Skip to content

Commit

Permalink
Merge pull request #150 from GOKULRAJ136/branch-1
Browse files Browse the repository at this point in the history
MOSIP-26354 : PMP UI: All active policies should be display in Policy group dropdown
  • Loading branch information
aranaravi authored Feb 5, 2024
2 parents 95f5526 + e7b6e2d commit 9fd333e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@
placeholder="{{ field.label[primaryLang] }}"
required
>
<input placeholder="Search..." matInput type="text" (keyup)="onKey($event.target.value)" class="search-input" >
<mat-option
*ngFor="let data of dropDownValues[field.name]"
*ngFor="let data of searchResult"
(onSelectionChange)="
captureDropDownValue($event, field.name, 'primary')
"
[id]="data.fieldCode"
[value]="data.fieldCode"
panelMaxHeight="500px"
[id]="data.fieldValue"
[value]="data.fieldValue"
>
{{ data.fieldValue }}
{{ data.fieldCode }}
</mat-option>
</mat-select>
</mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ mat-form-field{

.mat-card-content>:first-child {
margin-top: 14px;
}

.search-input {
height: 35px;
width: 50px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class MaterDataCommonBodyComponent implements OnInit {
disableForms: boolean;
copyPrimaryWord: any;
copySecondaryWord: any;
searchResult: any[] = [];

@Input() primaryData: any = {};
@Input() secondaryData: any;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -456,16 +457,27 @@ 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";
let request = new RequestModel('', null, filterRequest);
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);
});
}

Expand Down

0 comments on commit 9fd333e

Please sign in to comment.