blob: 7f33a21354beac9752cb957f7adaecb41868a61b [file] [log] [blame]
kumaran.m3b4814a2020-05-01 19:48:54 +05301<!--
2Copyright 2020 TATA ELXSI
3
4Licensed under the Apache License, Version 2.0 (the 'License');
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15
16Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
17-->
SANDHYA.JSc84f1122024-06-04 21:50:03 +053018<div class="d-flex flex-row justify-content-between">
kumaran.m3b4814a2020-05-01 19:48:54 +053019 <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>
SANDHYA.JSc84f1122024-06-04 21:50:03 +053033 <div class="col-sm-5 mb-3">
kumaran.m3b4814a2020-05-01 19:48:54 +053034 <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>
SANDHYA.JSc84f1122024-06-04 21:50:03 +053040 <div class="col-sm-5 mb-3">
kumaran.m3b4814a2020-05-01 19:48:54 +053041 <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' }">
SANDHYA.JSc84f1122024-06-04 21:50:03 +053046 <div class="col-sm-6 mb-3">
kumaran.m3b4814a2020-05-01 19:48:54 +053047 <button type="button" class="btn btn-danger" routerLink="/roles/details">{{'CANCEL' | translate}}</button>
SANDHYA.JSc84f1122024-06-04 21:50:03 +053048 <button class="btn btn-primary ms-3"
kumaran.m3b4814a2020-05-01 19:48:54 +053049 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">
SANDHYA.JSc84f1122024-06-04 21:50:03 +053057 <button ngbPanelToggle class="btn text-dark container-fluid text-start ps-0 p-10"><i
kumaran.m3b4814a2020-05-01 19:48:54 +053058 [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>
SANDHYA.JSc84f1122024-06-04 21:50:03 +053087<div class="float-end" *ngIf="viewMode == 'preview'">
kumaran.m3b4814a2020-05-01 19:48:54 +053088 <button type="button" class="btn btn-danger" routerLink="/roles/details">{{'CANCEL' | translate}}</button>
SANDHYA.JSc84f1122024-06-04 21:50:03 +053089 <button class="btn btn-primary ms-3"
kumaran.m3b4814a2020-05-01 19:48:54 +053090 (click)="roleCheck()">{{ (getRoleType == 'Add' ? 'CREATE' : 'APPLY') | translate}}</button>
91</div>
92<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>