internetee/registry

View on GitHub
app/views/admin/invoices/partials/_items.haml

Summary

Maintainability
Test Coverage
%h4= t(:items)
%hr
.table-responsive
  %table.table.table-hover.table-condensed
    %thead
      %tr
        %th{class: 'col-xs-4'}= t(:description)
        %th{class: 'col-xs-2'}= t(:unit)
        %th{class: 'col-xs-2'}= InvoiceItem.human_attribute_name :quantity
        %th{class: 'col-xs-2'}= t(:price)
        %th{class: 'col-xs-2'}= t(:total)
    %tbody
      - @invoice.each do |invoice_item|
        %tr
          %td= invoice_item.description
          %td= invoice_item.unit
          %td= invoice_item.quantity
          %td= currency(invoice_item.price)
          %td= currency(invoice_item.item_sum_without_vat)
    %tfoot
      %tr
        %th{colspan: 3}
        %th= Invoice.human_attribute_name :subtotal
        %td= number_to_currency @invoice.subtotal
      %tr
        %th.no-border{colspan: 3}
        %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}"
        %td= number_to_currency @invoice.vat_amount
      %tr
        %th.no-border{colspan: 3}
        %th= t(:total)
        %td= number_to_currency @invoice.total