Skip to content

Commit 8f522fa

Browse files
kushthedudeiamareebjamal
authored andcommitted
feat: Billing Information Enhancements and Updations (#3654)
* Billing Information Enhancements and Updations * Shortening the function * Removing duplications * REmoving the field checking into template
1 parent 05ea12b commit 8f522fa

File tree

6 files changed

+73
-48
lines changed

6 files changed

+73
-48
lines changed

app/components/forms/orders/order-form.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ export default Component.extend(FormMixin, {
3838
}),
3939
sameAsBuyer: false,
4040

41+
isBillingInfoNeeded: computed('event', 'data.isBillingEnabled', function() {
42+
return this.event.isBillingInfoMandatory || this.data.isBillingEnabled;
43+
}),
44+
4145
getRemainingTime: computed('settings', function() {
4246
let orderExpiryTime = this.get('settings.orderExpiryTime');
4347
let willExpireAt = this.get('data.createdAt').add(orderExpiryTime, 'minutes');
@@ -380,12 +384,12 @@ export default Component.extend(FormMixin, {
380384
}
381385
]
382386
},
383-
company: {
384-
identifier : 'company',
387+
taxBusinessInfo: {
388+
identifier : 'taxBusinessInfo',
385389
rules : [
386390
{
387391
type : 'empty',
388-
prompt : this.l10n.t('Please enter your company')
392+
prompt : this.l10n.t('Please enter your Tax ID or Business ID')
389393
}
390394
]
391395
},
@@ -490,4 +494,4 @@ export default Component.extend(FormMixin, {
490494
}
491495
}
492496
}
493-
});
497+
});

