|
| 1 | +<form |
| 2 | + vclForm |
| 3 | + novalidate |
| 4 | + [formGroup]="form" |
| 5 | + (submit)="onSubmit()" |
| 6 | +> |
| 7 | + <section class="rc-section"> |
| 8 | + <h4>Identity</h4> |
| 9 | + |
| 10 | + <div class="rc-grid cols-2 gap-4"> |
| 11 | + <vcl-form-control-group> |
| 12 | + <vcl-label>First name</vcl-label> |
| 13 | + <vcl-input-field> |
| 14 | + <input |
| 15 | + vclInput |
| 16 | + formControlName="firstName" |
| 17 | + /> |
| 18 | + </vcl-input-field> |
| 19 | + </vcl-form-control-group> |
| 20 | + |
| 21 | + <vcl-form-control-group> |
| 22 | + <vcl-label>Last name</vcl-label> |
| 23 | + <vcl-input-field> |
| 24 | + <input |
| 25 | + vclInput |
| 26 | + formControlName="lastName" |
| 27 | + /> |
| 28 | + </vcl-input-field> |
| 29 | + </vcl-form-control-group> |
| 30 | + |
| 31 | + <vcl-form-control-group> |
| 32 | + <vcl-label>Email</vcl-label> |
| 33 | + <vcl-input-field> |
| 34 | + <input |
| 35 | + vclInput |
| 36 | + formControlName="email" |
| 37 | + /> |
| 38 | + </vcl-input-field> |
| 39 | + <vcl-hint-error error="required" |
| 40 | + >This field is required.</vcl-hint-error |
| 41 | + > |
| 42 | + <vcl-hint-error error="email">Invalid email address.</vcl-hint-error> |
| 43 | + </vcl-form-control-group> |
| 44 | + |
| 45 | + <rc-username-field formControlName="username" /> |
| 46 | + </div> |
| 47 | + </section> |
| 48 | + |
| 49 | + <vcl-checkbox formControlName="invite">Invite</vcl-checkbox> |
| 50 | + |
| 51 | + <rc-password-field formControlName="password" /> |
| 52 | + |
| 53 | + <section class="rc-section"> |
| 54 | + <h4>Default Scope</h4> |
| 55 | + |
| 56 | + <vcl-form-control-group> |
| 57 | + <vcl-label>Scope</vcl-label> |
| 58 | + <vcl-select> |
| 59 | + <vcl-select-list formControlName="defaultScope"> |
| 60 | + @for (item of organizations; track $index) { |
| 61 | + <vcl-select-list-item [value]="item.id"> |
| 62 | + {{ item.name }} |
| 63 | + </vcl-select-list-item> |
| 64 | + } |
| 65 | + </vcl-select-list> |
| 66 | + </vcl-select> |
| 67 | + </vcl-form-control-group> |
| 68 | + </section> |
| 69 | + |
| 70 | + <section |
| 71 | + class="rc-section" |
| 72 | + formArrayName="roleAssignments" |
| 73 | + > |
| 74 | + <h4>Role Assignment</h4> |
| 75 | + |
| 76 | + <fieldset> |
| 77 | + <legend> |
| 78 | + Add role |
| 79 | + |
| 80 | + <vcl-icon |
| 81 | + class="role-add" |
| 82 | + icon="vcl:add" |
| 83 | + (click)="addRoleAssignment()" |
| 84 | + ></vcl-icon> |
| 85 | + </legend> |
| 86 | + |
| 87 | + @for (group of roleAssignments.controls; track $index; let i = $index) { |
| 88 | + <fieldset [formGroupName]="i"> |
| 89 | + <legend> |
| 90 | + Role {{ i + 1 }} |
| 91 | + <vcl-icon |
| 92 | + class="role-remove" |
| 93 | + icon="vcl:remove" |
| 94 | + (click)="removeRoleAssignment(i)" |
| 95 | + ></vcl-icon> |
| 96 | + </legend> |
| 97 | + |
| 98 | + <!-- Role --> |
| 99 | + <vcl-form-control-group> |
| 100 | + <vcl-label>Role</vcl-label> |
| 101 | + <vcl-select |
| 102 | + [clearable]="true" |
| 103 | + placeholder="Select role" |
| 104 | + [search]="true" |
| 105 | + > |
| 106 | + <vcl-select-list formControlName="role"> |
| 107 | + @for (role of roles; track role.id) { |
| 108 | + <vcl-select-list-item [value]="role.id"> |
| 109 | + {{ role.name }} |
| 110 | + <vcl-sub-label>{{ role.description }}</vcl-sub-label> |
| 111 | + </vcl-select-list-item> |
| 112 | + } |
| 113 | + </vcl-select-list> |
| 114 | + </vcl-select> |
| 115 | + <vcl-hint-error error="required" |
| 116 | + >This field is required.</vcl-hint-error |
| 117 | + > |
| 118 | + </vcl-form-control-group> |
| 119 | + |
| 120 | + <!-- Organization --> |
| 121 | + <vcl-form-control-group> |
| 122 | + <vcl-label>Organization</vcl-label> |
| 123 | + <vcl-select |
| 124 | + [clearable]="true" |
| 125 | + placeholder="Select Organization" |
| 126 | + [search]="true" |
| 127 | + > |
| 128 | + <vcl-select-list formControlName="scopeInstance"> |
| 129 | + @for (organization of organizations; track organization.id) { |
| 130 | + <vcl-select-list-item [value]="organization.id"> |
| 131 | + {{ organization.name }} |
| 132 | + </vcl-select-list-item> |
| 133 | + } |
| 134 | + </vcl-select-list> |
| 135 | + </vcl-select> |
| 136 | + <vcl-hint-error error="required" |
| 137 | + >This field is required.</vcl-hint-error |
| 138 | + > |
| 139 | + </vcl-form-control-group> |
| 140 | + </fieldset> |
| 141 | + } |
| 142 | + </fieldset> |
| 143 | + </section> |
| 144 | + |
| 145 | + <div class="loose-button-group row justify-content-end mt-4"> |
| 146 | + <button |
| 147 | + vcl-button |
| 148 | + class="transparent outline" |
| 149 | + type="button" |
| 150 | + routerLink="../" |
| 151 | + > |
| 152 | + Cancel |
| 153 | + </button> |
| 154 | + |
| 155 | + <button |
| 156 | + vcl-button |
| 157 | + class="emphasized" |
| 158 | + type="submit" |
| 159 | + [disabled]="form.invalid || loading" |
| 160 | + > |
| 161 | + Create User |
| 162 | + </button> |
| 163 | + </div> |
| 164 | +</form> |
0 commit comments