From 035e48639ba20bd32007758816ace396dcb6dc10 Mon Sep 17 00:00:00 2001 From: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:37:41 +0530 Subject: [PATCH] MOSIP-26354 : PMP UI: All active policies should be display in Policy group dropdown Signed-off-by: GOKULRAJ136 <110164849+GOKULRAJ136@users.noreply.github.com> --- .../mater-data-common-body.component.html | 9 +++++--- .../mater-data-common-body.component.scss | 5 +++++ .../mater-data-common-body.component.ts | 22 ++++++++++++++----- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.html b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.html index 4364ee721..e9d684f41 100644 --- a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.html +++ b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.html @@ -49,14 +49,17 @@ placeholder="{{ field.label[primaryLang] }}" required > + - {{ data.fieldValue }} + {{ data.fieldCode }} diff --git a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.scss b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.scss index 8301a6f7b..f6a57f3f5 100644 --- a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.scss +++ b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.scss @@ -9,4 +9,9 @@ mat-form-field{ .mat-card-content>:first-child { margin-top: 14px; +} + +.search-input { + height: 35px; + width: 50px; } \ No newline at end of file diff --git a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.ts b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.ts index a4c85523d..0490f37b9 100644 --- a/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.ts +++ b/pmp-ui/src/app/features/resources/shared/mater-data-common-body/mater-data-common-body.component.ts @@ -44,6 +44,7 @@ export class MaterDataCommonBodyComponent implements OnInit { disableForms: boolean; copyPrimaryWord: any; copySecondaryWord: any; + searchResult: any[] = []; @Input() primaryData: any = {}; @Input() secondaryData: any; @@ -131,12 +132,12 @@ export class MaterDataCommonBodyComponent implements OnInit { else if(url === "datasharepolicy"){ this.pageName = "Data Share Policy"; this.primaryData = {"name": "", "desc": "", "policies": "", "policyGroupName": "", "policyType": "DataShare", "version": "1.1"}; - this.getPolicyGroup("policyGroupName"); + this.getPolicyGroup(); } else if(url === "authpolicy"){ this.pageName = "Auth Policy"; this.primaryData = {"name": "", "desc": "", "policies": "", "policyGroupName": "", "policyType": "Auth", "version": "1.1"}; - this.getPolicyGroup("policyGroupName"); + this.getPolicyGroup(); } else if(url === "policymapping"){ this.pageName = "Map Policy"; @@ -456,8 +457,17 @@ export class MaterDataCommonBodyComponent implements OnInit { }); } - getPolicyGroup(key) { - const filterObject = new FilterValuesModel('name', 'unique', ''); + onKey(value) { + this.searchResult = this.search(value); + } + + search(value: string) { + let filter = value.toLowerCase(); + return this.dropDownValues.partnerTypeCode.primary.filter(option => option.fieldCode.toLowerCase().startsWith(filter)); + } + + getPolicyGroup() { + const filterObject = new FilterValuesModel('id', 'unique', ''); let optinalFilterObject = new OptionalFilterValuesModel('isActive', 'equals', 'true'); let filterRequest = new FilterRequest([filterObject], this.primaryLang, [optinalFilterObject]); filterRequest["purpose"] = "REGISTRATION"; @@ -465,7 +475,9 @@ export class MaterDataCommonBodyComponent implements OnInit { this.dataStorageService .getFiltersForAllDropDown('policymanager/policies/group', request) .subscribe(response => { - this.dropDownValues[key] = response.response.filters; + if(response.response.filters) + this.searchResult = response.response.filters.sort((a, b) => (a.id && b.id) ? a.id.localeCompare(b.id) : 0); + this.dropDownValues.partnerTypeCode.primary = response.response.filters.sort((a, b) => (a.id && b.id) ? a.id.localeCompare(b.id) : 0); }); }