diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte index 1975400bd..c0c5c2c55 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step1.svelte @@ -9,6 +9,7 @@ import { sdk } from '$lib/stores/sdk'; import type { OrganizationUsage } from '$lib/sdk/billing'; import type { Models } from '@appwrite.io/console'; + import { sizeToBytes } from '$lib/helpers/sizeConvertion'; let usage: OrganizationUsage = null; let members: Models.MembershipList = null; @@ -40,7 +41,10 @@ $changeOrganizationTier.limitOverflow = { bandwidth: usage.bandwidth[0] > plan.bandwidth ? usage.bandwidth[0] - plan.bandwidth : 0, - storage: usage.storage[0] > plan.storage ? usage.storage[0] - plan.storage : 0, + storage: + usage.storage[0] > sizeToBytes(plan.storage, 'GB') + ? usage.storage[0] - plan.storage + : 0, users: usage.users[0] > plan.users ? usage.users[0] - plan.users : 0, executions: usage.executions[0] > plan.executions ? usage.executions[0] - plan.executions : 0, diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step4.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step4.svelte index 5af929094..b641c13f0 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step4.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step4.svelte @@ -1,12 +1,29 @@ @@ -21,5 +38,90 @@ Changing your plan now will result in removal of organization members and more + + {#if $changeOrganizationTier?.limitOverflow?.members > 0} + {#if $changeOrganizationTier?.billingPlan === 'tier-0'} + The Starter plan has a limit of one organization member. By proceeding, all but the + creator of the organization admin will be removed. + {:else if $changeOrganizationTier?.billingPlan === 'tier-1'} + Additional organization members on the Pro plan cost {collaboratorPrice} per member per + billing period. By proceeding, you acknowledge your fees may increase in your next billing + period. + {/if} + {/if} + {#if $changeOrganizationTier?.limitOverflow?.bandwidth > 0 || $changeOrganizationTier?.limitOverflow?.executions > 0 || $changeOrganizationTier?.limitOverflow?.storage > 0 || $changeOrganizationTier?.limitOverflow?.users} + The Starter plan has a limit of one organization member. By proceeding, all but the + creator of the organization admin will be removed. Until you reduce your usage, you will + be unable to add to the resources listed below in all projects within your organization. + Your current billing cycle will end on {toLocaleDate( + $organization.billingCurrentInvoiceDate + )}. Any executions, bandwidth, or messaging usage will be reset at that time. + {/if} + + + + + + + + Resource + Free limit + Excess usage + + + {#if $changeOrganizationTier?.limitOverflow?.members} + + Organization members + {plan.members} members + +

+ + {$changeOrganizationTier.limitOverflow.members} members +

+
+
+ {/if} + {#if $changeOrganizationTier?.limitOverflow?.storage} + + Storage + {plan.storage} GB + +

+ + {humanFileSize($changeOrganizationTier.limitOverflow.storage)} +

+
+
+ {/if} + {#if $changeOrganizationTier?.limitOverflow?.executions} + + Function executions + + {abbreviateNumber(plan.executions)} executions + + +

+ + {$changeOrganizationTier.limitOverflow.executions} executions +

+
+
+ {/if} + {#if $changeOrganizationTier?.limitOverflow?.users} + + Users + + {abbreviateNumber(plan.users)} users + + +

+ + {$changeOrganizationTier.limitOverflow.users} users +

+
+
+ {/if} +
+
diff --git a/src/routes/console/wizard/cloudOrganizationChangeTier/step5.svelte b/src/routes/console/wizard/cloudOrganizationChangeTier/step5.svelte index 822728aac..6e098f2a0 100644 --- a/src/routes/console/wizard/cloudOrganizationChangeTier/step5.svelte +++ b/src/routes/console/wizard/cloudOrganizationChangeTier/step5.svelte @@ -14,7 +14,9 @@ const collaboratorsNumber = $changeOrganizationTier?.collaborators?.length ?? 0; const totalExpences = plan.price + collaboratorPrice * collaboratorsNumber; const today = new Date(); - const billingPayDate = new Date(today.getTime() + 44 * 24 * 60 * 60 * 1000); + $: billingPayDate = $isUpgrade + ? new Date(today.getTime() + 44 * 24 * 60 * 60 * 1000) + : $organization.billingCurrentInvoiceDate; let comment: string = null; async function fetchCard() {