diff --git a/src/lib/layout/wizardSecondaryContent.svelte b/src/lib/layout/wizardSecondaryContent.svelte index 908995692..f4e9ea882 100644 --- a/src/lib/layout/wizardSecondaryContent.svelte +++ b/src/lib/layout/wizardSecondaryContent.svelte @@ -1,9 +1,15 @@ + +
-
-
- -
+ {#if !hideSidebar} +
+
+ +
+ {/if}
diff --git a/src/routes/(console)/apply-credit/+page.svelte b/src/routes/(console)/apply-credit/+page.svelte index 2c4137270..12380757e 100644 --- a/src/routes/(console)/apply-credit/+page.svelte +++ b/src/routes/(console)/apply-credit/+page.svelte @@ -13,7 +13,7 @@ import { app } from '$lib/stores/app'; import { addNotification } from '$lib/stores/notifications'; import { organizationList, type Organization } from '$lib/stores/organization'; - import { ID } from '@appwrite.io/console'; + import { BillingPlan, ID } from '@appwrite.io/console'; import { onMount } from 'svelte'; import { writable } from 'svelte/store'; import { CreditsApplied } from '$lib/components/billing'; @@ -59,6 +59,10 @@ $: selectedAction = selectedOrgId === newOrgId ? 'create' : 'update'; onMount(async () => { + if (!$organizationList?.total && couponData?.code) { + goto(`${base}/create-organization?coupon=${couponData.code}&plan=${BillingPlan.Tier1}`); + } + if (!$organizationList?.total || campaign?.onlyNewOrgs) { selectedOrgId = newOrgId; } @@ -134,7 +138,7 @@ Apply credits - +
{#if $organizationList?.total && !campaign?.onlyNewOrgs && canSelectOrg} @@ -147,6 +151,59 @@ id="organization" /> {/if} + + {#if !$organizationList?.total} + {#if campaign?.template === 'card'} +
+
+
+ promo +

+ {#if couponData?.credits} + {campaign.title.replace( + 'VALUE', + couponData.credits.toString() + )} + {:else} + {campaign.title} + {/if} +

+
+
+ {/if} + +
+ {#if couponData?.code && couponData?.status === 'active'} + {@const dateAvailable = selectedOrg?.billingNextInvoiceDate} + +

+ {#if !dateAvailable} + Credits will automatically be applied to your next invoice. + {:else} + Credits will automatically be applied to your next invoice on {toLocaleDate(selectedOrg?.billingNextInvoiceDate)}. + {/if} +

+ {:else} +

+ Add a coupon code to apply credits to your organization. +

+ {/if} +
+ {/if} + {#if campaign?.plan && selectedOrg && selectedOrg.billingPlan !== campaign?.plan} This coupon code is only valid when upgrading to Scale plan. @@ -214,13 +271,14 @@ {#if $isSubmitting}