Skip to content
Snippets Groups Projects
group-administration.component.html 16.1 KiB
Newer Older
  • Learn to ignore specific revisions
  • <div class="admin-container" [class.admin-is-mobile]="appService.getViewMode()">
    
        <mat-sidenav-container autosize class="admin-sidenav-container">
            <mat-sidenav #snav [mode]="appService.getViewMode() ? 'over' : 'side'"
                [fixedInViewport]="appService.getViewMode()" fixedTopGap="56"
    
                [opened]="appService.getViewMode() ? false : true">
    
                <menu-shortcut></menu-shortcut>
    
    Alex ORLUC's avatar
     
    Alex ORLUC committed
                <menu-nav></menu-nav>
    
            </mat-sidenav>
            <mat-sidenav-content>
                <div *ngIf="loading" style="display:flex;height:100%;">
                    <mat-spinner style="margin:auto;"></mat-spinner>
                </div>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                <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">
    
                                    <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>
    
                                    <input matInput name="description" title="{{lang.label}}" placeholder="{{lang.label}}"
                                        [(ngModel)]="group.group_desc" maxlength="255" required>
    
                                </mat-form-field>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                <mat-form-field>
    
                                    <input matInput name="comment" title="{{lang.description}}"
                                        placeholder="{{lang.description}}" [(ngModel)]="group.security.maarch_comment">
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                </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)="snav2.toggle()"></mat-icon>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                </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>
    
                        <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 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 privilegeService.getAdministrations() | sortBy: 'label' | filterList:listFilterAdmin.value:'label'"
                                        style="padding:10px;">
                                        <mat-slide-toggle color="primary" name="{{administration.label}}"
                                            [checked]="group.privileges.indexOf(administration.id) > -1"
                                            (change)="toggleService($event,administration)"
                                            matTooltip="{{administration.comment}}">{{administration.label}}
                                        </mat-slide-toggle>
    
                                </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'">
    
                                        <mat-expansion-panel-header>
                                            <mat-panel-title>
    
                                                {{unit.label}}
    
                                            </mat-panel-title>
                                        </mat-expansion-panel-header>
    
                                        <ng-container *ngIf="unit.id !== 'diffusionList'; else elseTemplate">
                                            <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-template #elseTemplate>
                                            <mat-list-item *ngFor="let fakePrivilege of unit.services" color="primary"
                                                style="font-size: 16px;">
                                                {{fakePrivilege.label}}
                                                <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> {{fakePrivilege.label2}}
    
                                    </mat-expansion-panel>
                                </mat-tab>
                            </mat-tab-group>
    
                        <mat-tab label="{{lang.indexation}}" *ngIf="!creationMode">
                            <ng-template matTabContent>
                                <app-indexing-administration [groupId]="group.id"></app-indexing-administration>
                            </ng-template>
                        </mat-tab>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                        <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" [pageSize]="10">
                                    </mat-paginator>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                </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" [pageSize]="10">
                                    </mat-paginator>
                                </div>
                            </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-card>
            </mat-sidenav-content>
    
            <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'"
                [fixedInViewport]="appService.getViewMode()" fixedTopGap="56" position='end'
                [opened]="appService.getViewMode() ? false : false">
    
    
                <mat-nav-list>
                    <h3 mat-subheader>{{lang.keywordHelp}}</h3>
                </mat-nav-list>
    
    Florian Azizian's avatar
    Florian Azizian committed
                <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>
            </mat-sidenav>
        </mat-sidenav-container>