From c8d758c25aff6bab84fa73a37178f83c373a9502 Mon Sep 17 00:00:00 2001 From: Thiago Youssef Date: Sun, 4 Sep 2022 17:57:32 -0300 Subject: [PATCH] Fix merge --- app/views/admin/invoices/show.haml | 74 +++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/app/views/admin/invoices/show.haml b/app/views/admin/invoices/show.haml index 5b5640608..80da77bc8 100644 --- a/app/views/admin/invoices/show.haml +++ b/app/views/admin/invoices/show.haml @@ -123,9 +123,79 @@ %dd= @invoice.buyer_email .row - if @invoice.monthly_invoice - .col-md-12= render 'registrar/invoices/partials/monthly_invoice_items' + .col-md-12 + %h4= t(:items) + %hr + .table-responsive + %table.table.table-hover.table-condensed + %thead + %tr + %th{class: 'col-xs-1'}= t(:code) + %th{class: 'col-xs-1'}= InvoiceItem.human_attribute_name :quantity + %th{class: 'col-xs-1'}= t(:unit) + %th{class: 'col-xs-5'}= t(:description) + %th{class: 'col-xs-2'}= t(:price) + %th{class: 'col-xs-2'}= t(:total) + %tbody + - @invoice.each do |invoice_item| + %tr + %td= invoice_item.product_id + %td= invoice_item.quantity + %td= invoice_item.unit + %td= invoice_item.description + - if invoice_item.price && invoice_item.quantity + %td= currency(invoice_item.price) + %td= "#{currency((invoice_item.price * invoice_item.quantity).round(3))} #{@invoice.currency}" + - else + %td= '' + %td= '' + %tfoot + %tr + %th{colspan: 4} + %th= Invoice.human_attribute_name :subtotal + %td= number_to_currency(0) + %tr + %th.no-border{colspan: 4} + %th= "VAT #{number_to_percentage(@invoice.vat_rate, precision: 1)}" + %td= number_to_currency(0) + %tr + %th.no-border{colspan: 4} + %th= t(:total) + %td= number_to_currency(0) - else - .col-md-12= render 'registrar/invoices/partials/items' + .col-md-12 + %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 .row .col-md-12 %h4= "Payment Orders"