Skip to content
Snippets Groups Projects
Verified Commit b88e5c89 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #11266 TIME 2 shortcut refactoring (for v2 index admin)

parent c44bcafa
No related branches found
No related tags found
No related merge requests found
......@@ -30,14 +30,14 @@
<mat-nav-list>
<h3 mat-subheader>{{lang.shortcut}}</h3>
<div class="button-row" style="padding-left: 10px;padding-right: 10px;display: flex;width: 300px;margin-top: -10px;margin-bottom: 10px;">
<ng-container *ngFor="let shortcut of headerService.menu">
<span style="flex:1;text-align: left;padding: 5px;" *ngIf="(shortcut.id == 'index_mlb' && speedDialFabButtons.length<=1) || (shortcut.id != 'index_mlb' && shortcut.shortcut == 'true')">
<ng-container *ngFor="let shortcut of headerService.shortcut">
<span style="flex:1;text-align: left;padding: 5px;" *ngIf="(shortcut.id == 'indexing' && speedDialFabButtons.length<=1) || (shortcut.id != 'indexing')">
<button style="z-index: 9999;" color="default" mat-fab (click)="gotToMenu(shortcut);" matTooltip="{{shortcut.name}}"
matTooltipPosition="above">
<mat-icon class="fa {{shortcut.style}}" style="height:auto;font-size:22px;"></mat-icon>
</button>
</span>
<span style="flex:1;text-align: left;padding: 5px;position: relative;" *ngIf="shortcut.id=='index_mlb' && shortcut.shortcut == 'true' && speedDialFabButtons.length>1">
<span style="flex:1;text-align: left;padding: 5px;position: relative;" *ngIf="shortcut.id=='indexing' && speedDialFabButtons.length>1">
<smd-fab-speed-dial #myFab direction="down" animationMode="fling" fixed="false" (mouseenter)="myFab.open = true"
(mouseleave)="myFab.open = false">
<smd-fab-trigger spin="true">
......
......@@ -36,13 +36,14 @@ export class MenuShortcutComponent implements OnInit {
ngOnInit(): void {
setTimeout(() => {
if(this.headerService.user.indexingGroups.length > 0) {
this.headerService.user.indexingGroups.forEach((group: any) => {
const index = this.headerService.shortcut.map(index => index.id).indexOf('indexing');
if(index > -1) {
this.headerService.shortcut[index].groups.forEach((group: any) => {
this.speedDialFabButtons.push({
icon: 'fa fa-plus',
tooltip: this.lang.indexingWithProfile+' '+ group.label,
label: group.label,
id: group.groupId
id: group.id
});
});
}
......
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { LANG } from '../app/translate.component';
import { tap, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
@Injectable()
export class HeaderService {
......@@ -8,29 +10,79 @@ export class HeaderService {
subHeaderMessage: string = "";
user: any = { firstname: "", lastname: "" };
menu: any[] = [];
shortcut: any[] = [];
shortcutIcon: any = {
home: 'fa fa-home',
administration: 'fa fa-cogs',
search: 'fa fa-search',
indexing: 'fa fa-file-medical',
}
lang: any = LANG;
constructor(public http: HttpClient) { }
loadHeader() {
this.http.get('../../rest/header')
.subscribe((data: any) => {
this.user = data.user;
this.user.menu = data.menu;
data.menu.unshift({
"name": this.lang.home,
"comment": this.lang.home,
"servicepage": "/home",
"shortcut": "true",
"style": "fa fa-home",
"angular": "true"
});
this.menu = data.menu;
}, (err) => {
this.http.get('../../rest/header').pipe(
tap((data: any) => this.setUser(data.user)),
tap((data: any) => this.setMenu(data.menu)),
tap((data: any) => this.setShortcut(data.shortcuts)),
catchError((err: any) => {
console.log(err.error.errors);
});
return of(false);
})
).subscribe();
}
setUser(user: any) {
this.user = user;
}
setMenu(menu: any) {
menu.unshift({
"name": this.lang.home,
"comment": this.lang.home,
"servicepage": "/home",
"shortcut": "true",
"style": "fa fa-home",
"angular": "true"
});
this.menu = menu;
}
setShortcut(shortcuts: any) {
shortcuts.forEach((element: any) => {
if (['indexing', 'search'].indexOf(element.id) > -1) {
// TO DO : DELETE AFTER FULL V2
this.setShortcutV1(element);
} else {
this.shortcut.push(
{
id: element.id,
name: this.lang[element.id],
servicepage: '/' + element.id,
style: this.shortcutIcon[element.id],
angular: element.id !== 'search' ? "true" : "false",
groups : element.groups !== undefined ? element.groups : ''
},
);
}
});
}
setShortcutV1(shortcut: any) {
this.shortcut.push(
{
id: shortcut.id,
name: this.lang[shortcut.id],
servicepage: shortcut.id !== 'search' ? "index.php?page=view_baskets&module=basket&baskets=IndexingBasket" : "index.php?page=search_adv&dir=indexing_searching",
style: this.shortcutIcon[shortcut.id],
angular: "false",
groups : shortcut.groups !== undefined ? shortcut.groups : ''
},
);
}
setHeader(maintTitle: string, subTitle: any = '') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment