fix listing filters
This commit is contained in:
parent
5965acc4aa
commit
63e5cde313
|
@ -1,12 +1,14 @@
|
|||
import { Lookup } from "@common/model/lookup";
|
||||
import { Guid } from "@common/types/guid";
|
||||
import { IsActive } from "../common/enum/is-active.enum";
|
||||
import { DescriptionTemplateTypeStatus } from "../common/enum/description-template-type-status";
|
||||
|
||||
export class DescriptionTemplateTypeLookup extends Lookup implements DescriptionTemplateTypeFilter {
|
||||
ids: Guid[];
|
||||
excludedIds: Guid[];
|
||||
like: string;
|
||||
isActive: IsActive[];
|
||||
statuses: DescriptionTemplateTypeStatus[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -18,4 +20,5 @@ export interface DescriptionTemplateTypeFilter {
|
|||
excludedIds: Guid[];
|
||||
like: string;
|
||||
isActive: IsActive[];
|
||||
statuses: DescriptionTemplateTypeStatus[];
|
||||
}
|
|
@ -10,7 +10,7 @@ export class ReferenceLookup extends Lookup implements ReferenceFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
sourceTypes: ReferenceSourceType[];
|
||||
referenceTypes: ReferenceType[];
|
||||
types: ReferenceType[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -23,5 +23,5 @@ export interface ReferenceFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
sourceTypes: ReferenceSourceType[];
|
||||
referenceTypes: ReferenceType[];
|
||||
types: ReferenceType[];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
|
|||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DescriptionTemplateType, DescriptionTemplateTypePersist } from '@app/core/model/description-template-type/description-template-type';
|
||||
import { DescriptionTemplateTypeLookup } from '@app/core/query/description-template-type.lookup';
|
||||
import { DmpBlueprintLookup } from '@app/core/query/dmp-blueprint.lookup';
|
||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||
import { QueryResult } from '@common/model/query-result';
|
||||
|
@ -80,8 +79,8 @@ export class DescriptionTemplateTypeService {
|
|||
valueAssign: (item: DescriptionTemplateType) => item.id,
|
||||
};
|
||||
|
||||
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DmpBlueprintLookup {
|
||||
const lookup: DmpBlueprintLookup = new DmpBlueprintLookup();
|
||||
private buildAutocompleteLookup(like?: string, excludedIds?: Guid[], ids?: Guid[]): DescriptionTemplateTypeLookup {
|
||||
const lookup: DescriptionTemplateTypeLookup = new DescriptionTemplateTypeLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||
if (ids && ids.length > 0) { lookup.ids = ids; }
|
||||
|
|
|
@ -71,29 +71,29 @@ export class ReferenceService {
|
|||
//
|
||||
// Autocomplete Commons
|
||||
//
|
||||
public getSingleAutocompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
|
||||
public getSingleAutocompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): SingleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
initialItems: (data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery)).pipe(map(x => x.items)),
|
||||
getSelectedItem: (selectedItem: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, [selectedItem])).pipe(map(x => x.items[0])),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
valueAssign: (item: Reference) => item.id,
|
||||
};
|
||||
};
|
||||
|
||||
public getMultipleAutoCompleteConfiguration(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
|
||||
public getMultipleAutoCompleteConfiguration(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[]): MultipleAutoCompleteConfiguration {
|
||||
return {
|
||||
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(referenceTypes, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)),
|
||||
initialItems: (excludedItems: any[], data?: any) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, excludedItems ? excludedItems : null)).pipe(map(x => x.items)),
|
||||
filterFn: (searchQuery: string, excludedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, searchQuery, excludedItems)).pipe(map(x => x.items)),
|
||||
getSelectedItems: (selectedItems: any[]) => this.query(this.buildAutocompleteLookup(types, sourceTypes, null, null, selectedItems)).pipe(map(x => x.items)),
|
||||
displayFn: (item: Reference) => item.label,
|
||||
titleFn: (item: Reference) => item.label,
|
||||
valueAssign: (item: Reference) => item.id,
|
||||
};
|
||||
}
|
||||
|
||||
private buildAutocompleteLookup(referenceTypes?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
private buildAutocompleteLookup(types?: ReferenceType[], sourceTypes?: ReferenceSourceType[], like?: string, excludedIds?: Guid[], ids?: Guid[]): ReferenceLookup {
|
||||
const lookup: ReferenceLookup = new ReferenceLookup();
|
||||
lookup.page = { size: 100, offset: 0 };
|
||||
if (excludedIds && excludedIds.length > 0) { lookup.excludedIds = excludedIds; }
|
||||
|
@ -105,7 +105,7 @@ export class ReferenceService {
|
|||
nameof<Reference>(x => x.label)
|
||||
]
|
||||
};
|
||||
if (referenceTypes && referenceTypes.length > 0) { lookup.referenceTypes = referenceTypes; }
|
||||
if (types && types.length > 0) { lookup.types = types; }
|
||||
if (sourceTypes && sourceTypes.length > 0) { lookup.sourceTypes = sourceTypes; }
|
||||
lookup.order = { items: [nameof<Reference>(x => x.label)] };
|
||||
if (like) { lookup.like = this.filterService.transformLike(like); }
|
||||
|
|
|
@ -27,6 +27,7 @@ import { ImportDescriptionTemplateDialogComponent } from './import-description-t
|
|||
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
|
||||
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
|
||||
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -127,6 +128,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<DescriptionTemplate>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.IS-ACTIVE' | translate}}
|
||||
</mat-slide-toggle>
|
||||
|
||||
<div>
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.STATUS' | translate}}
|
||||
<mat-select multiple [(ngModel)]="internalFilters.statuses">
|
||||
<mat-option *ngFor="let descriptionTemplateStatus of descriptionTemplateStatusEnumValues" [value]="descriptionTemplateStatus">{{enumUtils.toDescriptionTemplateTypeStatusString(descriptionTemplateStatus)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
||||
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
||||
{{'DESCRIPTION-TEMPLATE-LISTING.FILTER.CANCEL' | translate}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DescriptionTemplateFilter } from '@app/core/query/description-template.lookup';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
@ -16,6 +17,8 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
|
|||
@Input() readonly filter: DescriptionTemplateFilter;
|
||||
@Output() filterChange = new EventEmitter<DescriptionTemplateFilter>();
|
||||
|
||||
descriptionTemplateStatusEnumValues = this.enumUtils.getEnumValues<DescriptionTemplateStatus>(DescriptionTemplateStatus);
|
||||
|
||||
// * State
|
||||
internalFilters: DescriptionTemplateListingFilters = this._getEmptyFilters();
|
||||
|
||||
|
@ -46,12 +49,12 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
|
|||
}
|
||||
|
||||
protected applyFilters(): void {
|
||||
const { isActive, like, typeIds } = this.internalFilters ?? {}
|
||||
const { isActive, like, statuses } = this.internalFilters ?? {}
|
||||
this.filterChange.emit({
|
||||
...this.filter,
|
||||
like,
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
|
||||
typeIds
|
||||
statuses
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -61,12 +64,12 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
|
|||
return this._getEmptyFilters();
|
||||
}
|
||||
|
||||
let { excludedIds, ids, isActive, like, typeIds } = inputFilter;
|
||||
let { excludedIds, ids, isActive, like, statuses } = inputFilter;
|
||||
|
||||
return {
|
||||
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
||||
like: like,
|
||||
typeIds: typeIds
|
||||
statuses: statuses
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -75,7 +78,7 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
|
|||
return {
|
||||
isActive: true,
|
||||
like: null,
|
||||
typeIds: null,
|
||||
statuses: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,5 +98,5 @@ export class DescriptionTemplateListingFiltersComponent extends BaseComponent im
|
|||
interface DescriptionTemplateListingFilters {
|
||||
isActive: boolean;
|
||||
like: string;
|
||||
typeIds: Guid[];
|
||||
statuses: DescriptionTemplateStatus[];
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
|
|||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||
import { PipeService } from '@common/formatting/pipe.service';
|
||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { QueryResult } from '@common/model/query-result';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||
|
@ -110,6 +111,12 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
|
|||
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<DescriptionTemplateType>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.IS-ACTIVE' | translate}}
|
||||
</mat-slide-toggle>
|
||||
|
||||
<div>
|
||||
<mat-label>{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.STATUS' | translate}}
|
||||
<mat-select multiple [(ngModel)]="internalFilters.statuses">
|
||||
<mat-option *ngFor="let descriptionTemplateTypeStatus of descriptionTemplateTypeStatusEnumValues" [value]="descriptionTemplateTypeStatus">{{enumUtils.toDescriptionTemplateTypeStatusString(descriptionTemplateTypeStatus)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
||||
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
||||
{{'DESCRIPTION-TEMPLATE-TYPE-LISTING.FILTER.CANCEL' | translate}}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { DescriptionTemplateTypeStatus } from '@app/core/common/enum/description-template-type-status';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { DescriptionTemplateTypeFilter } from '@app/core/query/description-template-type.lookup';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
@ -15,6 +16,8 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
|
|||
@Input() readonly filter: DescriptionTemplateTypeFilter;
|
||||
@Output() filterChange = new EventEmitter<DescriptionTemplateTypeFilter>();
|
||||
|
||||
descriptionTemplateTypeStatusEnumValues = this.enumUtils.getEnumValues<DescriptionTemplateTypeStatus>(DescriptionTemplateTypeStatus);
|
||||
|
||||
// * State
|
||||
internalFilters: DescriptionTemplateTypeListingFilters = this._getEmptyFilters();
|
||||
|
||||
|
@ -45,11 +48,12 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
|
|||
}
|
||||
|
||||
protected applyFilters(): void {
|
||||
const { isActive, like } = this.internalFilters ?? {}
|
||||
const { isActive, like, statuses } = this.internalFilters ?? {}
|
||||
this.filterChange.emit({
|
||||
...this.filter,
|
||||
like,
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive]
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
|
||||
statuses
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -59,11 +63,12 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
|
|||
return this._getEmptyFilters();
|
||||
}
|
||||
|
||||
let { excludedIds, ids, isActive, like } = inputFilter;
|
||||
let { excludedIds, ids, isActive, like, statuses } = inputFilter;
|
||||
|
||||
return {
|
||||
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
||||
like: like
|
||||
like: like,
|
||||
statuses: statuses
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,6 +77,7 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
|
|||
return {
|
||||
isActive: true,
|
||||
like: null,
|
||||
statuses: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,4 +97,5 @@ export class DescriptionTemplateTypeListingFiltersComponent extends BaseComponen
|
|||
interface DescriptionTemplateTypeListingFilters {
|
||||
isActive: boolean;
|
||||
like: string;
|
||||
statuses: DescriptionTemplateTypeStatus[];
|
||||
}
|
||||
|
|
|
@ -20,9 +20,13 @@
|
|||
{{'DMP-BLUEPRINT-LISTING.FILTER.IS-ACTIVE' | translate}}
|
||||
</mat-slide-toggle>
|
||||
|
||||
<mat-select multiple [(ngModel)]="internalFilters.statuses">
|
||||
<mat-option *ngFor="let blueprintStatus of dmpBlueprintStatusEnumValues" [value]="blueprintStatus">{{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}}</mat-option>
|
||||
</mat-select>
|
||||
<div>
|
||||
<mat-label>{{'DMP-BLUEPRINT-LISTING.FILTER.STATUS' | translate}}
|
||||
<mat-select multiple [(ngModel)]="internalFilters.statuses">
|
||||
<mat-option *ngFor="let blueprintStatus of dmpBlueprintStatusEnumValues" [value]="blueprintStatus">{{enumUtils.toDmpBlueprintStatusString(blueprintStatus)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
||||
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
||||
|
|
|
@ -12,6 +12,7 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
|
|||
import { BaseListingComponent } from '@common/base/base-listing-component';
|
||||
import { PipeService } from '@common/formatting/pipe.service';
|
||||
import { DataTableDateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { QueryResult } from '@common/model/query-result';
|
||||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||
|
@ -102,6 +103,12 @@ export class LanguageListingComponent extends BaseListingComponent<Language, Lan
|
|||
languageName: 'LANGUAGE-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<Language>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'LANGUAGE-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -21,6 +21,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Observable } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
|
||||
@Component({
|
||||
templateUrl: './reference-type-listing.component.html',
|
||||
|
@ -95,7 +96,6 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
|
|||
prop: nameof<ReferenceType>(x => x.code),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.CODE',
|
||||
//cellTemplate: this.ReferenceTypeStatus
|
||||
},
|
||||
{
|
||||
prop: nameof<ReferenceType>(x => x.createdAt),
|
||||
|
@ -109,6 +109,12 @@ export class ReferenceTypeListingComponent extends BaseListingComponent<Referenc
|
|||
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<ReferenceType>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-TYPE-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -20,6 +20,14 @@
|
|||
{{'REFERENCE-LISTING.FILTER.IS-ACTIVE' | translate}}
|
||||
</mat-slide-toggle>
|
||||
|
||||
<div>
|
||||
<mat-label>{{'REFERENCE-LISTING.FILTER.TYPE' | translate}}
|
||||
<mat-select multiple [(ngModel)]="internalFilters.types">
|
||||
<mat-option *ngFor="let referenceType of referenceTypeEnumValues" [value]="referenceType">{{enumUtils.toReferenceTypeString(referenceType)}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-label>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end align-items-center mt-4 gap-1-rem">
|
||||
<button mat-stroked-button color="primary" (click)="filterMenuTrigger?.closeMenu()">
|
||||
{{'REFERENCE-LISTING.FILTER.CANCEL' | translate}}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { TenantFilter } from '@app/core/query/tenant.lookup';
|
||||
import { ReferenceType } from '@app/core/common/enum/reference-type';
|
||||
import { ReferenceFilter } from '@app/core/query/reference.lookup';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
|
@ -12,8 +13,10 @@ import { nameof } from 'ts-simple-nameof';
|
|||
})
|
||||
export class ReferenceListingFiltersComponent extends BaseComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input() readonly filter: TenantFilter;
|
||||
@Output() filterChange = new EventEmitter<TenantFilter>();
|
||||
@Input() readonly filter: ReferenceFilter;
|
||||
@Output() filterChange = new EventEmitter<ReferenceFilter>();
|
||||
|
||||
referenceTypeEnumValues = this.enumUtils.getEnumValues<ReferenceType>(ReferenceType);
|
||||
|
||||
// * State
|
||||
internalFilters: ReferenceListingFilters = this._getEmptyFilters();
|
||||
|
@ -27,7 +30,7 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
const filterChange = changes[nameof<ReferenceListingFiltersComponent>(x => x.filter)]?.currentValue as TenantFilter;
|
||||
const filterChange = changes[nameof<ReferenceListingFiltersComponent>(x => x.filter)]?.currentValue as ReferenceFilter;
|
||||
if (filterChange) {
|
||||
this.updateFilters()
|
||||
}
|
||||
|
@ -45,25 +48,27 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
}
|
||||
|
||||
protected applyFilters(): void {
|
||||
const { isActive, like } = this.internalFilters ?? {}
|
||||
const { isActive, like, types } = this.internalFilters ?? {}
|
||||
this.filterChange.emit({
|
||||
...this.filter,
|
||||
like,
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive]
|
||||
isActive: isActive ? [IsActive.Active] : [IsActive.Inactive],
|
||||
types
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private _parseToInternalFilters(inputFilter: TenantFilter): ReferenceListingFilters {
|
||||
private _parseToInternalFilters(inputFilter: ReferenceFilter): ReferenceListingFilters {
|
||||
if (!inputFilter) {
|
||||
return this._getEmptyFilters();
|
||||
}
|
||||
|
||||
let { excludedIds, ids, isActive, like } = inputFilter;
|
||||
let { excludedIds, ids, isActive, like, types } = inputFilter;
|
||||
|
||||
return {
|
||||
isActive: (isActive ?? [])?.includes(IsActive.Active) || !isActive?.length,
|
||||
like: like
|
||||
like: like,
|
||||
types: types
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,6 +77,7 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
return {
|
||||
isActive: true,
|
||||
like: null,
|
||||
types: null
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,4 +97,5 @@ export class ReferenceListingFiltersComponent extends BaseComponent implements O
|
|||
interface ReferenceListingFilters {
|
||||
isActive: boolean;
|
||||
like: string;
|
||||
types: ReferenceType[];
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Observable } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { ReferenceTypePipe } from '@common/formatting/pipes/reference-type.pipe';
|
||||
|
||||
@Component({
|
||||
templateUrl: './REFERENCE-LISTING.component.html',
|
||||
|
@ -100,6 +102,7 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
|
|||
prop: nameof<Reference>(x => x.type),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-LISTING.FIELDS.TYPE',
|
||||
pipe: this.pipeService.getPipe<ReferenceTypePipe>(ReferenceTypePipe)
|
||||
},
|
||||
{
|
||||
prop: nameof<Reference>(x => x.createdAt),
|
||||
|
@ -113,6 +116,12 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
|
|||
languageName: 'REFERENCE-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<Reference>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -21,6 +21,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||
import { Observable } from 'rxjs';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
|
||||
@Component({
|
||||
templateUrl: './tenant-listing.component.html',
|
||||
|
@ -94,7 +95,6 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
|
|||
prop: nameof<Tenant>(x => x.code),
|
||||
sortable: true,
|
||||
languageName: 'TENANT-LISTING.FIELDS.CODE',
|
||||
//cellTemplate: this.TenantStatus
|
||||
},
|
||||
{
|
||||
prop: nameof<Tenant>(x => x.createdAt),
|
||||
|
@ -108,6 +108,12 @@ export class TenantListingComponent extends BaseListingComponent<Tenant, TenantL
|
|||
languageName: 'TENANT-LISTING.FIELDS.UPDATED-AT',
|
||||
pipe: this.pipeService.getPipe<DataTableDateTimeFormatPipe>(DataTableDateTimeFormatPipe).withFormat('short')
|
||||
},
|
||||
{
|
||||
prop: nameof<Tenant>(x => x.isActive),
|
||||
sortable: true,
|
||||
languageName: 'TENANT-LISTING.FIELDS.IS-ACTIVE',
|
||||
pipe: this.pipeService.getPipe<IsActiveTypePipe>(IsActiveTypePipe)
|
||||
},
|
||||
{
|
||||
alwaysShown: true,
|
||||
cellTemplate: this.actions,
|
||||
|
|
|
@ -1006,11 +1006,13 @@
|
|||
"STATUS": "Status",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created",
|
||||
"PUBLISHED-AT": "Published"
|
||||
"PUBLISHED-AT": "Published",
|
||||
"IS-ACTIVE":"Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
"IS-ACTIVE": "Is Active",
|
||||
"STATUS": "Status",
|
||||
"CANCEL": "Cancel",
|
||||
"APPLY-FILTERS": "Apply filters"
|
||||
},
|
||||
|
@ -1046,11 +1048,13 @@
|
|||
"NAME": "Name",
|
||||
"STATUS": "Status",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
"IS-ACTIVE": "Is Active",
|
||||
"STATUS": "Status",
|
||||
"CANCEL": "Cancel",
|
||||
"APPLY-FILTERS": "Apply filters"
|
||||
},
|
||||
|
@ -1073,7 +1077,8 @@
|
|||
"NAME": "Name",
|
||||
"CODE": "Code",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
|
@ -1100,7 +1105,8 @@
|
|||
"NAME": "Name",
|
||||
"CODE": "Code",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
|
@ -1128,11 +1134,13 @@
|
|||
"SOURCE": "Source",
|
||||
"TYPE": "Type",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
"IS-ACTIVE": "Is Active",
|
||||
"TYPE": "Type",
|
||||
"CANCEL": "Cancel",
|
||||
"APPLY-FILTERS": "Apply filters"
|
||||
},
|
||||
|
@ -1154,7 +1162,8 @@
|
|||
"FIELDS": {
|
||||
"CODE": "Code",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
|
@ -1587,11 +1596,13 @@
|
|||
"STATUS": "Status",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created",
|
||||
"PUBLISHED-AT": "Published"
|
||||
"PUBLISHED-AT": "Published",
|
||||
"IS-ACTIVE":"Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
"IS-ACTIVE": "Is Active",
|
||||
"STATUS": "Status",
|
||||
"CANCEL": "Cancel",
|
||||
"APPLY-FILTERS": "Apply filters"
|
||||
},
|
||||
|
@ -1797,11 +1808,13 @@
|
|||
"ROLES": "Roles",
|
||||
"NAME": "Name",
|
||||
"UPDATED-AT": "Updated",
|
||||
"CREATED-AT": "Created"
|
||||
"CREATED-AT": "Created",
|
||||
"IS-ACTIVE": "Is Active"
|
||||
},
|
||||
"FILTER": {
|
||||
"TITLE": "Filters",
|
||||
"IS-ACTIVE": "Is Active",
|
||||
"ROLES": "Roles",
|
||||
"CANCEL": "Cancel",
|
||||
"APPLY-FILTERS": "Apply filters"
|
||||
},
|
||||
|
@ -1818,6 +1831,10 @@
|
|||
"MANAGER": "Manager",
|
||||
"DESCRIPTION-TEMPLATE-EDITOR": "Description Template Editor"
|
||||
},
|
||||
"IS-ACTIVE":{
|
||||
"ACTIVE":"Active",
|
||||
"INACTIVE":"Inactive"
|
||||
},
|
||||
"DMP-PROFILE-FIELD": {
|
||||
"DATA-TYPE": {
|
||||
"DATE": "Date",
|
||||
|
|
|
@ -5,6 +5,7 @@ import { DataTableDateOnlyFormatPipe, DateOnlyPipe } from '@common/formatting/pi
|
|||
import { DataTableDateTimeFormatPipe, DateTimeFormatPipe } from '@common/formatting/pipes/date-time-format.pipe';
|
||||
import { LowercaseFirstLetterPipe } from '@common/formatting/pipes/lowercase-first-letter.pipe';
|
||||
import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
||||
import { ReferenceTypePipe } from './pipes/reference-type.pipe';
|
||||
|
||||
//
|
||||
//
|
||||
|
@ -21,7 +22,8 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
|||
ArrayToStringPipe,
|
||||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe
|
||||
|
||||
],
|
||||
exports: [
|
||||
|
@ -33,7 +35,8 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
|||
ArrayToStringPipe,
|
||||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe
|
||||
],
|
||||
providers: [
|
||||
DateFormatPipe,
|
||||
|
@ -44,7 +47,8 @@ import { IsActiveTypePipe } from './pipes/is-active-type.pipe';
|
|||
ArrayToStringPipe,
|
||||
DateOnlyPipe,
|
||||
DataTableDateOnlyFormatPipe,
|
||||
IsActiveTypePipe
|
||||
IsActiveTypePipe,
|
||||
ReferenceTypePipe
|
||||
]
|
||||
})
|
||||
export class CommonFormattingModule { }
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
||||
@Pipe({ name: 'AppRoleTypeFormat' })
|
||||
export class AppRoleTypePipe implements PipeTransform {
|
||||
constructor(private enumUtils: EnumUtils) { }
|
||||
|
||||
public transform(value): any {
|
||||
return this.enumUtils.toAppRoleString(value);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
|
||||
|
||||
@Pipe({ name: 'ReferenceTypeFormat' })
|
||||
export class ReferenceTypePipe implements PipeTransform {
|
||||
constructor(private enumUtils: EnumUtils) { }
|
||||
|
||||
public transform(value): any {
|
||||
return this.enumUtils.toReferenceTypeString(value);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue