coton_app/app/views/admin/p_documents/_form.html.haml
Nicolas Bally 03a728c372 suite
2019-03-27 16:28:05 +01:00

163 lines
3.9 KiB
Plaintext
Executable File

=semantic_form_for [:admin, @avoir], :url => save_avoir_admin_p_document_path() ,:remote => false, :html => {:id => "cart_form"} do |form|
= form.hidden_field :label
= form.hidden_field :doc_ref_id
= form.hidden_field :doc_ref_number
= form.hidden_field :p_document_type_id
= form.hidden_field :element_type
= form.hidden_field :element_id
.content
%h3 Client
=form.inputs do
= form.hidden_field :p_customer_id, :class => "p_customer_id"
.addresses.row
.columns.span_6
%h3 Adresse de facturation
-if @avoir.p_customer
=form.inputs do
= form.input :particular_bill_id, :collection => @avoir.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation"
-else
=form.inputs do
= form.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
.columns.span_6
%h3 Adresse de livraison
-if @avoir.p_customer
=form.inputs do
= form.input :particular_send_id, :collection => @avoir.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison"
-else
=form.inputs do
= form.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation"
.clear
= form.input :cust_ref, :label => "Référence commande client :"
.p_sheet_lines_form
=form.semantic_fields_for :p_sheet_lines do |form|
=render :partial => "admin/p_sheet_lines/avoir_form", :locals => {:form => form}
=#%p= link_to_add_fields "Ajouter une ligne", form, :p_sheet_lines
%table{:style => "width:100%;"}
%td{:style => "text-align:right;"}
Total HT articles :
%td.price_td
.price_emp.p_sheet_lines_tot_ht
= form.input :fdp_force_price, :label => "Frais de port :" , :input_html => {:id => "fdp_value"}
-if true
%p
%strong Totaux
%table{:style => "width:100%;"}
%td{:style => "text-align:right;"}
Total HT :
%td.price_td
.price_emp.p_sheet_lines_tot_ht_fdp
%table{:style => "width:100%;"}
%td{:style => "text-align:right;"}
TVA :
%td.price_td
.price_emp.p_sheet_lines_tot_tva
%table{:style => "width:100%;"}
%td{:style => "text-align:right;"}
Total TTC :
%td.price_td
.price_emp.p_sheet_lines_tot_ttc
.right.actions=form.submit "sauvegarder", :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}
}
}
:coffeescript
tva = 1.2
@update_sheet_line_tot = ->
tot_sheet = 0.0
$(".p_sheet_lines_form").find(".product_stock_form").each ->
tot = 0.0
tot = parseFloat($(this).find(".price_tot").data("price"))
tot_sheet += tot
$(".p_sheet_lines_tot_ht").html(accounting.formatMoney(tot_sheet))
tot_sheet_fdp = (tot_sheet + parseFloat($("#fdp_value").val()))
$(".p_sheet_lines_tot_ht_fdp").html(accounting.formatMoney(tot_sheet_fdp))
$(".p_sheet_lines_tot_tva").html(accounting.formatMoney(tot_sheet_fdp*(tva-1.0)))
$(".p_sheet_lines_tot_ttc").html(accounting.formatMoney(tot_sheet_fdp*tva))
#alert(tot_sheet)
:coffeescript
udpate_sheet_lines()
update_sheet_line_tot()
$("#cart_form").change ->
udpate_sheet_lines()
update_sheet_line_tot()
$("#cart_form").keyup ->
udpate_sheet_lines()
update_sheet_line_tot()