getCpmDropDown method
dynamic
getCpmDropDown(
{ - String? parentId,
- required int dropDownMasterId,
})
Implementation
getCpmDropDown({String? parentId, required int dropDownMasterId}) async {
String requestTime = "";
String responseTime = "";
await ApiClient(
baseUrl: ApiConstant.baseUrl,
onFetchRequestTime: (time) {
requestTime = time;
},
onFetchResponseTime: (time) {
responseTime = time;
},
screenName: "customerManagement",
)
.cpmDropDown(
parentId: parentId,
dropDownMasterId: dropDownMasterId,
xUserId: SecureStorageService.readSecureData(
SecureStorageService.xUserId,
) ??
"",
)
.then((value) {
Helper.logEvent(
"RESPONSE_EVENT",
success: true,
endPoint: Api.cpmDropdown,
responseDate: responseTime,
screenName: "customerManagement",
requestDate: requestTime,
);
if (value.content != null && value.content!.isNotEmpty) {
if (dropDownMasterId == 11005) {
for (var element in value.content!) {
if (element.dropDownId == "approvalStatus") {
var dropDownValue = element.dropDownValue;
if (dropDownValue != null && dropDownValue.isNotEmpty) {
approvalStatusList =
dropDownValue.split(',').map((e) => int.parse(e)).toList();
}
}
}
} else if (dropDownMasterId == 6001) {
stateDropdowns.clear();
stateDropdowns.addAll(value.content?.toList() ?? []);
// for(var state in stateDropdowns){
// if()
// }
} else if (dropDownMasterId == 6002) {
cityDropdowns.clear();
cityDropdowns.addAll(value.content?.toList() ?? []);
} else if (dropDownMasterId == 9004) {
orderTypeList.clear();
orderTypeList.addAll(value.content?.toList() ?? []);
} else if (dropDownMasterId == 3001) {
warehouseLocationTypeDropdowns.clear();
warehouseLocationTypeDropdowns.addAll(value.content?.toList() ?? []);
} else if (dropDownMasterId == 7008) {
warehouseRestrictionDropdowns.clear();
warehouseRestrictionDropdowns.addAll(value.content?.toList() ?? []);
}
}
}).catchError((err) {});
}