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

223 lines
6.1 KiB
Plaintext

.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
%span
Récapitulatif & paiement
.qi_row
.qi_pannel.qi_plain.padding
%table.table{:style => ""}
%tr
%td{:style => "border:0"}
%h3 Adresse de facturation
-if @p_customer_sheet.particular_bill
%strong=@p_customer_sheet.particular_bill.organisation
%br
=@p_customer_sheet.particular_bill.firstname
=@p_customer_sheet.particular_bill.name
%br
=@p_customer_sheet.particular_bill.address_2
-if @p_customer_sheet.particular_bill.address_3?
%br
=@p_customer_sheet.particular_bill.address_3
%br
=@p_customer_sheet.particular_bill.cp
=@p_customer_sheet.particular_bill.city
%br
=@p_customer_sheet.particular_bill.country
%br
%br
=@p_customer_sheet.particular_bill.tel
%td{:style => "border:0"}
%h3 Adresse de livraison
-if @p_customer_sheet.particular_bill
%strong=@p_customer_sheet.particular_bill.organisation
%br
=@p_customer_sheet.particular_send.firstname
=@p_customer_sheet.particular_send.name
%br
=@p_customer_sheet.particular_send.address_2
-if @p_customer_sheet.particular_send.address_3?
%br
=@p_customer_sheet.particular_send.address_3
%br
=@p_customer_sheet.particular_send.cp
=@p_customer_sheet.particular_send.city
%br
=@p_customer_sheet.particular_send.country
%br
%br
=@p_customer_sheet.particular_bill.tel
%h3 Résumé
-ok = ok || false
-sheet_lines = @p_customer_sheet.p_sheet_lines
%table.table.sheet_line{:style => "width:100%;"}
%tr.sheet_line_head
%th
Description
%th
Qte
%th
Prix U.
%th
Prix Tot.
%th
Prix TTC
-sheet_lines.each do |sheet_line|
-p_sheet_line_lines = sheet_line.p_sheet_line_lines.where("qte > 0")
-nbr_lines = p_sheet_line_lines.count
-ok = true if sheet_line.shiped
%tr
%td{:colspan => 1, :style => "text-align:right;"}
%table.size_table
%tr
%th{:style => "text-align:left !important;"}
=sheet_line.product_name
-sheet_line.p_product.p_sizes.order("position").all.each do |psize|
%th.p_size_td=psize.name
%td{:colspan => 4}
-sheet_line.p_product.p_colors.all.each do |pc|
-qte_tot = 0.0
%tr
%td{:colspan => 1, :style => "text-align:right;"}
%table.size_table
%tr
%td
=pc.name
-sheet_line.p_product.p_sizes.order("position").all.each do |psize|
%td.p_size_td
-psl = p_sheet_line_lines.joins(:p_product_stock).where(:p_product_stocks => {:p_size_id => psize.id, :p_color_id => pc.id} ).first
-if psl
=psl.qte
-qte_tot += psl.qte
%td{}
=qte_tot.to_i
%td
=number_to_currency sheet_line.price.to_f
%td
=number_to_currency sheet_line.price.to_f * qte_tot.to_i
%td
=number_to_currency sheet_line.price.to_f * (sheet_line.tva.to_f+1) * qte_tot.to_i
%tr.tr_sheet_line_head
%td
%td
=sheet_line.qte
%td
=number_to_currency sheet_line.price if sheet_line.price
%td
=number_to_currency sheet_line.price_tot if sheet_line.price_tot
%td
=number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
-total_with_labels = PSheetLine.total_with_labels(sheet_lines)
-total_with_labels.each do |index, total|
%tr.sheet_line_head
%td{:style => "text-align:right;padding-right:10px;", :colspan =>3}
%strong
=total[:label]
%td
=number_to_currency total[:value]
%td
:scss
.sheet_line_head{
td, th{
border-color:rgba(0,0,0,0.5) !important;
}
}
.marges{
td{
vertical-align:top;
}
}
.size_table{
width:97%;
text-align:center;
margin-right:3%;
td,th{
text-align:right;
border:0;
border-right:solid 1px rgba(0,0,0,0.1) !important;
padding:0 3px;
}
.p_size_td{
width:60px;
text-align:center;
}
}
=semantic_form_for [:public, @p_customer_sheet],:url => recap_save_public_p_orders_path(), :html => { :method => :post, :onchange =>""}, :remote => false do |form|
=form.input :cgv, :label => raw("J'ai lu et j'accepte les <a href='/fr/mentions-legales.html' target='_blank'>conditions générales de vente</a>")
=form.input :p_payment_type_id, :label => "Mode de paiement :", :collection => PPaymentType.where(:enabled => true).all, :as => :radio
=form.submit "Passer commande", :class => "btn btn-primary"