Skip to content
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
111 changes: 111 additions & 0 deletions app/components/forms/admin/settings/billing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import Component from '@ember/component';
import FormMixin from 'open-event-frontend/mixins/form';
import { validPhoneNumber } from 'open-event-frontend/utils/validators';
import { action } from '@ember/object';

export default class extends Component.extend(FormMixin) {
getValidationRules() {
return {
inline : true,
delay : false,
on : 'blur',
fields : {
adminBillingContactName: {
identifier : 'adminBillingContactName',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the Contact name')
}
]
},
adminBillingPhone: {
identifier : 'adminBillingPhone',
rules : [
{
type : 'regExp',
value : validPhoneNumber,
prompt : this.l10n.t('Please enter a valid mobile number.')
}
]
},
adminBillingEmail: {
identifier : 'adminBillingEmail',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the email')
},
{
type : 'email',
prompt : this.l10n.t('Please enter a valid email address')
}
]
},
adminBillingCountry: {
identifier : 'adminBillingCountry',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the country')
}
]
},

adminBillingTaxInfo: {
identifier : 'adminBillingTaxInfo',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the tax id')
}
]
},
adminCompany: {
identifier : 'adminCompany',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the company')
}
]
},
adminBillingAddress: {
identifier : 'adminBillingAddress',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the Address')
}
]
},
adminBillingCity: {
identifier : 'adminBillingCity',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the city')
}
]
},

adminBillingZip: {
identifier : 'adminBillingZip',
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter the zip code')
}
]
}
}
};
}

@action
submit() {
this.onValid(() => {
this.save();
});
}
}
28 changes: 28 additions & 0 deletions app/controllers/admin/settings/billing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Controller from '@ember/controller';
import { timezones } from 'open-event-frontend/utils/dictionary/date-time';
import { countries } from 'open-event-frontend/utils/dictionary/demography';
import { action } from '@ember/object';
import { computed } from '@ember/object';
import { paymentCountries } from 'open-event-frontend/utils/dictionary/payment';
import { orderBy, filter } from 'lodash-es';


