add short name at individual entrepreneur in form add partner

feature/docker
Dmitriy Shesterkin 9 years ago
parent f2b5ae2294
commit aab0941587
  1. 8
      src/dokumentor/static/js/client/search-external-api.js
  2. 9
      src/dokumentor/static/js/dialogs.js

@ -60,7 +60,7 @@ $(document).ready(function() {
function changeDataInInputs(data) {
if (data.type === "LEGAL"|| data.type === "INDIVIDUAL" ) {
//console.log(data);
console.log(data);
if (data.name) {
clientName.val(join([data.opf && data.opf.short || "", data.name.short || data.name.full], " "));
clientNameShort.val(data.name.short);
@ -83,6 +83,12 @@ $(document).ready(function() {
contactName.val(getShortPersonName(data.name.full));
}
// fill self contact name for individual entrepreneur
if (data.type === "INDIVIDUAL" && data.name && data.name.full) {
var resultName = '';
clientNameShort.val(getShortPersonNameWithOpf(data.name.full, data.opf.short));
}
clientInn.val(data.inn);
clientKpp.val(data.kpp);
clientOqrn.val(data.ogrn);

@ -173,6 +173,15 @@ function getShortPersonName(fullName) {
return getPartOfPersonName(fullName,0) + ' ' + getPartOfPersonName(fullName,1)[0] + '.' + getPartOfPersonName(fullName,2)[0] + '.';
}
function getShortPersonNameWithOpf(fullName, opf) {
if (!fullName) return;
if (opf) {
return opf + ' ' + getPartOfPersonName(fullName,0) + ' ' + getPartOfPersonName(fullName,1)[0] + '.' + getPartOfPersonName(fullName,2)[0] + '.';
} else {
return 'ИП' + ' ' + getPartOfPersonName(fullName,0) + ' ' + getPartOfPersonName(fullName,1)[0] + '.' + getPartOfPersonName(fullName,2)[0] + '.';
}
}
function expandObject(obj, width, align) {
obj["templateColWidth"] = width;

Loading…
Cancel
Save