Skip to content
Snippets Groups Projects
group-administration.component.html 20.9 KiB
Newer Older
  • Learn to ignore specific revisions
  • <mat-sidenav-container autosize class="maarch-container">
        <mat-sidenav-content>
            <div class="bg-head">
                <div class="bg-head-title" [class.customContainerRight]="appService.getViewMode()">
                    <div class="bg-head-title-label">
    
                    </div>
                    <div class="bg-head-title-tool">
                        <header-right></header-right>
                    </div>
    
                <div class="bg-head-content" [class.fullContainer]="appService.getViewMode()">
                </div>
            </div>
            <div class="container" [class.fullContainer]="appService.getViewMode()">
                <div class="container-content">
                    <div *ngIf="loading" style="display:flex;height:100%;">
                        <mat-spinner style="margin:auto;"></mat-spinner>
                    </div>
                    <mat-card *ngIf="!loading" class="card-app-content">
                        <mat-tab-group [(selectedIndex)]="selectedTabIndex_1">
                            <mat-tab label="{{lang.informations}}">
                                <form class="form-horizontal" (ngSubmit)="onSubmit()" #groupForm="ngForm">
                                    <mat-form-field>
                                        <input matInput *ngIf="creationMode" name="identifier" placeholder="{{lang.id}}"
                                               [(ngModel)]="group.group_id" pattern="^[\w.-]*$" maxlength="32" required>
                                        <input matInput *ngIf="!creationMode" name="identifier" placeholder="{{lang.id}}"
                                               title="{{lang.id}}" [(ngModel)]="group.group_id" disabled>
    
                                    </mat-form-field>
    
                                    <mat-form-field>
                                        <input matInput name="description" title="{{lang.label}}" placeholder="{{lang.label}}"
                                               [(ngModel)]="group.group_desc" maxlength="255" required>
    
                                    </mat-form-field>
    
                                    <mat-form-field>
    
                                        <input matInput name="comment" title="{{lang.description}}"
                                               placeholder="{{lang.description}}" [(ngModel)]="group.security.maarch_comment">
    
                                    </mat-form-field>
                                    <mat-form-field>
    
                                    <textarea matInput name="clause" title="{{lang.clauseGroup}}"
                                              placeholder="{{lang.clauseGroup}}" [(ngModel)]="group.security.where_clause"
                                              required matTextareaAutosize matAutosizeMinRows="1"
                                              matAutosizeMaxRows="5"></textarea>
                                        <mat-icon style="cursor:pointer;" color="primary" matSuffix class="fa fa-info-circle"
                                                  matTooltip="{{lang.keywordHelper}}"
                                                  (click)="panelMode='keywordInfos';snav2.toggle()"></mat-icon>
    
                                    </mat-form-field>
    
                                    <div class="col-md-12 text-center" style="padding:10px;">
                                        <button mat-raised-button [disabled]="!groupForm.form.valid"
                                                color="primary">{{lang.save}}</button>
                                    </div>
                                </form>
                            </mat-tab>
                            <mat-tab label="{{lang.privileges}}" *ngIf="!creationMode">
                                <mat-tab-group [(selectedIndex)]="selectedTabIndex_2" *ngIf="!creationMode">
                                    <mat-tab label="{{lang.menus}}">
                                        <mat-list>
                                            <mat-list-item *ngFor="let menu of privilegeService.getMenus() | sortBy: 'label'">
                                                <mat-slide-toggle color="primary" name="{{menu.label}}"
                                                                  [checked]="group.privileges.indexOf(menu.id) > -1"
                                                                  (change)="toggleService($event,menu)" matTooltip="{{menu.comment}}">
                                                    {{menu.label}}</mat-slide-toggle>
                                            </mat-list-item>
                                        </mat-list>
                                    </mat-tab>
                                    <mat-tab label="{{lang.administrationServices}}">
                                        <mat-form-field floatLabel="never" appearance="outline" class="basketsFilter"
                                                        style="padding-left:20px;padding-right:20px;font-size: 11px;">
                                            <input matInput placeholder="{{lang.filterBy}}" #listFilterAdmin>
                                        </mat-form-field>
                                        <div class="col-md-3"
                                             *ngFor="let administration of administrationPrivileges | sortBy: 'label' | filterList:listFilterAdmin.value:'label'"
                                             style="padding:10px;">
                                            <mat-slide-toggle color="primary" name="{{administration.label}}" [(ngModel)]="administration.checked"
                                                              [checked]="administration.checked"
                                                              (change)="toggleService($event,administration)"
                                                              matTooltip="{{administration.comment}}">{{administration.label}}
                                            </mat-slide-toggle>
                                            <button mat-icon-button [class.active]="panelMode === administration.id"
                                                    *ngIf="administration.hasParams"
                                                    (click)="$event.stopPropagation();openUserParams(administration.id)"
                                                    color="primary" [title]="lang.goToAdminParams"
                                                    [disabled]="group.privileges.indexOf(administration.id) === -1">
                                                <mat-icon class="fa fa-cogs"></mat-icon>
                                            </button>
                                        </div>
                                    </mat-tab>
                                    <mat-tab label="{{lang.functionnalities}}">
                                        <mat-form-field floatLabel="never" appearance="outline" class="basketsFilter"
                                                        style="padding-left:20px;padding-right:20px;font-size: 11px;">
                                            <input matInput placeholder="{{lang.filterBy}}" #listFilter>
                                        </mat-form-field>
    
                                        <mat-expansion-panel *ngFor="let unit of unitPrivileges | sortBy: 'label'" expanded [class.emptyExpansionPanel]="(unit.services | filterList:listFilter.value:'label').length == 0">
    
                                            <mat-expansion-panel-header>
                                                <mat-panel-title>
                                                    {{unit.label}}
                                                </mat-panel-title>
                                            </mat-expansion-panel-header>
                                            <ng-container
                                                    *ngIf="['diffusionList','confidentialityAndSecurity'].indexOf(unit.id) === -1">
                                                <mat-list>
                                                    <mat-list-item
                                                            *ngFor="let privilege of unit.services | sortBy: 'label' | filterList:listFilter.value:'label'">
                                                        <mat-slide-toggle color="primary" name="{{privilege.label}}"
                                                                          [checked]="group.privileges.indexOf(privilege.id) > -1"
                                                                          (change)="toggleService($event,privilege)"
                                                                          matTooltip="{{privilege.comment}}">{{privilege.label}}
                                                        </mat-slide-toggle>
                                                    </mat-list-item>
                                                </mat-list>
                                            </ng-container>
                                            <ng-container *ngIf="unit.id === 'diffusionList'">
                                                <mat-list-item *ngFor="let fakePrivilege of unit.services" color="primary"
                                                               style="font-size: 16px;">
                                                    <span [innerHTML]="fakePrivilege.label"></span>
                                                    <mat-form-field
                                                            style="width: 250px !important;padding-left: 10px;padding-right: 10px;">
                                                        <mat-select [(ngModel)]="fakePrivilege.current"
                                                                    (selectionChange)="changeDifflistPrivilege($event, fakePrivilege.id)">
                                                            <mat-option value="">{{lang.noRole}}</mat-option>
                                                            <mat-option *ngFor="let subservice of fakePrivilege.services"
                                                                        [value]="subservice.id">{{subservice.label}}</mat-option>
                                                        </mat-select>
                                                    </mat-form-field>.
                                                </mat-list-item>
                                            </ng-container>
                                            <ng-container *ngIf="unit.id === 'confidentialityAndSecurity'">
                                                <mat-list-item *ngFor="let fakePrivilege of unit.services" color="primary"
                                                               style="font-size: 16px;">
                                                    <span [innerHTML]="fakePrivilege.label"></span>
                                                    <mat-form-field
                                                            style="width: 300px !important;padding-left: 10px;padding-right: 10px;">
                                                        <mat-select [(ngModel)]="fakePrivilege.current"
                                                                    (selectionChange)="changePersonalDataPrivilege($event)">
                                                            <mat-option value="">{{lang.notVisible}}</mat-option>
                                                            <mat-option *ngFor="let subservice of fakePrivilege.services"
                                                                        [value]="subservice.id">{{subservice.label}}</mat-option>
                                                        </mat-select>
                                                    </mat-form-field>.
                                                </mat-list-item>
                                            </ng-container>
    
                                        </mat-expansion-panel>
                                    </mat-tab>
                                </mat-tab-group>
                            </mat-tab>
                            <mat-tab label="{{lang.indexation}}" *ngIf="!creationMode">
                                <ng-template matTabContent>
                                    <app-indexing-administration [groupId]="group.id" (resfreshShortcut)="resfreshShortcut()">
                                    </app-indexing-administration>
                                </ng-template>
                            </mat-tab>
                            <mat-tab label="{{lang.relatedUsers}}" *ngIf="!creationMode">
                                <div class="row" style="margin:0px;">
                                    <div class="col-md-12" *ngIf="group.canAdminUsers" style="padding:5px;">
                                        <plugin-autocomplete [labelPlaceholder]="lang.linkUser"
                                                             [labelList]="lang.availableUsers" [routeDatas]="['/rest/autocomplete/users']"
                                                             [targetSearchKey]="'idToDisplay'" [subInfoKey]="'id'"
                                                             (triggerEvent)="linkUser($event)"></plugin-autocomplete>
                                        <hr />
                                    </div>
                                    <div class="col-md-6 col-xs-6">
                                        <mat-form-field>
                                            <input matInput (keyup)="applyFilter($event.target.value)"
                                                   placeholder="{{lang.filterBy}}">
                                        </mat-form-field>
                                    </div>
                                    <div class="col-md-6 col-xs-6">
                                        <mat-paginator #paginator [length]="100" [hidePageSize]="true" [pageSize]="10">
                                        </mat-paginator>
                                    </div>
    
                                <mat-table #sortUsers="matSort" [dataSource]="usersDataSource" matSort matSortActive="lastname"
                                           matSortDirection="asc">
                                    <ng-container matColumnDef="firstname">
                                        <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.firstname}}</mat-header-cell>
                                        <mat-cell *matCellDef="let element"> {{element.firstname}} </mat-cell>
                                    </ng-container>
                                    <ng-container matColumnDef="lastname">
                                        <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.lastname}}</mat-header-cell>
                                        <mat-cell *matCellDef="let element"> {{element.lastname}} </mat-cell>
                                    </ng-container>
                                    <mat-header-row *matHeaderRowDef="usersDisplayedColumns"></mat-header-row>
                                    <mat-row *matRowDef="let row; columns: usersDisplayedColumns;"
                                             routerLink="/administration/users/{{row.id}}" matTooltip="{{lang.view}}"
                                             style="cursor:pointer;"></mat-row>
                                </mat-table>
                            </mat-tab>
                            <mat-tab label="{{lang.relatedBaskets}}" *ngIf="!creationMode">
                                <div class="row" style="margin:0px;">
                                    <div class="col-md-6 col-xs-6">
                                        <mat-form-field>
                                            <input matInput (keyup)="applyBasketsFilter($event.target.value)"
                                                   placeholder="{{lang.filterBy}}">
                                        </mat-form-field>
                                    </div>
                                    <div class="col-md-6 col-xs-6">
                                        <mat-paginator #paginatorBaskets [length]="100" [hidePageSize]="true" [pageSize]="10">
                                        </mat-paginator>
                                    </div>
    
                                <mat-table #sortBaskets="matSort" [dataSource]="basketsDataSource" matSort
                                           matSortActive="basket_name" matSortDirection="asc">
                                    <ng-container matColumnDef="basket_name">
                                        <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.label}}</mat-header-cell>
                                        <mat-cell *matCellDef="let element"> {{element.basket_name}} </mat-cell>
                                    </ng-container>
                                    <ng-container matColumnDef="basket_desc">
                                        <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.description}}
                                        </mat-header-cell>
                                        <mat-cell *matCellDef="let element"> {{element.basket_desc}} </mat-cell>
                                    </ng-container>
                                    <mat-header-row *matHeaderRowDef="basketsDisplayedColumns"></mat-header-row>
                                    <mat-row *matRowDef="let row; columns: basketsDisplayedColumns;"
                                             routerLink="/administration/baskets/{{row.basket_id}}" matTooltip="{{lang.view}}"
                                             style="cursor:pointer;"></mat-row>
                                </mat-table>
                            </mat-tab>
                        </mat-tab-group>
                    </mat-card>
                </div>
            </div>
        </mat-sidenav-content>
    
        <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'"
                     [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" position='end'
                     [opened]="appService.getViewMode() ? false : false">
            <ng-container *ngIf="panelMode === 'keywordInfos'">
                <mat-nav-list>
                    <h3 mat-subheader>{{lang.keywordHelp}}</h3>
                </mat-nav-list>
                <mat-list role="list" style="width: 400px;padding: 5px;">
                    <p style="font-size:10px;">{{lang.keywordHelpDesc_11}}</p>
                    <div style="border:1px black solid; padding:3px;font-size:10px;">
                        <b>DESTINATION = @my_primary_entity or DESTINATION in (@subentities[@my_primary_entity])</b>
                    </div>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@user :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_1}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@user_id :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_12}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@email :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_2}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@my_entities :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_3}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@my_primary_entity :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_4}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@subentities[('entity_1',...,'entity_n')] :
                    </h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_5}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@parent_entity['entity_id'] :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_6}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@sisters_entities['entity_id'] :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_7}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@entity_type['type'] :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_8}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@all_entities :</h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_9}}</p>
                    <h4 mat-line style="font-weight:bold;font-size:10px;">@immediate_children['entity_1',...,
                        'entity_id'] :
                    </h4>
                    <p mat-line style="font-size:10px;">{{lang.keywordHelpDesc_10}}</p>
                </mat-list>
            </ng-container>
            <ng-container *ngIf="panelMode === 'admin_users'">
                <mat-nav-list>
                    <h3 mat-subheader>{{lang.adminParamsUsers}}</h3>
                </mat-nav-list>
                <mat-list role="list" style="width: 400px;padding: 5px;">
                    <p color="primary">
                        {{lang.chooseAllowedGroups}} :
                    </p>
                    <mat-selection-list #paramsList
                                        (selectionChange)="updatePrivilegeParams(paramsList.selectedOptions.selected)">
                        <mat-list-option color="primary" style="font-size: 13px;" checkboxPosition="before"
                                         *ngFor="let authorizedGroup of authorizedGroupsUserParams"
                                         [selected]="authorizedGroup.checked" [value]="authorizedGroup.id">
                            {{authorizedGroup.label}}
                        </mat-list-option>
                    </mat-selection-list>
                </mat-list>
            </ng-container>
        </mat-sidenav>
    </mat-sidenav-container>