File tree Expand file tree Collapse file tree 4 files changed +14
-7
lines changed
organization-[organization]/billing Expand file tree Collapse file tree 4 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 170170
171171 trackEvent (Submit .OrganizationCreate , {
172172 plan: tierToPlan (billingPlan )?.name ,
173- budget_cap_enabled: !! billingBudget ,
173+ budget_cap_enabled: billingBudget !== null ,
174174 members_invited: collaborators ?.length
175175 });
176176
Original file line number Diff line number Diff line change 11<script lang =" ts" >
22 import { Container } from ' $lib/layout' ;
33 import { organization } from ' $lib/stores/organization' ;
4- import BudgetAlert from ' ./budgetAlert.svelte' ;
54 import BudgetCap from ' ./budgetCap.svelte' ;
65 import PlanSummary from ' ./planSummary.svelte' ;
76 import BillingAddress from ' ./billingAddress.svelte' ;
128127 <BillingAddress billingAddress ={data ?.billingAddress } />
129128 <TaxId />
130129 <BudgetCap />
131- <BudgetAlert />
132130 <AvailableCredit />
133131</Container >
134132
Original file line number Diff line number Diff line change 2020 import { sdk } from ' $lib/stores/sdk' ;
2121 import { onMount } from ' svelte' ;
2222
23+ export let alertsEnabled = false ;
24+
2325 let search: string ;
2426 let selectedAlert: number ;
2527 let alerts: number [] = [];
7476 }
7577 }
7678
77- $ : isButtonDisabled = symmetricDifference (alerts , $organization .budgetAlerts ).length === 0 ;
79+ $ : isButtonDisabled =
80+ symmetricDifference (alerts , $organization .budgetAlerts ).length === 0 || ! alertsEnabled ;
7881 </script >
7982
8083<Form onSubmit ={updateBudget }>
107110
108111 <div class =" u-flex u-gap-16" >
109112 <InputSelectSearch
113+ disabled ={! alertsEnabled }
110114 label =" Percentage (%) of budget cap"
111115 placeholder =" Select a percentage"
112116 id =" alerts"
118122 <div style =" align-self: flex-end" >
119123 <Button
120124 secondary
121- disabled ={alerts .length > 3 || (! search && ! selectedAlert )}
125+ disabled ={alerts .length > 3 ||
126+ (! search && ! selectedAlert ) ||
127+ ! alertsEnabled }
122128 on:click ={addAlert }>
123129 Add alert
124130 </Button >
Original file line number Diff line number Diff line change 99 import { organization , currentPlan } from ' $lib/stores/organization' ;
1010 import { sdk } from ' $lib/stores/sdk' ;
1111 import { onMount } from ' svelte' ;
12+ import BudgetAlert from ' ./budgetAlert.svelte' ;
1213
1314 let capActive = false ;
1415 let budget: number ;
1516
1617 onMount (() => {
1718 budget = $organization ?.billingBudget ;
18- capActive = !! $organization ?.billingBudget ;
19+ capActive = $organization ?.billingBudget !== null ;
1920 });
2021
2122 async function updateBudget() {
4445 }
4546
4647 $ : if (! capActive ) {
47- budget = 0 ;
48+ budget = null ;
4849 }
4950 </script >
5051
113114 </svelte:fragment >
114115 </CardGrid >
115116</Form >
117+
118+ <BudgetAlert alertsEnabled ={capActive && budget > 0 } />
You can’t perform that action at this time.
0 commit comments