new-profile.component.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <div class="items-container animated fadeIn">
  2. <div id="navigation" class="mb-8">
  3. <div class="prev-page prevent-select indigo_primary_background mat-elevation-z8" (click)="goBack(1)" matRipple>
  4. <mat-icon style="color: white;">arrow_back</mat-icon>
  5. <div class="page-name ml-4">Administrador de perfiles</div>
  6. </div>
  7. </div>
  8. <mat-card class="override-elevation-z8" style="width: 100%; height: 100%;">
  9. <mat-card-title style="text-align: center;" class="prevent-select">{{ tituloCard }}</mat-card-title>
  10. <mat-card-content>
  11. <div class="loader-container prevent-select animated fadeIn" *ngIf="isLoading">
  12. <mat-spinner></mat-spinner>
  13. <h2 class="loader-label">Cargando...</h2>
  14. </div>
  15. <div class="error-container prevent-select animated fadeIn fast" *ngIf="!isLoading && hasError">
  16. <mat-icon style="color: #e53935; transform: scale(5); margin: 48px;">error</mat-icon>
  17. <h1 style="color: #e53935;">¡Error!</h1>
  18. <p style="font-style: italic; font-size: 16px; overflow-wrap: anywhere; text-align: center;">{{ errorStr }}</p>
  19. </div>
  20. <div class="name-container prevent-select animated fadeIn" *ngIf="!isLoading && !hasError">
  21. <mat-form-field appearance="outline" style="width: 384px;">
  22. <mat-label>Nombre del perfil</mat-label>
  23. <input matInput placeholder="Ingresa el nombre del perfil" [formControl]="profileName" [errorStateMatcher]="errorMatcher">
  24. <mat-error *ngIf="profileName.hasError('required')">
  25. El nombre del perfil es <strong>requerido</strong>
  26. </mat-error>
  27. <mat-error *ngIf="profileName.hasError('minlength')">
  28. El nombre del perfil debe tener al menos <strong>8 caracteres</strong>
  29. </mat-error>
  30. <mat-error *ngIf="profileName.hasError('maxlength')">
  31. El nombre del perfil debe tener máximo <strong>50 caracteres</strong>
  32. </mat-error>
  33. </mat-form-field>
  34. <h2>Asignar permisos</h2>
  35. <div class="accordion-container">
  36. <mat-accordion class="example-headers-align">
  37. <mat-expansion-panel *ngFor="let module of permissions" class="mat-elevation-z0 borders">
  38. <mat-expansion-panel-header>
  39. <mat-panel-title>
  40. {{ module.id }}
  41. </mat-panel-title>
  42. <mat-panel-description>
  43. {{ module.name }}
  44. <mat-chip-listbox>
  45. <mat-chip class="white_font no_wrap" [ngClass]="{
  46. green_primary_background: module.access == 2,
  47. amber_primary_background: module.access == 1,
  48. red_primary_background: module.access == 0
  49. }" (click)="enableModule(module.id)">{{ getAccessText(module.access) }}</mat-chip>
  50. </mat-chip-listbox>
  51. </mat-panel-description>
  52. </mat-expansion-panel-header>
  53. <mat-accordion *ngIf="hasChildren(module.id)" class="example-headers-align">
  54. <mat-expansion-panel *ngFor="let submodule of module.children" class="mat-elevation-z0 borders">
  55. <mat-expansion-panel-header>
  56. <mat-panel-title>
  57. {{ submodule.id }}
  58. </mat-panel-title>
  59. <mat-panel-description>
  60. {{ submodule.name }}
  61. <mat-chip-listbox>
  62. <mat-chip class="white_font no_wrap" [ngClass]="{
  63. green_primary_background: submodule.access == 2,
  64. amber_primary_background: submodule.access == 1,
  65. red_primary_background: submodule.access == 0
  66. }" (click)="enableSubmodule(module.id, submodule.id)">{{ getAccessText(submodule.access) }}</mat-chip>
  67. </mat-chip-listbox>
  68. </mat-panel-description>
  69. </mat-expansion-panel-header>
  70. <mat-accordion class="example-headers-align">
  71. <mat-expansion-panel *ngFor="let function of submodule.children" [hideToggle]="function.children == undefined || function.children == null || function.children.length == 0" class="mat-elevation-z0 borders">
  72. <mat-expansion-panel-header>
  73. <mat-panel-title>
  74. {{ function.id }}
  75. </mat-panel-title>
  76. <mat-panel-description>
  77. {{ function.name }}
  78. <mat-chip-listbox>
  79. <mat-chip class="white_font no_wrap" [ngClass]="{
  80. green_primary_background: function.access == 2,
  81. amber_primary_background: function.access == 1,
  82. red_primary_background: function.access == 0
  83. }" (click)="enableFunction(module.id, submodule.id, function.id)">{{ getAccessText(function.access) }}</mat-chip>
  84. </mat-chip-listbox>
  85. </mat-panel-description>
  86. </mat-expansion-panel-header>
  87. <mat-accordion *ngIf="!(function.children == undefined || function.children == null || function.children.length == 0)" class="example-headers-align">
  88. <mat-expansion-panel *ngFor="let screen of function.children" hideToggle class="mat-elevation-z0 borders">
  89. <mat-expansion-panel-header>
  90. <mat-panel-title>
  91. {{ screen.id }}
  92. </mat-panel-title>
  93. <mat-panel-description>
  94. {{ screen.name }}
  95. <mat-chip-listbox>
  96. <mat-chip class="white_font no_wrap" [ngClass]="{
  97. green_primary_background: screen.access == 2,
  98. amber_primary_background: screen.access == 1,
  99. red_primary_background: screen.access == 0
  100. }" (click)="enableScren(module.id, submodule.id, function.id, screen.id)">{{ getAccessText(screen.access) }}</mat-chip>
  101. </mat-chip-listbox>
  102. </mat-panel-description>
  103. </mat-expansion-panel-header>
  104. </mat-expansion-panel>
  105. </mat-accordion>
  106. </mat-expansion-panel>
  107. </mat-accordion>
  108. </mat-expansion-panel>
  109. </mat-accordion>
  110. <div *ngIf="!hasChildren(module.id)" class="img-container">
  111. <img src="assets/img/empty_data.svg" alt="prueba" width="128px" class="mb-8">
  112. <p>No se encontró información</p>
  113. </div>
  114. </mat-expansion-panel>
  115. </mat-accordion>
  116. </div>
  117. </div>
  118. </mat-card-content>
  119. <mat-card-actions align="end" *ngIf="!isLoading && !hasError">
  120. <div matTooltip="Su perfil no cuenta con los permisos suficientes para ejecutar esta acción."
  121. [matTooltipDisabled]="realTimeUpdateEnabled" *ngIf="action != 'detalles'">
  122. <button mat-button (click)="save()" [disabled]="!realTimeUpdateEnabled">Guardar perfil</button>
  123. </div>
  124. </mat-card-actions>
  125. </mat-card>
  126. </div>