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,8 +880,19 @@ $(function() {
dataType: "json", dataType: "json",
success:function(result){ success:function(result){
if (result.status) { if (result.status) {
console.log(result)
if (result.data == null){ if (result.data == null){
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(); window.location.href = '/origami/quick_service/pending_order/' + $('#sale_id').text();
});
}else{ }else{
window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment" window.location.href = "/origami/sale/"+result.data["sale_id"]+"/"+type+"/payment"
} }

View File

@@ -314,7 +314,7 @@ tr.discount-item-row:hover {
position: relative; position: relative;
left: 42%; left: 42%;
top: 30%; top: 30%;
background-color: #d9534f; background-color: #32ad1a;
color: #fff; color: #fff;
text-align: center; text-align: center;
width: 200px; width: 200px;
@@ -396,3 +396,27 @@ i.logout_icon{
color: #fff !important; color: #fff !important;
background-color: #5DADE2 !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, :body => member_params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :timeout => 10
) )
@@ -269,7 +269,7 @@ end
:body => member_params, :body => member_params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :timeout => 10
) )
@@ -328,7 +328,7 @@ end
:body => member_params, :body => member_params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :timeout => 10
) )

View File

@@ -25,6 +25,13 @@ class Oqs::EditController < BaseOqsController
order_item.item_order_by = current_user.name order_item.item_order_by = current_user.name
order_item.qty = qty_weight order_item.qty = qty_weight
order_item.remark = remarks 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 order_item.save
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server 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, auth_token:auth_token}.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, :timeout => 10) }, :timeout => 10)
rescue HTTParty::Error rescue HTTParty::Error
response = {"status": false, "message": "Can't open membership server " } response = {"status": false, "message": "Can't open membership server " }

View File

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

View File

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

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

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

View File

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

View File

@@ -34,7 +34,7 @@ class Customer < ApplicationRecord
}.to_json, }.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10) :timeout => 10)
rescue HTTParty::Error rescue HTTParty::Error
@@ -71,7 +71,7 @@ class Customer < ApplicationRecord
}.to_json, }.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :timeout => 10
) )
@@ -124,7 +124,7 @@ class Customer < ApplicationRecord
:body => member_params, :body => member_params,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}) })
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { status: false, message: "Server Time out" } response = { status: false, message: "Server Time out" }
@@ -201,7 +201,7 @@ class Customer < ApplicationRecord
}.to_json, }.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, :timeout => 10) }, :timeout => 10)
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" } response = { "status": false , "message": "Connect To" }
@@ -277,7 +277,7 @@ class Customer < ApplicationRecord
}.to_json, }.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, :timeout => 10) }, :timeout => 10)
rescue Net::OpenTimeout rescue Net::OpenTimeout
response = { "status": false , "message": "Connect To" } response = { "status": false , "message": "Connect To" }
@@ -312,7 +312,7 @@ class Customer < ApplicationRecord
}.to_json, }.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json; version=2' 'Accept' => 'application/json; version=3'
}, },
:timeout => 10 :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.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.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," + "(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" + mc.name as" +
" menu_category_name,mc.id as menu_category_id, si.remark as status_type, " menu_category_name,mc.id as menu_category_id, si.remark as status_type,
si.price as price ") si.price as price ")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -189,18 +189,27 @@
</div> </div>
<% end %> <% end %>
</div> </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> <script>
$(document).ready(function () { $(document).ready(function () {
setHeaderBreadCrumb(_DASHBOARD_); setHeaderBreadCrumb(_DASHBOARD_);
}); });
$(".cashier_view").on('click', function() { $(".cashier_view").on('click', function() {
window.location.href = '/origami'; window.location.href = '/origami';
}); });
$(".qs_view").on('click', function() { $(".qs_view").on('click', function() {
document.getElementById('second_view').click();
window.location.href = '/origami/quick_service'; window.location.href = '/origami/quick_service';
});
$("#second_view").on('click', function () {
var url = $(this).attr("data-href");
window.open(url,'_blank');
}); });
</script> </script>

View File

@@ -134,7 +134,7 @@
<div class="tab-pane dining" id="orders" role="tabpanel"> <div class="tab-pane dining" id="orders" role="tabpanel">
<div class="card-columns"> <div class="card-columns">
<% @orders.each do |order| %> <% @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"> <div class="card-block">
<% <%
order_status = "" order_status = ""
@@ -424,7 +424,7 @@
<i class="material-icons">reply</i> <i class="material-icons">reply</i>
<%= t("views.btn.back") %> <%= t("views.btn.back") %>
</button> </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="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> <button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<% if @dining.status != "available" %> <% if @dining.status != "available" %>
@@ -491,11 +491,11 @@
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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>
<div class="modal-body"> <div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" > <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> <option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %> <% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>"> <option value="<%= pay.payment_method %>">

View File

@@ -131,7 +131,7 @@
<div class="tab-pane active" id="orders" role="tabpanel" style=""> <div class="tab-pane active" id="orders" role="tabpanel" style="">
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @orders.each do |order| %> <% @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"> <div class="card-block">
<% <%
order_status = "" order_status = ""

