Merge branch 'adminbsb_material_ui'
This commit is contained in:
@@ -198,6 +198,18 @@ select.form-control {
|
|||||||
background-color: blue !important;
|
background-color: blue !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected-payment {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: blue !important;
|
||||||
|
}
|
||||||
|
.payment_btn {
|
||||||
|
white-space: normal !important;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
margin-right: 15px;
|
||||||
|
color:#fff !important;
|
||||||
|
# background-color: green !important;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reciept Style */
|
/* Reciept Style */
|
||||||
#order-charges-table td {
|
#order-charges-table td {
|
||||||
border-top: none !important;
|
border-top: none !important;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::CommissionersController < ApplicationController
|
class Settings::CommissionersController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /commissioners
|
# GET /commissioners
|
||||||
# GET /commissioners.json
|
# GET /commissioners.json
|
||||||
@@ -82,7 +83,11 @@ class Settings::CommissionersController < ApplicationController
|
|||||||
end
|
end
|
||||||
render json: @transactions
|
render json: @transactions
|
||||||
end
|
end
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_commissioner
|
def set_commissioner
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::CommissionsController < ApplicationController
|
class Settings::CommissionsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /commissions
|
# GET /commissions
|
||||||
# GET /commissions.json
|
# GET /commissions.json
|
||||||
@@ -68,6 +69,12 @@ class Settings::CommissionsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_commission
|
def set_commission
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::OrderQueueStationsController < ApplicationController
|
class Settings::OrderQueueStationsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /settings/order_queue_stations
|
# GET /settings/order_queue_stations
|
||||||
# GET /settings/order_queue_stations.json
|
# GET /settings/order_queue_stations.json
|
||||||
@@ -67,6 +68,12 @@ class Settings::OrderQueueStationsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_settings_order_queue_station
|
def set_settings_order_queue_station
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::ProductsController < ApplicationController
|
class Settings::ProductsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
|
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /settings/products
|
# GET /settings/products
|
||||||
# GET /settings/products.json
|
# GET /settings/products.json
|
||||||
@@ -65,6 +66,12 @@ load_and_authorize_resource except: [:create]
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_settings_product
|
def set_settings_product
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::PromotionProductsController < ApplicationController
|
class Settings::PromotionProductsController < ApplicationController
|
||||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
||||||
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /promotion_products
|
# GET /promotion_products
|
||||||
# GET /promotion_products.json
|
# GET /promotion_products.json
|
||||||
@@ -63,6 +64,12 @@ class Settings::PromotionProductsController < ApplicationController
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_promotion
|
def set_promotion
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Settings::PromotionsController < ApplicationController
|
class Settings::PromotionsController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
|
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /promotions
|
# GET /promotions
|
||||||
# GET /promotions.json
|
# GET /promotions.json
|
||||||
@@ -119,6 +120,12 @@ class Settings::PromotionsController < ApplicationController
|
|||||||
render json: res
|
render json: res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_promotion
|
def set_promotion
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Transactions::CreditNotesController < ApplicationController
|
class Transactions::CreditNotesController < ApplicationController
|
||||||
|
|
||||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /transactions/sales
|
# GET /transactions/sales
|
||||||
# GET /transactions/sales.json
|
# GET /transactions/sales.json
|
||||||
@@ -25,12 +26,18 @@ class Transactions::CreditNotesController < ApplicationController
|
|||||||
@credit_notes = 0
|
@credit_notes = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
puts "sssssssssssss"
|
|
||||||
puts @credit_notes.to_json
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @credit_notes }
|
format.json { render json: @credit_notes }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
class Transactions::OrdersController < ApplicationController
|
class Transactions::OrdersController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
@@ -39,4 +41,10 @@ class Transactions::OrdersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Transactions::SalesController < ApplicationController
|
class Transactions::SalesController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
# GET /transactions/sales
|
# GET /transactions/sales
|
||||||
# GET /transactions/sales.json
|
# GET /transactions/sales.json
|
||||||
@@ -147,6 +148,12 @@ class Transactions::SalesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_transactions_sale
|
def set_transactions_sale
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class Transactions::ShiftSalesController < ApplicationController
|
class Transactions::ShiftSalesController < ApplicationController
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy]
|
before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :check_user
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
@@ -53,6 +54,12 @@ class Transactions::ShiftSalesController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_user
|
||||||
|
if current_user.nil?
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_transactions_shift_sale
|
def set_transactions_shift_sale
|
||||||
|
|||||||
@@ -526,16 +526,17 @@
|
|||||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment Method</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>
|
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||||
<% @payment_methods.each do |pay| %>
|
<% @payment_methods.each do |pay| %>
|
||||||
<option value="<%= pay.payment_method %>">
|
<!-- <option value="<%= pay.payment_method %>">
|
||||||
<%= pay.payment_method %>
|
<%= pay.payment_method %>
|
||||||
</option>
|
</option> -->
|
||||||
|
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||||
<%end %>
|
<%end %>
|
||||||
|
|
||||||
</select>
|
<!-- </select> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer p-r-30">
|
<div class="modal-footer p-r-30">
|
||||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
@@ -735,11 +736,27 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// click select option icon for add
|
||||||
|
$(document).on('click', '.payment_btn', function(event){
|
||||||
|
active = $(this).hasClass('selected-payment');
|
||||||
|
value = $(this).data('value');
|
||||||
|
type = $(this).data('type');
|
||||||
|
group = $(this).data('group');
|
||||||
|
payments = $(".payment_btn");
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
$(this).removeClass('selected-payment');
|
||||||
|
}else{
|
||||||
|
$(this).addClass('selected-payment');
|
||||||
|
}
|
||||||
|
}); //End selecct attribute buttom
|
||||||
|
|
||||||
$(".choose_payment").on('click', function () {
|
$(".choose_payment").on('click', function () {
|
||||||
$( "#loading_wrapper").show();
|
$( "#loading_wrapper").show();
|
||||||
|
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
type = $('.payment_method').val();
|
// type = $('.payment_method').val();
|
||||||
|
type = get_selected_attributes('selected-payment');
|
||||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||||
calculate_member_discount(sale_id,"Card");
|
calculate_member_discount(sale_id,"Card");
|
||||||
@@ -985,4 +1002,16 @@
|
|||||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get Selected Class
|
||||||
|
function get_selected_attributes(selected_class) {
|
||||||
|
var item_row = $('.'+selected_class);
|
||||||
|
var attribute_arr = [];
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
value = $(item_row[i]).attr('data-value');
|
||||||
|
str = value;
|
||||||
|
attribute_arr.push(str);
|
||||||
|
});
|
||||||
|
return attribute_arr;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -489,16 +489,13 @@
|
|||||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
<button class='btn waves-effect payment_btn green' data-type='Credit' data-value='Credit'>Credit</button>
|
||||||
<option value="Cash">Cash</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 %>">
|
||||||
<%= pay.payment_method %>
|
<%= pay.payment_method %>
|
||||||
</option>
|
</option> -->
|
||||||
|
<button class='btn btn-lg waves-effect payment_btn green' data-type='<%= pay.payment_method %>' data-value='<%= pay.payment_method %>'><%= pay.payment_method %></button>
|
||||||
<%end %>
|
<%end %>
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer p-r-30">
|
<div class="modal-footer p-r-30">
|
||||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
@@ -680,6 +677,21 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// click select option icon for add
|
||||||
|
$(document).on('click', '.payment_btn', function(event){
|
||||||
|
active = $(this).hasClass('selected-payment');
|
||||||
|
value = $(this).data('value');
|
||||||
|
type = $(this).data('type');
|
||||||
|
group = $(this).data('group');
|
||||||
|
payments = $(".payment_btn");
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
$(this).removeClass('selected-payment');
|
||||||
|
}else{
|
||||||
|
$(this).addClass('selected-payment');
|
||||||
|
}
|
||||||
|
}); //End selecct attribute buttom
|
||||||
|
|
||||||
// Print for first bill
|
// Print for first bill
|
||||||
$("#first_bill").on('click', function(){
|
$("#first_bill").on('click', function(){
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
@@ -704,7 +716,9 @@ $(".choose_payment").on('click', function () {
|
|||||||
$( "#loading_wrapper").show();
|
$( "#loading_wrapper").show();
|
||||||
|
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
type = $('.payment_method').val();
|
type = get_selected_attributes('selected-payment');
|
||||||
|
|
||||||
|
// type = $('.payment_method').val();
|
||||||
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||||
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1) {
|
||||||
calculate_member_discount(sale_id,"Card");
|
calculate_member_discount(sale_id,"Card");
|
||||||
@@ -954,4 +968,15 @@ $('#add_invoice').on('click',function(){
|
|||||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/"+dining_id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Get Selected Class
|
||||||
|
function get_selected_attributes(selected_class) {
|
||||||
|
var item_row = $('.'+selected_class);
|
||||||
|
var attribute_arr = [];
|
||||||
|
$(item_row).each(function(i){
|
||||||
|
value = $(item_row[i]).attr('data-value');
|
||||||
|
str = value;
|
||||||
|
attribute_arr.push(str);
|
||||||
|
});
|
||||||
|
return attribute_arr;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user