Add BankAccountConnector to implement bank import methods in plugins
This commit is contained in:
parent
d476993321
commit
5d84156bd8
11 changed files with 281 additions and 22 deletions
33
app/views/finance/bank_accounts/_import.html.haml
Normal file
33
app/views/finance/bank_accounts/_import.html.haml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
= form_tag import_finance_bank_account_path(@bank_account), class: 'form-horizontal',
|
||||
data: { auto_submit: @auto_submit}, id: 'import_form', method: :post, remote: true do
|
||||
|
||||
= hidden_field_tag :import_uid, @import_uid
|
||||
= hidden_field_tag :state, @state
|
||||
|
||||
- for control in @controls
|
||||
- name = control.name
|
||||
.control-group
|
||||
- if name
|
||||
- if control.type == :hidden
|
||||
= hidden_field_tag "controls[#{control.name}]", control.value
|
||||
- else
|
||||
%label(for=name class='control-label')
|
||||
= control.label + ':'
|
||||
.controls
|
||||
- if control.type == :password
|
||||
= password_field_tag "controls[#{control.name}]", control.value
|
||||
-else
|
||||
= text_field_tag "controls[#{control.name}]", control.value
|
||||
- else
|
||||
= control.text
|
||||
|
||||
- if @auto_submit
|
||||
:javascript
|
||||
var form = $('#import_form');
|
||||
setTimeout(function() {
|
||||
form.submit();
|
||||
}, form.data('auto-submit'));
|
||||
- else
|
||||
.control-group
|
||||
.controls
|
||||
= submit_tag t('.submit'), class: 'btn btn-primary'
|
||||
|
|
@ -1,12 +1,4 @@
|
|||
- title t('.title', name: @bank_account.name)
|
||||
|
||||
= form_for :bank_accounts, :url => parse_upload_finance_bank_account_path(@bank_account),
|
||||
:html => { multipart: true, class: "form-horizontal" } do |f|
|
||||
|
||||
.control-group
|
||||
%label(for="bank_transactions_file")= t '.file_label'
|
||||
= f.file_field "file"
|
||||
|
||||
.form-actions
|
||||
= submit_tag t('.submit'), class: 'btn btn-primary'
|
||||
= link_to t('ui.or_cancel'), finance_bank_account_transactions_path(@bank_account)
|
||||
#import
|
||||
= render "import"
|
||||
|
|
|
|||
4
app/views/finance/bank_accounts/import.js.haml
Normal file
4
app/views/finance/bank_accounts/import.js.haml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- if @js_redirect
|
||||
document.location.replace('#{escape_javascript(@js_redirect)}');
|
||||
- else
|
||||
$('#import').html('#{escape_javascript(render("import"))}');
|
||||
Loading…
Add table
Add a link
Reference in a new issue