Skip to content

Commit

Permalink
Merge branch 'master' into queue/tomas/9885-create-change-disposition…
Browse files Browse the repository at this point in the history
…-task-and-actions
  • Loading branch information
va-bot authored Apr 8, 2019
2 parents 726c12e + 703bc8b commit 465a971
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 25 deletions.
1 change: 1 addition & 0 deletions client/COPY.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
"NO_RELATIONSHIPS": "This Veteran currently has no known relationships. If you have access, please add the claimant to the Corporate Database to continue processing this intake. If you do not have access, please ",
"CLAIMANT_NOT_FOUND_START": "Please select the claimant listed on the form. If you do not see the claimant in the options below or if the claimant's information needs updated, and you have access, please add the claimant to the Corporate Database to continue processing this intake. If you do not have access, please ",
"CLAIMANT_NOT_FOUND_END": " for assistance.",
"INTAKE_EDIT_WITHDRAW_DATE": "Please include the date the withdrawal was requested",

"WITHDRAW_HEARING_MODAL_TITLE": "Confirm withdraw hearing",
"WITHDRAW_HEARING_MODAL_BODY": "Sending to Schedule Veteran will place this case in the list of Veterans to be scheduled.",
Expand Down
10 changes: 10 additions & 0 deletions client/app/intake/actions/addIssues.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ export const removeIssue = (index) => ({
payload: { index }
});

export const withdrawIssue = (index) => ({
type: ACTIONS.WITHDRAW_ISSUE,
payload: { index }
});

export const setIssueWithdrawalDate = (withdrawalDate) => ({
type: ACTIONS.SET_ISSUE_WITHDRAWAL_DATE,
payload: { withdrawalDate }
});

