Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Billing Information Enhancements and Updations #3654

Merged
merged 7 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions app/components/forms/orders/order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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')
}
]
},
Expand Down Expand Up @@ -490,4 +494,4 @@ export default Component.extend(FormMixin, {
}
}
}
});
});
1 change: 1 addition & 0 deletions app/models/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
53 changes: 12 additions & 41 deletions app/templates/components/forms/orders/order-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -81,52 +81,23 @@
{{/if}}
{{/each}}
{{/each}}

{{#if isPaidOrder}}
<h4 class="ui horizontal divider header">
<i class="ticket icon"></i>
{{t 'Billing Information'}}
</h4>
<div class="field">
<label class="required" for="company">{{t 'Company'}}</label>
{{input type='text' id='company' value=data.company}}
</div>
<div class="field">
<label for="taxBusinessInfo">{{t 'Tax ID or Business ID'}}</label>
{{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}}
</div>
<div class="field">
<label class="required" for="address">{{t 'Address'}}</label>
{{textarea rows='2' id='address' value=data.address}}
</div>
<div class="field">
<label class="required" for="city">{{t 'City'}}</label>
{{input type='text' id='city' value=data.city}}
</div>
<div class="field">
<label for="state">{{t 'State/Province'}}</label>
{{input type='text' id='state' value=data.state}}
</div>
<div class="field">
<label class="required" for="zipcode">{{t 'Zip Code'}}</label>
{{input type='text' id='zip_code' value=data.zipcode}}
</div>
<div class="field">
<label class="required">{{t 'Select country'}}</label>
{{#ui-dropdown class="search selection" selected=data.country
onChange=(action (mut data.country)) as |execute mapper|}}
{{input type='hidden' id='country' value=data.country}}
<div class="default text">{{t 'Select country'}}</div>
<i class="dropdown icon"></i>
<div class="menu">
{{#each countries as |country|}}
<div data-value="{{map-value mapper country.name}}" class="item">
<i class="{{lowercase country.code}} flag"></i>
{{country.name}}
</div>
{{/each}}
</div>
{{/ui-dropdown}}
</div>
{{#unless this.event.isBillingInfoMandatory}}
<div class="ui center aligned field">
{{ui-checkbox label=(t 'Enable Billing Information') checked=data.isBillingEnabled
onChange=(action (mut data.isBillingEnabled))}}
</div>
{{/unless}}
{{#if isBillingInfoNeeded}}
{{widgets/forms/billing-info
data=data
event=event}}
{{/if}}
<h4 class="ui horizontal divider header">
<i class="ticket icon"></i>
{{t 'Payment Method'}}
Expand Down
12 changes: 10 additions & 2 deletions app/templates/components/forms/wizard/basic-details-step.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,18 @@
{{t 'Add Tax Information'}}
</button>
{{/if}}
<div class="ui hidden divider"></div>
<div class="field">
<div class="ui radio checkbox">
{{input type='checkbox' id='billing_info_mandatory' checked=data.event.isBillingInfoMandatory}}
<label for="billing_info">
<strong>{{t 'Billing Info'}}:</strong>
{{t 'Require Billing Information from Ticket Buyer'}}
</label>
</div>
</div>
</div>

</div>

{{/if}}
<div class="ui section divider"></div>
<div class="grouped fields">
Expand Down
41 changes: 41 additions & 0 deletions app/templates/components/widgets/forms/billing-info.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div class="field">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move it back to the template now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks more organised since its a just a tool which is needed for the order-form, I dont see any issue in moving it to a widget?

<label class="required" for="company">{{t 'Company'}}</label>
{{input type='text' id='company' value=data.company}}
</div>
<div class="field">
<label for="taxBusinessInfo">{{t 'Tax ID or Business ID'}}</label>
{{input type='text' id='taxBusinessInfo' value=data.taxBusinessInfo}}
</div>
<div class="field">
<label class="required" for="address">{{t 'Address'}}</label>
{{textarea rows='2' id='address' value=data.address}}
</div>
<div class="field">
<label class="required" for="city">{{t 'City'}}</label>
{{input type='text' id='city' value=data.city}}
</div>
<div class="field">
<label for="state">{{t 'State/Province'}}</label>
{{input type='text' id='state' value=data.state}}
</div>
<div class="field">
<label class="required" for="zipcode">{{t 'Zip Code'}}</label>
{{input type='text' id='zip_code' value=data.zipcode}}
</div>
<div class="field">
<label class="required">{{t 'Select country'}}</label>
{{#ui-dropdown class="search selection" selected=data.country
onChange=(action (mut data.country)) as |execute mapper|}}
{{input type='hidden' id='country' value=data.country}}
<div class="default text">{{t 'Select country'}}</div>
<i class="dropdown icon"></i>
<div class="menu">
{{#each countries as |country|}}
<div data-value="{{map-value mapper country.name}}" class="item">
<i class="{{lowercase country.code}} flag"></i>
{{country.name}}
</div>
{{/each}}
</div>
{{/ui-dropdown}}
</div>
2 changes: 1 addition & 1 deletion app/templates/orders/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</div>
<div class="row">
<div class="ten wide column">
{{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}}
</div>
<div class="six wide column">
{{#if model.order.event.ownerName}}
Expand Down