View File

@@ -391,21 +391,23 @@
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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>
<div class="modal-body"> <div class="modal-body">
<input type="hidden" name="sale_receipt_no" id="sale_receipt_no"> <input type="hidden" name="sale_receipt_no" id="sale_receipt_no">
<input type="hidden" name="filename" id="filename"> <input type="hidden" name="filename" id="filename">
<input type="hidden" name="printer_name" id="printer_name"> <input type="hidden" name="printer_name" id="printer_name">
<p id="changed_amount"></p>
<div class="text-center"> <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> </div>
<div class="modal-footer "> <div class="modal-footer ">
<div class="row p-r-20"> <div class="row m-b-10 m-r-30">
<% if ENV["SERVER_MODE"] != 'cloud' %> <% 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> <button type="button" class="btn btn-link bg-red waves-effect print_receipt">Print</button>
</div> </div>
<% end %> <% end %>
@@ -424,27 +426,29 @@
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <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>
<div class="modal-body"> <div class="modal-body">
<div class="row text-center">
<input type="hidden" name="paypar_account_no" id="paypar_account_no" /> <input type="hidden" name="paypar_account_no" id="paypar_account_no" />
<input type="hidden" name="qr_code" id="qr_code" /> <input type="hidden" name="qr_code" id="qr_code" />
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"> <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> <button type="button" class="btn btn-lg btn-link bg-green waves-effect btn_customer_yes">Yes</button>
</div> </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> <button type="button" class="btn btn-lg btn-link bg-red waves-effect" data-dismiss="modal">No</button>
</div> </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> </div>
<div class="modal-footer"></div> <div class="modal-footer"></div>
@@ -453,7 +457,12 @@
</div> </div>
<div id="sxModal"> <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> </div>
<script type="text/javascript"> <script type="text/javascript">
@@ -463,7 +472,7 @@ var customer_name = "<%= @customer.name %>";
$(document).ready(function(){ $(document).ready(function(){
setHeaderBreadCrumb(_PAYMENTS_); setHeaderBreadCrumb(_PAYMENTS_);
//start customer modal popup //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')){ if((customer_id == 'CUS-000000000001') && (customer_name == 'WALK-IN')){
$("#is_memberModal").modal({show : true, backdrop: false, keyboard : false}); $("#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 if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
console.log("ssssssssssss") 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 (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide(); $("#credit_payment").hide();
@@ -601,7 +612,7 @@ var customer_name = "<%= @customer.name %>";
$("#printer_name").val(result.printer_name); $("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename); $("#receipt_pdf").attr("src", result.filename);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false}); $("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Payment Successful!"); $("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text(""); $("#changed_amount").text("");
if($('#balance').text() < 0){ if($('#balance').text() < 0){
<% if precision.to_i > 0 %> <% if precision.to_i > 0 %>
@@ -1100,4 +1111,8 @@ var customer_name = "<%= @customer.name %>";
}); });
}); });
} }
$("#sxModal .btn_cancel").on('click',function(){
$("#sxModal").hide();
});
</script> </script>

View File

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

View File

@@ -4,7 +4,7 @@
<div class="card"> <div class="card">
<div class="card-block"> <div class="card-block">
<div class="card-text" > <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"> <table class="table table-striped second_display_items" id="order-items-table">
<thead> <thead>
<tr> <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> <button type="button" class="hidden" id="s_reload">Reload</button>
<div class="slider" id="second_display_slider"> <div class="slider" id="second_display_slider">
<%= render '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 order_ids = [];
var arr_order_ids = [];
if(order_items!=undefined && order_items!=null){ if(order_items!=undefined && order_items!=null){
$.each(order_items,function(key,value){ $.each(order_items,function(key,value){
var orderIds = {};
if($.inArray(value.order_id,order_ids) == -1){ if($.inArray(value.order_id,order_ids) == -1){
order_ids.push(value.order_id); 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"; var ajax_url = "/origami/split_bills";
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
dataType: 'JSON', 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) { success: function (result) {
if (!result.status) { if (!result.status) {
swal("Information!", result.error_message); swal("Information!", result.error_message);
@@ -670,7 +689,7 @@ function orderSplitBillProcess(cnt_orders){
type: "POST", type: "POST",
url: ajax_url, url: ajax_url,
dataType: 'JSON', 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) { success: function (result) {
if (!result.status) { if (!result.status) {
swal("Information!", result.error_message); swal("Information!", result.error_message);

View File

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

View File

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

View File

@@ -6,7 +6,7 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
t.string :template t.string :template
t.string :font, :default => "" t.string :font, :default => ""
t.string :printer_name, :null => false t.string :printer_name, :null => false
t.string :api_settings, t.string :api_settings
t.string :brand_name t.string :brand_name
t.string :type t.string :type
t.decimal :page_width, :null => false, :default => 210 t.decimal :page_width, :null => false, :default => 210