Merge branch 'r-1902001-01-dev' of gitlab.com:code2lab/SXRestaurant into r-1902001-01-dev

This commit is contained in:
Myat Zin Wai Maw
2019-06-21 15:34:21 +06:30
12 changed files with 406 additions and 344 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,13 @@
App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
// App.messages = App.cable.subscriptions.create('MessagesChannel', {
connected: function() {},
disconnected: function() {},
received: function(data) {
received: function(data) {
var hostname = location.hostname.trim();
if(data.from == "" || hostname == data.from){
if(data.from == "" || hostname == data.from){
var items = data.data;
var tax = data.tax_profiles;
var status= data.status
@@ -16,8 +16,8 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
}
$('#second_display_slider').addClass("hidden")
$('#second_display_items').removeClass("hidden")
// append items
if (status == "add") {
for(var i in items) {
@@ -34,15 +34,15 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
// d_option = items[i].options;
// if (d_option){
// option_name = "-"+items[i].options;
// option_name = "-"+items[i].options;
// }else{
// option_name = '';
// }
d_option = items[i].opt;
if (items[i].click_type != "add_icon"){
option_name = "-"+items[i].options;
data_option = items[i].options ;
option_name = "-"+items[i].options;
data_option = items[i].options ;
}else{
option_name = ' ';
data_option = '[]';
@@ -56,25 +56,25 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
var instance_code = $(item_row[j]).attr('data-instance-code');
var r_option = $(item_row[j]).attr('data-options');
if (item_code == items[i].item_code && instance_code == items[i].instance_code && r_option==d_option) {
if (qty > 1) {
if (qty > 1) {
qty = parseInt($(item_row[j]).children('#item_qty').text()) + qty;
}else{
}else{
qty = parseInt($(item_row[j]).children('#item_qty').text()) + 1;
}
$(item_row[j]).children('#item_qty').text(qty);
parseFloat($(item_row[j]).children('#item_price').text(parseFloat(price*qty).toFixed(2)));
append =1;
}else{
if (qty > 1) {
if (qty > 1) {
qty = qty;
}else{
}else{
qty = 1;
}
}
});
}
});
if (append===0) {
row ="<tr class='item_box_"+items[i].item_code+"' data-price ='"
row ="<tr class='item_box_"+items[i].instance_code+"' data-price ='"
+price+ "' 'data-instance ='"
+instance+ "' data-code='"+items[i].item_code+"' data-instance-code='"
+items[i].instance_code+"' data-attributes='"
@@ -84,12 +84,12 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + items[i].name+ ' ' + instance + ' ' + option_name +'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(price).toFixed(2)
+'</td>'
+'</td>'
+'</tr>';
$(".second_display_items tbody").append(row);
}
}
}
@@ -117,28 +117,29 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
+'<td class="item-cell-no">'+rowCount+'</td>'
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name + ''+option+'</td>'
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
+'<td class="item-cell-price" id="item_price">'
+'<td class="item-cell-price" id="item_price">'
+ parseFloat(total).toFixed(2)
+'</td>'
+'</td>'
+'</tr>';
$(".second_display_items tbody").append(row);
rowCount = rowCount + 1;
}
}
//remove item
if(status == "remove"){
for(var i in items) {
var item_code = items[i].item_code;
var item_code = items[i].instance_code;
$("#order-items-table tbody > tr.item_box_"+item_code+"").remove();
}
}
//remove item
//update item qty
if(status == "update_qty"){
for(var i in items) {
var item_code = items[i].item_code;
var item_code = items[i].instance_code;
var item_qty = parseInt(items[i].qty);
var item_price = parseFloat(items[i].price);
var item_total = parseFloat(item_qty * item_price).toFixed(2);
@@ -157,8 +158,8 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
$(item_row).each(function(i){
var unit_price = parseFloat($(item_row[i]).attr('data-price'));
var qty = parseFloat($(item_row[i]).children('#item_qty').text());
total_price += qty*unit_price;
});
total_price += qty*unit_price;
});
//calculate Tax Amount
for(var i in tax) {
// substract , to give after discount
@@ -177,13 +178,12 @@ App.checkin = App.cable.subscriptions.create('SecondDisplayViewChannel', {
var fixed_taxable_amount = parseFloat(total_tax_amount).toFixed(2);
var fixed_grand_total = parseFloat(total_price + total_tax_amount).toFixed(2);
$('#s_sub_total').empty();
$('#s_sub_total').empty();
$('#s_sub_total').append(fixed_total_price);
$('#s_tatal_tax').empty();
$('#s_tatal_tax').empty();
$('#s_tatal_tax').append(fixed_taxable_amount);
$('#s_grand_total').empty();
$('#s_grand_total').empty();
$('#s_grand_total').append(fixed_grand_total);
}
}
});

