<iqser-page-header
    (closeAction)="routerHistoryService.navigateToLastDossiersScreen()"
    [pageLabel]="'permissions-screen.label' | translate : { targetObject }"
    [showCloseButton]="currentUser.isUser && permissionsService.has$(roles.dossiers.read) | async"
></iqser-page-header>

<iqser-table [itemSize]="80" [tableColumnConfigs]="tableColumnConfigs"></iqser-table>

<ng-template #tableItemTemplate let-entity="entity">
    <div *ngIf="cast(entity) as config">
        <div class="cell">{{ translations[targetObject][config.searchKey] | translate }}</div>
        <div *ngFor="let permission of mappedPermissions" class="center cell">
            <mat-slide-toggle
                (toggleChange)="togglePermission(config.searchKey, permission)"
                [disabled]="config.isDisabled(permission)"
                [checked]="config.isChecked(permission)"
                [attr.help-mode-key]="'dossier_permissions'"
                color="primary"
            ></mat-slide-toggle>
        </div>
    </div>
</ng-template>
