Update the form to allow sending a workflow to an external destinee

OP#734 Modification du formulaire pour permettre l'envoi d'un workflow

https://champs-libres.openproject.com/work_packages/734
This commit is contained in:
2024-10-03 17:29:27 +02:00
parent da6589ba87
commit 071c5e3c55
7 changed files with 100 additions and 1 deletions

View File

@@ -11,7 +11,8 @@ window.addEventListener('DOMContentLoaded', function() {
userChoice = document.querySelector('#workflow_step_isPersonOrUserSignature_1'),
signatureZone = document.querySelector('#signature-zone'),
transitionFilterContainer = document.querySelector('#transitionFilter'),
transitionsContainer = document.querySelector('#transitions')
transitionsContainer = document.querySelector('#transitions'),
sendExternalContainer = document.querySelector('#sendExternalContainer')
;
// ShowHide instance for future dest users
@@ -24,6 +25,10 @@ window.addEventListener('DOMContentLoaded', function() {
for (let transition of froms) {
for (let input of transition.querySelectorAll('input')) {
if (input.checked) {
if ('1' === input.dataset.isSentExternal) {
return false;
}
const inputData = JSON.parse(input.getAttribute('data-is-signature'))
if (inputData.includes('person') || inputData.includes('user')) {
return false;
@@ -40,6 +45,26 @@ window.addEventListener('DOMContentLoaded', function() {
}
});
// ShowHide instance for send external
new ShowHide({
debug: true,
load_event: null,
froms: [divTransitions],
container: [sendExternalContainer],
test: function(froms, event) {
for (let transition of froms) {
for (let input of transition.querySelectorAll('input')) {
if (input.checked) {
if ('1' === input.dataset.isSentExternal) {
return true;
}
}
}
}
return false;
}
})
// ShowHide signature zone
new ShowHide({
debug: false,