Angular project using NgRx pattern to manage state of a system

company-update.component.html 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <div class="container" *ngIf="companyFormGroup">
  2. <ng-container *ngIf="companyState.msgState == msgState.FORM_LOADING">
  3. {{companyState.msgState}}
  4. </ng-container>
  5. <ng-container *ngIf="companyState.msgState == msgState.FORM_LOAD_ERR">
  6. {{companyState.msgState}}
  7. </ng-container>
  8. <ng-container *ngIf="companyState.msgState == msgState.FORM_LOADED">
  9. <div class="card mt-3" style="width: 18rem">
  10. <div class="card-header">Update company informations</div>
  11. <div class="card-body">
  12. <form [formGroup]="companyFormGroup"
  13. (ngSubmit)="onCompanyUpdate(); companyFormGroup.reset()"
  14. >
  15. <div class="col-md-auto mb-3">
  16. <label for="companyName">Company name</label>
  17. <input
  18. type="text"
  19. formControlName="companyName"
  20. class="form-control"
  21. [ngClass]="{
  22. 'is-invalid':
  23. companyFormGroup.controls['companyName'].touched &&
  24. !companyFormGroup.controls['companyName'].valid
  25. }"
  26. />
  27. <div class="invalid-feedback">
  28. <span
  29. *ngIf="companyFormGroup.controls['companyName'].errors?.['required']"
  30. >
  31. required
  32. </span>
  33. <span
  34. *ngIf="companyFormGroup.controls['companyName'].errors?.['minlength']"
  35. >
  36. min nbr chars 5
  37. </span>
  38. </div>
  39. </div>
  40. <div class="col-md-auto mb-3">
  41. <label for="type">Company type</label>
  42. <select formControlName="companyType" class="form-control">
  43. <option *ngFor="let companyType of companyTypes | keyvalue " [ngValue]="companyType.value">
  44. {{companyType.value}}
  45. </option>
  46. </select>
  47. </div>
  48. <div class="text-center col-md-auto mt-3">
  49. <button
  50. class="btn btn-outline-primary"
  51. type="submit" [disabled]="!companyFormGroup.valid"
  52. >
  53. update
  54. </button>
  55. </div>
  56. </form>
  57. </div>
  58. </div>
  59. </ng-container>
  60. <ng-container *ngIf="companyState.msgState == msgState.UPDATED">
  61. <div class="alert-success container p-3 m-3" style="width: 30em">
  62. <span> {{ msgState.UPDATED }}</span> &nbsp;&nbsp;
  63. <button class="btn btn-success" (click)="onUpdateOk()">OK</button>
  64. </div>
  65. </ng-container>
  66. </div>

Powered by TurnKey Linux.