WIP filters works, but without global search
This commit is contained in:
parent
6cc9d167f5
commit
6b98b8f03c
@ -28,9 +28,6 @@ class Admin::PProductRefsController < ApplicationController
|
||||
@p_product_refs = @p_product_refs.joins(:fournisseur_product_refs).where("fournisseur_product_refs.ref LIKE ?","%#{params[:search][:fournisseur_ref]}%")
|
||||
end
|
||||
|
||||
if params[:search][:global].to_s != ""
|
||||
@p_product_refs = PProductRef.global_search(params[:search][:global])
|
||||
end
|
||||
|
||||
if params[:search][:p_product_ref_cat_id].to_s != ""
|
||||
if params[:search][:p_product_ref_cat_id].to_s == "null"
|
||||
@ -42,13 +39,11 @@ class Admin::PProductRefsController < ApplicationController
|
||||
|
||||
|
||||
if params[:search][:s_brand_id].to_s != ""
|
||||
@p_product_refs = @p_product_refs.where(:p_products => {:s_brand_id => params[:search][:s_brand_id]})
|
||||
end
|
||||
|
||||
@p_product_refs = @p_product_refs.where(:s_brand => params[:search][:s_brand_id])
|
||||
puts "£££££££££££££££££££££££££££££££££££££"
|
||||
puts "£££££££££££££££££££££££££££££££££££££"
|
||||
puts SBrand.find(params[:search][:s_brand_id]).id.to_s + ' ' +SBrand.find(params[:search][:s_brand_id]).name
|
||||
puts "£££££££££££££££££££££££££££££££££££££"
|
||||
puts "£££££££££££££££££££££££££££££££££££££"
|
||||
if params[:search][:global].to_s != ""
|
||||
@p_product_refs = PProductRef.global_search(params[:search][:global])
|
||||
end
|
||||
|
||||
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
|
||||
|
@ -1,4 +1,5 @@
|
||||
class SBrand < ApplicationRecord
|
||||
|
||||
has_many :p_products
|
||||
has_many :p_product_refs, through: :p_products
|
||||
validates :name, :presence => true, :uniqueness => true
|
||||
end
|
||||
|
@ -15,25 +15,24 @@
|
||||
%table
|
||||
%tr
|
||||
|
||||
-if false
|
||||
%td=text_field_tag "search[code]", params[:search][:code],:class => "form-control", :placeholder => "Code"
|
||||
|
||||
%td=text_field_tag "search[fournisseur_ref]", params[:search][:fournisseur_ref],:class => "form-control", :placeholder => "Code fournisseur"
|
||||
|
||||
|
||||
%td{style: "min-width: 500px;"}
|
||||
.input-group
|
||||
=text_field_tag "search[global]", params[:search][:global],:class => "form-control", :placeholder => "Marque, modèle, couleur, code..."
|
||||
.input-group-append{:onclick => "$(this).prev('input').val('');"}
|
||||
.btn.btn-outline-primary
|
||||
.btn.btn-outline-dark
|
||||
=ic(:times)
|
||||
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
Actif :
|
||||
%td
|
||||
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled]), class: "custom-select"
|
||||
-if false
|
||||
%td=text_field_tag "search[code]", params[:search][:code],:class => "form-control", :placeholder => "Code"
|
||||
|
||||
%td=text_field_tag "search[fournisseur_ref]", params[:search][:fournisseur_ref],:class => "form-control", :placeholder => "Code fournisseur"
|
||||
|
||||
%td
|
||||
Actif :
|
||||
%td
|
||||
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled]), class: "custom-select"
|
||||
%td
|
||||
Catégorie :
|
||||
%td
|
||||
|
Reference in New Issue
Block a user