app/views/admin/summaries/edit.html.haml
- if ["new", "clone"].include?(action_name)
- path = admin_entries_path
- elsif action_name == "edit"
- path = admin_entry_path(@entry)
%section.container.row.full-width.no-max-width
.col.s12
= form_for(@entry, url: path) do |f|
.section.row
.col.m6.s12
.row.mb-3
.col.m4.switch
%label
Paid?
= f.check_box(:status, { class: '' }, "paid", "open")
%span.lever
.col.m4.switch
%label
Offer?
= f.check_box :is_offer, checked: params[:is_offer] == "true" || @entry.is_offer?
%span.lever
.col.m4.switch
%label
Consultant?
= f.check_box :is_consultant, checked: params[:is_consultant] == "true" || @entry.is_consultant?
%span.lever
.input-field
%h5
= f.label :title, class: action_name == "edit" ? "active" : ""
= f.text_field :title, class: "validate", :autofocus => true, :required => true
= f.fields_for :customer, @customer do |builder|
= builder.hidden_field :id
.input-field.pb-1
- if ["new", "clone"].exclude?(action_name)
%i.material-icons{class: @entry.customer.present? ? "prefix" : ""}
- if @entry.customer.present?
= link_to edit_admin_customer_path(@customer) do
account_circle
= builder.label :name, "Customer Name", class: @entry.customer.present? ? "active" : "", :required => true
= builder.text_field :name, class: "validate autocomplete", value: @entry.customer.present? ? @entry.customer.name : nil
.input-field
= builder.label :address, "Customer Address", class: @entry.customer.present? ? "active" : ""
= builder.text_area :address, class: "validate materialize-textarea"
.input-field
= builder.label :company, "Company", class: @entry.customer.present? ? "active" : ""
= builder.text_field :company, class: "validate"
.col.m6.s12
.input-field
= f.label :invoice_number, class: "active"
= f.number_field :invoice_number, class: "validate"
.input-field.row.mt-0.pb-1
.col.s6.input-field
= f.label :invoice_date, class: "active"
= f.date_field :invoice_date, class: "validate datepicker mb-0"
.col.s6.input-field
= f.label :delivery_date, class: "active"
= f.date_field :delivery_date, class: "validate mb-0"
%ul.box-shadow-0.m-0.collapsible{"data-collapsible" => "expandable"}
%li
.collapsible-header.hiddendiv{class: @entry.is_offer? || params[:is_offer] ? "active": ""}
.collapsible-body.pr-0.pl-0.pb-0.no-border.pt-0
.input-field
= f.label :valid_until, class: action_name == "edit" ? "active" : ""
= f.date_field :valid_until, class: "validate datepicker "
.input-field
.row.mb-0
.col.s10
= f.label :notes, class: (action_name == "edit" && @entry.notes.present?) ? "active" : ""
= f.text_area :notes, class: "materialize-textarea validate", value: (( action_name == "edit" && @entry.notes.present?) ? @entry.notes.gsub("\n", '').squeeze(' ') : "")
.col.s2
.row.mb-0
.col.p-0
%a.right.btn-floating.tooltipped.mb-1.note-part.waves-effect.waves-light.btn{"data-delay": 10, "data-position":"left", "data-tooltip": "Ich bin nach §19 UStG als Kleinunternehmer von der Umsatzsteuer befreit.", "data-value": "Ich bin nach §19 UStG als Kleinunternehmer von der Umsatzsteuer befreit."}
%i.material-icons child_care
.row.mb-0
.col.p-0
%a.right.btn-floating.tooltipped.mb-1.note-part.waves-effect.waves-light.btn{"data-delay": 10, "data-position":"left", "data-tooltip": "Diese Tätigkeit ist nach §4 Nr. 21 UstG von der Umsatzsteuer für Bildungsleistungen befreit.", "data-value": "Diese Tätigkeit ist nach §4 Nr. 21 UstG von der Umsatzsteuer für Bildungsleistungen befreit."}
%i.material-icons change_history
.input-field
.row.mb-0
.col.s12
= f.label :private_note, class: (action_name == "edit" && @entry.private_note.present?) ? "active" : ""
= f.text_area :private_note, class: "materialize-textarea validate", value: ((action_name == "edit" && @entry.private_note.present?) ? @entry.private_note.gsub("\n", '').squeeze(' ') : "")
.section
%h4 Items
.row.mb-5
.sortable
= f.nested_fields_for :items, @items, wrapper_options: { class: 'm-0 no-border no-padding' } do |ff|
%span.hiddendiv.nested_index= ff.object.id
.input-field.col.m7.s12
= ff.label "Activity", class: "active"
= ff.text_field :name, :required => true, class: "validate mb-0"
.col.s5.m2.inline
.row
.col.s6.input-field
= ff.label "Hour", class: "active"
= ff.number_field :count_hours, class: "validate mb-0"
.col.s6.input-field
= ff.label "Min", class: "active"
= ff.number_field :count_mins, max: 60, min: 0, placeholder: 0, class: "validate mb-0"
.input-field.col.s5.m2
= ff.label "Price",class: "active"
= ff.number_field :price, step: 0.01, :required => true, class: "validate mb-0"
.col.s2.m1.text-right
.right
= ff.remove_nested_fields_link do
.btn-floating.waves-effect.waves-light.red.mt-1
%i.material-icons remove
.col.s12
.row.mb-0
.col.m7
= f.add_nested_fields_link :items, class: "tooltipped btn-floating waves-effect waves-light big-when-focus", "data-delay": 10, "data-position":"right", "data-tooltip": "Add Item" do
%i.material-icons add
.col.s6.m2
.input-field
= f.label "discount",class: action_name == "edit" ? "active" : ""
= f.number_field :discount, class: "validate"
.col.s6.m3.teal-text
Total:
%div= @time
%div= "#{money_helper(get_items_total( @entry ))}"
.fixed-action-btn
= f.button :submit, class: "pulse tooltipped btn btn-floating btn-large ", "data-delay": 10, "data-position":"left", "data-tooltip": "Save" do
%i.material-icons done
- if action_name == "edit"
%ul
%li
= link_to admin_entry_download_path(@entry), target: "_blank", class: "tooltipped btn btn-floating", "data-delay": 10, "data-position":"left", "data-tooltip": "Preview" do
%i.material-icons="open_in_browser"
%li
= link_to admin_entry_download_path(@entry, format: "pdf"), target: "_blank", class: "tooltipped btn btn-floating yellow darken-2", "data-delay": 10, "data-position":"left", "data-tooltip": "Download", "data-value": "Ich bin nach §19 UStG als Kleinunternehmer von der Umsatzsteuer befreit." do
%i.material-icons="play_for_work"