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

Vapo #2623

Merged
merged 30 commits into from
Dec 18, 2024
Merged

Vapo #2623

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d3a1a1f
LEAF 4455 data.metadata read for forms and report builder cells
aerinkayne Oct 18, 2024
1c63e27
Merge branch 'master' into enhance/LEAF-4455/metadata_read_all
aerinkayne Oct 23, 2024
37614a9
LEAF 4455 action_history table read metadata
aerinkayne Oct 30, 2024
cb6420e
LEAF exper server side get progress
aerinkayne Nov 26, 2024
3643446
LEAF exper, formjs side validation, remove error_log
aerinkayne Nov 26, 2024
a8f67b9
LEAF 4604 move count_required to own method, update param
aerinkayne Nov 27, 2024
d1f3ee0
LEAF 4455 get updates from master, resolve submodule conflicts
aerinkayne Nov 27, 2024
f015626
LEAF 4455 records and notes userMetadata read
aerinkayne Dec 2, 2024
e1ea6a5
LEAF 4455 display val logic consistency, read approverName, fix appro…
aerinkayne Dec 2, 2024
b197710
LEAF 4455 read metadata for resolvedBy, remove VAMC init for that lookup
aerinkayne Dec 2, 2024
f2cec1b
LEAF 4455 metadata read, dep -2 requestor followup steps
aerinkayne Dec 2, 2024
e20c490
LEAF 4604 rename some variables, add total tracking
aerinkayne Dec 3, 2024
aeec897
LEAF 4604 comment unused / pending checkbox logic, add trim to data v…
aerinkayne Dec 3, 2024
1911d7a
Revert "LEAF 4455 metadata read, dep -2 requestor followup steps"
aerinkayne Dec 4, 2024
39b09e3
LEAF 4455 keep lookup if pending action, use metadata if avail for mo…
aerinkayne Dec 4, 2024
fdd9aa0
LEAF 4604 method signature per feedback
aerinkayne Dec 4, 2024
a60a75a
LEAF 4455 update q to use record usermetadata instead of join
aerinkayne Dec 5, 2024
f9b7b15
LEAF 4455 use metadata info for comment when setting initiator
aerinkayne Dec 5, 2024
56140ce
LEAF 4455 Report Builder, userID instead of null for inactive accounts
aerinkayne Dec 5, 2024
4955503
LEAF 4455 add actionType to filterData for cancelled by display,
aerinkayne Dec 5, 2024
4b0b014
LEAF 4455 revert view reports change except for join call, handle dis…
aerinkayne Dec 6, 2024
f3cfc8a
LEAF 4455 remove unneeded sql trim for comparison
aerinkayne Dec 6, 2024
a5ac942
LEAF 4455 revert -2 text update since this info is already elsewhere
aerinkayne Dec 9, 2024
a6ea261
LEAF 4455 keep initiatorName query distinct from general records query
aerinkayne Dec 9, 2024
f8c11b7
LEAF 4455 inactive user verbiage, simplify empty metadata check
aerinkayne Dec 10, 2024
9f6733f
Merge pull request #2613 from department-of-veterans-affairs/enhance/…
Pelentan Dec 12, 2024
ab2d96e
Merge pull request #2615 from department-of-veterans-affairs/enhance/…
Pelentan Dec 12, 2024
53146f4
Revert "Merge pull request #2615 from department-of-veterans-affairs/…
aerinkayne Dec 12, 2024
1a15579
Merge pull request #2620 from department-of-veterans-affairs/revert_d…
Pelentan Dec 12, 2024
8f51837
Merge pull request #2621 from department-of-veterans-affairs/dev
Pelentan Dec 12, 2024
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
2 changes: 1 addition & 1 deletion LEAF_Request_Portal/ajaxJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// this method does not exist in Form class
// echo $form->getProgressJSON($_GET['recordID']);
// but this one does
echo $form->getProgress($_GET['recordID']);
echo $form->getProgress((int)$_GET['recordID']);

break;
case 'getrecentactions':
Expand Down
2 changes: 1 addition & 1 deletion LEAF_Request_Portal/api/controllers/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function get($act)
});

$this->index['GET']->register('form/[digit]/progress', function ($args) use ($form) {
$return = $form->getProgress($args[0]);
$return = $form->getProgress((int)$args[0]);
return $return;
});

