diff --git a/src/frontend/app/administration/user/user-administration.component.html b/src/frontend/app/administration/user/user-administration.component.html index c5da582d291aa903a1ea7ea7149ac4d8c209a59c..6ea4ee7a152c7c57c9ac6610f923140b3317e3f9 100755 --- a/src/frontend/app/administration/user/user-administration.component.html +++ b/src/frontend/app/administration/user/user-administration.component.html @@ -95,7 +95,8 @@ {{this.ruleText}}</div> <div class="col-sm-6" style="padding-left:0px;padding-right: 0px;"> <mat-form-field style="padding:10px;"> - <input matInput #inputPasswd placeholder="{{'lang.typeNewPassword' | translate}}" + <input matInput #inputPasswd + placeholder="{{'lang.typeNewPassword' | translate}}" formControlName="newPasswordCtrl" required [type]="hidePassword ? 'password' : 'text'"> <mat-icon matSuffix (click)="hidePassword = !hidePassword" @@ -110,8 +111,9 @@ </div> <div class="col-sm-6" style="padding-left:0px;padding-right:0px;"> <mat-form-field style="padding:10px;"> - <input matInput #inputPasswd2 placeholder="{{'lang.retypeNewPassword' | translate}}" - required [type]="hidePassword ? 'password' : 'text'" + <input matInput #inputPasswd2 + placeholder="{{'lang.retypeNewPassword' | translate}}" required + [type]="hidePassword ? 'password' : 'text'" formControlName="retypePasswordCtrl"> <mat-icon matSuffix (click)="hidePassword = !hidePassword" class="fa fa-2x" @@ -157,11 +159,14 @@ </div> <div class="input-group"> <mat-form-field> - <input matInput *ngIf="creationMode" type="text" title="{{'lang.id' | translate}}" - name="user_id" [(ngModel)]="user.userId" placeholder="{{'lang.id' | translate}}" - pattern="^[\w.@-]*$" required (keyup)="setLowerUserId()" maxlength="128"> - <input matInput *ngIf="!creationMode" type="text" title="{{'lang.id' | translate}}" - value="{{user.user_id}}" placeholder="{{'lang.id' | translate}}" disabled> + <input matInput *ngIf="creationMode" type="text" + title="{{'lang.id' | translate}}" name="user_id" + [(ngModel)]="user.userId" placeholder="{{'lang.id' | translate}}" + pattern="^[\w.@-]*$" required (keyup)="setLowerUserId()" + maxlength="128"> + <input matInput *ngIf="!creationMode" type="text" + title="{{'lang.id' | translate}}" value="{{user.user_id}}" + placeholder="{{'lang.id' | translate}}" disabled> </mat-form-field> </div> </div> @@ -170,21 +175,24 @@ <div class="col-sm-5" style="font-weight:bold;"> <mat-form-field> <input matInput type="text" id="lastname" name="lastname" maxlength="255" - title="{{'lang.lastname' | translate}}" placeholder="{{'lang.lastname' | translate}}" + title="{{'lang.lastname' | translate}}" + placeholder="{{'lang.lastname' | translate}}" [(ngModel)]="user.lastname" required> </mat-form-field> </div> <div class="col-sm-5" style="font-weight:bold;"> <mat-form-field> <input matInput type="text" id="firstname" name="firstname" maxlength="255" - title="{{'lang.firstname' | translate}}" placeholder="{{'lang.firstname' | translate}}" + title="{{'lang.firstname' | translate}}" + placeholder="{{'lang.firstname' | translate}}" [(ngModel)]="user.firstname" required> </mat-form-field> </div> <div class="col-sm-2" style="font-style:italic;"> <mat-form-field> <input matInput type="text" id="initials" name="initials" maxlength="32" - title="{{'lang.initials' | translate}}" placeholder="{{'lang.initials' | translate}}" + title="{{'lang.initials' | translate}}" + placeholder="{{'lang.initials' | translate}}" [(ngModel)]="user.initials"> </mat-form-field> </div> @@ -193,7 +201,8 @@ <div class="col-sm-12"> <mat-form-field> <input matInput type="tel" id="phone" name="phone" maxlength="32" - title="{{'lang.phoneNumber' | translate}}" placeholder="{{'lang.phoneNumber' | translate}}" + title="{{'lang.phoneNumber' | translate}}" + placeholder="{{'lang.phoneNumber' | translate}}" [(ngModel)]="user.phone" pattern="\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$" [disabled]="(creationMode && !canManagePersonalDatas) || (!creationMode && (!canManagePersonalDatas || !canViewPersonalDatas))"> </mat-form-field> @@ -202,8 +211,10 @@ <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput type="email" id="mail" name="mail" title="{{'lang.email' | translate}}" - placeholder="{{'lang.email' | translate}}" [(ngModel)]="user.mail" maxlength="255" + <input matInput type="email" id="mail" name="mail" + title="{{'lang.email' | translate}}" + placeholder="{{'lang.email' | translate}}" [(ngModel)]="user.mail" + maxlength="255" pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" required> </mat-form-field> </div> @@ -219,7 +230,8 @@ <mat-form-field> <mat-label>{{'lang.accountType' | translate}}</mat-label> <mat-select [(ngModel)]="user.mode" id="accountType" name="accountType" - required [disabled]="headerService.user.mode === 'standard' && ['root_visible','root_invisible'].indexOf(user.mode) > -1"> + required + [disabled]="headerService.user.mode === 'standard' && ['root_visible','root_invisible'].indexOf(user.mode) > -1"> <ng-container *ngFor="let mode of adminModes | sortBy : 'label'"> <mat-option [value]="mode.id" [disabled]="headerService.user.mode === 'standard' && ['root_visible','root_invisible'].indexOf(mode.id) > -1" @@ -233,8 +245,11 @@ <div *ngIf="user.mode === 'rest'"> <mat-form-field> <mat-label>{{'lang.authorizedRoutes' | translate}}</mat-label> - <textarea matInput name="authorizedApi" [(ngModel)]="user.authorizedApi" placeholder="Ex : PUT/attachments/{id}"></textarea> - <mat-hint>{{'lang.authorizedRoutesInformations' | translate}} <a href="https://docs.maarch.org/gitbook/html/MaarchCourrier/{{appVersion}}/guat/guat_architecture/API_REST/home.html" target="_blank">{{'lang.here' | translate}}</a></mat-hint> + <textarea matInput name="authorizedApi" [(ngModel)]="user.authorizedApi" + placeholder="Ex : PUT/attachments/{id}"></textarea> + <mat-hint>{{'lang.authorizedRoutesInformations' | translate}} <a + href="https://docs.maarch.org/gitbook/html/MaarchCourrier/{{appVersion}}/guat/guat_architecture/API_REST/home.html" + target="_blank">{{'lang.here' | translate}}</a></mat-hint> </mat-form-field> </div> </mat-expansion-panel> @@ -260,7 +275,9 @@ </mat-nav-list> </mat-tab> <mat-tab *ngIf="!creationMode" label="{{'lang.entities' | translate}}"> - <app-maarch-flat-tree #maarchTree (afterSelectNode)="addEntity($event)" [selectionPropagation]="false" [openState]="'all'" (afterDeselectNode)="deleteEntity($event)"></app-maarch-flat-tree> + <app-maarch-flat-tree #maarchTree (afterSelectNode)="addEntity($event)" + [selectionPropagation]="false"  [openState]="'all'" + (afterDeselectNode)="deleteEntity($event)"></app-maarch-flat-tree> </mat-tab> <mat-tab *ngIf="!creationMode" label="{{'lang.baskets' | translate}}"> <div class="col-sm-6" style="overflow:hidden;"> @@ -269,7 +286,8 @@ <mat-icon mat-list-icon color="primary"> <mat-checkbox color="primary" (change)="$event ? masterToggleBaskets($event) : null" - [checked]="selectionBaskets.hasValue()" matTooltip="{{'lang.selectAll' | translate}}"> + [checked]="selectionBaskets.hasValue()" + matTooltip="{{'lang.selectAll' | translate}}"> </mat-checkbox> </mat-icon> <p mat-line *ngIf="!selectionBaskets.hasValue()" @@ -282,11 +300,13 @@ <mat-icon class="fa fa-reply"></mat-icon> <mat-divider [vertical]="true" class="vertical-divider"></mat-divider> </button> - <button color="warn" mat-icon-button matTooltip="{{'lang.disableBasket' | translate}}" + <button color="warn" mat-icon-button + matTooltip="{{'lang.disableBasket' | translate}}" (click)="toggleBasket(false)"> <mat-icon class="fa fa-ban"></mat-icon> </button> - <button color="accent" mat-icon-button matTooltip="{{'lang.enableBasket' | translate}}" + <button color="accent" mat-icon-button + matTooltip="{{'lang.enableBasket' | translate}}" (click)="toggleBasket(true)"> <mat-icon class="fa fa-check"></mat-icon> </button> @@ -295,6 +315,8 @@ [routeDatas]="['/rest/autocomplete/users']" [targetSearchKey]="'idToDisplay'" [subInfoKey]="'descriptionToDisplay'" + [disableItems]="[user.id]" + [styles]="['no-margin']" (triggerEvent)="addBasketRedirection($event)" appearance="outline"> </plugin-autocomplete> </mat-menu> @@ -399,8 +421,10 @@ </mat-tab-group> </div> </mat-tab> - <mat-tab *ngIf="!creationMode" label="{{'lang.signatures' | translate}}" [disabled]="!canViewPersonalDatas"> - <div *ngIf="canManagePersonalDatas" dnd-droppable matTooltip="{{'lang.uploadSignFileInfo' | translate}}" + <mat-tab *ngIf="!creationMode" label="{{'lang.signatures' | translate}}" + [disabled]="!canViewPersonalDatas"> + <div *ngIf="canManagePersonalDatas" dnd-droppable + matTooltip="{{'lang.uploadSignFileInfo' | translate}}" (click)="clickOnUploader('uploadSignFile')" [class.dndFileHighlighted]="highlightMe" (dragover)="highlightMe=true" (dragleave)="highlightMe=false" (onDropSuccess)="test($event);highlightMe=false;" class="dndFile"> @@ -414,7 +438,8 @@ <mat-card-content style="text-align:center;"> <mat-form-field floatLabel="never"> <input matInput type="text" [(ngModel)]="signature.signature_label" - name="selectedSignatureLabel" placeholder="{{'lang.label' | translate}}" + name="selectedSignatureLabel" + placeholder="{{'lang.label' | translate}}" (change)="updateSignature(i)" [disabled]="!canManagePersonalDatas"> <button mat-button matSuffix mat-icon-button @@ -493,7 +518,8 @@ {{element.event_date | date : "dd/MM/y HH:mm"}}</mat-cell> </ng-container> <ng-container matColumnDef="record_id"> - <mat-header-cell *matHeaderCellDef style="flex:1;">{{'lang.technicalId' | translate}} + <mat-header-cell *matHeaderCellDef style="flex:1;"> + {{'lang.technicalId' | translate}} </mat-header-cell> <mat-cell *matCellDef="let element" style="flex:1;">{{element.record_id}} </mat-cell> @@ -545,7 +571,8 @@ <p mat-line> <mat-form-field style="font-size:10px;"> <input matInput type="text" id="role" name="role" title="{{'lang.role' | translate}}" - placeholder="{{'lang.role' | translate}}" [(ngModel)]="userGroup.role" (change)="updateGroup(userGroup)"> + placeholder="{{'lang.role' | translate}}" [(ngModel)]="userGroup.role" + (change)="updateGroup(userGroup)"> <mat-hint matTooltip="{{'lang.perimeter' | translate}}">{{userGroup.maarch_comment}}</mat-hint> </mat-form-field> </p> @@ -559,7 +586,8 @@ style="position:relative;"> <button mat-icon-button style="cursor:pointer;position: absolute;right: -20px;top: -20px;font-size:10px;" - (click)="updatePrimaryEntity(userEntity)" matTooltip="{{'lang.entityTooglePrimary' | translate}}"> + (click)="updatePrimaryEntity(userEntity)" + matTooltip="{{'lang.entityTooglePrimary' | translate}}"> <mat-icon class="fa fa-arrow-up"></mat-icon> </button> </mat-icon> @@ -580,4 +608,4 @@ </mat-list> </mat-sidenav> -</mat-sidenav-container> +</mat-sidenav-container> \ No newline at end of file diff --git a/src/frontend/app/profile.component.html b/src/frontend/app/profile.component.html index d49561c4fdfce27b1c454ac95a2a0583d4cbac31..b34cf92e23cbe1c7e71de700ae2e70b86f2c6285 100755 --- a/src/frontend/app/profile.component.html +++ b/src/frontend/app/profile.component.html @@ -42,12 +42,12 @@ <div class="form-group"> <mat-form-field style="padding:10px;"> <input matInput placeholder="{{'lang.typeCurrentPassword' | translate}}" - formControlName="currentPasswordCtrl" required - [type]="hidePassword ? 'password' : 'text'"> + formControlName="currentPasswordCtrl" required + [type]="hidePassword ? 'password' : 'text'"> <mat-icon matSuffix (click)="hidePassword = !hidePassword" class="fa fa-2x" - [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> + [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> <mat-error - *ngIf="firstFormGroup.controls['currentPasswordCtrl'].hasError('required')"> + *ngIf="firstFormGroup.controls['currentPasswordCtrl'].hasError('required')"> {{'lang.requiredField' | translate}}</mat-error> </mat-form-field> </div> @@ -56,11 +56,13 @@ {{this.ruleText}}</div> <div class="col-sm-6" style="padding-left:0px;padding-right: 0px;"> <mat-form-field style="padding:10px;"> - <input matInput #inputPasswd placeholder="{{'lang.typeNewPassword' | translate}}" - formControlName="newPasswordCtrl" required - [type]="hidePassword ? 'password' : 'text'"> - <mat-icon matSuffix (click)="hidePassword = !hidePassword" class="fa fa-2x" - [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> + <input matInput #inputPasswd + placeholder="{{'lang.typeNewPassword' | translate}}" + formControlName="newPasswordCtrl" required + [type]="hidePassword ? 'password' : 'text'"> + <mat-icon matSuffix (click)="hidePassword = !hidePassword" + class="fa fa-2x" + [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> <mat-hint *ngIf="validPassword"> <i color="accent" class="fa fa-check"></i> <span color="accent">{{'lang.passwordValid' | translate}}</span> @@ -70,13 +72,15 @@ </div> <div class="col-sm-6" style="padding-left:0px;padding-right:0px;"> <mat-form-field style="padding:10px;"> - <input matInput #inputPasswd2 placeholder="{{'lang.retypeNewPassword' | translate}}" - required [type]="hidePassword ? 'password' : 'text'" - formControlName="retypePasswordCtrl"> - <mat-icon matSuffix (click)="hidePassword = !hidePassword" class="fa fa-2x" - [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> + <input matInput #inputPasswd2 + placeholder="{{'lang.retypeNewPassword' | translate}}" required + [type]="hidePassword ? 'password' : 'text'" + formControlName="retypePasswordCtrl"> + <mat-icon matSuffix (click)="hidePassword = !hidePassword" + class="fa fa-2x" + [ngClass]="[hidePassword ? 'fa-eye-slash' : 'fa-eye']"></mat-icon> <mat-hint - *ngIf="!firstFormGroup.controls['retypePasswordCtrl'].hasError('mismatch') && firstFormGroup.controls['retypePasswordCtrl'].value != ''"> + *ngIf="!firstFormGroup.controls['retypePasswordCtrl'].hasError('mismatch') && firstFormGroup.controls['retypePasswordCtrl'].value != ''"> <i color="accent" class="fa fa-check"></i> <span color="accent">{{'lang.passwordMatch' | translate}}</span> </mat-hint> @@ -85,25 +89,25 @@ </div> </div> <div *ngIf="passwordRules.renewal.enabled || passwordRules.historyLastUse.enabled" - class="form-group"> + class="form-group"> <div class="col-sm-12" style="padding-left:0px;padding-right:0px;"> <div class="alert alert-warning" role="alert" [innerHTML]="otherRuleText" - style="text-align:center;"></div> + style="text-align:center;"></div> </div> </div> <div class="form-group"> <div style="text-align:center;"> <button mat-raised-button color="primary" type="button" - (click)="updatePassword()" - [disabled]="!firstFormGroup.valid">{{'lang.update' | translate}}</button> + (click)="updatePassword()" + [disabled]="!firstFormGroup.valid">{{'lang.update' | translate}}</button> <button mat-raised-button color="default" type="button" - (click)="showPassword=false">{{'lang.cancel' | translate}}</button> + (click)="showPassword=false">{{'lang.cancel' | translate}}</button> </div> </div> </form> </div> <form class="form-horizontal" (ngSubmit)="onSubmit()" #profileForm="ngForm" - *ngIf="!showPassword"> + *ngIf="!showPassword"> <div class="form-group"> <div class="col-sm-12"> <div class="pull-left"> @@ -113,8 +117,9 @@ </div> <div class="input-group"> <mat-form-field> - <input matInput type="text" title="{{'lang.id' | translate}}" value="{{user.user_id}}" - placeholder="{{'lang.id' | translate}}" disabled> + <input matInput type="text" title="{{'lang.id' | translate}}" + value="{{user.user_id}}" placeholder="{{'lang.id' | translate}}" + disabled> </mat-form-field> </div> </div> @@ -123,47 +128,52 @@ <div class="col-sm-5" style="font-weight:bold;"> <mat-form-field> <input matInput type="text" id="lastname" name="lastname" - title="{{'lang.lastname' | translate}}" placeholder="{{'lang.lastname' | translate}}" - [(ngModel)]="user.lastname" required> + title="{{'lang.lastname' | translate}}" + placeholder="{{'lang.lastname' | translate}}" + [(ngModel)]="user.lastname" required> </mat-form-field> </div> <div class="col-sm-5" style="font-weight:bold;"> <mat-form-field> <input matInput type="text" id="firstname" name="firstname" - title="{{'lang.firstname' | translate}}" placeholder="{{'lang.firstname' | translate}}" - [(ngModel)]="user.firstname" required> + title="{{'lang.firstname' | translate}}" + placeholder="{{'lang.firstname' | translate}}" + [(ngModel)]="user.firstname" required> </mat-form-field> </div> <div class="col-sm-2" style="font-style:italic;"> <mat-form-field> <input matInput type="text" id="initials" name="initials" - title="{{'lang.initials' | translate}}" placeholder="{{'lang.initials' | translate}}" - [(ngModel)]="user.initials"> + title="{{'lang.initials' | translate}}" + placeholder="{{'lang.initials' | translate}}" + [(ngModel)]="user.initials"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput type="tel" id="phone" name="phone" title="{{'lang.phoneNumber' | translate}}" - placeholder="{{'lang.phoneNumber' | translate}}" [(ngModel)]="user.phone" - pattern="\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$"> + <input matInput type="tel" id="phone" name="phone" + title="{{'lang.phoneNumber' | translate}}" + placeholder="{{'lang.phoneNumber' | translate}}" + [(ngModel)]="user.phone" pattern="\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput type="email" id="mail" name="mail" title="{{'lang.email' | translate}}" - placeholder="{{'lang.email' | translate}}" [(ngModel)]="user.mail" - pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" required> + <input matInput type="email" id="mail" name="mail" + title="{{'lang.email' | translate}}" + placeholder="{{'lang.email' | translate}}" [(ngModel)]="user.mail" + pattern="(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)" required> </mat-form-field> </div> </div> <div class="form-group" style="margin-top: 10px;"> <div style="text-align:center;"> <button mat-raised-button color="primary" type="submit" - [disabled]="!profileForm.form.valid">{{'lang.update' | translate}}</button> + [disabled]="!profileForm.form.valid">{{'lang.update' | translate}}</button> </div> </div> </form> @@ -174,7 +184,7 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-file-word" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> <span>{{'lang.editorOption' | translate}}</span> </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -182,14 +192,19 @@ </mat-panel-description> </mat-expansion-panel-header> - <div class="col-sm-12 col-md-4" style="line-height: 50px;">{{'lang.documentEditor' | translate}}</div> + <div class="col-sm-12 col-md-4" style="line-height: 50px;"> + {{'lang.documentEditor' | translate}}</div> <div class="col-sm-12 col-md-8"> <mat-form-field> - <mat-select name="documentEdition" [(ngModel)]="user.preferences.documentEdition" - (selectionChange)="updateUserPreferences();"> - <mat-option *ngFor='let editor of editorsList' [value]="editor">{{editor}}</mat-option> + <mat-select name="documentEdition" + [(ngModel)]="user.preferences.documentEdition" + (selectionChange)="updateUserPreferences();"> + <mat-option *ngFor='let editor of editorsList' [value]="editor"> + {{editor}}</mat-option> </mat-select> - <mat-hint>{{'lang.documentEditor_' + user.preferences.documentEdition | translate}}</mat-hint> + <mat-hint> + {{'lang.documentEditor_' + user.preferences.documentEdition | translate}} + </mat-hint> </mat-form-field> </div> </mat-expansion-panel> @@ -197,9 +212,10 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-inbox" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> <mat-icon color="primary" class="fa fa-magic" - style="position: absolute;margin-left: 30px;margin-top: -10px;"></mat-icon> + style="position: absolute;margin-left: 30px;margin-top: -10px;"> + </mat-icon> <span>{{'lang.basketsColor' | translate}}</span> </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -208,19 +224,22 @@ </mat-expansion-panel-header> <mat-list> - <ng-container *ngFor="let regroupedBasket of user.regroupedBaskets; let i = index"> + <ng-container + *ngFor="let regroupedBasket of user.regroupedBaskets; let i = index"> <h3 *ngIf="regroupedBasket.baskets[0]">{{regroupedBasket.groupDesc}}</h3> - <mat-list-item *ngFor="let basket of regroupedBasket.baskets; let y = index"> + <mat-list-item + *ngFor="let basket of regroupedBasket.baskets; let y = index"> <mat-icon mat-list-icon class="fa fa-inbox" - [ngStyle]="{'color': user.regroupedBaskets[i].baskets[y].color}"> + [ngStyle]="{'color': user.regroupedBaskets[i].baskets[y].color}"> </mat-icon> <h4 mat-line title="{{basket.basket_id}}">{{basket.basket_name}}</h4> <input name="color" type="color" - style="background: none;border: none;height: 20px;width:20px;padding: 0;margin-right: 15px" - [(ngModel)]="user.regroupedBaskets[i].baskets[y].color" - (change)="updateBasketColor(i, y)" /> + style="background: none;border: none;height: 20px;width:20px;padding: 0;margin-right: 15px" + [(ngModel)]="user.regroupedBaskets[i].baskets[y].color" + (change)="updateBasketColor(i, y)" /> <a (click)="user.regroupedBaskets[i].baskets[y].color = ''; updateBasketColor(i, y)" - title="{{'lang.resetColor' | translate}}" style="cursor: pointer;color: #666666"> + title="{{'lang.resetColor' | translate}}" + style="cursor: pointer;color: #666666"> <i class="fa fa-magic"></i> </a> </mat-list-item> @@ -231,9 +250,10 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-inbox" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> <mat-icon color="primary" class="fa fa-reply" - style="position: absolute;margin-left: 30px;margin-top: -10px;"></mat-icon> + style="position: absolute;margin-left: 30px;margin-top: -10px;"> + </mat-icon> {{'lang.myBaskets' | translate}} </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -245,37 +265,46 @@ <mat-list-item> <mat-icon mat-list-icon color="primary"> <mat-checkbox color="primary" - (change)="$event ? masterToggleBaskets($event) : null" - [checked]="selectionBaskets.hasValue()" - matTooltip="{{'lang.selectAll' | translate}}"></mat-checkbox> + (change)="$event ? masterToggleBaskets($event) : null" + [checked]="selectionBaskets.hasValue()" + matTooltip="{{'lang.selectAll' | translate}}"></mat-checkbox> </mat-icon> <p mat-line> - <span *ngIf="!selectionBaskets.hasValue()" - style="opacity: 0.5;font-style: italic;font-size: 80%;"> - {{'lang.selectAll' | translate}} - </span> - <plugin-autocomplete *ngIf="selectionBaskets.hasValue()" [labelPlaceholder]="'lang.redirectBaskets' | translate" [routeDatas]="['/rest/autocomplete/users']" [targetSearchKey]="'idToDisplay'" [subInfoKey]="'descriptionToDisplay'" (triggerEvent)="addBasketRedirection($event)" appearance="outline"></plugin-autocomplete> + <span *ngIf="!selectionBaskets.hasValue()" + style="opacity: 0.5;font-style: italic;font-size: 80%;"> + {{'lang.selectAll' | translate}} + </span> + <plugin-autocomplete *ngIf="selectionBaskets.hasValue()" + [labelPlaceholder]="'lang.redirectBaskets' | translate" + [routeDatas]="['/rest/autocomplete/users']" + [targetSearchKey]="'idToDisplay'" + [subInfoKey]="'descriptionToDisplay'" + [disableItems]="[headerService.user.id]" + (triggerEvent)="addBasketRedirection($event)" + appearance="outline"></plugin-autocomplete> </p> </mat-list-item> <mat-divider></mat-divider> <ng-container *ngFor="let basket of user.baskets;let i = index"> <mat-list-item *ngIf="basket.userToDisplay == null" - (mouseover)="showActions(basket)" (mouseout)="hideActions(basket)" - style="cursor: pointer;"> + (mouseover)="showActions(basket)" (mouseout)="hideActions(basket)" + style="cursor: pointer;"> <mat-icon mat-list-icon color="primary" *ngIf="basket.enabled"> <mat-checkbox (click)="$event.stopPropagation()" - (change)="$event ? selectionBaskets.toggle(basket) : null" - [checked]="selectionBaskets.isSelected(basket)" color="primary"> + (change)="$event ? selectionBaskets.toggle(basket) : null" + [checked]="selectionBaskets.isSelected(basket)" + color="primary"> </mat-checkbox> </mat-icon> - <h4 mat-line color="primary" style="display: flex;align-items: center;"> - <span (click)="selectionBaskets.toggle(basket);" - matTooltip="{{basket.basket_name}} [{{basket.group_desc}}]" - style="flex: 2;overflow: hidden;text-overflow: ellipsis;"> - {{basket.basket_name}} - <span class="label label-primary" - style="font-weight:normal">{{basket.group_desc}}</span> - </span> + <h4 mat-line color="primary" + style="display: flex;align-items: center;"> + <span (click)="selectionBaskets.toggle(basket);" + matTooltip="{{basket.basket_name}} [{{basket.group_desc}}]" + style="flex: 2;overflow: hidden;text-overflow: ellipsis;"> + {{basket.basket_name}} + <span class="label label-primary" + style="font-weight:normal">{{basket.group_desc}}</span> + </span> </h4> </mat-list-item> </ng-container> @@ -286,25 +315,25 @@ <mat-tab label="{{'lang.basketsRedirected' | translate}}"> <mat-list> <ng-container - *ngFor="let basket of user.redirectedBaskets;let i = index"> + *ngFor="let basket of user.redirectedBaskets;let i = index"> <mat-list-item> <mat-icon mat-list-icon color="primary" - style="margin-top:-60px;" class="fa fa-paper-plane"> + style="margin-top:-60px;" class="fa fa-paper-plane"> </mat-icon> <h4 mat-line color="primary">{{basket.basket_name}} <span class="label label-primary" - style="font-weight:normal">{{basket.group_desc}}</span> + style="font-weight:normal">{{basket.group_desc}}</span> </h4> <p mat-line> <mat-form-field> <input type="text" color="warn" matInput disabled - value="{{'lang.redirectedTo' | translate}} {{basket.userToDisplay}}"> + value="{{'lang.redirectedTo' | translate}} {{basket.userToDisplay}}"> <button mat-button color="warn" matSuffix - mat-icon-button aria-label="Clear" - (click)="delBasketRedirection(basket,i)" - matTooltip="{{'lang.deleteRedirection' | translate}}"> + mat-icon-button aria-label="Clear" + (click)="delBasketRedirection(basket,i)" + matTooltip="{{'lang.deleteRedirection' | translate}}"> <mat-icon color="warn" - class="fa fa-times text-danger"></mat-icon> + class="fa fa-times text-danger"></mat-icon> </button> </mat-form-field> </p> @@ -317,33 +346,42 @@ <mat-tab-group> <mat-tab label="{{'lang.basketsAssigned' | translate}}"> <mat-list> - <ng-container *ngFor="let basket of user.assignedBaskets;let i = index"> + <ng-container + *ngFor="let basket of user.assignedBaskets;let i = index"> <mat-list-item> <mat-icon mat-list-icon color="primary" - style="margin-top:-60px;" class="fa fa-reply"> + style="margin-top:-60px;" class="fa fa-reply"> </mat-icon> - <h4 mat-line color="primary">{{basket.basket_name}} + <h4 mat-line color="primary" (click)="basket.redirectMode=false">{{basket.basket_name}} <span class="label label-primary" - style="font-weight:normal">{{basket.group_desc}}</span> + style="font-weight:normal">{{basket.group_desc}}</span> </h4> <p mat-line> - <plugin-autocomplete *ngIf="basket.userToDisplay == null" [labelPlaceholder]="'lang.redirectBaskets' | translate" [routeDatas]="['/rest/autocomplete/users']" [targetSearchKey]="'idToDisplay'" [subInfoKey]="'descriptionToDisplay'" (triggerEvent)="reassignBasketRedirection($event,basket,i)" appearance="outline"></plugin-autocomplete> - <mat-form-field> + <plugin-autocomplete + *ngIf="basket.redirectMode" + [labelPlaceholder]="('lang.redirectBasket' | translate) + ': '+basket.basket_name" + [routeDatas]="['/rest/autocomplete/users']" + [targetSearchKey]="'idToDisplay'" + [subInfoKey]="'descriptionToDisplay'" + [disableItems]="[headerService.user.id]" + (triggerEvent)="reassignBasketRedirection($event,basket,i)" + appearance="outline"></plugin-autocomplete> + <mat-form-field *ngIf="!basket.redirectMode"> <input type="text" color="warn" matInput disabled - value="{{'lang.assignBy' | translate}} {{basket.userToDisplay}}"> + value="{{'lang.assignBy' | translate}} {{basket.userToDisplay}}"> <button mat-button color="warn" matSuffix - mat-icon-button aria-label="Clear" - (click)="basket.userToDisplay=null" - matTooltip="{{'lang.reassign' | translate}}"> + mat-icon-button aria-label="Clear" + (click)="basket.redirectMode=true" + matTooltip="{{'lang.reassign' | translate}}"> <mat-icon color="primary" class="fa fa-edit"> </mat-icon> </button> <button mat-button color="warn" matSuffix - mat-icon-button aria-label="Clear" - (click)="delBasketAssignRedirection(basket,i)" - matTooltip="{{'lang.deleteAssignation' | translate}}"> + mat-icon-button aria-label="Clear" + (click)="delBasketAssignRedirection(basket,i)" + matTooltip="{{'lang.deleteAssignation' | translate}}"> <mat-icon color="warn" - class="fa fa-times text-danger"></mat-icon> + class="fa fa-times text-danger"></mat-icon> </button> </mat-form-field> </p> @@ -359,7 +397,7 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-envelope" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> {{'lang.mySignMail' | translate}} </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -371,50 +409,52 @@ <div class="row" style="margin-top:5px;"> <div class="col-md-12"> <mat-form-field> - <input matInput type="text" [(ngModel)]="mailSignatureModel.title" - name="title" placeholder="{{'lang.label' | translate}}" required> + <input matInput type="text" + [(ngModel)]="mailSignatureModel.title" name="title" + placeholder="{{'lang.label' | translate}}" required> </mat-form-field> </div> </div> <div class="row" style="margin-top:5px;"> <div class="col-md-12"> <div id="html_mode" style="display: block; width:100%;"> - <textarea name="emailSignature" id="emailSignature" - style="width:100%" rows="15" cols="60"></textarea> + <textarea name="emailSignature" id="emailSignature" + style="width:100%" rows="15" cols="60"></textarea> </div> </div> </div> <div class="col-md-12 form-group" style="margin-top: 10px;"> <div style="text-align:center;"> <button mat-raised-button color="primary" type="submit" - *ngIf="mailSignatureModel.selected==-1" - [disabled]="!emailSignatureForm.form.valid">{{'lang.save' | translate}}</button> + *ngIf="mailSignatureModel.selected==-1" + [disabled]="!emailSignatureForm.form.valid">{{'lang.save' | translate}}</button> <button mat-raised-button color="primary" type="button" - *ngIf="mailSignatureModel.selected!=-1" - (click)="updateEmailSignature()" - [disabled]="!emailSignatureForm.form.valid">{{'lang.update' | translate}}</button> + *ngIf="mailSignatureModel.selected!=-1" + (click)="updateEmailSignature()" + [disabled]="!emailSignatureForm.form.valid">{{'lang.update' | translate}}</button> <button mat-raised-button color="warn" type="button" - *ngIf="mailSignatureModel.selected!=-1" - (click)="deleteEmailSignature()">{{'lang.delete' | translate}}</button> + *ngIf="mailSignatureModel.selected!=-1" + (click)="deleteEmailSignature()">{{'lang.delete' | translate}}</button> <button mat-raised-button color="default" type="button" - *ngIf="mailSignatureModel.selected!=-1" - (click)="resetEmailSignature()">{{'lang.cancel' | translate}}</button> + *ngIf="mailSignatureModel.selected!=-1" + (click)="resetEmailSignature()">{{'lang.cancel' | translate}}</button> </div> </div> </form> </div> <div class="col-sm-6" style="overflow:hidden;"> <div class="col-md-6 col-sm-6 col-xm-12" - *ngFor="let emailSignature of user.emailSignatures; let i = index"> + *ngFor="let emailSignature of user.emailSignatures; let i = index"> <mat-card style="margin-bottom:10px;"> <mat-card-content style="text-align:center;"> <mat-form-field floatLabel="never"> <input matInput type="text" [(ngModel)]="emailSignature.title" - name="selectedEmailSignatureLabel" placeholder="{{'lang.label' | translate}}" - disabled> + name="selectedEmailSignatureLabel" + placeholder="{{'lang.label' | translate}}" disabled> </mat-form-field> <button mat-icon-button color="primary" - (click)="changeEmailSignature(i)" matTooltip="{{'lang.update' | translate}}"> + (click)="changeEmailSignature(i)" + matTooltip="{{'lang.update' | translate}}"> <mat-icon class="fa fa-edit fa-2x"></mat-icon> </button> </mat-card-content> @@ -427,7 +467,7 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-certificate" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> {{'lang.mySignSignatureBook' | translate}} </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -437,75 +477,80 @@ <div style="overflow:hidden;"> <div dnd-droppable matTooltip="{{'lang.uploadSignFileInfo' | translate}}" - (click)="clickOnUploader('uploadSignFile')" - [class.dndFileHighlighted]="highlightMe" (dragover)="highlightMe=true" - (dragleave)="highlightMe=false" - (onDropSuccess)="dndUploadSignature($event);highlightMe=false;" - class="dndFile"> + (click)="clickOnUploader('uploadSignFile')" + [class.dndFileHighlighted]="highlightMe" (dragover)="highlightMe=true" + (dragleave)="highlightMe=false" + (onDropSuccess)="dndUploadSignature($event);highlightMe=false;" + class="dndFile"> {{'lang.uploadSignFile' | translate}} </div> <form (ngSubmit)="submitSignature()" #signatureForm="ngForm" - style="display:none;"> + style="display:none;"> <div class="col-md-12"> <mat-form-field> <input matInput type="text" id="signature_label" - name="signature_label" title="{{'lang.label' | translate}}" - placeholder="{{'lang.label' | translate}}" [(ngModel)]="signatureModel.label" - required> + name="signature_label" title="{{'lang.label' | translate}}" + placeholder="{{'lang.label' | translate}}" + [(ngModel)]="signatureModel.label" required> </mat-form-field> <div class="form-inline hide"> <div class="form-group"> <input type="file" name="files[]" id="uploadSignFile" - (change)="uploadSignatureTrigger($event)" accept="image/*"> + (change)="uploadSignatureTrigger($event)" accept="image/*"> </div> </div> </div> <div [ngClass]="[signatureModel.size != '' ? 'col-md-10' : 'col-md-12']"> <div class="upload-drop-zone" - (click)="clickOnUploader('uploadSignFile')" style="cursor:pointer"> + (click)="clickOnUploader('uploadSignFile')" style="cursor:pointer"> {{'lang.clickOn' | translate}} <i class="fa fa-upload fa-2x"></i> ( < 2MB) </div> </div> <div class="col-md-2" - *ngIf="signatureModel.size"> - <img id="signaturePreview" [src]="signatureModel.base64ForJs" - alt="Image non valide" style="width: 100%;"> - </div> - <div class="col-md-12 form-group" style="margin-top: 10px;"> - <div style="text-align:center;"> - <button mat-raised-button color="primary" type="submit" + *ngIf="signatureModel.size"> + <img id="signaturePreview" [src]="signatureModel.base64ForJs" + alt="Image non valide" style="width: 100%;"> + </div> + <div class="col-md-12 form-group" style="margin-top: 10px;"> + <div style="text-align:center;"> + <button mat-raised-button color="primary" type="submit" [disabled]="!signatureForm.form.valid || !signatureModel.size">{{'lang.save' | translate}}</button> + </div> </div> - </div> </form> </div> <div style="display: flex;align-items: flex-start;"> <div style="flex:1;overflow:hidden;"> <div class="col-md-4 col-sm-4 col-xm-6" - *ngFor="let signature of user.signatures; let i = index"> + *ngFor="let signature of user.signatures; let i = index"> <mat-card style="margin-bottom:10px;"> <mat-card-content style="text-align:center;"> <mat-form-field floatLabel="never"> - <input matInput type="text" [(ngModel)]="signature.signature_label" - name="selectedSignatureLabel" placeholder="{{'lang.label' | translate}}" - (change)="updateSignature(signature)"> + <input matInput type="text" + [(ngModel)]="signature.signature_label" + name="selectedSignatureLabel" + placeholder="{{'lang.label' | translate}}" + (change)="updateSignature(signature)"> <button mat-button matSuffix mat-icon-button - (click)="deleteSignature(signature.id)" color="warn" - matTooltip="{{'lang.delete' | translate}}"> + (click)="deleteSignature(signature.id)" color="warn" + matTooltip="{{'lang.delete' | translate}}"> <mat-icon class="fa fa-times"></mat-icon> </button> </mat-form-field> <img [src]="'../rest/users/' + user.id + '/signatures/' + signature.id + '/content' | secureUrl | async" - alt="Signature" style="max-width:100%;height:60px;"> + alt="Signature" style="max-width:100%;height:60px;"> </mat-card-content> </mat-card> </div> </div> <div> - <button *ngIf="user.signatures.length > 0" mat-icon-button color="primary" (click)="syncMP()" - matTooltip="{{'lang.syncSignsToMaarchParapheur' | translate}}" [disabled]="!user.external_id.maarchParapheur || loadingSign"> - <mat-icon class="fa fa-sync-alt fa-2x" [class.fa-spin]="loadingSign" ></mat-icon> + <button *ngIf="user.signatures.length > 0" mat-icon-button color="primary" + (click)="syncMP()" + matTooltip="{{'lang.syncSignsToMaarchParapheur' | translate}}" + [disabled]="!user.external_id.maarchParapheur || loadingSign"> + <mat-icon class="fa fa-sync-alt fa-2x" [class.fa-spin]="loadingSign"> + </mat-icon> </button> </div> </div> @@ -515,7 +560,7 @@ <mat-expansion-panel-header> <mat-panel-title> <mat-icon color="primary" class="fa fa-users" - style="font-size:25px;width:50px;"></mat-icon> + style="font-size:25px;width:50px;"></mat-icon> {{'lang.myContactsGroups' | translate}} </mat-panel-title> <mat-panel-description *ngIf="!appService.getViewMode()"> @@ -523,51 +568,57 @@ </mat-panel-description> </mat-expansion-panel-header> <mat-tab-group - (selectedIndexChange)="changeTabContactGrp($event);createGrpContPan.close();" - [selectedIndex]="selectedIndexContactsGrp"> + (selectedIndexChange)="changeTabContactGrp($event);createGrpContPan.close();" + [selectedIndex]="selectedIndexContactsGrp"> <mat-tab label="{{'lang.contactGroupList' | translate}}"> <mat-accordion> <mat-expansion-panel #createGrpContPan (opened)="initGroupsContact()"> <mat-expansion-panel-header> <mat-panel-title color="primary"> - <span style="margin-top:5px;">{{'lang.contactGroupCreate' | translate}}</span> + <span + style="margin-top:5px;">{{'lang.contactGroupCreate' | translate}}</span> </mat-panel-title> </mat-expansion-panel-header> <form id="contactsGroupFormUp" class="form-horizontal" - (ngSubmit)="contactsGroupSubmit();createGrpContPan.close();" - #contactsGroupFormUp="ngForm"> + (ngSubmit)="contactsGroupSubmit();createGrpContPan.close();" + #contactsGroupFormUp="ngForm"> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> <input matInput [(ngModel)]="contactsGroup.label" - required name="label" id="label" - title="{{'lang.label' | translate}}" type="text" - placeholder="{{'lang.label' | translate}}" maxlength="32"> + required name="label" id="label" + title="{{'lang.label' | translate}}" type="text" + placeholder="{{'lang.label' | translate}}" + maxlength="32"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput [(ngModel)]="contactsGroup.description" - required name="description" id="description" - title="{{'lang.description' | translate}}" type="text" - placeholder="{{'lang.description' | translate}}" maxlength="255"> + <input matInput + [(ngModel)]="contactsGroup.description" required + name="description" id="description" + title="{{'lang.description' | translate}}" + type="text" + placeholder="{{'lang.description' | translate}}" + maxlength="255"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> <mat-slide-toggle name="plubic" - title="{{'lang.contactsGroupDesc' | translate}}" id="plubic" - color="primary" [(ngModel)]="contactsGroup.public"> + title="{{'lang.contactsGroupDesc' | translate}}" + id="plubic" color="primary" + [(ngModel)]="contactsGroup.public"> {{'lang.public' | translate}}</mat-slide-toggle> </div> </div> <div class="form-group"> <div class="col-sm-12" style="text-align:center;"> <button mat-raised-button color="primary" type="submit" - [disabled]="!contactsGroupFormUp.form.valid">{{'lang.save' | translate}}</button> + [disabled]="!contactsGroupFormUp.form.valid">{{'lang.save' | translate}}</button> </div> </div> </form> @@ -578,54 +629,65 @@ <div class="col-md-6 col-xs-6"> <mat-form-field> <input matInput - (keyup)="applyFilterGroupsList($event.target.value)" - placeholder="{{'lang.filterBy' | translate}}"> + (keyup)="applyFilterGroupsList($event.target.value)" + placeholder="{{'lang.filterBy' | translate}}"> </mat-form-field> </div> <div class="col-md-6 col-xs-6"> - <mat-paginator #paginatorGroupsList [length]="100" [hidePageSize]="true" [pageSize]="5"> + <mat-paginator #paginatorGroupsList [length]="100" + [hidePageSize]="true" [pageSize]="5"> </mat-paginator> </div> </div> <mat-table #tableGroupsListSort="matSort" - [dataSource]="dataSourceGroupsList" matSort matSortActive="label" - matSortDirection="asc"> + [dataSource]="dataSourceGroupsList" matSort matSortActive="label" + matSortDirection="asc"> <ng-container matColumnDef="label"> <mat-header-cell *matHeaderCellDef mat-sort-header - [class.hide-for-mobile]="appService.getViewMode()" style="flex:2;"> + [class.hide-for-mobile]="appService.getViewMode()" + style="flex:2;"> {{'lang.label' | translate}}</mat-header-cell> <mat-cell *matCellDef="let element" - [class.hide-for-mobile]="appService.getViewMode()" style="flex:2;"> + [class.hide-for-mobile]="appService.getViewMode()" + style="flex:2;"> {{element.label}} </mat-cell> </ng-container> <ng-container matColumnDef="description"> - <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:2;"> + <mat-header-cell *matHeaderCellDef mat-sort-header + style="flex:2;"> {{'lang.description' | translate}}</mat-header-cell> <mat-cell *matCellDef="let element" style="flex:2;"> {{element.description}} </mat-cell> </ng-container> <ng-container matColumnDef="nbContacts"> - <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:1;"> - {{'lang.relatedContactNumber' | translate}}</mat-header-cell> + <mat-header-cell *matHeaderCellDef mat-sort-header + style="flex:1;"> + {{'lang.relatedContactNumber' | translate}} + </mat-header-cell> <mat-cell *matCellDef="let element" style="flex:1;"> - <span + <span *ngIf="element.nbContacts == 0">{{element.nbContacts}}</span> <span *ngIf="element.nbContacts > 0" color="primary" - style="font-weight:bold;">{{element.nbContacts}}</span> + style="font-weight:bold;">{{element.nbContacts}}</span> </mat-cell> </ng-container> <ng-container matColumnDef="public"> <mat-header-cell *matHeaderCellDef mat-sort-header - [class.hide-for-mobile]="appService.getViewMode()" style="flex:1;"> + [class.hide-for-mobile]="appService.getViewMode()" + style="flex:1;"> {{'lang.public' | translate}}</mat-header-cell> <mat-cell *matCellDef="let element" - [class.hide-for-mobile]="appService.getViewMode()" style="flex:1;"> - <span *ngIf="!element.public"> {{'lang.no' | translate}} </span> - <span *ngIf="element.public"> {{'lang.yes' | translate}} </span> + [class.hide-for-mobile]="appService.getViewMode()" + style="flex:1;"> + <span *ngIf="!element.public"> {{'lang.no' | translate}} + </span> + <span *ngIf="element.public"> {{'lang.yes' | translate}} + </span> </mat-cell> </ng-container> <ng-container matColumnDef="owner"> - <mat-header-cell *matHeaderCellDef mat-sort-header style="flex:1;"> + <mat-header-cell *matHeaderCellDef mat-sort-header + style="flex:1;"> {{'lang.createdBy' | translate}}</mat-header-cell> <mat-cell *matCellDef="let element" style="flex:1;"> {{element.labelledOwner}} </mat-cell> @@ -633,11 +695,12 @@ <ng-container matColumnDef="actions"> <mat-header-cell *matHeaderCellDef></mat-header-cell> <mat-cell *matCellDef="let element" - style="justify-content: flex-end;"> + style="justify-content: flex-end;"> <button mat-icon-button color="warn" - matTooltip="{{'lang.delete' | translate}}" - (click)="$event.stopPropagation();deleteContactsGroup(element.position)"> - <mat-icon class="fa fa-trash-alt fa-2x" aria-hidden="true"> + matTooltip="{{'lang.delete' | translate}}" + (click)="$event.stopPropagation();deleteContactsGroup(element.position)"> + <mat-icon class="fa fa-trash-alt fa-2x" + aria-hidden="true"> </mat-icon> </button> </mat-cell> @@ -645,32 +708,36 @@ <mat-header-row *matHeaderRowDef="displayedColumnsGroupsList"> </mat-header-row> <mat-row *matRowDef="let row; columns: displayedColumnsGroupsList;" - (click)="loadContactsGroup(row)" style="cursor:pointer;" - matTooltip="{{'lang.view' | translate}}"></mat-row> + (click)="loadContactsGroup(row)" style="cursor:pointer;" + matTooltip="{{'lang.view' | translate}}"></mat-row> </mat-table> </div> </mat-tab> - <mat-tab label="{{'lang.grouping' | translate}} : {{contactsGroup.label}}" *ngIf="contactsListMode"> + <mat-tab label="{{'lang.grouping' | translate}} : {{contactsGroup.label}}" + *ngIf="contactsListMode"> <mat-accordion> <mat-expansion-panel #linkContPan> <mat-expansion-panel-header> <mat-panel-title color="primary"> - <span style="margin-top:5px;">{{'lang.linkContact' | translate}}</span> + <span + style="margin-top:5px;">{{'lang.linkContact' | translate}}</span> </mat-panel-title> </mat-expansion-panel-header> <div id="contactsGroupFormAdd"> <div class="row" style="margin:0px;"> <div class="col-md-8" style="padding:5px;"> <mat-form-field hintLabel="3 caractères minimum"> - <span matPrefix> - <mat-icon class="fa fa-user-plus" color="primary"> - </mat-icon> - </span> + <span matPrefix> + <mat-icon class="fa fa-user-plus" + color="primary"> + </mat-icon> + </span> <input class="autocompleteSearch" type="text" - placeholder="{{'lang.linkContact' | translate}}" matInput - [formControl]="searchTerm" autocomplete="off" - (keyup)="launchLoading();" minlength="3"> + placeholder="{{'lang.linkContact' | translate}}" + matInput [formControl]="searchTerm" + autocomplete="off" (keyup)="launchLoading();" + minlength="3"> </mat-form-field> </div> <div class="col-md-6 col-xs-6"> @@ -679,30 +746,31 @@ [innerHTML]="'lang.limitDataReached_1000' | translate"></div> </div> <div class="col-md-6 col-xs-6"> - <mat-paginator #paginatorGroupsListAutocomplete [length]="0" - [hidePageSize]="true" [pageSize]="10"> + <mat-paginator #paginatorGroupsListAutocomplete + [length]="0" [hidePageSize]="true" [pageSize]="10"> </mat-paginator> </div> </div> <mat-progress-bar mode="indeterminate" - *ngIf="!dataSourceContactsListAutocomplete && !initAutoCompleteContact"> + *ngIf="!dataSourceContactsListAutocomplete && !initAutoCompleteContact"> </mat-progress-bar> <mat-table #tableContactList - [dataSource]="dataSourceContactsListAutocomplete" - *ngIf="dataSourceContactsListAutocomplete"> + [dataSource]="dataSourceContactsListAutocomplete" + *ngIf="dataSourceContactsListAutocomplete"> <ng-container matColumnDef="select"> <mat-header-cell *matHeaderCellDef style="flex:1;"> <mat-checkbox color="primary" - (change)="$event ? masterToggle($event) : null" - [checked]="selection.hasValue()"> + (change)="$event ? masterToggle($event) : null" + [checked]="selection.hasValue()"> </mat-checkbox> </mat-header-cell> <mat-cell *matCellDef="let element" style="flex:1;"> <mat-checkbox id="check_{{element.id}}" - color="primary" (click)="$event.stopPropagation()" - (change)="$event ? selection.toggle(element.id) : null" - [disabled]="isInGrp(element)" - [checked]="selection.isSelected(element.id)"> + color="primary" + (click)="$event.stopPropagation()" + (change)="$event ? selection.toggle(element.id) : null" + [disabled]="isInGrp(element)" + [checked]="selection.isSelected(element.id)"> </mat-checkbox> </mat-cell> </ng-container> @@ -719,19 +787,19 @@ {{element.address}} </mat-cell> </ng-container> <mat-header-row - *matHeaderRowDef="displayedColumnsContactsListAutocomplete"> + *matHeaderRowDef="displayedColumnsContactsListAutocomplete"> </mat-header-row> <mat-row - *matRowDef="let element; columns: displayedColumnsContactsListAutocomplete;" - (click)="selectContact(element.id);" - [ngStyle]="{'opacity': !isInGrp(element) ? '' : '0.5'}" - style="cursor: pointer;"></mat-row> + *matRowDef="let element; columns: displayedColumnsContactsListAutocomplete;" + (click)="selectContact(element.id);" + [ngStyle]="{'opacity': !isInGrp(element) ? '' : '0.5'}" + style="cursor: pointer;"></mat-row> </mat-table> <div class="form-group"> <div style="text-align:center;margin-top:30px"> <button mat-raised-button color="primary" type="button" - (click)="saveContactsList($event.target)" - [disabled]="this.selection.selected.length == 0">{{'lang.add' | translate}}</button> + (click)="saveContactsList($event.target)" + [disabled]="this.selection.selected.length == 0">{{'lang.add' | translate}}</button> </div> </div> </div> @@ -740,41 +808,46 @@ <div id="contactsGroup" style="margin-top:20px;"> <div class="col-sm-6"> <form class="form-horizontal" (ngSubmit)="updateGroupSubmit()" - #contactsGroupFormUp="ngForm"> + #contactsGroupFormUp="ngForm"> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> <input matInput [(ngModel)]="contactsGroup.label" - required name="label" id="label" - title="{{'lang.label' | translate}}" type="text" - placeholder="{{'lang.label' | translate}}" maxlength="32"> + required name="label" id="label" + title="{{'lang.label' | translate}}" type="text" + placeholder="{{'lang.label' | translate}}" + maxlength="32"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> <mat-form-field> - <input matInput [(ngModel)]="contactsGroup.description" - required name="description" id="description" - title="{{'lang.description' | translate}}" type="text" - placeholder="{{'lang.description' | translate}}" maxlength="255"> + <input matInput + [(ngModel)]="contactsGroup.description" required + name="description" id="description" + title="{{'lang.description' | translate}}" + type="text" + placeholder="{{'lang.description' | translate}}" + maxlength="255"> </mat-form-field> </div> </div> <div class="form-group"> <div class="col-sm-12"> - <mat-slide-toggle name="public" title="{{'lang.public' | translate}}" - id="public" color="primary" - [(ngModel)]="contactsGroup.public">{{'lang.public' | translate}} + <mat-slide-toggle name="public" + title="{{'lang.public' | translate}}" id="public" + color="primary" [(ngModel)]="contactsGroup.public"> + {{'lang.public' | translate}} </mat-slide-toggle> </div> </div> <div class="form-group"> <div class="col-sm-12" style="text-align:center;"> <button mat-raised-button color="primary" type="submit" - [disabled]="!contactsGroupFormUp.form.valid">{{'lang.update' | translate}}</button> + [disabled]="!contactsGroupFormUp.form.valid">{{'lang.update' | translate}}</button> <button mat-raised-button color="default" type="button" - (click)="initGroupsContact()">{{'lang.close' | translate}}</button> + (click)="initGroupsContact()">{{'lang.close' | translate}}</button> </div> </div> </form> @@ -782,34 +855,36 @@ <div class="col-sm-6" *ngIf="contactsListMode"> <mat-tab-group> <mat-tab - label="{{contactsGroup.contacts.length}} {{'lang.relatedContacts' | translate}}"> + label="{{contactsGroup.contacts.length}} {{'lang.relatedContacts' | translate}}"> <div class="row" style="margin:0px;"> <div class="col-md-6 col-xs-6"> <mat-form-field> <input matInput - (keyup)="applyFilterContactsList($event.target.value)" - placeholder="{{'lang.filterBy' | translate}}"> + (keyup)="applyFilterContactsList($event.target.value)" + placeholder="{{'lang.filterBy' | translate}}"> </mat-form-field> </div> <div class="col-md-6 col-xs-6"> <mat-paginator #paginatorContactsList [length]="0" - [hidePageSize]="true" [pageSize]="10"> + [hidePageSize]="true" [pageSize]="10"> </mat-paginator> </div> </div> <mat-table *ngIf="contactsListMode" - #tableContactsListSort="matSort" - [dataSource]="dataSourceContactsList" matSort - matSortActive="contact" matSortDirection="asc"> + #tableContactsListSort="matSort" + [dataSource]="dataSourceContactsList" matSort + matSortActive="contact" matSortDirection="asc"> <ng-container matColumnDef="contact"> <mat-header-cell *matHeaderCellDef mat-sort-header - style="flex:3;">{{'lang.contact' | translate}}</mat-header-cell> + style="flex:3;">{{'lang.contact' | translate}} + </mat-header-cell> <mat-cell *matCellDef="let element" style="flex:3;"> {{element.contact}} </mat-cell> </ng-container> <ng-container matColumnDef="address"> <mat-header-cell *matHeaderCellDef mat-sort-header - style="flex:3;">{{'lang.address' | translate}}</mat-header-cell> + style="flex:3;">{{'lang.address' | translate}} + </mat-header-cell> <mat-cell *matCellDef="let element" style="flex:3;"> {{element.address}} </mat-cell> </ng-container> @@ -817,20 +892,20 @@ <mat-header-cell *matHeaderCellDef style="flex:1;"> </mat-header-cell> <mat-cell *matCellDef="let element;let i = index" - style="justify-content: flex-end;flex:1;"> + style="justify-content: flex-end;flex:1;"> <button mat-icon-button color="warn" - matTooltip="{{'lang.delete' | translate}}" - (click)="$event.stopPropagation();preDelete(i)"> + matTooltip="{{'lang.delete' | translate}}" + (click)="$event.stopPropagation();preDelete(i)"> <mat-icon class="fa fa-trash-alt fa-2x" - aria-hidden="true"></mat-icon> + aria-hidden="true"></mat-icon> </button> </mat-cell> </ng-container> <mat-header-row - *matHeaderRowDef="displayedColumnsContactsList"> + *matHeaderRowDef="displayedColumnsContactsList"> </mat-header-row> <mat-row - *matRowDef="let element; columns: displayedColumnsContactsList;"> + *matRowDef="let element; columns: displayedColumnsContactsList;"> </mat-row> </mat-table> </mat-tab> @@ -849,27 +924,32 @@ <div class="col-md-6 col-xs-6"> <mat-form-field> <input matInput (keyup)="applyFilter($event.target.value)" - placeholder="{{'lang.filterBy' | translate}}"> + placeholder="{{'lang.filterBy' | translate}}"> </mat-form-field> </div> <div class="col-md-6 col-xs-6"> - <mat-paginator #paginatorHistory [length]="100" [hidePageSize]="true" [pageSize]="10"> + <mat-paginator #paginatorHistory [length]="100" [hidePageSize]="true" + [pageSize]="10"> </mat-paginator> </div> </div> <mat-table #tableHistorySort="matSort" [dataSource]="dataSource" matSort - matSortActive="event_date" matSortDirection="desc"> + matSortActive="event_date" matSortDirection="desc"> <ng-container matColumnDef="event_date"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{'lang.date' | translate}}</mat-header-cell> - <mat-cell *matCellDef="let element">{{element.event_date | date : "dd/MM/y HH:mm"}} + <mat-header-cell *matHeaderCellDef mat-sort-header>{{'lang.date' | translate}} + </mat-header-cell> + <mat-cell *matCellDef="let element"> + {{element.event_date | date : "dd/MM/y HH:mm"}} </mat-cell> </ng-container> <ng-container matColumnDef="record_id"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{'lang.technicalId' | translate}}</mat-header-cell> + <mat-header-cell *matHeaderCellDef mat-sort-header> + {{'lang.technicalId' | translate}}</mat-header-cell> <mat-cell *matCellDef="let element">{{element.record_id}}</mat-cell> </ng-container> <ng-container matColumnDef="info"> - <mat-header-cell *matHeaderCellDef mat-sort-header>{{'lang.description' | translate}} + <mat-header-cell *matHeaderCellDef mat-sort-header> + {{'lang.description' | translate}} </mat-header-cell> <mat-cell *matCellDef="let element"> {{element.info}} </mat-cell> </ng-container> @@ -885,8 +965,8 @@ </mat-sidenav-content> <mat-sidenav #snav2 [mode]="appService.getViewMode() ? 'over' : 'side'" [fixedInViewport]="appService.getViewMode()" - fixedTopGap="56" position='end' [opened]="appService.getViewMode() ? false : true" - style="overflow-x:hidden;max-width:500px;"> + fixedTopGap="56" position='end' [opened]="appService.getViewMode() ? false : true" + style="overflow-x:hidden;max-width:500px;"> <mat-list> <h3 mat-subheader>{{'lang.groups' | translate}}</h3> @@ -896,7 +976,7 @@ <p mat-line> <mat-form-field style="font-size:10px;"> <input matInput type="text" id="role" name="role" title="{{'lang.role' | translate}}" - placeholder="{{'lang.role' | translate}}" [(ngModel)]="userGroup.role" disabled> + placeholder="{{'lang.role' | translate}}" [(ngModel)]="userGroup.role" disabled> <mat-hint matTooltip="{{'lang.perimeter' | translate}}">{{userGroup.maarch_comment}}</mat-hint> </mat-form-field> </p> @@ -904,10 +984,10 @@ <mat-divider></mat-divider> <h3 mat-subheader>{{'lang.entities' | translate}}</h3> <mat-list-item *ngFor="let userEntity of user.entities"> - <mat-icon color="primary" *ngIf="userEntity.primary_entity == 'Y'" mat-list-icon - class="fa fa-sitemap"></mat-icon> - <mat-icon color="primary" *ngIf="userEntity.primary_entity != 'Y'" mat-list-icon - class="fa fa-sitemap" style="position:relative;"> + <mat-icon color="primary" *ngIf="userEntity.primary_entity == 'Y'" mat-list-icon class="fa fa-sitemap"> + </mat-icon> + <mat-icon color="primary" *ngIf="userEntity.primary_entity != 'Y'" mat-list-icon class="fa fa-sitemap" + style="position:relative;"> <!--<button mat-icon-button style="cursor:pointer;position: absolute;right: -20px;top: -20px;font-size:10px;" (click)="updatePrimaryEntity(userEntity)" matTooltip="{{'lang.entityTooglePrimary' | translate}}"> @@ -918,15 +998,15 @@ matTooltip="{{userEntity.entity_label}}"> {{userEntity.entity_label}} <span *ngIf="userEntity.primary_entity == 'Y'" class="label label-primary" - style="font-weight:normal">{{'lang.primary' | translate}}</span> + style="font-weight:normal">{{'lang.primary' | translate}}</span> </h4> <p mat-line> <mat-form-field style="font-size:10px;"> <input matInput type="text" id="role" name="role" title="{{'lang.role' | translate}}" - placeholder="{{'lang.role' | translate}}" [(ngModel)]="userEntity.user_role" disabled> + placeholder="{{'lang.role' | translate}}" [(ngModel)]="userEntity.user_role" disabled> </mat-form-field> </p> </mat-list-item> </mat-list> </mat-sidenav> -</mat-sidenav-container> +</mat-sidenav-container> \ No newline at end of file diff --git a/src/frontend/plugins/autocomplete/autocomplete.component.html b/src/frontend/plugins/autocomplete/autocomplete.component.html index 0a2781985e5339852cbb0553582b35565d868be5..ef0855a45bf23a58dfe69cb3c475b706a2e18a30 100644 --- a/src/frontend/plugins/autocomplete/autocomplete.component.html +++ b/src/frontend/plugins/autocomplete/autocomplete.component.html @@ -1,6 +1,6 @@ <form> <input *ngIf="controlAutocomplete !== undefined" type="hidden" [formControl]="controlAutocomplete"> - <mat-form-field [class.smallInput]="size === 'small'" [appearance]="appearance" floatLabel="never"> + <mat-form-field class="maarch-autocomplete" [class.no-margin]="styles.indexOf('no-margin') > -1" [class.smallInput]="size === 'small'" [appearance]="appearance" floatLabel="never" (click)="$event.stopPropagation();"> <mat-label *ngIf="singleMode">{{placeholder}}</mat-label> <mat-icon *ngIf="size !== 'small' && (myControl.enabled && !singleMode)" color="primary" class="fa fa-search" matPrefix></mat-icon> @@ -11,9 +11,9 @@ <button type="button" *ngIf="myControl.disabled" matSuffix mat-icon-button color="warn" (click)="unsetValue()"> <mat-icon class="fa fa-times" color="warn" [title]="'lang.delete' | translate"></mat-icon> </button> - <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selectOpt($event)"> + <mat-autocomplete #auto="matAutocomplete" (optionSelected)="selectOpt($event)" [displayWith]="displayFnWrapper()" > <ng-container *ngIf="options.length > 0 && !loading"> - <mat-option *ngFor="let option of filteredOptions | async | sortBy: key" [value]="option"> + <mat-option *ngFor="let option of filteredOptions | async | sortBy: key"[value]="option" [disabled]="disableItems.indexOf(option['serialId']) > -1"> <mat-icon *ngIf="type[option['type']]" class="autcompleteIcon fas {{type[option['type']]}}" color="primary"> </mat-icon> <span diff --git a/src/frontend/plugins/autocomplete/autocomplete.component.scss b/src/frontend/plugins/autocomplete/autocomplete.component.scss index 4a76455227da8dee474e45ff69207d3ac426cc4f..eabe4a7bdb5696fb3b2496dd7fc24b4acf488129 100644 --- a/src/frontend/plugins/autocomplete/autocomplete.component.scss +++ b/src/frontend/plugins/autocomplete/autocomplete.component.scss @@ -12,6 +12,13 @@ top: 0px !important; } +.no-margin { + ::ng-deep.mat-form-field-wrapper { + margin: 0px; + padding: 0px; + } +} + .mat-option { ::ng-deep.mat-option-text { align-items: center; @@ -24,6 +31,10 @@ } } +.mat-option-disabled { + opacity: 0.3 !important; +} + .autcompleteIcon { width: 20px; display: flex; diff --git a/src/frontend/plugins/autocomplete/autocomplete.component.ts b/src/frontend/plugins/autocomplete/autocomplete.component.ts index a7db65a83cd2d4d2c5cb8ef9690b555500f6098c..065f29413928f7978478d11bd5946d57b6f432c7 100644 --- a/src/frontend/plugins/autocomplete/autocomplete.component.ts +++ b/src/frontend/plugins/autocomplete/autocomplete.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; import { Input, EventEmitter, Output, ViewChild, ElementRef } from '@angular/core'; import { Observable, of, forkJoin } from 'rxjs'; -import { map, startWith, debounceTime, filter, distinctUntilChanged, switchMap, tap, exhaustMap, catchError } from 'rxjs/operators'; +import { map, startWith, debounceTime, filter, switchMap, tap, exhaustMap, catchError } from 'rxjs/operators'; import { LatinisePipe } from 'ngx-pipes'; import { TranslateService } from '@ngx-translate/core'; import { HttpClient } from '@angular/common/http'; @@ -58,7 +58,7 @@ export class PluginAutocomplete implements OnInit { /** * Route datas used in async autocomplete. Incompatible with @datas */ - @Input('routeDatas') routeDatas: string[]; + @Input() routeDatas: string[]; /** * Placeholder used in input @@ -90,6 +90,16 @@ export class PluginAutocomplete implements OnInit { */ @Input() manageDatas: string; + /** + * Identifier of disabled items + */ + @Input() disableItems: any = []; + + /** + * List of classes uses + */ + @Input() styles: any = []; + /** * Catch external event after select an element in autocomplete */ @@ -288,4 +298,13 @@ export class PluginAutocomplete implements OnInit { resetValue() { return this.myControl.setValue(''); } -} \ No newline at end of file + + displayFn(option: any): string { + return option ? option[this.key] : option; + } + + // workaround to use var in scope componenent + displayFnWrapper() { + return (offer: any) => this.displayFn(offer); + } +}