Improve invoice and supplier show views (#840)

This commit is contained in:
twothreenine 2021-03-24 21:29:44 +01:00 committed by GitHub
parent 007ff70c48
commit b2a6c198ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 73 deletions

View file

@ -335,10 +335,9 @@ td.symbol, th.symbol {
// https://github.com/twbs/bootstrap/issues/4550#issuecomment-31916049 // https://github.com/twbs/bootstrap/issues/4550#issuecomment-31916049
.dropdown-backdrop { position: static; } .dropdown-backdrop { position: static; }
// need more space for supplier&order information (in German, at least)
.dl-horizontal { .dl-horizontal {
dt { width: 160px; } dt { width: 200px; margin-bottom: 0.2em; }
dd { margin-left: 170px; } dd { margin-left: 210px; }
} }
// get rid of extra bottom margin inside well // get rid of extra bottom margin inside well

View file

@ -2,30 +2,31 @@
- total = 0 - total = 0
%p .row-fluid
%b= heading_helper(Invoice, :created_at) + ':' .span6
= format_time(@invoice.created_at) %dl.dl-horizontal
%p %dt= heading_helper(Invoice, :created_at) + ':'
%b= heading_helper(Invoice, :created_by) + ':' %dd= format_time(@invoice.created_at)
= show_user(@invoice.created_by)
%p %dt= heading_helper(Invoice, :created_by) + ':'
%b= heading_helper(Invoice, :supplier) + ':' %dd= show_user(@invoice.created_by)
= @invoice.supplier.name
%dt= heading_helper(Invoice, :supplier) + ':'
%dd= @invoice.supplier.name
- if @invoice.deliveries.any? - if @invoice.deliveries.any?
%p %dt= heading_helper(Invoice, :deliveries) + ':'
%b= heading_helper(Invoice, :deliveries) + ':' %dd><
%span><
- @invoice.deliveries.order(:date).each_with_index do |delivery, index| - @invoice.deliveries.order(:date).each_with_index do |delivery, index|
- sum = delivery.sum - sum = delivery.sum
- total += sum - total += sum
= ', ' if index > 0 = ', ' if index > 0
= link_to format_date(delivery.date), [delivery.supplier, delivery] = link_to format_date(delivery.date), [delivery.supplier, delivery]
= ' (' + number_to_currency(sum) + ')' = ' (' + number_to_currency(sum) + ')'
- if @invoice.orders.any? - if @invoice.orders.any?
%p %dt= heading_helper(Invoice, :orders) + ':'
%b= heading_helper(Invoice, :orders) + ':' %dd><
%span><
- @invoice.orders.order(:ends).each_with_index do |order, index| - @invoice.orders.order(:ends).each_with_index do |order, index|
- sum = order.sum - sum = order.sum
- total += sum - total += sum
@ -33,43 +34,44 @@
= link_to format_date(order.ends), new_finance_order_path(order_id: order) = link_to format_date(order.ends), new_finance_order_path(order_id: order)
= ' (' + number_to_currency(sum) + ')' = ' (' + number_to_currency(sum) + ')'
%p %dt= heading_helper(Invoice, :number) + ':'
%b= heading_helper(Invoice, :number) + ':' %dd= @invoice.number
= @invoice.number
%p
%b= heading_helper(Invoice, :date) + ':'
= @invoice.date
%p
%b= heading_helper(Invoice, :paid_on) + ':'
= @invoice.paid_on
%p
%b= heading_helper(Invoice, :amount) + ':'
= number_to_currency @invoice.amount
%p
%b= heading_helper(Invoice, :deposit) + ':'
= number_to_currency @invoice.deposit
%p
%b= heading_helper(Invoice, :deposit_credit) + ':'
= number_to_currency @invoice.deposit_credit
%p
%b= heading_helper(Invoice, :net_amount) + ':'
= number_to_currency @invoice.net_amount
- if @invoice.deliveries.any? || @invoice.orders.any?
%p
%b= heading_helper(Invoice, :total) + ':'
= number_to_currency total
%p
%b= heading_helper(Invoice, :attachment) + ':'
- if @invoice.attachment_data
= link_to t('ui.download'), finance_invoice_attachment_path(@invoice)
%p
%b= heading_helper(Invoice, :note) + ':'
=h @invoice.note
- if @invoice.financial_link
%p
%b= heading_helper(Invoice, :financial_link) + ':'
= link_to t('ui.show'), finance_link_path(@invoice.financial_link)
%dt= heading_helper(Invoice, :date) + ':'
%dd= format_date(@invoice.date)
%dt= heading_helper(Invoice, :paid_on) + ':'
%dd= format_date(@invoice.paid_on)
%dt= heading_helper(Invoice, :amount) + ':'
%dd= number_to_currency @invoice.amount
%dt= heading_helper(Invoice, :deposit) + ':'
%dd= number_to_currency @invoice.deposit
%dt= heading_helper(Invoice, :deposit_credit) + ':'
%dd= number_to_currency @invoice.deposit_credit
%dt= heading_helper(Invoice, :net_amount) + ':'
%dd= number_to_currency @invoice.net_amount
- if @invoice.deliveries.any? || @invoice.orders.any?
%dt= heading_helper(Invoice, :total) + ':'
%dd= number_to_currency total
- if @invoice.attachment_data
%dt= heading_helper(Invoice, :attachment) + ':'
%dd= link_to t('ui.download'), finance_invoice_attachment_path(@invoice)
%dt= heading_helper(Invoice, :note) + ':'
%dd= simple_format(@invoice.note)
- if @invoice.financial_link
%dt= heading_helper(Invoice, :financial_link) + ':'
%dd= link_to t('ui.show'), finance_link_path(@invoice.financial_link)
.clearfix
.form-actions
- if @invoice.user_can_edit?(current_user) - if @invoice.user_can_edit?(current_user)
= link_to t('ui.edit'), edit_finance_invoice_path(@invoice), class: 'btn' = link_to t('ui.edit'), edit_finance_invoice_path(@invoice), class: 'btn'
= link_to t('ui.or_cancel'), finance_invoices_path = link_to t('ui.or_cancel'), finance_invoices_path

View file

@ -38,9 +38,9 @@
%dt= heading_helper(Supplier, :delivery_days) + ':' %dt= heading_helper(Supplier, :delivery_days) + ':'
%dd= @supplier.delivery_days %dd= @supplier.delivery_days
%dt= heading_helper(Supplier, :order_howto) + ':' %dt= heading_helper(Supplier, :order_howto) + ':'
%dd= @supplier.order_howto %dd= simple_format(@supplier.order_howto)
%dt= heading_helper(Supplier, :note) + ':' %dt= heading_helper(Supplier, :note) + ':'
%dd= @supplier.note %dd= simple_format(@supplier.note)
%dt= heading_helper(Supplier, :min_order_quantity) + ':' %dt= heading_helper(Supplier, :min_order_quantity) + ':'
%dd= @supplier.min_order_quantity %dd= @supplier.min_order_quantity