Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix/SCAT-5753 CA/DA vetting validation #1619

Merged
merged 3 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"href": "/da/task-list?path="+ choosenViewPath
},
{
"text": "Set your resources and vetting weightings",
"text": "Select resources and set weightings",
"href": "#"
}]
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ document.addEventListener('DOMContentLoaded', () => {
var rolevalidation=[];
var staffval=[];
var vettval=[];
var rolebox_validation=[];
let totalStaff=0;
let totalVetting=0;

Expand Down Expand Up @@ -93,7 +94,7 @@ if(totalVetting<100 || totalVetting>100)
else if (classTarget.value > 99 && classTarget.value != '') {
document.getElementsByClassName("weight_class")[a - 1].classList.add('govuk-input--error')
document.getElementsByClassName("ca_weight_class_error")[a - 1].innerHTML = 'Please enter number <100 and >0';
preventDefaultState.push(true);
rolebox_validation.push(true);
}
else if (classTarget.value <= 0 && classTarget.value !== '') {
document.getElementsByClassName("weight_class")[a - 1].classList.add('govuk-input--error')
Expand Down Expand Up @@ -180,7 +181,7 @@ if(totalVetting<100 || totalVetting>100)



switch (true) {
/* switch (true) {
case (preventDefaultState.length > 0 && decimalnumber.length > 0 && nonnumerical.length > 0):

e.preventDefault();
Expand Down Expand Up @@ -267,9 +268,71 @@ if(totalVetting<100 || totalVetting>100)
default:
console.log("If all else fails");
break;
}
}*/


let errormsg='';
if(preventDefaultState.length > 0 || decimalnumber.length > 0 || nonnumerical.length > 0 || rolevalidation.length>0 || staffval.length>0 || vettval.length> 0 || rolebox_validation.length>0)
{
if(preventDefaultState.length > 0 && decimalnumber.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field should not contain decimal values</a></li><br><li><a href="#">The input field must be a number</a></li>';

if(preventDefaultState.length > 0 && decimalnumber.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field should not contain decimal values</a></li>';

if (preventDefaultState.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field must be a number</a></li>';

if (decimalnumber.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field should not contain decimal values</a></li><br><li><a href="#">The input field must be a number</a></li>';

if (preventDefaultState.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li>';

if (nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number</a></li>';

if (decimalnumber.length > 0)


errormsg=errormsg+'<li><a href="#">The input field should not contain decimal values</a></li>';

if (rolevalidation.length>0)

errormsg=errormsg+'<li><a href="#">At least 1 DDaT role must be populated with a quantity value</a></li>';

if(staffval.length>0)

errormsg=errormsg+'<li><a href="#">Sum of all [Weighting for number of staff] values for all Role Families in all groups = 100%</a></li>';

if(vettval.length>0)

errormsg=errormsg+'<li><a href="#">Sum of all [Weighting for related vetting requirement] values for all Role Families in all groups = 100%</a></li>';

if(rolebox_validation.length>0)

errormsg=errormsg+'<li><a href="#">Value entered in [How many people you need for this role family?] <= 99</a></li>';



e.preventDefault();
$('#ca_vetting_error_summary').removeClass('hide-block');
$('.govuk-error-summary__title').text('There is a problem');
$("#ca_summary_list").html(errormsg);
$('html, body').animate({ scrollTop: 0 }, 'fast');

}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ document.addEventListener('DOMContentLoaded', () => {
var rolevalidation=[];
var staffval=[];
var vettval=[];
var rolebox_validation=[];
let totalStaff=0;
let totalVetting=0;

Expand Down Expand Up @@ -96,7 +97,7 @@ if(totalVetting<100 || totalVetting>100)
else if (classTarget.value > 99 && classTarget.value != '') {
document.getElementsByClassName("weight_class")[a - 1].classList.add('govuk-input--error')
document.getElementsByClassName("da_weight_class_error")[a - 1].innerHTML = 'Please enter number <100 and >0';
preventDefaultState.push(true);
rolebox_validation.push(true);
}
else if (classTarget.value <= 0 && classTarget.value !== '') {
document.getElementsByClassName("weight_class")[a - 1].classList.add('govuk-input--error')
Expand Down Expand Up @@ -181,7 +182,7 @@ if(totalVetting<100 || totalVetting>100)
*
*/

switch (true) {
/*switch (true) {
case (preventDefaultState.length > 0 && decimalnumber.length > 0 && nonnumerical.length > 0):

e.preventDefault();
Expand Down Expand Up @@ -266,6 +267,69 @@ if(totalVetting<100 || totalVetting>100)
default:
console.log("If all else fails");
break;
}*/
let errormsg='';
if(preventDefaultState.length > 0 || decimalnumber.length > 0 || nonnumerical.length > 0 || rolevalidation.length>0 || staffval.length>0 || vettval.length> 0 || rolebox_validation.length>0)
{
if(preventDefaultState.length > 0 && decimalnumber.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field should not contain decimal values</a></li><br><li><a href="#">The input field must be a number</a></li>';

if(preventDefaultState.length > 0 && decimalnumber.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field should not contain decimal values</a></li>';

if (preventDefaultState.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li><br><li><a href="#">The input field must be a number</a></li>';

if (decimalnumber.length > 0 && nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field should not contain decimal values</a></li><br><li><a href="#">The input field must be a number</a></li>';

if (preventDefaultState.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number less than 100 and greater than 0</a></li>';

if (nonnumerical.length > 0)


errormsg=errormsg+'<li><a href="#">The input field must be a number</a></li>';

if (decimalnumber.length > 0)


errormsg=errormsg+'<li><a href="#">The input field should not contain decimal values</a></li>';

if (rolevalidation.length>0)

errormsg=errormsg+'<li><a href="#">At least 1 DDaT role must be populated with a quantity value</a></li>';

if(staffval.length>0)

errormsg=errormsg+'<li><a href="#">Sum of all [Weighting for number of staff] values for all Role Families in all groups = 100%</a></li>';

if(vettval.length>0)

errormsg=errormsg+'<li><a href="#">Sum of all [Weighting for related vetting requirement] values for all Role Families in all groups = 100%</a></li>';

if(rolebox_validation.length>0)

errormsg=errormsg+'<li><a href="#">Value entered in [How many people you need for this role family?] <= 99</a></li>';

e.preventDefault();
$('#da_vetting_error_summary').removeClass('hide-block');
$('.govuk-error-summary__title').text('There is a problem');
$("#da_summary_list").html(errormsg);
$('html, body').animate({ scrollTop: 0 }, 'fast');



}

if (!inputtedtext.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"title": "Your Project",
"subtitle": "Manage your project from this page including responding to supplier's clarification questions or messages in your inbox. See supplier's answers to your published project.",
"subtitle": "You can manage your project from this page including responding to supplier's clarification questions or messages in your inbox. See supplier's answers to your published project.",
"subtitle1":"You can close this project using the link under the project name below.",
"subsection2_title": "Project ID/name",
"subsection2_content": "Close this project",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/content/requirements/daTaskList-B1.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{
"Task": 4,
"link": "/da/resources-vetting-weightings",
"title": " Select the resources you need and set weighting for vetting and resources ",
"title": " Set your resources and vetting weightings",
"required": "mandatory",
"status": "Cannot start yet"
},
Expand Down