pull from master 23.5.2018

This commit is contained in:
San Wai Lwin
2018-05-23 09:36:49 +06:30
parent f1733d9f06
commit dbfc00435b
12 changed files with 89 additions and 62 deletions

View File

@@ -1434,7 +1434,7 @@ $(function() {
row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">' row = '<div class="card custom-card testimonial-card fadeInRight" style="height:100%;background-image:url(../../'+image_path+');background-repeat: no-repeat;">'
+'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">' +'<div class="custom-card-head card-head row" style="line-height:14px;margin:0px;" style="">'
+'<div class="col-md-10 " style="padding-left:10px !important;">'+ menu_items[field].name +'</div>' +'<div class="col-md-10 " style="padding:0px !important;">'+ menu_items[field].name +'</div>'
+"<div class='col-md-2 "+menu_item_box+" ' data-item-code='" +"<div class='col-md-2 "+menu_item_box+" ' data-item-code='"
+ menu_items[field].code +"' data-instance = '" + menu_items[field].code +"' data-instance = '"
+JSON.stringify(menu_items[field].instances)+"' data-id = '" +JSON.stringify(menu_items[field].instances)+"' data-id = '"
@@ -1442,8 +1442,8 @@ $(function() {
+JSON.stringify(item_attributes)+"' data-option = '" +JSON.stringify(item_attributes)+"' data-option = '"
+JSON.stringify(menu_items[field].options)+"'data-opt = '" +JSON.stringify(menu_items[field].options)+"'data-opt = '"
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '" +JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >" +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' style='padding:0px 5px 0px 5px'>"
+"<i class='m-l--10 fa "+fa_plus+" '>" +"<i class='m-l--5 fa "+fa_plus+" '>"
+add+ '</i>' +add+ '</i>'
+'</div>' +'</div>'
+'</div>' +'</div>'

View File

@@ -56,24 +56,29 @@ section .content{
.nav-tabs .nav-item { .nav-tabs .nav-item {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
margin-left:2px; margin-left:2px;
margin-right: -1.555rem;
} }
#ul-navbar{ #ul-navbar{
border-left: 1px solid #54A5AF; border-left: 1px solid #54A5AF;
border-right: 1px solid #54A5AF; border-right: 1px solid #54A5AF;
padding-right: 0px;
} }
.nav > li > a{ .nav > li > a{
color:#54A5AF; color:#54A5AF;
} }
.nav-tabs > li > a {
color:#111 !important;
}
.nav-tabs { .nav-tabs {
background-color: #eeeeee; background-color: #ccc;
} }
.nav-tabs .nav-link { .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 { .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
background-color: #fff; background-color: #a1aade;
border-left: 6px solid #111; border-left: 6px solid #111;
color:#54A5AF; color:#54A5AF;
font-weight: bold; font-weight: bold;
@@ -81,7 +86,7 @@ section .content{
} }
.sub_category_list{ .sub_category_list{
background:#fff; background:#fff;
margin-top:8px; margin-top:0px;
} }
.sub_category_list > li{ .sub_category_list > li{
list-style:none; list-style:none;
@@ -275,3 +280,13 @@ i.logout_icon{
.set_add_icon{ .set_add_icon{
display:none; display:none;
} }
.nav-tabs > li > a {
color:#111 !important;
}
.ls-closed section.content {
margin-left: 15px !important;
margin-right: 15px !important;
}

View File

@@ -7,7 +7,10 @@ class Api::Restaurant::MenuController < Api::ApiController
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp # checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
all_menu = Menu.all 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 # to hash
menu_array = [] menu_array = []
all_menu.each do |m| all_menu.each do |m|

View File

@@ -19,7 +19,7 @@ class HomeController < ApplicationController
def index def index
# @employees = Employee.all_emp_except_waiter.order("name asc") # @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() @login_form = LoginForm.new()
render "layouts/login_dashboard", layout: false render "layouts/login_dashboard", layout: false
end end
@@ -52,6 +52,7 @@ class HomeController < ApplicationController
@employee = Employee.login(@login_form.emp_id, @login_form.password) @employee = Employee.login(@login_form.emp_id, @login_form.password)
if @employee != nil if @employee != nil
if @employee.is_active
if @employee.role == "administrator" if @employee.role == "administrator"
session[:session_token] = @employee.token_session session[:session_token] = @employee.token_session
redirect_to dashboard_path redirect_to dashboard_path
@@ -76,6 +77,9 @@ class HomeController < ApplicationController
else else
render :index render :index
end end
else
redirect_to root_path, :notice => "This Employee is not active"
end
else else
redirect_to root_path, :notice => "Username and Password doesn't match!" redirect_to root_path, :notice => "Username and Password doesn't match!"
end end

View File

@@ -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)') # .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) # @inventories = StockJournal.inventory_balances(today).sum(:balance)
@total_sale = Sale.total_sale(today) @total_sale = Sale.total_sale(today,current_user)
@total_count = Sale.total_count(today) @total_count = Sale.total_count(today,current_user)
@total_card = Sale.total_card_sale(today) @total_card = Sale.total_card_sale(today,current_user)
@total_credit = Sale.credit_payment(today) @total_credit = Sale.credit_payment(today,current_user)
@sale_data = Array.new @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| @total_payment_methods.each do |payment|
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" 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}) @sale_data.push({'card' => pay.payment_amount})
else 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}) @sale_data.push({payment.payment_method => pay.payment_amount})
end end
end end
@summ_sale = Sale.summary_sale_receipt(today) @summ_sale = Sale.summary_sale_receipt(today,current_user)
@total_customer = Sale.total_customer(today) @total_customer = Sale.total_customer(today,current_user)
@total_dinein = Sale.total_dinein(today) @total_dinein = Sale.total_dinein(today,current_user)
@total_takeaway = Sale.total_takeaway(today) @total_takeaway = Sale.total_takeaway(today,current_user)
@total_other_customer = Sale.total_other_customer(today) @total_other_customer = Sale.total_other_customer(today,current_user)
@total_membership = Sale.total_membership(today) @total_membership = Sale.total_membership(today,current_user)
@total_order = Sale.total_order(today) @total_order = Sale.total_order(today,current_user)
@total_accounts = Sale.total_account(today) @total_accounts = Sale.total_account(today,current_user)
@account_data = Array.new @account_data = Array.new
@total_accounts.each do |account| @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? if !acc.nil?
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
end end
end end
@top_items = Sale.top_items(today) @top_items = Sale.top_items(today,current_user)
@total_foc_items = Sale.total_foc_items(today) @total_foc_items = Sale.total_foc_items(today,current_user)
# get printer info # get printer info
@print_settings = PrintSetting.get_precision_delimiter() @print_settings = PrintSetting.get_precision_delimiter()

View File

@@ -68,6 +68,6 @@ class Settings::EmployeesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through. # Never trust parameters from the scary internet, only allow the white list through.
def employee_params 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
end end

View File

@@ -17,7 +17,7 @@ if (menu.menu_categories)
if category.menu_items if category.menu_items
json.items category.menu_items do |item| 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 end
end end

View File

@@ -53,7 +53,11 @@ json.id item.id
json.code item.item_code json.code item.item_code
json.name item.name json.name item.name
json.alt_name item.alt_name json.alt_name item.alt_name
if !request_url.nil? && request_url != ''
json.image request_url + item.image_path.url.to_s
else
json.image item.image_path.url json.image item.image_path.url
end
json.description item.description json.description item.description
json.information item.information json.information item.information
json.type item.type json.type item.type

View File

@@ -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_from menu.valid_time_from.strftime("%H:%M")
json.valid_time_to menu.valid_time_to.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) # if (@current_menu)
# json.current_menu do # json.current_menu do
# json.partial! 'api/restaurant/menu/menu', menu: @current_menu # json.partial! 'api/restaurant/menu/menu', menu: @current_menu

View File

@@ -5,7 +5,7 @@
<% type = request.path_info.include?('quick_service')%> <% type = request.path_info.include?('quick_service')%>
<% modify_order = request.path_info.include?('modify_order')%> <% modify_order = request.path_info.include?('modify_order')%>
<div class="container-fluid "> <div class="container-fluid " style="padding:0px 3px 0px 3px;">
<div id="oqs_loading_wrapper" style="display:none;"> <div id="oqs_loading_wrapper" style="display:none;">
<div id="oqs_loading"></div> <div id="oqs_loading"></div>
</div> </div>

View File

@@ -570,8 +570,8 @@ 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
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
console.log(payment_type) // console.log(payment_type)
console.log(parseInt(jQuery.inArray("MPU", payment_type))) // console.log(parseInt(jQuery.inArray("MPU", payment_type)))
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();
@@ -636,7 +636,7 @@ var customer_name = "<%= @customer.name %>";
$('#pay').click(function() { $('#pay').click(function() {
sub_total = $('#sub-total').text(); sub_total = $('#sub-total').text();
member = $('#membership_id').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) { if (parseInt(jQuery.inArray("MPU", payment_type)) != -1 && $('.mpu').text() == 0 && sub_total != 0.0 && member) {
swal("Oops","Please Pay with MPU Payment","warning"); 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){ }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, url: url,
data: {}, data: {},
success: function (result) { success: function (result) {
console.log(result) // console.log(result)
if (result.status == true) { if (result.status == true) {
createAccessCode(code); createAccessCode(code);
if (type == "edit") { if (type == "edit") {
@@ -1330,7 +1330,7 @@ var customer_name = "<%= @customer.name %>";
url: url, url: url,
data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code, data: "remark="+ remark + "&sale_id=" + sale_id+ "&access_code=" + access_code,
success: function (result) { success: function (result) {
console.log(result) // console.log(result)
// For Server Print - from jade // For Server Print - from jade
if ($("#server_mode").val() == "cloud") { if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath.substr(6), result.printer_url); code2lab.printFile(result.filepath.substr(6), result.printer_url);

View File

@@ -7,6 +7,7 @@
<div class="form-inputs p-l-15"> <div class="form-inputs p-l-15">
<%= f.input :name %> <%= f.input :name %>
<%= f.input :is_active,:input_html=>{:class=>"col-md-9"} %>
<% if current_user.role == "administrator" %> <% if current_user.role == "administrator" %>
<%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %> <%= f.input :role, :collection => Lookup.collection_of("employee_roles"),:class=>'form-group' %>
<% else %> <% else %>