add InteralStatuses filtering to plan + description status listing, add to language files

This commit is contained in:
mchouliara 2024-08-27 10:13:51 +03:00
parent f972e8305f
commit 0a0bc0ee1b
19 changed files with 156 additions and 24 deletions

View File

@ -20,4 +20,5 @@ export interface DescriptionStatusFilter {
excludedIds: Guid[];
like: string;
isActive: IsActive[];
internalStatuses?: DescriptionStatusEnum[];
}

View File

@ -20,4 +20,5 @@ export interface PlanStatusFilter {
excludedIds: Guid[];
like: string;
isActive: IsActive[];
internalStatuses?: PlanStatusEnum[];
}

View File

@ -8,6 +8,10 @@ import { Guid } from "@common/types/guid";
import { DescriptionStatusLookup } from "@app/core/query/description-status.lookup";
import { DescriptionStatus } from "@app/core/model/description-status/description-status";
import { DescriptionStatusPersist } from "@app/core/model/description/description";
import { IsActive } from "@app/core/common/enum/is-active.enum";
import { nameof } from "ts-simple-nameof";
import { FilterService } from "@common/modules/text-filter/filter-service";
import { DescriptionStatusEnum } from "@app/core/common/enum/description-status";
@Injectable()
export class DescriptionStatusService {
@ -16,6 +20,7 @@ export class DescriptionStatusService {
constructor(
private http: BaseHttpV2Service,
private configurationService: ConfigurationService,
private filterService: FilterService,
) {
}
@ -50,4 +55,32 @@ export class DescriptionStatusService {
.delete<DescriptionStatus>(url).pipe(
catchError((error: any) => throwError(() => error)));
}
buildLookup(params: {
like?: string,
excludedIds?: Guid[],
ids?: Guid[],
lookupFields?: string[],
size?: number,
order?: string[],
internalStatuses?: DescriptionStatusEnum[]
}): DescriptionStatusLookup {
const {like, excludedIds, ids, lookupFields, size = 100, order, internalStatuses} = params;
const lookup = new DescriptionStatusLookup();
lookup.isActive = [IsActive.Active];
lookup.order = { items: order ?? [nameof<DescriptionStatus>(x => x.name)] };
lookup.page = { size, offset: 0 };
if(internalStatuses?.length){ lookup.internalStatuses = internalStatuses };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; }
if (like) { lookup.like = this.filterService.transformLike(like); }
if(lookupFields){
lookup.project = {
fields: lookupFields
}
};
return lookup;
}
}

View File

