|
|
|
|
@ -549,7 +549,7 @@ |
|
|
|
|
var paramsType, |
|
|
|
|
profileForm = $("#profile-form"), |
|
|
|
|
profileSearch = $("#searchAPI"), |
|
|
|
|
profileBossName = ("#id_boss_name", profileForm), |
|
|
|
|
profileBossName = $("#id_boss_name", profileForm), |
|
|
|
|
profileBossSurname =$("#id_boss_surname", profileForm), |
|
|
|
|
profileBossMiddleName =$("#id_boss_midname", profileForm), |
|
|
|
|
profileInn = $("#id_inn", profileForm), |
|
|
|
|
@ -557,7 +557,8 @@ |
|
|
|
|
profileOqrn = $("#id_ogrn", profileForm), |
|
|
|
|
profileAddress = $("#id_address", profileForm), |
|
|
|
|
profileLegalAddress = $("#id_jur_address", profileForm), |
|
|
|
|
profilePostalAddress = $("#id_real_address", profileForm); |
|
|
|
|
profilePostalAddress = $("#id_real_address", profileForm), |
|
|
|
|
profileInputs = []; |
|
|
|
|
|
|
|
|
|
function getType() { |
|
|
|
|
var False = false, |
|
|
|
|
@ -576,12 +577,52 @@ |
|
|
|
|
return fullName.split(' ')[part]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function showSuggestion(suggestion) { |
|
|
|
|
function confirmChangeDataPromise(inputArray) { |
|
|
|
|
var dlg_msg = $('#dialog-message'); |
|
|
|
|
var emptyInput = true; |
|
|
|
|
var defer = $.Deferred(); |
|
|
|
|
|
|
|
|
|
var data = suggestion.data; |
|
|
|
|
if (!data) return; |
|
|
|
|
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) |
|
|
|
|
@ -627,20 +668,44 @@ |
|
|
|
|
profileInn.val(data.inn); |
|
|
|
|
profileKpp.val(data.kpp); |
|
|
|
|
profileOqrn.val(data.ogrn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
profileSearch.val(''); |
|
|
|
|
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({ |
|
|
|
|
@ -655,7 +720,6 @@ |
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
var bankForm = $("#bank-account-edit-form"), |
|
|
|
|
|