export const addUnidentifiedIssue = (description, notes) => (dispatch) => {
dispatch({
type: ACTIONS.ADD_ISSUE,
Expand Down
5 changes: 5 additions & 0 deletions client/app/intake/components/AddedIssue.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class AddedIssue extends React.PureComponent {
}
}

if (issue.withdrawalPending) {
eligibleState.cssKlasses.push('withdrawn-issue');
}

return <div className={eligibleState.cssKlasses.join(' ')}>
<span className="issue-num">{issueIdx + 1}.&nbsp;</span>
{ issue.text } {eligibleState.errorMsg}
Expand All @@ -101,6 +105,7 @@ class AddedIssue extends React.PureComponent {
<span className="desc">{ legacyIssue(issue, this.props.legacyAppeals).description }</span>
</div>
}
{ issue.withdrawalPending && <p>Withdraw pending</p> }
</div>;
}

Expand Down
2 changes: 2 additions & 0 deletions client/app/intake/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export const ACTIONS = {
SET_ISSUE_SELECTED: 'SET_ISSUE_SELECTED',
ADD_ISSUE: 'ADD_ISSUE',
REMOVE_ISSUE: 'REMOVE_ISSUE',
WITHDRAW_ISSUE: 'WITHDRAW_ISSUE',
SET_ISSUE_WITHDRAWAL_DATE: 'SET_ISSUE_WITHDRAWAL_DATE',
ADD_NONRATING_REQUEST_ISSUE: 'ADD_NONRATING_REQUEST_ISSUE',
NEW_NONRATING_REQUEST_ISSUE: 'NEW_NONRATING_REQUEST_ISSUE',
SET_ISSUE_CATEGORY: 'SET_ISSUE_CATEGORY',
Expand Down
103 changes: 83 additions & 20 deletions client/app/intake/pages/addIssues.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,26 @@ import UntimelyExemptionModal from '../components/UntimelyExemptionModal';
import LegacyOptInModal from '../components/LegacyOptInModal';
import Button from '../../components/Button';
import Dropdown from '../../components/Dropdown';
import InlineForm from '../../components/InlineForm';
import DateSelector from '../../components/DateSelector';
import AddedIssue from '../components/AddedIssue';
import ErrorAlert from '../components/ErrorAlert';
import { REQUEST_STATE, PAGE_PATHS, VBMS_BENEFIT_TYPES } from '../constants';
import { formatAddedIssues, getAddIssuesFields } from '../util/issues';
import { formatDateStr } from '../../util/DateUtil';
import Table from '../../components/Table';
import {
toggleAddIssuesModal,
toggleUntimelyExemptionModal,
toggleNonratingRequestIssueModal,
removeIssue,
withdrawIssue,
setIssueWithdrawalDate,
toggleUnidentifiedIssuesModal,
toggleIssueRemoveModal,
toggleLegacyOptInModal
} from '../actions/addIssues';
import COPY from '../../../COPY.json';

export class AddIssuesPage extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -56,7 +62,15 @@ export class AddIssuesPage extends React.Component {
return false;
}

onRemoveClick = (index, option = 'remove') => {
onClickAddIssue = (ratingIssueCount) => {
if (!ratingIssueCount) {
return this.props.toggleNonratingRequestIssueModal;
}

return this.props.toggleAddIssuesModal;
}

onClickIssueAction = (index, option = 'remove') => {
if (option === 'remove') {
if (this.props.toggleIssueRemoveModal) {
// on the edit page, so show the remove modal
Expand All @@ -67,15 +81,13 @@ export class AddIssuesPage extends React.Component {
} else {
this.props.removeIssue(index);
}
} else if (option === 'withdraw') {
this.props.withdrawIssue(index);
}
}

onClickAddIssue = (ratingIssueCount) => {
if (!ratingIssueCount) {
return this.props.toggleNonratingRequestIssueModal;
}

return this.props.toggleAddIssuesModal;
withdrawalDateOnChange = (value) => {
this.props.setIssueWithdrawalDate(value);
}

render() {
Expand All @@ -98,6 +110,12 @@ export class AddIssuesPage extends React.Component {
intakeData.addedIssues, (issue) => VBMS_BENEFIT_TYPES.includes(issue.benefitType) || issue.ratingIssueReferenceId)
);

const issues = formatAddedIssues(intakeData, useAmaActivationDate);
const requestIssues = issues.filter((issue) => !issue.withdrawalPending);
const issuesPendingWithdrawal = issues.filter((issue) => issue.withdrawalPending);
const hasWithdrawnIssues = !_.isEmpty(issuesPendingWithdrawal);
const withdrawDatePlaceholder = formatDateStr(new Date());

if (intakeData.isDtaError) {
return <Redirect to={PAGE_PATHS.DTA_CLAIM} />;
}
Expand All @@ -110,9 +128,7 @@ export class AddIssuesPage extends React.Component {
return <Redirect to={PAGE_PATHS.OUTCODED} />;
}

const issuesComponent = () => {
let issues = formatAddedIssues(intakeData, useAmaActivationDate);

const requestIssuesComponent = () => {
const issueActionOptions = [
{ displayText: 'Withdraw issue',
value: 'withdraw' },
Expand All @@ -122,31 +138,31 @@ export class AddIssuesPage extends React.Component {

return <div className="issues">
<div>
{ issues.map((issue, index) => {
{ requestIssues.map((issue) => {
return <div
className="issue"
data-key={`issue-${index}`}
key={`issue-${index}`}
data-key={`issue-${issue.index}`}
key={`issue-${issue.index}`}
id={`issue-${issue.referenceId}`}>
<AddedIssue
issue={issue}
issueIdx={index}
issueIdx={issue.index}
requestIssues={intakeData.requestIssues}
legacyOptInApproved={intakeData.legacyOptInApproved}
legacyAppeals={intakeData.legacyAppeals}
formType={formType} />
<div className="issue-action">
{ withdrawDecisionReviews && <Dropdown
name={`issue-action-${index}`}
name={`issue-action-${issue.index}`}
label="Actions"
hideLabel
options={issueActionOptions}
defaultText="Select action"
onChange={(option) => this.onRemoveClick(index, option)}
onChange={(option) => this.onClickIssueAction(issue.index, option)}
/>
}
{ !withdrawDecisionReviews && <Button
onClick={() => this.onRemoveClick(index)}
onClick={() => this.onClickIssueAction(issue.index)}
classNames={['cf-btn-link', 'remove-issue']}
>
<i className="fa fa-trash-o" aria-hidden="true"></i><br />Remove
Expand All @@ -169,6 +185,26 @@ export class AddIssuesPage extends React.Component {
</div>;
};

const withdrawnIssuesComponent = () => {
return <div className="issues">
{ issuesPendingWithdrawal.map((issue) => {
return <div
className="issue"
data-key={`issue-${issue.index}`}
key={`issue-${issue.index}`}
id={`issue-${issue.referenceId}`}>
<AddedIssue
issue={issue}
issueIdx={issue.index}
requestIssues={intakeData.requestIssues}
legacyOptInApproved={intakeData.legacyOptInApproved}
legacyAppeals={intakeData.legacyAppeals}
formType={formType} />
</div>;
})}
</div>;
};

const columns = [
{ valueName: 'field' },
{ valueName: 'content' }
Expand All @@ -191,7 +227,16 @@ export class AddIssuesPage extends React.Component {

let rowObjects = fieldsForFormType.concat(
{ field: 'Requested issues',
content: issuesComponent() });
content: requestIssuesComponent() });

if (hasWithdrawnIssues) {
rowObjects = rowObjects.concat(
{
field: 'Withdrawn issues',
content: withdrawnIssuesComponent()
}
);
}

return <div className="cf-intake-edit">
{ intakeData.addIssuesModalVisible && <AddIssuesModal
Expand Down Expand Up @@ -235,6 +280,20 @@ export class AddIssuesPage extends React.Component {
rowObjects={rowObjects}
rowClassNames={issueChangeClassname}
slowReRendersAreOk />

{ hasWithdrawnIssues &&
<div className="cf-gray-box cf-decision-date">
<InlineForm>
<DateSelector
label={COPY.INTAKE_EDIT_WITHDRAW_DATE}
name="withdraw-date"
value={intakeData.withdrawalDate}
onChange={this.withdrawalDateOnChange}
placeholder={withdrawDatePlaceholder}
/>
</InlineForm>
</div>
}
</div>;
}
}
Expand All @@ -256,7 +315,9 @@ export const IntakeAddIssuesPage = connect(
toggleNonratingRequestIssueModal,
toggleUnidentifiedIssuesModal,
toggleLegacyOptInModal,
removeIssue
removeIssue,
withdrawIssue,
setIssueWithdrawalDate
}, dispatch)
)(AddIssuesPage);

Expand All @@ -279,6 +340,8 @@ export const EditAddIssuesPage = connect(
toggleNonratingRequestIssueModal,
toggleUnidentifiedIssuesModal,
toggleLegacyOptInModal,
removeIssue
removeIssue,
withdrawIssue,
setIssueWithdrawalDate
}, dispatch)
)(AddIssuesPage);
18 changes: 18 additions & 0 deletions client/app/intake/reducers/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ export const commonReducers = (state, action) => {
};
};

actionsMap[ACTIONS.WITHDRAW_ISSUE] = () => {
let listOfIssues = state.addedIssues ? state.addedIssues : [];

listOfIssues[action.payload.index].withdrawalPending = true;

return {
...state,
addedIssues: listOfIssues
};
};

actionsMap[ACTIONS.SET_ISSUE_WITHDRAWAL_DATE] = () => {
return {
...state,
withdrawalDate: action.payload.withdrawalDate
};
};

return actionsMap;
};

Expand Down
14 changes: 10 additions & 4 deletions client/app/intake/util/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,15 @@ export const formatAddedIssues = (intakeData, useAmaActivationDate = false) => {
let issues = intakeData.addedIssues || [];
const amaActivationDate = new Date(useAmaActivationDate ? DATES.AMA_ACTIVATION : DATES.AMA_ACTIVATION_TEST);

return issues.map((issue) => {
return issues.map((issue, index) => {
if (issue.isUnidentified) {
return {
index,
referenceId: issue.id,
text: `Unidentified issue: no issue matched for "${issue.description}"`,
notes: issue.notes,
isUnidentified: true
isUnidentified: true,
withdrawalPending: issue.withdrawalPending
};
} else if (issue.isRating) {
if (!issue.decisionDate && !issue.approxDecisionDate) {
Expand All @@ -323,6 +325,7 @@ export const formatAddedIssues = (intakeData, useAmaActivationDate = false) => {
const decisionDate = new Date(issue.decisionDate || issue.approxDecisionDate);

return {
index,
referenceId: issue.id,
text: issue.description,
// formatDatStr converts to local time instead of UTC
Expand All @@ -340,14 +343,16 @@ export const formatAddedIssues = (intakeData, useAmaActivationDate = false) => {
vacolsId: issue.vacolsId,
vacolsSequenceId: issue.vacolsSequenceId,
vacolsIssue: issue.vacolsIssue,
eligibleForSocOptIn: issue.eligibleForSocOptIn
eligibleForSocOptIn: issue.eligibleForSocOptIn,
withdrawalPending: issue.withdrawalPending
};
}

const decisionDate = new Date(issue.decisionDate);

// returns nonrating request issue format
return {
index,
referenceId: issue.id,
text: issue.decisionIssueId ? issue.description : `${issue.category} - ${issue.description}`,
benefitType: issue.benefitType,
Expand All @@ -361,7 +366,8 @@ export const formatAddedIssues = (intakeData, useAmaActivationDate = false) => {
vacolsSequenceId: issue.vacolsSequenceId,
vacolsIssue: issue.vacolsIssue,
eligibleForSocOptIn: issue.eligibleForSocOptIn,
decisionReviewTitle: issue.decisionReviewTitle
decisionReviewTitle: issue.decisionReviewTitle,
withdrawalPending: issue.withdrawalPending
};
});
};
13 changes: 12 additions & 1 deletion client/app/styles/_intake.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@

div {
display: table-cell;
padding: 0.5em 0;
padding: 1em 0;
}

.issue-desc {
width: 100%;
padding-right: 0.5em;

.issue-num {
padding-right: 0.25em;
Expand All @@ -198,6 +199,16 @@
.issue-date {
display: block;
}

}

.withdrawn-issue {
color: $color-gray-light;

p {
color: $color-gray-dark;
font-style: italic;
}
}

.not-eligible {
Expand Down
14 changes: 14 additions & 0 deletions spec/feature/intake/appeal/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,20 @@
click_remove_intake_issue_dropdown("PTSD denied")
expect(page).to_not have_content("PTSD denied")
end

scenario "Set an issue to be pending withdrawal" do
visit "appeals/#{appeal.uuid}/edit/"

expect(page).to_not have_content("Withdrawn issues")
expect(page).to_not have_content("Please include the date the withdrawal was requested")
expect(page).to have_content("Requested issues\n1. PTSD denied")

click_withdraw_intake_issue_dropdown("PTSD denied")

expect(page).to have_content("Requested issues\n2. Military Retired Pay")
expect(page).to have_content("Withdrawn issues\n1. PTSD denied\nDecision date: 01/20/2018\nWithdraw pending")
expect(page).to have_content("Please include the date the withdrawal was requested")
end
end

context "when remove decision reviews is enabled" do
Expand Down
Loading

0 comments on commit 465a971

Please sign in to comment.