Skip to content

Commit

Permalink
Merge branch 'feature/APPEALS-53424' into TYLERB/APPEALS-56609
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBroyles committed Oct 25, 2024
2 parents 05995b3 + 096145a commit 13ee9e4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
"ORGANIZATIONAL_QUEUE_PAGE_ASSIGNED_TAB_TITLE": "Assigned (%d)",
"ORGANIZATIONAL_QUEUE_PAGE_IN_PROGRESS_TAB_TITLE": "In Progress (%d)",
"ORGANIZATIONAL_QUEUE_ON_HOLD_TAB_TITLE": "On Hold (%d)",
"VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION": "Cases completed:",
"VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION": "Cases completed",
"VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION_WITH_FILTER": "Cases completed (%s)",
"EDUCATION_RPO_QUEUE_PAGE_COMPLETED_TASKS_DESCRIPTION": "Cases completed in the last 7 days:",
"VHA_ORGANIZATIONAL_QUEUE_PAGE_READY_FOR_REVIEW_TAB_TITLE": "Ready for Review",
Expand Down
22 changes: 17 additions & 5 deletions client/app/components/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ class DatePicker extends React.PureComponent {
apply() {
const { onChange } = this.props;

if (this.state.mode === 'all') {
this.clearFilter();
this.hideDropdown();

return true;
}

if (onChange) {
onChange(`${this.state.mode },${ this.state.startDate },${ this.state.endDate}`);
}
Expand Down Expand Up @@ -225,6 +232,8 @@ class DatePicker extends React.PureComponent {
}
} else if (this.state.mode !== '') {
disabled = this.state.startDate === '';
} else if (this.state.mode === 'all') {
disabled = false;
}

return disabled;
Expand All @@ -243,19 +252,22 @@ class DatePicker extends React.PureComponent {
}

updateMode = (mode) => {
const format = 'YYYY-MM-DD';

this.setState({ mode });
if (mode !== 'between') {
this.setState({ endDate: '' });
}

if (mode === 'last7') {
this.setState({ startDate: moment().subtract(7, 'days') });
this.setState({ startDate: moment().subtract(7, 'days').
format(format) });
} else if (mode === 'last30') {
this.setState({ startDate: moment().subtract(30, 'days') });
this.setState({ startDate: moment().subtract(30, 'days').
format(format) });
} else if (mode === 'last365') {
this.setState({ startDate: moment().subtract(365, 'days') });
} else if (mode === 'all') {
this.setState({ startDate: moment().subtract(300, 'years') });
this.setState({ startDate: moment().subtract(365, 'days').
format(format) });
}
}

Expand Down
8 changes: 4 additions & 4 deletions client/app/nonComp/components/NonCompTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ const NonCompTabsUnconnected = (props) => {
const buildCompletedTabDescriptionFromFilter = (filters) => {
const completedDateFilter = filters.find((value) => value.includes('col=completedDateColumn'));

if (completedDateFilter) {
if (!isVhaBusinessLine) {
return COPY.QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION;
} else if (completedDateFilter) {
const match = completedDateFilter.match(/val=([^&]*)/);

if (match) {
Expand All @@ -78,11 +80,9 @@ const NonCompTabsUnconnected = (props) => {
completedDateFilterModeHandlers[mode]);
}

} else if (!isVhaBusinessLine) {
return COPY.QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION;
}

return COPY.QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION;
return COPY.VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION;

};

Expand Down
19 changes: 14 additions & 5 deletions client/app/queue/QueueTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export default class QueueTable extends React.PureComponent {
});
}

return filters;
return _.omit(filters, 'undefined');
};

defaultRowClassNames = () => '';
Expand Down Expand Up @@ -586,14 +586,23 @@ export default class QueueTable extends React.PureComponent {

// Remove paramsToClear from currentParams if they are not in tableParams
paramsToClear.forEach((param) => {
if (!tableParams.has(param)) {
currentParams.delete(param);
}
currentParams.delete(param);
});

// Merge tableParams and tabParams into currentParams, overwriting any duplicate keys
for (const [key, value] of [...tabParams.entries(), ...tableParams.entries()]) {
currentParams.set(key, value);
if (key.includes('[]')) {
// Get all current values for the key
const existingValues = currentParams.getAll(key);

// If the new value doesn't already exist, append it
if (!existingValues.includes(value)) {
currentParams.append(key, value);
}
} else {
// Set for all other keys (overrides existing values)
currentParams.set(key, value);
}
}

return `${base}?${currentParams.toString()}`;
Expand Down
6 changes: 3 additions & 3 deletions client/test/app/components/DatePicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('DatePicker', () => {

clickSubmissionButton('Apply Filter');

expect(handleChange).toHaveBeenCalledWith('last7,Wed Jan 10 2024 02:00:00 GMT-0500,');
expect(handleChange).toHaveBeenCalledWith('last7,2024-01-10,');
});

it('quick select options can select last 30 days', async () => {
Expand All @@ -173,7 +173,7 @@ describe('DatePicker', () => {

clickSubmissionButton('Apply Filter');

expect(handleChange).toHaveBeenCalledWith('last30,Mon Dec 18 2023 02:00:00 GMT-0500,');
expect(handleChange).toHaveBeenCalledWith('last30,2023-12-18,');
});

it('quick select options can select last 365 days', async () => {
Expand All @@ -189,7 +189,7 @@ describe('DatePicker', () => {

clickSubmissionButton('Apply Filter');

expect(handleChange).toHaveBeenCalledWith('last365,Tue Jan 17 2023 02:00:00 GMT-0500,');
expect(handleChange).toHaveBeenCalledWith('last365,2023-01-17,');
});

it('disables Apply Filter button if between is selected and the start date is after the end date', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/test/app/nonComp/NonCompTabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('NonCompTabsVha', () => {

await waitFor(() => {
// expect(screen.getByText('Cases completed (last 7 days):')).toBeInTheDocument();
expect(screen.getByText('Cases completed:')).toBeInTheDocument();
expect(screen.getByText('Cases completed')).toBeInTheDocument();
});

// Check for the correct completed tasks header values
Expand Down
4 changes: 2 additions & 2 deletions spec/feature/non_comp/reviews_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def current_table_rows

# Verify the filter counts for the completed tab
click_on "Completed Tasks"
expect(page).to have_content(COPY::QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION)
expect(page).to have_content(COPY::VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION)
# Turn this back on after last 7 days prefilter is added
# expect(page).to have_content(COPY::QUEUE_PAGE_COMPLETE_LAST_SEVEN_DAYS_TASKS_DESCRIPTION)
find("[aria-label='Filter by issue type']").click
Expand Down Expand Up @@ -1004,7 +1004,7 @@ def current_table_rows
# expect(page).to have_content("Viewing 1-2 of 2 total")

# Remove these 3 once Last 7 days pre filter is added back
expect(page).to have_content("Cases completed:")
expect(page).to have_content(COPY::VHA_QUEUE_PAGE_COMPLETE_TASKS_DESCRIPTION)
expect(page).to_not have_content("Date Completed (1)")
expect(page).to have_content("Viewing 1-3 of 3 total")

Expand Down

0 comments on commit 13ee9e4

Please sign in to comment.