diff --git a/app/components/forms/orders/order-form.js b/app/components/forms/orders/order-form.js index bd3d2e7c52b..8dead19d533 100644 --- a/app/components/forms/orders/order-form.js +++ b/app/components/forms/orders/order-form.js @@ -38,6 +38,10 @@ export default Component.extend(FormMixin, { }), sameAsBuyer: false, + isBillingInfoNeeded: computed('event', 'data.isBillingEnabled', function() { + return this.event.isBillingInfoMandatory || this.data.isBillingEnabled; + }), + getRemainingTime: computed('settings', function() { let orderExpiryTime = this.get('settings.orderExpiryTime'); let willExpireAt = this.get('data.createdAt').add(orderExpiryTime, 'minutes'); @@ -380,12 +384,12 @@ export default Component.extend(FormMixin, { } ] }, - company: { - identifier : 'company', + taxBusinessInfo: { + identifier : 'taxBusinessInfo', rules : [ { type : 'empty', - prompt : this.l10n.t('Please enter your company') + prompt : this.l10n.t('Please enter your Tax ID or Business ID') } ] }, @@ -490,4 +494,4 @@ export default Component.extend(FormMixin, { } } } -}); \ No newline at end of file +}); diff --git a/app/models/event.js b/app/models/event.js index d11fdb030f8..2b87426c44f 100644 --- a/app/models/event.js +++ b/app/models/event.js @@ -50,6 +50,7 @@ export default ModelBase.extend(CustomPrimaryKeyMixin, { isTicketFormEnabled : attr('boolean', { defaultValue: false }), isSessionsSpeakersEnabled : attr('boolean', { defaultValue: false }), isFeatured : attr('boolean', { defaultValue: false }), + isBillingInfoMandatory : attr('boolean', { defaultValue: false }), isTaxEnabled : attr('boolean', { defaultValue: false }), canPayByPaypal : attr('boolean', { defaultValue: false }), diff --git a/app/templates/components/forms/orders/order-form.hbs b/app/templates/components/forms/orders/order-form.hbs index bcabc8b30c7..d202979b48a 100644 --- a/app/templates/components/forms/orders/order-form.hbs +++ b/app/templates/components/forms/orders/order-form.hbs @@ -81,52 +81,23 @@ {{/if}} {{/each}} {{/each}} + {{#if isPaidOrder}}

{{t 'Billing Information'}}

-
- - {{input type='text' id='company' value=data.company}} -
-
- - {{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}} -
-
- - {{textarea rows='2' id='address' value=data.address}} -
-
- - {{input type='text' id='city' value=data.city}} -
-
- - {{input type='text' id='state' value=data.state}} -
-
- - {{input type='text' id='zip_code' value=data.zipcode}} -
-
- - {{#ui-dropdown class="search selection" selected=data.country - onChange=(action (mut data.country)) as |execute mapper|}} - {{input type='hidden' id='country' value=data.country}} -
{{t 'Select country'}}
- - - {{/ui-dropdown}} -
+ {{#unless this.event.isBillingInfoMandatory}} +
+ {{ui-checkbox label=(t 'Enable Billing Information') checked=data.isBillingEnabled + onChange=(action (mut data.isBillingEnabled))}} +
+ {{/unless}} + {{#if isBillingInfoNeeded}} + {{widgets/forms/billing-info + data=data + event=event}} + {{/if}}

{{t 'Payment Method'}} diff --git a/app/templates/components/forms/wizard/basic-details-step.hbs b/app/templates/components/forms/wizard/basic-details-step.hbs index f6fe9647005..67ea755cc11 100644 --- a/app/templates/components/forms/wizard/basic-details-step.hbs +++ b/app/templates/components/forms/wizard/basic-details-step.hbs @@ -492,10 +492,18 @@ {{t 'Add Tax Information'}} {{/if}} + +
+
+ {{input type='checkbox' id='billing_info_mandatory' checked=data.event.isBillingInfoMandatory}} + +
+
- - {{/if}}
diff --git a/app/templates/components/widgets/forms/billing-info.hbs b/app/templates/components/widgets/forms/billing-info.hbs new file mode 100644 index 00000000000..2710cb66688 --- /dev/null +++ b/app/templates/components/widgets/forms/billing-info.hbs @@ -0,0 +1,41 @@ +
+ + {{input type='text' id='company' value=data.company}} +
+
+ + {{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}} +
+
+ + {{textarea rows='2' id='address' value=data.address}} +
+
+ + {{input type='text' id='city' value=data.city}} +
+
+ + {{input type='text' id='state' value=data.state}} +
+
+ + {{input type='text' id='zip_code' value=data.zipcode}} +
+
+ + {{#ui-dropdown class="search selection" selected=data.country + onChange=(action (mut data.country)) as |execute mapper|}} + {{input type='hidden' id='country' value=data.country}} +
{{t 'Select country'}}
+ + + {{/ui-dropdown}} +
\ No newline at end of file diff --git a/app/templates/orders/new.hbs b/app/templates/orders/new.hbs index 9576c2a3def..d02a58a7fa9 100644 --- a/app/templates/orders/new.hbs +++ b/app/templates/orders/new.hbs @@ -28,7 +28,7 @@
- {{forms/orders/order-form save='save' data=model.order fields=model.form settings=settings}} + {{forms/orders/order-form save='save' data=model.order event=model.event fields=model.form settings=settings}}
{{#if model.order.event.ownerName}}