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

This commit is contained in:
phyusin
2018-05-11 13:04:57 +06:30
37 changed files with 403 additions and 208 deletions

View File

@@ -188,6 +188,10 @@ Add Base URL for DOEMAL
1) settings/lookups => { type:order_reservation, name: BaseURL, value:'{doemal url}' }
2) settings/lookups => { type:order_reservation, name: Token, value:'{doemal token}' }
Add Feature for Dine-in Cashier
** '0' means can not use dine-in cashier and '1' means can use dine-in cashier **
=> settings/lookups => { type:dinein_cashier, name: DineInCashier, value:'{0 or 1}' }
Add Feature for Quick Service
** '0' means can not use quick service and '1' means can use quick service **
=> settings/lookups => { type:quick_service, name: QuickService, value:'{0 or 1}' }

View File

@@ -33,6 +33,7 @@ $(function() {
$("#accepted").on("click", function(){
if($(this).text().trim() == "ACCEPT"){
$("#status").text($(this).attr("data-value"));
var requested_time = $("#requested_date_time").text();
$("#requested_order_time").text(requested_time);
showTimePicker(requested_time);
@@ -65,14 +66,17 @@ $(function() {
var waiting_time = new Date(date_time+' '+$("#waiting_time").val());
// requested_time.setHours(requested_time.getHours() - 1);
// console.log(requested_time);
// console.log(date_time);
if(waiting_time.getTime() < requested_time.getTime()){
var time_diff = (requested_time.getTime() - waiting_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
}else{
$("#waiting_time").val("");
$("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
var time_diff = (waiting_time.getTime() - requested_time.getTime());
var expected_time = (Math.floor(time_diff) / 1000) / 60;
// $("#waiting_time").val("");
// $("#waiting_timeErr").text("Expected waiting time is greater than requested time!");
}
callback_url(callback,ref_no,order_id,status,expected_time,waiting_time);
});
});
@@ -278,9 +282,9 @@ function callback_url(callback,ref_no,order_id,status,time,exptime){
function timeFormat(date){
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
(isPM ? ' PM' : 'AM');
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM');
return time;
}

View File

@@ -247,4 +247,27 @@ i.logout_icon{
}
.list-menu > a:hover{
text-decoration: none;
}
.cashier_number{
width: 33%;
height:58px;
line-height:58px;
text-align:center;
background:#54A5AF;
// float:left;
// margin:2px;
font-size:20px;
color:white;
// cursor:pointer;
}
.border-top{
border-top:1px solid #fff;
}
.border-right{
border-right:1px solid #fff;
}
.border-left{
border-left:1px solid #fff;
}

View File

@@ -10,6 +10,7 @@
@import "BSBMaterial/style";
@import "BSBMaterial/themes/all-themes";
@import "reset";
@import "fileinput.min";
/* Reset */

View File

@@ -5,6 +5,7 @@ class BaseOrigamiController < ActionController::Base
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail, :current_token
@@ -14,18 +15,14 @@ class BaseOrigamiController < ActionController::Base
redirect_to origami_dashboard_path
end
def check_user
def check_user
if check_mobile
if current_user.nil?
return render status: 401, json: {
message: "User using other device!"
}.to_json
end
else
if ENV["SERVER_MODE"] != 'cloud'
protect_from_forgery with: :exception
end
else
if current_user.nil?
redirect_to root_path
end

View File

@@ -96,7 +96,7 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers
# POST /crm/customers.json
def create
def create
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
@crm_customers = Customer.new(customer_params)

View File

@@ -18,9 +18,6 @@ class Origami::AddordersController < BaseOrigamiController
if check_mobile
@webview = true
end
today = DateTime.now
day = Date.today.wday
@menus = Menu.all
@menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc')
@table_id = params[:id]

View File

@@ -56,6 +56,13 @@ class Origami::DashboardController < BaseOrigamiController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@current_user = current_user
#dine-in cashier
dinein_cashier = Lookup.collection_of('dinein_cashier')
@dinein_cashier = 0
if !dinein_cashier[0].nil?
@dinein_cashier = dinein_cashier[0][1]
end
#quick service
quick_service = Lookup.collection_of('quick_service')
@quick_service = 0

View File

@@ -132,7 +132,7 @@ class Origami::HomeController < BaseOrigamiController
def check_emp_access_code
pin_code = params[:code]
employee = Employee.find_by_emp_id(pin_code)
if employee && employee.role == "manager"
if employee && (employee.role == "manager" || employee.role == "supervisor")
result = {:status=> true, :message=>"Success" }
else
result = {:status=> false, :message=>"Invalid Access Code" }

View File

@@ -1,7 +1,7 @@
class Origami::OrderReservationController < BaseOrigamiController
def index
@order = OrderReservation.latest_order
@order = OrderReservation.latest_order #.active
@count_on_order = OrderReservation.get_count_on_order
end

View File

@@ -15,12 +15,11 @@ class Origami::OtherChargesController < BaseOrigamiController
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
else
@table = nil
end
end
end
end
def create
def create
sale_id = params[:sale_id]
other_charges_items = JSON.parse(params[:other_charges_items])
sub_total = params[:sub_total]
@@ -79,8 +78,6 @@ class Origami::OtherChargesController < BaseOrigamiController
if !table.nil?
dining = {:table_id => table_id, :table_type => table.type }
render :json => dining.to_json
end
end
end
end
end

View File

@@ -279,6 +279,9 @@ class Origami::PaymentsController < BaseOrigamiController
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
@sale_data.grand_total = new_total
@sale_data.old_grand_total = saleObj.grand_total
@sale_data.rounding_adjustment = @rounding_adj
else
@rounding_adj = @sale_data.rounding_adjustment
end

View File

@@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord
end
#Print order_item in 1 slip per item
def print_slip_item(oqs, assigned_item)
def print_slip_item(oqs, order, assigned_items)
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
@@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord
end
end
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
if !assigned_items.nil?
assigned_items.each do |order_item|
order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" )
end
end
# update print status for completed same order items
assigned_order_item.each do |ai|
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
ai.print_status=true
ai.save
end

View File

@@ -7,6 +7,7 @@ class OrderReservation < ApplicationRecord
has_many :order_reservation_items
has_one :delivery
scope :active, -> { where("created_at BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") }
scope :latest_order, -> { order("order_reservation_id desc, created_at desc") }
SEND_TO_KITCHEN = "send_to_kitchen"
@@ -218,7 +219,7 @@ class OrderReservation < ApplicationRecord
def self.check_order_send_to_kitchen
today = Time.now.utc
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}'")
order_reservation = OrderReservation.where("status='accepted' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_send_to_kitchen_channel",data: order_reservation
@@ -228,7 +229,7 @@ class OrderReservation < ApplicationRecord
def self.check_order_ready_to_delivery
today = Time.now.utc
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}'")
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time > '#{today}' and expected_waiting_time < '#{today}'")
if order_reservation.length > 0
if ENV["SERVER_MODE"] == 'cloud'
ActionCable.server.broadcast "check_order_ready_to_delivery_channel",data: order_reservation

View File

@@ -4,8 +4,8 @@ class OrderSetItemPdf < Prawn::Document
def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width
self.page_height = print_settings.page_height
self.header_font_size = printer_settings.header_font_size.to_i
self.item_font_size = printer_settings.item_font_size.to_i
self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0
self.price_width = 40 # No Need for item
self.qty_width = 40

View File

@@ -206,7 +206,6 @@ class ReceiptBillPdf < Prawn::Document
total_price = item.price #item.qty*item.unit_price - comment for room charges
price = item.unit_price
product_name = item.product_name
total_qty += item.qty
y_position = cursor

View File

@@ -19,6 +19,10 @@ class CommissionerImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -19,6 +19,10 @@ class CustomerImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -19,6 +19,10 @@ class EmployeeImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -19,6 +19,10 @@ class MenuItemImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -19,6 +19,10 @@ class ProductImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -19,6 +19,10 @@ class ShopImageUploader < CarrierWave::Uploader::Base
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def filename
"#{Shop.find(1).shop_code}_#{original_filename}" if original_filename.present?
end
# def cache_dir
# '/tmp/images'
# end

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -185,7 +185,7 @@ $(document).on('click',".customer_tr",function(){
url: url,
data: {},
dataType: "json",
success: function(data) {
success: function(data) {
// Selected for Taxes
var taxes = JSON.stringify(data.tax_profiles);
var parse_taxes = JSON.parse(taxes);
@@ -193,7 +193,7 @@ $(document).on('click',".customer_tr",function(){
$("#customer_tax_profiles option[value='" + value + "']").attr("selected","selected").css({'color':'#fff','background':'#215d9c'});
});
$('#customer_id').val(data.id);
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no);
@@ -205,6 +205,9 @@ $(document).on('click',".customer_tr",function(){
$('#paypar_account_no').val(data.paypar_account_no);
$('#customer_address').val(data.address);
$('#customer_date_of_birth').val(data.date_of_birth);
if(data.image_path.url!=undefined && data.image_path.url!=null){
$('.menu-item-img .img-thumbnail').attr('src',data.image_path.url);
}
$('#customer_membership_type').val(data.membership_type);
$('.selectpicker > option[value="'+data.membership_type+'"]').attr('selected','selected');
if (data.gender == 'Male') {

View File

@@ -1,4 +1,4 @@
json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth,
:membership_id, :membership_type, :membership_authentication_code,
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :tax_profiles
:salutation, :gender,:nrc_no,:address,:card_no, :paypar_account_no, :customer_type, :image_path, :tax_profiles
json.url crm_customer_url(@crm_customer, format: :json)

View File

@@ -43,46 +43,46 @@
<a class="nav-link" data-toggle="tab" href="" role="tab">Products</a>
</li>
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%> " data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<% else %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</ul>
<% if !menu.valid_time.nil? %>
<% if menu.menu_category_id.nil? %>
<!--if type quick_service or cashier for table -->
<% if type %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class="sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- else quick_service or cashier for table -->
<% else %>
<% if @table.get_current_checkout_booking.nil? %>
<% if !menu.code.include? "SPL" %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%> " data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<% else %>
<li class="nav-item menu_category sub_click first_<%=menu.id%>" data-id="<%=menu.id%>" data-sub-id="<%=menu.get_sub_category%>">
<p class="hidden menu-id"><%= menu.id %></p>
<a class="nav-link" data-toggle="tab" href="" role="tab"> <%= menu.name%>
<ul class=" sub_category_list hidden fadeInTop animated" id="sub_category_list">
</ul>
</a>
</li>
<% end%>
<!-- end quick_service or cashier for table -->
<% end %>
<% end%>
<% end %>
<%end %>
</ul>
</div>
</div>
@@ -313,7 +313,7 @@
<div class="col-md-3 cashier_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 cashier_number border-top border-left" data-value="00" data-type="num">00</div>
<div class="col-md-3 cashier_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 cashier_number border-top border-left bg-orange" data-type="clr">Clr</div>
</div>
</div>
<div class="modal-footer">

View File

@@ -207,6 +207,21 @@
<%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.customer_photo") %></label>
<div class="panel padding-10">
<div class="menu-item-img">
<% if f.object.image_path? %>
<p><%= f.object.name %></p>
<%= image_tag f.object.image_path.url, :class => "img-thumbnail" %>
<% else %>
<%= image_tag "/image/menu_images/default.png", :class => "img-thumbnail" %>
<% end %>
</div>
<%= f.file_field :image_path, :class => "img-thumbnail" %>
</div>
</div>
<div class="form-group">
<label><%= t("views.right_panel.detail.select_customer_type") %></label>
<select class="form-control col-md-12" id="customer_type" name="customer[customer_type]" style="height: 40px" >

View File

@@ -28,6 +28,7 @@
</div>
</div>
<% end %>
<% if @dinein_cashier == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 cashier_view">
<div class="info-box bg-green">
<div class="icon" >
@@ -36,6 +37,7 @@
<div class="text font-20 m-l-5" style="line-height: 80px;"><%= t :dine_in_cashier %></div>
</div>
</div>
<% end %>
<% if @order_reservation == '1' %>
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12 order_reservation">
<div class="info-box bg-blue">

View File

@@ -487,8 +487,13 @@
<% if current_login_employee.role != "waiter" %>
<!-- <button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button> -->
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
<% end %>
<% end %>
<% if current_login_employee.role != "waiter" %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>

View File

@@ -355,13 +355,13 @@
</td>
</tr>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">ADDRESS</span><br>
<b id="address"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">
<td colspan="2" class="body-td align-left">
<span class="font-13">DELEVERY</span><br>
<b id="delivery_to"></b>
</td>
@@ -378,7 +378,7 @@
</div>
</div>
</div>
</div>
<p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p>
@@ -411,4 +411,6 @@
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>
<div id="notify_order_ready_to_delivery"></div>
</div>

View File

@@ -350,20 +350,30 @@
<i class="material-icons">reply</i>
Back
</button>
<!-- <button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<!-- -->
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
<a class="btn btn-block bg-deep-purple waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
<% else %>
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="waste" value="waste" id="btn_waste" onclick="waste_and_spoilage('waste')">Waste</button>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button> -->
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="foc"> FOC</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="waste"> Waste</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="spoile"> Spoile</a>
<button type="button" class="btn btn-block bg-deep-purple waves-effect " data-status="spoile" value="spoile" id="btn_spoile" onclick="waste_and_spoilage('spoile')">Spoile</button>
<% end %>
<% if @cashier_type=="quick_service" %>
<hr>
<button type="button" id="survey" class="btn btn-block bg-blue waves-effect"><%= t("views.right_panel.detail.survey") %></button>
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect" >Customer</button>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="edit">Edit</a>
<% else %>
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
<% end %>
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
<!-- Waiter Buttons -->

View File

@@ -198,13 +198,74 @@
<!-- Column Three -->
<div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale.sale_status != 'void' %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %>
<% if @sale.sale_status != 'void' %>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<% else %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %>
<% end %>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
</div>
</div>
</div>
<div class="modal fade" id="AccessCodeModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="AccessCodeModalLabel">Enter Access Code</h4>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
<div class="col-md-3 access_number border-top border-left" data-value="3" data-type="num">3</div>
<div class="col-md-3 access_number border-top border-left" data-value="4" data-type="num">4</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="5" data-type="num">5</div>
<div class="col-md-3 access_number border-top border-left" data-value="6" data-type="num">6</div>
<div class="col-md-3 access_number border-top border-left" data-value="7" data-type="num">7</div>
<div class="col-md-3 access_number border-top border-left" data-value="8" data-type="num">8</div>
</div>
<div class="row bottom p-l-15 p-r-15">
<div class="col-md-3 access_number border-top border-left" data-value="9" data-type="num">9</div>
<div class="col-md-3 access_number border-top border-left" data-value="0" data-type="num">0</div>
<div class="col-md-3 access_number border-top border-left orange" data-type="clr">Clr</div>
<div class="col-md-3 access_number ok border-top border-left blue" data-type="ok" data-action="">OK</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
</div>
<div class="modal-body">
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
</div>
<div class="col-md-5">
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$(".tables").on('click', function(){
@@ -247,7 +308,14 @@ $('#back').on('click',function(){
// // });
// }
// });
$(document).on('click', '.access_modal', function(event){
type = $(this).data("type");
$(".ok").attr("data-action",type)
$('#AccessCodeModal').modal('show');
});
$('#void').on('click', function () {
var access_code = localStorage.getItem("access_code");
swal({
title: "Alert",
text: "Are you sure want to Void?",
@@ -259,10 +327,12 @@ $('#back').on('click',function(){
}, function (isConfirm) {
if (isConfirm) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
var ajax_url = "/origami/sale/" + sale_id +'/'+'cashier'+ '/void';
// var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
data: {'access_code':access_code},
success: function () {
window.location.href = '/origami/sale/'+sale_id;
}
@@ -271,10 +341,52 @@ $('#back').on('click',function(){
});
});
function check_emp_access_code(access_code,type) {
var url = "/origami/check_emp_access_code/" + access_code ;
$.ajax({
type: 'POST',
url: url,
data: {},
success: function (result) {
console.log(result)
if (result.status == true) {
createAccessCode(code);
if (type == "edit") {
var dining_id = $('#dining').text();
var sale_id = $('#sale_id').text();
if (dining_id) {
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
}else{
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
}
}else if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
// overall_void();
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');
// overall_foc();
}
}else{
swal("Opps",result.message,"warning")
}
}
});
}
$('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
// return false;
});
</script>

View File

@@ -5,52 +5,77 @@
<table class="table table-striped" border="0">
<h5 class="p-l-10 p-t-10">Report For <%= @sale_type? @sale_type : 'Waste' %></h5>
<% @sale_data.each do |sale| %>
<% receipt_arr = Array.new %>
<% menu_cat_arr = Array.new %>
<% footer_arr = Array.new %>
<% count = 0 %>
<% waste_and_spoil_item_count = 0%>
<thead>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td ><strong>Item Name</strong></td>
<td ><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
<% @sale_data.each do |sale| %>
<% if !receipt_arr.include?(sale.receipt_no) %>
<thead>
<td>&nbsp;</td>
<tr>
<td >
<strong>Receipt No :<%= sale.receipt_no %></strong>
</td>
<td></td>
<td></td>
<td colspan="3" style="text-align:right"><strong>Date : <%= sale.created_at.utc.getlocal.strftime("%e,%b %Y %I:%M %p") %></strong></td>
</tr>
<tr>
<td><strong>Menu Category</strong></td>
<td><strong>Item Name</strong></td>
<td><strong>Item Code</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total Price</strong></td>
</tr>
</thead>
<% receipt_arr.push(sale.receipt_no) %>
<% menu_cat_arr.clear %>
<% count = 0 %>
<% end %>
<% sale.sale_items.each do |item| %>
<% if !item.item_instance_code.nil?%>
<% waste_and_spoil_item_count += item.qty.to_i%>
<tr>
<td><%= item.product_name %></td>
<td><%= item.product_code %></td>
<td><%= item.qty %></td>
<td><%= item.price %></td>
<td><%= item.price %></td>
</tr>
<% end %>
<% end %>
<tr>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td><span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
</tbody>
<% end %>
<tbody>
<% if !sale.item_instance_code.nil?%>
<% waste_and_spoil_item_count += sale.qty.to_i %>
<tr>
<% if !menu_cat_arr.include?(sale.name) %>
<td><%= sale.name %></td>
<% menu_cat_arr.push(sale.name) %>
<% else %>
<td>&nbsp;</td>
<% end %>
<td><%= sale.product_name %></td>
<td><%= sale.product_code %></td>
<td><%= sale.qty.to_i %></td>
<td><%= sale.unit_price %></td>
<td><%= sale.price %></td>
</tr>
<% end %>
<% count = count + 1 %>
<% if sale.sale_items.count == count %>
<tr>
<td></td>
<td colspan="2" style="text-align:right"> <strong>Total Qty: </strong></td>
<td>
<span class="underline" style="text-align:right">
<strong><%= waste_and_spoil_item_count %></strong>
<% waste_and_spoil_item_count = 0%>
</span></td>
<td style="text-align:right"> <strong>Grand Total: </strong></td>
<td >
<span class="underline" style="text-align:right">
<strong><%= sale.grand_total %></strong>
</span>
</td>
</tr>
<% footer_arr.push(sale.sale_id) %>
<% end %>
</tbody>
<% end %>
</table>
</div>
</div>

View File

@@ -1,7 +0,0 @@
redis: &redis
adapter: redis
url: redis://localhost:6379/1
production: *redis
development: *redis
test: *redis

View File

@@ -8,7 +8,7 @@ class ActionController::Base
from = request.subdomain.downcase + "." + request.domain.downcase
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
if (!@license.nil?)
logger.info "Location - " + @license.dbhost
logger.info "Location - " + @license.dbschema
ActiveRecord::Base.establish_connection(website_connection(@license))
# authenticate_session_token
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
@@ -97,7 +97,7 @@ class ActionController::API
from = request.subdomain.downcase + "." + request.domain.downcase
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
if (!@license.nil?)
# logger.info "Location - " + @license.dbhost
logger.info "Location - " + @license.dbschema
ActiveRecord::Base.establish_connection(website_connection(@license))
# authenticate_session_token
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema

View File

@@ -1,48 +0,0 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View File

@@ -14,14 +14,14 @@ every 1.minutes do
runner "DiningFacility.checkin_time"
end
every 3.minutes do
every 10.minutes do
runner "OrderReservation.check_new_order"
end
every 5.minutes do
every 10.minutes do
runner "OrderReservation.check_order_send_to_kitchen"
end
every 5.minutes do
every 10.minutes do
runner "OrderReservation.check_order_ready_to_delivery"
end