food court and Booking ID for order and receipt

This commit is contained in:
phyusin
2018-10-08 17:41:22 +06:30
parent 5535a5db81
commit 03fd7c79b8
44 changed files with 1155 additions and 378 deletions

View File

@@ -2,7 +2,7 @@
<%= javascript_include_tag 'addorder', 'data-turbolinks-track': 'reload' %>
<% type = request.path_info.include?('quick_service')%>
<% type = request.path_info.include?('quick_service') || request.path_info.include?('food_court')%>
<% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid " style="padding:0px 3px 0px 3px;">
@@ -11,6 +11,7 @@
</div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
<input type="hidden" name="link_type" id="link_type" value="<%= @cashier_type %>">
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
@@ -650,7 +651,7 @@
});
$('#pending_order').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami/'+'<%= @cashier_type %>'+'/pending_order';
});
$(document).on('click', '.menu_click', function(event){

View File

@@ -56,7 +56,7 @@
</div>
<script>
cashier_type = window.location.href.indexOf("quick_service");
cashier_type = '<%= @cashier_type %>';
console.log(cashier_type)
var payment_method = "";
@@ -83,19 +83,19 @@
url: "<%= origami_cash_ins_path %>",
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
success:function(result){
if (cashier_type == -1) {
window.location.href = '/origami';
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami';
}
}
});
})
$('#back').on('click',function(){
if (cashier_type == -1) {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service/pending_order';
}
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami';
}
})
</script>

View File

@@ -25,7 +25,7 @@
</div>
</div>
<script>
cashier_type = window.location.href.indexOf("quick_service");
cashier_type = '<%= @cashier_type %>';
$('#cash_out').on('click',function(){
var reference = $('#reference').val();
var remark = $('#remark').val();
@@ -34,22 +34,20 @@
url: "<%= origami_cash_outs_path %>",
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
success:function(result){
if (cashier_type == -1) {
window.location.href = '/origami';
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami';
}
}
});
})
$('#back').on('click',function(){
cashier_type = window.location.href.indexOf("quick_service");
if (cashier_type == -1) {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service/pending_order';
}
if (cashier_type == 'quick_service' || cashier_type == 'food_court') {
window.location.href = '/origami/'+cashier_type+'/pending_order';
}else{
window.location.href = '/origami';
}
})
</script>

View File

