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

Al/APPEALS-45334 Individual change history table which includes Reassign Cases to CAMO events #22483

Merged
merged 14 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions app/services/claim_change_history/claim_history_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def parse_request_issue_modification_attributes(change_data)
@decided_at_date = change_data["decided_at"]
@issue_modification_request_withdrawal_date = change_data["issue_modification_request_withdrawal_date"]
@remove_original_issue = change_data["remove_original_issue"]
@issue_modification_request_status = change_data["issue_modification_request_status"]
@requestor = change_data["requestor"]
@decider = change_data["decider"]
end
Expand Down
283 changes: 273 additions & 10 deletions client/app/nonComp/components/IndividualClaimHistoryTable.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from 'react';
/* eslint-disable max-lines */
import React, { useState } from 'react';
import QueueTable from '../../queue/QueueTable';
import BENEFIT_TYPES from 'constants/BENEFIT_TYPES';
import { formatDateStr } from 'app/util/DateUtil';
import PropTypes from 'prop-types';
import StringUtil from 'app/util/StringUtil';

almorbah marked this conversation as resolved.
Show resolved Hide resolved
const { capitalizeFirst } = StringUtil;

const IndividualClaimHistoryTable = (props) => {

Expand Down Expand Up @@ -34,15 +38,36 @@ const IndividualClaimHistoryTable = (props) => {
return <React.Fragment>Claim can be processed.</React.Fragment>;
};

const ClaimPendingFragment = () => {
return <React.Fragment>Claim cannot be processed until VHA admin reviews pending requests.</React.Fragment>;
};

const ClaimIncompleteFragment = () => {
return <React.Fragment>Claim cannot be processed until decision date is entered.</React.Fragment>;
};

const ClaimClosedFragment = (details) => {
return <React.Fragment>
Claim closed.<br />
<b>Claim decision date: </b>{formatDecisionDate(details.dispositionDate)}
</React.Fragment>;
let component = null;

switch (details.eventType) {
case 'cancelled':
component = <React.Fragment>
Claim cancelled.
</React.Fragment>;
break;
default:
component = <React.Fragment>
Claim closed.<br />
<b>Claim decision date: </b>{formatDecisionDate(details.dispositionDate)}
</React.Fragment>;
break;
}
almorbah marked this conversation as resolved.
Show resolved Hide resolved

return (
<div>
{component}
</div>
almorbah marked this conversation as resolved.
Show resolved Hide resolved
);
};

const AddedIssueFragment = (details) => {
Expand All @@ -53,6 +78,140 @@ const IndividualClaimHistoryTable = (props) => {
</React.Fragment>;
};

const RequestedIssueFragment = (details) => {
return <React.Fragment>
<b>Benefit type: </b>{BENEFIT_TYPES[details.benefitType]}<br />
<b>Issue type: </b>{details.newIssueType}<br />
<b>Issue description: </b>{details.newIssueDescription}<br />
<b>Decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
<b>{capitalizeFirst(details.requestType)} request reason: </b>{details.modificationRequestReason}<br />
</React.Fragment>;
};

const CancellationRequestedIssueFragment = (details) => {
let component = null;
almorbah marked this conversation as resolved.
Show resolved Hide resolved

switch (details.requestType) {
case 'modification':
component = <RequestedIssueModificationFragment {...details} />;
break;
case 'addition':
component = <RequestedIssueFragment {...details} />;
almorbah marked this conversation as resolved.
Show resolved Hide resolved
break;
case 'removal':
component = <RequestedIssueFragment {...details} />;
break;
case 'withdrawal':
component = <WithdrawnRequestedIssueModificationFragment {...details} />;
break;
default:
return null;
}

return (
<div>
{component}
</div>
);
};

const WithdrawalRequestedIssueFormat = (details) => {
return <>
<RequestedIssueFragment {...details} />
<b>Withdrawal request date: </b>{formatDecisionDate(details.issueModificationRequestWithdrawalDate)}<br />
</>;
};

const withdrawalRequestDate = (row) => {
if (['withdrawal'].includes(row.requestType)) {
return <React.Fragment>
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>Withdrawal request date: </b> {formatDecisionDate(row.issueModificationRequestWithdrawalDate)}<br />
</React.Fragment>;
}
};

const RequestedIssueModificationFragment = (details) => {
return <React.Fragment>
<b>Benefit type: </b>{BENEFIT_TYPES[details.benefitType]}<br />
<b>Current issue type: </b>{details.newIssueType}<br />
<b>Current issue description: </b>{details.newIssueDescription}<br />
<b>Current decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>New issue type: </b>{details.newIssueType}<br />
<b>New issue description: </b>{details.newIssueDescription}<br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>New decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
<b>{capitalizeFirst(details.requestType)} request reason: </b>{details.modificationRequestReason}<br />
</React.Fragment>;
};

const RemoveOriginalIssueFragment = (details) => {
return <React.Fragment>
<b>Remove original issue: </b>{details.removeOriginalIssue ? 'Yes' : 'No' }<br />
</React.Fragment>;
};

const reasonForRejection = (details) => {
return details.issueModificationRequestStatus === 'denied' ? <React.Fragment>
<b> Reason for rejection: </b> {details.decisionReason} <br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
</React.Fragment> : <></>;
};

const requestDecision = (details) => {
return <React.Fragment>
<b> Request decision: </b> {details.issueModificationRequestStatus === 'denied' ? 'Rejected' : 'Approved'} <br />
</React.Fragment>;
};

const RequestedIssueDecisionFragment = (details) => {
return <React.Fragment>
{requestDecision(details)}
{ details.issueModificationRequestStatus === 'approved' && ['modification'].includes(details.requestType) ?
<RemoveOriginalIssueFragment {...details} /> : null
almorbah marked this conversation as resolved.
Show resolved Hide resolved
}
{reasonForRejection(details)}
<b>Request originated by: </b>{details.requestor}<br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
</React.Fragment>;
};

const EditOfRequestIssueModification = (details) => {
let component = null;

switch (details.requestType) {
case 'modification':
component = <React.Fragment>
<b>New issue type: </b>{details.newIssueType}<br />
<b>New issue description: </b>{details.newIssueDescription}<br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>New decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
<b>New {details.requestType} request reason: </b>{details.modificationRequestReason}<br />
</React.Fragment>;
break;
case 'addition':
component = <React.Fragment>
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>New issue type: </b>{details.newIssueType}<br />
<b>New issue description: </b>{details.newIssueDescription}<br />
<b>New decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
<b>New {details.requestType} request reason: </b>{details.modificationRequestReason}<br />
</React.Fragment>;
break;
case 'removal':
component = <React.Fragment>
<b>New {details.requestType} request reason: </b>{details.requestor}<br />
</React.Fragment>;
almorbah marked this conversation as resolved.
Show resolved Hide resolved
break;
case 'withdrawal':
component = <React.Fragment>
<b>New {details.requestType} request reason: </b>{details.requestor}<br />
<b>New withdrawal request date: </b> {formatDecisionDate(details.issueModificationRequestWithdrawalDate)}<br />
almorbah marked this conversation as resolved.
Show resolved Hide resolved
</React.Fragment>;
break;
default:
return null;
}

return <React.Fragment>
{component}
</React.Fragment>;
};

const AddedIssueWithDateFragment = (details) => {
return <React.Fragment>
<AddedIssueFragment {...details} />
Expand Down Expand Up @@ -93,12 +252,79 @@ const IndividualClaimHistoryTable = (props) => {
</React.Fragment>;
};

const WithdrawnRequestedIssueModificationFragment = (details) => {
return <React.Fragment>
almorbah marked this conversation as resolved.
Show resolved Hide resolved
<b>Benefit type: </b>{BENEFIT_TYPES[details.benefitType]}<br />
<b>Issue type: </b>{details.newIssueType}<br />
<b>Issue description: </b>{details.newIssueDescription}<br />
<b>Decision date: </b>{formatDecisionDate(details.newDecisionDate)}<br />
<b>{capitalizeFirst(details.requestType)} request reason: </b>{details.modificationRequestReason}<br />
{withdrawalRequestDate(details)}
almorbah marked this conversation as resolved.
Show resolved Hide resolved
</React.Fragment>;
};

const OriginalRequestedIssueModificationFragment = (details) => {
let component = null;

switch (details.requestType) {
case 'modification':
component = <RequestedIssueModificationFragment {...details} />;
break;
case 'addition':
component = <RequestedIssueFragment {...details} />;
break;
case 'removal':
component = <RequestedIssueFragment {...details} />;
break;
case 'withdrawal':
component = <WithdrawnRequestedIssueModificationFragment {...details} />;
break;
default:
return null;
}

return (
<div>
{component}
</div>
);
};

const OriginalDetailsFragments = (row) => {
const { details, modificationRequestDetails } = row;

const requestDetails = { ...modificationRequestDetails };
const requestModificationDetails = { ...details, ...requestDetails };

almorbah marked this conversation as resolved.
Show resolved Hide resolved
const [isOpen, setIsOpen] = useState(false);

const toggle = () => {
// eslint-disable-next-line no-shadow
setIsOpen((isOpen) => !isOpen);
};
almorbah marked this conversation as resolved.
Show resolved Hide resolved

return (
<div>
<div style={{ marginBottom: '15px' }}>
<a onClick={toggle} style={{ cursor: 'pointer' }}>{`${isOpen ? 'Hide' : 'View' } original request`}</a>
</div>
{isOpen &&
<div>
<OriginalRequestedIssueModificationFragment {...requestModificationDetails} />
</div>}
</div>
);
};

const DetailsFragment = (row) => {

let component = null;
const { readableEventType, details, modificationRequestDetails } = row;

const { readableEventType, details } = row;
const detailsExtended = { ...details, eventDate: row.eventDate, eventType: row.eventType };

const detailsExtended = { ...details, eventDate: row.eventDate };
const requestDetails = { ...modificationRequestDetails };
const RequestIssueModificationDetails = { ...requestDetails, ...detailsExtended };

almorbah marked this conversation as resolved.
Show resolved Hide resolved
switch (readableEventType) {
case 'Claim created':
Expand All @@ -110,6 +336,9 @@ const IndividualClaimHistoryTable = (props) => {
case 'Completed disposition':
component = <CompletedDispositionFragment {...detailsExtended} />;
break;
case 'Claim status - Pending':
component = <ClaimPendingFragment />;
break;
case 'Claim status - In progress':
component = <ClaimInProgressFragment />;
break;
Expand All @@ -131,13 +360,46 @@ const IndividualClaimHistoryTable = (props) => {
case 'Removed issue':
component = <RemovedIssueFragment {...detailsExtended} />;
break;
case 'Cancellation of request':
component = <CancellationRequestedIssueFragment {...requestDetails} />;
break;
case 'Requested issue removal':
component = <RequestedIssueFragment {...requestDetails} />;
almorbah marked this conversation as resolved.
Show resolved Hide resolved
break;
case 'Requested issue modification':
component = <RequestedIssueModificationFragment {...requestDetails} />;
break;
case 'Requested issue addition':
component = <RequestedIssueFragment {...requestDetails} />;
break;
case 'Requested issue withdrawal':
component = <WithdrawalRequestedIssueFormat {...requestDetails} />;
break;
case `Approval of request - issue ${requestDetails.requestType}`:
component = <RequestedIssueDecisionFragment {...RequestIssueModificationDetails} />;
break;
case `Edit of request - issue ${requestDetails.requestType}`:
component = <EditOfRequestIssueModification {...RequestIssueModificationDetails} />;
break;
case `Rejection of request - issue ${requestDetails.requestType}`:
component = <RequestedIssueDecisionFragment {...RequestIssueModificationDetails} />;
break;
default:
return null;
}

return <p>
{component}
</p>;
const chunk = [
'request_approved',
'request_edited',
'request_denied'
];

return (
<div>
<p>{component}</p>
{ chunk.includes(RequestIssueModificationDetails.eventType) ? <OriginalDetailsFragments {...row} /> : null }
</div>
);
};

const dateSort = (row) => {
Expand Down Expand Up @@ -210,3 +472,4 @@ IndividualClaimHistoryTable.propTypes = {
};

export default IndividualClaimHistoryTable;
/* eslint-enable max-lines */
Loading
Loading