Compare commits
4 Commits
feature/do
...
02d89b8
| Author | SHA1 | Date |
|---|---|---|
|
|
21bdc8fcff | 9 years ago |
|
|
02d89b863e | 9 years ago |
|
|
063c6f8a61 | 9 years ago |
|
|
354eb753d8 | 9 years ago |
22 changed files with 47 additions and 5453 deletions
File diff suppressed because one or more lines are too long
@ -1,129 +0,0 @@ |
|||||||
$(document).ready(function() { |
|
||||||
var clientForm = $("#client-edit-form"), |
|
||||||
clientSearch = $("#searchClientInput", clientForm), |
|
||||||
clientName = $("#id_name", clientForm), |
|
||||||
clientInn = $("#id_inn", clientForm), |
|
||||||
clientKpp = $("#id_kpp", clientForm), |
|
||||||
clientOqrn = $("#id_ogrn", clientForm), |
|
||||||
clientAddress = $("#id_address", clientForm), |
|
||||||
bankSearch = $("#searchClientBankInput", clientForm), |
|
||||||
bankBic = $("#id_bank_bik", clientForm), |
|
||||||
bankFullName = $("#id_bank_name", clientForm), |
|
||||||
bankCorrespondentAccount = $("#id_bank_korr_account", clientForm), |
|
||||||
clientInputs = [clientName, clientInn, clientOqrn, clientAddress]; |
|
||||||
|
|
||||||
|
|
||||||
function confirmChangeDataPromise(inputArray) { |
|
||||||
var dlg_msg = $('#dialog-message'); |
|
||||||
var emptyInput = true; |
|
||||||
var defer = $.Deferred(); |
|
||||||
|
|
||||||
for (var i = inputArray.length - 1; i >= 0; --i) { |
|
||||||
|
|
||||||
if (inputArray[i].val()) { |
|
||||||
emptyInput = false; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (!emptyInput) { |
|
||||||
dlg_msg.dialog({ |
|
||||||
title: 'Изменить данные', |
|
||||||
buttons: |
|
||||||
{'Да': |
|
||||||
function(){ |
|
||||||
defer.resolve(true); |
|
||||||
$(this).dialog('close'); |
|
||||||
}, 'Нет': |
|
||||||
function(){ |
|
||||||
defer.resolve(false); |
|
||||||
$(this).dialog('close'); |
|
||||||
} |
|
||||||
} |
|
||||||
}).html('Имеются уже заполненные данные, они будут изменены, продолжить?'); |
|
||||||
dlg_msg.dialog('open'); |
|
||||||
|
|
||||||
} else { |
|
||||||
defer.resolve(true); |
|
||||||
} |
|
||||||
|
|
||||||
return defer.promise(); |
|
||||||
} |
|
||||||
|
|
||||||
function cleanSearchInput() { |
|
||||||
clientSearch.val(''); |
|
||||||
} |
|
||||||
|
|
||||||
function changeDataInInputs(data) { |
|
||||||
if (data.type === "LEGAL"|| data.type === "INDIVIDUAL" ) { |
|
||||||
if (data.name) |
|
||||||
clientName.val(join([data.opf && data.opf.short || "", data.name.short || data.name.full], " ")); |
|
||||||
if (data.name && data.name.full) |
|
||||||
clientName.val(join([data.opf && data.opf.full || "", data.name.full], " ")); |
|
||||||
clientInn.val(data.inn); |
|
||||||
clientKpp.val(data.kpp); |
|
||||||
clientOqrn.val(data.ogrn); |
|
||||||
if (data.address) |
|
||||||
clientAddress.val(data.address.value); |
|
||||||
} else { |
|
||||||
if (data.name && data.name.full || "") { |
|
||||||
bankFullName.val(data.name && data.name.full || ""); |
|
||||||
} |
|
||||||
if (data.name && data.name.payment || "") { |
|
||||||
bankFullName.val(data.name && data.name.payment || ""); |
|
||||||
} |
|
||||||
bankBic.val(data.bic); |
|
||||||
bankCorrespondentAccount.val(data.correspondent_account); |
|
||||||
|
|
||||||
var advancedObj = expandObject(data, 118, "right"); |
|
||||||
fillResultSearchBankTemplate(advancedObj); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
function showSuggestion(suggestion) { |
|
||||||
|
|
||||||
var data = suggestion.data; |
|
||||||
if (!data) return; |
|
||||||
if (data.type === "LEGAL"|| data.type === "INDIVIDUAL" ) { |
|
||||||
confirmChangeDataPromise(clientInputs).then(function (answer) { |
|
||||||
if (answer) { |
|
||||||
changeDataInInputs(data) |
|
||||||
} |
|
||||||
cleanSearchInput(); |
|
||||||
}) ; |
|
||||||
} else { |
|
||||||
changeDataInInputs(data) |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
function fillInput(input, type, count) { |
|
||||||
|
|
||||||
input.suggestions({ |
|
||||||
token: daDataExternalApiKey, |
|
||||||
type: type, |
|
||||||
count: count, |
|
||||||
onSelect: showSuggestion |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
bankSearch.on('keyup',(function () { |
|
||||||
if (bankSearch.val().length === 0) { |
|
||||||
clearResultSearchDiv($("#searchBankResult")); |
|
||||||
clearSearchInputs([bankFullName, bankBic, bankCorrespondentAccount]); |
|
||||||
} |
|
||||||
})); |
|
||||||
|
|
||||||
clientSearch.on('keyup',(function () { |
|
||||||
if (clientSearch.val().length === 0) { |
|
||||||
clearSearchInputs([clientName, clientInn, clientKpp, clientOqrn, clientAddress]); |
|
||||||
} else { |
|
||||||
|
|
||||||
} |
|
||||||
})); |
|
||||||
|
|
||||||
fillInput(clientSearch, "PARTY", 5); |
|
||||||
fillInput(bankSearch, "BANK", 1); |
|
||||||
|
|
||||||
}); |
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,36 +0,0 @@ |
|||||||
$(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]); |
|
||||||
} |
|
||||||
})); |
|
||||||
|
|
||||||
}); |
|
||||||
@ -1,158 +0,0 @@ |
|||||||
$(document).ready(function() { |
|
||||||
|
|
||||||
var paramsType, |
|
||||||
profileForm = $("#profile-form"), |
|
||||||
profileSearch = $("#searchAPI"), |
|
||||||
profileBossName = $("#id_boss_name", profileForm), |
|
||||||
profileBossSurname =$("#id_boss_surname", profileForm), |
|
||||||
profileBossMiddleName =$("#id_boss_midname", profileForm), |
|
||||||
profileInn = $("#id_inn", profileForm), |
|
||||||
profileKpp = $("#id_kpp", profileForm), |
|
||||||
profileOqrn = $("#id_ogrn", profileForm), |
|
||||||
profileAddress = $("#id_address", profileForm), |
|
||||||
profileLegalAddress = $("#id_jur_address", profileForm), |
|
||||||
profilePostalAddress = $("#id_real_address", profileForm), |
|
||||||
profileInputs = []; |
|
||||||
|
|
||||||
|
|
||||||
function confirmChangeDataPromise(inputArray) { |
|
||||||
var dlg_msg = $('#dialog-message'); |
|
||||||
var emptyInput = true; |
|
||||||
var defer = $.Deferred(); |
|
||||||
|
|
||||||
for (var i = inputArray.length - 1; i >= 0; --i) { |
|
||||||
|
|
||||||
if (inputArray[i].val()) { |
|
||||||
emptyInput = false; |
|
||||||
break; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
if (!emptyInput) { |
|
||||||
dlg_msg.dialog({ |
|
||||||
title: 'Изменить данные', |
|
||||||
buttons: |
|
||||||
{'Да': |
|
||||||
function(){ |
|
||||||
defer.resolve(true); |
|
||||||
$(this).dialog('close'); |
|
||||||
}, 'Нет': |
|
||||||
function(){ |
|
||||||
defer.resolve(false); |
|
||||||
$(this).dialog('close'); |
|
||||||
} |
|
||||||
} |
|
||||||
}).html('Имеются уже заполненные данные, они будут изменены, продолжить?'); |
|
||||||
dlg_msg.dialog('open'); |
|
||||||
|
|
||||||
} else { |
|
||||||
defer.resolve(true); |
|
||||||
} |
|
||||||
|
|
||||||
return defer.promise(); |
|
||||||
} |
|
||||||
|
|
||||||
function cleanSearchInput() { |
|
||||||
profileSearch.val(''); |
|
||||||
} |
|
||||||
|
|
||||||
function changeDataInInputs(data) { |
|
||||||
|
|
||||||
if (paramsType ==="LEGAL") { |
|
||||||
|
|
||||||
if (data.name) |
|
||||||
profileOrgName.val(join([data.opf && data.opf.short || "", data.name.short || data.name.full], " ")); |
|
||||||
if (data.name && data.name.full) |
|
||||||
profileOrgFullName.val(join([data.opf && data.opf.full || "", data.name.full], " ")); |
|
||||||
if (data.address) { |
|
||||||
profileAddress.val(data.address.value); |
|
||||||
profileLegalAddress.val(data.address.value); |
|
||||||
} |
|
||||||
|
|
||||||
if (data.management) { |
|
||||||
|
|
||||||
var management = data.management; |
|
||||||
if (management.post) {profileBossTitle.val(data.management.post)} |
|
||||||
if (management.name) { |
|
||||||
var fullName = management.name; |
|
||||||
profileBossSurname.val(getPartOfPersonName(fullName, 0)); |
|
||||||
profileBossName.val(getPartOfPersonName(fullName, 1)); |
|
||||||
profileBossMiddleName.val(getPartOfPersonName(fullName, 2)); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} else { |
|
||||||
|
|
||||||
if (data.name && data.name.full) { |
|
||||||
var profileFullName = data.name.full; |
|
||||||
profileBossSurname.val(getPartOfPersonName(profileFullName, 0)); |
|
||||||
profileBossName.val(getPartOfPersonName(profileFullName, 1)); |
|
||||||
profileBossMiddleName.val(getPartOfPersonName(profileFullName, 2)); |
|
||||||
} |
|
||||||
|
|
||||||
if (data.address) { |
|
||||||
var address = data.address.value; |
|
||||||
profileAddress.val(address); |
|
||||||
profileLegalAddress.val(address); |
|
||||||
profilePostalAddress.val(address); |
|
||||||
} |
|
||||||
|
|
||||||
if (data.state && data.state.registration_date) { |
|
||||||
profileRegDate.val((new Date(data.state.registration_date)).toLocaleDateString()) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
profileInn.val(data.inn); |
|
||||||
profileKpp.val(data.kpp); |
|
||||||
profileOqrn.val(data.ogrn); |
|
||||||
} |
|
||||||
|
|
||||||
function showSuggestion(suggestion) { |
|
||||||
|
|
||||||
var data = suggestion.data; |
|
||||||
if (!data) return; |
|
||||||
|
|
||||||
confirmChangeDataPromise(profileInputs).then(function (answer) { |
|
||||||
if (answer) { |
|
||||||
changeDataInInputs(data) |
|
||||||
} |
|
||||||
cleanSearchInput(); |
|
||||||
}) ; |
|
||||||
} |
|
||||||
|
|
||||||
paramsType = getType(); |
|
||||||
|
|
||||||
if (paramsType === "LEGAL") { |
|
||||||
|
|
||||||
var profileOrgName = $('#id_name', profileForm), |
|
||||||
profileOrgFullName = $('#id_full_name', profileForm), |
|
||||||
profileBossTitle = $('#id_boss_title', profileForm); |
|
||||||
|
|
||||||
profileInputs = [ |
|
||||||
profileOrgName, profileOrgFullName, profileInn, profileKpp, |
|
||||||
profileOqrn, profileBossName, profileBossSurname, profileBossMiddleName, |
|
||||||
profileAddress, profileLegalAddress |
|
||||||
]; |
|
||||||
|
|
||||||
} else { |
|
||||||
|
|
||||||
var profileRegDate = $('#id_ip_reg_date', profileForm); |
|
||||||
|
|
||||||
profileInputs = [ |
|
||||||
profileBossName, profileBossSurname, profileBossMiddleName, |
|
||||||
profileInn, profileKpp, profileOqrn, profileRegDate, |
|
||||||
profileAddress, profileLegalAddress, profilePostalAddress |
|
||||||
]; |
|
||||||
} |
|
||||||
|
|
||||||
profileSearch.suggestions({ |
|
||||||
token: daDataExternalApiKey, |
|
||||||
type: "PARTY", |
|
||||||
params: { |
|
||||||
type: paramsType |
|
||||||
}, |
|
||||||
count: 5, |
|
||||||
onSelect: showSuggestion |
|
||||||
}); |
|
||||||
|
|
||||||
}); |
|
||||||
@ -1,28 +0,0 @@ |
|||||||
{% verbatim %} |
|
||||||
<script id="resultSearchBankTemplate" type="text/x-handlebars-template"> |
|
||||||
<table> |
|
||||||
<tbody> |
|
||||||
<tr> |
|
||||||
<td width="{{ templateColWidth }}" align="{{ templateColAlign }}">Наименование:</td> |
|
||||||
{{#if name.full}} |
|
||||||
<td>{{ name.full }}</td> |
|
||||||
{{else}} |
|
||||||
<td>{{ name.payment }}</td> |
|
||||||
{{/if}} |
|
||||||
</tr> |
|
||||||
<tr> |
|
||||||
<td></td> |
|
||||||
<td><span class="bank-short-name">{{ name.payment }}</span></td> |
|
||||||
</tr> |
|
||||||
<tr> |
|
||||||
<td width="{{ templateColWidth }}" align="{{ templateColAlign }}">БИК:</td> |
|
||||||
<td> |
|
||||||
<span class="bank-bic">{{ bic }}</span> |
|
||||||
<span class="bank-account-label">К/сч:</span> |
|
||||||
<span class="bank-account">{{ correspondent_account }}</span> |
|
||||||
</td> |
|
||||||
</tr> |
|
||||||
</tbody> |
|
||||||
</table> |
|
||||||
</script> |
|
||||||
{% endverbatim %} |
|
||||||
Binary file not shown.
Loading…
Reference in new issue