@@ -120,7 +120,7 @@
<input type="hidden" id="table_id" name="table_id" value="<%= @dining_facility.id %>" />
<input type="hidden" id="type" name="type" value="<%= @dining_facility.type %>" />
<input type="hidden" id="table_type" name="table_type" value="<%= @dining_facility.type %>" />
<% elsif @cashier_type == 'quick_service' %>
<% elsif @cashier_type == 'quick_service' || @cashier_type == "food_court" %>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<input type="hidden" id="type" name="type" value="<%= @cashier_type %>" />
<input type="hidden" id="page" name="page" value="<%= @page %>" />
@@ -643,7 +643,7 @@
<% if !@booking_order.nil? %>
booking_id = "<%= @booking_order.booking_id %>";
<% end %>
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
@@ -673,7 +673,7 @@
var id = $("#table_id").val();
var type = $("#table_type").val();
var sale_id = $("#sale_id").val();
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(page == "pending"){

View File

@@ -31,6 +31,16 @@
</div>
</div>
<% end %>
<% if @food_court == '1' %>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 fc_view">
<div class="info-box bg-pink">
<div class="icon" >
<i class="material-icons">arrow_forward</i>
</div>
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= @food_court_name %></div>
</div>
</div>
<% end %>
<% if @dinein_cashier == '1' %>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-10 cashier_view">
<div class="info-box bg-green">
@@ -242,6 +252,19 @@ $(function() {
window.location.href = '/origami/quick_service';
});
$(".fc_view").on('click', function() {
var display_type = '<%= @display_type %>';
if (display_type.length>0) {
display_type = '<%= @display_type %>';
}else{
display_type = null;
}
if ($('#server_mode').val() != "cloud" && display_type == 2) {
document.getElementById('second_view').click();
}
window.location.href = '/origami/food_court';
});
$(".order_reservation").on('click', function() {
window.location.href = '/origami/order_reservation';
});

View File

@@ -265,7 +265,7 @@ var cashier_type = "<%= @cashier_type %>";
var id = $("#table_id").text();
var type = $("#table_type").text();
var sale_id = $('#sale-id').text();
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
@@ -454,7 +454,7 @@ var cashier_type = "<%= @cashier_type %>";
title: "Information!",
text: result.status,
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -504,7 +504,7 @@ var cashier_type = "<%= @cashier_type %>";
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -531,7 +531,7 @@ var cashier_type = "<%= @cashier_type %>";
text: result.status,
type: "success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){
@@ -580,7 +580,7 @@ var cashier_type = "<%= @cashier_type %>";
confirmButtonText: 'OK',
confirmButtonColor: btn_color,
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){

View File

@@ -333,7 +333,7 @@
title: "Information!",
text: "Success",
}, function () {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if(result.table_type == "Table"){

View File

@@ -35,7 +35,7 @@
<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' %>
<% if @cashier_type == 'quick_service' || @cashier_type == 'food_court' %>
<button type="button" class="btn bg-info waves-effect" id='customer_name'><%= @sale_data.customer.name%></button>
<% else %>
<span id="customer_name"><%= @sale_data.customer.name%></span>
@@ -193,7 +193,7 @@
<%= number_with_precision(@cash, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
</div>
</div>
<% if @sale_payment.nil? %>
<% if @sale_payment.nil? && @cashier_type != "food_court" %>
<div class="row payment credit-color p-l-5 p-r-5" id="credit_payment" >
<div class="col-md-8">Credit</div>
<div class="col-md-4" id="credit"><%= number_with_precision(@credit, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %></div>
@@ -209,7 +209,7 @@
</div>
</div>
<% else %>
<div class="row payment other-payment-color" id="card_payment" >
<div class="row payment other-payment-color" id="card_payment" >
<div class="col-md-8">Other Payments</div>
<div class="col-md-4" id="other_payment_amount">
<%= number_with_precision(@other_payment, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
@@ -432,7 +432,7 @@
<% end %>
<% end %>
<% if @cashier_type=="quick_service" && @sale_payment.nil? %>
<% if (@cashier_type=="quick_service" || @cashier_type=="food_court") && @sale_payment.nil? %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
@@ -669,6 +669,32 @@
</div>
</div>
<!-- customer light box -->
<div class="modal fade" id="is_paymemberModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="is_paymemberModalLabel">Are you Member?</h1>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_paymal_qr_code">QR Code</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<script type="text/javascript">
// //control borwser back
window.location.hash="no-back-button";
@@ -681,6 +707,9 @@ var pdf_view = '<%=@pdf_view%>';
var trans_flag = <%= @trans_flag %>;
// console.log(pdf_view)
$(document).ready(function(){
<%if @cashier_type == "food_court" && @paymalcount == 0.0 %>
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
setHeaderBreadCrumb(_PAYMENTS_);
/* replace url type*/
@@ -743,7 +772,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami/table/'+ dining_id;
}else{
window.location.href = '/origami/quick_service/pending_order/'+sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/'+sale_id;
}
}
@@ -775,124 +804,130 @@ var trans_flag = <%= @trans_flag %>;
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
return false;
if(cashier_type != "food_court"){
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/"+url_param+"/others_payment";
return false;
}else{
<% if @paymalcount == 0.0 %>
$("#is_paymemberModal").modal({show : true, backdrop : false, keyboard : false});
<% end %>
}
});
$('#pay').click(function() {
sub_total = $('#sub-total').text();
member = $('#membership_id').text();
// console.log(member)
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Alipay Payment","warning");
}
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Gift Voucher","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
calculate_member_discount(sale_id,tax_type);
}
// $("#pdfModal").on('shown.bs.modal', function () {
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
/* check credit payment or not*/
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_cash_path %>";
}else{
var url = "<%= origami_payment_cash_path %>";
}
$.ajax({type: "POST",
url: url,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
}
}
});
}
if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning");
}else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Redeem Payment","warning");
}else if(parseInt(jQuery.inArray("VISA", payment_type)) != -1 && $('#visacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Visa Payment","warning");
}else if(parseInt(jQuery.inArray("JCB", payment_type)) != -1 && $('#jcbcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with jcb Payment","warning");
}
else if(parseInt(jQuery.inArray("Master", payment_type)) != -1 && $('#mastercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(parseInt(jQuery.inArray("Alipay", payment_type)) != -1 && $('#alipaycount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Alipay Payment","warning");
}
else if(parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 && $('#junctionpaycount').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with JUNCTIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Credit Payment","warning");
}else if(parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 && $('#paymalcount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Paymal Payment","warning");
}else if(parseInt(jQuery.inArray("DINGA", payment_type)) != -1 && $('#dingacount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Dinga Payment","warning");
}else if(parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1 && $('#giftvouchercount').text()== 0 && sub_total != 0.0 && member){
swal("Oops","Please Pay with Gift Voucher","warning");
}else{
$( "#loading_wrapper").show();
if($('#balance').text() > 0){
swal ( "Oops", "Insufficient Amount!" , "error" );
$("#loading_wrapper").hide();
}else{
$(this).off("click");
var sale_id = $('#sale_id').text();
// var item_row = $('.is_card');
// payment
var cash = $('#cash').text();
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
calculate_member_discount(sale_id,tax_type);
}
// $("#pdfModal").on('shown.bs.modal', function () {
// $('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
/* check credit payment or not*/
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_cash_path %>";
}else{
var url = "<%= origami_payment_cash_path %>";
}
$.ajax({type: "POST",
url: url,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
else{
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", pdfPath);
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)).toFixed(<%= precision %>));
<% else %>
$("#changed_amount").text('Changed amount ' + parseFloat($('#balance').text() * (-1)));
<% end %>
}
if (pdf_view == 1) {
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
print_receipt();
}
}
}
});
}
}
});
// $('#void').on('click',function () {
@@ -1160,8 +1195,10 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
window.location.href = '/origami/'+cashier_type;
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}else{
@@ -1195,10 +1232,12 @@ var trans_flag = <%= @trans_flag %>;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
}
}else {
window.location.href = '/origami/'+cashier_type;
if(cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
});
}
@@ -1213,7 +1252,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
@@ -1452,7 +1491,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
});
@@ -1497,7 +1536,7 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
}
}
@@ -1539,8 +1578,10 @@ var trans_flag = <%= @trans_flag %>;
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/quick_service';
customer_display_view(null,"reload");
window.location.href = '/origami/'+cashier_type;
if(cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}
@@ -1611,10 +1652,178 @@ var trans_flag = <%= @trans_flag %>;
/* customer light-box */
$("#customer_name").on("click",function(){
//start customer modal popup
if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((cashier_type=='quick_service' || cashier_type=='food_court') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
// if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
// }
}
});
// Read Card Reader
$(".btn_paymal_member").on('click', function(){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var customer_mamber_card_no = 0;
var payment_amount = parseFloat($("#grand_total").text());
$("#is_paymemberModal").hide();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if (customer_mamber_card_no == 0) {
customer_mamber_card_no = $("#membership_id").text() || 0;
}
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : customer_mamber_card_no, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:customer_mamber_card_no},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: data.message.toString(),
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
},100);
});
// QR Code Reader
$(".btn_paymal_qr_code").on('click', function(e){
$("#is_paymemberModal").hide();
var code = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
var payment_amount = parseFloat($("#grand_total").text());
setTimeout(function(){
code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
data: { account_no : code, amount : payment_amount, receipt_no : receipt_no},
dataType: "json",
success: function(data) {
if (data.status == true) {
var valid_amount = parseFloat(data.old_balance_amount) - parseFloat(data.reload_amount);
// $("#valid_amount").val((valid_amount > 0) ? parseFloat(valid_amount) : 0);
$.ajax({
type: "POST",
url: "<%=origami_payment_paymal_path%>",
data: {payment_amount:payment_amount,membership_id:0,sale_id:sale_id,transaction_ref:data.transaction_ref,account_no:code},
success: function(result){
if(result.status == true){
swal({
title: "Information!",
text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/"+cashier_type+"/payment";
});
}else{
swal({
title: 'Oops',
text: result.message,
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}else{
swal({
title: 'Oops',
text: 'Please Check Member',
type: 'warning',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type + "/payment";
});
}
}
});
}
},100);
});
</script>

View File

@@ -10,10 +10,11 @@
<li class="nav-item">
<a class="nav-link " data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<% if @cashier_type == "quick_service" %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
@@ -49,37 +50,39 @@
</div>
<!-- Credit Sale Panel -->
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
<% if @cashier_type == "quick_service" %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
</div>
<% end %>
<!-- Credit Sale Panel -->
</div>
</div>
@@ -303,17 +306,17 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
})
$('#reprint').on('click', function () {
var sale_id = $('#sale_id').val();
@@ -333,12 +336,12 @@ $(document).ready(function(){
});
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service/pending_order';
window.location.href = '/origami/'+cashier_type+'/pending_order';
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
@@ -364,11 +367,11 @@ $(document).ready(function(){
}
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
});
$('#void').on('click', function () {
@@ -397,7 +400,7 @@ $(document).ready(function(){
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
}
});
}

View File

@@ -10,9 +10,11 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<%if @cashier_type=='quick_service' %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<!-- Nav tabs - End -->
<div id="custom-slimscroll">
@@ -49,6 +51,7 @@
</div>
<!-- Credit Sales Panel -->
<%if @cashier_type=='quick_service' %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
@@ -80,6 +83,7 @@
</div>
</div>
</div>
<% end %>
<!-- Credit Sales Panel -->
</div>
</div>
@@ -112,39 +116,39 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
});
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
});
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
window.location.href = '/origami/sale/' + sale_id + "/"+cashier_type+"/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
});
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
});
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
});
});

