- make second display to be responsive
This commit is contained in:
aungthetkhaing
2025-05-26 18:07:55 +06:30
parent da6a80a9bb
commit 613cb3a0cb
6 changed files with 320 additions and 83 deletions

View File

@@ -48,6 +48,10 @@
<% end %>
<div class="row clearfix h-100">
<% if @error %>
<input type="hidden" name="error_message" id="error_message" value="<%= json_escape(@error.to_json) %>">
<% end %>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 d-flex flex-column h-100">
<div class="card h-100" style="margin-bottom: 15px">
<div class="card-header m-l-5 m-r-5">
@@ -248,8 +252,12 @@
document.addEventListener('DOMContentLoaded', function() {
const paymentWaiting = document.querySelector('.payment-waiting');
let amountToReceive = <%= number_with_precision(@sale_data.grand_total, precision: precision.to_i) %>;
let receipt_no = document.querySelector('#receipt_no').textContent;
console.log(receipt_no);
const ws = new WebSocket("wss://juicecorner-0mo.sx-fc.app/cable");
ws.onopen = () => {
console.log("Nagato channel connected");
@@ -277,16 +285,6 @@
<p>Amount Received: ${amountToReceive}</p>
</div>
`;
ws.close();
// fetch('/foodcourt/qrpay/process_payment', {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content,
// },
// body: JSON.stringify({ sale_id: "SAL-0qg000000671" })
// })
fetch('/foodcourt/qrpay/process_payment', {
method: 'POST',
@@ -298,7 +296,7 @@
}).then((res) => res.json())
.then((data) => {
if(data.status) {
customer_display_view(null, "reload");
customer_display_view({msg: "Payment Successful", paid_amount: amountToReceive,receipt_no:receipt_no}, "pay_success");
setTimeout(() => {
window.location.href = "/";
}, 3000)
@@ -317,6 +315,8 @@
function customer_display_view(data, status) {
let url = '/foodcourt/customer_view';
console.log(data);
$.ajax({
type: "POST",
url: url,