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

Correspondence and Appeal Tasks: Inbound Ops Team Superuser/visor: Remove Evidence Submission Window Action Dropdown #23083

Merged
merged 16 commits into from
Oct 8, 2024
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
4 changes: 4 additions & 0 deletions app/models/serializers/work_queue/appeal_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,8 @@ class WorkQueue::AppealSerializer
end

attribute :has_completed_sct_assign_task, &:completed_specialty_case_team_assign_task?

attribute :waivable do |object|
object.tasks.where(type: "EvidenceSubmissionWindowTask").any?(&:waivable?)
end
end
4 changes: 4 additions & 0 deletions app/models/serializers/work_queue/task_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class WorkQueue::TaskSerializer
}
end

attribute :waivable do |object|
object.try(:waivable?) ? true : false
end

attribute :cancelled_by do |object|
{
css_id: object.cancelled_by.try(:css_id)
Expand Down
26 changes: 26 additions & 0 deletions app/models/tasks/evidence_submission_window_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ def update_from_params(params, user)
[self]
end

# only inbound ops superusers/supervisors can waive the Evidence Window task.
def waivable?
return false unless RequestStore[:current_user].inbound_ops_team_superuser? ||
RequestStore[:current_user].inbound_ops_team_supervisor?

assigned_at > 90.days.ago && status == Constants.TASK_STATUSES.completed
end

def actions_available?(user)
return true if user_can_waive_task?(user)

super
end

def available_actions(user)
if user_can_waive_task?(user)
return [Constants.TASK_ACTIONS.REMOVE_WAIVE_EVIDENCE_WINDOW.to_h]
end

[]
end

private

def set_assignee
Expand Down Expand Up @@ -91,4 +113,8 @@ def cancelled_schedule_hearing_task
def update_params_will_create_ihp_task?(params)
params[:status].eql?(Constants.TASK_STATUSES.completed)
end

def user_can_waive_task?(user)
(user&.inbound_ops_team_superuser? || user&.inbound_ops_team_supervisor?) && waivable?
end
end
7 changes: 5 additions & 2 deletions client/app/queue/components/TaskRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class TaskRows extends React.PureComponent {
};

taskLabelListItem = (task) => {
if (task.closedAt) {
if (task.closedAt && !task?.waivable) {
return null;
}

Expand Down Expand Up @@ -516,14 +516,16 @@ class TaskRows extends React.PureComponent {
return null;
}

return this.showActionsSection(task) ? (
return this.showActionsSection(task) || this.taskIsWaivable(task) ? (
<div>
<h3>{COPY.TASK_SNAPSHOT_ACTION_BOX_TITLE}</h3>
<ActionsDropdown task={task} appealId={appeal.externalId} />
</div>
) : null;
};

taskIsWaivable = (task) => task?.waivable && this.props.waivableUser;

showActionsSection = (task) => task && !this.props.hideDropdown;

hearingRequestTypeConvertedAtListItem = (task) => {
Expand Down Expand Up @@ -773,6 +775,7 @@ TaskRows.propTypes = {
hideDropdown: PropTypes.bool,
taskList: PropTypes.array,
timeline: PropTypes.bool,
waivableUser: PropTypes.bool
};

export default TaskRows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const CorrespondenceAppealTasks = (props) => {
timeline={false}
editNodDateEnabled={false}
hideDropdown
waivableUser={props.waivableUser}
/>
</div>
</div>
Expand All @@ -78,7 +79,9 @@ CorrespondenceAppealTasks.propTypes = {
task_added: PropTypes.object,
organizations: PropTypes.array,
userCssId: PropTypes.string,
appeal: PropTypes.object
appeal: PropTypes.object,
waivableUser: PropTypes.bool

};

export default CorrespondenceAppealTasks;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { ExternalLinkIcon } from 'app/components/icons/ExternalLinkIcon';
import { COLORS } from 'app/constants/AppConstants';
import Checkbox from 'app/components/Checkbox';
import CorrespondencePaginationWrapper from 'app/queue/correspondence/CorrespondencePaginationWrapper';

import Button from '../../../components/Button';
import Alert from '../../../components/Alert';
import ApiUtil from '../../../util/ApiUtil';
Expand Down Expand Up @@ -494,6 +493,7 @@ const CorrespondenceDetails = (props) => {
organizations={props.organizations}
userCssId={props.userCssId}
appeal={taskAdded.appeal.data.attributes}
waivableUser={props.isInboundOpsSuperuser || props.isInboundOpsSupervisor}
/>
)
)}
Expand Down
11 changes: 7 additions & 4 deletions client/app/queue/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const taskAttributesFromRawTask = (task) => {
},
veteranParticipantId: task.attributes.veteran_participant_id,
veteranSSN: task.attributes.veteran_ssn,
appeal_receipt_date: task.attributes.appeal_receipt_date
appeal_receipt_date: task.attributes.appeal_receipt_date,
waivable: task.attributes.waivable
};
};

Expand Down Expand Up @@ -563,7 +564,8 @@ export const prepareAppealForStore = (appeals) => {
locationHistory: prepareLocationHistoryForStore(appeal),
hasCompletedSctAssignTask: appeal.attributes.has_completed_sct_assign_task,
mst: appeal.attributes.mst,
pact: appeal.attributes.pact
pact: appeal.attributes.pact,
waivable: appeal.attributes?.waivable
};

return accumulator;
Expand Down Expand Up @@ -644,7 +646,8 @@ export const prepareAppealForSearchStore = (appeals) => {
caseflowVeteranId: appeal.attributes.caseflow_veteran_id,
locationHistory: prepareLocationHistoryForStore(appeal),
mst: appeal.attributes.mst,
pact: appeal.attributes.pact
pact: appeal.attributes.pact,
waivable: appeal.attributes?.waivable
};

return accumulator;
Expand Down Expand Up @@ -903,7 +906,7 @@ export const currentDaysOnHold = (task) => {
};

export const taskIsActive = (task) =>
![TASK_STATUSES.completed, TASK_STATUSES.cancelled].includes(task.status);
![TASK_STATUSES.completed, TASK_STATUSES.cancelled].includes(task.status) || task?.waivable;
HunJerBAH marked this conversation as resolved.
Show resolved Hide resolved

export const taskActionData = ({ task, match }) => {
if (!task) {
Expand Down
4 changes: 4 additions & 0 deletions client/constants/TASK_ACTIONS.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,5 +577,9 @@
"label": "Cancel task",
"value": "modal/cancel_correspondence_task",
"func": "cancel_correspondence_task_data"
},
"REMOVE_WAIVE_EVIDENCE_WINDOW": {
"label": "Remove waive of evidence window",
"value:": "remove_waive_of_evidence_window"
}
}
Loading