Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into osaka
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
class MenuCategory < ApplicationRecord
|
class MenuCategory < ApplicationRecord
|
||||||
before_create :generate_menu_category_code
|
# before_create :generate_menu_category_code
|
||||||
|
|
||||||
belongs_to :menu
|
belongs_to :menu
|
||||||
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id"
|
||||||
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
|
belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true
|
||||||
has_many :menu_items
|
has_many :menu_items
|
||||||
|
|
||||||
validates_presence_of :name, :menu, :order_by
|
validates_presence_of :name, :menu, :code, :order_by
|
||||||
|
|
||||||
default_scope { order('order_by asc') }
|
default_scope { order('order_by asc') }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class MenuItem < ApplicationRecord
|
class MenuItem < ApplicationRecord
|
||||||
|
|
||||||
before_create :generate_menu_item_code
|
# before_create :generate_menu_item_code
|
||||||
|
|
||||||
belongs_to :menu_category, :optional => true
|
belongs_to :menu_category, :optional => true
|
||||||
has_many :menu_item_instances
|
has_many :menu_item_instances
|
||||||
@@ -8,7 +8,7 @@ class MenuItem < ApplicationRecord
|
|||||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|
||||||
validates_presence_of :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
validates_presence_of :item_code, :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
||||||
|
|
||||||
default_scope { order('item_code asc') }
|
default_scope { order('item_code asc') }
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class MenuItemInstance < ApplicationRecord
|
class MenuItemInstance < ApplicationRecord
|
||||||
belongs_to :menu_item
|
belongs_to :menu_item
|
||||||
before_create :generate_menu_item_instance_code
|
# before_create :generate_menu_item_instance_code
|
||||||
|
|
||||||
def self.findParentCategory(item)
|
def self.findParentCategory(item)
|
||||||
if item.menu_category_id
|
if item.menu_category_id
|
||||||
|
|||||||
@@ -18,15 +18,16 @@ class ShiftSale < ApplicationRecord
|
|||||||
|
|
||||||
def self.current_shift
|
def self.current_shift
|
||||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null",today_date).take
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null").take
|
||||||
return shift
|
return shift
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.current_open_shift(current_user)
|
def self.current_open_shift(current_user)
|
||||||
#if current_user
|
#if current_user
|
||||||
#find open shift where is open today and is not closed and login by current cashier
|
#find open shift where is open today and is not closed and login by current cashier
|
||||||
|
#DATE(shift_started_at)=? and
|
||||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
|
||||||
return shift
|
return shift
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user