Merge branch 'adminbsb_ui_changes' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -228,6 +228,15 @@ For Price 0 in receipt bill
|
||||
For Aston Request => Gift Voucher
|
||||
1) settings/payment_method_settings => {payment_method:'GiftVoucher', is_active:true, ...}
|
||||
|
||||
|
||||
Menu Image (Import guideline)
|
||||
|
||||
=> First, check shop_code is there in shops table.
|
||||
* If there is shop_code (mark in one place/ note and set NULL for this record for a while)/ there is no shop_code in shops table (* skip set NULL step), and copy and paste images into Application/[sxrestaurant]/public/image/menu_images.
|
||||
=> Second, import [menu].xlsx file in /settings/menus and then checked image is uploaded into Application/[sxrestaurant]/public/image/menu_images and insert into menu_items table in database.
|
||||
=> Last, if shop has shop_code, update marked/noted shop_code into shops table again.
|
||||
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
|
||||
@@ -72,7 +72,7 @@ class Settings::MenusController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def export
|
||||
def export
|
||||
@settings_menus = Menu.all.page(params[:page]).per(10)
|
||||
menu = Menu.find(params[:id])
|
||||
|
||||
@@ -135,7 +135,7 @@ class Settings::MenusController < ApplicationController
|
||||
if mii.item_attributes.length > 0
|
||||
attribute = MenuItemAttribute.find(mii.item_attributes[0]).name
|
||||
end
|
||||
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, mi.image_path.to_s.remove("/image/menu_images/")], :style=>wrap_text
|
||||
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, mi.image_path.to_s.remove("/image/menu_images")], :style=>wrap_text
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -140,6 +140,14 @@ class Menu < ApplicationRecord
|
||||
end
|
||||
else
|
||||
# Menu by Menu Import
|
||||
@shop = Shop.first
|
||||
shop_code = ""
|
||||
if !@shop.nil?
|
||||
if @shop.shop_code
|
||||
shop_code = @shop.shop_code + "_"
|
||||
end
|
||||
end
|
||||
|
||||
sheet = spreadsheet.sheet(0)
|
||||
menu = sheet.row(1)[1]
|
||||
imported_menu = Menu.create({name: menu, is_active: true, valid_days: "1,2,3,4,5,6,7",valid_time_from: "00:00:00", valid_time_to: "23:59:59", created_by: created_by})
|
||||
@@ -184,11 +192,10 @@ class Menu < ApplicationRecord
|
||||
account = Account.create({title: row["Account"], account_type: "0"})
|
||||
end
|
||||
|
||||
image_path = row["Image Path"] ? row["Image Path"] : ""
|
||||
image_path = row["Image Path"] ? URI.parse('public/image/menu_images/'+row["Image Path"]) : ""
|
||||
puts "image_path"
|
||||
puts image_path
|
||||
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: image_path.to_s, description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: item_attrs, item_options: item_opts, is_sub_item: 0, is_available: 1, created_by: created_by)
|
||||
puts "menu_itm"
|
||||
puts menu_itm.to_json
|
||||
menu_itm = MenuItem.create(item_code: row["Item Code"], name: row["Item Name"], account_id: account.id, alt_name: row["Item AltName"], image_path: image_path, description: '', information: '', unit: '', type: "SimpleMenuItem", menu_category_id: menu_cat.id, item_attributes: item_attrs, item_options: item_opts, is_sub_item: 0, is_available: 1, created_by: created_by)
|
||||
# else
|
||||
# status = status + "Item Code already exists for " + row["Item Name"] + "."
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user