View File

@@ -31,7 +31,7 @@ class Api::PaymentsController < Api::ApiController
if @status
sale_payment = SalePayment.new
status, @sale, @membership_data = sale_payment.process_payment(sale, current_login_employee, sale.grand_total, "paymal",params[:card_no])
if status == true && @membership_data["status"] == true
sale_payment = SalePayment.new
status = sale_payment.process_payment(sale, current_login_employee, 0, "cash")
@@ -95,7 +95,7 @@ class Api::PaymentsController < Api::ApiController
@message = membership_data["message"]
end
else
@status = false
@status = false
@message = "No gateway url!"
end

View File

@@ -1,10 +1,10 @@
class Origami::AddordersController < BaseOrigamiController
# before_action :set_dining, only: [:detail]
def index
@webview = false
if check_mobile
@webview = true
@webview = true
end
@tables = Table.all.active.order('zone_id asc').group("zone_id")
@@ -17,7 +17,7 @@ class Origami::AddordersController < BaseOrigamiController
@cashier_type = params[:type]
@webview = false
if check_mobile
@webview = true
@webview = true
end
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@@ -29,7 +29,7 @@ class Origami::AddordersController < BaseOrigamiController
@menus = []
@menu = []
# else
# @menus = Menu.all
# @menus = Menu.all
# @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
# end
@@ -57,10 +57,10 @@ class Origami::AddordersController < BaseOrigamiController
def get_menu_category ()
if (params[:id])
#Pull this menu
@menu = MenuCategory.find_by_id(params[:id])
# puts @menu.menu_items[1].item_attributes.to_json
return @menu
else
@@ -96,9 +96,9 @@ class Origami::AddordersController < BaseOrigamiController
return @sub_menu
end
end
def get_all_product()
@product = Product.all
@product = Product.all
end
def create
@@ -108,7 +108,7 @@ class Origami::AddordersController < BaseOrigamiController
extra_time = ''
items_arr = []
JSON.parse(params[:order_items]).each { |i|
JSON.parse(params[:order_items]).each { |i|
i["item_instance_code"] = i["item_instance_code"].downcase.to_s
if i["item_instance_code"].include? "ext"
is_extra_time = true
@@ -192,25 +192,25 @@ class Origami::AddordersController < BaseOrigamiController
type = 'order'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
end
if params[:order_source] != "quick_service" && params[:order_source] != "food_court"
process_order_queue(@order.order_id,@order.table_id,@order.source)
end
end
end
end
# Order.send_customer_view(@booking)
if current_user.role != "waiter" && params[:create_type] == "create_pay"
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
# for second display
# for second display
if @order.source == 'quick_service'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale",from:from
end
#end
result = {:status=> @status, :data => @sale }
@@ -220,7 +220,7 @@ class Origami::AddordersController < BaseOrigamiController
result = {:status=> @status, :data => 0 }
render :json => result.to_json
end
end
# render json for http status code
@@ -266,9 +266,9 @@ class Origami::AddordersController < BaseOrigamiController
def process_order_queue(order_id,table_id,order_source)
print_status = nil
cup_status = nil
#Send to background job for processing
order = Order.find(order_id)
order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
if ENV["SERVER_MODE"] != 'cloud'
cup_status = `#{"sudo service cups status"}`
@@ -307,7 +307,7 @@ class Origami::AddordersController < BaseOrigamiController
else
if ENV["SERVER_MODE"] != 'cloud'
from = ""
msg = ' Print Error ! Please contact to service'
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error',from:from
end
if !sidekiq.nil?
@@ -342,7 +342,7 @@ class Origami::AddordersController < BaseOrigamiController
return from
end
private
# def set_dining

View File

@@ -278,8 +278,12 @@ class Origami::PaymentsController < BaseOrigamiController
end
def show
puts current_user
puts "Hello current_user"
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@display_type = nil
end
path = request.fullpath
sale_id = params[:sale_id]
@trans_flag = true

View File

@@ -9,7 +9,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
def customer_view
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i == 2
if !display_type.nil? && display_type.value.to_i == 2
if params[:status]!= "billed"
tax_profiles = TaxProfile.all.order("order_by asc")
else
@@ -17,7 +17,7 @@ class Origami::SecondDisplayController < BaseOrigamiController
end
if ENV["SERVER_MODE"] == 'cloud'
from = request.subdomain + "." + request.domain
else
else
from = ""
end
ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status],from:from

View File

@@ -140,7 +140,13 @@ class Sale < ApplicationRecord
# shift with terminal zone
# set cashier
if order_source.downcase == "emenu"
if !order_source.nil?
orderSoure = order_source.downcase
else
orderSoure = nil
end
if orderSoure == "emenu"
if !booking.dining_facility_id.nil?
table = DiningFacility.find(booking.dining_facility_id)
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)

