- + (showDropdown = !showDropdown)}> diff --git a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte index 4d355b397..b6a5359a0 100644 --- a/src/routes/console/organization-[organization]/billing/paymentHistory.svelte +++ b/src/routes/console/organization-[organization]/billing/paymentHistory.svelte @@ -53,16 +53,17 @@ {#if $invoiceList.total} - Date + Due Date Status Amount Due Invoce # - + {#each $invoiceList?.invoices as invoice, i} - {toLocaleDate(invoice.from)} + {toLocaleDate(invoice.dueAt)} {invoice.status} diff --git a/src/routes/console/organization-[organization]/billing/paymentMethods.svelte b/src/routes/console/organization-[organization]/billing/paymentMethods.svelte index cdcaae7be..362acf7bf 100644 --- a/src/routes/console/organization-[organization]/billing/paymentMethods.svelte +++ b/src/routes/console/organization-[organization]/billing/paymentMethods.svelte @@ -133,7 +133,7 @@ - + (showDropdown = !showDropdown)}> @@ -167,7 +167,7 @@ - + diff --git a/src/routes/console/wizard/cloudOrganization/step2.svelte b/src/routes/console/wizard/cloudOrganization/step2.svelte index d17eb341c..58941023c 100644 --- a/src/routes/console/wizard/cloudOrganization/step2.svelte +++ b/src/routes/console/wizard/cloudOrganization/step2.svelte @@ -79,20 +79,20 @@ }); console.log(clientSecret); if (!clientSecret) { - console.log('test2'); paymentMethod = await sdk.forConsole.billing.createPaymentMethod(); + clientSecret = paymentMethod.clientSecret; } - const { setupIntent } = await stripe.retrieveSetupIntent(paymentMethod.clientSecret); + const { setupIntent } = await stripe.retrieveSetupIntent(clientSecret); if (setupIntent && setupIntent.status === 'succeeded') { await sdk.forConsole.billing.setOrganizationPaymentMethod( - $organization.$id, + $createOrganization.id, paymentMethod.$id ); await invalidate(Dependencies.PAYMENT_METHODS); console.log('test'); // const paymentElement = elements.getElement('payment'); // paymentElement.destroy(); - } else console.log('test2'); + } else console.log('something went wrong'); } catch (e) { console.log(e); // trackError(StripeError, Submit.ProjectCreate); diff --git a/src/routes/console/wizard/cloudOrganization/store.ts b/src/routes/console/wizard/cloudOrganization/store.ts index a376bdc55..47a40647a 100644 --- a/src/routes/console/wizard/cloudOrganization/store.ts +++ b/src/routes/console/wizard/cloudOrganization/store.ts @@ -2,16 +2,7 @@ import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; -export const stepsComponents = writable(new Map()); - -export function updateComponentStatus(map: WizardStepsType, key: number, status: boolean) { - const updatedComponent = { - ...map.get(key), - disabled: status - }; - map.set(key, updatedComponent); - return map; -} +export const createOrgSteps = writable(new Map()); export const createOrganization = writable<{ id?: string; diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte index 498d56068..92b7b019b 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte @@ -4,7 +4,21 @@ import { WizardStep } from '$lib/layout'; import { tierFree, tierPro, tierScale } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; - import { changeOrganizationTier } from './store'; + import { updateStepStatus } from '$lib/stores/wizard'; + import { changeOrganizationTier, changeTierSteps } from './store'; + + $: if ($changeOrganizationTier.billingPlan === 'tier-0') { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, true); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, true); + } + + $: if ( + $changeOrganizationTier.billingPlan === 'tier-2' || + $changeOrganizationTier.billingPlan === 'tier-1' + ) { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, false); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, false); + } @@ -81,4 +95,6 @@ {/if} + + {#if $organization.billingPlan === 'tier-0'}tesr{/if} diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts index a904e471d..4223b6b06 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts @@ -1,6 +1,9 @@ +import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; +export const changeTierSteps = writable(new Map()); + export const changeOrganizationTier = writable<{ id?: string; billingPlan: Tier;
- + (showDropdown = !showDropdown)}> @@ -167,7 +167,7 @@ - + diff --git a/src/routes/console/wizard/cloudOrganization/step2.svelte b/src/routes/console/wizard/cloudOrganization/step2.svelte index d17eb341c..58941023c 100644 --- a/src/routes/console/wizard/cloudOrganization/step2.svelte +++ b/src/routes/console/wizard/cloudOrganization/step2.svelte @@ -79,20 +79,20 @@ }); console.log(clientSecret); if (!clientSecret) { - console.log('test2'); paymentMethod = await sdk.forConsole.billing.createPaymentMethod(); + clientSecret = paymentMethod.clientSecret; } - const { setupIntent } = await stripe.retrieveSetupIntent(paymentMethod.clientSecret); + const { setupIntent } = await stripe.retrieveSetupIntent(clientSecret); if (setupIntent && setupIntent.status === 'succeeded') { await sdk.forConsole.billing.setOrganizationPaymentMethod( - $organization.$id, + $createOrganization.id, paymentMethod.$id ); await invalidate(Dependencies.PAYMENT_METHODS); console.log('test'); // const paymentElement = elements.getElement('payment'); // paymentElement.destroy(); - } else console.log('test2'); + } else console.log('something went wrong'); } catch (e) { console.log(e); // trackError(StripeError, Submit.ProjectCreate); diff --git a/src/routes/console/wizard/cloudOrganization/store.ts b/src/routes/console/wizard/cloudOrganization/store.ts index a376bdc55..47a40647a 100644 --- a/src/routes/console/wizard/cloudOrganization/store.ts +++ b/src/routes/console/wizard/cloudOrganization/store.ts @@ -2,16 +2,7 @@ import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; -export const stepsComponents = writable(new Map()); - -export function updateComponentStatus(map: WizardStepsType, key: number, status: boolean) { - const updatedComponent = { - ...map.get(key), - disabled: status - }; - map.set(key, updatedComponent); - return map; -} +export const createOrgSteps = writable(new Map()); export const createOrganization = writable<{ id?: string; diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte index 498d56068..92b7b019b 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte @@ -4,7 +4,21 @@ import { WizardStep } from '$lib/layout'; import { tierFree, tierPro, tierScale } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; - import { changeOrganizationTier } from './store'; + import { updateStepStatus } from '$lib/stores/wizard'; + import { changeOrganizationTier, changeTierSteps } from './store'; + + $: if ($changeOrganizationTier.billingPlan === 'tier-0') { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, true); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, true); + } + + $: if ( + $changeOrganizationTier.billingPlan === 'tier-2' || + $changeOrganizationTier.billingPlan === 'tier-1' + ) { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, false); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, false); + } @@ -81,4 +95,6 @@ {/if} + + {#if $organization.billingPlan === 'tier-0'}tesr{/if} diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts index a904e471d..4223b6b06 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts @@ -1,6 +1,9 @@ +import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; +export const changeTierSteps = writable(new Map()); + export const changeOrganizationTier = writable<{ id?: string; billingPlan: Tier;
- + diff --git a/src/routes/console/wizard/cloudOrganization/step2.svelte b/src/routes/console/wizard/cloudOrganization/step2.svelte index d17eb341c..58941023c 100644 --- a/src/routes/console/wizard/cloudOrganization/step2.svelte +++ b/src/routes/console/wizard/cloudOrganization/step2.svelte @@ -79,20 +79,20 @@ }); console.log(clientSecret); if (!clientSecret) { - console.log('test2'); paymentMethod = await sdk.forConsole.billing.createPaymentMethod(); + clientSecret = paymentMethod.clientSecret; } - const { setupIntent } = await stripe.retrieveSetupIntent(paymentMethod.clientSecret); + const { setupIntent } = await stripe.retrieveSetupIntent(clientSecret); if (setupIntent && setupIntent.status === 'succeeded') { await sdk.forConsole.billing.setOrganizationPaymentMethod( - $organization.$id, + $createOrganization.id, paymentMethod.$id ); await invalidate(Dependencies.PAYMENT_METHODS); console.log('test'); // const paymentElement = elements.getElement('payment'); // paymentElement.destroy(); - } else console.log('test2'); + } else console.log('something went wrong'); } catch (e) { console.log(e); // trackError(StripeError, Submit.ProjectCreate); diff --git a/src/routes/console/wizard/cloudOrganization/store.ts b/src/routes/console/wizard/cloudOrganization/store.ts index a376bdc55..47a40647a 100644 --- a/src/routes/console/wizard/cloudOrganization/store.ts +++ b/src/routes/console/wizard/cloudOrganization/store.ts @@ -2,16 +2,7 @@ import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; -export const stepsComponents = writable(new Map()); - -export function updateComponentStatus(map: WizardStepsType, key: number, status: boolean) { - const updatedComponent = { - ...map.get(key), - disabled: status - }; - map.set(key, updatedComponent); - return map; -} +export const createOrgSteps = writable(new Map()); export const createOrganization = writable<{ id?: string; diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte index 498d56068..92b7b019b 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte @@ -4,7 +4,21 @@ import { WizardStep } from '$lib/layout'; import { tierFree, tierPro, tierScale } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; - import { changeOrganizationTier } from './store'; + import { updateStepStatus } from '$lib/stores/wizard'; + import { changeOrganizationTier, changeTierSteps } from './store'; + + $: if ($changeOrganizationTier.billingPlan === 'tier-0') { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, true); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, true); + } + + $: if ( + $changeOrganizationTier.billingPlan === 'tier-2' || + $changeOrganizationTier.billingPlan === 'tier-1' + ) { + $changeTierSteps = updateStepStatus($changeTierSteps, 2, false); + $changeTierSteps = updateStepStatus($changeTierSteps, 3, false); + } @@ -81,4 +95,6 @@ {/if} + + {#if $organization.billingPlan === 'tier-0'}tesr{/if} diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts index a904e471d..4223b6b06 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/store.ts @@ -1,6 +1,9 @@ +import type { WizardStepsType } from '$lib/layout/wizard.svelte'; import type { Tier } from '$lib/stores/billing'; import { writable } from 'svelte/store'; +export const changeTierSteps = writable(new Map()); + export const changeOrganizationTier = writable<{ id?: string; billingPlan: Tier;