callTransactionDetailsApi method

Future<void> callTransactionDetailsApi(
  1. CollectStockHistoryContentModel data,
  2. String transactionId, {
  3. required String status,
  4. String? name,
  5. String? userId,
})

Implementation

Future<void> callTransactionDetailsApi(
  CollectStockHistoryContentModel data,
  String transactionId, {
  required String status,
  String? name,
  String? userId,
}) async {
  BuildContext context = Get.context!;

  Helper.progressDialog(context, "Please wait..");

  try {
    CollectStockHistoryDetailsModel model =
        await ApiClient(baseUrl: ApiConstant.posBFF)
            .getCollectStockHistoryProducts(
                assetsTransactionId: transactionId,
                limit: "10",
                offset: "0",
                type: "SCAN_IN",
                xUserId: storage.read("XUSER_ID"));
    Get.back();
    if (model.status == "POS200") {
      transactionDetailsList = model.data!.list ?? [];
      searchedDetailsList.value = transactionDetailsList;
      Get.to(
        () => CollectStockHistoryTransactionDetails(
          transactionId: transactionId,
          date: data.createdDate,
          status: status,
          name: name,
          userId: userId,
        ),
      );
    } else {
      if (model.errors != null) {
        Helper.messageDialog(
            Get.context!,
            model.errors![0].code ?? "Try again!!",
            model.errors![0].description ?? "Something went wrong");
      }
    }
  } catch (err, stacktrace) {
    print(stacktrace);
    Helper.messageDialog(Get.context!, "Try Again!!", err.toString());
  }
}