fix: show trial plan based on is_trial_plan

This commit is contained in:
Shariq Ansari 2024-11-22 21:56:46 +05:30
parent ab0517a020
commit e4fb10e0d2
4 changed files with 10 additions and 13 deletions

View file

@ -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' ? '₹' : '$'

View file

@ -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: {

View file

@ -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),

View file

@ -40,7 +40,7 @@
v-if="column.key == 'price'"
class="text-base text-gray-900 font-semibold"
>
<span v-if="item.isTrial" class=""> Free trial </span>
<span v-if="row.isTrial" class=""> Free trial </span>
<span v-else>
<span>{{ item.currency }} {{ item.label }}</span>
<span class="text-gray-700 font-normal">/mo</span>
@ -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: [
{