Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
<mtx-grid
[data]="items"
[columns]="mergedTableHeaders"
[cellTemplate]="{
actions: actionsTpl
}"
[showPaginator]="false"
[pageOnFront]="false"
[rowStriped]="true"
[showToolbar]="false"
[showColumnMenuButton]="false"
>
</mtx-grid>

<ng-template #actionsTpl let-row let-i="index">
<div class="report-actions" id="action-items-{{i}}">
<button id="actionMenu" mat-icon-button [matMenuTriggerFor]="menu" matTooltip="{{ 'Actions' | translate }}">
<mat-icon>more_vert</mat-icon>
</button>

<mat-menu #menu="matMenu">
<button
mat-menu-item
*ngIf="row.imagesCount !== 0"
id="viewImagesBtn-{{i}}"
(click)="onClickViewPicture(row.microtingSdkCaseId)"
>
<mat-icon>image</mat-icon>
<span>{{ 'View images' | translate }}</span>
</button>
<button
mat-menu-item
id="editCaseBtn-{{i}}"
(click)="onClickEditCase(row.microtingSdkCaseId, row.eFormId, row.id)"
>
<mat-icon>edit</mat-icon>
<span>{{ 'Edit' | translate }}</span>
</button>
<button
mat-menu-item
id="deleteCaseBtn-{{i}}"
(click)="onShowDeletePlanningCaseModal(row)"
>
<mat-icon color="warn">delete</mat-icon>
<span>{{ 'Delete' | translate }}</span>
</button>
</mat-menu>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,8 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
{
header: this.translateService.stream('Actions'),
field: 'actions',
type: 'button',
buttons: [
{
tooltip: this.translateService.stream('View images'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickViewPicture(record.microtingSdkCaseId),
icon: 'image',
iif: (record: ReportEformItemModel) => record.imagesCount !== 0,
},
{
tooltip: this.translateService.stream('Edit'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickEditCase(record.microtingSdkCaseId, record.eFormId, record.id),
icon: 'edit',
},
{
tooltip: this.translateService.stream('Delete'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onShowDeletePlanningCaseModal(record),
color: 'warn',
icon: 'delete',
}
]
width: '160px',
pinned: 'right',
},
];
adminTableHeaders: MtxGridColumn[] = [
Expand All @@ -96,29 +75,8 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
{
header: this.translateService.stream('Actions'),
field: 'actions',
type: 'button',
buttons: [
{
tooltip: this.translateService.stream('View images'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickViewPicture(record.microtingSdkCaseId),
icon: 'image',
iif: (record: ReportEformItemModel) => record.imagesCount !== 0,
},
{
tooltip: this.translateService.stream('Edit'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickEditCase(record.microtingSdkCaseId, record.eFormId, record.id),
icon: 'edit',
},
{
tooltip: this.translateService.stream('Delete'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onShowDeletePlanningCaseModal(record),
color: 'warn',
icon: 'delete',
}
]
width: '160px',
pinned: 'right',
},
];
mergedTableHeaders: MtxGridColumn[] = [];
Expand Down Expand Up @@ -169,12 +127,8 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
};
});
if (this.isAdmin) {
this.adminTableHeaders.find(x => x.field === 'actions').class = ((record: ReportEformItemModel, _) =>
record ? `id-${record.id}` : '');//microtingSdkCaseId${record.microtingSdkCaseId}-eFormId${record.eFormId}-
this.mergedTableHeaders = [...this.adminTableHeaders, ...itemHeaders];
} else {
this.tableHeaders.find(x => x.field === 'actions').class = ((record: ReportEformItemModel, _) =>
record ? `id-${record.id}` : '');//microtingSdkCaseId${record.microtingSdkCaseId}-eFormId${record.eFormId}-
this.mergedTableHeaders = [...this.tableHeaders, ...itemHeaders];
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
<mtx-grid
[data]="items"
[columns]="mergedTableHeaders"
[cellTemplate]="{
actions: actionsTpl
}"
[showPaginator]="false"
[pageOnFront]="false"
[rowStriped]="true"
[showToolbar]="false"
[showColumnMenuButton]="false"
>
</mtx-grid>

<ng-template #actionsTpl let-row let-i="index">
<div class="report-actions" id="action-items-{{i}}">
<button id="actionMenu" mat-icon-button [matMenuTriggerFor]="menu" matTooltip="{{ 'Actions' | translate }}">
<mat-icon>more_vert</mat-icon>
</button>

<mat-menu #menu="matMenu">
<button
mat-menu-item
*ngIf="row.imagesCount !== 0"
id="viewImagesBtn-{{i}}"
(click)="onClickViewPicture(row.microtingSdkCaseId)"
>
<mat-icon>image</mat-icon>
<span>{{ 'View images' | translate }}</span>
</button>
<button
mat-menu-item
id="editCaseBtn-{{i}}"
(click)="onClickEditCase(row.microtingSdkCaseId, row.eFormId, row.id)"
>
<mat-icon>edit</mat-icon>
<span>{{ 'Edit' | translate }}</span>
</button>
<button
mat-menu-item
id="deleteCaseBtn-{{i}}"
(click)="onShowDeletePlanningCaseModal(row)"
>
<mat-icon color="warn">delete</mat-icon>
<span>{{ 'Delete' | translate }}</span>
</button>
</mat-menu>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,8 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
{
header: this.translateService.stream('Actions'),
field: 'actions',
type: 'button',
buttons: [
{
tooltip: this.translateService.stream('View images'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickViewPicture(record.microtingSdkCaseId),
icon: 'image',
iif: (record: ReportEformItemModel) => record.imagesCount !== 0,
},
{
tooltip: this.translateService.stream('Edit'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickEditCase(record.microtingSdkCaseId, record.eFormId, record.id),
icon: 'edit',
},
{
tooltip: this.translateService.stream('Delete'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onShowDeletePlanningCaseModal(record),
color: 'warn',
icon: 'delete',
}
]
width: '160px',
pinned: 'right',
},
{header: this.translateService.stream('Employee no'), field: 'employeeNo'},
];
Expand All @@ -87,29 +66,8 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
{
header: this.translateService.stream('Actions'),
field: 'actions',
type: 'button',
buttons: [
{
tooltip: this.translateService.stream('View images'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickViewPicture(record.microtingSdkCaseId),
icon: 'image',
iif: (record: ReportEformItemModel) => record.imagesCount !== 0,
},
{
tooltip: this.translateService.stream('Edit'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onClickEditCase(record.microtingSdkCaseId, record.eFormId, record.id),
icon: 'edit',
},
{
tooltip: this.translateService.stream('Delete'),
type: 'icon',
click: (record: ReportEformItemModel) => this.onShowDeletePlanningCaseModal(record),
color: 'warn',
icon: 'delete',
}
]
width: '160px',
pinned: 'right',
},
{header: this.translateService.stream('Employee no'), field: 'employeeNo'},
];
Expand Down Expand Up @@ -161,9 +119,6 @@ export class ReportTableComponent implements OnInit, OnChanges, OnDestroy {
let isAdmin = false;
this.selectAuthIsAdmin$.subscribe((selectAuthIsAdmin$) => isAdmin = selectAuthIsAdmin$);
const tableHeaders = [...(isAdmin ? [...this.adminTableHeaders] : [...this.tableHeaders])];
const index = tableHeaders
.findIndex(x => x.field === 'actions');
tableHeaders[index].width = this.items.filter(x => x.imagesCount > 0).length > 0 ? '160px' : '110px';

this.mergedTableHeaders = [
...tableHeaders,
Expand Down
Loading