Fix: update order in mmqr
This commit is contained in:
@@ -89,17 +89,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row p-l-5 p-r-5">
|
||||
<!-- <div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<strong>Customer :</strong>
|
||||
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
|
||||
<button type="button" class="btn bg-info waves-effect" id='customer_name' data-toggle="modal" data-target="#read_modal"><%= @sale_data&.customer.name%></button>
|
||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" value='<%=@sale_data&.customer.paypar_account_no%>' />
|
||||
<% else %>
|
||||
<input type="hidden" name="paypar_account_no" id="paypar_account_no" value='<%=@sale_data&.customer.paypar_account_no%>' />
|
||||
<span id="customer_name"><%= @sale_data&.customer.name%></span>
|
||||
<% end %>
|
||||
<span class="hidden" id="membership_id"><%= @sale_data&.customer.membership_id%></span>
|
||||
<span class="hidden" id="member_discount"><%= @member_discount%></span></div> -->
|
||||
|
||||
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Checkin Time : </strong> <%if !@checkin_time.nil?%><%= @checkin_time.strftime("%I:%M %p") %>
|
||||
<%end%></div>
|
||||
</div>
|
||||
|
||||
@@ -312,8 +312,27 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
create_type: "create_pay",
|
||||
};
|
||||
|
||||
modify_order = window.location.href.indexOf("modify_order");
|
||||
type = $("#link_type").val();
|
||||
if (modify_order !=-1) {
|
||||
var ajax_url = '/foodcourt/food_court/update_modify_order';
|
||||
var table_type = $('#table_type').text();
|
||||
var table_id = $('#table_id').text();
|
||||
var customer_id = $('#customer_id').text();
|
||||
var sale_id = $('#sale_id').text();
|
||||
}else{
|
||||
var ajax_url = '/foodcourt/addorders/create';
|
||||
}
|
||||
|
||||
var booking_id = $('#booking_id').text();
|
||||
if (booking_id.length > 0) {
|
||||
params.booking_id = booking_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '/foodcourt/addorders/create',
|
||||
url: ajax_url,
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
headers: {
|
||||
@@ -321,8 +340,15 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
},
|
||||
data: JSON.stringify(params),
|
||||
success: function(result) {
|
||||
const booking_id = result.booking_id;
|
||||
|
||||
if (!result.sale_id) {
|
||||
request_bill(0, function(saleId) {
|
||||
window.location.href = `/foodcourt/${saleId}/qrpay/precreate`;
|
||||
});
|
||||
}else{
|
||||
window.location.href = `/foodcourt/${result.sale_id}/qrpay/precreate`;
|
||||
}
|
||||
|
||||
if ($serverMode.val() !== "cloud" && $("#display_type").val() === "2") {
|
||||
// customer_display_view(null, "reload");
|
||||
}
|
||||
@@ -338,6 +364,30 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function request_bill(customer_id, callback){
|
||||
if (window.location.pathname.includes('foodcourt')) {
|
||||
const order_id = $('#order_id').val() || $('#save_order_id').val();
|
||||
const data = { 'customer_id': customer_id };
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/foodcourt/food_court/" + order_id + "/request_bill",
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if(data.status === true) {
|
||||
callback(data.sale_id); // ✅ return via callback
|
||||
} else {
|
||||
swal("Alert!", "Error!", "error");
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// function initDynamicQrPay() {
|
||||
// const paymentMethod = 'MMQR';
|
||||
// const $serverMode = $('#server_mode');
|
||||
|
||||
Reference in New Issue
Block a user