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

Team Queue and Individual Correspondence Page - Framework 35471 #20672

Merged
merged 51 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
8ed1da7
APPEALS-35714 - Initial WIP Commit
KiMauVA Jan 19, 2024
c9c6a0d
WIP correspondence config
wmedders21 Jan 22, 2024
2387c88
Initial commit for correspondence migration
divyadasari-va Jan 23, 2024
8652d8c
APPEALS-35714 - Clear comments, update controller
KiMauVA Jan 23, 2024
d809a9f
Commit for seed data updations with the AC
divyadasari-va Jan 23, 2024
262b1bd
Update correspondence_config to use correspondence related classes
wmedders21 Jan 24, 2024
ea626fa
Temporarily default column filtering to false
wmedders21 Jan 24, 2024
8c095e6
Override methods to work with correspondence tasks
wmedders21 Jan 24, 2024
5535105
allow correspondence tasks
wmedders21 Jan 24, 2024
5f6ea7a
add correspondence queue tabs for org
wmedders21 Jan 24, 2024
313f95d
update column names
wmedders21 Jan 24, 2024
a5574c5
update column names
wmedders21 Jan 24, 2024
edda7ab
add correspondence org queue tabs
wmedders21 Jan 24, 2024
47f150a
add task column serializer for correspondence queue
wmedders21 Jan 24, 2024
4244077
add helper to be able to call correspondence on correspondence tasks …
wmedders21 Jan 24, 2024
a659574
revert controller changes
wmedders21 Jan 24, 2024
ebcf53c
Update correspondence_controller.rb
KiMauVA Jan 24, 2024
f31c10d
Update constants.js
KiMauVA Jan 24, 2024
2d1ff8c
APPEALS-35714 - Tasks 2 Config
KiMauVA Jan 24, 2024
5dd293f
Update CorrespondenceCases.jsx
KiMauVA Jan 24, 2024
a89f96b
APPEALS-35714 - Title Update
KiMauVA Jan 24, 2024
374bc22
added dynamic routing to correspondence cases
wmedders21 Jan 24, 2024
c068fca
Merge branch 'Ki/APPEALS-35714' of github.com:department-of-veterans-…
wmedders21 Jan 24, 2024
3334233
Commit for generating few othere tasks
divyadasari-va Jan 24, 2024
6650ca6
create fixtures for individual and team correspondence config
wmedders21 Jan 25, 2024
058e9d4
update task tab attributes
wmedders21 Jan 25, 2024
5eb55be
Revert changes to CorrespondenceCases.jsx
wmedders21 Jan 25, 2024
c3c59a5
Revert changes to QueueTableBuilder.jsx
wmedders21 Jan 25, 2024
7900d88
remove fixtures
wmedders21 Jan 25, 2024
0302cc7
Test: correspondence_config
wmedders21 Jan 25, 2024
ea8973d
Commit for the changes mentioned for task file and reverting the chan…
divyadasari-va Jan 25, 2024
63a8f20
add column names to JSON file
wmedders21 Jan 25, 2024
490df1e
Merge branch 'Ki/APPEALS-35714' into wmedders21/APPEALS-35816
wmedders21 Jan 25, 2024
64e7715
connect to config
wmedders21 Jan 26, 2024
7864d87
Merge branch 'feature/APPEALS-27311' of github.com:department-of-vete…
wmedders21 Jan 26, 2024
f71c879
Merge branch 'Div/APPEALS-38389' of github.com:department-of-veterans…
wmedders21 Jan 26, 2024
3b1de8e
Update columns
wmedders21 Jan 26, 2024
2057e09
Experimental changes
Rnmarshall93 Jan 30, 2024
e2de357
Merge branch 'KiRyan-35471' of github.com:department-of-veterans-affa…
wmedders21 Jan 31, 2024
cb64fd6
fix pagination for individual correspondence queue table
wmedders21 Jan 31, 2024
27d52b4
fix pagination for organization correspondence queue table
wmedders21 Jan 31, 2024
ebcc37d
Fix extra end
wmedders21 Jan 31, 2024
f7d031f
fix indentation
wmedders21 Jan 31, 2024
317f23b
RuboCop Fixes
KiMauVA Jan 31, 2024
238a67e
Merge branch 'feature/APPEALS-32900' into KiRyan-35471
KiMauVA Jan 31, 2024
7807ee9
Merge Issues
KiMauVA Jan 31, 2024
9a2de25
minor changes to get the component rendering
Rnmarshall93 Feb 1, 2024
7c17511
Fixed redux issue
Rnmarshall93 Feb 1, 2024
363ff1a
Removed duplicates
Rnmarshall93 Feb 1, 2024
ef075df
Fixed rubocop warning in a correct way.
Rnmarshall93 Feb 1, 2024
23dab7e
Removed React.Fragments and replaced with <>
Rnmarshall93 Feb 1, 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
27 changes: 27 additions & 0 deletions app/controllers/concerns/task_pagination_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,28 @@ def pagination_json
}
end

