merge with master
This commit is contained in:
4
Gemfile
4
Gemfile
@@ -48,7 +48,6 @@ gem 'prawn'
|
||||
gem 'prawn-table'
|
||||
gem 'spreadsheet'
|
||||
gem 'to_xls-rails'
|
||||
|
||||
#Reporting gem
|
||||
#gem 'compendium'
|
||||
#gem "cancan"
|
||||
@@ -81,7 +80,6 @@ gem 'kaminari', '~> 1.0.1'
|
||||
gem 'filterrific'
|
||||
|
||||
gem 'cancancan', '~> 1.10'
|
||||
|
||||
#pageless no need for current
|
||||
# gem 'will_paginate'
|
||||
# gem 'pageless-rails', github: 'rorlab/pageless-rails'
|
||||
@@ -129,4 +127,4 @@ gem 'momentjs-rails' # for date-range selector
|
||||
# gem 'bootstrap-datepicker-rails' # date picker
|
||||
# gem 'jquery-datetimepicker-rails'
|
||||
# gem 'select2-rails' # for multi-select and auto-complete select box
|
||||
gem "chartkick" #chart lib
|
||||
gem "chartkick" #chart lib
|
||||
22
README.md
22
README.md
@@ -132,12 +132,34 @@ ADD COLUMN image_path VARCHAR(255);
|
||||
|
||||
ALTER TABLE sales
|
||||
ADD COLUMN equal_persons INT(11) after rebate_status;
|
||||
|
||||
ALTER TABLE sale_items
|
||||
ADD COLUMN remark VARCHAR(255) after status;
|
||||
|
||||
ALTER TABLE shops
|
||||
ADD COLUMN shop_code VARCHAR(255) after name,
|
||||
ADD COLUMN client_name VARCHAR(255) after shop_code,
|
||||
ADD COLUMN client_code VARCHAR(255) after client_name;
|
||||
|
||||
ALTER TABLE print_settings
|
||||
ADD COLUMN brand_name VARCHAR(255) after api_settings,
|
||||
ADD COLUMN type VARCHAR(255) after brand_name;
|
||||
|
||||
ALTER TABLE tax_profiles
|
||||
ADD COLUMN group_type VARCHAR(255) after name;
|
||||
|
||||
<---- Extra Fields Script ----->
|
||||
For CloseCashierCustomisePdf in lookups
|
||||
*** change CloseCashierPdf to CloseCashierCustomisePdf
|
||||
1) settings/print_settings
|
||||
2) settings/lookups => { type:print_settings, name: CloseCashierCustomisePdf, value:1 }
|
||||
|
||||
/* Tax Profile Group Types in lookups */
|
||||
1) settings/lookups => { type:tax_profiles, name: Cashier, value:cashier }
|
||||
2) settings/lookups => { type:tax_profiles, name: Quick Service, value: quick_service }
|
||||
3) settings/lookups => { type:tax_profiles, name: Doemal, value: doemal }
|
||||
/* Tax Profile Group Types in lookups */
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -180,7 +180,6 @@ $(function() {
|
||||
image_path = "image/logo.png";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
row = '<div class="card custom-card testimonial-card animated 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="">'
|
||||
@@ -190,6 +189,7 @@ $(function() {
|
||||
+JSON.stringify(menu_items[field].instances)+"' data-id = '"
|
||||
+JSON.stringify(menu_items[field].attributes)+"' data-item = '"
|
||||
+JSON.stringify(item_attributes)+"' data-option = '"
|
||||
+JSON.stringify(menu_items[field].options)+"'data-opt = '"
|
||||
+JSON.stringify(menu_items[field].options)+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >"
|
||||
+"<i class='fa "+fa_plus+" '>"
|
||||
@@ -202,7 +202,8 @@ $(function() {
|
||||
+ price +"' data-instance-code = '"+ code +"' data-instance = '"
|
||||
+ name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '"
|
||||
+ JSON.stringify(item_attributes) +"' data-options = '"
|
||||
+ options +"' data-image='"+image_path+"' data-toggle='"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-opt = '"
|
||||
+ JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='"
|
||||
+data_modal+"' data-target='."+data_target+"' data-item-sets = '"
|
||||
+JSON.stringify(menu_items[field].item_sets)+"'data-instances = '"
|
||||
+JSON.stringify(menu_items[field].instances)+"'>"
|
||||
@@ -237,10 +238,10 @@ $(function() {
|
||||
//instances = $(this).data('instance');
|
||||
item_sets = $(this).data('item-sets');
|
||||
instances = $(this).data('instances');
|
||||
// item_sets = $(data).attr('data-item-sets');
|
||||
item_options = $(this).data('options');
|
||||
|
||||
for(var field in item_sets) {
|
||||
|
||||
|
||||
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
|
||||
|
||||
value = item_sets[field]["instances"];
|
||||
@@ -283,10 +284,20 @@ $(function() {
|
||||
});
|
||||
}
|
||||
|
||||
for(var j in item_options) {
|
||||
value = item_options[j]["values"];
|
||||
type = item_options[j]["type"];
|
||||
row = "<h4>"+type+"</h4>"
|
||||
$(value).each(function(i){
|
||||
row +="<button class='btn btn- waves-effect option_btn "+ type +"' data-type='"
|
||||
+type+"' data-value='"+value[i]+"' data-group='set_menu_default'>"+value[i]+"</button>";
|
||||
});
|
||||
$(".options-list").append(row);
|
||||
}
|
||||
$('.set-item').attr('data-code',instances[0]['code']);
|
||||
$('.set-item').attr('data-name',instances[0]['name']);
|
||||
$('.set-item').attr('data-price',instances[0]['price']);
|
||||
$('.set-item').attr('data-options','[]');
|
||||
$('.set-item').attr('data-options','');
|
||||
$('.set-item').attr('data-parent',true);
|
||||
|
||||
$('#set_change_qty').val(1);
|
||||
@@ -341,6 +352,7 @@ $(function() {
|
||||
sub_total = $('#set_total_price').text();
|
||||
name = $(this).data('name');
|
||||
price = $(this).data('price');
|
||||
options = $(this).attr('data-options','');
|
||||
// qty = $('#set_change_qty').val();
|
||||
qty = document.getElementById("set_count").value;
|
||||
total = qty*price;
|
||||
@@ -369,52 +381,48 @@ $(function() {
|
||||
|
||||
item = get_set_item(items);
|
||||
customer_display_view(item,"set_add");
|
||||
|
||||
var option = ''
|
||||
attribute_arr = []
|
||||
option_arr = []
|
||||
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
option_arr = []
|
||||
code = $('.set-item').attr('data-code');
|
||||
name = $('.set-item').attr('data-name');
|
||||
price = $('.set-item').attr('data-price');
|
||||
option = $('.set-item').attr('data-options');
|
||||
option = ($('.set-item').attr('data-options') === 'undefined') ? '' :$('.set-item').attr('data-options');
|
||||
parent = $('.set-item').attr('data-parent');
|
||||
total = qty * price ;
|
||||
option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option_arr+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
|
||||
+option+"' data-row ='"+rowCount+ "' data-parent ='"+parent+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + option +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
+'</td>'
|
||||
+'</tr>';
|
||||
$(".summary-items tbody").append(row);
|
||||
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var set_option = ''
|
||||
$(items).each(function(i){
|
||||
code = $(items[i]).attr('data-code');
|
||||
name = $(items[i]).attr('data-name');
|
||||
price = $(items[i]).attr('data-price');
|
||||
option = $(items[i]).attr('data-options');
|
||||
set_option = ($(items[i]).attr('data-options') === 'undefined') ? ' ' :$(items[i]).attr('data-options');
|
||||
|
||||
sub_item = $(items[i]).attr('data-sub-item');
|
||||
option = $(items[i]).attr('data-options');
|
||||
total = qty * price ;
|
||||
option_arr.push(option);
|
||||
row ="<tr class='item_box' data-price ='"
|
||||
+price+ "' data-toggle='modal' data-target='#sx_itemModal' 'data-instance ='"
|
||||
+name+ "' data-code='"+item_code+"' data-instance-code='"
|
||||
+code+"' data-attributes='"
|
||||
+attribute_arr+"' data-options ='"
|
||||
+option_arr+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||
+set_option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + item_name+ ' ' + name +' ' + set_option +'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(total).toFixed(2)
|
||||
@@ -626,8 +634,6 @@ $(function() {
|
||||
|
||||
|
||||
if(group == "set_menu"){
|
||||
code = $(this).data('code');
|
||||
value = $(this).data('value');
|
||||
|
||||
instance = $(".selected-instance");
|
||||
$(instance).each(function(i){
|
||||
@@ -638,6 +644,12 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(group == "set_menu_default"){
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
$('.set-item').attr('data-options',JSON.stringify(option_arr));
|
||||
$('.set_default_option').text(option_arr);
|
||||
}
|
||||
|
||||
}); //End selecct attribute buttom
|
||||
|
||||
@@ -650,7 +662,6 @@ $(function() {
|
||||
|
||||
attribute_arr = get_selected_attributes('selected-attribute');
|
||||
option_arr = get_selected_attributes('selected-option');
|
||||
|
||||
if (item_row.length>0) {
|
||||
var instances = jQuery.parseJSON(item_row.attr('data-instances'));
|
||||
|
||||
@@ -691,7 +702,7 @@ $(function() {
|
||||
var item_data = $(this);
|
||||
item = get_item(item_data);
|
||||
customer_display_view(item,"add");
|
||||
show_item_detail(item_data);
|
||||
show_item_detail(item_data,"add_to_order");
|
||||
calculate_sub_total();
|
||||
|
||||
}); //End add order Click
|
||||
@@ -701,11 +712,11 @@ $(function() {
|
||||
var item_data = $(this);
|
||||
item = get_item(item_data);
|
||||
customer_display_view(item,"add");
|
||||
show_item_detail(item_data);
|
||||
show_item_detail(item_data,"add_icon");
|
||||
calculate_sub_total();
|
||||
}); //End Add Icon Click
|
||||
|
||||
function show_item_detail(data){
|
||||
function show_item_detail(data,click_type){
|
||||
|
||||
qty = parseInt(data.attr('data-qty'));
|
||||
append = 0;
|
||||
@@ -717,23 +728,26 @@ $(function() {
|
||||
}else{
|
||||
instance = "("+data.attr('data-instance')+")";
|
||||
}
|
||||
|
||||
d_option = data.attr('data-options');
|
||||
if (d_option){
|
||||
option_name = "-"+data.attr('data-options');
|
||||
d_option = data.attr('data-opt');
|
||||
if (click_type != "add_icon"){
|
||||
option_name = "-"+data.attr('data-options');
|
||||
data_option = data.attr('data-options') ;
|
||||
}else{
|
||||
option_name = '';
|
||||
option_name = ' ';
|
||||
data_option = '[]';
|
||||
}
|
||||
|
||||
|
||||
var rowCount = $('.summary-items tbody tr').length+1;
|
||||
var item_row = $('.summary-items tbody tr');
|
||||
|
||||
$(item_row).each(function(i){
|
||||
item_code = $(item_row[i]).attr('data-code');
|
||||
instance_code = $(item_row[i]).attr('data-instance-code');
|
||||
r_option = $(item_row[i]).attr('data-options');
|
||||
|
||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option==d_option) {
|
||||
r_option = $(item_row[i]).attr('data-opt');
|
||||
console.log(r_option)
|
||||
console.log(d_option)
|
||||
if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) {
|
||||
if (qty > 1) {
|
||||
qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty;
|
||||
}else{
|
||||
@@ -757,9 +771,10 @@ $(function() {
|
||||
+instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='"
|
||||
+data.attr('data-instance-code')+"' data-attributes='"
|
||||
+data.attr('data-attributes')+"' data-options ='"
|
||||
+data_option+"' data-opt ='"
|
||||
+data.attr('data-options')+"' data-row ='"+rowCount+ "'>"
|
||||
+'<td class="item-cell-no">'+rowCount+'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +' ' + option_name +'</td>'
|
||||
+'<td class="item-cell-name" id="item_name" >' + data.attr('data-name')+ ' ' + instance +''+option_name+'</td>'
|
||||
+'<td class="item-cell-qty" id="item_qty">' + qty + '</td>'
|
||||
+'<td class="item-cell-price" id="item_price">'
|
||||
+ parseFloat(price).toFixed(2)
|
||||
@@ -813,8 +828,6 @@ $(function() {
|
||||
data: params,
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
console.log(type)
|
||||
console.log(table_type)
|
||||
if (type == "quick_service") {
|
||||
window.location.href = "/origami/quick_service"
|
||||
}else{
|
||||
@@ -880,7 +893,7 @@ $(function() {
|
||||
dataType: "json",
|
||||
success:function(result){
|
||||
if (result.status) {
|
||||
console.log(result)
|
||||
|
||||
if (result.data == null){
|
||||
swal({
|
||||
title: "Please Open Shift !",
|
||||
|
||||
@@ -67,7 +67,8 @@ class Api::OrdersController < Api::ApiController
|
||||
end
|
||||
}
|
||||
#end extra time
|
||||
|
||||
puts params[:order_items]
|
||||
puts "ITEM aaaaaaaaaaaaaaaaaaa"
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
17
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
17
app/controllers/oqs/edit_controller.rb
Executable file → Normal file
@@ -6,6 +6,11 @@ class Oqs::EditController < BaseOqsController
|
||||
if params[:type] == 'oqs'
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'")
|
||||
elsif
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
@booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id")
|
||||
.where("bko.order_id = '#{assigned_item.order_id}'").first()
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'")
|
||||
else
|
||||
assigned_item = OrderItem.find(assigned_item_id)
|
||||
dining = DiningFacility.find_by_id(params[:type])
|
||||
@@ -25,13 +30,6 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.item_order_by = current_user.name
|
||||
order_item.qty = qty_weight
|
||||
order_item.remark = remarks
|
||||
if !order_item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(order_item.set_menu_items)
|
||||
instance_item_sets.each_with_index do |instance_item, instance_index|
|
||||
instance_item_sets[instance_index]["quantity"] = qty_weight
|
||||
end
|
||||
order_item.set_menu_items = instance_item_sets.to_json
|
||||
end
|
||||
order_item.save
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
@@ -67,4 +65,9 @@ class Oqs::EditController < BaseOqsController
|
||||
end
|
||||
end
|
||||
|
||||
#Shop Name in Navbor
|
||||
helper_method :shop_detail
|
||||
def shop_detail
|
||||
@shop = Shop.first
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,10 +94,10 @@ class Origami::AddordersController < BaseOrigamiController
|
||||
extra_time = Time.at(time)
|
||||
end
|
||||
end
|
||||
if i["parent_order_item_id"]
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]}
|
||||
if i["parent_order_item_id"];
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])}
|
||||
else
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]}
|
||||
items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])}
|
||||
end
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
@@ -74,16 +74,6 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@date = order.created_at
|
||||
@booking= booking
|
||||
order.order_items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
item.price = item.price.to_f + instance_item["price"].to_f
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
@order_items.push(item)
|
||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||
# if !assigned_order_items.nil?
|
||||
|
||||
@@ -113,7 +113,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
#end rounding adjustment
|
||||
|
||||
puts "sale"
|
||||
puts saleObj.to_json
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, current_user.name, cash, "cash")
|
||||
|
||||
@@ -161,12 +163,24 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||
member_info = Customer.get_member_account(customer)
|
||||
if member_info["status"] == true
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||
current_balance = SaleAudit.paymal_search(sale_id)
|
||||
end
|
||||
|
||||
#orders print out
|
||||
if params[:type] == "quick_service"
|
||||
booking = Booking.find_by_sale_id(sale_id)
|
||||
if booking.dining_facility_id.to_i>0
|
||||
table_id = booking.dining_facility_id
|
||||
else
|
||||
table_id = 0
|
||||
end
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
Order.pay_process_order_queue(order.order_id,table_id)
|
||||
end
|
||||
end
|
||||
|
||||
#for card sale data
|
||||
card_data = Array.new
|
||||
card_sale_trans_ref_no = Sale.getCardSaleTrans(sale_id)
|
||||
|
||||
@@ -68,16 +68,6 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@date = order.created_at
|
||||
@booking = booking
|
||||
order.order_items.each do |item|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
arr_instance_item_sets = Array.new
|
||||
instance_item_sets.each do |instance_item|
|
||||
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
|
||||
arr_instance_item_sets.push(item_instance_name)
|
||||
item.price = item.price.to_f + instance_item["price"].to_f
|
||||
end
|
||||
item.set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
@order_items.push(item)
|
||||
# assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
|
||||
# if !assigned_order_items.nil?
|
||||
|
||||
@@ -3,6 +3,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
end
|
||||
|
||||
def show
|
||||
@type = params[:type]
|
||||
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||
#for bank integration
|
||||
bank_integration = Lookup.collection_of('bank_integration')
|
||||
|
||||
@@ -6,6 +6,13 @@ class Settings::MenusController < ApplicationController
|
||||
# GET /settings/menus.json
|
||||
def index
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
# format.csv { send_data MenuCsvExport.generate }
|
||||
|
||||
format.csv { send_data Menu.to_csv }
|
||||
# format.csv { send_data MenuCategory.to_csv }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /settings/menus/1
|
||||
@@ -67,6 +74,11 @@ class Settings::MenusController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def import
|
||||
Menu.import(params[:file])
|
||||
redirect_to settings_menu_path, notice: "imported"
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_menu
|
||||
|
||||
@@ -6,6 +6,18 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
# GET /settings/tax_profiles.json
|
||||
def index
|
||||
@settings_tax_profiles = TaxProfile.all
|
||||
tax_profiles = Lookup.collection_of("tax_profiles")
|
||||
if !@settings_tax_profiles.nil?
|
||||
@settings_tax_profiles.each_with_index do |setting_tax_profile, tax_index|
|
||||
if !tax_profiles.nil?
|
||||
tax_profiles.each do |group|
|
||||
if setting_tax_profile.group_type == group[1]
|
||||
@settings_tax_profiles[tax_index].group_type = group[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /settings/tax_profiles/1
|
||||
@@ -15,11 +27,19 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
|
||||
# GET /settings/tax_profiles/new
|
||||
def new
|
||||
@name = nil
|
||||
@settings_tax_profile = TaxProfile.new
|
||||
@tax_profiles = TaxProfile.all
|
||||
end
|
||||
|
||||
# GET /settings/tax_profiles/1/edit
|
||||
def edit
|
||||
@settings_tax_profile = TaxProfile.find(params[:id])
|
||||
@name = nil
|
||||
if !@settings_tax_profile.nil?
|
||||
@name = @settings_tax_profile.name
|
||||
end
|
||||
@tax_profiles = TaxProfile.all
|
||||
end
|
||||
|
||||
# POST /settings/tax_profiles
|
||||
@@ -69,10 +89,20 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_tax_profile
|
||||
@settings_tax_profile = TaxProfile.find(params[:id])
|
||||
tax_profiles = Lookup.collection_of("tax_profiles")
|
||||
if !@settings_tax_profile.nil?
|
||||
if !tax_profiles.nil?
|
||||
tax_profiles.each do |group|
|
||||
if @settings_tax_profile.group_type == group[1]
|
||||
@settings_tax_profile.group_type = group[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_tax_profile_params
|
||||
params.require(:tax_profile).permit(:name, :rate, :inclusive, :order_by, :created_by)
|
||||
params.require(:tax_profile).permit(:name, :group_type, :rate, :inclusive, :order_by, :created_by)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,11 +21,12 @@ class Transactions::OrdersController < ApplicationController
|
||||
@receipt_no = filter
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
end
|
||||
format.html
|
||||
format.json { render json: @orders }
|
||||
# format.csv { send_data OrdersCsvExport.generate }
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -31,4 +31,22 @@ class Menu < ApplicationRecord
|
||||
menu.destroy
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
def self.to_csv
|
||||
m_attributes = %w{name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at}
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << m_attributes
|
||||
menu = Menu.all
|
||||
menu.each do |user|
|
||||
csv << m_attributes.map{ |attr| user.send(attr)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.import(file)
|
||||
CSV.foreach(file.path, headers:true) do |row|
|
||||
Menu.create! row.to_hash
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
class MenuCategory < ApplicationRecord
|
||||
# before_create :generate_menu_category_code
|
||||
|
||||
belongs_to :menu
|
||||
belongs_to :menu , counter_cache: true
|
||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
|
||||
has_many :menu_items
|
||||
@@ -83,4 +83,19 @@ class MenuCategory < ApplicationRecord
|
||||
# def generate_menu_category_code
|
||||
# self.code = SeedGenerator.generate_code(self.class.name, "C")
|
||||
# end
|
||||
|
||||
def self.to_csv
|
||||
|
||||
mc_attributes = %w{id menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at}
|
||||
CSV.generate(headers: true) do |csv|
|
||||
csv << mc_attributes
|
||||
|
||||
csv << mc_attributes
|
||||
MenuCategory.all.each do |user|
|
||||
puts user
|
||||
csv << mc_attributes.map{ |attr| user.send(attr)}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -135,7 +135,7 @@ class Order < ApplicationRecord
|
||||
|
||||
#loop to add all items to order
|
||||
ordered_list.each do |item|
|
||||
|
||||
|
||||
menu_item = MenuItem.search_by_item_code(item[:item_instance_code])
|
||||
|
||||
# For Product while item code not in menu item
|
||||
@@ -152,7 +152,7 @@ class Order < ApplicationRecord
|
||||
item[:sub_items].each do |si|
|
||||
# Retrive instance's Price
|
||||
set_item = MenuItem.search_by_item_code(si[:item_instance_code])
|
||||
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "quantity"=>si[:quantity], "price"=>set_item[:price]})
|
||||
set_order_items.push({"item_instance_code"=>si[:item_instance_code], "item_instance_name"=>set_item[:name], "quantity"=>si[:quantity], "price"=>set_item[:price], "options"=>si[:options]})
|
||||
end
|
||||
end
|
||||
set_order_items = set_order_items.to_json
|
||||
@@ -339,17 +339,17 @@ class Order < ApplicationRecord
|
||||
#Process order items and send to order queue
|
||||
def self.pay_process_order_queue(id,table_id)
|
||||
sidekiq = Lookup.find_by_lookup_type("sidekiq")
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
order = Order.find(id)
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, table_id)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
if !sidekiq.nil?
|
||||
OrderQueueProcessorJob.perform_later(id, table_id)
|
||||
else
|
||||
order = Order.find(id)
|
||||
if order
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, table_id)
|
||||
end
|
||||
assign_order = AssignedOrderItem.assigned_order_item_by_job(id)
|
||||
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
|
||||
end
|
||||
end
|
||||
|
||||
def check_cup_status(status)
|
||||
|
||||
@@ -5,7 +5,8 @@ class OrderItem < ApplicationRecord
|
||||
before_create :generate_custom_id
|
||||
|
||||
#Associations
|
||||
belongs_to :order, autosave: true
|
||||
belongs_to :order, autosave: true
|
||||
# belongs_to :order, counter_cache: true
|
||||
|
||||
#Validation
|
||||
validates_presence_of :item_code, :item_name, :qty
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class TaxProfile < ApplicationRecord
|
||||
default_scope { order('order_by asc') }
|
||||
# validations
|
||||
validates_presence_of :name, :rate
|
||||
validates_presence_of :name, :rate, :group_type
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ class OrderItemPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if order_item.dining.to_i > 0
|
||||
if !order_item.dining.nil?
|
||||
text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
2
app/pdf/order_item_slim_pdf.rb
Normal file → Executable file
2
app/pdf/order_item_slim_pdf.rb
Normal file → Executable file
@@ -37,7 +37,7 @@ class OrderItemSlimPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if order_item_slim.dining.to_i > 0
|
||||
if !order_item_slim.dining.nil?
|
||||
text "#{ order_item_slim.type + '-' + order_item_slim.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
2
app/pdf/order_set_item_pdf.rb
Normal file → Executable file
2
app/pdf/order_set_item_pdf.rb
Normal file → Executable file
@@ -37,7 +37,7 @@ class OrderSetItemPdf < Prawn::Document
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
#font "public/fonts/Chinese.ttf"
|
||||
if order_set_item.dining.to_i > 0
|
||||
if !order_set_item.dining.nil?
|
||||
text "#{ order_set_item.type + '-' + order_set_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
@@ -36,7 +36,8 @@ class OrderSummaryPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
if order[0].dining.to_i > 0
|
||||
|
||||
if !order[0].dining.nil?
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
2
app/pdf/order_summary_set_pdf.rb
Normal file → Executable file
2
app/pdf/order_summary_set_pdf.rb
Normal file → Executable file
@@ -36,7 +36,7 @@ class OrderSummarySetPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
if order[0].dining.to_i > 0
|
||||
if !order[0].dining.nil?
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
2
app/pdf/order_summary_slim_pdf.rb
Normal file → Executable file
2
app/pdf/order_summary_slim_pdf.rb
Normal file → Executable file
@@ -36,7 +36,7 @@ class OrderSummarySlimPdf < Prawn::Document
|
||||
|
||||
# font "public/fonts/Zawgyi-One.ttf"
|
||||
# font "public/fonts/padauk.ttf"
|
||||
if order[0].dining.to_i > 0
|
||||
if !order[0].dining.nil?
|
||||
text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
else
|
||||
text "#{ print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20
|
||||
|
||||
@@ -46,9 +46,12 @@ if (@booking)
|
||||
child_spent += (item.price * item.qty)
|
||||
end
|
||||
# End YGN BBQ
|
||||
json.order_items_id item.order_items_id
|
||||
json.order_id item.order_id
|
||||
json.item_code item.item_code
|
||||
json.item_instance_code item.item_instance_code
|
||||
json.item_name item.item_name
|
||||
json.set_menu_items item.set_menu_items
|
||||
json.price item.price
|
||||
json.qty item.qty
|
||||
json.options item.options
|
||||
|
||||
4
app/views/oqs/edit/index.html.erb
Executable file → Normal file
4
app/views/oqs/edit/index.html.erb
Executable file → Normal file
@@ -112,6 +112,8 @@ $(document).ready(function(){
|
||||
var remarks = $("textarea[name='remarks']").val();
|
||||
var order_items_id = $(this).attr('data-id');
|
||||
var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks }
|
||||
var booking_id = '<%= @booking.booking_id %>';
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/oqs/' + order_items_id,
|
||||
@@ -121,6 +123,8 @@ $(document).ready(function(){
|
||||
<% if !@link_type.nil? %>
|
||||
<% if @link_type == 'oqs' %>
|
||||
window.location.href = '/oqs';
|
||||
<% elsif @link_type == 'pending' %>
|
||||
window.location.href = '/origami/quick_service/pending_order/'+booking_id;
|
||||
<% else %>
|
||||
<% if !@dining_type.nil? %>
|
||||
<% if @dining_type == 'Table' %>
|
||||
|
||||
@@ -375,7 +375,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="row set-item">
|
||||
<div class="col-md-4">
|
||||
<p style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
<p class="set_default_option" style="text-align: center;"> <%= image_tag "logo.png" ,width: '', height: '', :id => 'logo' %></p>
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-md-6" style="margin-top:5px">Quantity</label>
|
||||
<input type="number" name="qty" class="form-control col-md-5 input-number change_qty" id="set_change_qty" value="" min="1" max="100">
|
||||
|
||||
@@ -241,7 +241,7 @@ $('#cash_out').on('click',function(){
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/close';
|
||||
var linkURL = '/origami/shift/cashier/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
})
|
||||
|
||||
|
||||
@@ -292,9 +292,26 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -371,9 +388,26 @@
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
|
||||
22
app/views/origami/pending_order/index.html.erb
Normal file → Executable file
22
app/views/origami/pending_order/index.html.erb
Normal file → Executable file
@@ -34,7 +34,9 @@
|
||||
<i class="material-icons">reply</i>
|
||||
<%= t("views.btn.back") %>
|
||||
</button>
|
||||
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,4 +53,22 @@
|
||||
$('#back').on('click', function () {
|
||||
window.location.href = '/origami/quick_service';
|
||||
})
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<strong id="order-title"> PENDING ORDER </strong>
|
||||
@@ -100,7 +100,7 @@
|
||||
@order_items.each do |order_item|
|
||||
sub_total = sub_total + order_item.price %>
|
||||
<input type="hidden" id="sale_id" value="<%= @bookings.booking_id %>">
|
||||
<tr>
|
||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
||||
<td class='item-name'><%= order_item.item_name %></td>
|
||||
<td class='item-attr'><%= order_item.qty %></td>
|
||||
<td class='item-attr'><%= order_item.price %></td>
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- Column Three -->
|
||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
|
||||
<% if current_user.role != "waiter" || @status != "sale"%>
|
||||
<button type="button" id="addorder" class="btn bg-blue btn-block">Add Order</button>
|
||||
@@ -167,6 +167,9 @@
|
||||
<% if @status != "sale"%>
|
||||
<button type="button" id="request_bills" class="btn btn-block bg-blue waves-effect">Req.Bill</button>
|
||||
<%end%>
|
||||
<% if current_user.role != "waiter" %>
|
||||
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -203,12 +206,11 @@ $(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 {
|
||||
window.location.href = '../pending_order/'+ result.data;
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -269,5 +271,31 @@ $(document).ready(function(){
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#close_cashier').on('click',function(e){
|
||||
e.preventDefault(); // Prevent the href from redirecting directly
|
||||
var linkURL = '/origami/shift/quick_service/close';
|
||||
warnBeforeRedirect(linkURL);
|
||||
});
|
||||
|
||||
function warnBeforeRedirect(linkURL) {
|
||||
swal({
|
||||
title: "Alert!",
|
||||
text: "Are you sure you want to close cashier?",
|
||||
type: "warning",
|
||||
showCancelButton: true
|
||||
}, function() {
|
||||
// Redirect the user
|
||||
window.location.href = linkURL;
|
||||
});
|
||||
}
|
||||
|
||||
/*edit order in oqs*/
|
||||
$('.edit_order').on('click',function(){
|
||||
var assigned_order_item_id = $(this).attr('data-id');
|
||||
if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){
|
||||
window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -277,9 +277,26 @@
|
||||
<td><%= count %></td>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
@@ -345,9 +362,26 @@
|
||||
<td><%= count %>
|
||||
<td class='item-name'>
|
||||
<%= order_item.item_name %>
|
||||
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
|
||||
<% JSON.parse(order_item.options).each do |option| %>
|
||||
<br><span class="font-13">
|
||||
<%= option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !order_item.set_menu_items.nil?
|
||||
order_item.set_menu_items.each do |item_instance| %>
|
||||
<br><span class="font-13"><%= item_instance %></span>
|
||||
JSON.parse(order_item.set_menu_items).each do |item_instance| %>
|
||||
<br><span class="font-13">
|
||||
<%= item_instance["item_instance_name"] %>
|
||||
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
|
||||
<% (item_instance["options"]).each do |set_item_option| %>
|
||||
<br><span class="font-13">
|
||||
<%= set_item_option %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<% end
|
||||
end %>
|
||||
</td>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var type = '<%= @type %>';
|
||||
$('#close_cashier').on('click',function(){
|
||||
var amount = $('#closing_balance_amount').val();
|
||||
var shift_id = "<%= @shift.id rescue ""%>"
|
||||
@@ -72,7 +73,11 @@
|
||||
});
|
||||
|
||||
$('#back').on('click',function(){
|
||||
window.location.href = '/origami';
|
||||
if(type!='quick_service'){
|
||||
window.location.href = '/origami';
|
||||
}else{
|
||||
window.location.href = '/origami/quick_service';
|
||||
}
|
||||
});
|
||||
|
||||
/** start CB Card Settle process **/
|
||||
@@ -90,7 +95,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/shift/close';
|
||||
window.location.href = '/origami/shift/'+type+'/close';
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -115,7 +120,7 @@
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/shift/close';
|
||||
window.location.href = '/origami/shift/'+type+'/close';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
9
app/views/origami/split_bill/index.html.erb
Executable file → Normal file
9
app/views/origami/split_bill/index.html.erb
Executable file → Normal file
@@ -53,12 +53,14 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% order_item_count = 0 %>
|
||||
<% if !@order_items.nil? %>
|
||||
<% sub_total = 0 %>
|
||||
<% @order_items.each do |order_item| %>
|
||||
<% if order_item.include? ('all_order') %>
|
||||
<% order_item['all_order'].each do |odr_item| %>
|
||||
<%
|
||||
order_item_count = order_item_count.to_i + 1
|
||||
sub_total += odr_item['qty'].to_f * odr_item['price'].to_f
|
||||
%>
|
||||
<tr class="item-row" id=<%= odr_item['order_items_id'] %> >
|
||||
@@ -385,10 +387,9 @@
|
||||
|
||||
//order_item_split
|
||||
$('#order_item_split').on('click',function () {
|
||||
var cnt_order_item = "<%= @order_items.count %>";
|
||||
var cnt_order_item = "<%= order_item_count %>";
|
||||
var order_items = get_selected_order_items();// Selected Order Items
|
||||
|
||||
var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length);
|
||||
var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length);
|
||||
if (order_items.length > 0){
|
||||
// if(cnt_items > 0){
|
||||
swal({
|
||||
@@ -423,6 +424,7 @@
|
||||
$.each(orders, function(key,value){
|
||||
if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){
|
||||
$("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item');
|
||||
$(".item-row").removeClass('selected-split-item');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -621,6 +623,7 @@ function orderItemSplitBillProcess(cnt_items){
|
||||
if(cnt_items == 0){
|
||||
booking_id = json_booking.booking_id;
|
||||
}
|
||||
console.log(booking_id);
|
||||
|
||||
var order_ids = [];
|
||||
var arr_order_ids = [];
|
||||
|
||||
2
app/views/reports/product_sale/index.html.erb
Normal file → Executable file
2
app/views/reports/product_sale/index.html.erb
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
<div class="page-header">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="<%= dashboard_path %>"><%= t("views.right_panel.button.home") %></a></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.sale_item_report") %></li>
|
||||
<li class="breadcrumb-item active"><%= t("views.right_panel.detail.product_sale_report") %></li>
|
||||
<span class="float-right">
|
||||
<%= link_to 'Back', dashboard_path %>
|
||||
</span>
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
</span>
|
||||
</ol>
|
||||
</div>
|
||||
<!-- <h4>Import</h4>
|
||||
<%= form_tag import_settings_menus_path, multipart:true do%>
|
||||
<%=file_field_tag :file%>
|
||||
<%=submit_tag "Import CSV"%>
|
||||
<%end%> -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-2 col-lg-2">
|
||||
<br><br>
|
||||
|
||||
@@ -8,14 +8,16 @@
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs p-l-15">
|
||||
<%= f.input :name %>
|
||||
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
|
||||
<%= f.input :name, :input_html=>{:onchange=>"checkDuplicate(this.value);"} %>
|
||||
<span id="tax_profile_nameErr" style="color:red;"></span>
|
||||
<%= f.input :rate %>
|
||||
<%= f.input :inclusive %>
|
||||
<%= f.input :order_by %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions p-l-15">
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
|
||||
<%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect btn_submit' %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -45,5 +47,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function checkDuplicate(obj){
|
||||
// $("#tax_profile_nameErr").html("");
|
||||
var name = '<%= @name %>';
|
||||
var tax_profiles = JSON.parse('<%= @tax_profiles.to_json.html_safe %>');
|
||||
var group_type = $("#tax_profile_group_type").val();
|
||||
if(tax_profiles!=undefined && tax_profiles!=null && tax_profiles!=""){
|
||||
$.each(tax_profiles,function(key,value){
|
||||
if(value.group_type == group_type){
|
||||
if(name.trim().toLowerCase()!=value.name.trim().toLowerCase()){
|
||||
if(value.name.trim().toLowerCase() == obj.trim().toLowerCase()){
|
||||
$("#tax_profile_name").val("");
|
||||
$("#tax_profile_nameErr").html("duplicate group type and name");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.group_type") %></th>
|
||||
<th><%= t("views.right_panel.detail.name") %></th>
|
||||
<th><%= t("views.right_panel.detail.rate") %></th>
|
||||
<th><%= t("views.right_panel.detail.inclusive") %></th>
|
||||
@@ -29,6 +30,7 @@
|
||||
<tbody>
|
||||
<% @settings_tax_profiles.each do |settings_tax_profile| %>
|
||||
<tr>
|
||||
<td><%= settings_tax_profile.group_type %></td>
|
||||
<td><%= settings_tax_profile.name %></td>
|
||||
<td><%= settings_tax_profile.rate %></td>
|
||||
<td><%= settings_tax_profile.inclusive %></td>
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><%= t("en.tax_profile") %></h4>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.group_type") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.group_type %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong><%= t("views.right_panel.detail.name") %>:</strong></td>
|
||||
<td><%= @settings_tax_profile.name %></td>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require_relative 'boot'
|
||||
|
||||
require 'csv'
|
||||
require 'rails/all'
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
@@ -19,5 +20,7 @@ module SXRestaurants
|
||||
config.active_record.time_zone_aware_types = [:datetime, :time]
|
||||
config.active_job.queue_adapter = :sidekiq
|
||||
config.time_zone = 'Asia/Rangoon'
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -449,6 +449,8 @@ en:
|
||||
gateway_url: "Gateway url"
|
||||
additional_parameter: "Additional parameter"
|
||||
lookup: "Lookup"
|
||||
product_sale_report: "Product Sale"
|
||||
group_type: "Group Type"
|
||||
|
||||
code_txt: "code "
|
||||
charge_txt: "charge"
|
||||
|
||||
@@ -444,6 +444,8 @@ mm:
|
||||
additional_parameter: "ထပ်ဖြည့်အကြောင်းအရာ"
|
||||
survey: "ခြုံငုံလေ့လာခြင်း"
|
||||
lookup: "သတ်မှတ်ချက်များ"
|
||||
product_sale_report: "Product Sale"
|
||||
group_type: "Group Type"
|
||||
|
||||
code_txt: "ကုတ်ဒ် "
|
||||
charge_txt: "ကောက်ခံသည်"
|
||||
|
||||
@@ -152,7 +152,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
#---------Shift ---------------#
|
||||
resources :shifts, only: [:index, :new, :create, :edit]
|
||||
post 'close_shift' => 'shifts#update_shift'
|
||||
get 'shift/close' => 'shifts#show'
|
||||
get 'shift/:type/close' => 'shifts#show'
|
||||
get 'shift/sale_summary' => 'shifts#sale_summary'
|
||||
#shift - index (open/close shift landing page)
|
||||
#shift - show (sales summary display)
|
||||
@@ -300,6 +300,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
#menu
|
||||
resources :menus do
|
||||
#menu_categories
|
||||
collection { post :import }
|
||||
resources :menu_categories, only: [:new, :create, :edit, :delete]
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ class CreateTaxProfiles < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :tax_profiles do |t|
|
||||
t.string :name, :null => false
|
||||
t.string :group_type, :null => false
|
||||
t.decimal :rate, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.boolean :inclusive, :null => false, :default => false
|
||||
t.integer :order_by, :null => false, :default => 1
|
||||
|
||||
@@ -119,8 +119,8 @@ customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contac
|
||||
# room = Room.create({name:"Table 2", zone: zone2, status:"available", seater: 4 , order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
|
||||
#Tax Profile
|
||||
tax_profiles = TaxProfile.create({id:1, name: "Commercial Tax", rate:5.0, order_by:2, created_by:"SYSTEM DEFAULT"})
|
||||
service_charges = TaxProfile.create({id:2, name: "Service Charges", rate:10.0, order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
tax_profiles = TaxProfile.create({id:1, name: "Commercial Tax", group_type: "cashier", rate:5.0, order_by:2, created_by:"SYSTEM DEFAULT"})
|
||||
service_charges = TaxProfile.create({id:2, name: "Service Charges", group_type: "cashier", rate:10.0, order_by:1, created_by:"SYSTEM DEFAULT"})
|
||||
|
||||
#Default menu
|
||||
menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
|
||||
|
||||
Reference in New Issue
Block a user