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

FEAT #16063 TIME 0:30 WIP menu dashboard

parent 3b5ce6b3
No related branches found
No related tags found
No related merge requests found
......@@ -12,14 +12,16 @@
</button>
<mat-menu #toolMenu="matMenu">
<ng-container *ngFor="let menu of tile.menus">
<button *ngIf="menu!=='view'" mat-menu-item>{{menu}}</button>
<button *ngIf="menu==='view'" mat-menu-item [matMenuTriggerFor]="toolMenuView">{{menu}}</button>
<button *ngIf="menu!=='view'" mat-menu-item (click)="launchAction(menu, tile)">{{'lang.'+ menu | translate}}</button>
<button *ngIf="menu==='view'" mat-menu-item [matMenuTriggerFor]="toolMenuView">{{'lang.'+ menu | translate}}</button>
</ng-container>
</mat-menu>
<mat-menu #toolMenuView="matMenu">
<button mat-menu-item *ngFor="let view of tile.views" [disabled]="tile.view === view" (click)="changeView(tile,view.id)">
<mat-icon class="fa fa-list" color="primary" style="height: auto;width: auto;"></mat-icon>
<span>{{view.id}}</span>
<button mat-menu-item *ngFor="let view of tile.views" [disabled]="tile.view === view.id" (click)="changeView(tile,view.id)">
<mat-icon *ngIf="view.id==='list'" class="fa fa-list" color="primary" style="height: auto;width: auto;"></mat-icon>
<mat-icon *ngIf="view.id==='resume'" class="fas fa-equals" color="primary" style="height: auto;width: auto;"></mat-icon>
<mat-icon *ngIf="view.id==='chart'" class="fas fa-chart-pie" color="primary" style="height: auto;width: auto;"></mat-icon>
<span>{{'lang.' + view.id | translate}}</span>
</button>
</mat-menu>
</div>
......
......@@ -6,6 +6,7 @@ import { FunctionsService } from '@service/functions.service';
import { TileCreateComponent } from './tile/tile-create.component';
import { exhaustMap, filter, tap } from 'rxjs/operators';
import { MatDialog } from '@angular/material/dialog';
import { ConfirmComponent } from '@plugins/modal/confirm.component';
@Component({
selector: 'app-dashboard',
......@@ -87,6 +88,7 @@ export class DashboardComponent implements OnInit, AfterViewInit {
changeView(tile: any, view: string) {
const indexTile = this.tiles.filter((tileItem: any) => tileItem.id !== null).map((tileItem: any) => tileItem.sequence).indexOf(tile.sequence);
this.tileComponent.toArray()[indexTile].changeView(view);
tile.view = view;
}
transferDataSuccess() {
......@@ -106,4 +108,24 @@ export class DashboardComponent implements OnInit, AfterViewInit {
})
).subscribe();
}
launchAction(action: string, tile: any) {
this[action](tile);
}
delete(tile: any) {
const dialogRef = this.dialog.open(ConfirmComponent, { panelClass: 'maarch-modal', autoFocus: false, disableClose: true, data: { title: this.translate.instant('lang.delete'), msg: this.translate.instant('lang.confirmAction') } });
// TO DO: SAVE IN BACK
dialogRef.afterClosed().pipe(
filter((data: string) => data === 'ok'),
tap(() => {
this.tiles[tile.sequence] = {
id: null,
sequence: tile.sequence,
editMode: false
};
})
).subscribe();
}
}
......@@ -8,8 +8,8 @@ export class DashboardService {
tileTypes: any = {
myLastResources : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......@@ -28,8 +28,8 @@ export class DashboardService {
},
basket : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......@@ -48,8 +48,8 @@ export class DashboardService {
},
searchTemplate : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......@@ -68,8 +68,8 @@ export class DashboardService {
},
followedMail : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......@@ -88,8 +88,8 @@ export class DashboardService {
},
folder : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......@@ -108,8 +108,8 @@ export class DashboardService {
},
externalSignatoryBook : {
menus : [
'delete',
'view'
'view',
'delete'
],
views: [
{
......
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