def correspondence_pagination_json
{
tasks: correspondence_json_tasks(correspondence_task_pager.paged_tasks),
task_page_count: correspondence_task_pager.task_page_count,
total_task_count: correspondence_task_pager.total_task_count,
tasks_per_page: CorrespondenceTaskPager::TASKS_PER_PAGE
}
end

private

def correspondence_task_pager
@correspondence_task_pager ||= CorrespondenceTaskPager.new(
assignee: assignee,
tab_name: params[Constants.QUEUE_CONFIG.TAB_NAME_REQUEST_PARAM.to_sym],
page: params[Constants.QUEUE_CONFIG.PAGE_NUMBER_REQUEST_PARAM.to_sym],
sort_order: params[Constants.QUEUE_CONFIG.SORT_DIRECTION_REQUEST_PARAM.to_sym],
sort_by: params[Constants.QUEUE_CONFIG.SORT_COLUMN_REQUEST_PARAM.to_sym],
filters: params[Constants.QUEUE_CONFIG.FILTER_COLUMN_REQUEST_PARAM.to_sym]
)
end

def task_pager
@task_pager ||= TaskPager.new(
assignee: assignee,
Expand All @@ -30,6 +50,13 @@ def task_pager
)
end

def correspondence_json_tasks(tasks)
{ data: WorkQueue::CorrespondenceTaskColumnSerializer.new(
tasks,
is_collection: true
).serializable_hash[:data] }
end

def json_tasks(tasks)
tasks = AppealRepository.eager_load_legacy_appeals_for_tasks(tasks)
params = { user: current_user }
Expand Down
17 changes: 17 additions & 0 deletions app/controllers/correspondence_task_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

class CorrespondenceTaskPagesController < ApplicationController
include TaskPaginationConcern

def index
render json: correspondence_pagination_json
end

def assignee
if params[:user_id]
User.find(params[:user_id])
elsif params[:organization_id]
Organization.find(params[:organization_id])
end
end
end
7 changes: 6 additions & 1 deletion app/models/correspondence_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,17 @@ def attach_tasks_to_tab(tab)
sort_order: tab.default_sorting_direction
)
endpoint = "task_pages?#{Constants.QUEUE_CONFIG.TAB_NAME_REQUEST_PARAM}=#{tab.name}"
base_path = if assignee_is_org?
"organizations/#{assignee.id}/"
else
"correspondence/users/#{assignee.id}/}#{endpoint}"
end

tab.to_hash.merge(
tasks: serialized_tasks_for_columns(task_pager.paged_tasks, tab.column_names),
task_page_count: task_pager.task_page_count,
total_task_count: task_pager.total_task_count,
task_page_endpoint_base_path: "#{assignee_is_org? ? "#{assignee.path}/" : "users/#{assignee.id}/"}#{endpoint}"
task_page_endpoint_base_path: base_path
)
end

Expand Down
8 changes: 8 additions & 0 deletions app/models/correspondence_queue_tab.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ def task_includes
def default_sorting_column
CorrespondenceQueueColumn.from_name(Constants.QUEUE_CONFIG.COLUMNS.VA_DATE_OF_RECEIPT.name)
end

# If you don't create your own tab name it will default to the tab defined in QueueTab
def self.from_name(tab_name)
tab = descendants.find { |subclass| subclass.tab_name == tab_name }
fail(Caseflow::Error::InvalidTaskTableTab, tab_name: tab_name) unless tab

tab
end
end
8 changes: 8 additions & 0 deletions app/models/tasks/cavc_correspondence_mail_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ def user_task_assigned_to_cavc_lit_support
def assigned_to_cavc_lit_team_member
CavcLitigationSupport.singleton.users.include?(assigned_to)
end

def status_is_valid_on_create
unless [Constants.TASK_STATUSES.assigned, Constants.TASK_STATUSES.completed].include?(status)
fail Caseflow::Error::InvalidStatusOnTaskCreate, task_type: type
end

true
end
end
16 changes: 11 additions & 5 deletions app/models/tasks/correspondence_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,21 @@ def correspondence

private

