From 82328faa5da0268e24260483e0ccb3c532de9ec0 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sun, 20 Jan 2019 15:50:23 +0100 Subject: [PATCH] suite --- app/views/admin/p_sheet_lines/_form.html.haml | 102 +----------------- 1 file changed, 3 insertions(+), 99 deletions(-) diff --git a/app/views/admin/p_sheet_lines/_form.html.haml b/app/views/admin/p_sheet_lines/_form.html.haml index 84a3c5f..eac6d55 100755 --- a/app/views/admin/p_sheet_lines/_form.html.haml +++ b/app/views/admin/p_sheet_lines/_form.html.haml @@ -70,7 +70,7 @@ -p_product.p_sizes.order("p_sizes.position ASC, p_sizes.id ASC").all.each do |p_size| %th.size_th =p_size.name - + %th.price_td Qte %th.price_td PU %th.price_td Prix tot. @@ -90,6 +90,7 @@ =builder.hidden_field :p_product_stock_id,:label => false, :as => :string =builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"} + %td.qte_tot.price_td %td.price.price_td{:data => {:price => form.object.price}} =number_to_currency form.object.price @@ -104,6 +105,7 @@ %td   + %td %td.qte_tot.price_td{:style => "font-weight:bold;"} %strong=form.object.qte @@ -115,101 +117,3 @@ =number_to_currency form.object.price_tot %br --if false - .product_stock_form.field - %hr - %table{:style => "width:100%;"} - %tr - %td - %label Produit : - %input.p_product_autocomplete_input.form-control{:type => "text", :value => ("#{form.object.p_product.code} #{form.object.p_product.name}" if form.object.p_product), :readonly => ("true" if form.object.id)} - - - = form.hidden_field :p_product_id, :class => "p_product_id" - - :javascript - $( function() { - - $('.p_product_autocomplete_input').autocomplete({ - source: function( request, response ) { - $.ajax( { - url: "/admin/p_products/autocomplete.json", - dataType: "json", - data: { - search: request.term - }, - success: function(data){ - - arr = jQuery.map( data, function( item ) { - return { - label: item.code+" "+item.name, - value: item.code+" "+item.name, - id: item.id - } - }); - - response(arr) - - } - - } ); - }, - minLength: 2, - select: function( event, ui ) { - - $(this).next(".p_product_id").val(ui.item.id) - - //return false - } - }); - - - - } ); - - - - - - %td - -if form.object.p_product - - -p_product = form.object.p_product - - - %table.table - %tr - %th Taille - %th Couleur - %th Qte - -s = "a" - -si = 1 - - - -if true - -p_product.p_product_stocks.order("p_size_id ASC, p_color_id ASC").each do |ps| - - -si = p_product.p_product_stocks.where(:p_size_id => ps.p_size_id).count() - - %tr - -if ps.p_size_id != s - -s = ps.p_size_id - - %td{:rowspan => si} - =si - =ps.p_size.name if ps.p_size - - %td - =ps.p_color.name if ps.p_color - - %td - -p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock => ps.id).first - - =form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder| - =builder.input :qte,:label => false, :as => :string - - - - - - \ No newline at end of file