View File

@@ -9,9 +9,11 @@
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#pending_order" role="tab">Pending</a>
</li>
<% if @cashier_type == "quick_service" %>
<li class="nav-item credit_items">
<a class="nav-link" data-toggle="tab" href="#credits" role="tab"><%= t :credits %></a>
</li>
<% end %>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
@@ -47,37 +49,39 @@
</div>
<!-- Credit Sale Panel -->
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
<% if @cashier_type == "quick_service" %>
<div class="tab-pane dining" id="credits" role="tabpanel">
<div class="card-block">
<div class="row m-t-10 m-l-10 clearfix">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<input type="text" name="filter" id="filter" onchange="getCreditData('quick_service');" style="height: 32px;" placeholder="Receipt No." class="form-control">
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<select class="form-control" id="sel_customer" name="sel_customer" placeholder="Select Customer" onchange="getCreditData('quick_service');">
<option value="">-- Select Customer --</option>
<% if !@customers.empty? %>
<% @customers.each do |cus| %>
<option value="<%= cus[0] %>"><%= cus[1] %></option>
<% end %>
<% end %>
</select>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
<div class="row clearfix m-t-20 m-l-10">
<table class="table table-responsive tbl_credit_lists">
<thead>
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t :customer %> <%= t("views.right_panel.detail.name") %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
</table>
</div>
</div>
</div>
<% end %>
<!-- Credit Sale Panel -->
</div>
</div>
@@ -244,40 +248,40 @@
<!-- script data for credit lists -->
<script>
var cashier_type = "quick_service";
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
getCreditSales("","",cashier_type); //credit sales script data binding
$(".sales").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/pending_order/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/pending_order/' + sale_id;
})
$(".completed").on('click',function(){
var sale_id = $(this).attr("data-id");
window.location.href = '/origami/quick_service/completed_sale/' + sale_id;
window.location.href = '/origami/'+cashier_type+'/completed_sale/' + sale_id;
})
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/sale/' + sale_id + "/quick_service/payment";
window.location.href = '/origami/sale/' + sale_id + "/"+cashier_type+"/payment";
});
$('#back').on('click', function () {
window.location.href = '/origami/quick_service';
window.location.href = '/origami/'+cashier_type;
});
$('#addorder').on('click', function () {
var table_id = "<%=@table_id%>";
var booking_id = "<%=@bookings.booking_id%>";
var sale_id = $("#sale_id").val();
if (table_id) {
window.location.href = '/origami/quick_service/modify_order/' + table_id+"/"+sale_id;
window.location.href = '/origami/'+cashier_type+'/modify_order/' + table_id+"/"+sale_id;
}else{
window.location.href = '/origami/quick_service/modify_order/'+ booking_id+"/" +sale_id;
window.location.href = '/origami/'+cashier_type+'/modify_order/'+ booking_id+"/" +sale_id;
}
});
// Bill Request
$('#request_bills').click(function () {
var order_id = $('#save_order_id').val();
var ajax_url = "../../../origami/" +order_id+ "/request_bills";
var ajax_url = "/origami/" +order_id+ "/request_bills";
console.log(ajax_url)
$.ajax({
type: "GET",
@@ -288,7 +292,7 @@ $(document).ready(function(){
swal("Information!", result.error_message);
}
else {
window.location.href = '/origami/sale/'+result.data+'/quick_service/payment';
window.location.href = '/origami/sale/'+result.data+'/'+cashier_type+'/payment';
}
}
});
@@ -352,7 +356,7 @@ $(document).ready(function(){
$('#close_cashier').on('click',function(e){
e.preventDefault(); // Prevent the href from redirecting directly
var linkURL = '/origami/shift/quick_service/close';
var linkURL = '/origami/shift/'+cashier_type+'/close';
occupied_count = $(this).data("count");
warnBeforeRedirect(linkURL,occupied_count);
});
@@ -385,11 +389,11 @@ $(document).ready(function(){
});
$('#cash_in').on('click',function(){
window.location.href = '/origami/quick_service/cash_ins';
window.location.href = '/origami/'+cashier_type+'/cash_ins';
})
$('#cash_out').on('click',function(){
window.location.href = '/origami/quick_service/cash_outs';
window.location.href = '/origami/'+cashier_type+'/cash_outs';
})
});
</script>

View File

@@ -321,7 +321,7 @@ var access_code = localStorage.getItem("access_code");
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
var sale_id = "<%= @saleobj.sale_id %>"
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;
@@ -350,7 +350,7 @@ var access_code = localStorage.getItem("access_code");
url: ajax_url,
data: 'sale_id=' + sale_id+'&type='+cashier_type,
success: function (result) {
if (cashier_type=="quick_service") {
if (cashier_type=="quick_service" || cashier_type=="food_court") {
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
window.location.href = '/origami/table/' + table_id;

View File

@@ -429,7 +429,7 @@ var cashier_type = "<%= @cashier_type %>";
var table_type = $('#table_type').val();
var table_id = $('#table_id').val();
if (cashier_type == "quick_service") {
if (cashier_type == "quick_service" || cashier_type == "food_court") {
window.location.href = '/origami/sale/<%= @id %>/<%= @cashier_type %>/payment/';
}else{
if(table_type == "Table"){