diff --git a/apps/maarch_entreprise/xml/services.xml b/apps/maarch_entreprise/xml/services.xml index 880769fdc32c39462098786207b87f3b48be3018..d5d7e97eb33c9033d09b4077fd1a8135497ae3b6 100755 --- a/apps/maarch_entreprise/xml/services.xml +++ b/apps/maarch_entreprise/xml/services.xml @@ -36,7 +36,7 @@ <shortcut>true</shortcut> <system_service>false</system_service> <enabled>true</enabled> - <style>fa fa-plus</style> + <style>fa fa-file-medical</style> <angular>false</angular> </SERVICE> <SERVICE> diff --git a/src/frontend/app/app-common.module.ts b/src/frontend/app/app-common.module.ts index 542555f0a6bb061f3f4cc4000b667891b039c53c..6beaabdd42db7ff46e92050c8d7f4861744b6691 100644 --- a/src/frontend/app/app-common.module.ts +++ b/src/frontend/app/app-common.module.ts @@ -17,11 +17,13 @@ import { FilterListPipe } from '../plugins/filterList.pipe /*FRONT IMPORTS*/ import { AppMaterialModule } from './app-material.module'; +import { SpeedDialFabComponent } from '../plugins/mat-speed-dial-fab/speed-dial-fab.component'; + /*MENU COMPONENT*/ import { MainHeaderComponent } from './menu/main-header.component'; import { MenuComponent } from './menu/menu.component'; import { MenuNavComponent } from './menu/menu-nav.component'; -import { MenuShortcutComponent } from './menu/menu-shortcut.component'; +import { MenuShortcutComponent, IndexingGroupModalComponent } from './menu/menu-shortcut.component'; /*SEARCH*/ import { SearchHomeComponent } from './search/search-home.component'; @@ -49,6 +51,8 @@ import { BasketHomeComponent } from './basket/basket-home TimeAgoPipe, TimeLimitPipe, FilterListPipe, + IndexingGroupModalComponent, + SpeedDialFabComponent ], exports: [ CommonModule, @@ -68,6 +72,10 @@ import { BasketHomeComponent } from './basket/basket-home TimeAgoPipe, TimeLimitPipe, FilterListPipe, - ] + SpeedDialFabComponent + ], + entryComponents: [ + IndexingGroupModalComponent + ], }) export class SharedModule { } diff --git a/src/frontend/app/menu/indexing-group-modal.component.html b/src/frontend/app/menu/indexing-group-modal.component.html new file mode 100644 index 0000000000000000000000000000000000000000..fe4690bbba53f03594c366b54f90e89afde90e37 --- /dev/null +++ b/src/frontend/app/menu/indexing-group-modal.component.html @@ -0,0 +1,13 @@ +<h2 mat-dialog-title color="primary"><span style="padding-left: 10px;">Choisissez un profil d'indexation</span></h2> +<mat-dialog-content> + <mat-nav-list> + <ng-container *ngFor="let group of data.indexingGroups"> + <a mat-list-item href="{{data.link}}&groupId={{group.groupId}}"> + <mat-icon color="primary" mat-list-icon class="fa fa-users"></mat-icon> + <p mat-line> + {{group.label}} + </p> + </a> + </ng-container> + </mat-nav-list> +</mat-dialog-content> \ No newline at end of file diff --git a/src/frontend/app/menu/main-header.component.html b/src/frontend/app/menu/main-header.component.html index 11778b9785bcfc6a147a9c627f27194ebaaaab0f..bf6dc4a71664705a236ebb72c4d134c553a3ef03 100644 --- a/src/frontend/app/menu/main-header.component.html +++ b/src/frontend/app/menu/main-header.component.html @@ -12,7 +12,7 @@ </button> <mat-menu #applications="matMenu" class="headerMaarchShortcut"> <ng-container *ngFor="let shortcut of user.menu"> - <button (click)="gotToMenu(shortcut.servicepage,shortcut.angular);" style="white-space:inherit;height: 100px;line-height:20px;" class="col-md-4 col-xs-6" mat-button color="primary" matTooltip="{{shortcut.comment}}"> + <button (click)="gotToMenu(shortcut);" style="white-space:inherit;height: 100px;line-height:20px;" class="col-md-4 col-xs-6" mat-button color="primary" matTooltip="{{shortcut.comment}}"> <i class="{{shortcut.style}} fa-2x"></i> <br/>{{shortcut.name}} </button> diff --git a/src/frontend/app/menu/main-header.component.ts b/src/frontend/app/menu/main-header.component.ts index afd4a1897faab08d6969f098922e18b745e7ac0e..5a55702697c7077f3b017a229b8e883e3ee744cb 100644 --- a/src/frontend/app/menu/main-header.component.ts +++ b/src/frontend/app/menu/main-header.component.ts @@ -1,8 +1,9 @@ import { Component, OnInit, NgZone } from '@angular/core'; import { LANG } from '../translate.component'; -import { MatSidenav } from '@angular/material'; +import { MatSidenav, MatDialog, MatDialogRef } from '@angular/material'; import { HttpClient } from '@angular/common/http'; import { Router } from '@angular/router'; +import { IndexingGroupModalComponent } from './menu-shortcut.component'; import { ShortcutMenuService } from '../../service/shortcut-menu.service'; @@ -20,6 +21,8 @@ export class MainHeaderComponent implements OnInit { lang : any = LANG; user : any = {firstname : "",lastname : ""}; mobileMode : boolean = false; + dialogRef : MatDialogRef<any>; + config : any = {}; titleHeader : string; router : any; @@ -27,7 +30,7 @@ export class MainHeaderComponent implements OnInit { snav2 : MatSidenav; - constructor(public http: HttpClient, private zone: NgZone, private _router: Router, private shortcut: ShortcutMenuService) { + constructor(public http: HttpClient, private zone: NgZone, private _router: Router, private shortcut: ShortcutMenuService, public dialog: MatDialog) { this.router = _router; this.mobileMode = angularGlobals.mobileMode; window['MainHeaderComponent'] = { @@ -45,7 +48,16 @@ export class MainHeaderComponent implements OnInit { this.user.menu = data.menu; this.shortcut.shortcutsData.user = data.user; + data.menu.unshift({ + "name" : this.lang.home, + "comment" : this.lang.home, + "servicepage" : "/home", + "shortcut" : "true", + "style" : "fa fa-home", + "angular" : "true" + }); this.shortcut.shortcutsData.menu = data.menu; + }, (err) => { console.log(err.error.errors); }); @@ -68,11 +80,14 @@ export class MainHeaderComponent implements OnInit { } } - gotToMenu(link:string, angularMode:string) { - if (angularMode == 'true') { - this.router.navigate([link]); - } else{ - location.href = link; + gotToMenu(shortcut:any) { + if (shortcut.id == 'index_mlb' && this.shortcut.shortcutsData.user.indexingGroups.length > 1) { + this.config = { data: { indexingGroups:this.shortcut.shortcutsData.user.indexingGroups, link:shortcut.servicepage } }; + this.dialogRef = this.dialog.open(IndexingGroupModalComponent, this.config); + } else if (shortcut.angular == 'true') { + this.router.navigate([shortcut.servicepage]); + } else { + location.href = shortcut.servicepage; } } } diff --git a/src/frontend/app/menu/menu-shortcut.component.html b/src/frontend/app/menu/menu-shortcut.component.html index 2da07d418e33a65e73ffa9868125e0f666bddf4f..483d06e17c7d88465ce6cddf37faf7b1ca315e62 100644 --- a/src/frontend/app/menu/menu-shortcut.component.html +++ b/src/frontend/app/menu/menu-shortcut.component.html @@ -30,17 +30,13 @@ <mat-nav-list> <h3 mat-subheader>{{lang.shortcut}}</h3> <div class="button-row" style="padding-left: 10px;padding-right: 10px;display: flex;width: 250px;"> - <span style="flex:1;text-align: left;padding: 5px;"> - <button color="primary" mat-icon-button (click)="gotToMenu('/home','true');" matTooltip="{{lang.home}}"> - <mat-icon class="fa fa-home" style="height:auto;"></mat-icon> - </button> - </span> <ng-container *ngFor="let shortcut of shortcut.shortcutsData.menu"> - <span style="flex:1;text-align: left;padding: 5px;" *ngIf="shortcut.shortcut == 'true'"> - <button color="primary" mat-icon-button (click)="gotToMenu(shortcut.servicepage, shortcut.angular);" matTooltip="{{shortcut.name}}"> + <span style="flex:1;text-align: left;padding: 5px;" *ngIf="(shortcut.id == 'index_mlb' && speedDialFabButtons.length<=1) || (shortcut.id != 'index_mlb' && shortcut.shortcut == 'true')"> + <button color="primary" mat-icon-button (click)="gotToMenu(shortcut);" matTooltip="{{shortcut.name}}"> <mat-icon class="fa {{shortcut.style}}" style="height:auto;"></mat-icon> </button> </span> + <speed-dial-fab matTooltip="{{shortcut.name}}" mainIcon="fa fa-file-medical" *ngIf="shortcut.id=='index_mlb' && shortcut.shortcut == 'true' && speedDialFabButtons.length>1" style="flex:1;display: inline-block;margin-top:5px;" class="speed-dial-container" (fabClick)="onSpeedDialFabClicked($event, shortcut)" [buttons]="speedDialFabButtons"></speed-dial-fab> </ng-container> </div> </mat-nav-list> diff --git a/src/frontend/app/menu/menu-shortcut.component.ts b/src/frontend/app/menu/menu-shortcut.component.ts index a671b28921bf0e100bbdac92b399f5ae3e660049..17e73b910a7b6faabf4f1830b648bd0ef0d059cd 100644 --- a/src/frontend/app/menu/menu-shortcut.component.ts +++ b/src/frontend/app/menu/menu-shortcut.component.ts @@ -1,9 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Inject } from '@angular/core'; import { Router } from '@angular/router'; import { HttpClient } from '@angular/common/http'; import { Location } from '@angular/common'; import { LANG } from '../translate.component'; import { ShortcutMenuService } from '../../service/shortcut-menu.service'; +import { MAT_DIALOG_DATA, MatDialogRef, MatDialog } from '@angular/material'; declare function $j(selector: any) : any; @@ -20,21 +21,53 @@ export class MenuShortcutComponent implements OnInit { lang : any = LANG; mobileMode : boolean = false; router : any; + dialogRef : MatDialogRef<any>; + config : any = {}; + speedDialFabButtons : any = []; + speedDialFabColumnDirection = 'column'; - constructor(public http: HttpClient, private _location: Location, private _router: Router, public shortcut: ShortcutMenuService) { + + constructor(public http: HttpClient, private _location: Location, private _router: Router, public shortcut: ShortcutMenuService, public dialog: MatDialog) { this.mobileMode = angularGlobals.mobileMode; this.router = _router; + /**/ } ngOnInit(): void { this.coreUrl = angularGlobals.coreUrl; + setTimeout(() => { + if(this.shortcut.shortcutsData.user.indexingGroups.length > 0) { + this.shortcut.shortcutsData.user.indexingGroups.forEach((group: any) => { + this.speedDialFabButtons.push({ + icon: 'fa fa-plus', + tooltip: this.lang.indexingWithProfile+' '+ group.label, + label: group.label, + id: group.groupId + }); + }); + } + }, 500); + } + + onSpeedDialFabClicked(btn: any, shortcut:any) { + location.href = shortcut.servicepage+'&groupId='+btn.id; } - gotToMenu(link: string, angularMode: string) { - if (angularMode == 'true') { - this.router.navigate([link]); - } else{ - location.href = link; + gotToMenu(shortcut:any) { + if (shortcut.angular == 'true') { + this.router.navigate([shortcut.servicepage]); + } else { + location.href = shortcut.servicepage; } } } +@Component({ + templateUrl: "indexing-group-modal.component.html", + styles: [".mat-dialog-content{max-height: 65vh;width:600px;}"] +}) +export class IndexingGroupModalComponent { + lang: any = LANG; + + constructor(public http: HttpClient, @Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<IndexingGroupModalComponent>) { + } +} \ No newline at end of file diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts index f386067d7cf959407fcf69bd4463015183a222d9..b43199455b002e29635cf1d6be8193cd688a8867 100755 --- a/src/frontend/lang/lang-en.ts +++ b/src/frontend/lang/lang-en.ts @@ -643,4 +643,5 @@ export const LANG_EN = { "ascending" : "Ascending", "descending" : "Descending", "orderBy" : "Ordering", + "indexingWithProfile" : "Index document with profile", }; diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts index f8e50c94178269dbe88e77764329743bc78e3bb3..3202eae14cd919e82f3c476f88cfe38157a4f2ea 100755 --- a/src/frontend/lang/lang-fr.ts +++ b/src/frontend/lang/lang-fr.ts @@ -668,4 +668,5 @@ export const LANG_FR = { "ascending" : "Ascendant", "descending" : "Descendant", "orderBy" : "Ordre", + "indexingWithProfile" : "Enregistrer un document avec le profil", }; diff --git a/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.animations.ts b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.animations.ts new file mode 100644 index 0000000000000000000000000000000000000000..59af51513ae168301201a907ece19ad7506af04d --- /dev/null +++ b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.animations.ts @@ -0,0 +1,51 @@ +import { + animate, + keyframes, + query, + stagger, + state, + style, + transition, + trigger + } from '@angular/animations'; + + export const speedDialFabAnimations = [ + trigger('fabToggler', [ + state('inactive', style({ + transform: 'rotate(0deg)' + })), + state('active', style({ + transform: 'rotate(225deg)' + })), + transition('* <=> *', animate('200ms cubic-bezier(0.4, 0.0, 0.2, 1)')), + ]), + trigger('speedDialStagger', [ + transition('* => *', [ + + query(':enter', style({ opacity: 0 }), {optional: true}), + + query(':enter', stagger('40ms', + [ + animate('200ms cubic-bezier(0.4, 0.0, 0.2, 1)', + keyframes( + [ + style({opacity: 0, transform: 'translateY(10px)'}), + style({opacity: 1, transform: 'translateY(0)'}), + ] + ) + ) + ] + ), {optional: true}), + + query(':leave', + animate('200ms cubic-bezier(0.4, 0.0, 0.2, 1)', + keyframes([ + style({opacity: 1}), + style({opacity: 0}), + ]) + ), {optional: true} + ) + + ]) + ]) + ]; \ No newline at end of file diff --git a/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.html b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.html new file mode 100644 index 0000000000000000000000000000000000000000..523e1b45e2a2fd0819f685f1d08cb7ef70cae41d --- /dev/null +++ b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.html @@ -0,0 +1,22 @@ +<div id="fab-dismiss" + *ngIf="fabTogglerState==='active'" + (click)="onToggleFab()"> +</div> +<div class='fab-container' [style.flexDirection]="reverseColumnDirection?'column-reverse':'column'"> + <button color="primary" mat-icon-button class="fab-toggler" + (click)="onToggleFab()"> + <i class="{{mainIcon}}" [@fabToggler]="{value: fabTogglerState}"></i> + </button> + <div [className]="reverseColumnDirection?'column-reverse':'column'" [@speedDialStagger]="buttons.length"> + <div class="fab-container-background"></div> + <button color="primary" *ngFor="let btn of buttons;let i = index" + #test="matTooltip" + mat-mini-fab + matTooltip="{{btn.tooltip}}" + class="fab-secondary" + color="secondary" + (click)="onClickFab(btn)"> + <i color="primary" class="{{btn.icon}}"></i> <span style="position: absolute;margin-left: 20px;">{{btn.label}}</span> + </button> + </div> +</div> \ No newline at end of file diff --git a/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.scss b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.scss new file mode 100644 index 0000000000000000000000000000000000000000..6681070e29dbcda609b53dfb9d51228406499d52 --- /dev/null +++ b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.scss @@ -0,0 +1,58 @@ +.fab-container { + position: relative; + z-index: 100; + display: flex; + align-items: center; + + >div.column { + display: flex; + flex-direction: column; + align-items: flex-start; + margin-top: 45px; + position: absolute; + width: 250px; + left: 0px; + + button { + margin-top: 17px; + } + } + + >div.column-reverse { + display: flex; + flex-direction: column-reverse; + align-items: center; + margin-bottom: 5px; + + button { + margin-bottom: 17px; + } + } +} + +.fab-toggler { + float: right; + z-index: 100; +} + +#fab-dismiss { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 99; +} + +.fab-container-background { + background-color: white; + -webkit-filter: blur(1.5rem); + -moz-filter: blur(1.5rem); + -o-filter: blur(1.5rem); + -ms-filter: blur(1.5rem); + filter: blur(1.5rem); + position: absolute; + width: 250px; + height: 100%; + z-index: -1; +} \ No newline at end of file diff --git a/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.ts b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..586e4ee10aa35be624f3d4a4d7ca0858803e53c7 --- /dev/null +++ b/src/frontend/plugins/mat-speed-dial-fab/speed-dial-fab.component.ts @@ -0,0 +1,53 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; + +import { speedDialFabAnimations } from './speed-dial-fab.animations'; + +export interface FabButton { + icon: string, + tooltip: string +} + +export enum SpeedDialFabPosition { + Top = 'top', + Bottom = 'bottom', + Left = 'left', + Right = 'right' +} + +@Component({ + selector: 'speed-dial-fab', + templateUrl: './speed-dial-fab.component.html', + styleUrls: ['./speed-dial-fab.component.scss'], + animations: speedDialFabAnimations +}) +export class SpeedDialFabComponent { + + @Input("reverse-column-direction") reverseColumnDirection: boolean = false; + @Input("buttons") fabButtons: FabButton[]; + @Input("mainIcon") mainIcon: String; + @Output('fabClick') fabClick = new EventEmitter(); + + buttons:any = []; + fabTogglerState = 'inactive'; + + constructor() { } + + private showItems() { + this.fabTogglerState = 'active'; + this.buttons = this.fabButtons; + } + + private hideItems() { + this.fabTogglerState = 'inactive'; + this.buttons = []; + } + + public onToggleFab() { + this.buttons.length ? this.hideItems() : this.showItems(); + } + + public onClickFab(btn: {icon: string}) { + this.hideItems(); + this.fabClick.emit(btn); + } +} \ No newline at end of file