global search ok / WIP for select filters
This commit is contained in:
parent
fc143d26fd
commit
6cc9d167f5
@ -28,8 +28,8 @@ class Admin::PProductRefsController < ApplicationController
|
|||||||
@p_product_refs = @p_product_refs.joins(:fournisseur_product_refs).where("fournisseur_product_refs.ref LIKE ?","%#{params[:search][:fournisseur_ref]}%")
|
@p_product_refs = @p_product_refs.joins(:fournisseur_product_refs).where("fournisseur_product_refs.ref LIKE ?","%#{params[:search][:fournisseur_ref]}%")
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:search][:name].to_s != ""
|
if params[:search][:global].to_s != ""
|
||||||
@p_product_refs = @p_product_refs.where("p_product_refs.ct_sub_name LIKE ? or p_product_refs.cc_name LIKE ?","%#{params[:search][:name]}%", "%#{params[:search][:name]}%")
|
@p_product_refs = PProductRef.global_search(params[:search][:global])
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:search][:p_product_ref_cat_id].to_s != ""
|
if params[:search][:p_product_ref_cat_id].to_s != ""
|
||||||
@ -42,7 +42,13 @@ class Admin::PProductRefsController < ApplicationController
|
|||||||
|
|
||||||
|
|
||||||
if params[:search][:s_brand_id].to_s != ""
|
if params[:search][:s_brand_id].to_s != ""
|
||||||
@p_product_refs = @p_product_refs.where(:s_brand_id => params[:search][:s_brand_id])
|
|
||||||
|
@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 "£££££££££££££££££££££££££££££££££££££"
|
||||||
end
|
end
|
||||||
|
|
||||||
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
|
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
|
||||||
|
@ -14,27 +14,35 @@
|
|||||||
|
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
%td
|
|
||||||
Actif :
|
|
||||||
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled])
|
|
||||||
|
|
||||||
|
|
||||||
|
-if false
|
||||||
%td=text_field_tag "search[code]", params[:search][:code],:class => "form-control", :placeholder => "Code"
|
%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=text_field_tag "search[fournisseur_ref]", params[:search][:fournisseur_ref],:class => "form-control", :placeholder => "Code fournisseur"
|
||||||
|
|
||||||
|
|
||||||
%td=text_field_tag "search[name]", params[:search][:name],:class => "form-control", :placeholder => "Nom"
|
%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
|
||||||
|
=ic(:times)
|
||||||
|
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
|
%td
|
||||||
|
Actif :
|
||||||
|
%td
|
||||||
|
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled]), class: "custom-select"
|
||||||
%td
|
%td
|
||||||
Catégorie :
|
Catégorie :
|
||||||
=select_tag "search[p_product_ref_cat_id]", options_for_select([["",""],["Aucune","null"]]+PProductCat.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_product_ref_cat_id])
|
%td
|
||||||
|
=select_tag "search[p_product_ref_cat_id]", options_for_select([["",""],["Aucune","null"]]+PProductCat.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:p_product_ref_cat_id]), class: "custom-select"
|
||||||
|
|
||||||
%td
|
%td
|
||||||
Marque :
|
Marque :
|
||||||
=select_tag "search[s_brand_id]", options_for_select([["",""]]+SBrand.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:s_brand_id])
|
%td
|
||||||
|
=select_tag "search[s_brand_id]", options_for_select([["",""]]+SBrand.order(:name).all.map{|a| [a.name, a.id]}, params[:search][:s_brand_id]), class: "custom-select"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user