move customer func: from doemal

This commit is contained in:
phyusin
2018-05-11 13:45:04 +06:30
parent a76f9068da
commit baac2c33ea
3 changed files with 23 additions and 23 deletions

View File

@@ -352,28 +352,6 @@ class Customer < ApplicationRecord
end
#new customer for doemal
def self.addCustomer(params)
if params[:gender] == "female"
gender = "Female"
else
gender = "Male"
end
customer = Customer.new
customer.name = params[:name]
customer.email = params[:email]
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
customer.gender = gender
customer.address = params[:address] ? params[:address] : ''
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
customer.membership_id = params[:membership_id]
customer.customer_type = "Takeaway"
customer.tax_profiles = ["2"]
customer.save
return customer
end
WALKIN = "CUS-000000000001"
TAKEAWAY = "CUS-000000000002"