From 5894eb8885f9bd5b92bfe37bbc4ca7082cccb632 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 7 May 2024 16:10:05 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20create=20org=20wizard=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/billing/paymentModal.svelte | 1 + .../billing/selectPaymentMethod.svelte | 39 +++++- src/lib/elements/forms/form.svelte | 12 +- .../elements/forms/inputSelectSearch.svelte | 4 +- .../console/create-organization/+page.svelte | 123 +++++++++++------- .../console/create-organization/store.ts | 28 ---- 6 files changed, 126 insertions(+), 81 deletions(-) delete mode 100644 src/routes/console/create-organization/store.ts diff --git a/src/lib/components/billing/paymentModal.svelte b/src/lib/components/billing/paymentModal.svelte index 2ac93e0b2..2b5ef5d1b 100644 --- a/src/lib/components/billing/paymentModal.svelte +++ b/src/lib/components/billing/paymentModal.svelte @@ -70,6 +70,7 @@ + - import { Button, InputSelectSearch } from '$lib/elements/forms'; + import { Button, InputChoice, InputSelectSearch, InputText } from '$lib/elements/forms'; import type { PaymentList, PaymentMethodData } from '$lib/sdk/billing'; import { sdk } from '$lib/stores/sdk'; import { hasStripePublicKey, isCloud } from '$lib/system'; import { onMount } from 'svelte'; import { Card, CreditCardBrandImage } from '..'; import PaymentModal from './paymentModal.svelte'; + import { capitalize } from '$lib/helpers/string'; export let methods: PaymentList; export let value: string; + export let taxId = ''; + let showTaxId = false; let showPaymentModal = false; async function cardSaved(event: CustomEvent) { @@ -35,21 +38,34 @@ options={filteredMethods.map((method) => { return { value: method.$id, - label: `ending in ${method.last4}`, + label: `${capitalize(method.brand)} ending in ${method.last4}`, data: [method.brand] }; })} interactiveOutput let:option={o}> + + + + + + {o.label} + + + + + + + - {o.data} {o.label} + {o.label} - + -

- Credits applied -

+ {#if couponData.credits > 100} +

+ Credits applied +

+ {:else} + -{formatCurrency(couponData.credits)} + {/if} {/if}
@@ -298,7 +326,7 @@ @@ -321,7 +349,12 @@ - + diff --git a/src/routes/console/create-organization/store.ts b/src/routes/console/create-organization/store.ts deleted file mode 100644 index 613259fe0..000000000 --- a/src/routes/console/create-organization/store.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { BillingPlan } from '$lib/constants'; -import type { WizardStepsType } from '$lib/layout/wizard.svelte'; -import type { Tier } from '$lib/stores/billing'; -import { writable } from 'svelte/store'; - -export const createOrgSteps = writable(new Map()); -export const createOrganizationFinalAction = writable('Start trial'); - -export const createOrganization = writable<{ - id?: string; - name: string; - billingPlan: Tier; - paymentMethodId: string; - billingAddressId: string; - collaborators?: string[]; - billingBudget?: number; - taxId?: string; - couponCode?: string; -}>({ - id: null, - name: null, - billingPlan: BillingPlan.PRO, - paymentMethodId: null, - collaborators: [], - billingAddressId: null, - taxId: null, - couponCode: null -});