Pull from master

This commit is contained in:
San Wai Lwin
2018-03-15 13:48:52 +06:30
parent 96f8640df7
commit 1188f6e8e9
29 changed files with 242 additions and 97 deletions

View File

@@ -880,13 +880,24 @@ $(function() {
dataType: "json",
success:function(result){
if (result.status) {
console.log(result)
if (result.data == null){
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
swal({
title: "Please Open Shift !",
text: result.status,
type: "warning",
confirmButtonColor: "#DD6B55",
confirmButtonText: "Ok",
closeOnConfirm: false
}, function () {
window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
});
}else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
}
}
}
}
});
});

View File

@@ -314,7 +314,7 @@ tr.discount-item-row:hover {
position: relative;
left: 42%;
top: 30%;
background-color: #d9534f;
background-color: #32ad1a;
color: #fff;
text-align: center;
width: 200px;
@@ -396,3 +396,27 @@ i.logout_icon{
color: #fff !important;
background-color: #5DADE2 !important;
}
/* Start Is Member Modal */
#is_memberModal .modal-body {
height: 200px !important;
}
#is_memberModal .btn {
width: 80%;
}
/* End Is Member Modal */
/* Start iframe */
iframe {
border: none;
overflow: hidden !important;
width: 400px;
height: 550px;
}
#pdfModal .btn {
width: 150%;
height: 100%;
}
/* End iframe */

View File

@@ -143,7 +143,7 @@ class Crm::CustomersController < BaseCrmController
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
@@ -269,7 +269,7 @@ end
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
@@ -328,7 +328,7 @@ end
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)

View File

@@ -25,6 +25,13 @@ class Oqs::EditController < BaseOqsController
order_item.item_order_by = current_user.name
order_item.qty = qty_weight
order_item.remark = remarks
if !order_item.set_menu_items.nil?
instance_item_sets = JSON.parse(order_item.set_menu_items)
instance_item_sets.each_with_index do |instance_item, instance_index|
instance_item_sets[instance_index]["quantity"] = qty_weight
end
order_item.set_menu_items = instance_item_sets.to_json
end
order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server

View File

@@ -273,7 +273,7 @@ class Origami::DiscountsController < BaseOrigamiController
auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue HTTParty::Error
response = {"status": false, "message": "Can't open membership server " }

View File

@@ -63,9 +63,9 @@ class Origami::PaymentsController < BaseOrigamiController
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer)
current_balance = SaleAudit.paymal_search(sale_id)
# current_balance = 0
# member_info = Customer.get_member_account(customer)
# current_balance = SaleAudit.paymal_search(sale_id)
current_balance = 0
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
@@ -152,8 +152,10 @@ class Origami::PaymentsController < BaseOrigamiController
if customer.membership_id != nil && rebate && credit_data.nil?
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
if member_info["status"] == true
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
current_balance = SaleAudit.paymal_search(sale_id)
end
end
#for card sale data

View File

@@ -8,9 +8,7 @@ class Origami::RequestBillsController < ApplicationController
if !ShiftSale.current_shift.nil?
order_id = params[:id] # order_id
bk_order = BookingOrder.find_by_order_id(order_id)
puts params[:id]
puts bk_order
puts bk_order.booking_id
order = Order.find(order_id)
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
if check_booking.sale_id.nil?
@@ -29,6 +27,10 @@ class Origami::RequestBillsController < ApplicationController
# Promotion Activation
Promotion.promo_activate(@sale)
if order.source == "quick_service"
result = {:status=> @status, :data => @sale.sale_id }
render :json => result.to_json
end
else
@status = false
@error_message = "No Current Open Shift for This Employee"

70
app/controllers/origami/split_bill_controller.rb Normal file → Executable file
View File

