Skip to content
Snippets Groups Projects
group-administration.component.html 13.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • <div class="admin-container" [class.admin-is-mobile]="mobileQuery.matches">
        <mat-toolbar color="primary" class="admin-toolbar">
            <button mat-button (click)="snav.toggle()">
                <mat-icon class="maarchLogo" [svgIcon]="mobileQuery.matches ? 'maarchLogoOnly' : 'maarchLogo'"></mat-icon>
            </button>
            <h1 class="admin-toolbar-title" *ngIf="!creationMode">{{lang.groupModification}}
                <small [class.hide-for-mobile]="mobileQuery.matches">{{group.group_desc}} ({{group.group_id}})</small>
            </h1>
            <h1 class="admin-toolbar-title" *ngIf="creationMode">{{lang.groupCreation}}
                <small [class.hide-for-mobile]="mobileQuery.matches">{{group.group_desc}} ({{group.group_id}})</small>
            </h1>
            <span style="flex: 1 1 auto;"></span>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
            <menu-top></menu-top>
    
        </mat-toolbar>
        <mat-sidenav-container class="admin-sidenav-container" [style.marginTop.px]="mobileQuery.matches ? 56 : 0">
            <mat-sidenav #snav [mode]="mobileQuery.matches ? 'over' : 'side'" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56"
                [opened]="mobileQuery.matches ? false : true">
    
    Alex ORLUC's avatar
     
    Alex ORLUC committed
                <menu-nav></menu-nav>
    
                <mat-divider></mat-divider>
            </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>
    
                                <mat-form-field>
                                    <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">
                                </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>
                                </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 label="{{lang.privileges}}" *ngIf="!creationMode">
                            <mat-tab-group [(selectedIndex)]="selectedTabIndex_2" *ngIf="!creationMode">
                                <mat-tab label="{{lang.menus}}">
                                    <mat-expansion-panel *ngFor="let upperService of group.services.menu; let i = index">
                                        <mat-expansion-panel-header>
                                            <mat-panel-title>
                                                {{lang[upperService[0]['location']]}}
                                            </mat-panel-title>
                                        </mat-expansion-panel-header>
                                        <mat-list>
                                            <mat-list-item *ngFor="let service of upperService">
                                                <mat-slide-toggle color="primary" name="{{service.name}}" [checked]="service.checked" [(ngModel)]="service.checked" (change)="updateService(service)"
                                                    matTooltip="{{service.comment}}">{{service.name}}</mat-slide-toggle>
                                            </mat-list-item>
                                        </mat-list>
                                    </mat-expansion-panel>
                                </mat-tab>
    
                                <mat-tab label="{{lang.administrationServices}}">
    
                                    <div class="col-md-3" *ngFor="let service of group['services'].administration" style="padding:10px;">
                                        <mat-slide-toggle color="primary" name="{{service.name}}" [checked]="service.checked" [(ngModel)]="service.checked" (change)="updateService(service)"
                                            matTooltip="{{service.comment}}">{{service.name}}</mat-slide-toggle>
                                    </div>
    
                                </mat-tab>
                                <mat-tab label="{{lang.functionnalities}}">
                                    <mat-expansion-panel *ngFor="let upperService of group.services.use; let i = index">
                                        <mat-expansion-panel-header>
                                            <mat-panel-title>
                                                {{lang[upperService[0]['location']]}}
                                            </mat-panel-title>
                                        </mat-expansion-panel-header>
                                        <mat-list>
                                            <mat-list-item *ngFor="let service of upperService">
                                                <mat-slide-toggle color="primary" name="{{service.name}}" [checked]="service.checked" [(ngModel)]="service.checked" (change)="updateService(service)"
                                                    matTooltip="{{service.comment}}">{{service.name}}</mat-slide-toggle>
                                            </mat-list-item>
                                        </mat-list>
                                    </mat-expansion-panel>
                                </mat-tab>
                            </mat-tab-group>
    
    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;">
    
                                        <mat-form-field>
                                            <span matPrefix><mat-icon class="fa fa-user-plus" color="primary"></mat-icon>&nbsp;&nbsp;</span>
                                            <input class="autocompleteSearch" #autocompleteFilter placeholder="{{lang.linkUser}}" type="text" matInput [matAutocomplete]="auto"
                                                [formControl]="userCtrl">
                                            <mat-autocomplete #auto="matAutocomplete">
                                                <mat-option *ngFor="let user of filteredUsers | async" [value]="user.idToDisplay" (click)="linkUser(user)">
                                                    <p mat-line style="margin:0;">
                                                        <span class="col-xm-1" style="padding-right:5px;">
                                                            <mat-icon color="primary" [class]="user.type == 'entity' ? 'fa fa-sitemap fa-2x' : 'fa fa-user fa-2x'" style="margin-right:0px;"></mat-icon>
                                                        </span>
                                                        <span class="col-xm-11">
                                                            {{ user.idToDisplay }}
                                                            <small>{{ user.otherInfo }}</small>
                                                        </span>
                                                    </p>
                                                </mat-option>
                                            </mat-autocomplete>
                                        </mat-form-field>
                                        <hr/>
    
    Alex ORLUC's avatar
    Alex ORLUC committed
                                    </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>
                                    </div>
                                </div>
                                <mat-table #table [dataSource]="dataSource" matSort matSortActive="lastname" matSortDirection="asc">
                                    <ng-container matColumnDef="user_id">
                                        <mat-header-cell *matHeaderCellDef mat-sort-header>{{lang.id}}</mat-header-cell>
                                        <mat-cell *matCellDef="let element"> {{element.user_id}} </mat-cell>
                                    </ng-container>
                                    <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="displayedColumns"></mat-header-row>
                                    <mat-row *matRowDef="let row; columns: displayedColumns;" routerLink="/administration/users/{{row.id}}" matTooltip="{{lang.view}}"
                                        style="cursor:pointer;"></mat-row>
                                </mat-table>
                            </mat-tab>
    
                </mat-card>
            </mat-sidenav-content>
            <mat-sidenav #snav2 [mode]="mobileQuery.matches ? 'over' : 'side'" [fixedInViewport]="mobileQuery.matches" fixedTopGap="56"
                position='end' [opened]="mobileQuery.matches ? 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;">@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>