feat: qr payment flow update

This commit is contained in:
Pyae Bhone Zaw
2025-06-27 12:58:49 +06:30
committed by DevTeam
parent 4790309150
commit 3f926f7711
6 changed files with 1677 additions and 39 deletions

View File

@@ -292,10 +292,11 @@ document.addEventListener('DOMContentLoaded', function () {
setTimeout(function() {
document.getElementById('fullpage-loading').style.display = 'none';
}, 5000);
initDynamicQrPay();
precreateDynamicQrPay();
// initDynamicQrPay();
});
function initDynamicQrPay() {
function precreateDynamicQrPay() {
const paymentMethod = 'MMQR';
const $serverMode = $('#server_mode');
const $createOrderBtn = $('#create_order');
@@ -321,7 +322,7 @@ document.addEventListener('DOMContentLoaded', function () {
data: JSON.stringify(params),
success: function(result) {
const booking_id = result.booking_id;
window.location.href = `/foodcourt/${result.sale_id}/qrpay/init`;
window.location.href = `/foodcourt/${result.sale_id}/qrpay/precreate`;
if ($serverMode.val() !== "cloud" && $("#display_type").val() === "2") {
// customer_display_view(null, "reload");
}
@@ -336,5 +337,47 @@ document.addEventListener('DOMContentLoaded', function () {
}
});
}
// function initDynamicQrPay() {
// const paymentMethod = 'MMQR';
// const $serverMode = $('#server_mode');
// const $createOrderBtn = $('#create_order');
// const $createPayOrderBtn = $('#create_pay_order');
// const params = {
// order_source: "food_court",
// order_type: "dine_in",
// customer_id: $("#customer_id").text(),
// guest_info: "",
// table_id: $("#table_id").text(),
// order_items: JSON.stringify(get_order_item_rows()),
// create_type: "create_pay",
// };
// $.ajax({
// url: '/foodcourt/addorders/create',
// method: 'POST',
// contentType: 'application/json',
// headers: {
// 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
// },
// data: JSON.stringify(params),
// success: function(result) {
// const booking_id = result.booking_id;
// window.location.href = `/foodcourt/${result.sale_id}/qrpay/init`;
// if ($serverMode.val() !== "cloud" && $("#display_type").val() === "2") {
// // customer_display_view(null, "reload");
// }
// },
// error: function(xhr) {
// $('#oqs_loading_wrapper').hide();
// $createOrderBtn.prop('disabled', false);
// $createPayOrderBtn.prop('disabled', false);
// const errorMsg = xhr.status ? `Status: ${xhr.status} - ${xhr.statusText}` : "Network error";
// swal("Error", errorMsg, "error");
// }
// });
// }
});
</script>