cancel qr pay action
This commit is contained in:
@@ -199,6 +199,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-5 d-flex flex-column h-100" style="padding-right: 10px;">
|
||||
|
||||
<div class="card-block">
|
||||
<div class="payment-waiting text-center" style="height: 400px; display: flex; flex-direction: column; justify-content: center; align-items: center;">
|
||||
<h3 class="m-t-20" style="color: #555;">Waiting for Customer Payment</h3>
|
||||
@@ -209,32 +210,14 @@
|
||||
<div class="processing-dot"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<button class="btn btn-block btn-default waves-effect" id="cancel-btn">Cancel</button>
|
||||
</div>
|
||||
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
|
||||
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
|
||||
<%= link_to '/foodcourt/app_orders', class: 'btn btn-block btn-default waves-effect', :id => 'foodcourt_back', style: "padding-top: 0;" do%>
|
||||
<i class="material-icons">reply</i>
|
||||
BACK
|
||||
<% end %>
|
||||
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||
Refresh
|
||||
</button>
|
||||
<% if @sale_payment.nil? %>
|
||||
<hr>
|
||||
<% if current_login_employee.role == "cashier" %>
|
||||
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
|
||||
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
|
||||
<% else %>
|
||||
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||
<% end %>
|
||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||
<%end %>
|
||||
</div>
|
||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||
</div>
|
||||
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||
@@ -286,5 +269,26 @@
|
||||
|
||||
// Start checking payment status
|
||||
checkPaymentStatus();
|
||||
}
|
||||
|
||||
document.querySelector('#cancel-btn').addEventListener('click', function(e) {
|
||||
const data = {
|
||||
sale_id: "<%= @sale_data.sale_id %>",
|
||||
};
|
||||
|
||||
fetch('/foodcourt/qrpay/cancel', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content,
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
}).then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(data) {
|
||||
if(data.status) {
|
||||
window.location.href = "/"
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user