1
+ < div >
2
+ < header >
3
+ < h3 >
4
+ < span class ="glyphicon glyphicon-user "> </ span >
5
+ {{ customer.firstName }} {{ customer.lastName }}
6
+ </ h3 >
7
+ </ header >
8
+ < br />
9
+ < form [formGroup] ="customerForm " (ngSubmit) ="submit(customerForm) " class ="editForm " novalidate >
10
+ < div class ="form-group ">
11
+ < label > Name</ label >
12
+ < input type ="text " class ="form-control " formControlName ="firstName " />
13
+ < div class ="alert alert-danger " [hidden] ="customerForm.controls.firstName.untouched || customerForm.controls.firstName.valid "> First Name is required</ div >
14
+ </ div >
15
+ < div class ="form-group ">
16
+ < label > Last Name</ label >
17
+ < input type ="text " class ="form-control " formControlName ="lastName ">
18
+ < div class ="alert alert-danger " [hidden] ="customerForm.controls.lastName.untouched || customerForm.controls.lastName.valid "> Last Name is required</ div >
19
+ </ div >
20
+ < div class ="form-group ">
21
+ < label > Gender</ label >
22
+ < br />
23
+ < div class ="radio ">
24
+ < label >
25
+ < input type ="radio " name ="gender " formControlName ="gender " value ="Male " />
26
+ Male
27
+ </ label >
28
+ </ div >
29
+ < div class ="radio ">
30
+ < label >
31
+ < input type ="radio " name ="gender " formControlName ="gender " value ="Female " />
32
+ Female
33
+ </ label >
34
+ </ div >
35
+ </ div >
36
+ < div class ="form-group ">
37
+ < label > Email</ label >
38
+ < input type ="email " class ="form-control " formControlName ="email " />
39
+ < div class ="alert alert-danger " [hidden] ="customerForm.controls.email.untouched || customerForm.controls.email.valid "> Email is required and must be valid</ div >
40
+ </ div >
41
+ < div class ="form-group ">
42
+ < label > Address</ label >
43
+ < input type ="text " class ="form-control " formControlName ="address " />
44
+ < div class ="alert alert-danger " [hidden] ="customerForm.controls.address.untouched || customerForm.controls.address.valid "> Address is required</ div >
45
+ </ div >
46
+ < div class ="form-group ">
47
+ < label > City</ label >
48
+ < input type ="text " class ="form-control " formControlName ="city " />
49
+ < div class ="alert alert-danger " [hidden] ="customerForm.controls.city.untouched || customerForm.controls.city.valid "> City is required</ div >
50
+ </ div >
51
+ < div class ="form-group ">
52
+ < label > State</ label >
53
+ < select class ="form-control " formControlName ="stateId ">
54
+ < option *ngFor ="let state of states " [ngValue] ="state.id "> {{state.name}}</ option >
55
+ </ select >
56
+ </ div >
57
+ < br />
58
+
59
+ < div *ngIf ="customer ">
60
+ < div class ="alert alert-warning " *ngIf ="customer._id && deleteMessageEnabled ">
61
+ Delete Customer? < button class ="btn btn-danger " (click) ="delete($event) "> Yes</ button >
62
+ < button class ="btn btn-default " (click) ="deleteMessageEnabled = false "> No</ button >
63
+ </ div >
64
+ < button class ="btn btn-danger " *ngIf ="customer._id && !deleteMessageEnabled " (click) ="deleteMessageEnabled = true "> Delete</ button >
65
+
66
+ < div class ="pull-right " *ngIf ="!deleteMessageEnabled ">
67
+ < button class ="btn btn-default " (click) ="cancel($event) "> Cancel</ button >
68
+ < button type ="submit " class ="btn btn-success " [disabled] ="!customerForm.valid "> {{ operationText }}</ button >
69
+ </ div >
70
+ </ div >
71
+ < br />
72
+ < br />
73
+ < div class ="alert alert-danger " *ngIf ="errorMessage != null "> {{ errorMessage }}</ div >
74
+
75
+ </ form >
76
+ </ div >
0 commit comments