|
31 | 31 | const isTrial = |
32 | 32 | new Date($organization?.billingStartDate).getTime() - today.getTime() > 0 && |
33 | 33 | $organization?.billingTrialDays; /* number of trial days. */ |
| 34 | + $: isUpgrading = $organization?.status === 'upgrading'; |
34 | 35 |
|
35 | 36 | const extraUsage = currentInvoice ? currentInvoice.amount - currentPlan?.price : 0; |
36 | 37 | </script> |
|
41 | 42 | A breakdown of your estimated upcoming payment for the current billing period. Totals displayed |
42 | 43 | exclude accumulated credits and applicable taxes. |
43 | 44 | <svelte:fragment slot="aside"> |
44 | | - <p class="text u-bold"> |
45 | | - Due at: {toLocaleDate($organization?.billingNextInvoiceDate)} |
46 | | - </p> |
| 45 | + <Layout.Stack gap="xs"> |
| 46 | + <p class="text u-bold"> |
| 47 | + Due at: {toLocaleDate($organization?.billingNextInvoiceDate)} |
| 48 | + </p> |
| 49 | + </Layout.Stack> |
47 | 50 | <Card.Base variant="secondary" padding="s"> |
48 | 51 | <Layout.Stack> |
49 | 52 | <Layout.Stack direction="row" justifyContent="space-between"> |
|
165 | 168 | </Card.Base> |
166 | 169 | </svelte:fragment> |
167 | 170 | <svelte:fragment slot="actions"> |
168 | | - {#if !currentPlan.requiresPaymentMethod} |
169 | | - <div |
170 | | - class="u-flex u-flex-vertical-mobile u-cross-center u-gap-16 u-flex-wrap u-width-full-line u-main-end"> |
171 | | - {#if !currentPlan?.usagePerProject} |
172 | | - <Button text href={`${base}/organization-${$organization?.$id}/usage`}> |
173 | | - View estimated usage |
174 | | - </Button> |
175 | | - {/if} |
| 171 | + <div |
| 172 | + class="u-flex u-flex-vertical-mobile u-cross-center u-gap-16 u-flex-wrap u-width-full-line u-main-end"> |
| 173 | + <Tooltip disabled={!isUpgrading}> |
| 174 | + <div> |
| 175 | + {#if !currentPlan.requiresPaymentMethod} |
| 176 | + <Button |
| 177 | + disabled={$organization?.markedForDeletion || isUpgrading} |
| 178 | + href={getChangePlanUrl($organization?.$id)} |
| 179 | + on:click={() => |
| 180 | + trackEvent(Click.OrganizationClickUpgrade, { |
| 181 | + from: 'button', |
| 182 | + source: 'billing_tab' |
| 183 | + })}> |
| 184 | + Upgrade |
| 185 | + </Button> |
| 186 | + {:else if $organization?.billingPlanDowngrade !== null} |
| 187 | + <Button |
| 188 | + text |
| 189 | + disabled={isUpgrading} |
| 190 | + on:click={() => (showCancel = true)}> |
| 191 | + Cancel change |
| 192 | + </Button> |
| 193 | + {:else} |
| 194 | + <Button |
| 195 | + text |
| 196 | + disabled={$organization?.markedForDeletion || isUpgrading} |
| 197 | + href={getChangePlanUrl($organization?.$id)} |
| 198 | + on:click={() => |
| 199 | + trackEvent(Click.OrganizationClickUpgrade, { |
| 200 | + from: 'button', |
| 201 | + source: 'billing_tab' |
| 202 | + })}> |
| 203 | + Change plan |
| 204 | + </Button> |
| 205 | + {/if} |
| 206 | + </div> |
| 207 | + <svelte:fragment slot="tooltip"> |
| 208 | + Your payment is still being processed, check with your payment provider. |
| 209 | + </svelte:fragment> |
| 210 | + </Tooltip> |
| 211 | + {#if !currentPlan?.usagePerProject} |
176 | 212 | <Button |
177 | | - disabled={$organization?.markedForDeletion} |
178 | | - href={getChangePlanUrl($organization?.$id)} |
179 | | - on:click={() => |
180 | | - trackEvent(Click.OrganizationClickUpgrade, { |
181 | | - from: 'button', |
182 | | - source: 'billing_tab' |
183 | | - })}> |
184 | | - Upgrade |
| 213 | + text={!currentPlan.requiresPaymentMethod} |
| 214 | + secondary={currentPlan.requiresPaymentMethod} |
| 215 | + href={`${base}/organization-${$organization?.$id}/usage`}> |
| 216 | + View estimated usage |
185 | 217 | </Button> |
186 | | - </div> |
187 | | - {:else} |
188 | | - <div |
189 | | - class="u-flex u-flex-vertical-mobile u-cross-center u-gap-16 u-flex-wrap u-width-full-line u-main-end"> |
190 | | - {#if $organization?.billingPlanDowngrade !== null} |
191 | | - <Button text on:click={() => (showCancel = true)}>Cancel change</Button> |
192 | | - {:else} |
193 | | - <Button |
194 | | - text |
195 | | - disabled={$organization?.markedForDeletion} |
196 | | - href={getChangePlanUrl($organization?.$id)} |
197 | | - on:click={() => |
198 | | - trackEvent(Click.OrganizationClickUpgrade, { |
199 | | - from: 'button', |
200 | | - source: 'billing_tab' |
201 | | - })}> |
202 | | - Change plan |
203 | | - </Button> |
204 | | - {/if} |
205 | | - {#if !currentPlan?.usagePerProject} |
206 | | - <Button secondary href={`${base}/organization-${$organization?.$id}/usage`}> |
207 | | - View estimated usage |
208 | | - </Button> |
209 | | - {/if} |
210 | | - </div> |
211 | | - {/if} |
| 218 | + {/if} |
| 219 | + </div> |
212 | 220 | </svelte:fragment> |
213 | 221 | </CardGrid> |
214 | 222 | {/if} |
|
0 commit comments