order api - WIP & db structure change

This commit is contained in:
Min Zeya Phyo
2017-04-04 12:18:17 +06:30
parent aba3e52d0b
commit bcdce092cc
21 changed files with 120 additions and 130 deletions

View File

@@ -3,13 +3,12 @@ class CreateOrderItems < ActiveRecord::Migration[5.0]
create_table :order_items do |t|
t.references :order, foreign_key: true, :null => false
t.string :order_item_status, :null => false, :default => "new"
t.string :item_order_by #person who order this
t.string :item_code, :null => false
t.string :item_name, :null => false
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :item_order_by #person who order this
t.string :remark
t.string :options
t.string :variants
t.json :set_menu_items #this parameter is require to route the items correctly
t.timestamps

View File

@@ -1,11 +0,0 @@
class CreateDiningIns < ActiveRecord::Migration[5.0]
def change
create_table :dining_ins do |t|
t.references :table
t.references :order
t.boolean :currently_occupied, :default => false #there will only be 1 true - where table_id+order_id
t.timestamps
end
end
end

View File

@@ -1,15 +0,0 @@
class CreateRoomBookings < ActiveRecord::Migration[5.0]
def change
create_table :room_bookings do |t|
t.references :room, :null => false
t.datetime :checkin_at, :null => false
t.datetime :checkout_at
t.string :checkout_by
t.datetime :reserved_at
t.string :reserved_by
t.string :status, :null => false, :default => "new"
t.boolean :is_currently_checkin, :default => false, :null => true
t.timestamps
end
end
end

View File

@@ -1,11 +0,0 @@
class CreateRoomOrders < ActiveRecord::Migration[5.0]
def change
create_table :room_orders do |t|
t.references :room
t.references :orders, foreign_key: true
t.string :order_by
t.timestamps
end
end
end

View File

@@ -35,10 +35,10 @@ menu_item_instance : {
}
order_item : {
order_item_code : "",
item_instance_code : "",
item_instance_price: "",
quantity : 0,
option_values : [],
option_values : [{key,value},],
sub_order_items : [],
}
@@ -51,8 +51,8 @@ customer {name, company, contact, email, member_id, member_type, member_authenti
order { id, date, order_ref, order_source [tablet, order_station, emenu, api], order_type [dine-in, takeaway, delivery],customer_id, item_count, quantity_count, status [new, processing, fulfilled], waiters[], guest_info: {adult_count, child_count, woman_count, man_count}}
order_items { order_item_status, product_code, name, qty, price, remark, options , variants: [], set_menu_items :[]}
order_delivery_info {name, address, contact_no, delivery-by [InHouse | YDoor2Door | Food2U], tracker-id, sale}
dine-in-table {table, order, status}
room-booking {room, check-in, check-out, reserved_by, status, orders}
booking {dining_facility_id, type, checkin_at, checkout_at, checkout_by, reserved_at, reserved_by, status, is_currently_checkin}
booking_order(booking, order)
order_queue_station {name, is_active, processing_items [product_code], print_copy: boolean, printer_name, font_size, cut_per_item, use_alternate_name}
order_queue_log {order_id, job_status [new, completed], print_status [], header: {table name, order_type, order_date}, items :{name, comment, qty}}

View File

@@ -47,11 +47,6 @@ menu_item_type = Lookup.create([{lookup_type:'menu_item_type', name: 'SIMPLE', v
{lookup_type:'menu_item_type', name: 'Set Menu', value: 'set_menu'},
{lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}])
#dining_facilities:[available| reserved | occupied| cleaning]
dining_facilities_status = Lookup.create([{lookup_type:'dining_facilities_status', name: 'Available', value: 'available'},
{lookup_type:'dining_facilities_status', name: 'Reserved', value: 'reserved'},
{lookup_type:'dining_facilities_status', name: 'Occupied', value: 'occupied'},
{lookup_type:'dining_facilities_status', name: 'Cleaning', value: 'cleaning'}])
#Employee Roles
employee_roles = Lookup.create([{lookup_type:'employee_roles', name: 'Cashier', value: 'cashier'},
@@ -60,6 +55,11 @@ employee_roles = Lookup.create([{lookup_type:'employee_roles', name: 'Cashier',
{lookup_type:'employee_roles', name: 'Manager', value: 'manager'},
{lookup_type:'employee_roles', name: 'Administrator', value: 'Administrator'}])
#booking_status
booking_status = Lookup.create([{lookup_type:'booking_status', name: 'Available', value: 'available'},
{lookup_type:'booking_status', name: 'Reserved', value: 'reserved'},
{lookup_type:'booking_status', name: 'Occupied', value: 'occupied'},
{lookup_type:'booking_status', name: 'Cleaning', value: 'cleaning'}])
#WALK CUSTOMER - Default CUSTOMER (take key 1)
customer = Customer.create({id:1, name:"WALK-IN", contact_no:"000000000"})