Initial Commit - NG UI
[osm/NG-UI.git] / src / app / roles / roles-create-edit / RolesCreateEditComponent.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="row d-flex flex-row justify-content-between">
19 <div class="d-flex align-items-center header-style">
20 {{ (getRoleType == 'Add' ? 'PAGE.ROLES.CREATEROLE' : 'PAGE.ROLES.EDITROLE') | translate}}</div>
21 <span class="button">
22 <button class="btn btn-primary" type="button" (click)="viewSelection()" placement="top" container="body"
23 ngbTooltip="{{ (viewMode == 'text' ? 'PAGE.ROLES.PREVIEW' : 'PAGE.ROLES.TEXTVIEW') | translate}}"> <i
24 [ngClass]="{ 'fa': 'true', 'fa-comment': viewMode == 'text', 'fa-edit': viewMode == 'preview' }"></i>&nbsp;{{ (viewMode == 'text' ? 'PAGE.ROLES.PREVIEW' : 'PAGE.ROLES.TEXTVIEW') | translate}}
25 </button>
26 </span>
27 </div>
28 <form [formGroup]="roleForm" (ngSubmit)="roleCheck()" autocomplete="off">
29 <div class="form-group row">
30 <label class="col-sm-12 col-form-label mandatory-label"
31 [ngClass]="{'text-danger': roleForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label>
32 <label class="col-sm-2 col-form-label">{{'NAME' | translate}}*</label>
33 <div class="col-sm-5">
34 <input placeholder="{{'NAME' | translate}}" type="text" class="form-control" maxlength="30"
35 formControlName="roleName" [ngClass]="{ 'is-invalid': submitted && f.roleName.errors }" required>
36 </div>
37 </div>
38 <div class="form-group row" *ngIf="viewMode == 'text'">
39 <label class="col-sm-2 col-form-label">{{'PAGE.ROLES.PERMISSIONS' | translate}}</label>
40 <div class="col-sm-5">
41 <textarea placeholder="{{'PAGE.ROLES.YAMLPERMISSIONS' | translate}}" rows="10" cols="50" type="text"
42 class="form-control" formControlName="permissions"></textarea>
43 </div>
44 </div>
45 <div class="form-group row" [ngClass]="{ 'justify-content-end': viewMode == 'text' }">
46 <div class="col-sm-6">
47 <button type="button" class="btn btn-danger" routerLink="/roles/details">{{'CANCEL' | translate}}</button>
48 <button class="btn btn-primary ml-3"
49 type="submit">{{ (getRoleType == 'Add' ? 'CREATE' : 'APPLY') | translate}}</button>
50 </div>
51 </div>
52 </form>
53 <ngb-accordion class="roles-section" [closeOthers]="true" type="secondary" *ngIf="rolePermissions && viewMode == 'preview'">
54 <ngb-panel *ngFor="let permissionGroup of rolePermissions; let i = index">
55 <ng-template ngbPanelHeader let-opened="opened">
56 <div class="d-flex align-items-center justify-content-between">
57 <button ngbPanelToggle class="btn text-dark container-fluid text-left pl-0"><i
58 [ngClass]="{ 'fas': true, 'fa-angle-down': opened, 'fa-angle-right': !opened }"></i> {{permissionGroup.title}}</button>
59 </div>
60 </ng-template>
61 <ng-template ngbPanelContent>
62 <div class="row">
63 <div class="col-lg-4 col-md-6 col-sm-12" *ngFor="let permission of permissionGroup.permissions">
64 <div class="row">
65 <div class="col-md-6 col-sm-6 p-2">{{permission.operation}}</div>
66 <div class="btn-group btn-group-toggle custom-button col-md-6 col-sm-6" ngbRadioGroup name="permission"
67 [(ngModel)]="permission.value">
68 <label ngbButtonLabel ngbTooltip="true">
69 <input ngbButton type="radio" [value]="true">
70 <span class="bg-success"><img src="assets/images/TICK.svg" alt="Checked Icon" /></span>
71 </label>
72 <label ngbButtonLabel ngbTooltip="NA">
73 <input ngbButton type="radio" value="NA">
74 <span class="bg-warning"><img src="assets/images/TICK.svg" alt="Checked Icon" /></span>
75 </label>
76 <label ngbButtonLabel ngbTooltip="false">
77 <input ngbButton type="radio" [value]="false">
78 <span class="bg-danger"><img src="assets/images/TICK.svg" alt="Checked Icon" /></span>
79 </label>
80 </div>
81 </div>
82 </div>
83 </div>
84 </ng-template>
85 </ngb-panel>
86 </ngb-accordion>
87 <div class="float-right" *ngIf="viewMode == 'preview'">
88 <button type="button" class="btn btn-danger" routerLink="/roles/details">{{'CANCEL' | translate}}</button>
89 <button class="btn btn-primary ml-3"
90 (click)="roleCheck()">{{ (getRoleType == 'Add' ? 'CREATE' : 'APPLY') | translate}}</button>
91 </div>
92 <app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>