Skip to content

Commit ade89eb

Browse files
committed
add intial mechanism for billing options(admin)
Added initial billing info subtab in admin Added INvoice Contact info linting Added fields for admin invoice contact Added fields for admin invoice contact
1 parent 88fd06c commit ade89eb

File tree

9 files changed

+234
-8
lines changed

9 files changed

+234
-8
lines changed
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import Component from '@ember/component';
2+
import FormMixin from 'open-event-frontend/mixins/form';
3+
4+
export default Component.extend(FormMixin, {
5+
getValidationRules() {
6+
return {
7+
inline : true,
8+
delay : false,
9+
on : 'blur',
10+
fields : {
11+
contactName: {
12+
identifier : 'contactName',
13+
rules : [
14+
{
15+
type : 'empty',
16+
prompt : this.l10n.t('Please enter the Contact name')
17+
}
18+
]
19+
},
20+
phone: {
21+
identifier : 'phone',
22+
rules : [
23+
{
24+
type : 'empty',
25+
prompt : this.l10n.t('Please enter a phone number')
26+
}
27+
]
28+
},
29+
email: {
30+
identifier : 'email',
31+
rules : [
32+
{
33+
type : 'empty',
34+
prompt : this.l10n.t('Please enter the email')
35+
}
36+
]
37+
},
38+
country: {
39+
identifier : 'country',
40+
rules : [
41+
{
42+
type : 'empty',
43+
prompt : this.l10n.t('Please enter the country')
44+
}
45+
]
46+
},
47+
48+
taxID: {
49+
identifier : 'tax_id',
50+
rules : [
51+
{
52+
type : 'empty',
53+
prompt : this.l10n.t('Please enter the tax id')
54+
}
55+
]
56+
},
57+
company: {
58+
identifier : 'company',
59+
rules : [
60+
{
61+
type : 'empty',
62+
prompt : this.l10n.t('Please enter the company')
63+
}
64+
]
65+
},
66+
address: {
67+
identifier : 'address',
68+
rules : [
69+
{
70+
type : 'empty',
71+
prompt : this.l10n.t('Please enter the Address')
72+
}
73+
]
74+
},
75+
city: {
76+
identifier : 'city',
77+
rules : [
78+
{
79+
type : 'empty',
80+
prompt : this.l10n.t('Please enter the city')
81+
}
82+
]
83+
},
84+
85+
zip: {
86+
identifier : 'zip',
87+
rules : [
88+
{
89+
type : 'empty',
90+
prompt : this.l10n.t('Please enter the zip code')
91+
}
92+
]
93+
},
94+
additionalInfo: {
95+
identifier : 'additional_info',
96+
rules : [
97+
{
98+
type : 'empty',
99+
prompt : this.l10n.t('Please enter additional info')
100+
}
101+
]
102+
},
103+
comments: {
104+
identifier : 'comments',
105+
rules : [
106+
{
107+
type : 'empty',
108+
prompt : this.l10n.t('Please enter the comments')
109+
}
110+
]
111+
}
112+
113+
}
114+
};
115+
116+
},
117+
118+
actions: {
119+
submit() {
120+
this.onValid(() => {
121+
this.sendAction('save');
122+
});
123+
}
124+
}
125+
});
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Controller from '@ember/controller';
2+
import { timezones } from 'open-event-frontend/utils/dictionary/date-time';
3+
4+
export default Controller.extend({
5+
timezones,
6+
updateModel() {
7+
this.set('isLoading', true);
8+
let model = this.model;
9+
model.save()
10+
.then(() => {
11+
this.notify.success(this.l10n.t('Admin Billing info has been saved successfully'));
12+
})
13+
.catch(() => {
14+
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
15+
})
16+
.finally(() => {
17+
this.set('isLoading', false);
18+
});
19+
}
20+
});

app/models/admin-sales-invoice.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@ import attr from 'ember-data/attr';
22
import ModelBase from 'open-event-frontend/models/base';
33