# rubocop:disable Metrics/CyclomaticComplexity
def status_is_valid_on_create
if type == "ReviewPackageTask" && status != Constants.TASK_STATUSES.unassigned
update!(status: :unassigned)
elsif type != "ReviewPackageTask" && status != Constants.TASK_STATUSES.assigned
fail Caseflow::Error::InvalidStatusOnTaskCreate, task_type: type
case type
when "ReviewPackageTask"
return Constants.TASK_STATUSES.on_hold if status != Constants.TASK_STATUSES.on_hold
when "CorrespondenceIntakeTask", "EfolderUploadFailedTask"
return Constants.TASK_STATUSES.in_progress if status != Constants.TASK_STATUSES.in_progress
when "CorrespondenceRootTask", "HearingPostponementRequestMailTask"
return Constants.TASK_STATUSES.completed if status != Constants.TASK_STATUSES.completed
else
fail Caseflow::Error::InvalidStatusOnTaskCreate, task_type: type unless status == Constants.TASK_STATUSES.assigned
end

true
end
# rubocop:enable Metrics/CyclomaticComplexity

def assignee_status_is_valid_on_create
if parent&.child_must_have_active_assignee? && assigned_to.is_a?(User) && !assigned_to.active?
Expand Down
8 changes: 4 additions & 4 deletions client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"CASE_LIST_TABLE_QUEUE_DROPDOWN_OWN_CASES_LABEL": "Your cases",
"CASE_LIST_TABLE_QUEUE_DROPDOWN_TEAM_CASES_LABEL": "%s team cases",
"CASE_LIST_TABLE_QUEUE_DROPDOWN_CORRESPONDENCE_CASES": "Correspondence Cases",
"TITLE_MODAL_EDIT_DOCUMENT_TYPE_CORRESPONDENCE" : "Edit document type",
"TEXT_MODAL_EDIT_DOCUMENT_TYPE_CORRESPONDENCE" : "Change the document type of the selected document.",
"ORIGINAL_DOC_EDIT_DOCUMENT_TYPE_CORRESPONDENCE" : "Original document type",
"NEW_DOC_EDIT_DOCUMENT_TYPE_CORRESPONDENCE" : "New document type",
"TITLE_MODAL_EDIT_DOCUMENT_TYPE_CORRESPONDENCE": "Edit document type",
"TEXT_MODAL_EDIT_DOCUMENT_TYPE_CORRESPONDENCE": "Change the document type of the selected document.",
"ORIGINAL_DOC_EDIT_DOCUMENT_TYPE_CORRESPONDENCE": "Original document type",
"NEW_DOC_EDIT_DOCUMENT_TYPE_CORRESPONDENCE": "New document type",
"CASE_LIST_TABLE_EMPTY_TEXT": "This Veteran has no appeals at this time.",
"CASE_LIST_TABLE_TOTAL_DAYS_COLUMN_TITLE": "Total Days",
"CASE_LIST_TABLE_BOARD_INTAKE": "Board Intake",
Expand Down
7 changes: 5 additions & 2 deletions client/app/queue/QueueTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Pagination from '../components/Pagination/Pagination';
import { COLORS, LOGO_COLORS } from '../constants/AppConstants';
import ApiUtil from '../util/ApiUtil';
import LoadingScreen from '../components/LoadingScreen';
import { tasksWithAppealsFromRawTasks } from './utils';
import { tasksWithAppealsFromRawTasks, tasksWithCorrespondenceFromRawTasks } from './utils';
import QUEUE_CONFIG from '../../constants/QUEUE_CONFIG';
import COPY from '../../COPY';

Expand Down Expand Up @@ -638,7 +638,9 @@ export default class QueueTable extends React.PureComponent {
tasks: { data: tasks }
} = response.body;

const preparedTasks = tasksWithAppealsFromRawTasks(tasks);
const preparedTasks = this.props.isCorrespondenceTable ?
tasksWithCorrespondenceFromRawTasks(tasks) :
tasksWithAppealsFromRawTasks(tasks);

const preparedResponse = Object.assign(response.body, { tasks: preparedTasks });

Expand Down Expand Up @@ -843,6 +845,7 @@ HeaderRow.propTypes = FooterRow.propTypes = Row.propTypes = BodyRows.propTypes =
}),
onHistoryUpdate: PropTypes.func,
preserveFilter: PropTypes.bool,
isCorrespondenceTable: PropTypes.bool,
};

Row.propTypes.rowObjects = PropTypes.arrayOf(PropTypes.object);
Expand Down
46 changes: 46 additions & 0 deletions client/app/queue/components/TaskTableColumns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ContinuousProgressBar from 'app/components/ContinuousProgressBar';
import OnHoldLabel, { numDaysOnHold } from './OnHoldLabel';
import IhpDaysWaitingTooltip from './IhpDaysWaitingTooltip';
import TranscriptionTaskTooltip from './TranscriptionTaskTooltip';
import Checkbox from '../../components/Checkbox';

