97016654a5a602f638cd632e5a1034c6425637f0
[osm/NG-UI.git] / src / app / users / add-user / AddEditUserComponent.html
1 <!--
2 Copyright 2020 TATA ELXSI
3
4 Licensed under the Apache License, Version 2.0 (the 'License');
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
17 -->
18 <div class="wrap-user" [ngClass]="{'change-password': isPassword}">
19 <form [formGroup]="userForm" (ngSubmit)="userAction(userType)" autocomplete="off">
20 <div class="modal-header">
21 <h4 class="modal-title" id="modal-basic-title">{{userTitle}}</h4>
22 <button *ngIf="!isFirstLogin" class="button-xs" type="button" class="close" aria-label="Close"
23 (click)="close()">
24 <i class="fas fa-times-circle text-danger"></i>
25 </button>
26 </div>
27 <div class="modal-body">
28 <label class="col-sm-12 col-form-label mandatory-label"
29 [ngClass]="{'text-danger': userForm.invalid === true && submitted === true && isOtp === false,'message': isPassword && userForm.invalid === true && submitted }">{{'MANDATORYCHECK'|
30 translate}}</label>
31 <div class="row form-group mb-3" *ngIf="userType === 'add' || userType === 'editUserName'|| userType === 'forgotPassword'">
32 <div class="col-sm-4">
33 <label for="userName">{{'PAGE.USERS.USERNAME' | translate}} *</label>
34 </div>
35 <div class="col-sm-8">
36 <input class="form-control" placeholder="{{'PAGE.USERS.USERNAME' | translate}}" type="text"
37 formControlName="userName" id="userName" [ngClass]="{ 'is-invalid': submitted && f.userName.errors }"
38 required>
39 </div>
40 <div *ngIf="submitted && f.userName.errors" class="input-validation-msg">
41 <div *ngIf="f.userName.errors.minlength">
42 {{'PAGE.LOGIN.USERNAMEMINLENGTHVALIDMESSAGE' | translate}} </div>
43 </div>
44 </div>
45 <div class="row form-group mb-3"
46 *ngIf="userType === 'add' || userType === 'editmail' || userType === 'forgotPassword'">
47 <div class="col-sm-4">
48 <label *ngIf="userType === 'editmail' || userType === 'add'" for="email">{{'PAGE.USERS.EMAIL' | translate}}</label>
49 <label *ngIf="userType === 'forgotPassword'" for="email">{{'PAGE.USERS.EMAIL' | translate}} *</label>
50 </div>
51 <div class="col-sm-8">
52 <input class="form-control" placeholder="{{'PAGE.USERS.EMAIL' | translate}}" type="text" formControlName="email_id"
53 id="email" [ngClass]="{ 'is-invalid': submitted && f.email_id.errors }" required>
54 </div>
55 </div>
56 <ng-container *ngIf="isOtp">
57 <div class="row form-group mb-3">
58 <div class="col-sm-4">
59 <label for="otp">{{'PAGE.USERS.OTP' | translate}} *</label>
60 </div>
61 <div class="col-sm-8">
62 <input class="form-control" placeholder="{{'PAGE.USERS.OTP' | translate}}" type="text" formControlName="otp" id="otp"
63 [ngClass]="{ 'is-invalid': submitted && f.otp.errors && isOtp === false }" required>
64 </div>
65 </div>
66 </ng-container>
67 <ng-container
68 *ngIf="userType === 'editPassword' || userType === 'add' || userType === 'changePassword' || userType === 'change_password'">
69 <div class="row form-group mb-3" *ngIf=" userType === 'changePassword'">
70 <div class="col-sm-4">
71 <label for="oldpassword">{{'PAGE.USERS.OLDPASSWORD' | translate}} *</label>
72 </div>
73 <div class="col-sm-8">
74 <input class="form-control" placeholder="{{'PAGE.USERS.OLDPASSWORD' | translate}}" type="password"
75 formControlName="old_password" id="old_password" autocomplete="old-password"
76 [ngClass]="{ 'is-invalid': submitted && f.old_password.errors }" required>
77 </div>
78 </div>
79 <div class="row form-group mb-3" *ngIf="userType === 'add' || userType === 'editPassword'">
80 <div class="col-sm-4">
81 <label for="password">{{'PAGE.USERS.PASSWORD' | translate}} *</label>
82 </div>
83 <div class="col-sm-8">
84 <input class="form-control" placeholder="{{'PAGE.USERS.PASSWORD' | translate}}" minlength="8" maxlength="50"
85 type="password" formControlName="password" id="password" autocomplete="new-password"
86 [ngClass]="{ 'is-invalid': submitted && f.password.errors }" required>
87 </div>
88 <div class="input-validation-msg" [ngClass]="{'message': isPassword}">
89 <div
90 *ngIf="userForm?.controls.password.hasError('minlength') || userForm?.controls.password.errors?.pattern">
91 {{'PAGE.LOGIN.PASSWORDMINLENGTHVALIDMESSAGE' | translate}} </div>
92 </div>
93 </div>
94 <div class="row form-group mb-3" *ngIf="userType === 'changePassword' || userType === 'change_password'">
95 <div class="col-sm-4">
96 <label for="password">{{'PAGE.USERS.NEWPASSWORD' | translate}} *</label>
97 </div>
98 <div class="col-sm-8">
99 <input class="form-control" placeholder="{{'PAGE.USERS.NEWPASSWORD' | translate}}" minlength="8"
100 maxlength="50" type="password" formControlName="password" id="password" autocomplete="new-password"
101 [ngClass]="{ 'is-invalid': submitted && f.password.errors }" required>
102 </div>
103 <div class="input-validation-msg" [ngClass]="{'message': isPassword}">
104 <div
105 *ngIf="userForm?.controls.password.hasError('minlength') || userForm?.controls.password.errors?.pattern">
106 {{'PAGE.LOGIN.PASSWORDMINLENGTHVALIDMESSAGE' | translate}} </div>
107 </div>
108 </div>
109 <div class="row form-group mb-3" *ngIf= "userType === 'editPassword' || userType === 'add'|| userType === 'change_password'|| userType === 'changePassword'">
110 <div class="col-sm-4">
111 <label for="password2">{{'PAGE.USERS.CONFPASSWORD' | translate}} *</label>
112 </div>
113 <div class="col-sm-8">
114 <input class="form-control" placeholder="{{'PAGE.USERS.CONFPASSWORD' | translate}}" type="password"
115 formControlName="password2" id="password2" autocomplete="new-password"
116 [ngClass]="{ 'is-invalid': submitted && f.password2.errors }" required>
117 <div class="mr-top-5" *ngIf="userForm?.controls.password.value && userForm?.controls.password2.value">
118 <i class="far"
119 [ngClass]="{'fa-times-circle text-danger':userForm?.controls.password.value !== userForm?.controls.password2.value,
120 'fa-check-circle text-success':userForm?.controls.password.value === userForm?.controls.password2.value}"></i>
121 {{'PAGE.USERS.PASSWORDMATCH' | translate}}
122 </div>
123 </div>
124 </div>
125 </ng-container>
126 <div class="form-group row mb-3" *ngIf="userType === 'add'">
127 <label class="col-sm-4 col-form-label">{{'DOMAIN' | translate}} {{'NAME' | translate}}</label>
128 <div class="col-sm-8">
129 <ng-select [clearable]="false" placeholder="{{'SELECT' | translate}}" [items]="domains" bindLabel="title"
130 bindValue="value" formControlName="domain_name" id="domain_name"
131 [ngClass]="{ 'is-invalid': submitted && f.domain_name.errors }"></ng-select>
132 </div>
133 </div>
134 </div>
135 <div class="modal-footer">
136 <button type="button" class="btn btn-danger" (click)="close()">{{'CANCEL' | translate}}</button>
137 <button *ngIf="userType==='add'" type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
138 <button *ngIf="userType!=='add'" type="submit" class="btn btn-primary">{{'APPLY' | translate}}</button>
139 </div>
140 </form>
141 </div>
142 <app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>