Merge branch 'printservice_dev' into r-1902001-01

This commit is contained in:
Thein Lin Kyaw
2020-08-26 10:38:00 +06:30
41 changed files with 1441 additions and 1044 deletions

View File

@@ -1,6 +1,6 @@
<!-- Column One -->
<div class="row clearfix m-top-100" style="">
<div class="col-lg-7 col-md-7 col-sm-7">
<div class="col-lg-7 col-md-7 col-sm-7">
<p class="hidden filter"><%= @filter %></p>
<div class="card">
<div class="card-block">
@@ -20,7 +20,7 @@
<p class="hidden oqs-id"><%= qsi.id %></p>
<option value="<%= qsi.id %>" data-id="<%= qsi.id %>" <%=selected%> style="padding:5px 20px !important;"> <%= qsi.station_name %></option>
<% end %>
<% end %>
<% end %>
</select>
</div>
@@ -38,8 +38,8 @@
<div class="tab-content" id="custom-slimscroll" style="">
<div class="tab-pane in active" id="completed" role="tabpanel">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;column-count: ;">
<%
@queue_completed_item.each do |qid|
<%
@queue_completed_item.each do |qid|
%>
<div class="card queue_station" data-order-no="<%= qid.order_id %>">
<div class="card-block">
@@ -52,38 +52,38 @@
<span class="order-zone hidden font-13"><%= qid.zone %></span>
<span class="col-md-8"><small class="float-right font-13"><%= qid.order_id %></small></span>
</div>
</div>
<p class="m-b--10">
<span class="order-item font-16">
<%= qid.item_name %>
</span> [x
<span class="order-qty">
<%= qid.qty %>
</span> ]
</span> ]
<% if !qid.set_menu_items.nil? %>
<% qid.set_menu_items.each do |item_instance|%>
<br><span class="font-12">
<%= item_instance %>
</span>
<% end %>
<% end %>
</p>
<% end %>
</p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<br/><p class="card-text item-options"><%= qid.options == "[]"? "" : qid.options %></p>
<span class="card-text">
<span class="text-muted">Order at -
<span class="text-muted">Order at -
<span class="order-at font-13">
<%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %>
</span> <br>
</span> <br>
Order By - <span class="order-by font-13">
<%= qid.item_order_by %>
</span>
</span>
</span>
</span>
<p class="hidden order-status">completed</p>
<p class="hidden order-customer"><%= qid.customer_name %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
</div>
<% if !qid.delivery_status %>
<div class="card-footer">
@@ -91,11 +91,11 @@
<button id="assigned_queue_<%= qid.assigned_order_item_id %>" class="btn btn-primary order-item order-complete">COMPLETE</button>
</div>
<%end%>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
<div class="card-columns oqs_append" id="oqs_container" style="padding-top:10px; column-gap: 1.2rem;">
</div>
</div>
</div>
@@ -127,7 +127,7 @@
<td id="order-customer" colspan="2"></td>
</tr> -->
<!-- </tbody>
</table>
</table>
</div>
<div class="card-text" id="order-detail-slimscroll" style="min-height:; max-height:; overflow:">
<table class="table" id="oqs-order-details-table">
@@ -137,7 +137,7 @@
<th style="width:20%; text-align:right">QTY</th>
</tr>
</thead>
<tbody>
<tbody>
</tbody>
</table>
</div>
@@ -163,7 +163,7 @@
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= table.id %>" data-id="<%= table.id %>"> <%= table.name %> <br> <%= table.zone.name %></button>
</div>
<% end %>
<% end %>
</div>
<%if !@rooms.empty? %>
<div id="room" class="tab-pane fade">
@@ -171,21 +171,21 @@
<div class="col-lg-4 col-md-4 col-sm-4 table-float">
<button class='btn btn-lg waves-effect green tables table-width' value="<%= room.id %>" data-id="<%= room.id %>"> <%= room.name %> <br> <%= room.zone.name %></button>
</div>
<% end %>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<!-- <br> -->
<% if current_user.role != "kitchen" %>
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<%end%>
<%end%>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<!-- <button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
@@ -195,6 +195,8 @@
</div>
<input type="hidden" id="server_mode" value="<%=ENV["SERVER_MODE"]%>">
<%= print_settings %>
<script type="text/javascript">
$(document).on('turbolinks:load', function() {
$('#back').on('click', function () {
@@ -202,12 +204,10 @@
});
});
document.getElementById("defaultOpen").click();
</script>
<style type="text/css">
.oqs-btn {
padding: .46875rem 0.25rem;color: #fff !important;position: relative;margin-bottom: .3125rem;font-size: .875rem;text-decoration: none;text-transform: uppercase;letter-spacing: 0;cursor: pointer;border: 0;
}
</style>
</style>

