internetee/registry

View on GitHub
app/views/admin/invoices/show.haml

Summary

Maintainability
Test Coverage
.row
  .col-sm-4
    %h1.text-center-xs
      = @invoice
  .col-sm-8
    %h1.text-right.text-center-xs
      - unless @invoice.monthly_invoice
        - if @invoice.unpaid?
          = link_to(t(:payment_received), new_admin_bank_statement_path(invoice_id: @invoice.id), class: 'btn btn-default')

        - if @invoice.paid? && !@invoice.cancelled?
          = link_to(t(:cancel_payment), cancel_paid_admin_invoices_path(invoice_id: @invoice.id), method: 'post', data: { confirm: t(:are_you_sure) }, class: 'btn btn-warning')

      = link_to(t('.download_btn'), download_admin_invoice_path(@invoice), class: 'btn btn-default')
      = link_to(t('.deliver_btn'), new_admin_invoice_delivery_path(@invoice), class: 'btn btn-default')
      - if @invoice.cancellable?
        = link_to(t(:cancel), cancel_admin_invoice_path(@invoice), method: :patch, class: 'btn btn-warning')
      = link_to(t(:back), admin_invoices_path, class: 'btn btn-default')
%hr
= render 'shared/full_errors', object: @invoice

.row
  .col-md-6= render 'admin/invoices/partials/details'
.row
  .col-md-6= render 'admin/invoices/partials/seller'
  .col-md-6= render 'admin/invoices/partials/buyer'
.row
  - if @invoice.monthly_invoice 
    .col-md-12= render 'admin/invoices/partials/monthly_invoice_items'
  - else
    .col-md-12= render 'admin/invoices/partials/items'
.row
  .col-md-12= render 'admin/invoices/partials/payment_orders'