mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix plan selection
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
export let isNewOrg = false;
|
||||
export let selfService = true;
|
||||
|
||||
$: isBasePlan = BASE_BILLING_PLANS.includes($currentPlan?.$id);
|
||||
$: plans = Object.values(page.data.plans.plans) as Plan[];
|
||||
$: currentPlanInList = plans.filter((plan) => plan.$id === $currentPlan?.$id).length > 0;
|
||||
</script>
|
||||
|
||||
<Layout.Stack>
|
||||
@@ -41,7 +41,7 @@
|
||||
</Typography.Text>
|
||||
</LabelCard>
|
||||
{/each}
|
||||
{#if $currentPlan && !isBasePlan}
|
||||
{#if $currentPlan && !currentPlanInList}
|
||||
<LabelCard
|
||||
name="plan"
|
||||
bind:group={billingPlan}
|
||||
|
||||
@@ -91,8 +91,9 @@
|
||||
if ($currentPlan?.$id === BillingPlan.SCALE) {
|
||||
selectedPlan = BillingPlan.SCALE;
|
||||
} else {
|
||||
selectedPlan = BillingPlan.PRO;
|
||||
selectedPlan = $currentPlan?.$id as BillingPlan || BillingPlan.FREE;
|
||||
}
|
||||
console.log('Selected plan:', selectedPlan);
|
||||
});
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -247,8 +248,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
$: isUpgrade = $plansInfo.get(selectedPlan).order > $currentPlan?.order;
|
||||
$: isDowngrade = $plansInfo.get(selectedPlan).order < $currentPlan?.order;
|
||||
$: isUpgrade = $plansInfo.get(selectedPlan)?.order > $currentPlan?.order;
|
||||
$: isDowngrade = $plansInfo.get(selectedPlan)?.order < $currentPlan?.order;
|
||||
$: isButtonDisabled = $organization?.billingPlan === selectedPlan;
|
||||
</script>
|
||||
|
||||
|
||||
@@ -8,9 +8,10 @@ export const load: PageLoad = async ({ depends, parent, url }) => {
|
||||
const { members, organization, currentPlan, organizations } = await parent();
|
||||
depends(Dependencies.UPGRADE_PLAN);
|
||||
|
||||
const [coupon, paymentMethods] = await Promise.all([
|
||||
const [coupon, paymentMethods, plans] = await Promise.all([
|
||||
getCoupon(url),
|
||||
sdk.forConsole.billing.listPaymentMethods()
|
||||
sdk.forConsole.billing.listPaymentMethods(),
|
||||
sdk.forConsole.billing.listPlans()
|
||||
]);
|
||||
|
||||
let plan = getPlanFromUrl(url);
|
||||
@@ -29,6 +30,7 @@ export const load: PageLoad = async ({ depends, parent, url }) => {
|
||||
return {
|
||||
members,
|
||||
plan,
|
||||
plans,
|
||||
coupon,
|
||||
selfService,
|
||||
hasFreeOrgs,
|
||||
|
||||
Reference in New Issue
Block a user