View File

@@ -597,6 +597,8 @@
</div>
</div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -972,13 +974,15 @@
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
location.reload();
}
});
}
@@ -1003,80 +1007,82 @@
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
// type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
var sale_id = $('#sale_id').val();
// type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Card",tax_type);
}
}else{
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type);
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Card",tax_type);
}
}else{
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type);
}
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
location.reload();
}
});
location.reload();
}
});
});
function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
}else{
is_card = true
}
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false,
success:function(result){
}
});
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
} else {
is_card = true
}
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false,
success:function(result){
}
});
}
$('#pay').on('click', function () {
var sale_id = $('#sale_id').val();
var data_order = $(this).data("order");
if (data_order) {
swal({
title: "Alert! This Receipt has another item",
text: "Are you sure want to pay this receipt !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, Pay it !",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
});
}else{
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
var sale_id = $('#sale_id').val();
var data_order = $(this).data("order");
if (data_order) {
swal({
title: "Alert! This Receipt has another item",
text: "Are you sure want to pay this receipt !",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, Pay it !",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
});
} else {
window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
}
});
// $('#kbz_query').on('click', function(){
@@ -1105,33 +1111,33 @@
var current_checkin_induties_count =localStorage.getItem("current_checkin_induties_count");
localStorage.removeItem("current_checkin_induties_count");
if(order_id!=undefined && order_id!=null && order_id!=""){
if($('#request_bills').is(":visible")) {
if ($('#request_bills').is(":visible")) {
$('#request_bills').prop("disabled",true);
}
$.ajax({
type: "GET",
url: ajax_url,
data: {current_checkin_induties_count: current_checkin_induties_count},
success: function (result) {
if (!result.status) {
swal({
title: 'Oops',
text: result.error_message,
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
location.reload();
}
});
}
else {
type: "GET",
url: ajax_url,
data: {current_checkin_induties_count: current_checkin_induties_count},
success: function (result) {
if (!result.status) {
swal({
title: 'Oops',
text: result.error_message,
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function (isConfirm) {
if(isConfirm){
location.reload();
}
});
}
else {
location.reload();
}
}
});
}else{
swal("Opps","There is no orders!","warning");
@@ -1167,24 +1173,24 @@
// var tax_type = localStorage.getItem("tax_type");
var tax_type = $("#check_tax").val();
$.ajax({
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
$("#loading_wrapper").hide();
}
type: "POST",
url: ajax_url,
data: 'dining_id=' + dining_id + "&sale_id=" + sale_id + "&tax_type=" + tax_type,
success: function (result) {
swal({
title: "Information!",
text: "Invoice updated",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
$("#first_bill").removeAttr('disabled');
$("#pay").removeAttr('disabled');
window.location.reload();
});
$("#loading_wrapper").hide();
}
});
})
@@ -1269,13 +1275,15 @@
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
}
window.location.href = '/origami/';
window.location.href = '/origami/';
}
});
}
@@ -1378,13 +1386,15 @@
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) {
console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
}
window.location.href = '/origami/';
window.location.href = '/origami/';
}
});
}

View File