Expand Down
115 changes: 76 additions & 39 deletions LEAF_Request_Portal/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,28 @@ var LeafForm = function (containerID) {
/** cross walk end */

let childRequiredValidators = {};
//store required validators for the controlled question and any subchildren on main entry and modals
const handleChildValidators = (childID) => {
if (!childRequiredValidators[childID]) {
childRequiredValidators[childID] = {
validator: formRequired[`id${childID}`]?.setRequired,
};
}
//reset the validator, if there is one, from the stored value
if (
childRequiredValidators[childID].validator !== undefined &&
dialog !== null
) {
dialog.requirements[childID] =
childRequiredValidators[childID].validator;
}
let arrValidatorIDs = [ childID ];
const arrSubchildren = Array.from(
document.querySelectorAll(`.response.blockIndicator_${childID} div.response[class*="blockIndicator_"]`)
);
arrSubchildren.forEach(element => {
const id = +element.className.match(/(\d+)$/)?.[0];
if(id > 0) {
arrValidatorIDs.push(id);
}
});
arrValidatorIDs.forEach(id => {
if (!childRequiredValidators[id]) {
childRequiredValidators[id] = {
validator: formRequired[`id${id}`]?.setRequired,
};
}
if (childRequiredValidators[id].validator !== undefined && dialog !== null) {
dialog.requirements[id] = childRequiredValidators[id].validator;
}
});
};
//validator ref for required question in a hidden state
const hideShowValidator = function () {
Expand Down Expand Up @@ -361,32 +369,61 @@ var LeafForm = function (containerID) {
return sanitize(val).trim();
};

/* clear out potential entries and set validator for hidden questions */
const clearValues = (childFormat = "", childIndID = 0) => {
$("#" + childIndID).val(""); //clears most formats
$(`input[id^="${childIndID}_"]`).prop("checked", false); //radio and checkbox(es) formats
$(`input[id^="${childIndID}_radio0"]`).prop("checked", true);

$(`#grid_${childIndID}_1_input tbody td`) //grid table data
.each(function () {
if ($("textarea", this).length) {
$("textarea", this).val('');
} else if ($("select", this).length) {
$("select", this).val('');
} else if ($("input", this).length) {
$("input", this).val('');
/*hide the question and any subquestions. clear out potential entries and set validator for hidden questions */
const clearValues = (childIndID = 0) => {
const arrSubchildren = Array.from(
document.querySelectorAll(`.response.blockIndicator_${childIndID} div.response[class*="blockIndicator_"]`)
);

//parse the IDs of any additional subquestions
let arrChildAndSubquestionIDs = [ childIndID ];
arrSubchildren.forEach(element => {
const id = +element.className.match(/(\d+)$/)?.[0];
if(id > 0) {
arrChildAndSubquestionIDs.push(id);
}
});

if (childFormat === "multiselect") {
clearMultiSelectChild($("#" + childIndID), childIndID);
}
if (
childRequiredValidators[childIndID].validator !== undefined &&
dialog !== null
) {
dialog.requirements[childIndID] = hideShowValidator;
}
arrChildAndSubquestionIDs.forEach(id => {
//clear values for questions in a hidden state.
$("#" + id).val(""); //most formats
$(`input[id^="${id}_"]`).prop("checked", false); //radio and checkbox(es) formats

$(`#grid_${id}_1_input tbody td`) //grid table data
.each(function () {
if ($("textarea", this).length) {
$("textarea", this).val('');
} else if ($("select", this).length) {
$("select", this).val('');
} else if ($("input", this).length) {
$("input", this).val('');
}
});

const isMultiselectQuestion = document.querySelector(`select[id="${id}"][multiple]`) !== null;
if (isMultiselectQuestion) {
clearMultiSelectChild($("#" + id), id);
}

const isRadioQuestion = document.querySelector(`input[id^="${id}_radio"]`) !== null;
if(isRadioQuestion) {
const radioEmpty = $(`input[id^="${id}_radio0"]`); //need to add hidden empty input to clear radio
if (radioEmpty.length === 0) {
$(`div.response.blockIndicator_${id}`).prepend(
`<input id="${id}_radio0" name="${id}" value="" style="display:none;" />`
);
}
$(`input[id^="${id}_radio0"]`).prop("checked", true);
}

//if the question is required, use the alternate validator
if (
childRequiredValidators[id].validator !== undefined &&
dialog !== null
) {
dialog.requirements[id] = hideShowValidator;
}
});
};

/**
Expand Down Expand Up @@ -526,7 +563,7 @@ var LeafForm = function (containerID) {
switch (co) {
case "hide":
if (hideShowConditionMet === true) {
clearValues(childFormat, childID);
clearValues(childID);
elChildResponse.classList.add('response-hidden');
elsChild.hide();
elsChild.attr('aria-hidden', true);
Expand All @@ -542,7 +579,7 @@ var LeafForm = function (containerID) {
elsChild.removeAttr('aria-hidden');
elsChild.show();
} else {
clearValues(childFormat, childID);
clearValues(childID);
elChildResponse.classList.add('response-hidden');
elsChild.hide();
elsChild.attr('aria-hidden', true);
Expand Down Expand Up @@ -611,7 +648,7 @@ var LeafForm = function (containerID) {
setTimeout(() => {
const closestHidden = elChildResponse.closest('.response-hidden');
if (closestHidden !== null) {
clearValues(childFormat, childID);
clearValues(childID);
}

elChildInput.trigger("change");
Expand Down
Loading
Loading