fix modal

This commit is contained in:
aungthetkhaing
2025-06-03 14:00:18 +06:30
parent ef0629bf31
commit 5b374dc48f
3 changed files with 1904 additions and 1465 deletions

View File

@@ -1,20 +1,4 @@
<<<<<<< Updated upstream
<div class="modal fade" id="read_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
<div class="modal-dialog read-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" id="defaultModalLabel" style="color:#fff;">Customer Detail</h4>
</div>
<div class="modal-body">
<p style="text-align: center; font-weight: bolder; color: black; font-size: larger">Please tap NFC Card or Scan Code</p>
<div style="text-align: center;">
<img src="/image/nfc.png" style="height: 200px"><br>
</div>
</div>
<div class="modal-footer" style="justify-content: center;">
<button type="button" class="btn btn-danger" id="close" >Cancel</button>
</div>
=======
<style>
/* Base Styling */
.payment-modal {
@@ -23,11 +7,6 @@
box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
#read_modal{
pointer-events: auto;
zindex: 1000;
}
.payment-header {
background: #f8fbfc;
padding: 1.5rem;
@@ -163,7 +142,27 @@
}
</style>
<div class="modal fade payment-modal" id="read_modal" role="dialog">
<div class="modal fade" id="read_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" >
<div class="modal-dialog read-dialog" role="document">
<div class="modal-content">
<div class="modal-header" style="background-color: #54A5AF;padding-top:10px !important;">
<h4 class="modal-title" id="defaultModalLabel" style="color:#fff;">Customer Detail</h4>
</div>
<div class="modal-body">
<p style="text-align: center; font-weight: bolder; color: black; font-size: larger">Please tap NFC Card or Scan Code</p>
<div style="text-align: center;">
<img src="/image/barcode.png" style="height: 200px">
<img src="/image/nfc.png" style="height: 200px"><br>
</div>
</div>
<div class="modal-footer" style="justify-content: center;">
<button type="button" class="btn btn-danger" id="close" >Cancel</button>
</div>
</div>
</div>
</div>
<div class="modal fade payment-modal" id="payment_modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="payment-header">
@@ -179,87 +178,94 @@
<div class="text-center text-bold text-muted">
(Or)
>>>>>>> Stashed changes
</div>
<!-- Read NFC Card -->
<button type="button" id="read_nfc" data-toggle="modal" data-target="#read_modal">
<div class="payment-card disabled" id="read_nfc" style="grid-column: span 2;">
<div class="payment-icon text-center">
<img src="/image/nfc.png" width="100" height="100" />
</div>
<div class="payment-label text-center">Tap your NFC-enabled card or device</div>
</div>
</button>
</div>
<div class="modal-footer">
<button type="button" class="btn-cancel" id="close">
Cancel
</button>
</div>
</div>
</div>
</div>
<style>
#read_modal {
text-align: center;
padding: 0!important;
}
<script defer type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
const paymentCards = document.querySelectorAll('.payment-card:not(.disabled)');
const cancelButton = document.querySelector('.btn-cancel');
#read_modal:before {
display: inline-block;
vertical-align: middle;
content: " ";
height: 100%;
}
$("#read_nfc").on('click', function() {
$('#payment_modal').css('display', 'none');
$('.modal-backdrop.fade').css('display', 'none');
});
.read-dialog {
display: inline-block;
text-align: left;
vertical-align: middle;
}
</style>
<script>
$('#mmqr').click(function() {
// alert("MMQR");
cancelButton.addEventListener('click', function () {
console.log("Action: Cancel payment.");
const paymentMethod = 'MMQR';
const $serverMode = $('#server_mode');
const $createOrderBtn = $('#create_order');
const $createPayOrderBtn = $('#create_pay_order');
paymentCards.forEach(c => c.classList.remove('active'));
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",
};
styleProceedButton(false);
});
$.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 disabledNfcCard = document.querySelector('.payment-card.disabled');
const errorMsg = xhr.status ? `Status: ${xhr.status} - ${xhr.statusText}` : "Network error";
swal("Error", errorMsg, "error");
document.querySelector('.payment-card#dynamic_qr').addEventListener('click', function() {
initDynamicQrPay();
});
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);
// function get_order_item_rows(){
// var order_items = [];
// var item_row = $('.summary-items tbody tr');
// $(item_row).each(function(i){
// var order_item = {};
// // order_item.item_name = $(item_row[i]).attr('data-item-name');
// order_item.item_instance_code = $(item_row[i]).attr('data-instance-code');
// order_items.push(order_item);
// });
// return order_items;
// }
const errorMsg = xhr.status ? `Status: ${xhr.status} - ${xhr.statusText}` : "Network error";
swal("Error", errorMsg, "error");
}
});
}
});
</script>