@@ -1,17 +1,17 @@
<%= stylesheet_link_tag 'order_reservation', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'order_reservation', 'data-turbolinks-track': 'reload' %>
<div class="container-fluid m-top-100">
<!-- start count function -->
<%
<%
pending_count = 0
accepted_count = 0
delivered_count = 0
completed_count = 0
processed_count = 0
%>
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
<% if !@count_on_order.nil?
@count_on_order.each do |count_order|
if count_order.status == "new"
pending_count = count_order.count
elsif count_order.status == "accepted"
accepted_count = count_order.count
@@ -19,16 +19,16 @@
delivered_count = count_order.count
elsif count_order.status == "ready_to_delivery"
completed_count = count_order.count
end
end
end
end
end
end
if !@count_on_completed.nil?
processed_count = @count_on_completed.count
end
%>
<!-- end count function -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<% if request.user_agent.include? "Mobile" %>
<div class="row m-t-10" style="margin-left: 0.2rem">
<% else %>
@@ -125,7 +125,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
@@ -179,7 +179,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="delivery" role="tabpanel">
@@ -232,7 +232,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--- Panel 3 - Orders -->
<div class="tab-pane dining" id="completed" role="tabpanel">
@@ -285,7 +285,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
<!--- Panel 5 - processed -->
<div class="tab-pane dining" id="processed" role="tabpanel">
@@ -338,7 +338,7 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@@ -350,7 +350,7 @@
<table class="table">
<tr>
<td width ="10%" class="header-td align-left">
<b class="col-pink font-16"><span id="sr_number"></span></b>
<b class="col-pink font-16"><span id="sr_number"></span></b>
</td>
<td width="40%" class="header-td align-left">
<b><span class="font-15" id="requested_date_time"></span></b>
@@ -378,7 +378,7 @@
<br><span class="font-13">2 <span class="col-blue">X700</span></span>
</td>
<td width ="30%" class="body-td align-right">1400.00</td>
</tr> -->
</tr> -->
</tbody>
</table>
</div>
@@ -388,7 +388,7 @@
<tbody>
<tr>
<td width ="70%" class="footer-td align-left" >
SUB TOTAL
SUB TOTAL
</td>
<td width ="30%" class="footer-td align-right" id="sub_total">0.00</td>
</tr>
@@ -419,19 +419,19 @@
</tbody>
</table>
</div>
</div>
</div>
</div>
<% if request.user_agent.include? "Mobile" %>
<div class="col-lg-3 col-md-3 col-sm-3" style="margin-right: 0.5rem">
<% else %>
<div class="col-lg-3 col-md-3 col-sm-3">
<% end %>
<div class="card m-b-5 p-t-5" style="background-color: #E8EAF6">
<div class="card-header custom-card-header" style="background-color: #E8EAF6">
<table class="table">
<tr>
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
<td class="header-td align-left col-blue">CUSTOMER & DELIVERY INFORMATION
</td>
</tr>
</table>
@@ -541,7 +541,7 @@
</button>
</td>
</tr>
<% if current_user.role != "waiter" %>
<tr class="order_close_cashier" style="display:none">
<td colspan="2" width="100%" class="footer-td align-right col-blue">
@@ -559,12 +559,16 @@
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_send_to_kitchen"></div>
<div id="<%= @shop.shop_code ? @shop.shop_code : '' %>_notify_order_ready_to_delivery"></div>
</div>
<p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p>
<p id="status" class="hidden"></p>
<%= print_settings %>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="modal fade" id="waiting_timeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
@@ -656,7 +660,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -675,12 +679,12 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="void">OK</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- pdf light box -->
<div class="modal fade" id="receiptpdfModal" tabindex="-1" role="dialog" >
@@ -696,13 +700,13 @@
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name">
<div class="text-center">
<div class="text-center">
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div>
</div>
<div class="modal-footer">
<button type="button" class="mr-2 m-t-5 btn-lg btn-block bg-red waves-effect print_receipt_pdf" id="print_receipt_pdf"> Print
</button>
</button>
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
CLOSE
</button>

View File

