Skip to content

Commit

Permalink
PositionTemplate формирование label из title
Browse files Browse the repository at this point in the history
  • Loading branch information
lexiqq committed Dec 17, 2024
1 parent 45b104f commit 5415aeb
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ export const pre = function (individual, template, container, mode, extra) {
}
template[0].dispatchEvent(new CustomEvent('validated', {detail: result}));
});

veda.user.isMemberOf('cfg:SuperUser').then(function (isMemberSuperUser) {
if (isMemberSuperUser) {
$('#label_edit', template).removeAttr('disabled');
} else{
$('#label_edit', template).remove();
}
});
// для сторонних организаций формируем Полное наименование должности из title и организации
individual.on('v-s:title', function (values) {
if (values && values.length && individual.hasValue('v-s:parentOrganization') && individual['v-s:parentOrganization'][0].id !== 'd:org_RU1121003135') {
const title = values[0];
const orgName = individual['v-s:parentOrganization'][0]['rdfs:label'][0];
individual['rdfs:label'] = [`${title}. ${orgName}`];
}
});
};

export const html = `
Expand All @@ -79,8 +95,17 @@ export const html = `
<label about="v-s:title" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div property="rdfs:label" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
<div property="v-s:title" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="v-s:title" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
<div class="col-sm-3 col-xs-5">
<label about="v-s:LabelBundleForPosition" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div about="@" property="rdfs:label" class="view edit -search"></div>
<veda-control class="disabled" id="label_edit" data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ export const pre = function (individual, template, container, mode, extra) {
}*/
template[0].dispatchEvent(new CustomEvent('validated', {detail: result}));
});

veda.user.isMemberOf('cfg:SuperUser').then(function (isMemberSuperUser) {
if (isMemberSuperUser) {
$('#label_edit', template).removeAttr('disabled');
} else{
$('#label_edit', template).remove();
}
});

// для сторонних организаций формируем Полное наименование должности из title и организации
individual.on('v-s:title', function (values) {
if (values && values.length && individual.hasValue('v-s:parentOrganization') && individual['v-s:parentOrganization'][0].id !== 'd:org_RU1121003135') {
const title = values[0];
const orgName = individual['v-s:parentOrganization'][0]['rdfs:label'][0];
individual['rdfs:label'] = [`${title}. ${orgName}`];
}
});
};

export const html = `
Expand Down Expand Up @@ -90,8 +107,17 @@ export const html = `
<label about="v-s:title" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div property="rdfs:label" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
<div property="v-s:title" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="v-s:title" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
<div class="col-sm-3 col-xs-5">
<label about="v-s:LabelBundleForPosition" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div about="@" property="rdfs:label" class="view edit -search"></div>
<veda-control class="disabled" id="label_edit" data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ export const pre = function (individual, template, container, mode, extra) {
}
template[0].dispatchEvent(new CustomEvent('validated', {detail: result}));
});

veda.user.isMemberOf('cfg:SuperUser').then(function (isMemberSuperUser) {
if (isMemberSuperUser) {
$('#label_edit', template).removeAttr('disabled');
} else{
$('#label_edit', template).remove();
}
});
// для сторонних организаций формируем Полное наименование должности из title и организации
individual.on('v-s:title', function (values) {
if (values && values.length && individual.hasValue('v-s:parentOrganization') && individual['v-s:parentOrganization'][0].id !== 'd:org_RU1121003135') {
const title = values[0];
const orgName = individual['v-s:parentOrganization'][0]['rdfs:label'][0];
individual['rdfs:label'] = [`${title}. ${orgName}`];
}
});
};

export const post = function (individual, template, container, mode, extra) {
Expand Down Expand Up @@ -126,10 +142,19 @@ export const html = `
<label about="v-s:title" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div property="rdfs:label" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
<div property="v-s:title" class="view -edit -search"></div>
<veda-control data-type="multilingualText" property="v-s:title" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
<div class="col-sm-3 col-xs-5">
<label about="v-s:LabelBundleForPosition" property="rdfs:label"></label>
</div>
<div class="col-sm-9 col-xs-7">
<div about="@" property="rdfs:label" class="view edit -search"></div>
<veda-control class="disabled" id="label_edit" data-type="multilingualText" property="rdfs:label" class="-view edit search"></veda-control>
</div>
</div>
<div class="row row-attribute">
<div class="col-sm-3 col-xs-5">
<label about="v-s:PositionCode" property="rdfs:label"></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ v-s:DefaultAppointmentBundle
rdfs:label "Основное назначение"@ru ;
rdfs:label "Default appointment"@en ;
.
v-s:LabelBundleForPosition
rdf:type v-s:Bundle ;
rdfs:label "Полное наименование"@ru ;
rdfs:label "Full name"@en ;
.


# ------------------------------------------------------------ МОДЕЛИ --
Expand Down

0 comments on commit 5415aeb

Please sign in to comment.