diff --git a/app/components/forms/user-payment-info-form.js b/app/components/forms/user-payment-info-form.js index ad464322b6c..31e6a3e7dd8 100644 --- a/app/components/forms/user-payment-info-form.js +++ b/app/components/forms/user-payment-info-form.js @@ -2,14 +2,14 @@ import Component from '@ember/component'; import FormMixin from 'open-event-frontend/mixins/form'; import { validPhoneNumber } from 'open-event-frontend/utils/validators'; import { pick, orderBy } from 'lodash-es'; -import { action, computed } from '@ember/object'; +import { computed } from '@ember/object'; import { countries } from 'open-event-frontend/utils/dictionary/demography'; -export default class extends Component.extend(FormMixin) { +export default Component.extend(FormMixin, { didInsertElement() { - super.didInsertElement(...arguments); + this._super(...arguments); this.set('userBillingInfo', pick(this.authManager.currentUser, ['billingContactName', 'billingCity', 'billingPhone', 'company', 'billingTaxInfo', 'billingCountry', 'billingState', 'billingAddress', 'billingZipCode', 'billingAdditionalInfo'])); - } + }, getValidationRules() { return { @@ -88,26 +88,26 @@ export default class extends Component.extend(FormMixin) { } } }; - } + }, - @computed() - get countries() { + countries: computed(function() { return orderBy(countries, 'name'); - } + }), - @action - submit() { - this.onValid(async() => { - this.set('isLoading', true); - try { - this.authManager.currentUser.setProperties(this.userBillingInfo); - await this.authManager.currentUser.save(); - this.notify.success(this.l10n.t('Your billing details has been updated')); - } catch (error) { - this.authManager.currentUser.rollbackAttributes(); - this.notify.error(this.l10n.t('An unexpected error occurred')); - } - this.set('isLoading', false); - }); + actions: { + submit() { + this.onValid(async() => { + this.set('isLoading', true); + try { + this.authManager.currentUser.setProperties(this.userBillingInfo); + await this.authManager.currentUser.save(); + this.notify.success(this.l10n.t('Your billing details has been updated')); + } catch (error) { + this.authManager.currentUser.rollbackAttributes(); + this.notify.error(this.l10n.t('An unexpected error occurred')); + } + this.set('isLoading', false); + }); + } } -} +});