You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
$(document).ready(function() {
|
|
var bankForm = $("#bank-account-edit-form"),
|
|
bankSearch = $("#searchBankAPI"),
|
|
bankBic = $("#id_bik", bankForm),
|
|
bankShortName = $("#id_short_name", bankForm),
|
|
bankFullName = $("#id_name", bankForm),
|
|
bankCorrespondentAccount = $("#id_korr_account", bankForm);
|
|
|
|
function showSuggestion(suggestion) {
|
|
var data = suggestion.data;
|
|
if (!data) return;
|
|
|
|
bankShortName.val(data.name && data.name.payment || "");
|
|
bankFullName.val(data.name && data.name.full && data.name.payment || "");
|
|
bankBic.val(data.bic);
|
|
bankCorrespondentAccount.val(data.correspondent_account);
|
|
|
|
var advancedObj = expandObject(data, 110, "left");
|
|
fillResultSearchBankTemplate(advancedObj);
|
|
}
|
|
|
|
bankSearch.suggestions({
|
|
token: daDataExternalApiKey,
|
|
type: "BANK",
|
|
count: 2,
|
|
onSelect: showSuggestion
|
|
});
|
|
|
|
bankSearch.on('keyup',(function () {
|
|
if (bankSearch.val().length === 0) {
|
|
clearResultSearchDiv($("#searchBankResult"));
|
|
clearSearchInputs([bankFullName, bankShortName, bankBic, bankCorrespondentAccount]);
|
|
}
|
|
}));
|
|
|
|
}); |