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]}%")
|
@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][: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 != ""
|
||||||
if params[:search][:p_product_ref_cat_id].to_s == "null"
|
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 != ""
|
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])
|
if params[:search][:global].to_s != ""
|
||||||
puts "£££££££££££££££££££££££££££££££££££££"
|
@p_product_refs = PProductRef.global_search(params[:search][:global])
|
||||||
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")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
class SBrand < ApplicationRecord
|
class SBrand < ApplicationRecord
|
||||||
|
has_many :p_products
|
||||||
|
has_many :p_product_refs, through: :p_products
|
||||||
validates :name, :presence => true, :uniqueness => true
|
validates :name, :presence => true, :uniqueness => true
|
||||||
end
|
end
|
||||||
|
@ -15,25 +15,24 @@
|
|||||||
%table
|
%table
|
||||||
%tr
|
%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;"}
|
%td{style: "min-width: 500px;"}
|
||||||
.input-group
|
.input-group
|
||||||
=text_field_tag "search[global]", params[:search][:global],:class => "form-control", :placeholder => "Marque, modèle, couleur, code..."
|
=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('');"}
|
.input-group-append{:onclick => "$(this).prev('input').val('');"}
|
||||||
.btn.btn-outline-primary
|
.btn.btn-outline-dark
|
||||||
=ic(:times)
|
=ic(:times)
|
||||||
|
|
||||||
%table
|
%table
|
||||||
%tr
|
%tr
|
||||||
%td
|
-if false
|
||||||
Actif :
|
%td=text_field_tag "search[code]", params[:search][:code],:class => "form-control", :placeholder => "Code"
|
||||||
%td
|
|
||||||
=select_tag "search[enabled]", options_for_select([[""], "Oui", "Non"], params[:search][:enabled]), class: "custom-select"
|
%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
|
%td
|
||||||
Catégorie :
|
Catégorie :
|
||||||
%td
|
%td
|
||||||
|
Reference in New Issue
Block a user