@@ -77,6 +77,10 @@ class Origami::SplitBillController < BaseOrigamiController
def create
order_ids = params[:order_ids]
arr_order_ids = nil
if !params[:arr_order_ids].nil?
arr_order_ids = JSON.parse(params[:arr_order_ids])
end
orders = nil
if !params[:orders].empty?
orders = JSON.parse(params[:orders])
@@ -136,14 +140,15 @@ class Origami::SplitBillController < BaseOrigamiController
order_id_count = 0
order_id = nil
order_items.each do |order_item|
order_item_count = 0
order = Order.find(order_item["order_id"])
if order.order_items.count == 1
order_id = order.id
order_id_count += 1
else
order_item_count += 1
arr_order_ids.each do |order|
order.each do |odr|
data = Order.find(odr[0])
if data.order_items.count == odr[1]
order_id = odr[0]
order_id_count += 1
else
order_item_count += 1
end
end
end
@@ -158,10 +163,12 @@ class Origami::SplitBillController < BaseOrigamiController
puts "order_id_count > 1"
updated_order_id = Array.new
order_ids.each do |odr_id|
odr = Order.find(odr_id)
if odr.order_items.count > 1
updated_order_id.push(odr_id)
arr_order_ids.each do |order|
order.each do |odr|
data = Order.find(odr[0])
if data.order_items.count != odr[1]
updated_order_id.push(odr[0])
end
end
end
@@ -266,12 +273,32 @@ class Origami::SplitBillController < BaseOrigamiController
end
end
else
# puts order_ids
if order_ids.count == 1 && order_id_count == 0 && order_item_count == 1
BookingOrder.find_by_order_id(order_ids[0]).delete
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
order_items.each do |order_item|
update_order_item(order_ids[0], order_item)
if order_ids.count == 1 && order_item_count == 1
if order_id_count == 0
customer = Customer.find(params[:customer_id])
order_type = "dine_in"
if !customer.nil?
if customer.customer_type == "Takeaway"
order_type = "takeaway"
elsif customer.customer_type == "Delivery"
order_type = "delivery"
end
end
# begin
order = create_order(params,order_type,order_items.count,current_user)
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id})
order_items.each do |order_item|
update_order_item(order.order_id, order_item)
end
else
BookingOrder.find_by_order_id(order_ids[0]).delete
BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_ids[0]})
order_items.each do |order_item|
update_order_item(order_ids[0], order_item)
end
end
else
customer = Customer.find(params[:customer_id])
@@ -366,4 +393,11 @@ class Origami::SplitBillController < BaseOrigamiController
render :json => { status: true }
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
end
end

View File

@@ -54,7 +54,7 @@ class Origami::VoucherController < BaseOrigamiController
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10
)
rescue Net::OpenTimeout

View File

@@ -34,7 +34,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10)
rescue HTTParty::Error
@@ -71,7 +71,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
@@ -124,7 +124,7 @@ class Customer < ApplicationRecord
:body => member_params,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
})
rescue Net::OpenTimeout
response = { status: false, message: "Server Time out" }
@@ -201,7 +201,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }
@@ -277,7 +277,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }
@@ -312,7 +312,7 @@ class Customer < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)

View File

@@ -884,7 +884,7 @@ def self.get_menu_item_query(order_by)
"(CASE WHEN si.qty IS NOT NULL THEN SUM(si.qty) ELSE 0 END) as total_item," +
"(CASE WHEN si.unit_price != mii.price THEN si.unit_price ELSE mii.price END) as unit_price," +
"(CASE WHEN si.qty IS NOT NULL THEN (SUM(si.qty) * si.unit_price) ELSE 0 END) as grand_total," +
"mii.price as unit_price, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE mii.item_instance_name END) as product_name,
"mii.price as unit_price, (CASE WHEN si.product_name IS NOT NULL THEN si.product_name ELSE CONCAT(menu_items.name,' - ',mii.item_instance_name) END) as product_name,
mc.name as" +
" menu_category_name,mc.id as menu_category_id, si.remark as status_type,
si.price as price ")

View File

@@ -85,7 +85,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10
)
rescue Net::OpenTimeout
@@ -133,7 +133,7 @@ class SalePayment < ApplicationRecord
auth_token:auth_token}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
},
:timeout => 10
)
@@ -455,7 +455,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": " Connection timeout" }
@@ -500,7 +500,8 @@ class SalePayment < ApplicationRecord
end
rebate_arr.push(data)
end
Rails.logger.debug "Rebage Response"
Rails.logger.debug rebate_arr.to_json
total_amount = rebate_prices - payparcost - overall_dis
if credit == 1
@@ -531,7 +532,7 @@ class SalePayment < ApplicationRecord
}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2'
'Accept' => 'application/json; version=3'
}, :timeout => 10)
rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" }

View File

@@ -491,8 +491,8 @@ class ReceiptBillA5Pdf < Prawn::Document
end
#individual payment per person
def individual_payment(sale_data, survey, precision, delimiter)
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
def individual_payment(sale_data, precision, delimiter)
per_person = sale_data.grand_total.to_i / sale_data.equal_persons.to_i
stroke_horizontal_rule
move_down line_move
y_position = cursor

View File

