|
| 1 | +<div class="modal-overlay" [class.active]="isOpen" (click)="closeModal()"> |
| 2 | + <div |
| 3 | + class="modal-content" |
| 4 | + [class.active]="isOpen" |
| 5 | + (click)="$event.stopPropagation()" |
| 6 | + > |
| 7 | + <div class="modal-header"> |
| 8 | + <h2>Tạo người dùng mới</h2> |
| 9 | + <button class="close-btn" (click)="closeModal()">×</button> |
| 10 | + </div> |
| 11 | + |
| 12 | + <div class="modal-body"> |
| 13 | + <form [formGroup]="createUserForm" (ngSubmit)="onSubmit()"> |
| 14 | + <div class="steps-container"> |
| 15 | + <!-- STEP 1 --> |
| 16 | + <div class="form-step" [class.active]="currentStep === 1"> |
| 17 | + <div class="form-group"> |
| 18 | + <label>Vai trò hệ thống *</label> |
| 19 | + <select formControlName="role"> |
| 20 | + <option value="STUDENT">Học sinh</option> |
| 21 | + <option value="TEACHER">Giáo viên</option> |
| 22 | + <option value="ADMIN">Quản trị viên</option> |
| 23 | + </select> |
| 24 | + </div> |
| 25 | + |
| 26 | + <div class="form-group"> |
| 27 | + <label>Giới tính *</label> |
| 28 | + <select formControlName="gender"> |
| 29 | + <option [ngValue]="true">Nam</option> |
| 30 | + <option [ngValue]="false">Nữ</option> |
| 31 | + </select> |
| 32 | + </div> |
| 33 | + |
| 34 | + <div class="form-grid-2"> |
| 35 | + <div class="form-group"> |
| 36 | + <label for="firstName">Họ *</label> |
| 37 | + <input type="text" id="firstName" formControlName="firstName" /> |
| 38 | + </div> |
| 39 | + <div class="form-group"> |
| 40 | + <label for="lastName">Tên *</label> |
| 41 | + <input type="text" id="lastName" formControlName="lastName" /> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + |
| 45 | + <div class="form-group"> |
| 46 | + <label for="username">User Name *</label> |
| 47 | + <input type="text" id="username" formControlName="username" /> |
| 48 | + </div> |
| 49 | + |
| 50 | + <div class="form-group"> |
| 51 | + <label for="email">Email *</label> |
| 52 | + <input type="email" id="email" formControlName="email" /> |
| 53 | + </div> |
| 54 | + |
| 55 | + <div class="form-group"> |
| 56 | + <label for="password">Mật khẩu *</label> |
| 57 | + <input type="password" id="password" formControlName="password" /> |
| 58 | + </div> |
| 59 | + |
| 60 | + <div class="form-group"> |
| 61 | + <label for="displayName">Tên hiển thị *</label> |
| 62 | + <input |
| 63 | + type="text" |
| 64 | + id="displayName" |
| 65 | + formControlName="displayName" |
| 66 | + /> |
| 67 | + </div> |
| 68 | + |
| 69 | + <!-- Ngày sinh --> |
| 70 | + <div class="form-group"> |
| 71 | + <label for="dob">Ngày sinh *</label> |
| 72 | + <input type="date" id="dob" formControlName="dob" /> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | + |
| 76 | + <!-- STEP 2 --> |
| 77 | + <div class="form-step" [class.active]="currentStep === 2"> |
| 78 | + <div class="form-group"> |
| 79 | + <label for="bio">Tiểu sử</label> |
| 80 | + <textarea id="bio" rows="3" formControlName="bio"></textarea> |
| 81 | + </div> |
| 82 | + |
| 83 | + <div class="form-group"> |
| 84 | + <label for="education">Trình độ học vấn</label> |
| 85 | + <select id="education" formControlName="education"> |
| 86 | + <option |
| 87 | + *ngFor="let option of educationOptions" |
| 88 | + [value]="option.value" |
| 89 | + > |
| 90 | + {{ option.label }} |
| 91 | + </option> |
| 92 | + </select> |
| 93 | + </div> |
| 94 | + |
| 95 | + <div class="form-group"> |
| 96 | + <label for="links">Liên kết cá nhân</label> |
| 97 | + <input |
| 98 | + type="text" |
| 99 | + id="links" |
| 100 | + formControlName="links" |
| 101 | + placeholder="https://..." |
| 102 | + /> |
| 103 | + </div> |
| 104 | + |
| 105 | + <div class="form-group"> |
| 106 | + <label for="city">Thành phố</label> |
| 107 | + <input type="text" id="city" formControlName="city" /> |
| 108 | + </div> |
| 109 | + |
| 110 | + <div class="form-group org-search-group"> |
| 111 | + <label for="organization">Tổ chức *</label> |
| 112 | + <input |
| 113 | + type="text" |
| 114 | + id="organization" |
| 115 | + placeholder="Tìm kiếm theo tên tổ chức..." |
| 116 | + [value]="selectedOrganizationName || ''" |
| 117 | + (input)="onOrgSearchInput($event)" |
| 118 | + (focus)="showOrgDropdown = true" |
| 119 | + /> |
| 120 | + |
| 121 | + <div class="org-dropdown" *ngIf="showOrgDropdown"> |
| 122 | + <div *ngIf="isSearchingOrgs" class="dropdown-item loading"> |
| 123 | + Đang tìm... |
| 124 | + </div> |
| 125 | + <div |
| 126 | + *ngIf="!isSearchingOrgs && searchedOrganizations.length === 0" |
| 127 | + class="dropdown-item not-found" |
| 128 | + > |
| 129 | + Không tìm thấy kết quả. |
| 130 | + </div> |
| 131 | + <div |
| 132 | + *ngFor="let org of searchedOrganizations" |
| 133 | + class="dropdown-item" |
| 134 | + (click)="selectOrganization(org)" |
| 135 | + > |
| 136 | + {{ org.name }} |
| 137 | + </div> |
| 138 | + </div> |
| 139 | + </div> |
| 140 | + |
| 141 | + <div class="form-group"> |
| 142 | + <label>Vai trò trong tổ chức *</label> |
| 143 | + <select formControlName="organizationMemberRole"> |
| 144 | + <option value="STUDENT">Học sinh</option> |
| 145 | + <option value="TEACHER">Giáo viên</option> |
| 146 | + <option value="ADMIN">Quản trị viên</option> |
| 147 | + </select> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | + </form> |
| 152 | + </div> |
| 153 | + |
| 154 | + <div class="modal-footer"> |
| 155 | + <button |
| 156 | + class="btn btn-secondary" |
| 157 | + *ngIf="currentStep === 2" |
| 158 | + (click)="prevStep()" |
| 159 | + > |
| 160 | + Quay lại |
| 161 | + </button> |
| 162 | + |
| 163 | + <button |
| 164 | + class="btn btn-primary" |
| 165 | + *ngIf="currentStep === 1" |
| 166 | + (click)="nextStep()" |
| 167 | + > |
| 168 | + Tiếp theo |
| 169 | + </button> |
| 170 | + |
| 171 | + <button |
| 172 | + class="btn btn-primary" |
| 173 | + *ngIf="currentStep === 2" |
| 174 | + [disabled]="isSubmitting" |
| 175 | + (click)="onSubmit()" |
| 176 | + > |
| 177 | + <span *ngIf="!isSubmitting">Tạo người dùng</span> |
| 178 | + <span *ngIf="isSubmitting" class="spinner"></span> |
| 179 | + </button> |
| 180 | + </div> |
| 181 | + </div> |
| 182 | +</div> |
0 commit comments