Popup produits
This commit is contained in:
parent
bfafa906ce
commit
1609c92ab7
@ -240,9 +240,10 @@ function select_video_from_manager(input_id){
|
||||
|
||||
|
||||
function select_product_from_manager(input_id){
|
||||
|
||||
|
||||
manager_prompt("/admin/p_product_refs.html?manager=true",function(m_return){
|
||||
|
||||
|
||||
manager_prompt(p_product_refs_url,function(m_return){
|
||||
|
||||
$('.p_product_ref_id_'+input_id).val(m_return.id);
|
||||
$('.p_product_ref_name_'+input_id).val(m_return.name);
|
||||
|
@ -47,6 +47,14 @@ class Admin::PProductRefsController < ApplicationController
|
||||
|
||||
@p_product_refs = sort_by_sorting(@p_product_refs, "id DESC")
|
||||
respond_to do |format|
|
||||
format.js{
|
||||
|
||||
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||
per_page = params[:search][:per_page]
|
||||
page = (params[:page] and params[:page] != "") ? params[:page] : 1
|
||||
@p_product_refs = @p_product_refs.page(page).per(per_page)
|
||||
|
||||
}
|
||||
format.html{
|
||||
|
||||
params[:search][:per_page] = params[:search][:per_page] || 100
|
||||
|
@ -1,17 +1,19 @@
|
||||
.qi_header
|
||||
.right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false
|
||||
%h1
|
||||
Achats
|
||||
%span
|
||||
Produits
|
||||
-if !@manager
|
||||
.qi_header
|
||||
.right= link_to ic(:plus)+' Ajouter un produit', new_admin_p_product_path(), :class => "btn btn-primary btn-ap-add", :remote => false
|
||||
%h1
|
||||
Achats
|
||||
%span
|
||||
Références
|
||||
|
||||
|
||||
|
||||
.qi_search_row
|
||||
=form_tag "", :method => "get", :onsubmit => "" do
|
||||
=form_tag admin_p_product_refs_path, :method => "get", :onsubmit => "", :remote => true do
|
||||
|
||||
=hidden_field_tag :column, params[:column]
|
||||
=hidden_field_tag :direction, params[:direction]
|
||||
|
||||
=hidden_field_tag :manager, params[:manager]
|
||||
%table
|
||||
%tr
|
||||
%td
|
||||
@ -42,7 +44,7 @@
|
||||
|
||||
|
||||
|
||||
=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs}
|
||||
#p_product_refs_index_wrapper=render :partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}
|
||||
|
||||
|
||||
|
||||
@ -52,4 +54,7 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
:coffeescript
|
||||
$(".qi_search_row form").on "submit", ->
|
||||
$("#p_product_refs_index_wrapper").html('recherche en cours ...')
|
9
app/views/admin/p_product_refs/index.js.erb
Normal file
9
app/views/admin/p_product_refs/index.js.erb
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
var p_product_refs_url = "<%= escape_javascript(request.url) %>";
|
||||
|
||||
|
||||
$('#p_product_refs_index_wrapper').html("<%= escape_javascript(render(:partial => "qi/qi_ordered_table", :locals => {:qi_ordered_table_collection => @p_product_refs, :remote => true}))%>");
|
||||
|
||||
|
||||
|
||||
$(".btn-qi-search").html('<i class="fa fa-search "></i> Rechercher');
|
@ -18,6 +18,9 @@
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id p_product_ref_id_#{key}"
|
||||
%td
|
||||
=link_to ic(:search), "#", class: "ml-2",:onclick => "select_product_from_manager('#{key}');return false;"
|
||||
|
||||
:javascript
|
||||
var p_product_refs_url = "#{admin_p_product_refs_path(:manager => true)}"
|
||||
|
||||
-form.object.forced_price = true if form.object.ct_u_price_ht
|
||||
|
||||
@ -39,7 +42,6 @@
|
||||
.mx-2.form-inline
|
||||
= form.input :qte, :label => "qte :", :input_html => {:class => "input_price_line_qte form-control mx-2", tabindex: 1}
|
||||
|
||||
= form.hidden_field :p_product_ref_id, :class => "p_product_ref_id"
|
||||
%td
|
||||
.form-inline
|
||||
%label.mx-2 Taux de TVA :
|
||||
|
@ -1,5 +1,7 @@
|
||||
- "QI ActsAsCaching V0.6"
|
||||
|
||||
- remote = remote || false
|
||||
|
||||
-if true
|
||||
-masqued_columns = masqued_columns || nil
|
||||
|
||||
@ -183,7 +185,7 @@
|
||||
|
||||
|
||||
.qi_pagination
|
||||
= paginate qi_ordered_table_collection #, :remote => true
|
||||
= paginate qi_ordered_table_collection, :remote => remote
|
||||
|
||||
:scss
|
||||
|
||||
|
Reference in New Issue
Block a user