Add edit functionality for financial links
This commit is contained in:
parent
f0a55fb951
commit
707501e3f8
13 changed files with 169 additions and 6 deletions
|
|
@ -20,3 +20,6 @@
|
|||
%td
|
||||
- if t.financial_link
|
||||
= link_to t('ui.show'), finance_link_path(t.financial_link)
|
||||
- else
|
||||
= link_to t('.add_financial_link'), finance_links_path(bank_transaction: t.id),
|
||||
method: :post, class: 'btn btn-success btn-mini'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
.modal-header
|
||||
= close_button :modal
|
||||
%h3= t('.add_invoice')
|
||||
.modal-body
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper BankTransaction, :date
|
||||
%th= heading_helper BankTransaction, :text
|
||||
%th= heading_helper BankTransaction, :reference
|
||||
%th= heading_helper BankTransaction, :amount
|
||||
%tbody
|
||||
- for t in @bank_transactions
|
||||
%tr
|
||||
%td= link_to format_time(t.date), add_bank_transaction_finance_link_path(@financial_link, bank_transaction: t.id), method: :put
|
||||
%td= t.text
|
||||
%td= t.reference
|
||||
%td= number_to_currency t.amount
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
.modal-header
|
||||
= close_button :modal
|
||||
%h3= t('.add_invoice')
|
||||
.modal-body
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper FinancialTransaction, :created_on
|
||||
%th= heading_helper FinancialTransaction, :ordergroup
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%th= heading_helper FinancialTransaction, :financial_transaction_type
|
||||
%th= heading_helper FinancialTransaction, :amount
|
||||
%tbody
|
||||
- for t in @financial_transactions
|
||||
%tr
|
||||
%td= link_to format_time(t.created_on), add_financial_transaction_finance_link_path(@financial_link, financial_transaction: t.id), method: :put
|
||||
%td= t.ordergroup.name
|
||||
- if FinancialTransactionType.has_multiple_types
|
||||
%td= h t.financial_transaction_type.name
|
||||
%td= number_to_currency t.amount
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
20
app/views/finance/financial_links/_index_invoice.html.haml
Normal file
20
app/views/finance/financial_links/_index_invoice.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.modal-header
|
||||
= close_button :modal
|
||||
%h3= t('.add_invoice')
|
||||
.modal-body
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper Invoice, :number
|
||||
%th= heading_helper Invoice, :supplier
|
||||
%th= heading_helper Invoice, :date
|
||||
%th= heading_helper Invoice, :amount
|
||||
%tbody
|
||||
- for invoice in @invoices
|
||||
%tr
|
||||
%td= link_to h(invoice.number), add_invoice_finance_link_path(@financial_link, invoice: invoice.id), method: :put
|
||||
%td= invoice.supplier.name
|
||||
%td= format_date invoice.date
|
||||
%td= number_to_currency invoice.amount
|
||||
.modal-footer
|
||||
= link_to t('ui.close'), '#', class: 'btn', data: {dismiss: 'modal'}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('#{j(render("index_bank_transaction"))}');
|
||||
$('#modalContainer').modal();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('#{j(render("index_financial_transaction"))}');
|
||||
$('#modalContainer').modal();
|
||||
2
app/views/finance/financial_links/index_invoice.js.haml
Normal file
2
app/views/finance/financial_links/index_invoice.js.haml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$('#modalContainer').html('#{j(render("index_invoice"))}');
|
||||
$('#modalContainer').modal();
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
- title t('.title', number: @financial_link.id)
|
||||
|
||||
- content_for :actionbar do
|
||||
= link_to t('.add_bank_transaction'), index_bank_transaction_finance_link_path(@financial_link), remote: true, class: 'btn'
|
||||
= link_to t('.add_financial_transaction'), index_financial_transaction_finance_link_path(@financial_link), remote: true, class: 'btn'
|
||||
= link_to t('.add_invoice'), index_invoice_finance_link_path(@financial_link), remote: true, class: 'btn'
|
||||
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
|
|
@ -7,6 +12,7 @@
|
|||
%th= t '.type'
|
||||
%th= t '.description'
|
||||
%th= t '.amount'
|
||||
%th
|
||||
%tbody
|
||||
- @items.each do |item|
|
||||
%tr
|
||||
|
|
@ -18,6 +24,8 @@
|
|||
%td= item[:type]
|
||||
%td= item[:description]
|
||||
%td.numeric{style: 'width:5em'}= format_currency item[:amount]
|
||||
%td= link_to t('ui.delete'), item[:remove_path], :data => {:confirm => t('ui.confirm_delete', name: item[:description])}, :method => :delete,
|
||||
class: 'btn btn-danger btn-mini'
|
||||
|
||||
%p
|
||||
= @financial_link.note
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue