Skip to content
Snippets Groups Projects
Commit b805c5b1 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #229 refactoring add visa user in visa circuit

parent dfd4b336
No related branches found
No related tags found
No related merge requests found
......@@ -5,20 +5,10 @@ function addVisaUser(users) {
if(nb_visa == 0){
$j("#emptyVisa").hide();
}
if ($j("select[id^=signRequest_] option:selected[value=true]").length >= 2 ||
($j("select[id^=signRequest_] option:selected[value=true]").length == 1 && $j("select[id^=signRequest_] option:last:selected[value=true]").length == 0)) {
selected = '';
} else {
if (!$j('#signRequest_'+nb_visa).is(':disabled')) {
$j('#signRequest_'+nb_visa).val("false");
}
selected = ' selected="selected" ';
}
if ($j("#isAllAttachementSigned").val() == 'false') {
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false">VISEUR</option><option value="true" '+selected+'>SIGNATAIRE</option></select></sub>';
} else if($j("#isAllAttachementSigned").val() == 'allsigned'){
selected = ' selected="selected" ';
if($j("#isAllAttachementSigned").val() == 'allsigned' || $j("#isAllAttachementSigned").val() == 'false'){
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>';
} else {
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'" disabled="disabled"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>';
......@@ -55,21 +45,13 @@ function addVisaUser(users) {
if(nb_visa == 0){
$j("#emptyVisa").hide();
}
if ($j("select[id^=signRequest_] option:selected[value=true]").length <= 2) {
if (!$j('#signRequest_'+nb_visa).is(':disabled')) {
$j('#signRequest_'+nb_visa).val("false");
}
selected = ' selected="selected" ';
} else {
selected = '';
}
if ($j("#isAllAttachementSigned").val() == 'false') {
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false">VISEUR</option><option value="true" '+selected+'>SIGNATAIRE</option></select></sub>';
} else if($j("#isAllAttachementSigned").val() == 'allsigned'){
selected = ' selected="selected" ';
if($j("#isAllAttachementSigned").val() == 'allsigned' || $j("#isAllAttachementSigned").val() == 'false'){
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>';
} else {
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'" disabled="disabled"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>';
signRequest = '<br/><sub><select id="signRequest_'+next_visa+'" disabled="disabled"><option value="false" '+selected+'>VISEUR</option><option value="true">SIGNATAIRE</option></select></sub>';
}
$j("#visa_content").append('<div class="droptarget" id="visa_' + next_visa + '" draggable="true">'
+'<span class="visaUserStatus">'
......@@ -116,30 +98,6 @@ function resetPosVisa () {
$j("#" + this.id).find(".visaUserPos").text(i);
i++;
});
i = 1;
var hasSignatory = false;
$j(".droptarget").each(function() {
if ($j("#signRequest_"+(i)+" option:selected[value=true]").length) {
userRequestSign=true;
} else {
userRequestSign=false;
}
if ($j("#signedUser_"+(i)).css('visibility') == 'visible') {
userSignatory=true;
} else {
userSignatory=false;
}
if(userRequestSign || userSignatory){
hasSignatory = true;
}
if ($j("#signRequest_"+(i+1)).length == 0 && !hasSignatory) {
$j('#signRequest_'+(i)).val("true");
}
i++;
});
i--;
}
......
......@@ -180,7 +180,7 @@ if (!defined('_ENCRYPTED')) {
}
if (!defined('_ADD_VISA_ROLE')) {
define('_ADD_VISA_ROLE', 'Add visa user / signatory user');
define('_ADD_VISA_ROLE', 'Add visa user');
}
if (!defined('_ADD_VISA_MODEL')) {
......
......@@ -201,7 +201,7 @@ if (!defined('_SIGN_USER')) {
}
if (!defined('_ADD_VISA_ROLE')) {
define('_ADD_VISA_ROLE', 'Ajouter un viseur / signataire');
define('_ADD_VISA_ROLE', 'Ajouter un viseur');
}
if (!defined('_ADD_VISA_MODEL')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment