foodsoft/app/views/finance/invoices/_form.html.haml
Patrick Gansterer b623b6abbf Remove useless if in invoices form
The created_at field has a value all the time, so the check if it is set
make no sense since it evaluates to true all the time.
2016-03-04 19:06:05 +01:00

32 lines
1.3 KiB
Text

= simple_form_for([:finance, @invoice]) do |f|
= f.association :deliveries, multiple: true, as: :hidden
= f.association :orders, multiple: true, as: :hidden
- if @invoice.deliveries.first
%p= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_delivery'), [@invoice.supplier,@invoice.deliveries.first])).html_safe
- if @invoice.orders.first
%p= t('finance.invoices.linked', what_link: link_to(t('finance.invoices.linked_order'), new_finance_order_path(order_id: @invoice.orders.first.id))).html_safe
.fold-line
.control-group
%label.control-label{for: 'created_at'}
= Invoice.human_attribute_name(:created_at)
.controls.control-text#article_fc_price
= format_date @invoice.created_at
.control-group
%label.control-label{for: 'created_by'}
= Invoice.human_attribute_name(:created_by)
.controls.control-text#article_fc_price
= show_user @invoice.created_by
= f.association :supplier, collection: Supplier.order(:name), hint: false
= f.input :number
= f.input :date, as: :date_picker
- if current_user.role_finance?
= f.input :paid_on, as: :date_picker
= f.input :amount, as: :string
= f.input :deposit, as: :string
= f.input :deposit_credit, as: :string
= f.input :note
.form-actions
= f.submit class: 'btn'
= link_to t('ui.or_cancel'), :back