Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2018-03-15 11:15:53 +06:30
18 changed files with 75 additions and 43 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

@@ -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

@@ -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"

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

@@ -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

@@ -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">
@@ -81,7 +82,7 @@
</div>
</div>
</nav>
<%end%>
<script type="text/javascript">
if((document.getElementById("otherPayment")!=undefined) && (document.getElementById("otherPayment")!=null) && (document.getElementById("otherPayment")!="")){
var otherPayment = location.href.split('/')[location.href.split('/').length -1 ];

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

@@ -189,15 +189,24 @@
</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>
$(".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

@@ -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' %>

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