export default class extends Controller {
timezones = timezones;
@computed()
get countries() {
return orderBy(filter(countries, country => paymentCountries.includes(country.code)), 'name');
}
payment
@action
async updateInvoiceModel() {
this.set('isLoading', true);
try {
await this.model.save();
this.notify.success(this.l10n.t('Admin Billing info has been saved successfully'));
} catch (error) {
this.notify.error(this.l10n.t('An unexpected error has occurred. Settings not saved.'));
}
this.set('isLoading', false);
}
}
139 changes: 74 additions & 65 deletions app/models/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,80 @@ export default ModelBase.extend({
* Attributes
*/

appEnvironment : attr('string'),
appName : attr('string'),
tagline : attr('string'),
secret : attr('string'),
storagePlace : attr('string'),
awsKey : attr('string'),
awsSecret : attr('string'),
awsBucketName : attr('string'),
awsRegion : attr('string'),
gsKey : attr('string'),
gsSecret : attr('string'),
gsBucketName : attr('string'),
isGoogleRecaptchaEnabled : attr('boolean', { defaultValue: false }),
googleRecaptchaSitekey : attr('string'),
googleRecaptchaSecretkey : attr('string'),
googleClientId : attr('string'),
googleClientSecret : attr('string'),
fbClientId : attr('string'),
fbClientSecret : attr('string'),
twConsumerKey : attr('string'),
twConsumerSecret : attr('string'),
inClientId : attr('string'),
inClientSecret : attr('string'),
paypalMode : attr('string'),
paypalClient : attr('string'),
paypalSecret : attr('string'),
paypalSandboxClient : attr('string'),
paypalSandboxSecret : attr('string'),
alipaySecretKey : attr('string'),
alipayPublishableKey : attr('string'),
omiseMode : attr('string'),
omiseTestPublic : attr('string'),
omiseTestSecret : attr('string'),
omiseLivePublic : attr('string'),
omiseLiveSecret : attr('string'),
stripeClientId : attr('string'),
stripeSecretKey : attr('string'),
stripePublishableKey : attr('string'),
isPaypalActivated : attr('boolean'),
isStripeActivated : attr('boolean'),
isAliPayActivated : attr('boolean'),
isOmiseActivated : attr('boolean'),
emailService : attr('string'),
emailFrom : attr('string'),
emailFromName : attr('string'),
sendgridKey : attr('string'),
smtpHost : attr('string'),
smtpUsername : attr('string'),
smtpPassword : attr('string'),
smtpPort : attr('string'),
smtpEncryption : attr('string'),
analyticsKey : attr('string'),
googleUrl : attr('string'),
githubUrl : attr('string'),
twitterUrl : attr('string'),
supportUrl : attr('string'),
facebookUrl : attr('string'),
youtubeUrl : attr('string'),
androidAppUrl : attr('string'),
frontendUrl : attr('string'),
webAppUrl : attr('string'),
staticDomain : attr('string'),
cookiePolicy : attr('string'),
cookiePolicyLink : attr('string'),

appEnvironment : attr('string'),
appName : attr('string'),
tagline : attr('string'),
secret : attr('string'),
storagePlace : attr('string'),
awsKey : attr('string'),
awsSecret : attr('string'),
awsBucketName : attr('string'),
awsRegion : attr('string'),
gsKey : attr('string'),
gsSecret : attr('string'),
gsBucketName : attr('string'),
googleClientId : attr('string'),
googleClientSecret : attr('string'),
fbClientId : attr('string'),
fbClientSecret : attr('string'),
twConsumerKey : attr('string'),
twConsumerSecret : attr('string'),
inClientId : attr('string'),
inClientSecret : attr('string'),
paypalMode : attr('string'),
paypalClient : attr('string'),
paypalSecret : attr('string'),
paypalSandboxClient : attr('string'),
paypalSandboxSecret : attr('string'),
alipaySecretKey : attr('string'),
alipayPublishableKey : attr('string'),
omiseMode : attr('string'),
omiseTestPublic : attr('string'),
omiseTestSecret : attr('string'),
omiseLivePublic : attr('string'),
omiseLiveSecret : attr('string'),
stripeClientId : attr('string'),
stripeSecretKey : attr('string'),
stripePublishableKey : attr('string'),
isAliPayActivated : attr('boolean'),
isPaypalActivated : attr('boolean'),
isStripeActivated : attr('boolean'),
isOmiseActivated : attr('boolean'),
emailService : attr('string'),
emailFrom : attr('string'),
emailFromName : attr('string'),
sendgridKey : attr('string'),
smtpHost : attr('string'),
smtpUsername : attr('string'),
smtpPassword : attr('string'),
smtpPort : attr('string'),
smtpEncryption : attr('string'),
analyticsKey : attr('string'),
googleUrl : attr('string'),
githubUrl : attr('string'),
twitterUrl : attr('string'),
supportUrl : attr('string'),
facebookUrl : attr('string'),
youtubeUrl : attr('string'),
androidAppUrl : attr('string'),
frontendUrl : attr('string'),
webAppUrl : attr('string'),
staticDomain : attr('string'),
cookiePolicy : attr('string'),
cookiePolicyLink : attr('string'),
invoiceSendingDay : attr('number'),
invoiceSendingTimezone : attr('string'),
adminBillingContactName : attr('string'),
adminBillingPhone : attr('string'),
adminBillingEmail : attr('string'),
adminBillingState : attr('string'),
adminBillingCountry : attr('string'),
adminBillingTaxInfo : attr('string'),
adminCompany : attr('string'),
adminBillingAddress : attr('string'),
adminBillingCity : attr('string'),
adminBillingZip : attr('string'),
adminBillingAdditionalInfo : attr('string'),
/**
* Computed properties
*/
Expand Down
1 change: 1 addition & 0 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ router.map(function() {
this.route('analytics');
this.route('payment-gateway');
this.route('ticket-fees');
this.route('billing');
});
this.route('modules');
this.route('content', function() {
Expand Down
10 changes: 10 additions & 0 deletions app/routes/admin/settings/billing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Route from '@ember/routing/route';

export default class extends Route {
titleToken() {
return this.l10n.t('Admin Billing');
}
model() {
return this.modelFor('admin.settings');
}
}
3 changes: 3 additions & 0 deletions app/templates/admin/settings.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{{#link-to 'admin.settings.ticket-fees' class='item'}}
{{t 'Ticket Fees'}}
{{/link-to}}
{{#link-to 'admin.settings.billing' class='item'}}
{{t 'Billing'}}
{{/link-to}}
{{/tabbed-navigation}}
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions app/templates/admin/settings/billing.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="ui basic {{if isLoading 'loading'}} segment">
{{forms/admin/settings/billing timezones=timezones countries=countries model=model save=(action 'updateInvoiceModel')}}
</div>
Loading