app/models/event.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default ModelBase.extend(CustomPrimaryKeyMixin, {
5050
isTicketFormEnabled : attr('boolean', { defaultValue: false }),
5151
isSessionsSpeakersEnabled : attr('boolean', { defaultValue: false }),
5252
isFeatured : attr('boolean', { defaultValue: false }),
53+
isBillingInfoMandatory : attr('boolean', { defaultValue: false }),
5354

5455
isTaxEnabled : attr('boolean', { defaultValue: false }),
5556
canPayByPaypal : attr('boolean', { defaultValue: false }),

app/templates/components/forms/orders/order-form.hbs

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -81,52 +81,23 @@
8181
{{/if}}
8282
{{/each}}
8383
{{/each}}
84+
8485
{{#if isPaidOrder}}
8586
<h4 class="ui horizontal divider header">
8687
<i class="ticket icon"></i>
8788
{{t 'Billing Information'}}
8889
</h4>
89-
<div class="field">
90-
<label class="required" for="company">{{t 'Company'}}</label>
91-
{{input type='text' id='company' value=data.company}}
92-
</div>
93-
<div class="field">
94-
<label for="taxBusinessInfo">{{t 'Tax ID or Business ID'}}</label>
95-
{{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}}
96-
</div>
97-
<div class="field">
98-
<label class="required" for="address">{{t 'Address'}}</label>
99-
{{textarea rows='2' id='address' value=data.address}}
100-
</div>
101-
<div class="field">
102-
<label class="required" for="city">{{t 'City'}}</label>
103-
{{input type='text' id='city' value=data.city}}
104-
</div>
105-
<div class="field">
106-
<label for="state">{{t 'State/Province'}}</label>
107-
{{input type='text' id='state' value=data.state}}
108-
</div>
109-
<div class="field">
110-
<label class="required" for="zipcode">{{t 'Zip Code'}}</label>
111-
{{input type='text' id='zip_code' value=data.zipcode}}
112-
</div>
113-
<div class="field">
114-
<label class="required">{{t 'Select country'}}</label>
115-
{{#ui-dropdown class="search selection" selected=data.country
116-
onChange=(action (mut data.country)) as |execute mapper|}}
117-
{{input type='hidden' id='country' value=data.country}}
118-
<div class="default text">{{t 'Select country'}}</div>
119-
<i class="dropdown icon"></i>
120-
<div class="menu">
121-
{{#each countries as |country|}}
122-
<div data-value="{{map-value mapper country.name}}" class="item">
123-
<i class="{{lowercase country.code}} flag"></i>
124-
{{country.name}}
125-
</div>
126-
{{/each}}
127-
</div>
128-
{{/ui-dropdown}}
129-
</div>
90+
{{#unless this.event.isBillingInfoMandatory}}
91+
<div class="ui center aligned field">
92+
{{ui-checkbox label=(t 'Enable Billing Information') checked=data.isBillingEnabled
93+
onChange=(action (mut data.isBillingEnabled))}}
94+
</div>
95+
{{/unless}}
96+
{{#if isBillingInfoNeeded}}
97+
{{widgets/forms/billing-info
98+
data=data
99+
event=event}}
100+
{{/if}}
130101
<h4 class="ui horizontal divider header">
131102
<i class="ticket icon"></i>
132103
{{t 'Payment Method'}}

app/templates/components/forms/wizard/basic-details-step.hbs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,18 @@
492492
{{t 'Add Tax Information'}}
493493
</button>
494494
{{/if}}
495+
<div class="ui hidden divider"></div>
496+
<div class="field">
497+
<div class="ui radio checkbox">
498+
{{input type='checkbox' id='billing_info_mandatory' checked=data.event.isBillingInfoMandatory}}
499+
<label for="billing_info">
500+
<strong>{{t 'Billing Info'}}:</strong>
501+
{{t 'Require Billing Information from Ticket Buyer'}}
502+
</label>
503+
</div>
504+
</div>
495505
</div>
496-
497506
</div>
498-
499507
{{/if}}
500508
<div class="ui section divider"></div>
501509
<div class="grouped fields">
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<div class="field">
2+
<label class="required" for="company">{{t 'Company'}}</label>
3+
{{input type='text' id='company' value=data.company}}
4+
</div>
5+
<div class="field">
6+
<label for="taxBusinessInfo">{{t 'Tax ID or Business ID'}}</label>
7+
{{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}}
8+
</div>
9+
<div class="field">
10+
<label class="required" for="address">{{t 'Address'}}</label>
11+
{{textarea rows='2' id='address' value=data.address}}
12+
</div>
13+
<div class="field">
14+
<label class="required" for="city">{{t 'City'}}</label>
15+
{{input type='text' id='city' value=data.city}}
16+
</div>
17+
<div class="field">
18+
<label for="state">{{t 'State/Province'}}</label>
19+
{{input type='text' id='state' value=data.state}}
20+
</div>
21+
<div class="field">
22+
<label class="required" for="zipcode">{{t 'Zip Code'}}</label>
23+
{{input type='text' id='zip_code' value=data.zipcode}}
24+
</div>
25+
<div class="field">
26+
<label class="required">{{t 'Select country'}}</label>
27+
{{#ui-dropdown class="search selection" selected=data.country
28+
onChange=(action (mut data.country)) as |execute mapper|}}
29+
{{input type='hidden' id='country' value=data.country}}
30+
<div class="default text">{{t 'Select country'}}</div>
31+
<i class="dropdown icon"></i>
32+
<div class="menu">
33+
{{#each countries as |country|}}
34+
<div data-value="{{map-value mapper country.name}}" class="item">
35+
<i class="{{lowercase country.code}} flag"></i>
36+
{{country.name}}
37+
</div>
38+
{{/each}}
39+
</div>
40+
{{/ui-dropdown}}
41+
</div>

app/templates/orders/new.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</div>
2929
<div class="row">
3030
<div class="ten wide column">
31-
{{forms/orders/order-form save='save' data=model.order fields=model.form settings=settings}}
31+
{{forms/orders/order-form save='save' data=model.order event=model.event fields=model.form settings=settings}}
3232
</div>
3333
<div class="six wide column">
3434
{{#if model.order.event.ownerName}}

0 commit comments

Comments
 (0)