Add index view for invoices

This commit is contained in:
Martin Lensment 2015-04-09 18:20:22 +03:00
parent 6a47f38e80
commit d33d249e2d
5 changed files with 27 additions and 3 deletions

View file

@ -7,6 +7,7 @@ $container-large-desktop: 1040px
$font-family-sans-serif: 'EtelkaLightProRegular', Arial, Helvetica, sans-serif
$font-family-serif: 'EtelkaLightProBold', Georgia, "Times New Roman", Times, serif
$font-size-h1: 26px
$navbar-default-link-active-color: #333
html
position: relative
@ -30,6 +31,9 @@ hr
.no-border
border: 0 !important
.navbar li
font-weight: bold
.footer
position: absolute
bottom: 0

View file

@ -4,6 +4,7 @@ class Registrar::InvoicesController < RegistrarController
before_action :set_invoice, only: [:show]
def index
@invoices = current_user.registrar.invoices.includes(:invoice_items)
end
def show

View file

@ -1,2 +1,20 @@
invoices index
%h1= t('invoices')
%hr
.table-responsive
%table.table.table-hover.table-condensed
%thead
%tr
%th{class: 'col-xs-3'}= t('invoice')
%th{class: 'col-xs-3'}= t('paid_at')
%th{class: 'col-xs-3'}= t('due_date')
%th{class: 'col-xs-3'}= t('total')
%tbody
- @invoices.each do |x|
%tr
%td= link_to(t('invoice_no', no: x.id), [:registrar, x])
- if x.paid_at
%td= l(x.paid_at)
- else
%td{class: 'text-danger'}= t('unpaid')
%td= l(x.due_date)
%td= x.total

View file

@ -650,3 +650,4 @@ en:
seller: 'Seller'
prepayment: 'Prepayment'
vat: 'VAT (%{vat_prc}%)'
unpaid: 'Unpaid'

View file

@ -13,7 +13,7 @@ class AddInvoiceColumns < ActiveRecord::Migration
add_column :invoices, :reference_no, :string
add_column :invoices, :vat_prc, :decimal
#add_column :invoices, :total_sum, :decimal # calculate on the fly
add_column :invoices, :paid_at, :datetime
add_column :invoices, :paid_at, :datetime # maybe figure this out from transactions
# seller info
# add_column :invoices, :sellable_id, :integer # EIS is actually a registrar itself and invoice can belong to EIS