Untitled
unknown
plain_text
a year ago
1.8 kB
8
Indexable
const filterAuthOfferings = (value) => {
const selectedState = value;
let refTable = rfiUtil.getRefTableDataByCacheName(
ConstantKeys.REF_TABLE.CREATE_RFI_REF_TABLES,
);
let filteredOfferingData = [];
const privilegeData = AppContext.security.getProfile().profile;
console.log('privilegeData:', privilegeData);
//write the code to get all the uniques offering values from the privilegeData then use setFilteredOfferings to update the offering list
const matchedPrivileagedata = privilegeData.find(
(detail) => detail.state === selectedState,
);
filteredOfferingData = refTable.OFFERING.filter((offering) =>
matchedPrivileagedata.offering.includes(offering.CODE),
);
if (filteredOfferingData) {
setFilteredOfferings(filteredOfferingData);
}
//on change of requested as reset the vaue of offering and program to default value
setFilteredPrograms([]);
setFilteredCategory([]);
updateRFIRequest({
...rfiRequest,
offering: '',
category: [...ConstantKeys.DEFAULT_OPTION.CATEGORY],
programs: [...ConstantKeys.DEFAULT_OPTION.PROGRAM],
});
};
const filterProgramAndCategory = (value) => {
const selectedOffering = value;
const filteredProg = rfiUtil.getTableDataForOffering(
ConstantKeys.REF_TABLE_NAMES.PROGRAM,
selectedOffering,
);
setFilteredPrograms(filteredProg);
const filteredCategories = rfiUtil.getTableDataForOffering(
ConstantKeys.REF_TABLE_NAMES.CATEGORY,
selectedOffering,
);
setFilteredCategory(filteredCategories);
};Editor is loading...
Leave a Comment