<section class="content">
  <div class="container-fluid">
    <div class="row align-items-center">
      <!-- Left-hand side: Title -->
      <div class="col-md-6 mb-2">
        <span class="mb-0 page-title">{{'USER_PAGE_PERMISSION_TO' | translate}} <span>{{user?.firstName}}
            {{user?.lastName}} <app-page-help-text code="USER_PAGE_PERMISSION_TO"></app-page-help-text> </span></span>
      </div>
    </div>
    <div class="card">
      <div class="body">
        <div class="row align-items-center">
          <div class="col-md-4 col-sm-12">
            <h2 class="page-title">{{'PERMISSION' | translate}}</h2>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-12">
            <div fxLayout="row wrap" *ngFor='let screen of screens; let i=index'>
              <div fxFlex="100" fxFlex.sm="100">
                <mat-checkbox color="primary" (change)="onPageSelect($event,screen.name)">
                  <b> {{screen.name.replaceAll(' ', '_').toUpperCase() | translate}}</b>
                </mat-checkbox>
              </div>
              <div class="row ms-2">
                <ng-container *ngFor='let operation of operations'>
                  <div *ngIf="checkPageAction(screen.id,operation.id)" class="col-sm-3  mb-0">
                    <mat-checkbox color="primary" [checked]="checkPermission(screen.id,operation.id)"
                      (change)="onPermissionChange($event,screen,operation)">
                      {{operation.name.replaceAll(' ', '_').toUpperCase() | translate}}
                    </mat-checkbox>
                  </div>
                </ng-container>
              </div>
            </div>
          </div>
        </div>
        <div class="m-top-10">
          <button *hasClaim="'user_permission_edit'" class="btn btn-success btn-sm me-2" (click)="saveUserClaim()"
            cdkFocusInitial><i-feather name="save" class="small-icon"></i-feather> {{'SAVE' | translate}}</button>
          <a class="btn btn-danger btn-sm" [routerLink]="['/users']"><i-feather name="x-circle" class="small-icon"></i-feather> {{'CANCEL' |
            translate}}</a>
        </div>
      </div>
    </div>
  </div>
</section>