diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 9648a246..cc00984d 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -70,8 +70,8 @@ class Crm::CustomersController < BaseCrmController # GET /crm/customers/1 # GET /crm/customers/1.json def show - @orders = Order.where("customer_id=?", params[:id]) - @sales = Sale.where("customer_id=?", params[:id]) + @orders = Order.where("customer_id=?", params[:id]).limit(20) + @sales = Sale.where("customer_id=?", params[:id]).limit(20) if @orders @order_items = [] diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index f4f993d5..81f38324 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -97,7 +97,7 @@ class Origami::OrderReservationController < BaseOrigamiController end def get_order_info - order_reservation = OrderReservation.where("status = 'new' OR status='accepted' OR status='send_to_kitchen' OR status = 'ready_to_delivery'").count() + order_reservation = OrderReservation.where("status = 'new'").count() render :json => order_reservation end diff --git a/app/models/booking.rb b/app/models/booking.rb index 8ba89bd2..46c098b7 100755 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -57,7 +57,7 @@ class Booking < ApplicationRecord joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id") .where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}' OR df.name LIKE ?","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%") end - + .order("sale_id DESC") end private diff --git a/app/models/customer.rb b/app/models/customer.rb index a88f79c0..55a41722 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -336,7 +336,7 @@ class Customer < ApplicationRecord def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) - where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ? OR paypar_account_no ='#{search}'", "%#{search}%", "%#{search}%", "%#{search}%",) + where("name LIKE ? OR customer_type OR contact_no LIKE ? OR card_no LIKE ? OR DATE_FORMAT(date_of_birth,'%Y-%m-%d') LIKE ? OR nrc_no LIKE ? OR gender LIKE ? OR paypar_account_no ='#{search}'", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%", "%#{search}%") else find(:all) end diff --git a/app/models/sale.rb b/app/models/sale.rb index 6c55c7b7..4890aadf 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -734,7 +734,7 @@ class Sale < ApplicationRecord where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}' and shift_sale_id = ?","%#{filter}%","%#{filter}%",shift.id) end end - + .order("sale_id DESC") end def self.search_credit_sales(customer,filter,from,to,order_source="") diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb index c2e0aff4..ef5c76ba 100644 --- a/app/views/crm/customers/_new_form.html.erb +++ b/app/views/crm/customers/_new_form.html.erb @@ -90,6 +90,31 @@ <% end %> + +
+
+ +
+
+ +
+ +
+
+ +
+ + <%= f.file_field :image_path, :class => "img-thumbnail" %> +
+
+

@@ -127,31 +152,6 @@ <%= f.input :address, :class => "form-control address" %>
- -
-
- -
-
-
-
- -
-
- -
- - <%= f.file_field :image_path, :class => "img-thumbnail" %> -
-
-
diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index 69d5f29f..275ae672 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -1,14 +1,14 @@ -