@@ -315,6 +315,9 @@
</div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
</div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -723,6 +726,7 @@ $(document).ready(function(){
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
success:function(result){
/* start delete receipt no in first bill*/
console.log(result);
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
var receipt_no = ($("#receipt_no").html()).trim();
deleteReceiptNoInFirstBillData(receipt_no);
@@ -737,33 +741,29 @@ $(document).ready(function(){
var msg = '';
}
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
$("#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(location.pathname.includes("credit_payment") || pdf_view != 1){
payment_success_alert();
}else{
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
} 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();
}
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}
$("#loading_wrapper").hide();
}
});
}
@@ -1007,6 +1007,7 @@ $(document).ready(function(){
if($('#pay').is(":visible")) {
$('#pay').prop("disabled",true);
}
$("#loading_wrapper" ).show();
var sale_id = $('#sale_id').text();
var filename = $("#filename").val();
@@ -1018,31 +1019,35 @@ $(document).ready(function(){
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
data: params,
success:function(result){
// For Server Print - from jade
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
if (pdf_view ==1) {
var flag = localStorage.getItem("trans_flag");
localStorage.removeItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = "/transactions/sales/"+sale_id;
if (pdf_view ==1) {
var flag = localStorage.getItem("trans_flag");
localStorage.removeItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = "/transactions/sales/"+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
window.location.href = '/origami/'+cashier_type;
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}else{
payment_success_alert();
}
}else{
payment_success_alert();
}
$("#loading_wrapper" ).hide();
}
});
}
@@ -1322,11 +1327,13 @@ $(document).ready(function(){
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}, function () {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
var flag = localStorage.getItem("trans_flag");
@@ -1339,7 +1346,7 @@ $(document).ready(function(){
window.location.href = '/origami/'+cashier_type;
}
}
});
});
}
}
});
@@ -1369,24 +1376,26 @@ $(document).ready(function(){
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {result
customer_display_view(null,"reload");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
}
}
}
})
}
}
var flag = localStorage.getItem("trans_flag");
if((flag!=null) && (flag != "true")){
window.location.href = '/transactions/sales/'+sale_id;
}else{
if (cashier_type=="cashier") {
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
}
}
}
})
}
});
});
@@ -1412,10 +1421,12 @@ $(document).ready(function(){
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
var flag = localStorage.getItem("trans_flag");

View File

@@ -17,7 +17,7 @@
<% end %>
</ul>
<div id="custom-slimscroll">
<div class="tab-content m-t-15">
<div class="tab-content m-t-15">
<div class="tab-pane active" id="completed" role="tabpanel">
<div class="card-columns">
<% @completed.each do |sale| %>
@@ -26,7 +26,7 @@
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
</div>
</div>
<% end %>
<% end %>
</div>
</div>
@@ -74,7 +74,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
@@ -97,7 +97,7 @@
</div>
<div class="card-block">
<div class="card-title row p-l-5 p-r-5">
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6">
&nbsp; Receipt No: <span id="receipt_no">
@@ -110,8 +110,8 @@
<%= @bookings.booking_orders[0].order_id rescue '' %></span>
</div>
<% end%>
<% if @status == 'sale' %>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> &nbsp; </span>
@@ -168,7 +168,7 @@
</tr>
<% end%>
<% end%>
</tbody>
</table>
</div>
@@ -211,7 +211,7 @@
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if current_user.role != "waiter" %>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_user.role == "cashier" %>
@@ -219,7 +219,7 @@
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% end %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
<% else %>
<% if @sale.payment_status != 'foc' %>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
@@ -234,6 +234,8 @@
</div>
</div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -252,7 +254,7 @@
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
@@ -265,7 +267,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -284,7 +286,7 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
@@ -326,9 +328,11 @@ $(document).ready(function(){
type: "GET",
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
@@ -338,7 +342,7 @@ $(document).ready(function(){
$('#back').on('click', function () {
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/'+cashier_type+'/close';
@@ -348,15 +352,15 @@ $(document).ready(function(){
function warnBeforeRedirect(linkURL,occupied_count) {
if (occupied_count>0) {
text = "<h5><span style=\"color: #CC0000\"> We have "+occupied_count+" pending orders and sales</span> </h5>.<br>Are you sure you want to close cashier? ";
}else{
text = "Are you sure you want to close cashier?";
}
swal({
title: "Alert!",
text: text,
title: "Alert!",
text: text,
type: "warning",
showCancelButton: true,
html: true
@@ -396,15 +400,17 @@ $(document).ready(function(){
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami/'+cashier_type;
}
});
}
});
});
}else{
swal("Opps","You are not authorized for void","warning")
}
@@ -437,9 +443,11 @@ function check_emp_access_code(access_code,type) {
type: "GET",
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();

View File

@@ -45,12 +45,12 @@
<div class="card-columns">
<% @tables.each do |table| %>
<% if table.status == 'occupied' %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -62,12 +62,12 @@
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
</div>
</div>
<% else %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -200,7 +200,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
@@ -356,9 +356,9 @@
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -368,8 +368,8 @@
</span>
<% end %>
<% end %>
</span>
<% end
</span>
<% end
sub_total += set_item_prices
end %>
</td>
@@ -463,9 +463,9 @@
<% end %>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
JSON.parse(order_item.set_menu_items).each do |item_instance|
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -475,8 +475,8 @@
</span>
<% end %>
<% end %>
</span>
<% end
</span>
<% end
sub_total += set_item_prices
end %>
</td>
@@ -489,7 +489,7 @@
%>
</table>
<button class='btn bg-primary btn-block' id='add_invoice'> Add to existing invoice </button>-->
<% end %>
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
@@ -522,7 +522,7 @@
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i> Back</button>
<button type="button" id="add_order" class="btn btn-block btn- bg-blue waves-effect">Add Order</button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect">Survey</button>
<% if @room.status != "available" %>
<% if @room.status != "available" %>
<% if @status_order == 'order' && @status_sale != 'sale' %>
<!-- <button type="button" class="btn bg-blue btn-block" >Add Order</button> -->
<!-- <button type="button" id="customer" class="btn bg-blue btn-block" disabled>Customer</button> -->
@@ -551,7 +551,7 @@
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
@@ -561,7 +561,7 @@
<% 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 bg-blue btn-block" >Charges</button>
<% if !@split_bill.nil? %>
<% if @split_bill == '1' && (!(@order_items.nil?) || !(@order_items.empty?)) %>
<button type="button" id="split_bills" class="btn btn-block bg-blue waves-effect">Split Bill</button>
@@ -592,7 +592,7 @@
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<button class='btn btn-md waves-effect btn-link payment-btn-box payment_btn bg-green' data-type='Credit' data-value='Credit'>Credit</button>
</div>
<% @payment_methods.each_with_index do |pay, pay_index| %>
<%if (pay_index+1)%3 == 0 %>
<div class="row clearfix"></div>
@@ -602,7 +602,7 @@
</div>
<%end %>
</div>
</div>
</div>
<div class="modal-footer p-r-30 pb-3">
<button type="button" class="btn btn-md btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
@@ -624,6 +624,8 @@
</div>
</div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -642,7 +644,7 @@
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
@@ -653,7 +655,7 @@
<div class="modal-header">
<h4 class="modal-title" id="waste_spoileModalLabel">Are you sure Waste or Spoile ?</h4>
</div>
<div class="modal-body">
<div class="modal-body">
<div class="row p-r-20">
<div class="col-md-3">
<button type="button" class="btn btn-lg bg-red waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')"><strong>Waste</strong></button>
@@ -679,7 +681,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -698,7 +700,7 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
@@ -730,7 +732,7 @@
count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
@@ -741,10 +743,10 @@
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
@@ -754,8 +756,8 @@
</span>
<% end %>
<% end %>
</span>
<% end
</span>
<% end
sub_total += set_item_prices
end %>
</td>
@@ -956,7 +958,7 @@ $(document).ready(function(){
} else {
var sale_id = "<%= @room.id %>";
}
//var table_id = $('.tables').attr("data-id");
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ "/surveys"
});
// bind customer to order or sale
@@ -1025,8 +1027,8 @@ $(document).ready(function(){
});
// click select option icon for add
$(document).on('click', '.payment_btn', function(event){
// click select option icon for add
$(document).on('click', '.payment_btn', function(event){
active = $(this).hasClass('selected-payment');
value = $(this).data('value');
type = $(this).data('type');
@@ -1041,7 +1043,7 @@ $(document).ready(function(){
}); //End selecct attribute buttom
// Print for first bill
$("#first_bill").on('click', function(){
$("#first_bill").on('click', function(){
swal({
title: "Alert",
@@ -1067,10 +1069,12 @@ $("#first_bill").on('click', function(){
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
@@ -1095,7 +1099,7 @@ $(".choose_payment").on('click', function () {
if(!location.pathname.includes("credit_payment")){
calculate_member_discount(sale_id,"Cash",tax_type);
}
}
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
@@ -1107,16 +1111,17 @@ $(".choose_payment").on('click', function () {
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
}
});
});
});
function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text();
@@ -1130,7 +1135,7 @@ $.ajax({
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false,
success:function(result){
success:function(result){
}
});
}
@@ -1142,11 +1147,11 @@ $('#pay').on('click',function() {
$.ajax({
type: "POST",
url: '/origami/sale/'+ sale_id + "/rounding_adj",
success:function(result){
success:function(result){
window.location.href = '/origami/sale/'+ sale_id + "/cashier/payment";
}
});
});
// Bill Request
$('#request_bills').click(function() {
@@ -1179,7 +1184,7 @@ $('#request_bills').click(function() {
}
});
}
else {
else {
location.reload();
}
}
@@ -1187,7 +1192,7 @@ $('#request_bills').click(function() {
}else{
swal("Opps","There is no orders!","warning");
}
});
//split bill process
@@ -1350,17 +1355,19 @@ $('#add_invoice').on('click',function(){
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
}
window.location.href = '/origami/';
window.location.href = '/origami/';
}
});
}
});
});
}else{
swal("Opps","You are not authorized for void","warning");
}
@@ -1442,17 +1449,19 @@ $('#add_invoice').on('click',function(){
data: "remark="+ remark + "&sale_id=" + sale_id,
success: function (result) {
console.log(result)
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
}
window.location.href = '/origami/';
window.location.href = '/origami/';
}
});
}
});
});
}
$(document).on('click', '.access_modal', function(event){
@@ -1490,7 +1499,7 @@ $('#add_invoice').on('click',function(){
});
}
/* check in process */
/* check in process */
$('#check_in').on('click',function(){
var room_id = "<%= @room.id %>";
@@ -1541,12 +1550,12 @@ $('#add_invoice').on('click',function(){
type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
success:function(data){
success:function(data){
if(data.status){
// console.log(tax_type);
localStorage.setItem("tax_type", tax_type);
window.location.href = '/origami/room/'+dining_id;
}
}
}
});
}else{

View File

@@ -46,9 +46,9 @@
<% if table.get_booking.nil? %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -61,12 +61,12 @@
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<% end %>
<div class="card-block">
<%= table.name %> <br>
<%= table.zone.name %>
@@ -129,7 +129,7 @@
<div class="card-block">
<%= room.name %><br>
<%= room.zone.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div>
</div>
<% end %>
@@ -189,7 +189,7 @@
<th><%= t :credit %> <%= t :sale %> <%= t("views.right_panel.detail.date") %></th>
<th><%= t("views.right_panel.detail.receipt_no") %></th>
<th> <%= t :cashier %></th>
<th> <%= t :customer %></th>
<th> <%= t :customer %></th>
<th> <%= t("views.right_panel.detail.credit_amount") %> </th>
</thead>
<tbody class="tbd_credit_lists"></tbody>
@@ -303,17 +303,19 @@
<a class="btn btn-block bg-danger waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% end %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
<% else %>
<% else %>
<% if @sale.payment_status != 'foc' %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %>
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Re.Print</button>
<% end %>
<% end %>
<% end %>
</div>
</div>
<%= print_settings %>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -332,7 +334,7 @@
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
@@ -346,7 +348,7 @@
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
@@ -365,12 +367,12 @@
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
@@ -390,7 +392,7 @@
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
@@ -440,9 +442,11 @@ $('#reprint').on('click', function () {
type: "GET",
url: ajax_url,
success: function (result) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
@@ -542,15 +546,17 @@ $(document).on('click', '.access_modal', function(event){
type: "GET",
url: ajax_url,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
}
});
});
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');

View File

@@ -164,6 +164,8 @@
</div>
</div>
<%= print_settings %>
<!-- membership paymentmodal -->
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
@@ -243,7 +245,6 @@
</div>
</div>
</div>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
@@ -303,31 +304,6 @@ $(document).ready(function(){
})
});
// $('#pay').on('click',function() {
// window.location.href = '/origami/sale/<%= @sale.id %>/payment';
// });
// Print for first bill
// $("#first_bill").on('click', function () {
// var sale_id = '<%= @sale.id %>';
// var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
// $.ajax({
// type: "GET",
// url: ajax_url,
// success: function (result) {
// receipt_no = ($("#receipt_no").html()).trim();
// if((receipt_no!=undefined) && (receipt_no!=""))
// createReceiptNoInFirstBillData(receipt_no,"");
// // For Server Print - from jade
// if ($("#server_mode").val() == "cloud") {
// code2lab.printFile(result.filepath.substr(6), result.printer_url);
// }
// location.reload();
// }
// });
// });
// Print for first bill
$("#first_bill").on('click', function () {
swal({
@@ -353,11 +329,12 @@ $(document).ready(function(){
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
location.reload();
@@ -385,17 +362,20 @@ $(document).ready(function(){
type: "GET",
url: ajax_url,
success: function (result) {
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
$( "#loading_wrapper" ).hide();
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
location.reload();
}
}
location.reload();
}
});
});
@@ -463,13 +443,15 @@ $('#void').on('click',function () {
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id + "&access_code=" + access_code ,
success: function (result) {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
}
window.location.href = '/origami';
}
});
}
@@ -499,17 +481,19 @@ $('#foc').click(function() {
success:function(result){
if (cash >= 0) {
swal({
title: "Information!",
text: 'Thank You !',
}, function () {
// For Server Print - from jade
title: "Information!",
text: 'Thank You !',
}, function () {
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
window.location.href = '/origami';
});
}
window.location.href = '/origami';
});
}
}
});
@@ -531,31 +515,30 @@ $(document).on('click', '.access_modal', function(event){
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
if (type == "edit") {
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
} else if(type == "void") {
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
} else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
} else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
} else if(type == "foc") {
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
} else {
swal("Opps",result.message,"warning")
}
}
});
}

