finished customer form and update
This commit is contained in:
@@ -45,43 +45,19 @@ class Customer < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
# require "net/http"
|
||||
# def self.url_exist?(url_string)
|
||||
# url = URI.parse(url_string)
|
||||
|
||||
|
||||
# req = Net::HTTP.new(url.host, url.port)
|
||||
# puts "hhhhhhhhhhhh"
|
||||
# puts req.to_json
|
||||
# req.use_ssl = (url.scheme == 'https')
|
||||
# puts "aaaaaaaaaaaa"
|
||||
# puts req.use_ssl?
|
||||
# path = url.path if url.path.present?
|
||||
# puts "bbbbbbbbbbbbb"
|
||||
# puts path
|
||||
# res = req.request_head(path || '/')
|
||||
# puts "cccccccccccccc"
|
||||
# puts res.to_json
|
||||
# puts "ddddddddd"
|
||||
# puts res.kind_of?(Net::HTTPRedirection)
|
||||
# if res.kind_of?(Net::HTTPRedirection)
|
||||
# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL
|
||||
# else
|
||||
# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families
|
||||
# end
|
||||
# rescue Errno::ENOENT
|
||||
# false #false if can't find the server
|
||||
# end
|
||||
|
||||
|
||||
# def self.search(search)
|
||||
# where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",)
|
||||
# end
|
||||
|
||||
def lastest_invoices
|
||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
def self.count_customer
|
||||
all = self.all.count+1
|
||||
count = all-2
|
||||
|
||||
end
|
||||
|
||||
WALKIN = "CUS-000000000001"
|
||||
TAKEAWAY = "CUS-000000000002"
|
||||
|
||||
private
|
||||
def generate_custom_id
|
||||
self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS")
|
||||
|
||||
Reference in New Issue
Block a user