View File

@@ -139,7 +139,16 @@
<span class="font-15 shopinfo" >Team Viewer</span>
</p>
</li>
<%if current_login_employee.role =="cashier" %>
<li>
<p class="waves-effect waves-block p-l-30 m-b-5">
<a href="/origami/second_display" onclick="window.open('/origami/second_display', 'newwindow', 'width=700,height=500'); return false;" style="text-decoration: none;">
<i class="material-icons font-7 logout_icon shopinfo">info</i>
<span class="font-15 shopinfo" >Second Display</span>
</a>
</p>
</li>
<% end %>
<!-- <p class="delete waves-effect waves-block p-l-30 m-b-5" data-ref="<%=logout_path%>" data-method="delete">
<i class="material-icons font-10 logout_icon">exit_to_app</i>
<span class="font-18">Logout</span>

View File

@@ -795,8 +795,21 @@
$(".summary-items tbody").empty();
$('#sub_total').text("0.00");
$(".create").attr("disabled","disabled");
customer_display_view(null,"reload");
});
function customer_display_view(data,status) {
url = '../../../../origami/customer_view';
$.ajax({
type: "POST",
url: url,
data: {"data":data,"status":status},
dataType: "json",
success:function(result){
}
});
}
$(document).on('click', '.cashier_number', function(event){
if(event.handled !== true) {
var original_value;

View File

@@ -17,7 +17,7 @@
else
delimiter = ""
end
%>
%>
<!-- Widgets -->
<div class="row clearfix">
@@ -114,9 +114,9 @@
<tr>
<% if payment.payment_method == 'paypar' %>
<td>Redeem Sale : </td>
<% else %>
<% else %>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<% end %>
<% end %>
<td align="right">
<% @sale_data.each do |data| %>
<% pay_mth = payment.payment_method %>
@@ -143,7 +143,7 @@
</div>
</div>
</div>
<% end %>
<% end %>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="card">
<div class="body">
@@ -211,7 +211,7 @@
<% if !@top_items.nil? %>
<tr>
<td width="40px"><%= t :top %> <%= t("views.right_panel.detail.item") %> : </td>
<td align="right" width="60px"><%= @top_items.item_name %>
<td align="right" width="60px"><%= @top_items.item_name %>
<br>(<%= @top_items.item_total_price %>)</td>
</tr>
<% end %>
@@ -249,7 +249,7 @@ $(function() {
if ($('#server_mode').val() != "cloud" && display_type == 2) {
document.getElementById('second_view').click();
}
window.location.href = '/origami/quick_service';
window.location.href = '/origami/quick_service';
});
$(".fc_view").on('click', function() {
@@ -262,13 +262,13 @@ $(function() {
if ($('#server_mode').val() != "cloud" && display_type == 2) {
document.getElementById('second_view').click();
}
window.location.href = '/origami/food_court';
window.location.href = '/origami/food_court';
});
$(".order_reservation").on('click', function() {
window.location.href = '/origami/order_reservation';
});
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
@@ -278,4 +278,4 @@ $(function() {
window.location.href = '/origami/reservation';
});
});
</script>
</script>

View File

@@ -31,7 +31,7 @@
<span class="hidden" id="dining"><%if !@dining.nil?%><%= @dining.id%><%end%></span>
<div class="col-lg-6 col-md-6 col-sm-6 text-left"><strong>Sale ID :</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></div>
</div>
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<strong>Customer :</strong>
@@ -186,7 +186,7 @@
</strong>
</div>
</div>
<div class="row payment cash-color p-l-5 p-r-5">
<div class="col-md-8">Cash</div>
<div class="col-md-4" id="cash" >
@@ -387,6 +387,8 @@
<div class="cashier_number border-top border- border-left payment-long" data-value="10000" data-type="add">10000</div>
</div>
<div class="row bottom">
<input type="hidden" name="server_mode" value="<%=ENV["SERVER_MODE"]%>" id="server_mode">
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="pay border-top border- border-left purple payment-left" id="pay">Pay</div>
</div>
</div>
@@ -442,7 +444,7 @@
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons -->
@@ -468,7 +470,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>
@@ -491,11 +493,11 @@
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- pdf light box -->
<div class="modal fade" id="pdfModal" tabindex="-1" role="dialog" >
@@ -511,20 +513,20 @@
<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" id="print_receipt"> Print
</button>
</button>
<button type="button" class="btn-lg btn-block bg-blue waves-effect btn_pdf_close" data-dismiss="modal">
CLOSE
</button>
</div>
</div>
</div>
</div>
</div>
<!-- customer light box -->
<div class="modal fade" id="is_memberModal" tabindex="-1" role="dialog">
@@ -570,7 +572,7 @@
<div class="modal-footer"></div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
@@ -579,7 +581,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>
@@ -598,12 +600,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>
<!-- change tax modal -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
@@ -667,7 +669,7 @@
<div class="m-r-20" align="right">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect btn_cancel">Cancel</button>
</div>
</div>
</div>
<!-- customer light box -->
<div class="modal fade m-t-40" id="is_paymemberModal" tabindex="-1" role="dialog">
@@ -694,14 +696,14 @@
<div class="modal-footer"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
// //control borwser back
window.location.hash="no-back-button";
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
window.onhashchange=function(){window.location.hash="";}
var cashier_type = "<%= @cashier_type %>";
var cashier_type = "<%= @cashier_type %>";
var customer_id = "<%= @customer.id %>";
var customer_name = "<%= @customer.name %>";
var pdf_view = '<%=@pdf_view%>';
@@ -725,35 +727,35 @@ $(document).ready(function(){
/* start check first bill or not*/
var member_id = $('#membership_id').text();
var member_discount = $('#member_discount').text();
var receipt_no = "";
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
payment_type = '';
// if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
// console.log(payment_type)
// console.log(parseInt(jQuery.inArray("MPU", payment_type)))
if (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
$("#credit_payment").hide();
} else{
$("#credit_payment").show();
}
if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 ||
parseInt(jQuery.inArray("VISA", payment_type)) != -1 ||
parseInt(jQuery.inArray("JCB", payment_type)) != -1 ||
parseInt(jQuery.inArray("Master", payment_type)) != -1 ||
parseInt(jQuery.inArray("UNIONPAY", payment_type)) != -1 ||
if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 ||
parseInt(jQuery.inArray("VISA", payment_type)) != -1 ||
parseInt(jQuery.inArray("JCB", payment_type)) != -1 ||
parseInt(jQuery.inArray("Master", payment_type)) != -1 ||
parseInt(jQuery.inArray("UNIONPAY", payment_type)) != -1 ||
parseInt(jQuery.inArray("Redeem", payment_type)) != -1 ||
parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 ||
parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 ||
parseInt(jQuery.inArray("Alipay", payment_type)) != -1 ||
parseInt(jQuery.inArray("PAYMAL", payment_type)) != -1 ||
parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) != -1 ||
parseInt(jQuery.inArray("Alipay", payment_type)) != -1 ||
parseInt(jQuery.inArray("DINGA", payment_type)) != -1 ||
parseInt(jQuery.inArray("GiftVoucher", payment_type)) != -1){
$("#card_payment").show();
$("#card_payment").show();
} else{
$("#card_payment").hide();
}
@@ -775,9 +777,9 @@ $(document).ready(function(){
window.location.href = '/origami/table/'+ dining_id;
}else{
window.location.href = '/origami/'+cashier_type+'/pending_order/'+sale_id;
}
}
}
});
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
@@ -826,7 +828,7 @@ $(document).ready(function(){
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");
}
@@ -871,7 +873,7 @@ $(document).ready(function(){
calculate_member_discount(sale_id,tax_type);
}
// $("#pdfModal").on('shown.bs.modal', function () {
// $("#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")){
@@ -891,7 +893,7 @@ $(document).ready(function(){
}
/* end delete receipt no in first bill*/
localStorage.removeItem("cash");
localStorage.removeItem("cash");
if (result.status) {
var msg = result.message;
}
@@ -899,7 +901,7 @@ $(document).ready(function(){
var msg = '';
}
$("#loading_wrapper" ).hide();
$("#loading_wrapper" ).hide();
if(location.pathname.includes("credit_payment")){
payment_success_alert();
}else{
@@ -922,7 +924,7 @@ $(document).ready(function(){
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
}else{
//PDF lightbox data
//PDF lightbox data
print_receipt();
}
}
@@ -930,10 +932,26 @@ $(document).ready(function(){
});
}
}
var second_display_lookup = $("#display_type").val();
if ($('#server_mode').val() != "cloud" && second_display_lookup == 2){
customer_display_view(null,"reload");
}
});
function customer_display_view(data,status) {
url = '../../../../origami/customer_view';
$.ajax({
type: "POST",
url: url,
data: {"data":data,"status":status},
dataType: "json",
success:function(result){
}
});
}
// $('#void').on('click',function () {
// if ($(this).attr('active') === "true") {
// if ($(this).attr('active') === "true") {
// var sale_id = $('#sale_id').text();
// var remark = $("#remark").val();
// var ajax_url = "/origami/sale/" + sale_id + '/void';
@@ -949,7 +967,7 @@ $(document).ready(function(){
// swal("Oops","You are not authorized for void","warning")
// }
// });
});
// bind survey to order or sale
@@ -960,7 +978,7 @@ $(document).ready(function(){
} else {
var sale_id = $('#dining').text();
}
//var table_id = $('.tables').attr("data-id");
//var table_id = $('.tables').attr("data-id");
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys";
});
@@ -1023,7 +1041,7 @@ $(document).ready(function(){
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else{
swal("Oops","You are not authorized for void","warning")
}
@@ -1118,7 +1136,7 @@ $(document).ready(function(){
var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(alipay) + parseFloat(junctionpay) + parseFloat(paymal) + parseFloat(dinga) + parseFloat(giftvoucher);
var result = parseFloat(amount_due) - parseFloat(total);
<% if precision.to_i > 0 %>
$('#balance').text(parseFloat(result).toFixed(<%= precision %>));
<% else %>
@@ -1134,7 +1152,7 @@ $(document).ready(function(){
url: '../../../customer_view',
data: {"data":data,"status":status},
dataType: "json",
success:function(result){
success:function(result){
}
});
}
@@ -1155,7 +1173,7 @@ $(document).ready(function(){
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type, 'tax_type':tax_type },
async: false,
success:function(result){
success:function(result){
}
});
}
@@ -1179,7 +1197,7 @@ $(document).ready(function(){
var receipt_no = $("#sale_receipt_no").val();
var params = { 'filename':filename, 'receipt_no':receipt_no, 'printer_name':printer_name };
$.ajax({
type: "POST",
type: "POST",
url: "/origami/sale/"+sale_id+"/"+cashier_type+"/payment/print",
data: params,
success:function(result){
@@ -1203,7 +1221,7 @@ $(document).ready(function(){
if (cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}
}else{
payment_success_alert();
@@ -1216,7 +1234,7 @@ $(document).ready(function(){
var title = "Payment Successful!";
if($('#balance').text() < 0){
var text = 'Changed amount ' + $('#balance').text() * (-1);
}else{
}else{
$('#pay').text("Pay");
var text = 'Thank You !';
}
@@ -1225,7 +1243,7 @@ $(document).ready(function(){
title: "Payment Successful!",
text: text,
html: true,
closeOnConfirm: false,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
@@ -1245,7 +1263,7 @@ $(document).ready(function(){
}
});
}
$(".btn_pdf_close").on('click',function(){
var flag = localStorage.getItem("trans_flag");
@@ -1257,9 +1275,9 @@ $(document).ready(function(){
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
}
}
}
});
$(".btn_customer_yes").on('click',function(){
@@ -1268,8 +1286,8 @@ $(document).ready(function(){
});
// Read Card Reader
$(".btn_member").on('click', function(){
var cardNo = "";
$(".btn_member").on('click', function(){
var cardNo = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
@@ -1278,13 +1296,13 @@ $(document).ready(function(){
var customer_mamber_card_no = 0;
$("#is_memberModal").hide();
$("#sxModal").show();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
$("#sxModal").hide();
customer_mamber_card_no = $("#paypar_account_no").val();
if(sale_id != 0 && customer_mamber_card_no != 0){
if(sale_id != 0 && customer_mamber_card_no != 0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
@@ -1302,7 +1320,7 @@ $(document).ready(function(){
}
}
});
});
}
},100);
});
@@ -1324,17 +1342,17 @@ $(document).ready(function(){
// QR Code Reader
$(".btn_qr_code").on('click', function(e){
$("#is_memberModal").hide();
var code = "";
var code = "";
var customer_id = '';
var customer_name = '';
var membership_id = '';
var membership_type = '';
var membership_type = '';
setTimeout(function(){
code=getQRCode();
code=getQRCode();
$("#qr_code").val(code);
});
if(sale_id != 0 && code != ""){
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/get_customer" ,
@@ -1352,13 +1370,13 @@ $(document).ready(function(){
}
}
});
}
});
}
});
// Read qrcode from java
function getQRCode(){
return code2lab.readQRCode();
return code2lab.readQRCode();
}
function update_sale(membership_id, customer_id, customer_name, sale_id) {
@@ -1393,7 +1411,7 @@ $(document).ready(function(){
location.reload();
}
}
});
});
});
}
@@ -1462,7 +1480,7 @@ $(document).ready(function(){
var cash = $('#grand_total').text();
var sub_total = $('#sub-total').text();
var sale_id = $('#sale_id').text();
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark,'type':cashier_type,'access_code':access_code };
swal({
title: "Alert",
text: "Are you sure want to FOC This Receipt?",
@@ -1477,8 +1495,8 @@ $(document).ready(function(){
type: "POST",
url: "/origami/payment/"+cashier_type+"/foc",
data: params,
success:function(result){
customer_display_view(null,"reload");
success:function(result){
customer_display_view(null,"reload");
if (cash >= 0) {
swal({
title: "Information!",
@@ -1498,14 +1516,14 @@ $(document).ready(function(){
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
}
}
}
});
}
}
});
}
});
});
});
$('#void').on('click', function () {
@@ -1543,12 +1561,12 @@ $(document).ready(function(){
window.location.href = '/origami';
}else{
window.location.href = '/origami/'+cashier_type;
}
}
}
}
})
}
});
});
});
function waste_and_spoilage(remark) {
@@ -1588,12 +1606,12 @@ $(document).ready(function(){
if(cashier_type=="quick_service"){
customer_display_view(null,"reload");
}
}
}
}
}
});
}
});
});
}
/* Start function for tax changable */
@@ -1628,12 +1646,12 @@ $(document).ready(function(){
type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
success:function(data){
success:function(data){
if(data.status){
// console.log(type);
localStorage.setItem("tax_type", type);
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment';
}
}
}
});
}else{
@@ -1666,10 +1684,10 @@ $(document).ready(function(){
});
// Read Card Reader - Paymal payment for FoodCourt
$(".btn_paymal_member").on('click', function (){
var cardNo = "";
$(".btn_paymal_member").on('click', function (){
var cardNo = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
var receipt_no = "";
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
receipt_no = ($("#receipt_no").html()).trim();
}
@@ -1678,15 +1696,15 @@ $(document).ready(function(){
var payment_amount = parseFloat($("#grand_total").text());
$("#is_paymemberModal").hide();
$("#sxModal").show();
$("#sxModal").show();
setTimeout(function(){
getCardNo();
$("#sxModal").hide();
$("#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){
if(sale_id != 0 && customer_mamber_card_no !=0){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
@@ -1743,7 +1761,7 @@ $(document).ready(function(){
});
}
}
});
});
}else{
swal({
title: 'Oops',
@@ -1763,16 +1781,16 @@ $(document).ready(function(){
// QR Code Reader
$(".btn_paymal_qr_code").on('click', function(e){
$("#is_paymemberModal").hide();
var code = "";
var code = "";
var sale_id = $("#sale_id").text() || 0;
var receipt_no = "";
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 != ""){
code=getQRCode();
if(sale_id != 0 && code != ""){
$.ajax({
type: "POST",
url: "/origami/"+sale_id+"/send_account" ,
@@ -1828,8 +1846,8 @@ $(document).ready(function(){
});
}
}
});
}
});
}
},100);
});

View File

@@ -0,0 +1,11 @@
class ChangeImageToAddLimitInDisplayImages < ActiveRecord::Migration[5.1]
def up
change_column :display_images, :image, :binary, :limit => 10.megabyte
end
def down
change_column :display_images, :image, :binary, :limit => nil
end
end