.p_product_page
  .qi_header
    %h1
      =link_to ic(:user)+" Mon compte", public_my_account_path
      %span
        =link_to "Mon panier", cart_public_p_orders_path
      

  .qi_row
    .qi_pannel.qi_plain.padding
      
      =semantic_form_for [:public, @p_customer_sheet],:url => update_cart_public_p_orders_path(), :html => { :method => :post, :onchange =>"", :id => "cart_form"}, :remote => true do |form|

    
  
  
        .p_sheet_lines_form
          =form.semantic_fields_for :p_sheet_lines do |form|
            #p_sheet_line.product_stock_form.field.p_sheet_line_field{:id => form.object.id}

              
             
                
                    

        
                


              = form.hidden_field :p_product_id, :class => "p_product_id"
        
              -if form.object.p_product

                -p_product = form.object.p_product
  
                
                %table.table.order_table
                  %tr
                    %th
                      =form.object.p_product.name
                      =link_to_remove_fields ic(:"trash-o"), form
                      
                    -p_product.p_sizes.all.each do |p_size|
                      %th.size_th
                        =p_size.name
                    
                    %th.price_td PU
                    %th.price_td
                      Prix tot.
                    
                  -p_product.p_colors.all.each do |p_color|
                    %tr.color_line
                      %td=p_color.name
                  
                      -p_product.p_sizes.all.each do |p_size|
                        %td
                          -ps = p_product.p_product_stocks.where(:p_size_id => p_size.id, :p_color_id => p_color.id).first
                      
                          -if ps
                            -p_sheet_line_line = form.object.p_sheet_line_lines.where(:p_product_stock_id => ps.id).first
                            -if p_sheet_line_line
                              =form.fields_for(:p_sheet_line_lines, p_sheet_line_line) do |builder|
                                =builder.hidden_field :p_product_stock_id,:label => false, :as => :string
                                =builder.input :qte,:label => false, :as => :string, :input_html => {:class => "qte"}
                      
                      %td.price.price_td{:data => {:price => form.object.price}}
                        =number_to_currency form.object.price
                        
                      %td.price_color_tot.price_td
                
                
              %table{:style => "width:100%"}

                    
                    
                %tr
                    
                  %td
                    &nbsp
                  %td.qte_tot.price_td{:style => "font-weight:bold;"}
                    %strong=form.object.qte
                    
                  %td.price.price_td{:style => "font-weight:bold;", :data => {:price => form.object.price}}
                    %strong=number_to_currency form.object.price
                  
                    
                  %td.price_tot.price_td{:style => "font-weight:bold;"}
                    =number_to_currency form.object.price_tot
              %br
               
        
              
  
        

  


          
        #cart_totals=render :partial => "cart_totals"
              
          


        %hr
        =#form.submit "sauvegarder", :class => "btn btn-primary"
  
        =link_to "Suivant", particulars_public_p_orders_path, :class => "btn btn-primary"
 
  
      :scss
        .price_emp{
          padding: 6px 12px;
          font-size: 14px;
          line-height: 1.42857;
          color: #555555;
          height:34px;
    
        }
  
        .price_td{
          width:170px;
          text-align:right;
    
        }


      :scss
        .product_stock_form{
        td{
          vertical-align:top;
        .form-control, .form-group{
        margin-bottom:0}
        }

        }
        
:scss
  .size_th{
    width:80px;
    
  }
  
:coffeescript
  
  
  udpate_sheet_lines()
  
  $("#cart_form").change ->
    udpate_sheet_lines()
    $(this).submit()
  $("#cart_form").keyup ->
    udpate_sheet_lines()
    $(this).submit()