@ -12,6 +12,7 @@ import { PlanLookup } from "@app/core/query/plan.lookup";
import { FilterService } from "@common/modules/text-filter/filter-service";
import { IsActive } from "@notification-service/core/enum/is-active.enum";
import { nameof } from "ts-simple-nameof";
import { PlanStatusEnum } from "@app/core/common/enum/plan-status";
@Injectable()
export class PlanStatusService {
@ -62,15 +63,17 @@ export class PlanStatusService {
ids?: Guid[],
lookupFields?: string[],
size?: number,
order?: string[]
order?: string[],
internalStatuses?: PlanStatusEnum[]
}): PlanStatusLookup {
const {like, excludedIds, ids, lookupFields, size = 100, order} = params;
const lookup = new PlanLookup();
const {like, excludedIds, ids, lookupFields, size = 100, order, internalStatuses} = params;
const lookup = new PlanStatusLookup();
lookup.isActive = [IsActive.Active];
lookup.order = { items: order ?? [nameof<PlanStatus>(x => x.name)] };
lookup.page = { size, offset: 0 };
if(internalStatuses?.length){ lookup.internalStatuses = internalStatuses };
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
if (ids && ids.length > 0) { lookup.ids = ids; }
if (like) { lookup.like = this.filterService.transformLike(like); }

View File

@ -27,6 +27,17 @@
</section>
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>{{'DESCRIPTION-STATUS-EDITOR.FIELDS.INTERNAL-STATUS' | translate}}</mat-label>
<mat-select multiple [(ngModel)]="internalFilters.internalStatuses">
<mat-option *ngFor="let internalStatus of internalStatusEnum" [value]="internalStatus">{{enumUtils.toDescriptionStatusString(internalStatus)}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div class="row justify-content-end align-items-center mt-4 mb-1 gap-1-rem">

View File

@ -1,5 +1,7 @@
import { Component, effect, EventEmitter, input, Output } from '@angular/core';
import { DescriptionStatusEnum } from '@app/core/common/enum/description-status';
import { DescriptionStatusFilter } from '@app/core/query/description-status.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
import { IsActive } from '@notification-service/core/enum/is-active.enum';
@ -15,7 +17,9 @@ export class DescriptionStatusListingFiltersComponent extends BaseComponent{
internalFilters: DescriptionStatusListingFilters = this._getEmptyFilters();
appliedFilterCount: number = 0;
constructor(){
internalStatusEnum = this.enumUtils.getEnumValues<DescriptionStatusEnum>(DescriptionStatusEnum);
constructor(protected enumUtils: EnumUtils){
super();
effect(() => {
const newFilters = this.filter();
@ -31,11 +35,12 @@ export class DescriptionStatusListingFiltersComponent extends BaseComponent{
return this._getEmptyFilters();
}
let { isActive, like } = inputFilter;
let { isActive, like, internalStatuses } = inputFilter;
return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like,
like,
internalStatuses: internalStatuses?.length ? internalStatuses : null
}
}
@ -55,6 +60,7 @@ export class DescriptionStatusListingFiltersComponent extends BaseComponent{
return {
isActive: true,
like: null,
internalStatuses: null
}
}
@ -64,11 +70,12 @@ export class DescriptionStatusListingFiltersComponent extends BaseComponent{
}
protected applyFilters(): void {
const { isActive, like } = this.internalFilters ?? {}
const { isActive, like, internalStatuses } = this.internalFilters ?? {}
this.filterChange.emit({
...this.filter(),
like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive]
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
internalStatuses: internalStatuses?.length ? internalStatuses : null
})
}
@ -85,4 +92,5 @@ export class DescriptionStatusListingFiltersComponent extends BaseComponent{
interface DescriptionStatusListingFilters {
isActive: boolean;
like: string;
internalStatuses: DescriptionStatusEnum[];
}

View File

@ -28,6 +28,16 @@
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<mat-form-field class="w-100">
<mat-label>{{'PLAN-STATUS-EDITOR.FIELDS.INTERNAL-STATUS' | translate}}</mat-label>
<mat-select multiple [(ngModel)]="internalFilters.internalStatuses">
<mat-option *ngFor="let internalStatus of internalStatusEnum" [value]="internalStatus">{{enumUtils.toPlanStatusString(internalStatus)}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<div class="row justify-content-end align-items-center mt-4 mb-1 gap-1-rem">
<div class="col-auto">

View File

@ -1,6 +1,8 @@
import { Component, effect, EventEmitter, input, Input, Output } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { PlanStatusEnum } from '@app/core/common/enum/plan-status';
import { PlanStatusFilter } from '@app/core/query/plan-status.lookup';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
@Component({
@ -14,8 +16,9 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
internalFilters: PlanStatusListingFilters = this._getEmptyFilters();
appliedFilterCount: number = 0;
internalStatusEnum = this.enumUtils.getEnumValues<PlanStatusEnum>(PlanStatusEnum);
constructor(){
constructor(protected enumUtils: EnumUtils){
super();
effect(() => {
const newFilters = this.filter();
@ -31,11 +34,12 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
return this._getEmptyFilters();
}
let { isActive, like } = inputFilter;
let { isActive, like, internalStatuses } = inputFilter;
return {
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
like: like,
like,
internalStatuses: internalStatuses?.length ? internalStatuses : null
}
}
@ -47,6 +51,9 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
}
if(filters?.like){
count++;
}
if(filters?.internalStatuses?.length) {
count++;
}
return count;
}
@ -55,6 +62,7 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
return {
isActive: true,
like: null,
internalStatuses: null
}
}
@ -64,11 +72,12 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
}
protected applyFilters(): void {
const { isActive, like } = this.internalFilters ?? {}
const { isActive, like, internalStatuses } = this.internalFilters ?? {}
this.filterChange.emit({
...this.filter(),
like,
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive]
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
internalStatuses: internalStatuses?.length ? internalStatuses : null
})
}
@ -85,4 +94,5 @@ export class PlanStatusListingFiltersComponent extends BaseComponent{
interface PlanStatusListingFilters {
isActive: boolean;
like: string;
internalStatuses: PlanStatusEnum[];
}

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -453,6 +453,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"FIELDS": {
"TIMEZONE": "Timezone",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},

View File

@ -479,6 +479,10 @@
"PLAN-WORKFLOW": {
"TITLE": "Plan Workflow",
"HINT": "Configure the workflow for this tenant's plans"
},
"DESCRIPTION-WORKFLOW": {
"TITLE": "Description Workflow",
"HINT": "Configure the workflow for this tenant's descriptions"
},
"ACTIONS": {
"SAVE": "Save",
@ -2527,9 +2531,10 @@
"CONFIRM": "Confirm"
}
},
"PLAN-WORKFLOW-EDITOR": {
"WORKFLOW-EDITOR": {
"ACTIONS": {
"SELECT-PLAN-STATUS": "Select plan status",
"SELECT-DESCRIPTION-STATUS": "Select description status",
"ADD-STATUS-TRANSITION": "Add status transition",
"REMOVE-STATUS-TRANSITION": "Remove status transition"
},