approvalScanInOrder method

void approvalScanInOrder({
  1. required BuildContext context,
  2. required String transactionId,
  3. required String status,
  4. String? remarks,
})

Implementation

void approvalScanInOrder({
  required BuildContext context,
  required String transactionId,
  required String status,
  String? remarks,
}) {
  String requestTime = "";
  String responseTime = "";
  ApiClient(
    baseUrl: ApiConstant.posBFF,
    onFetchRequestTime: (time) {
      requestTime = time;
    },
    onFetchResponseTime: (time) {
      responseTime = time;
    },
    screenName: "collectStockHistoryDetails",
  )
      .pendingProductsApproval(
    type: "SCAN_IN",
    assetsTransactionId: transactionId,
    status: status,
    remarks: remarks,
  )
      .then((value) {
    Helper.logEvent(
      "RESPONSE_EVENT",
      success: true,
      endPoint: "${Api.collectHistoryPending}/SCAN_IN/action:approval",
      responseDate: responseTime,
      screenName: "collectStockHistoryDetails",
      requestDate: requestTime,
    );
    if (value.status == "POS200") {
      Get.back();
      // if (status == "APPROVED") {
      //   Get.to(
      //     () => CollectStockAccepted(
      //       transactionId: transactionId,
      //       date: Helper.fromTimeStamptoDateTime(value.timeStamp ?? 0),
      //     ),
      //   );
      // } else {
      //   Get.to(
      //     () => CollectStockRejected(
      //       transactionId: transactionId,
      //       date: Helper.fromTimeStamptoDateTime(value.timeStamp ?? 0),
      //     ),
      //   );
      // }
    } else {
      Helper.messageDialog(
        Get.context!,
        value.errors?[0].code ?? "Try again!!",
        value.errors?[0].description ?? "Something went wrong",
      );
    }
  }).catchError((onError) {
    MainController mainController = Get.put(MainController());
    mainController.showErrorPopup();
  });
}