Add link to OFX bank

This commit is contained in:
Hillel Coren 2017-12-31 20:53:49 +02:00
parent 937e438591
commit df286665d8
2 changed files with 26 additions and 3 deletions

View File

@ -2418,7 +2418,8 @@ $LANG = array(
'contact_custom1' => 'Contact First Custom',
'contact_custom2' => 'Contact Second Custom',
'currency' => 'Currency',
'ofx_help' => 'In most cases the default values should work, if you\'re unable to connect it may help to adjust the settings.',
'ofx_help' => 'In most cases the default values should work, if you\'re unable to connect it may help to :link.',
'adjust_the_settings' => 'adjust the settings',
'item_product' => 'Item Product',
'item_notes' => 'Item Notes',

View File

@ -66,7 +66,9 @@
->addOption('101', 101)
->addOption('102', 102)
->addOption('103', 103)
->help('ofx_help') !!}
->help(trans('texts.ofx_help', [
'link' => link_to('http://www.ofxhome.com/index.php/home/directory', trans('texts.adjust_the_settings'), ['target' => '_blank', 'id' => 'ofxLink'])
])) !!}
</div>
</div>
@ -298,7 +300,27 @@
}
$(function() {
$('#bank_id').focus();
var banks = {!! $banks !!};
var bankMap = {};
for (var i=0; i<banks.length; i++) {
var bank = banks[i];
bankMap[bank.id] = bank;
}
$('#bank_id')
.change(function(event) {
var bankId = $(event.currentTarget).val();
bankId = bankMap[bankId] ? bankMap[bankId].remote_id : false;
if (bankId) {
var link = 'http://www.ofxhome.com/index.php/institution/view/' + bankId;
} else {
var link = 'http://www.ofxhome.com/index.php/home/directory';
}
$('#ofxLink').attr('href', link);
})
.focus();
});
var TransactionModel = function(data) {