diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 3d375eee..4bd9434d 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -49,7 +49,7 @@ class Api::CheckInProcessController < Api::ApiController arr_time = checkout_time[0].split("-") start_time = Time.parse(arr_time[0].strip).utc.getlocal.strftime("%H:%M%p") end_time = Time.parse(arr_time[1].strip).utc.getlocal.strftime("%H:%M%p") - if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time + if start_time <= today.strftime("%H:%M%p") && today.strftime("%H:%M%p") <= end_time checkout_at = checkout_at + (checkout_time[1]).to_i.minutes end end diff --git a/app/controllers/api/order_reservation_controller.rb b/app/controllers/api/order_reservation/order_reservation_controller.rb similarity index 70% rename from app/controllers/api/order_reservation_controller.rb rename to app/controllers/api/order_reservation/order_reservation_controller.rb index 97c07669..aa01ec39 100644 --- a/app/controllers/api/order_reservation_controller.rb +++ b/app/controllers/api/order_reservation/order_reservation_controller.rb @@ -1,5 +1,5 @@ -class Api::OrderReservationController < Api::ApiController - skip_before_action :authenticate +class Api::OrderReservation::OrderReservationController < Api::ApiController + # skip_before_action :authenticate def check_customer customer_name = params[:name] @@ -8,11 +8,10 @@ class Api::OrderReservationController < Api::ApiController customer_gender = params[:gender] customer_addr = params[:address] customer_membership_id = params[:membership_id] - customer_membership_type = params[:membership_type] customer_date_of_birth = params[:date_of_birth] customer_id = 0 - check_customer = Customer.find_by_email_and_contact_no_and_membership_id_and_membership_type(customer_email,customer_contact_no,customer_membership_id,customer_membership_type) + check_customer = Customer.find_by_email_and_contact_no_and_membership_id(customer_email,customer_contact_no,customer_membership_id) if !check_customer.nil? customer_id = check_customer.customer_id else @@ -24,11 +23,13 @@ class Api::OrderReservationController < Api::ApiController customer.address = customer_addr customer.date_of_birth = Time.parse(customer_date_of_birth).strftime("%Y-%m-%d") customer.membership_id = customer_membership_id - customer.membership_type = customer_membership_type - customer.save! + customer.customer_type = "Doemal" + customer.tax_profiles = ["2"] + customer.save + customer_id = customer.id end - render :json => { :status => true, :data => { customer_id : customer_id} } + render :json => { :status => true, :data => { :customer_id => customer_id} } end end diff --git a/app/models/customer.rb b/app/models/customer.rb index 934d371f..b05caaf6 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -9,10 +9,10 @@ class Customer < ApplicationRecord has_many :orders has_many :sales - validates_presence_of :name, :contact_no, :email,:card_no + validates_presence_of :name, :contact_no, :email #,:card_no validates :contact_no, uniqueness: true, numericality: true validates :email, uniqueness: true,format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create } - validates :card_no, uniqueness: true + # validates :card_no, uniqueness: true # validates :paypar_account_no, uniqueness: true paginates_per 50 diff --git a/app/views/api/order_reservation/index.json.jbuilder b/app/views/api/order_reservation/index.json.jbuilder new file mode 100644 index 00000000..e69de29b