Skip to content

Commit

Permalink
added member tier and plan to manage member screen
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed Jun 22, 2024
1 parent fcfe307 commit 1a88239
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 20 deletions.
2 changes: 2 additions & 0 deletions memberportal/api_admin_tools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ def get(self, request, member_id):
"cancelAt": s.cancel_at,
"cancelAtPeriodEnd": s.cancel_at_period_end,
"startDate": s.start_date,
"membershipTier": member.profile.membership_plan.member_tier.get_object(),
"membershipPlan": member.profile.membership_plan.get_object(),
}
else:
billing_info["subscription"] = None
Expand Down
2 changes: 2 additions & 0 deletions memberportal/api_billing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ def get(self, request):
"cancelAt": s.cancel_at,
"cancelAtPeriodEnd": s.cancel_at_period_end,
"startDate": s.start_date,
"membershipTier": request.user.profile.membership_plan.member_tier.get_object(),
"membershipPlan": request.user.profile.membership_plan.get_object(),
}
return Response({"success": True, "subscription": subscription})

Expand Down
82 changes: 63 additions & 19 deletions src-frontend/src/components/AdminTools/ManageMember.vue
Original file line number Diff line number Diff line change
Expand Up @@ -898,23 +898,61 @@
>
<thead>
<tr>
<th class="text-left">
{{ $t(`adminTools.membershipTier`) }}
</th>
<th class="text-left">
{{ $t(`adminTools.billingPlan`) }}
</th>
<th class="text-left">
{{ $t(`adminTools.billingCycleAnchor`) }}
</th>
<th class="text-left">{{ $t(`adminTools.startDate`) }}</th>
<th class="text-left">
{{ $t(`adminTools.currentPeriodEnd`) }}
</th>
<th v-if="billing.subscription.cancelAt" class="text-left">
{{ $t(`adminTools.cancelAt`) }}
</th>
<th v-if="billing.subscription.cancelAt" class="text-left">
{{ $t(`adminTools.cancelAtPeriodEnd`) }}
</th>
<template v-if="billing.subscription.cancelAt">
<th class="text-left">
{{ $t(`adminTools.cancelAt`) }}
</th>
<th class="text-left">
{{ $t(`adminTools.cancelAtPeriodEnd`) }}
</th>
</template>
</tr>
</thead>
<tbody>
<tr>
<td class="text-left">
<router-link
:to="{
name: 'manageTier',
params: {
planId: billing.subscription.membershipPlan.id,
},
}"
>{{
billing.subscription.membershipTier.name
}}</router-link
>
</td>
<td class="text-left">
{{
$t('paymentPlans.intervalDescription', {
currency:
billing.subscription.membershipPlan.currency.toUpperCase(),
amount: $n(
billing.subscription.membershipPlan.cost / 100,
'currency',
siteLocaleCurrency
),
interval: $tc(
`paymentPlans.interval.${billing.subscription.membershipPlan.interval.toLowerCase()}`,
billing.subscription.membershipPlan.intervalAmount
),
})
}}
</td>
<td class="text-left">
{{ formatDate(billing.subscription.billingCycleAnchor) }}
</td>
Expand All @@ -924,12 +962,18 @@
<td class="text-left">
{{ formatDate(billing.subscription.currentPeriodEnd) }}
</td>
<td v-if="billing.subscription.cancelAt" class="text-left">
{{ formatDate(billing.subscription.cancelAt) }}
</td>
<td v-if="billing.subscription.cancelAt" class="text-left">
{{ formatDate(billing.subscription.cancelAtPeriodEnd) }}
</td>
<template v-if="billing.subscription.cancelAt">
<td class="text-left">
{{ formatDate(billing.subscription.cancelAt) }}
</td>
<td class="text-left">
{{
formatBooleanYesNo(
billing.subscription.cancelAtPeriodEnd
)
}}
</td>
</template>
</tr>
</tbody>
</q-markup-table>
Expand Down Expand Up @@ -1643,13 +1687,13 @@ export default defineComponent({
max-width: 100%;
}
a,
a:visited,
a:hover,
a:active {
color: inherit;
text-decoration: none;
}
//a,
//a:visited,
//a:hover,
//a:active {
// color: inherit;
// text-decoration: none;
//}
.active {
color: green;
Expand Down
2 changes: 2 additions & 0 deletions src-frontend/src/i18n/en-AU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ export default {
cancelAt: 'Cancels At',
cancelAtPeriodEnd: 'Cancels At Period End',
currentPeriodEnd: 'Current Period End',
membershipTier: 'Membership Tier',
billingPlan: 'Billing Plan',
startDate: 'Start Date',
noSubscription: 'No subscription was found for this member.',
noMembers: 'No members were found that match your filter or search query.',
Expand Down
19 changes: 19 additions & 0 deletions src-frontend/src/types/subscriptions.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
interface MemberPlan {
id: number;
name: string;
currency: string;
cost: number;
intervalAmount: number;
interval: string;
}

interface MemberTier {
id: number;
name: string;
description: string;
featured: boolean;
plans: MemberPlan[];
}

interface MemberSubscription {
billingCycleAnchor: Date;
cancelAt: Date;
cancelAtPeriodEnd: boolean;
currentPeriodEnd: Date;
startDate: Date;
status: string;
membershipPlan: MemberPlan;
membershipTier: MemberTier;
}
3 changes: 2 additions & 1 deletion src-frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"@store/*": ["src/store/*"],
"@mixins/*": ["src/mixins/*"],
"@assets/*": ["src/assets/*"],
"types/*": ["src/types/*"]
"types/*": ["src/types/*"],
"boot/*": ["src/boot/*"],
}
},
"moduleResolution": "node"
Expand Down

0 comments on commit 1a88239

Please sign in to comment.