=semantic_form_for [:admin, @price_document], :html => {:class => "oldqi_price_form"}, :remote => false do |f| -@p_customer = @price_document.p_customer .content =f.inputs do %h3 Client =f.inputs do = f.input :p_commercial_id, :label => "Commercial :", :include_blank => true, :collection => PCommercial.order(:name).all, :as => :select, :member_label => :long_name # if @price_document.id =hidden_field_tag :last_p_customer_id, @price_document.p_customer_id %label Client : %input.p_customer_autocomplete_input.form-control{:type => "text", :value => ("#{f.object.p_customer.show_name}" if f.object.p_customer)} = f.hidden_field :p_customer_id, :class => "p_customer_id" :coffeescript $ -> $('.p_customer_autocomplete_input').autocomplete source: (request, response) -> $.ajax url: '/admin/p_customers/autocomplete.json' dataType: 'json' data: {search: request.term} success: (data) -> arr = jQuery.map(data, (item) -> { label: item.show_name value: item.show_name id: item.id } ) response arr return return minLength: 2 select: (event, ui) -> $(this).next('.p_customer_id').val ui.item.id change_address = false if parseInt($('#last_p_customer_id').val()) != parseInt(ui.item.id) change_address = true $.ajax url: '/admin/p_customers/' + ui.item.id + '/autocomplete_apercu.js' type: 'GET' data: change_address: change_address $('#last_p_customer_id').val ui.item.id return return .p_customer_sheet_customer -if @price_document.p_customer and @price_document.p_customer.particular =render :partial => "admin/p_customers/apercu", :locals => {:particular => @price_document.p_customer.particular} .addresses.row .columns.span_6 %h3 Adresse de facturation -if @price_document.p_customer =f.inputs do = f.input :particular_bill_id, :collection => @price_document.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de facturation" -else =f.inputs do = f.input :particular_bill_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation" .columns.span_6 %h3 Adresse de livraison -if @price_document.p_customer =f.inputs do = f.input :particular_send_id, :collection => @price_document.p_customer.particulars.all, :as => :select, :member_label => :address_line, :include_blank => false, :label => "Adresse de livraison" -else =f.inputs do = f.input :particular_send_id, :collection => [], :as => :select, :include_blank => false, :label => "Adresse de facturation" .clear .price_line_block_form =f.semantic_fields_for :price_line_block do |f| =render :partial => "admin/price_line_blocks/form", :locals => {:f => f} -if false = f.input :movement_type, :label => "movement_type :" = f.input :accounting, :label => "accounting :" = f.input :soldable, :label => "soldable :" = f.input :date, :label => "date :" = f.input :ac_tot_amount_ht, :label => "ac_tot_amount_ht :" = f.input :cc_tot_amount_ht, :label => "cc_tot_amount_ht :" = f.input :ac_tot_amount_ttc, :label => "ac_tot_amount_ttc :" = f.input :cc_tot_amount_ttc, :label => "cc_tot_amount_ttc :" = f.input :ac_tot_amount_tva, :label => "ac_tot_amount_tva :" = f.input :cc_tot_amount_tva, :label => "cc_tot_amount_tva :" = f.input :d_number, :label => "d_number :" = f.input :d_index, :label => "d_index :" = f.input :d_year, :label => "d_year :" = f.input :d_month, :label => "d_month :" = f.input :d_day, :label => "d_day :" = f.input :d_prefix, :label => "d_prefix :" = f.input :solded, :label => "solded :" = f.input :imported, :label => "imported :" = f.input :ref_element_type, :label => "ref_element_type :" = f.input :ref_element_id, :label => "ref_element_id :" = f.input :price_document_type_id, :label => "price_document_type_id :" = f.input :ac_label, :label => "ac_label :" = f.input :cc_label, :label => "cc_label :" = f.input :token, :label => "token :" = f.input :custom_header, :label => "custom_header :" = f.input :ac_header, :label => "ac_header :" = f.input :cc_header, :label => "cc_header :" = f.input :custom_footer, :label => "custom_footer :" = f.input :ac_footer, :label => "ac_footer :" = f.input :cc_footer, :label => "cc_footer :" = f.input :ac_payment_days, :label => "ac_payment_days :" = f.input :cc_payment_days, :label => "cc_payment_days :" = f.input :paid_at, :label => "paid_at :" = f.input :ct_payment_delais, :label => "ct_payment_delais :" = f.input :ac_payment_delais, :label => "ac_payment_delais :" = f.input :cc_payment_delais, :label => "cc_payment_delais :" = f.input :ct_payment_month_end, :label => "ct_payment_month_end :" = f.input :ac_payment_month_end, :label => "ac_payment_month_end :" = f.input :cc_payment_month_end, :label => "cc_payment_month_end :" = f.input :ac_payment_end_at, :label => "ac_payment_end_at :" = f.input :cc_payment_end_at, :label => "cc_payment_end_at :" = f.input :doc_ref_id, :label => "doc_ref_id :" = f.input :accounting_locked, :label => "accounting_locked :" = f.input :particular_bill_id, :label => "particular_bill_id :" = f.input :particular_send_id, :label => "particular_send_id :" = f.input :ac_particular_bill_id, :label => "ac_particular_bill_id :" = f.input :ac_particular_send_id, :label => "ac_particular_send_id :" = f.input :ac_to_paid_ht, :label => "ac_to_paid_ht :" = f.input :cc_to_paid_ht, :label => "cc_to_paid_ht :" = f.input :ac_to_paid_ttc, :label => "ac_to_paid_ttc :" = f.input :cc_to_paid_ttc, :label => "cc_to_paid_ttc :" = f.input :ac_to_paid_tva, :label => "ac_to_paid_tva :" = f.input :cc_to_paid_tva, :label => "cc_to_paid_tva :" .actions=f.submit "sauvegarder", :class => "btn btn-primary"