44
export default ModelBase.extend({
5-
identifier : attr('string'),
6-
status : attr('string'),
7-
amount : attr('number'),
8-
createdAt : attr('moment'),
9-
completedAt : attr('moment'),
10-
eventName : attr('string'),
11-
sentTo : attr('string')
5+
identifier : attr('string'),
6+
status : attr('string'),
7+
amount : attr('number'),
8+
createdAt : attr('moment'),
9+
completedAt : attr('moment'),
10+
eventName : attr('string'),
11+
sentTo : attr('string'),
12+
adminContactName : attr('string'),
13+
adminPhone : attr('string'),
14+
adminEmail : attr('string'),
15+
adminCountry : attr('string'),
16+
adminTaxInfo : attr('string'),
17+
adminCompany : attr('string'),
18+
adminCompanyAddress : attr('string'),
19+
adminCompanyCity : attr('string'),
20+
adminCompanyZip : attr('string'),
21+
adminAdditionalInfo : attr('string'),
22+
adminCompanyComments : attr('string')
23+
1224
});

app/models/setting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default ModelBase.extend({
6868
webAppUrl : attr('string'),
6969
staticDomain : attr('string'),
7070
cookiePolicy : attr('string'),
71-
cookiePolicyLink : attr('string'),
71+
cookiePolicyLink : attr('string')
7272

7373
/**
7474
* Computed properties

app/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ router.map(function() {
189189
this.route('analytics');
190190
this.route('payment-gateway');
191191
this.route('ticket-fees');
192+
this.route('billing');
192193
});
193194
this.route('modules');
194195
this.route('content', function() {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Route from '@ember/routing/route';
2+
3+
export default Route.extend({
4+
model() {
5+
return this.store.findAll('admin-sales-invoice');
6+
}
7+
});

app/templates/admin/settings.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
{{#link-to 'admin.settings.ticket-fees' class='item'}}
2121
{{t 'Ticket Fees'}}
2222
{{/link-to}}
23+
{{#link-to 'admin.settings.billing' class='item'}}
24+
{{t 'Billing'}}
25+
{{/link-to}}
2326
{{/tabbed-navigation}}
2427
</div>
2528
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="ui basic {{if isLoading 'loading' ''}} segment">
2+
{{forms/admin/settings/billing timezones=timezones save='updateModel'}}
3+
</div>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<form class="ui form" {{action 'submit' on='submit'}}>
2+
<h3 class="ui header">
3+
{{t 'Invoice Handling'}}
4+
</h3>
5+
<div class="two fields">
6+
{{#ui-dropdown class="selection"}}
7+
<i class="dropdown icon"></i>
8+
<div class="default text">{{t 'Invoices Sent Out'}}</div>
9+
<div class="menu">
10+
<div class="item">First of every month</div>
11+
<div class="item">Second of every month</div>
12+
<div class="item">Third of every month</div>
13+
</div>
14+
{{/ui-dropdown}}
15+
<div class="ui hidden divider"></div>
16+
{{#ui-dropdown class="selection"}}
17+
{{input type='hidden' id='timezone' value=data.event.timezone}}
18+
<i class="dropdown icon"></i>
19+
<div class="default text">{{t 'Select timezone'}}</div>
20+
<div class="menu">
21+
{{#each timezones as |timezone|}}
22+
<div class="item" data-value="{{timezone}}">{{timezone}}</div>
23+
{{/each}}
24+
</div>
25+
{{/ui-dropdown}}
26+
</div>
27+
<div class="ui hidden divider"></div>
28+
<h3 class="ui header">
29+
{{t 'Invoice Contact'}}
30+
</h3>
31+
<div class="field">
32+
<label class="required" for="company">{{t 'Company'}}</label>
33+
{{input type='text' id='company'}}
34+
</div>
35+
<div class="field">
36+
<label for="taxID">{{t 'Tax ID or Business ID'}}</label>
37+
{{input type='text' id='taxID'}}
38+
</div>
39+
<div class="field">
40+
<label class="required" for="address">{{t 'Address'}}</label>
41+
{{textarea rows='2' id='address' }}
42+
</div>
43+
<div class="field">
44+
<label class="required" for="city">{{t 'City'}}</label>
45+
{{input type='text' id='city'}}
46+
</div>
47+
<div class="field">
48+
<label for="state">{{t 'State/Province'}}</label>
49+
{{input type='text' id='state'}}
50+
</div>
51+
<div class="field">
52+
<label class="required" for="zip">{{t 'Zip Code'}}</label>
53+
{{input type='text' id='zip'}}
54+
</div>
55+
</form>

0 commit comments

Comments
 (0)