fixes on listing actions

This commit is contained in:
CITE\spapacharalampous 2024-08-28 10:16:42 +03:00
parent 55aa84532c
commit da77e5f144
23 changed files with 67 additions and 17 deletions

View File

@ -74,7 +74,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -130,6 +130,11 @@ export class StatusListingComponent extends BaseListingComponent<Status, StatusL
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: Status): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -205,7 +205,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
} }
public canEdit(descriptionTemplate: DescriptionTemplate): boolean { public canEdit(descriptionTemplate: DescriptionTemplate): boolean {
return descriptionTemplate.status !== DescriptionTemplateStatus.Finalized && this.hasPermission(AppPermission.EditDescriptionTemplate, descriptionTemplate) && descriptionTemplate.belongsToCurrentTenant; return descriptionTemplate.status !== DescriptionTemplateStatus.Finalized && this.hasPermission(AppPermission.EditDescriptionTemplate, descriptionTemplate) && descriptionTemplate.belongsToCurrentTenant && descriptionTemplate.isActive == IsActive.Active;
} }
public canCreateNew(): boolean { public canCreateNew(): boolean {
@ -213,7 +213,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
} }
public canAddNewVersion(descriptionTemplate: DescriptionTemplate): boolean { public canAddNewVersion(descriptionTemplate: DescriptionTemplate): boolean {
return descriptionTemplate.belongsToCurrentTenant != false && this.canCreateNew(); return descriptionTemplate.belongsToCurrentTenant != false && descriptionTemplate.isActive == IsActive.Active && this.canCreateNew();
} }
public canClone(descriptionTemplate: DescriptionTemplate): boolean { public canClone(descriptionTemplate: DescriptionTemplate): boolean {
@ -221,7 +221,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
} }
public canViewVersions(descriptionTemplate: DescriptionTemplate): boolean { public canViewVersions(descriptionTemplate: DescriptionTemplate): boolean {
return descriptionTemplate.belongsToCurrentTenant != false && this.canCreateNew(); return descriptionTemplate.belongsToCurrentTenant != false && descriptionTemplate.isActive == IsActive.Active && this.canCreateNew();
} }
public canDownloadXml(descriptionTemplate: DescriptionTemplate): boolean { public canDownloadXml(descriptionTemplate: DescriptionTemplate): boolean {
@ -229,7 +229,7 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
} }
public canDelete(descriptionTemplate: DescriptionTemplate): boolean { public canDelete(descriptionTemplate: DescriptionTemplate): boolean {
return descriptionTemplate.belongsToCurrentTenant != false && this.hasPermission(AppPermission.DeleteDescriptionTemplate, descriptionTemplate); return descriptionTemplate.belongsToCurrentTenant != false && descriptionTemplate.isActive == IsActive.Active && this.hasPermission(AppPermission.DeleteDescriptionTemplate, descriptionTemplate);
} }
private onColumnsChangedInternal(columns: string[]) { private onColumnsChangedInternal(columns: string[]) {

View File

@ -84,7 +84,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu" *ngIf="!isFinalized(row) || row.belongsToCurrentTenant != false"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu" *ngIf="!isFinalized(row) || row.belongsToCurrentTenant != false">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -140,6 +140,10 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
// Listing Component functions // Listing Component functions
// //
isDeleted(row: DescriptionTemplateType): boolean {
return row?.isActive === IsActive.Inactive;
}
isFinalized(item: DescriptionTemplateType): boolean { isFinalized(item: DescriptionTemplateType): boolean {
return item.status === DescriptionTemplateTypeStatus.Finalized return item.status === DescriptionTemplateTypeStatus.Finalized
} }

View File

@ -75,7 +75,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -123,6 +123,11 @@ export class LanguageListingComponent extends BaseListingComponent<Language, Lan
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: Language): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -85,7 +85,7 @@
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>
</button> </button>
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button *ngIf="(row.status != null && row.status === planBlueprintStatuses.Draft)" mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/', row.id])"> <button *ngIf="(row.status != null && row.status === planBlueprintStatuses.Draft && row.isActive == isActive.Active)" mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/', row.id])">
<mat-icon>edit</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}} <mat-icon>edit</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}}
</button> </button>
<button *ngIf="row.belongsToCurrentTenant != false && (row.status === planBlueprintStatuses.Finalized || row.status == null)" mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/new-version/', row.id])"> <button *ngIf="row.belongsToCurrentTenant != false && (row.status === planBlueprintStatuses.Finalized || row.status == null)" mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/new-version/', row.id])">
@ -94,14 +94,14 @@
<button mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/clone/', row.id])"> <button mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/clone/', row.id])">
<mat-icon>content_copy</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}} <mat-icon>content_copy</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}}
</button> </button>
<button mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/versions/', row.groupId])"> <button *ngIf="row.isActive == isActive.Active" mat-menu-item [routerLink]="routerUtils.generateUrl(['/plan-blueprints/versions/', row.groupId])">
<mat-icon>library_books</mat-icon> <mat-icon>library_books</mat-icon>
{{'PLAN-BLUEPRINT-LISTING.ACTIONS.VIEW-VERSIONS' | translate}} {{'PLAN-BLUEPRINT-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
</button> </button>
<button mat-menu-item (click)="export($event, row.id)"> <button mat-menu-item (click)="export($event, row.id)">
<mat-icon>download</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}} <mat-icon>download</mat-icon>{{'PLAN-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button> </button>
<button *ngIf="row.belongsToCurrentTenant != false" mat-menu-item (click)="delete(row.id)"> <button *ngIf="row.belongsToCurrentTenant != false && row.isActive == isActive.Active" mat-menu-item (click)="delete(row.id)">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
{{'PLAN-BLUEPRINT-LISTING.ACTIONS.DELETE' | translate}} {{'PLAN-BLUEPRINT-LISTING.ACTIONS.DELETE' | translate}}
</button> </button>

View File

@ -42,6 +42,7 @@ export class PlanBlueprintListingComponent extends BaseListingComponent<PlanBlue
userSettingsKey = { key: 'PlanBlueprintListingUserSettings' }; userSettingsKey = { key: 'PlanBlueprintListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
planBlueprintStatuses = PlanBlueprintStatus; planBlueprintStatuses = PlanBlueprintStatus;
isActive = IsActive;
mode; mode;
@ViewChild('planBlueprintStatus', { static: true }) planBlueprintStatus?: TemplateRef<any>; @ViewChild('planBlueprintStatus', { static: true }) planBlueprintStatus?: TemplateRef<any>;

View File

@ -77,7 +77,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -128,6 +128,11 @@ export class PrefillingSourceListingComponent extends BaseListingComponent<Prefi
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: PrefillingSource): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -78,7 +78,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -128,6 +128,11 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: ReferenceType): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -99,7 +99,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -147,6 +147,11 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: Reference): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -78,7 +78,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -127,6 +127,11 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: Tenant): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -78,7 +78,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -137,6 +137,11 @@ export class UsageLimitListingComponent extends BaseListingComponent<UsageLimit,
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: UsageLimit): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -92,7 +92,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -141,6 +141,11 @@ export class NotificationTemplateListingComponent extends BaseListingComponent<N
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: NotificationTemplate): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));

View File

@ -80,7 +80,7 @@
</ng-template> </ng-template>
<ng-template #actions let-row="row" let-item> <ng-template #actions let-row="row" let-item>
<div class="row" (click)="$event.stopPropagation()"> <div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto"> <div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu"> <button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>

View File

@ -181,6 +181,11 @@ export class NotificationListingComponent extends BaseListingComponent<Notificat
// //
// Listing Component functions // Listing Component functions
// //
isDeleted(row: Notification): boolean {
return row?.isActive === IsActive.Inactive;
}
onColumnsChanged(event: ColumnsChangedEvent) { onColumnsChanged(event: ColumnsChangedEvent) {
super.onColumnsChanged(event); super.onColumnsChanged(event);
this.onColumnsChangedInternal(event.properties.map(x => x.toString())); this.onColumnsChangedInternal(event.properties.map(x => x.toString()));