@@ -494,8 +494,8 @@ class ReceiptBillPdf < Prawn::Document
end
#individual payment per person
def individual_payment(sale_data, survey, precision, delimiter)
per_person = sale_data.grand_total.to_f / survey.total_customer.to_i
def individual_payment(sale_data, precision, delimiter)
per_person = sale_data.grand_total.to_i / sale_data.equal_persons.to_i
stroke_horizontal_rule
move_down line_move
y_position = cursor

View File

@@ -162,6 +162,9 @@
<div id="sxModal">
<div id="sxModal-Content"><h3><%= t :card_tap %></h3></div>
<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>
<!-- The modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="modalLabelLarge" aria-hidden="true">
@@ -212,4 +215,8 @@
$("#type").val("card");
}
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -10,6 +10,7 @@
</div> -->
<!-- #END# Search Bar -->
<!-- Top Bar -->
<%if !request.path_info.include?('second_display') %>
<nav class="navbar">
<div class="container-fluid">
<div class="navbar-header">
@@ -79,7 +80,7 @@
</div>
</div>
</nav>
<%end%>
<script type="text/javascript">
$(function(){
$('.delete').click(function(){

View File

@@ -482,6 +482,11 @@
</div>
</div>
<% end %>
<style type="text/css">
.fadeInRight{
-webkit-animation-duration: 350ms !important;
}
</style>
<script>
jQuery(function(){
id = "<%=@menu[0].id%>";

View File

@@ -263,6 +263,9 @@
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<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>
<script type="text/javascript">
@@ -479,11 +482,11 @@
if(booking_id!= "" && page == "pending"){
window.location.href = '/origami/'+cashier_type+'/pending_order/'+booking_id;
}else{
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}
}else{
if(page == "payment"){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/customers/payment/';
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/';
}else{
if (type=="Table") {
window.location.href = '/origami/table/'+id
@@ -523,7 +526,11 @@
}
})
});
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -189,18 +189,27 @@
</div>
<% end %>
</div>
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<script>
$(document).ready(function () {
setHeaderBreadCrumb(_DASHBOARD_);
});
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});
$(".qs_view").on('click', function() {
window.location.href = '/origami/quick_service';
document.getElementById('second_view').click();
window.location.href = '/origami/quick_service';
});
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
});
</script>

View File

@@ -134,7 +134,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id="<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""
@@ -424,7 +424,7 @@
<i class="material-icons">reply</i>
<%= t("views.btn.back") %>
</button>
<a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a>
<!-- <a href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect" style="height: 45px">Customer View</a> -->
<button type="button" id="add_order" class="btn btn-block bg-blue waves-effect"><%= t("views.btn.add") %> <%= t("views.right_panel.detail.order") %></button>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %>
@@ -491,11 +491,11 @@
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</h4>
</div>
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option>
<!-- <option value="Cash">Cash</option> -->
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">

View File

@@ -131,7 +131,7 @@
<div class="tab-pane active" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %>
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id = "<%= order.order_id %>">
<div class="card-block">
<%
order_status = ""

View File

@@ -391,21 +391,23 @@
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="pdfModalLabel"></h4>
<h4 class="modal-title">
<span id="pdfModalLabel"></span>
<span id="changed_amount" class="p-l-120"></span>
</h4>
</div>
<div class="modal-body">
<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">
<p id="changed_amount"></p>
<div class="text-center">
<iframe id="receipt_pdf" src="" style="width: 400px; height: 600px;"></iframe>
<iframe id="receipt_pdf" src="" class="pdf-iframe" scrolling="no"></iframe>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="row m-b-10 m-r-30">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<div class="col-md-5">
<div class="col-md-5 m-r-20">
<button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div>
<% end %>
@@ -424,27 +426,29 @@
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="is_memberModalLabel">Are you Member?</h3>
<h1 class="modal-title" id="is_memberModalLabel">Are you Member?</h1>
</div>
<div class="modal-body">
<div class="row text-center">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" />
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Card Member</button>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR Code</button>
</div>
</div>
<div class="row clearfix"></div>
<div class="row text-center m-t-20">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-green waves-effect btn_customer_yes">Yes</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<button type="button" class="btn btn-lg btn-link bg-red waves-effect" data-dismiss="modal">No</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_member">Member</button>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<button type="button" class="btn btn-lg btn-link bg-primary waves-effect btn_qr_code">QR</button>
</div>
</div>
</div>
<div class="modal-footer"></div>
@@ -453,7 +457,12 @@
</div>
<div id="sxModal">
<div id="sxModal-Content"><h3>Card Tap</h3></div>
<div id="sxModal-Content">
<h3>Card Tap</h3>
</div>
<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>
<script type="text/javascript">
@@ -463,7 +472,7 @@ var customer_name = "<%= @customer.name %>";
$(document).ready(function(){
setHeaderBreadCrumb(_PAYMENTS_);
//start customer modal popup
if((customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((cashier_type=='quick_service') && (customer_id!=undefined) && (customer_id!=null) && (customer_id!="")){
if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false});
}
@@ -481,7 +490,9 @@ var customer_name = "<%= @customer.name %>";
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
console.log("ssssssssssss")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
console.log(member_id);
console.log(member_discount);
if (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
@@ -601,7 +612,7 @@ var customer_name = "<%= @customer.name %>";
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Payment Successful!");
$("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text("");
if($('#balance').text() < 0){
<% if precision.to_i > 0 %>
@@ -1100,4 +1111,8 @@ var customer_name = "<%= @customer.name %>";
});
});
}
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script>

