Skip to content

Commit

Permalink
Merge pull request #1450 from flexion/937-filings-and-proceedings
Browse files Browse the repository at this point in the history
937: Filings and Proceedings and Filed By strings
  • Loading branch information
rachaelparris authored Apr 19, 2019
2 parents acb63df + fa7cd6f commit d359acb
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 15 deletions.
3 changes: 3 additions & 0 deletions shared/src/business/useCases/createCaseFromPaperInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ exports.createCaseFromPaper = async ({
documentId: petitionFileId,
documentType: Case.documentTypes.petitionFile,
filedBy: caseCaptionNames,
isPaper: true,
userId: user.userId,
});
const newWorkItem = addPetitionDocumentWithWorkItemToCase(
Expand All @@ -114,6 +115,7 @@ exports.createCaseFromPaper = async ({
documentId: stinFileId,
documentType: Case.documentTypes.stin,
filedBy: caseCaptionNames,
isPaper: true,
userId: user.userId,
});
caseToAdd.addDocumentWithoutDocketRecord(stinDocumentEntity);
Expand All @@ -125,6 +127,7 @@ exports.createCaseFromPaper = async ({
documentId: ownershipDisclosureFileId,
documentType: Case.documentTypes.ownershipDisclosure,
filedBy: caseCaptionNames,
isPaper: true,
userId: user.userId,
});
caseToAdd.addDocument(odsDocumentEntity);
Expand Down
2 changes: 2 additions & 0 deletions web-client/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
faDollarSign,
faEdit as faEditSolid,
faExclamationTriangle,
faFileAlt as faFileAltSolid,
faFilePdf,
faFlag,
faLaptop,
Expand Down Expand Up @@ -81,6 +82,7 @@ const app = {
faFlag,
faLaptop,
faFileAlt,
faFileAltSolid,
faListUl,
faPaperclip,
faPlusCircle,
Expand Down
65 changes: 64 additions & 1 deletion web-client/src/presenter/computeds/formattedCaseDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const formatDocument = document => {
export const formatDocketRecord = docketRecord => {
const result = _.cloneDeep(docketRecord);
result.createdAtFormatted = moment.utc(result.filingDate).format('L');

return result;
};

Expand Down Expand Up @@ -82,7 +83,11 @@ export const formatYearAmounts = (caseDetail, caseDetailErrors = {}) => {
}
};

const formatDocketRecordWithDocument = (docketRecords = [], documents = []) => {
const formatDocketRecordWithDocument = (
docketRecords = [],
documents = [],
caseDetail,
) => {
const documentMap = documents.reduce((acc, document) => {
acc[document.documentId] = document;
return acc;
Expand All @@ -93,7 +98,64 @@ const formatDocketRecordWithDocument = (docketRecords = [], documents = []) => {

if (record.documentId) {
document = documentMap[record.documentId];

if (document.certificateOfServiceDate) {
document.certificateOfServiceDateFormatted = moment
.utc(document.certificateOfServiceDate)
.format('L');
}

//filings and proceedings string
//(C/S 04/17/2019) (Exhibit(s)) (Attachment(s)) (Objection) (Lodged)
const filingsAndProceedingsArray = [
`${
document.certificateOfService
? `(C/S ${document.certificateOfServiceDateFormatted})`
: ''
}`,
`${document.exhibits ? '(Exhibit(s))' : ''}`,
`${document.attachments ? '(Attachment(s))' : ''}`,
`${
document.objections === 'Yes'
? '(Objection)'
: document.objections === 'No'
? '(No Objection)'
: ''
}`,
`${document.lodged ? '(Lodged)' : ''}`,
];
record.filingsAndProceedings = filingsAndProceedingsArray
.filter(item => item !== '')
.join(' ');

if (!document.filedBy) {
let filedByString = '';
if (document.partyRespondent) {
filedByString = 'Resp.';
if (document.partyPrimary || document.partySecondary) {
filedByString += ' & ';
}
}
if (
document.partyPrimary &&
!document.partySecondary &&
caseDetail.contactPrimary
) {
filedByString += `Petr. ${caseDetail.contactPrimary.name}`;
} else if (
document.partyPrimary &&
document.partySecondary &&
caseDetail.contactPrimary &&
caseDetail.contactSecondary
) {
filedByString += `Petrs. ${caseDetail.contactPrimary.name} & ${
caseDetail.contactSecondary.name
}`;
}
document.filedBy = filedByString;
}
}

return { document, index, record };
});
};
Expand All @@ -108,6 +170,7 @@ const formatCase = (caseDetail, caseDetailErrors, documentTypesMap) => {
result.docketRecordWithDocument = formatDocketRecordWithDocument(
result.docketRecord,
result.documents,
caseDetail,
);
}

Expand Down
155 changes: 155 additions & 0 deletions web-client/src/presenter/computeds/formattedCaseDetail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,161 @@ describe('formatYearAmounts', () => {
);
});

it('formats docket record document data strings correctly', async () => {
const caseDetail = {
caseCaption: 'Brett Osborne, Petitioner',
contactPrimary: {
name: 'Bob',
},
contactSecondary: {
name: 'Bill',
},
docketRecord: [
{
description: 'Amended Petition',
documentId: '88cd2c25-b8fa-4dc0-bfb6-57245c86bb0d',
filingDate: '2019-04-19T17:29:13.120Z',
},
{
description:
'First Amended Unsworn Declaration under Penalty of Perjury in Support',
documentId: 'c501a558-7632-497e-87c1-0c5f39f66718',
filingDate: '2019-04-19T18:24:09.515Z',
},
{
description:
'Motion for Leave to File Computation for Entry of Decision',
documentId: '362baeaf-7692-4b04-878b-2946dcfa26ee',
filingDate: '2019-04-19T17:39:10.476Z',
},
{
description:
'Unsworn Declaration of Test under Penalty of Perjury in Support of Amended Petition',
documentId: '3ac23dd8-b0c4-4538-86e1-52b715f54838',
filingDate: '2019-04-19T17:29:13.122Z',
},
],
documents: [
{
attachments: false,
category: 'Petition',
certificateOfService: false,
createdAt: '2019-04-19T17:29:13.120Z',
documentId: '88cd2c25-b8fa-4dc0-bfb6-57245c86bb0d',
documentTitle: 'Amended Petition',
documentType: 'Amended Petition',
eventCode: 'PAP',
exhibits: false,
hasSupportingDocuments: true,
partyPrimary: true,
relationship: 'primaryDocument',
scenario: 'Standard',
supportingDocument:
'Unsworn Declaration under Penalty of Perjury in Support',
supportingDocumentFreeText: 'Test',
},
{
attachments: false,
category: 'Miscellaneous',
certificateOfService: false,
createdAt: '2019-04-19T18:24:09.515Z',
documentId: 'c501a558-7632-497e-87c1-0c5f39f66718',
documentTitle:
'First Amended Unsworn Declaration under Penalty of Perjury in Support',
documentType: 'Amended',
eventCode: 'ADED',
exhibits: true,
hasSupportingDocuments: true,
ordinalValue: 'First',
partyPrimary: true,
partyRespondent: true,
previousDocument:
'Unsworn Declaration under Penalty of Perjury in Support',
relationship: 'primaryDocument',
scenario: 'Nonstandard F',
supportingDocument: 'Brief in Support',
supportingDocumentFreeText: null,
},
{
attachments: true,
category: 'Motion',
certificateOfService: true,
certificateOfServiceDate: '2018-06-07',
certificateOfServiceDay: '7',
certificateOfServiceMonth: '6',
certificateOfServiceYear: '2018',
createdAt: '2019-04-19T17:39:10.476Z',
documentId: '362baeaf-7692-4b04-878b-2946dcfa26ee',
documentTitle:
'Motion for Leave to File Computation for Entry of Decision',
documentType: 'Motion for Leave to File',
eventCode: 'M115',
exhibits: true,
hasSecondarySupportingDocuments: false,
hasSupportingDocuments: true,
objections: 'Yes',
partyPrimary: true,
relationship: 'primaryDocument',
scenario: 'Nonstandard H',
secondarySupportingDocument: null,
secondarySupportingDocumentFreeText: null,
supportingDocument: 'Declaration in Support',
supportingDocumentFreeText: 'Rachael',
},
{
category: 'Supporting Document',
createdAt: '2019-04-19T17:29:13.122Z',
documentId: '3ac23dd8-b0c4-4538-86e1-52b715f54838',
documentTitle:
'Unsworn Declaration of Test under Penalty of Perjury in Support of Amended Petition',
documentType:
'Unsworn Declaration under Penalty of Perjury in Support',
eventCode: 'USDL',
freeText: 'Test',
partyPrimary: true,
partySecondary: true,
previousDocument: 'Amended Petition',
relationship: 'primarySupportingDocument',
scenario: 'Nonstandard C',
},
],
hasIrsNotice: false,
hasVerifiedIrsNotice: false,
petitioners: [{ name: 'bob' }],
};
const result = await runCompute(formattedCaseDetail, {
state: {
caseDetail,
caseDetailErrors: {},
constants,
},
});
expect(result.docketRecordWithDocument[0].document.filedBy).toEqual(
'Petr. Bob',
);
expect(
result.docketRecordWithDocument[0].record.filingsAndProceedings,
).toEqual('');
expect(result.docketRecordWithDocument[1].document.filedBy).toEqual(
'Resp. & Petr. Bob',
);
expect(
result.docketRecordWithDocument[1].record.filingsAndProceedings,
).toEqual('(Exhibit(s))');
expect(result.docketRecordWithDocument[2].document.filedBy).toEqual(
'Petr. Bob',
);
expect(
result.docketRecordWithDocument[2].record.filingsAndProceedings,
).toEqual('(C/S 06/07/2018) (Exhibit(s)) (Attachment(s)) (Objection)');
expect(result.docketRecordWithDocument[3].document.filedBy).toEqual(
'Petrs. Bob & Bill',
);
expect(
result.docketRecordWithDocument[3].record.filingsAndProceedings,
).toEqual('');
});

it('sorts the docket record in the expected order', async () => {
const caseDetail = {
caseCaption: 'Brett Osborne, Petitioner',
Expand Down
4 changes: 0 additions & 4 deletions web-client/src/styles/tables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ table#docket-record {
.hide-on-mobile {
display: none;
}

td {
min-height: 65px;
}
}
}

Expand Down
30 changes: 20 additions & 10 deletions web-client/src/views/DocketRecord.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ export const DocketRecord = connect(
token: state.token,
},
({ baseUrl, caseDetail, documentHelper, helper, token }) => {
function renderDocumentLink(documentId, description) {
function renderDocumentLink(documentId, description, isPaper) {
return (
<a
href={`${baseUrl}/documents/${documentId}/documentDownloadUrl?token=${token}`}
target="_blank"
rel="noreferrer noopener"
aria-label={`View PDF: ${description}`}
>
<span className="filing-type-icon-mobile">
<FontAwesomeIcon icon={['far', 'file-pdf']} />
</span>
{isPaper && (
<span className="filing-type-icon-mobile">
<FontAwesomeIcon icon={['fas', 'file-alt']} />
</span>
)}
{description}
</a>
);
Expand Down Expand Up @@ -52,7 +54,7 @@ export const DocketRecord = connect(
<th className="center-column">Event</th>
<th />
<th>Filings and Proceedings</th>
<th>Filed by</th>
<th>Filed By</th>
<th>Action</th>
<th>Served</th>
<th className="center-column">Parties</th>
Expand All @@ -74,10 +76,12 @@ export const DocketRecord = connect(
</td>
<td className="center-column">
<span className="responsive-label">Event</span>
CODE
{document && document.eventCode}
</td>
<td className="filing-type-icon hide-on-mobile">
<FontAwesomeIcon icon={['far', 'file-pdf']} />
{document && document.isPaper && (
<FontAwesomeIcon icon={['fas', 'file-alt']} />
)}
</td>
<td>
<span className="responsive-label">
Expand All @@ -88,6 +92,7 @@ export const DocketRecord = connect(
renderDocumentLink(
document.documentId,
record.description,
document.isPaper,
)}
{document && helper.showDocumentDetailLink && (
<a
Expand All @@ -97,16 +102,20 @@ export const DocketRecord = connect(
})}
aria-label="View PDF"
>
<span className="filing-type-icon-mobile">
<FontAwesomeIcon icon={['far', 'file-pdf']} />
</span>
{document && document.isPaper && (
<span className="filing-type-icon-mobile">
<FontAwesomeIcon icon={['fas', 'file-alt']} />
</span>
)}
{record.description}
</a>
)}
{!document &&
record.documentId &&
renderDocumentLink(record.documentId, record.description)}
{!document && !record.documentId && record.description}
{record.filingsAndProceedings &&
` ${record.filingsAndProceedings}`}
</td>
<td>
<span className="responsive-label">Filed by</span>
Expand All @@ -127,6 +136,7 @@ export const DocketRecord = connect(
</td>
<td className="center-column">
<span className="responsive-label">Parties</span>
{record.servedParties}
</td>
</tr>
),
Expand Down

0 comments on commit d359acb

Please sign in to comment.