diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index b0937554..202d4387 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -17,6 +17,8 @@
//= require turbolinks
//= require cable
//= require settings/processing_items
+//= require jquery-ui
+//= require bootstrap-datepicker
$(document).on("focus", "[data-behaviour~='datepicker']", function(e){
$(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true});
@@ -153,4 +155,3 @@ $(function(){
}
});
*/
->>>>>>> d54fd19d1c18384ee6b21c43ca51587fb7fa843f
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
deleted file mode 100644
index e69de29b..00000000
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index bed2e04f..a4fa6b9f 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -2,6 +2,8 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
+@import "jquery-ui";
+@import "bootstrap-datepicker3";
/* Show it is fixed to the top */
diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb
index e3fc7378..3215f9e6 100644
--- a/app/controllers/origami/customers_controller.rb
+++ b/app/controllers/origami/customers_controller.rb
@@ -10,8 +10,6 @@ class Origami::CustomersController < BaseOrigamiController
def show
end
-
-
def add_customer
@sale_id = params[:sale_id]
diff --git a/app/controllers/settings/orders_controller.rb b/app/controllers/settings/orders_controller.rb
deleted file mode 100644
index b5bbdc1c..00000000
--- a/app/controllers/settings/orders_controller.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-class Settings::OrdersController < ApplicationController
- def index
-
- filter = params[:filter]
- if filter.nil?
- orders = Order.order("order_id desc").limit(1000)
- else
- order = Order.where("order_id LIKE ?", "%#{filter}%").order("order_id desc").limit(1000).page(params[:page])
- if order.count > 0
- orders = order
- else
- orders = Order.order("order_id desc").limit(1000)
- flash[:notice] = "There is no data."
- end
- end
- @orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @orders }
- end
- end
- def show
-
- @order = Order.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @order }
- end
- end
-
-end
diff --git a/app/controllers/settings/sales_controller.rb b/app/controllers/settings/sales_controller.rb
deleted file mode 100644
index aabc2282..00000000
--- a/app/controllers/settings/sales_controller.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-class Settings::SalesController < ApplicationController
- def index
-
- search_date = params[:date]
- receipt_no = params[:receipt_no]
- today = Date.today
-
- if receipt_no.nil?
- @sales = Sale.order("sale_id").page(params[:page])
- #@products = Product.order("name").page(params[:page]).per(5)
- else
- @sales = Sale.where("receipt_no LIKE ?", "%#{receipt_no}%").order("receipt_no").page(params[:page])
- end
- #@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
- respond_to do |format|
- format.html # index.html.erb
- format.json { render json: @sales }
- end
- end
-
- def show
-
- @sale = Sale.find(params[:id])
- # @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
- respond_to do |format|
- format.html # show.html.erb
- format.json { render json: @sale }
- end
- end
-
-
-end
\ No newline at end of file
diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb
index ea9e8ccd..edafb1db 100644
--- a/app/controllers/transactions/sales_controller.rb
+++ b/app/controllers/transactions/sales_controller.rb
@@ -4,12 +4,34 @@ class Transactions::SalesController < ApplicationController
# GET /transactions/sales
# GET /transactions/sales.json
def index
- @transactions_sales = Sale.all
+
+ search_date = params[:date]
+ receipt_no = params[:receipt_no]
+ today = Date.today
+
+ if receipt_no.nil?
+ @sales = Sale.order("sale_id").page(params[:page])
+ #@products = Product.order("name").page(params[:page]).per(5)
+ else
+ @sales = Sale.search(receipt_no)
+ end
+ @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @sales }
+ end
end
# GET /transactions/sales/1
# GET /transactions/sales/1.json
def show
+
+ @sale = Sale.find(params[:id])
+ # @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @sale }
+ end
end
# GET /transactions/sales/new
diff --git a/app/models/order.rb b/app/models/order.rb
index 21c00580..10c1a6c2 100644
--- a/app/models/order.rb
+++ b/app/models/order.rb
@@ -292,6 +292,15 @@ class Order < ApplicationRecord
end
+ def self.search(search)
+ if search
+ # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
+ where("order_id LIKE ?", "%#{search}%")
+ else
+ find(:all)
+ end
+ end
+
private
def generate_custom_id
diff --git a/app/models/sale.rb b/app/models/sale.rb
index c0a73f3d..681bed64 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -261,7 +261,8 @@ class Sale < ApplicationRecord
def self.search(search)
if search
- find(:all, :conditions => ['receipt_no LIKE ?', "%#{search}%"])
+ # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"])
+ where("receipt_no LIKE ?", "%#{search}%",)
else
find(:all)
end
diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb
index 17f207c3..f3819466 100644
--- a/app/views/crm/customers/index.html.erb
+++ b/app/views/crm/customers/index.html.erb
@@ -25,8 +25,8 @@
|
<%= form_tag crm_customers_path, :method => :get do %>
- |