callSellthruHistoryAssetApi method
Future<void>
callSellthruHistoryAssetApi(
- String transferOrderId,
- String filterProductCode,
- int pageNo,
- BuildContext context, {
- String? query,
Implementation
Future<void> callSellthruHistoryAssetApi(
String transferOrderId,
String filterProductCode,
int pageNo,
BuildContext context, {
String? query,
}) async {
BuildContext context = Get.context!;
if (pageNo == 1) {
Helper.progressDialog(context, "Please wait..");
}
try {
String requestTime = "";
String responseTime = "";
StockDealerAssetModel model = await ApiClient(
baseUrl: ApiConstant.armBaseUrl,
onFetchRequestTime: (time) {
requestTime = time;
},
onFetchResponseTime: (time) {
responseTime = time;
},
screenName: "sellthruHistoryDetails",
).getSellthruAssetDetails(
pageNo: pageNo,
filterTransferOrderId: transferOrderId,
// filterPartnerID: storage.read("PARTNER_ID"),
xUserId: SecureStorageService.readSecureData(
SecureStorageService.xUserId,
),
productCode: filterProductCode,
filterSerialNumberLike: query,
);
Helper.logEvent(
"RESPONSE_EVENT",
success: true,
endPoint: Api.getAssetDetails,
responseDate: responseTime,
screenName: "sellthruHistoryDetails",
requestDate: requestTime,
);
if (model.status == true) {
if (model.data != null) {
if (pageNo == 1) {
Helper.close();
searchedSellThruAssetList.value = model.data!.content ?? [];
sellThruAssetList = searchedSellThruAssetList;
if (query == null) {
SellThruAssetsBottomSheet().sellThruAssetsModalBottomSheet(
context,
transferOrderId,
filterProductCode,
);
}
} else {
searchedSellThruAssetList.addAll(model.data!.content ?? []);
sellThruAssetList = searchedSellThruAssetList;
}
totalAssets = model.data!.totalElements ?? 0;
}
} else {
if (pageNo == 1) {
Helper.close();
}
if (model.errors != null) {
Helper.messageDialog(
Get.context!,
model.errors![0].errorCode ?? localization.translate("tryAgain"),
model.errors![0].errorDescription ??
localization.translate("technicalErrorMsg"),
);
} else {
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
}
}
isLoadingMore.value = false;
} catch (err, stacktrace) {
if (pageNo == 1) {
Helper.close();
}
isLoadingMore.value = false;
ConditionalLogs().customLog("$err");
ConditionalLogs().customLog("$stacktrace");
MainController mainController = Get.put(MainController());
mainController.showErrorPopup();
}
}