shop code
This commit is contained in:
@@ -5,7 +5,7 @@ class Settings::AccountsController < ApplicationController
|
||||
# GET /settings/accounts
|
||||
# GET /settings/accounts.json
|
||||
def index
|
||||
@settings_accounts = Account.all
|
||||
@settings_accounts = Account.all.where("shop_code='#{@shop.shop_code}'")
|
||||
end
|
||||
|
||||
# GET /settings/accounts/1
|
||||
@@ -26,6 +26,7 @@ class Settings::AccountsController < ApplicationController
|
||||
# POST /settings/accounts.json
|
||||
def create
|
||||
@settings_account = Account.new(account_params)
|
||||
@settings_account.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_account.save
|
||||
format.html { redirect_to settings_accounts_url, notice: 'Account was successfully created.' }
|
||||
|
||||
@@ -28,7 +28,7 @@ class Settings::CashierTerminalsController < ApplicationController
|
||||
# POST /settings/cashier_terminals.json
|
||||
def create
|
||||
@settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params)
|
||||
|
||||
@settings_cashier_terminal.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_cashier_terminal.save
|
||||
format.html { redirect_to settings_cashier_terminals_path, notice: 'Cashier terminal was successfully created.' }
|
||||
|
||||
@@ -18,7 +18,7 @@ class Settings::CommissionersController < ApplicationController
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
|
||||
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
@@ -30,6 +30,7 @@ class Settings::CommissionersController < ApplicationController
|
||||
def create
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
@commissioner.shop_code = @shop.shop_code
|
||||
unless @commissioner.joined_date.nil?
|
||||
@commissioner.joined_date = @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
|
||||
@@ -31,6 +31,7 @@ class Settings::CommissionsController < ApplicationController
|
||||
@commission = Commission.new(commission_params)
|
||||
@commission.product_type = 'menu_item'
|
||||
@commission.product_code = "[]"
|
||||
@commission.shop_code = @shop.shop_code
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
@@ -74,7 +75,7 @@ class Settings::CommissionsController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
|
||||
@@ -31,7 +31,7 @@ class Settings::EmployeesController < ApplicationController
|
||||
# POST /employees.json
|
||||
def create
|
||||
@employee = Employee.new(employee_params)
|
||||
|
||||
@employee.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @employee.save
|
||||
format.html { redirect_to settings_employees_path, notice: 'Employee was successfully created.' }
|
||||
|
||||
@@ -25,7 +25,7 @@ class Settings::LookupsController < ApplicationController
|
||||
# POST /settings/lookups.json
|
||||
def create
|
||||
@settings_lookup = Lookup.new(settings_lookup_params)
|
||||
|
||||
@settings_lookup.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_lookup.save
|
||||
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully created.' }
|
||||
|
||||
@@ -26,7 +26,7 @@ class Settings::MembershipActionsController < ApplicationController
|
||||
# POST /settings/membership_actions.json
|
||||
def create
|
||||
@settings_membership_action = MembershipAction.new(settings_membership_action_params)
|
||||
|
||||
@settings_membership_action.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_membership_action.save
|
||||
format.html { redirect_to settings_membership_actions_path, notice: 'Membership action was successfully created.' }
|
||||
|
||||
@@ -26,7 +26,7 @@ class Settings::MembershipSettingsController < ApplicationController
|
||||
# POST /settings/membership_settings.json
|
||||
def create
|
||||
@settings_membership_setting = MembershipSetting.new(settings_membership_setting_params)
|
||||
|
||||
@settings_membership_setting.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_membership_setting.save
|
||||
format.html { redirect_to settings_membership_settings_path, notice: 'Membership setting was successfully created.' }
|
||||
|
||||
@@ -5,7 +5,7 @@ class Settings::MenusController < ApplicationController
|
||||
# GET /settings/menus
|
||||
# GET /settings/menus.json
|
||||
def index
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xlsx
|
||||
@@ -32,6 +32,7 @@ class Settings::MenusController < ApplicationController
|
||||
def create
|
||||
@settings_menu = Menu.new(settings_menu_params)
|
||||
@settings_menu.created_by = current_login_employee.name
|
||||
@settings_menu.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_menu.save
|
||||
format.html { redirect_to settings_menus_path, notice: 'Menu was successfully created.' }
|
||||
@@ -73,7 +74,7 @@ class Settings::MenusController < ApplicationController
|
||||
end
|
||||
|
||||
def export
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
@settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10)
|
||||
menu = Menu.find(params[:id])
|
||||
|
||||
p = Axlsx::Package.new
|
||||
@@ -93,17 +94,17 @@ class Settings::MenusController < ApplicationController
|
||||
:alignment => { :horizontal => :left,
|
||||
:vertical => :center ,
|
||||
:header_text => true}
|
||||
|
||||
|
||||
# Menu Sheet
|
||||
wb.add_worksheet(name: menu.name,is_ordering: menu.is_ordering) do |sheet|
|
||||
sheet.add_row ["Name",menu.name,"is_ordering",menu.is_ordering], :style=>title
|
||||
sheet.add_row ["Name",menu.name,"is_ordering",menu.is_ordering], :style=>title
|
||||
sheet.add_row
|
||||
|
||||
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Instance Attribute", "Price", "Is Default", "Image Path"], :style=>header_text
|
||||
sheet.add_row ["Category Code", "Category Name", "Item Code", "Item Name", "Account", "Item AltName", "Taxable", "Attributes", "Options", "Instance Code", "Instance Name", "Instance Attribute", "Price", "Is Default", "Image Path"], :style=>header_text
|
||||
menu.menu_categories.each do |mc|
|
||||
mc.menu_items.each do |mi|
|
||||
attributes = ""
|
||||
i=0
|
||||
mc.menu_items.each do |mi|
|
||||
attributes = ""
|
||||
i=0
|
||||
if mi.item_attributes.length > 0
|
||||
mi.item_attributes.each do |mia|
|
||||
attribute = MenuItemAttribute.find(mia)
|
||||
@@ -111,8 +112,8 @@ class Settings::MenusController < ApplicationController
|
||||
attributes = attributes + attribute.name
|
||||
else
|
||||
attributes = attributes + attribute.name + ","
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
image_path = ""
|
||||
@@ -128,8 +129,8 @@ class Settings::MenusController < ApplicationController
|
||||
options = options + option.name
|
||||
else
|
||||
options = options + option.name + ","
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
@@ -141,8 +142,8 @@ class Settings::MenusController < ApplicationController
|
||||
sheet.add_row [ mc.code, mc.name, mi.item_code, mi.name, mi.account.title, mi.alt_name, mi.taxable, attributes, options, mii.item_instance_code, mii.item_instance_name, attribute, mii.price, mii.is_default, image_path], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
directory_name = "public/menus"
|
||||
@@ -154,9 +155,9 @@ class Settings::MenusController < ApplicationController
|
||||
|
||||
def import
|
||||
if params[:file]
|
||||
status = Menu.import(params[:file], current_user.name)
|
||||
status = Menu.import(params[:file], current_user.name,@shop)
|
||||
redirect_to settings_menus_path, notice: status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -32,6 +32,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
@settings_order_queue_station.created_by = current_login_employee.name
|
||||
@settings_order_queue_station.processing_items = "[]"
|
||||
@settings_order_queue_station.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.save
|
||||
format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' }
|
||||
@@ -77,7 +78,7 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_order_queue_station
|
||||
|
||||
@@ -26,7 +26,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
# POST /settings/payment_method_settings.json
|
||||
def create
|
||||
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
|
||||
|
||||
@settings_payment_method_settings.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_payment_method_setting.save
|
||||
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }
|
||||
|
||||
@@ -26,9 +26,10 @@ load_and_authorize_resource except: [:create]
|
||||
# POST /settings/products
|
||||
# POST /settings/products.json
|
||||
def create
|
||||
|
||||
|
||||
@settings_product = Product.new(settings_product_params)
|
||||
@settings_product.created_by = current_user.name
|
||||
@settings_product.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_product.save
|
||||
format.html { redirect_to settings_products_path, notice: 'Product was successfully created.' }
|
||||
@@ -71,7 +72,7 @@ load_and_authorize_resource except: [:create]
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_product
|
||||
|
||||
@@ -30,6 +30,7 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.shop_code = @shop.shop_code
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
@@ -126,7 +127,7 @@ class Settings::PromotionsController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_promotion
|
||||
|
||||
@@ -29,6 +29,7 @@ class Settings::RoomsController < ApplicationController
|
||||
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||
@settings_room.zone_id = params[:zone_id]
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
@settings_room.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_room.save
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||
|
||||
@@ -56,9 +56,9 @@ class Settings::ShopsController < ApplicationController
|
||||
audio_data = @settings_shop.display_images.find_by_name("order_audio").image
|
||||
delete_path = Rails.root.join("public/#{audio_data}")
|
||||
if File.exists?(delete_path)
|
||||
File.delete(delete_path)
|
||||
end
|
||||
end
|
||||
File.delete(delete_path)
|
||||
end
|
||||
end
|
||||
save_path = Rails.root.join("public/#{current_shop.shop_code}_#{a.original_filename}")
|
||||
File.open(save_path, 'wb') do |f|
|
||||
f.write a.read
|
||||
|
||||
@@ -28,6 +28,7 @@ class Settings::TablesController < ApplicationController
|
||||
@settings_table = Table.new(settings_table_params)
|
||||
@settings_table.type = DiningFacility::TABLE_TYPE
|
||||
@settings_table.zone_id = params[:zone_id]
|
||||
@settings_table.shop_code = @shop.shop_code
|
||||
@settings_table.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_table.save
|
||||
|
||||
@@ -47,7 +47,7 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
def create
|
||||
@settings_tax_profile = TaxProfile.new(settings_tax_profile_params)
|
||||
@settings_tax_profile.created_by = current_login_employee.name
|
||||
|
||||
@settings_tax_profile.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_tax_profile.save
|
||||
format.html { redirect_to settings_tax_profiles_path, notice: 'Tax profile was successfully created.' }
|
||||
|
||||
@@ -5,7 +5,7 @@ class Settings::ZonesController < ApplicationController
|
||||
# GET /settings/zones
|
||||
# GET /settings/zones.json
|
||||
def index
|
||||
@settings_zones = Zone.all
|
||||
@settings_zones = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true")
|
||||
end
|
||||
|
||||
# GET /settings/zones/1
|
||||
@@ -28,6 +28,7 @@ class Settings::ZonesController < ApplicationController
|
||||
# POST /settings/zones.json
|
||||
def create
|
||||
@settings_zone = Zone.new(settings_zone_params)
|
||||
@settings_zone.shop_code =@shop.shop_code
|
||||
@settings_zone.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_zone.save
|
||||
|
||||
Reference in New Issue
Block a user