teleconsultationRescheduleOrder method

dynamic teleconsultationRescheduleOrder({
  1. dynamic orderId,
  2. dynamic appointmentDate,
  3. dynamic appointmentTime,
  4. dynamic context,
})

Implementation

teleconsultationRescheduleOrder(
    {orderId, appointmentDate, appointmentTime, context}) async {
  var decodedResponse;
  final ApiBody = {
    "appointment_date": '$appointmentDate',
    "appointment_time": '$appointmentTime',
    "is_reshduled": '1',
  };

  http.Response response = await http.post(
      Uri.parse(
          '${WELLNESS_URL}api/teleconsultation/consultations/edit/$orderId'),
      headers: {
        'Authorization': currentUserToken,
      },
      body: ApiBody);
  decodedResponse = json.decode(response.body);
  Get.back();

  if (decodedResponse['success'] == true) {
    showDialog(
        context: context,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return MedicinePaymentSuccessPopup(
            fromPage: 'cancel_medicine',
            message: "${decodedResponse['message']}",
            image: "${FolderPath}Cancel_Order_Icon.svg",
            ontap: () {
              Get.off(MyOrders(
                fromScreen: 'teleconsultation',
              ));
              Get.to(TeleconsultationOrderDetails(Order_Id: "${orderId}"),
                  transition: Transition.noTransition,
                  preventDuplicates: false);
            },
          );
        });
  } else {
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}