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

* 'august_spring' of bitbucket.org:code2lab/sxrestaurant: (71 commits)
  Update
  Coupon / Voucher data change
  update menu_sync
  update addorder
  update addorder view
  add fields for Menu Sync
  update add oreder
  add menu api
  update add order and calculate subtotal
  update seed
  menu ui update
  update ability for setmenu
  fixed
  update show for foc
  add bootstrap file input and menu item img implemented
  update foc and pdf
  update menu item
  update receipt bill pdf for foc and credit
  add CarrierWave gems for menu image upload
  add CarrierWave gems for menu image upload
  ...
This commit is contained in:
Zin Lin Phyo
2017-08-21 13:30:28 +06:30
169 changed files with 4114 additions and 866 deletions

View File

@@ -8,7 +8,7 @@ class CreateMenuCategories < ActiveRecord::Migration[5.1]
t.integer :order_by
t.string :created_by, :null => false
t.references :menu_category, :null => true
t.boolean :is_available, :null => false, :default => true
t.timestamps
end
end

View File

@@ -1,4 +1,3 @@
class CreateMenuItems < ActiveRecord::Migration[5.1]
def change
create_table :menu_items do |t|
@@ -10,12 +9,16 @@ class CreateMenuItems < ActiveRecord::Migration[5.1]
t.string :information
t.string :type, :null => false, :default => "SimpleMenuItem"
t.references :menu_category, foreign_key: true
t.references :menu_item, foreign_key: true
t.json :item_attributes
t.json :item_options
# t.references :menu_item, foreign_key: true
t.references :account, foreign_key: true
t.integer :min_qty, :null => false, :default => 1
t.boolean :taxable, :null => false, :default => true
t.integer :min_selectable_item, :null => false, :default => 1
t.integer :max_selectable_item, :null => false, :default => 1
t.boolean :is_sub_item, :null => false, :default => false
t.boolean :is_available, :null => false, :default => true
# t.integer :min_selectable_item, :null => false, :default => 1
# t.integer :max_selectable_item, :null => false, :default => 1
t.string :created_by
t.timestamps

View File

@@ -1,6 +1,7 @@
class CreateMenuItemOptions < ActiveRecord::Migration[5.1]
def change
create_table :menu_item_options do |t|
t.string :option_type
t.string :name, :null => false
t.string :value, :null => false

View File

@@ -9,6 +9,7 @@ class CreateMenuItemInstances < ActiveRecord::Migration[5.1]
t.boolean :is_on_promotion, :null => false, :default => false
t.decimal :promotion_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.boolean :is_available, :null => false, :default => true
t.boolean :is_default, :null => false, :default => true
t.timestamps
end
end

View File

@@ -19,6 +19,7 @@ class CreateShops < ActiveRecord::Migration[5.1]
t.string :owner_token
t.string :id_prefix, :null => false, :limit => 3
t.boolean :is_rounding_adj, :default => false
t.boolean :quick_sale_summary, :default => false
t.timestamps
end

View File

@@ -3,11 +3,7 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
create_table :print_settings do |t|
t.string :name, :null => false
t.string :unique_code, :null => false
t.string :template
t.string :db_name
t.string :db_type
t.string :db_username
t.string :db_password
t.string :template
t.string :printer_name, :null => false
t.string :api_settings
t.decimal :page_width, :null => false, :default => 200

View File

@@ -0,0 +1,12 @@
class CreateItemSets < ActiveRecord::Migration[5.1]
def change
create_table :item_sets do |t|
t.string :name
t.string :alt_name
t.integer :min_selectable_qty
t.integer :max_selectable_qty
t.timestamps
end
end
end

View File

@@ -0,0 +1,10 @@
class CreateMenuItemSets < ActiveRecord::Migration[5.1]
def change
create_table :menu_item_sets do |t|
t.references :item_set, foreign_key: true
t.references :menu_item, foreign_key: true
t.timestamps
end
end
end

View File

@@ -0,0 +1,10 @@
class CreateMenuInstanceItemSets < ActiveRecord::Migration[5.1]
def change
create_table :menu_instance_item_sets do |t|
t.references :item_set, foreign_key: true
t.references :menu_item_instance, foreign_key: true
t.timestamps
end
end
end

View File

@@ -1,8 +0,0 @@
class RemoveDBcolsFromPrintSettings < ActiveRecord::Migration[5.1]
def change
remove_column :print_settings, :db_name, :string
remove_column :print_settings, :db_type, :string
remove_column :print_settings, :db_username, :string
remove_column :print_settings, :db_password, :string
end
end

View File

@@ -2,7 +2,6 @@ class SettingsProducts < ActiveRecord::Migration[5.1]
def change
create_table :products do |t|
t.string :item_code, :limit => 16
t.string :name, :null => false
t.string :alt_name
t.integer :unit_price

View File

