Merge branch 'crm' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
5
app/models/crm.rb
Normal file
5
app/models/crm.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
module Crm
|
||||
def self.table_name_prefix
|
||||
'crm_'
|
||||
end
|
||||
end
|
||||
@@ -9,7 +9,8 @@ class Customer < ApplicationRecord
|
||||
validates_presence_of :name, :contact_no, :email
|
||||
validates :contact_no, uniqueness: true
|
||||
validates :email, uniqueness: true
|
||||
|
||||
|
||||
paginates_per 50
|
||||
|
||||
def self.get_member_group
|
||||
|
||||
@@ -30,6 +31,14 @@ class Customer < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def self.search(search)
|
||||
if search
|
||||
find(:all, :conditions => ['name LIKE ?', "%#{search}%"])
|
||||
else
|
||||
find(:all)
|
||||
end
|
||||
end
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
3
app/models/dining_queue.rb
Normal file
3
app/models/dining_queue.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class DiningQueue < ApplicationRecord
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user