import { taskHasCompletedHold, hasDASRecord, collapseColumn, regionalOfficeCity, renderAppealType } from '../utils';
import { DateString, daysSinceAssigned, daysSincePlacedOnHold } from '../../util/DateUtil';
Expand Down Expand Up @@ -222,6 +223,51 @@ export const assignedByColumn = () => {
};
};

export const veteranDetails = () => {
return {
header: 'Veteran Details',
valueFunction: (task) => task.veteranDetails
};
};

export const vaDor = () => {

return {
header: 'VA DOR',
valueFunction: (task) => {
return moment(task.vador).format('MM/DD/YYYY');
}
};
};

export const notes = () => {
return {
header: 'Notes',
valueFunction: (task) => task.notes
};
};

export const checkboxColumn = () => {
return {
header: 'Select',
valueFunction: (task) => task ? <Checkbox id={task.uniqueId} /> : ''
};
};

export const actionType = () => {
return {
header: 'Action Type',
valueFunction: (task) => task.actionType
};
};

export const daysWaitingCorrespondence = () => {
return {
header: 'Days Waiting',
valueFunction: (task) => task.daysWaiting
};
};

export const regionalOfficeColumn = (tasks, filterOptions) => {
return {
header: COPY.CASE_LIST_TABLE_REGIONAL_OFFICE_COLUMN_TITLE,
Expand Down
50 changes: 15 additions & 35 deletions client/app/queue/correspondence/CorrespondenceCases.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,23 @@ import AppSegment from '@department-of-veterans-affairs/caseflow-frontend-toolki
import PropTypes from 'prop-types';
import COPY from '../../../COPY';
import { sprintf } from 'sprintf-js';
import { css } from 'glamor';
// import CorrespondenceTable from './CorrespondenceTable';
// import QueueOrganizationDropdown from '../components/QueueOrganizationDropdown';
import CorrespondenceTableBuilder from './CorrespondenceTableBuilder';
import Alert from '../../components/Alert';

// import {
// initialAssignTasksToUser,
// initialCamoAssignTasksToVhaProgramOffice
// } from '../QueueActions';

const CorrespondenceCases = (props) => {
const dispatch = useDispatch();
const configUrl = props.configUrl;

const currentAction = useSelector((state) => state.reviewPackage.lastAction);
const veteranInformation = useSelector((state) => state.reviewPackage.veteranInformation);

const [vetName, setVetName] = useState('');

useEffect(() => {
dispatch(loadCorrespondenceConfig(configUrl));
}, [dispatch, configUrl]);
}, []);

useEffect(() => {
// Retry the request after a delay
setTimeout(() => {
if (configUrl) {
dispatch(loadCorrespondenceConfig(configUrl));
}
}, 1000);
}, [configUrl]);
const config = useSelector((state) => state.intakeCorrespondence.correspondenceConfig);

useEffect(() => {
if (
Expand All @@ -46,28 +33,21 @@ const CorrespondenceCases = (props) => {
}, [veteranInformation]);

return (
<React.Fragment>
<>
<AppSegment filledBackground>
{(veteranInformation?.veteran_name?.first_name && veteranInformation?.veteran_name?.last_name) &&
{(veteranInformation?.veteran_name?.first_name && veteranInformation?.veteran_name?.last_name) &&
currentAction.action_type === 'DeleteReviewPackage' && (
<Alert
type="success"
title={sprintf(COPY.CORRESPONDENCE_TITLE_REMOVE_PACKAGE_BANNER, vetName)}
message={COPY.CORRESPONDENCE_MESSAGE_REMOVE_PACKAGE_BANNER}
scrollOnAlert={false}
/>
)}
<h1 {...css({ display: 'inline-block' })}>
{COPY.CASE_LIST_TABLE_QUEUE_DROPDOWN_CORRESPONDENCE_CASES}
</h1>
{/* <QueueOrganizationDropdown organizations={organizations} />
{this.props.correspondenceConfig &&
<CorrespondenceTable
correspondenceConfig={this.props.correspondenceConfig}
<Alert
type="success"
title={sprintf(COPY.CORRESPONDENCE_TITLE_REMOVE_PACKAGE_BANNER, vetName)}
message={COPY.CORRESPONDENCE_MESSAGE_REMOVE_PACKAGE_BANNER}
scrollOnAlert={false}
/>
} */}
)}
{config &&
<CorrespondenceTableBuilder />}
</AppSegment>
</React.Fragment>
</>
);
};

Expand Down
Loading
Loading