@@ -94,15 +94,13 @@ float_value = Lookup.create([{lookup_type:'float_value', name: '500', value: '50
{lookup_type:'float_value', name: '10000', value: '10000'}])
# customer type
customer_type = Lookup.create([{lookup_type:'float_value', name: '500', value: '500'},
{lookup_type:'float_value', name: '1000', value: '1000'},
{lookup_type:'float_value', name: '5000', value: '5000'},
{lookup_type:'float_value', name: '10000', value: '10000'}])
#WALK CUSTOMER - Default CUSTOMER (take key 1)
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"})
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"})
customer_type = Lookup.create([{lookup_type:'customer_type', name: 'Dinein', value: 'Dinein'},
{lookup_type:'customer_type', name: 'Takeaway', value: 'Takeaway'},
{lookup_type:'customer_type', name: 'Delivery', value: 'Delivery'}])
# Default CUSTOMER
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000", customer_type:"Dinein", tax_profiles:["2", "1"]})
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111", customer_type:"Takeaway", tax_profiles:["1"]})
#Default ZOne
# zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
@@ -116,18 +114,21 @@ customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contac
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"})
#Account for Menu Item Type (eg: Food, Beverage)
# food = Account.create({title: "Food", account_type: "0"})
# beverage = Account.create({title: "Beverage", account_type: "1"})
#Default menu
# menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
menu = Menu.create({name: "Main Menu", is_active: true, created_by: "SYSTEM DEFAULT"})
menu_options = MenuItemOption.create([{name: "Less Spicy", value: "less_spicy"},{name: "Spicy", value: "spicy"},{name: "Super Spicy", value: "super_spicy"}])
menu_options = MenuItemOption.create([{name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{name: "Less Sweet", value: "less_sweet"}])
#Default Account
food = Account.create({title: "Food", account_type: "0"})
beverage = Account.create({title: "Beverage", account_type: "1"})
product = Account.create({title: "Product", account_type: "2"})
#Default Menu Options
menu_options = MenuItemOption.create([{option_type: "Spicy", name: "Less Spicy", value: "less_spicy"},{option_type: "Spicy", name: "Spicy", value: "spicy"},{option_type: "Spicy", name: "Super Spicy", value: "super_spicy"}])
menu_options = MenuItemOption.create([{option_type: "Oil", name: "Less Oil", value: "less_oil"},{name: "No MSG", value: "no_msg"},{option_type: "Sweet", name: "Less Sweet", value: "less_sweet"}])
menu_pkg_options = MenuItemOption.create([{option_type: "Package", name: "Bottle", value: "Bottle"},{option_type: "Package", name: "Can", value: "can"}])
# #Default Menu Category
# menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1,created_by: "SYSTEM DEFAULT"})
menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base", alt_name: "Soup_base", order_by: 1, is_available: 1, created_by: "SYSTEM DEFAULT"})
# menu_category2 = MenuCategory.create({menu: menu, code:"C005", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 2,created_by: "SYSTEM DEFAULT"})
# menu_category3 = MenuCategory.create({menu: menu, code:"C006", name: "Pork", alt_name: "Pork", order_by: 3,created_by: "SYSTEM DEFAULT"})
# menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Chicken", alt_name: "Chicken", order_by: 1, menu_category_id: menu_category3.id, created_by: "SYSTEM DEFAULT"})
@@ -150,17 +151,12 @@ menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size
menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"})
shop = Shop.create({id:1, name: "OSAKA OHSHO(Tamwe)", address:'No. 256, Kyaikkasan Road, Tamwe Township, Yangon', township:"Tamwe",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"Tel: 09-258676611",reservation_no:"111",license:"123",
activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111",is_rounding_adj:"0"})
activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111",is_rounding_adj:"0",quick_sale_summary:"0"})
#Default Order Queue stations
# order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
# zone_order_queue_station = OrderQueueStation.create({station_name: "Zone 1 Queue Station 2", is_active: true, printer_name: "print_station", processing_items: JSON.generate(['01001','01002','01003','01004','02005','02006','02007','02008']), print_copy: true, cut_per_item: true, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
#Default Order Queue Process By Zone
# zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone2})
#Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator", role: "administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
admin_employee = Employee.create({name: "Waiter", role: "waiter", password: "11111", emp_id:"111", created_by: "SYSTEM DEFAULT"})
@@ -177,4 +173,75 @@ queue_no_printer=PrintSetting.create({name: "Queue No", unique_code: "QueueNoPdf
cashier_terminal = CashierTerminal.create({name:"Terminal 1"})
cashier_terminal2 = CashierTerminal.create({name:"Terminal 2"})
cashier_terminal3 = CashierTerminal.create({name:"Terminal 3"})
zone = Zone.create({id:1, name: "H1", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"61", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"62", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"53", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"54", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"24", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"25", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"26", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"34", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"35", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"45", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"46", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"47", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"48", zone: zone, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
zone2 = Zone.create({id:2, name: "H2", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"51", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"52", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"11", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"12", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"21", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"22", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"23", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"31", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"32", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"33", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"41", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"42", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"43", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"44", zone: zone2, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
zone3 = Zone.create({id:3, name: "H3", is_active:true, created_by: "SYSTEM DEFAULT"})
table = Table.create({name:"71", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"72", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"73", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"74", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"75", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"76", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"77", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
table = Table.create({name:"78", zone: zone3, status:"available", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"})
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://staging.membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"member_discount",gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
{membership_type:"get_member_campaign",gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:6},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"},
])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://membership.paypar.ws"})
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://membership.paypar.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
#Default Order Queue stations
order_queue_station1 = OrderQueueStation.create({station_name: "K1", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
order_queue_station2 = OrderQueueStation.create({station_name: "K2", is_active: true,printer_name: "Cashier", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"})
zone_order_queue_station = OrderQueueStation.create({station_name: "K3", is_active: true, printer_name: "Cashier", processing_items: JSON.generate(['01001','01002','01003','01004','02005','02006','02007','02008']), print_copy: true, cut_per_item: true, use_alternate_name: false, created_by: "SYSTEM DEFAULT"})
# QueueStationZone
zone_queue_station1 = OrderQueueProcessByZone.create({order_queue_station: order_queue_station1, zone: zone})
zone_queue_station2 = OrderQueueProcessByZone.create({order_queue_station: order_queue_station2, zone: zone2})
zone_queue_station3 = OrderQueueProcessByZone.create({order_queue_station: zone_order_queue_station, zone: zone3})
puts " Finished System Default Set Up Data "