diff --git a/components/admin/profile/updateInfo.tsx b/components/admin/profile/updateInfo.tsx index d33af687..fe604d45 100644 --- a/components/admin/profile/updateInfo.tsx +++ b/components/admin/profile/updateInfo.tsx @@ -109,6 +109,20 @@ const ProfileInfoUpdate = () => { /> {errors.telephone} + + + (viewModel.address = evt.target.value)} + disabled={viewModel.isSubmitting} + value={viewModel.address} + /> + {errors.address} + {viewModel.submitError.length > 0 && ( {viewModel.submitError} diff --git a/components/admin/profile/updateInfoViewModel.ts b/components/admin/profile/updateInfoViewModel.ts index 5e648667..f87a22f0 100644 --- a/components/admin/profile/updateInfoViewModel.ts +++ b/components/admin/profile/updateInfoViewModel.ts @@ -8,6 +8,7 @@ export class ProfileUpdateInfoViewModel extends BaseFormViewModel { _firstName: string = ""; _lastName: string = ""; _telephone: string = ""; + _address: string = ""; constructor(readonly me: Me, readonly profileService: IProfileService) { super(); @@ -18,6 +19,8 @@ export class ProfileUpdateInfoViewModel extends BaseFormViewModel { lastName: computed, _telephone: observable, telephone: computed, + _address: observable, + address: computed, save: action, validate: action, }); @@ -30,6 +33,7 @@ export class ProfileUpdateInfoViewModel extends BaseFormViewModel { this.firstName = this.me.firstName; this.lastName = this.me.lastName; this.telephone = this.me.telephone || ""; + this.address = this.me.address || ""; } public get firstName(): string { @@ -65,6 +69,17 @@ export class ProfileUpdateInfoViewModel extends BaseFormViewModel { } } + public get address(): string { + return this._address; + } + public set address(value: string) { + this._address = value; + delete this.fieldErrors["address"]; + if (this.submitError.length > 0) { + this.submitError = ""; + } + } + public async save(): Promise { this.isSubmitting = true; @@ -91,7 +106,8 @@ export class ProfileUpdateInfoViewModel extends BaseFormViewModel { return this.profileService.updateProfile( this.firstName, this.lastName, - this.telephone + this.telephone, + this.address ); } diff --git a/components/admin/user/create.tsx b/components/admin/user/create.tsx index a4288445..8f0d20f7 100644 --- a/components/admin/user/create.tsx +++ b/components/admin/user/create.tsx @@ -123,6 +123,17 @@ const UserCreate = () => { /> {errors.telephone} + + + (viewModel.address = evt.target.value)} + disabled={isSubmitting} + /> + {errors.address} +