File tree Expand file tree Collapse file tree 8 files changed +160
-48
lines changed Expand file tree Collapse file tree 8 files changed +160
-48
lines changed Original file line number Diff line number Diff line change 1+ import Component from '@ember/component' ;
2+ import FormMixin from 'open-event-frontend/mixins/form' ;
3+ import { validPhoneNumber } from 'open-event-frontend/utils/validators' ;
4+ import { computed } from "@ember/object" ;
5+
6+ export default Component . extend ( FormMixin , {
7+
8+ getValidationRules ( ) {
9+ return {
10+ inline : true ,
11+ delay : false ,
12+ on : 'blur' ,
13+
14+ fields : {
15+ name : {
16+ identifier : 'contactName' ,
17+ rules : [
18+ {
19+ type : 'empty' ,
20+ prompt : this . l10n . t ( 'Please enter your name' )
21+ }
22+ ]
23+ } ,
24+ company : {
25+ identifier : 'company' ,
26+ rules : [
27+ {
28+ type : 'empty' ,
29+ prompt : this . l10n . t ( 'Please enter your company' )
30+ }
31+ ]
32+ } ,
33+ address : {
34+ identifier : 'address' ,
35+ rules : [
36+ {
37+ type : 'empty' ,
38+ prompt : this . l10n . t ( 'Please enter your billing address' )
39+ }
40+ ]
41+ } ,
42+ city : {
43+ identifier : 'city' ,
44+ rules : [
45+ {
46+ type : 'empty' ,
47+ prompt : this . l10n . t ( 'Please enter your billing city' )
48+ }
49+ ]
50+ } ,
51+ zipCode : {
52+ identifier : 'zip' ,
53+ rules : [
54+ {
55+ type : 'empty' ,
56+ prompt : this . l10n . t ( 'Please enter the zip code' )
57+ }
58+ ]
59+ } ,
60+ phone : {
61+ identifier : 'phone' ,
62+ rules : [
63+ {
64+ type : 'empty' ,
65+ prompt : this . l10n . t ( 'Please enter a phone number.' )
66+ } ,
67+ {
68+ type : 'regExp' ,
69+ value : validPhoneNumber ,
70+ prompt : this . l10n . t ( 'Please enter a valid phone number.' )
71+ }
72+ ]
73+ }
74+ }
75+ } ;
76+ } ,
77+ user : computed ( function ( ) {
78+ return this . authManager . currentUser ;
79+ } ) ,
80+ actions : {
81+ submit ( ) {
82+ this . onValid ( async ( ) => {
83+ try {
84+ await this . user . save ( ) ;
85+ this . notify . success ( this . l10n . t ( 'Your billing details has been updated' ) ) ;
86+ } catch ( error ) {
87+ this . notify . error ( this . l10n . t ( 'An unexpected error occurred' ) ) ;
88+ }
89+ } ) ;
90+ }
91+ }
92+ } ) ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -47,6 +47,20 @@ export default ModelBase.extend({
4747 deletedAt : attr ( 'moment' ) ,
4848 lastAccessedAt : attr ( 'moment' , { readOnly : true } ) ,
4949
50+ /**
51+ * Billing Contact Information
52+ */
53+
54+ billingContactName : attr ( 'string' ) ,
55+ billingPhone : attr ( 'string' ) ,
56+ billingCountry : attr ( 'string' ) ,
57+ company : attr ( 'string' ) ,
58+ billingAddress : attr ( 'string' ) ,
59+ billingCity : attr ( 'string' ) ,
60+ billingZipCode : attr ( 'string' ) ,
61+ billingTaxInfo : attr ( 'string' ) ,
62+ billingAdditionalInfo : attr ( 'string' ) ,
63+
5064 status : computed ( 'lastAccessedAt' , 'deletedAt' , function ( ) {
5165 if ( this . deletedAt == null ) {
5266 if ( this . lastAccessedAt == null ) {
Original file line number Diff line number Diff line change @@ -4,5 +4,9 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
44export default Route . extend ( AuthenticatedRouteMixin , {
55 titleToken ( ) {
66 return this . l10n . t ( 'Billing Info' ) ;
7+ } ,
8+ beforeModel ( ) {
9+ this . _super ( ...arguments ) ;
10+ this . replaceWith ( 'account.billing-info.payment-info' ) ;
711 }
812} ) ;
Original file line number Diff line number Diff line change 11import Route from '@ember/routing/route' ;
2+ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin' ;
23
3- export default Route . extend ( {
4+ export default Route . extend ( AuthenticatedRouteMixin , {
5+ titleToken ( ) {
6+ return this . l10n . t ( 'Payment Info' ) ;
7+ }
48} ) ;
Original file line number Diff line number Diff line change 1+ <div class =" ui basic {{ if isLoading ' loading' ' ' }} segment" >
2+ {{ forms/user-payment-info-form }}
3+ </div >
Original file line number Diff line number Diff line change 1+ <form class =" ui form" {{ action ' submit' on =' submit' }} >
2+ <h3 class =" ui header" >
3+ {{ t ' Payment Information' }}
4+ </h3 >
5+ <div class =" field" >
6+ <label class =" required" for =" contactName" >{{ t ' Contact Name' }} </label >
7+ {{ input type =' text' id =' contactName' value = (mut user.billingContactName )}}
8+ </div >
9+ <div class =" field" >
10+ <label class =" required" for =" phone" >{{ t ' Phone' }} </label >
11+ {{ input type =' text' id =' phone' value = (mut user.billingPhone )}}
12+ </div >
13+ <div class =" field" >
14+ <label class =" required" for =" company" >{{ t ' Company' }} </label >
15+ {{ input type =' text' id =' company' value = (mut user.company )}}
16+ </div >
17+ <div class =" field" >
18+ <label for =" taxID" >{{ t ' Tax ID or Business ID' }} </label >
19+ {{ input type =' text' id =' taxID' value = (mut user.billingTaxInfo )}}
20+ </div >
21+ <div class =" field" >
22+ <label class =" required" for =" address" >{{ t ' Address' }} </label >
23+ {{ textarea rows =' 2' id =' address' value = (mut user.billingAddress )}}
24+ </div >
25+ <div class =" field" >
26+ <label class =" required" for =" city" >{{ t ' City' }} </label >
27+ {{ input type =' text' id =' city' value = (mut user.billingCity )}}
28+ </div >
29+ <div class =" field" >
30+ <label class =" required" for =" zip" >{{ t ' Zip Code' }} </label >
31+ {{ input type =' text' id =' zip' value = (mut user.billingZipCode )}}
32+ </div >
33+ <div class =" field" >
34+ <label for =" additionalInfo" >{{ t ' Additional Information' }} </label >
35+ {{ textarea rows =' 4' id =' additionalInfo' value = (mut user.billingAdditionalInfo )}}
36+ </div >
37+
38+ <button type =" submit" class =" ui teal submit button update-changes" >
39+ {{ t ' Submit' }}
40+ </button >
41+ </form >
42+ {{ user }}
You can’t perform that action at this time.
0 commit comments