From e4fb10e0d270c7056d81ec37628889957db42e1c Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Fri, 22 Nov 2024 21:56:46 +0530 Subject: [PATCH] fix: show trial plan based on is_trial_plan --- billing/src/components/AppSidebar.vue | 2 +- billing/src/pages/Cards.vue | 6 +++--- billing/src/pages/Invoices.vue | 4 ++-- billing/src/pages/Plans.vue | 11 ++++------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/billing/src/components/AppSidebar.vue b/billing/src/components/AppSidebar.vue index 5d9b453602..1c3e364c00 100644 --- a/billing/src/components/AppSidebar.vue +++ b/billing/src/components/AppSidebar.vue @@ -94,7 +94,7 @@ async function openSupport() { 'frappe.integrations.frappe_providers.frappecloud_billing.api', { method: 'site.get_first_support_plan', - }, + } ) if (!supportPlan) return let currency = team.data.currency == 'INR' ? '₹' : '$' diff --git a/billing/src/pages/Cards.vue b/billing/src/pages/Cards.vue index 5ae5204a41..be52b1584b 100644 --- a/billing/src/pages/Cards.vue +++ b/billing/src/pages/Cards.vue @@ -167,7 +167,7 @@ const rows = computed(() => { ? h(FeatherIcon, { name: 'check-circle', class: 'h-4 w-4 text-green-600', - }) + }) : null, alert: card.is_default && card.stripe_payment_method @@ -180,8 +180,8 @@ const rows = computed(() => { h(FeatherIcon, { name: 'alert-circle', class: 'h-4 w-4 text-red-600', - }), - ) + }) + ) : null, creation: useTimeAgo(card.creation).value, actions: { diff --git a/billing/src/pages/Invoices.vue b/billing/src/pages/Invoices.vue index b514e81807..87a515cc70 100644 --- a/billing/src/pages/Invoices.vue +++ b/billing/src/pages/Invoices.vue @@ -149,8 +149,8 @@ const rows = computed(() => { invoice.status === 'Paid' ? 'green' : invoice.status == 'Unpaid' - ? 'orange' - : 'gray', + ? 'orange' + : 'gray', }, due_date: due_date, total: formatCurrency(invoice.total), diff --git a/billing/src/pages/Plans.vue b/billing/src/pages/Plans.vue index 566c05a980..3c39d5bf4c 100644 --- a/billing/src/pages/Plans.vue +++ b/billing/src/pages/Plans.vue @@ -40,7 +40,7 @@ v-if="column.key == 'price'" class="text-base text-gray-900 font-semibold" > - Free trial + Free trial {{ item.currency }} {{ item.label }} /mo @@ -164,7 +164,6 @@ const rows = computed(() => { name: plan.name, price: { label: price.toString(), - isTrial: plan.name === 'Trial', currency: currency.value === 'INR' ? '₹' : '$', }, cpu: `${plan.cpu_time_per_day} ${cpu}`, @@ -172,15 +171,13 @@ const rows = computed(() => { disk: `${parseSize(plan.max_storage_usage)} Disk`, info: plan, isCurrent: plan.name === currentPlan.value, + isTrial: plan.is_trial_plan, downgradable: plan.allow_downgrading_from_other_plan, downgrade: currentPlanIndex > i, onClick: () => changePlan(plan, price.toString()), } }) - .filter( - (row) => - row.name !== 'Trial' || (row.name === 'Trial' && row.name === currentPlan.value), - ) + .filter((row) => !row.isTrial || (row.isTrial && row.name === currentPlan.value)) }) const defaultStep = ref(1) @@ -206,7 +203,7 @@ function changePlan(_plan, price) { createDialog({ title: 'Change plan', component: markRaw( - h(ConfirmMessage, { price, currency: currency.value === 'INR' ? '₹' : '$' }), + h(ConfirmMessage, { price, currency: currency.value === 'INR' ? '₹' : '$' }) ), actions: [ {