View File

@@ -203,11 +203,12 @@ $(document).ready(function(){
url: ajax_url,
// data: 'order_id='+ order_id,
success: function (result) {
console.log(result)
if (!result.status) {
swal("Information!", result.error_message);
}
else {
location.reload();
window.location.href = '../pending_order/'+ result.data;
}
}
});

View File

@@ -4,7 +4,7 @@
<div class="card">
<div class="card-block">
<div class="card-text" >
<div id="order-detail-slimscroll" data-height="150">
<div id="order-detail-slimscroll" data-height="160">
<table class="table table-striped second_display_items" id="order-items-table">
<thead>
<tr>

View File

@@ -1,4 +1,4 @@
<div class="container-fluid">
<div class="container-fluid" style="margin-top:-65px;">
<button type="button" class="hidden" id="s_reload">Reload</button>
<div class="slider" id="second_display_slider">
<%= render 'slider' %>

23
app/views/origami/split_bill/index.html.erb Normal file → Executable file
View File

@@ -624,20 +624,39 @@ function orderItemSplitBillProcess(cnt_items){
}
var order_ids = [];
var arr_order_ids = [];
if(order_items!=undefined && order_items!=null){
$.each(order_items,function(key,value){
var orderIds = {};
if($.inArray(value.order_id,order_ids) == -1){
order_ids.push(value.order_id);
orderIds[value.order_id] = 1;
arr_order_ids.push(orderIds);
}else{
if(arr_order_ids != null & arr_order_ids!=""){
if(arr_order_ids.length > 0){
$.each(arr_order_ids, function(k,val){
$.each(val,function(kk,vval){
if((val[kk]!= undefined) && (kk == value.order_id)){
val[kk] += 1;
}
});
arr_order_ids[k] = val;
});
}
}
}
});
}
// console.log(JSON.stringify(arr_order_ids));
var ajax_url = "/origami/split_bills";
$.ajax({
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'order_items' : JSON.stringify(order_items), 'orders' : ''},
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : order_ids, 'arr_order_ids': JSON.stringify(arr_order_ids), 'order_items' : JSON.stringify(order_items), 'orders' : ''},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);
@@ -670,7 +689,7 @@ function orderSplitBillProcess(cnt_orders){
type: "POST",
url: ajax_url,
dataType: 'JSON',
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders)},
data: {'dining_id' : dining_id, 'type': type, 'customer_id' : customer_id, 'booking_id' : booking_id, 'order_ids' : [], 'order_items' : '', 'orders' : JSON.stringify(orders), 'arr_order_ids': []},
success: function (result) {
if (!result.status) {
swal("Information!", result.error_message);

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end
else
# check for license file
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
end
end

View File

@@ -9,7 +9,7 @@ class CreateSaleAudits < ActiveRecord::Migration[5.1]
t.string :action_by, :null => false
t.string :approved_by, :null => true
t.datetime :approved_at, :null => true
t.string :remark
t.text :remark
t.timestamps
end
end

View File

@@ -6,13 +6,13 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
t.string :template
t.string :font, :default => ""
t.string :printer_name, :null => false
t.string :api_settings,
t.string :api_settings
t.string :brand_name
t.string :type
t.decimal :page_width, :null => false, :default => 210
t.decimal :page_height, :null => false, :default => 1450
t.integer :print_copies, :null => false, :default => 1
t.string :precision
t.string :precision
t.boolean :delimiter
t.integer :heading_space