coton_app/app/views/public/p_orders/cart.html.haml
Nicolas Bally 5f5d2b403f suite
2019-03-04 02:34:11 +01:00

155 lines
4.8 KiB
Plaintext

.p_product_page
.qi_header
%h1
=link_to "Les produits Biocoton disponibles", public_p_products_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.order("position").all.each do |p_size|
%th.size_th
=p_size.name
%th.price_td PU
%th.price_td
Prix tot.
%tr
%th{:colspan => (p_product.p_sizes.count + 3), :style => "border:0;padding:0"}
=form.input :cust_ref, :placeholder => "Votre référence", :label => false, :input_html => {:style => "width:300px;"}
-p_product.p_colors.all.each do |p_color|
%tr.color_line
%td=p_color.name
-p_product.p_sizes.order("position").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"}
.stock_line{:style => "text-align:left;font-size:0.8em;color:rgba(0,0,0,0.5)"}
%span{:style => "font-size:0.75em;"}
  
Stock :
=ps.stock_th_ok
%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"
.right
=link_to "Passer commande >", particulars_public_p_orders_path, :class => "btn btn-primary"
.clear
: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()