app/views/invoices/new.html.haml
- provide(:title, 'New Invoice')
.row
.small-12.columns
%h1.main_page_header New Invoice
%br/
.outline
= render 'companies/header'
.label_size= link_to 'Edit company header', edit_company_path
= form_for @invoice do |f|
= render 'shared/error_messages', object: f.object
= render 'date_tax_fields', f: f
= f.fields_for(:account, @invoice.account) do |account_f|
.row
.small-12.medium-6.large-6.columns
= account_f.label :name, 'Account/Company name (Case Sensitive)'
= account_f.text_field :name, id: 'account_name', placeholder: 'Smith House', title: t(:account_name_title),
data: { autocomplete_source: current_company.accounts.order(:name).pluck(:name) }
.newAccountFields.hidden= render 'accounts/checkbox_fields', f: account_f
%p= link_to 'show/hide additional fields for creating a New Account', '#', id: 'toggle', remote: true
.newAccountFields.hidden
%h4
Create New Account Form
%small (Account/Company name not found)
= account_f.fields_for(:user, @invoice.account.user) do |user_f|
.row
.small-12.medium-6.large-6.columns
= user_f.label :name, "Contact's (Full name)"
= user_f.text_field :name, placeholder: 'John Smith'
.small-12.medium-6.large-6.columns
= user_f.label :email
= user_f.text_field :email
= render 'shared/address_fields', f: account_f
%h4 Add Services
#services
= f.fields_for(:services, @invoice.services) do |service_f|
- unless service_f.object.persisted?
= render 'invoices/service_fields', f: service_f
.links
= link_to_add_association 'add another service', f, :services
%br/
.row
.small-12.columns
= f.submit class: 'tiny button radius'