View File

@@ -5,7 +5,7 @@
<%= simple_form_for(@print_setting) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="form-inputs p-l-10">
<%= f.input :name %>
<%= f.input :unique_code %>
<%= f.input :template %>
@@ -13,11 +13,8 @@
<%= f.input :header_font_size %>
<%= f.input :item_font_size %>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select" %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: "Please Select" %>
<% end %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select", class: "mdb-select md-form" %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>
<%= f.input :api_settings %>
@@ -45,7 +42,7 @@
</div>
<div class="form-actions">
<div class="form-actions p-l-10">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
</div>
<% end %>
@@ -80,38 +77,40 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.print_settings_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#print_setting_printer_name");
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud' && typeof code2lab != 'undefined'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#print_setting_printer_name");
$.each(printerInfo, function(key, value) {
$.each(printerInfo, function(key, value) {
$('#print_setting_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
.text(value.deviceName));
});
}
$('#print_setting_printer_name option:first').attr('disabled', true);
if ($('#sale_items').val() == '1') {
$('#sale_items').prop('checked', true);
}
// if selected printer change call and bind
$("#print_setting_printer_name").on("change", function(){
// if selected printer change call and bind
$("#print_setting_printer_name").on("change", function(){
if(serverMode != 'cloud'){
var printer_name = $(this).val();
var printer_name = $(this).val();
$.ajax({
type: "GET",
url: "/get_printer_options/"+printer_name,
success:function(result){
url: "/get_printer_options/"+printer_name,
success:function(result){
$("#print_setting_brand_name").val(result.model);
$("#print_setting_api_settings").val(result.url);
}
@@ -120,8 +119,13 @@
else {
$("#print_setting_api_settings").val($(this).val());
}
});
});
});
$("#print_setting_printer_name").select2({
theme: 'material',
tags: true
})
});
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
@@ -129,7 +133,7 @@
return false;
} else {
return true;
}
}
}
function greaterThanOne(val){
@@ -147,4 +151,4 @@
$(ele).val(1)
}
}
</script>
</script>

