diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 5b3142e6..3be2f34d 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -1434,16 +1434,16 @@ $(function() { row = '
' +'
' - +'
'+ menu_items[field].name +'
' - +"
'+ menu_items[field].name +'
' + +"
" - +"" + +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' style='padding:0px 5px 0px 5px'>" + +"" +add+ '' +'
' +'
' diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index d9b62131..929ffb13 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -56,24 +56,29 @@ section .content{ .nav-tabs .nav-item { border-bottom: 1px solid #fff; margin-left:2px; - + margin-right: -1.555rem; } #ul-navbar{ border-left: 1px solid #54A5AF; border-right: 1px solid #54A5AF; - + padding-right: 0px; } .nav > li > a{ color:#54A5AF; } +.nav-tabs > li > a { + color:#111 !important; +} .nav-tabs { - background-color: #eeeeee; + background-color: #ccc; } .nav-tabs .nav-link { - padding: 0.7286rem 0.2575 + padding: 0.7286rem 0.2575; + border-top-left-radius: 0rem; + border-top-right-radius: 0rem; } .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { - background-color: #fff; + background-color: #a1aade; border-left: 6px solid #111; color:#54A5AF; font-weight: bold; @@ -81,7 +86,7 @@ section .content{ } .sub_category_list{ background:#fff; - margin-top:8px; + margin-top:0px; } .sub_category_list > li{ list-style:none; @@ -274,4 +279,14 @@ i.logout_icon{ .set_add_icon{ display:none; +} + +.nav-tabs > li > a { + color:#111 !important; +} + + +.ls-closed section.content { + margin-left: 15px !important; + margin-right: 15px !important; } \ No newline at end of file diff --git a/app/controllers/api/restaurant/menu_controller.rb b/app/controllers/api/restaurant/menu_controller.rb index 011e4602..f6a43514 100755 --- a/app/controllers/api/restaurant/menu_controller.rb +++ b/app/controllers/api/restaurant/menu_controller.rb @@ -7,7 +7,10 @@ class Api::Restaurant::MenuController < Api::ApiController # checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp all_menu = Menu.all - + @request_url = '' + if ENV["SERVER_MODE"] == "cloud" + @request_url = request.subdomain + "." + request.domain #local_url => 'http://0.0.0.0:3000' + end # to hash menu_array = [] all_menu.each do |m| diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 1aa2738c..e23da859 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -19,7 +19,7 @@ class HomeController < ApplicationController def index # @employees = Employee.all_emp_except_waiter.order("name asc") - @employees = Employee.all.order("name asc") + @employees = Employee.all.where("is_active = true").order("name asc") @login_form = LoginForm.new() render "layouts/login_dashboard", layout: false end @@ -52,29 +52,33 @@ class HomeController < ApplicationController @employee = Employee.login(@login_form.emp_id, @login_form.password) if @employee != nil - if @employee.role == "administrator" - session[:session_token] = @employee.token_session - redirect_to dashboard_path - elsif @employee.role == "cashier" - session[:session_token] = @employee.token_session - route_by_role(@employee) - elsif @employee.role == "manager" - session[:session_token] = @employee.token_session - redirect_to dashboard_path - elsif @employee.role == "supervisor" - session[:session_token] = @employee.token_session - redirect_to origami_root_path - elsif @employee.role == "waiter" - session[:session_token] = @employee.token_session - redirect_to origami_dashboard_path - elsif @employee.role == "account" - session[:session_token] = @employee.token_session - redirect_to reports_dailysale_index_path - elsif @employee.role == "kitchen" - session[:session_token] = @employee.token_session - redirect_to oqs_root_path + if @employee.is_active + if @employee.role == "administrator" + session[:session_token] = @employee.token_session + redirect_to dashboard_path + elsif @employee.role == "cashier" + session[:session_token] = @employee.token_session + route_by_role(@employee) + elsif @employee.role == "manager" + session[:session_token] = @employee.token_session + redirect_to dashboard_path + elsif @employee.role == "supervisor" + session[:session_token] = @employee.token_session + redirect_to origami_root_path + elsif @employee.role == "waiter" + session[:session_token] = @employee.token_session + redirect_to origami_dashboard_path + elsif @employee.role == "account" + session[:session_token] = @employee.token_session + redirect_to reports_dailysale_index_path + elsif @employee.role == "kitchen" + session[:session_token] = @employee.token_session + redirect_to oqs_root_path + else + render :index + end else - render :index + redirect_to root_path, :notice => "This Employee is not active" end else redirect_to root_path, :notice => "Username and Password doesn't match!" diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index 9977850f..a633c9e1 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -18,42 +18,42 @@ class Origami::DashboardController < BaseOrigamiController # .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)') # @inventories = StockJournal.inventory_balances(today).sum(:balance) - @total_sale = Sale.total_sale(today) - @total_count = Sale.total_count(today) - @total_card = Sale.total_card_sale(today) - @total_credit = Sale.credit_payment(today) + @total_sale = Sale.total_sale(today,current_user) + @total_count = Sale.total_count(today,current_user) + @total_card = Sale.total_card_sale(today,current_user) + @total_credit = Sale.credit_payment(today,current_user) @sale_data = Array.new - @total_payment_methods = Sale.total_payment_methods(today) + @total_payment_methods = Sale.total_payment_methods(today,current_user) @total_payment_methods.each do |payment| if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" - pay = Sale.payment_sale('card', today) + pay = Sale.payment_sale('card', today, current_user) @sale_data.push({'card' => pay.payment_amount}) else - pay = Sale.payment_sale(payment.payment_method, today) + pay = Sale.payment_sale(payment.payment_method, today, current_user) @sale_data.push({payment.payment_method => pay.payment_amount}) end end - @summ_sale = Sale.summary_sale_receipt(today) - @total_customer = Sale.total_customer(today) - @total_dinein = Sale.total_dinein(today) - @total_takeaway = Sale.total_takeaway(today) - @total_other_customer = Sale.total_other_customer(today) - @total_membership = Sale.total_membership(today) + @summ_sale = Sale.summary_sale_receipt(today,current_user) + @total_customer = Sale.total_customer(today,current_user) + @total_dinein = Sale.total_dinein(today,current_user) + @total_takeaway = Sale.total_takeaway(today,current_user) + @total_other_customer = Sale.total_other_customer(today,current_user) + @total_membership = Sale.total_membership(today,current_user) - @total_order = Sale.total_order(today) - @total_accounts = Sale.total_account(today) + @total_order = Sale.total_order(today,current_user) + @total_accounts = Sale.total_account(today,current_user) @account_data = Array.new @total_accounts.each do |account| - acc = Sale.account_data(account.account_id, today) + acc = Sale.account_data(account.account_id, today,current_user) if !acc.nil? @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) end end - @top_items = Sale.top_items(today) - @total_foc_items = Sale.total_foc_items(today) + @top_items = Sale.top_items(today,current_user) + @total_foc_items = Sale.total_foc_items(today,current_user) # get printer info @print_settings = PrintSetting.get_precision_delimiter() diff --git a/app/controllers/settings/employees_controller.rb b/app/controllers/settings/employees_controller.rb index cefb7b9c..7b558ea1 100755 --- a/app/controllers/settings/employees_controller.rb +++ b/app/controllers/settings/employees_controller.rb @@ -68,6 +68,6 @@ class Settings::EmployeesController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def employee_params - params.require(:employee).permit(:name, :role, :emp_id, :password, :image_path) + params.require(:employee).permit(:name, :role, :is_active, :emp_id, :password, :image_path) end end diff --git a/app/views/api/restaurant/menu/_menu.json.jbuilder b/app/views/api/restaurant/menu/_menu.json.jbuilder index 8dcdf6fe..082b5f0a 100755 --- a/app/views/api/restaurant/menu/_menu.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu.json.jbuilder @@ -17,7 +17,7 @@ if (menu.menu_categories) if category.menu_items json.items category.menu_items do |item| - json.partial! 'api/restaurant/menu/menu_item', item: item + json.partial! 'api/restaurant/menu/menu_item', item: item, request_url: request_url end end end diff --git a/app/views/api/restaurant/menu/_menu_item.json.jbuilder b/app/views/api/restaurant/menu/_menu_item.json.jbuilder index 810daf6d..56a8cb5f 100755 --- a/app/views/api/restaurant/menu/_menu_item.json.jbuilder +++ b/app/views/api/restaurant/menu/_menu_item.json.jbuilder @@ -53,7 +53,11 @@ json.id item.id json.code item.item_code json.name item.name json.alt_name item.alt_name -json.image item.image_path.url +if !request_url.nil? && request_url != '' + json.image request_url + item.image_path.url.to_s +else + json.image item.image_path.url +end json.description item.description json.information item.information json.type item.type diff --git a/app/views/api/restaurant/menu/index.json.jbuilder b/app/views/api/restaurant/menu/index.json.jbuilder index 46f35e60..a230a965 100755 --- a/app/views/api/restaurant/menu/index.json.jbuilder +++ b/app/views/api/restaurant/menu/index.json.jbuilder @@ -5,7 +5,7 @@ menu_json = json.array! @menus do |menu| json.valid_time_from menu.valid_time_from.strftime("%H:%M") json.valid_time_to menu.valid_time_to.strftime("%H:%M") - json.partial! 'api/restaurant/menu/menu', menu: menu + json.partial! 'api/restaurant/menu/menu', menu: menu, request_url: @request_url # if (@current_menu) # json.current_menu do # json.partial! 'api/restaurant/menu/menu', menu: @current_menu diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 38d30fa8..0ba7f60b 100644 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -5,7 +5,7 @@ <% type = request.path_info.include?('quick_service')%> <% modify_order = request.path_info.include?('modify_order')%> -
+
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index ae7245a4..fb4824ec 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -570,8 +570,8 @@ var customer_name = "<%= @customer.name %>"; if ($("#server_mode").val() != "cloud") { // first bill not used in cloud payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); - console.log(payment_type) - console.log(parseInt(jQuery.inArray("MPU", payment_type))) + // console.log(payment_type) + // console.log(parseInt(jQuery.inArray("MPU", payment_type))) if (member_id && member_discount) { if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ $("#credit_payment").hide(); @@ -636,7 +636,7 @@ var customer_name = "<%= @customer.name %>"; $('#pay').click(function() { sub_total = $('#sub-total').text(); member = $('#membership_id').text(); - console.log(member) + // console.log(member) if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) { swal("Oops","Please Pay with MPU Payment","warning"); }else if(parseInt(jQuery.inArray("Redeem", payment_type)) != -1 && $('#ppamount').text()==0 && sub_total != 0.0 && member){ @@ -1195,7 +1195,7 @@ var customer_name = "<%= @customer.name %>"; url: url, data: {}, success: function (result) { - console.log(result) + // console.log(result) if (result.status == true) { createAccessCode(code); if (type == "edit") { @@ -1330,7 +1330,7 @@ var customer_name = "<%= @customer.name %>"; url: url, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, success: function (result) { - console.log(result) + // console.log(result) // For Server Print - from jade if ($("#server_mode").val() == "cloud") { code2lab.printFile(result.filepath.substr(6), result.printer_url); diff --git a/app/views/settings/employees/_form.html.erb b/app/views/settings/employees/_form.html.erb index ad50e9b8..70712c7b 100755 --- a/app/views/settings/employees/_form.html.erb +++ b/app/views/settings/employees/_form.html.erb @@ -7,6 +7,7 @@
<%= f.input :name %> + <%= f.input :is_active,:input_html=>{:class=>"col-md-9"} %> <% if current_user.role == "administrator" %> <%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %> <% else %>