Просмотр исходного кода

fix(admin-ui): Make emailAddress required in CustomerDetail form

Relates to #438
Michael Bromley 5 лет назад
Родитель
Сommit
2a9ee2e3d2

+ 7 - 7
packages/admin-ui/src/lib/customer/src/components/customer-detail/customer-detail.component.html

@@ -49,13 +49,6 @@
     >
         <input id="lastName" type="text" formControlName="lastName" />
     </vdr-form-field>
-    <vdr-form-field
-        [label]="'customer.phone-number' | translate"
-        for="phoneNumber"
-        [readOnlyToggle]="!(isNew$ | async)"
-    >
-        <input id="phoneNumber" type="text" formControlName="phoneNumber" />
-    </vdr-form-field>
     <vdr-form-field
         [label]="'customer.email-address' | translate"
         for="emailAddress"
@@ -63,6 +56,13 @@
     >
         <input id="emailAddress" type="text" formControlName="emailAddress" />
     </vdr-form-field>
+    <vdr-form-field
+           [label]="'customer.phone-number' | translate"
+           for="phoneNumber"
+           [readOnlyToggle]="!(isNew$ | async)"
+       >
+           <input id="phoneNumber" type="text" formControlName="phoneNumber" />
+       </vdr-form-field>
     <vdr-form-field [label]="'customer.password' | translate" for="password" *ngIf="isNew$ | async">
         <input id="password" type="password" formControlName="password" />
     </vdr-form-field>

+ 1 - 1
packages/admin-ui/src/lib/customer/src/components/customer-detail/customer-detail.component.ts

@@ -80,7 +80,7 @@ export class CustomerDetailComponent extends BaseDetailComponent<CustomerWithOrd
                 firstName: ['', Validators.required],
                 lastName: ['', Validators.required],
                 phoneNumber: '',
-                emailAddress: '',
+                emailAddress: ['', [Validators.required, Validators.email]],
                 password: '',
                 customFields: this.formBuilder.group(
                     this.customFields.reduce((hash, field) => ({ ...hash, [field.name]: '' }), {}),