View File

@@ -12,11 +12,9 @@
<%= f.input :auto_print_receipt %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
<% if(@server_mode != 'cloud') %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select", class: "mdb-select md-form" %>
<%= f.input :font %>
<%= f.input :font_size %>
<%= f.input :show_tax %>
@@ -24,7 +22,7 @@
<%= f.input :show_guest_info %>
</div>
<div class="form-actions">
<div class="form-actions p-l-10">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
</div>
<% end %>
@@ -58,24 +56,31 @@
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.cashier_terminal_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#cashier_terminal_printer_name");
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud' && typeof code2lab != 'undefined'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#cashier_terminal_printer_name");
$.each(printerInfo, function(key, value) {
$.each(printerInfo, function(key, value) {
$('#cashier_terminal_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
.text(value.deviceName));
});
}
$('#cashier_terminal_printer_name option:first').attr('disabled', true);
$("#cashier_terminal_printer_name").select2({
theme: 'material',
tags: true
})
});
</script>
</script>

View File

@@ -1,10 +1,3 @@
<style type="text/css">
div.form-inputs span{
padding: 1%;
}
</style>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
<div class="card">
@@ -12,22 +5,11 @@ div.form-inputs span{
<%= simple_form_for([:settings,@settings_order_queue_station]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs p-l-15">
<div class="form-inputs p-l-10">
<%= f.input :station_name %>
<%= f.input :is_active %>
<% if(@server_mode != 'cloud') %>
<div class="form-group select required order_queue_station_printer_name bmd-form-group is-filled focused">
<label class="control-label select required bmd-label-static" for="order_queue_station_printer_name"><abbr title="required">*</abbr> Printer name</label>
<select class="form-control select required" name="order_queue_station[printer_name]" id="order_queue_station_printer_name">
<% Printer::PrinterWorker.printers.each do |printer| %>
<option value="<%= printer.force_encoding("UTF-8") %>"><%= printer.force_encoding("UTF-8") %></option>
<% end %>
</select>
</div>
<% else %>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<!-- <%= f.input :font_size %> -->
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: "Please Select", class: "mdb-select md-form" %>
<%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>
<%= f.label "Select Zones", :class => 'control-label' %>
@@ -38,7 +20,7 @@ div.form-inputs span{
<%= f.input :auto_print %>
</div>
<div class="form-actions p-l-15">
<div class="form-actions p-l-10">
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
</div>
<% end %>
@@ -69,24 +51,31 @@ div.form-inputs span{
2) <%= t("views.right_panel.button.back") %> - <%= t("views.right_panel.detail.back_txt") %> <%= t("views.right_panel.detail.order_queue_stations_txt") %> <br>
</p>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#order_queue_station_printer_name");
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud' && typeof code2lab != 'undefined'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#order_queue_station_printer_name");
$.each(printerInfo, function(key, value) {
$.each(printerInfo, function(key, value) {
$('#order_queue_station_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
.text(value.deviceName));
});
}
});
$('#order_queue_station_printer_name option:first').attr('disabled', true);
$("#order_queue_station_printer_name").select2({
theme: 'material',
tags: true
})
</script>

View File

@@ -280,7 +280,7 @@
</div>
</div>
</div>
<%= print_settings %>
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
<span class="hidden" id="membership_id"><%= @sale.customer.membership_id rescue 0%></span>
@@ -405,10 +405,12 @@
url: ajax_url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
if (!$('#print_settings').data('action-cable')) {
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
if(typeof code2lab != 'undefined'){
code2lab.printFile(result.filepath.substr(6), result.printer_url);
}
}
}
window.location.href = '/transactions/sales/';