From aa4155c084a4254774b5db8e2cc4bfe21f86dffc Mon Sep 17 00:00:00 2001 From: antgmann Date: Tue, 15 Oct 2024 15:00:52 +0000 Subject: [PATCH 01/13] Experimental changes --- .../Office/WeightSummary/WeightSummary.jsx | 1 + src/hooks/queries.js | 16 +- .../ReviewBillableWeight.jsx | 142 ++++++++++++------ 3 files changed, 110 insertions(+), 49 deletions(-) diff --git a/src/components/Office/WeightSummary/WeightSummary.jsx b/src/components/Office/WeightSummary/WeightSummary.jsx index 6637c6567e2..3f65268e020 100644 --- a/src/components/Office/WeightSummary/WeightSummary.jsx +++ b/src/components/Office/WeightSummary/WeightSummary.jsx @@ -26,6 +26,7 @@ const WeightSummary = ({ maxBillableWeight, weightRequested, weightAllowance, to if (shipment.shipmentType === SHIPMENT_OPTIONS.HHG && countHHG <= 1) return 'HHG'; if (shipment.shipmentType === SHIPMENT_OPTIONS.NTS) return 'NTS'; if (shipment.shipmentType === SHIPMENT_OPTIONS.NTSR) return 'NTSR'; + if (shipment.shipmentType === SHIPMENT_OPTIONS.PPM) return 'PPM'; return ''; }; diff --git a/src/hooks/queries.js b/src/hooks/queries.js index de2aab16125..bfdaa70fb56 100644 --- a/src/hooks/queries.js +++ b/src/hooks/queries.js @@ -81,7 +81,7 @@ import { PAGINATION_PAGE_DEFAULT, PAGINATION_PAGE_SIZE_DEFAULT } from 'constants * @param {string} moveCode The move locator * @return {QueriesResults} ppmDocsQueriesResults: an array of the documents queries for each PPM shipment in the mtoShipments array. */ -const useAddWeightTicketsToPPMShipments = (mtoShipments, moveCode) => { +const useAddExpensesToPPMShipments = (mtoShipments, moveCode) => { // Filter for ppm shipments to get their documents(including weight tickets) const shipmentIDs = mtoShipments?.filter((shipment) => shipment.ppmShipment).map((shipment) => shipment.id) ?? []; @@ -93,8 +93,10 @@ const useAddWeightTicketsToPPMShipments = (mtoShipments, moveCode) => { queryFn: ({ queryKey }) => getPPMDocuments(...queryKey), enabled: !!shipmentID, select: (data) => { - // Shove the weight tickets into the corresponding ppmShipment object + // Shove the weight tickets and other expenses into the corresponding ppmShipment object const shipment = mtoShipments.find((s) => s.id === shipmentID); + shipment.ppmShipment.movingExpenses = data.MovingExpenses; + shipment.ppmShipment.proGearWeightTickets = data.ProGearWeightTickets; shipment.ppmShipment.weightTickets = data.WeightTickets; // Attach the review url to each ppm shipment shipment.ppmShipment.reviewShipmentWeightsURL = generatePath( @@ -363,7 +365,7 @@ export const useReviewShipmentWeightsQuery = (moveCode) => { }); // attach ppm documents to their respective ppm shipments - const ppmDocsQueriesResults = useAddWeightTicketsToPPMShipments(mtoShipments, moveCode); + const ppmDocsQueriesResults = useAddExpensesToPPMShipments(mtoShipments, moveCode); const { isLoading, isError, isSuccess } = getQueriesStatus([ moveQuery, @@ -414,7 +416,7 @@ export const useMoveTaskOrderQueries = (moveCode) => { ); // attach ppm documents to their respective ppm shipments - const ppmDocsQueriesResults = useAddWeightTicketsToPPMShipments(mtoShipments, moveCode); + const ppmDocsQueriesResults = useAddExpensesToPPMShipments(mtoShipments, moveCode); const { isLoading, isError, isSuccess } = getQueriesStatus([ moveQuery, @@ -661,8 +663,8 @@ export const useMovePaymentRequestsQueries = (moveCode) => { }, ); - // attach ppm documents to their respective ppm shipments - const ppmDocsQueriesResults = useAddWeightTicketsToPPMShipments(mtoShipments, moveCode); + // attach all ppm documents to their respective ppm shipments + const ppmDocsQueriesResults = useAddExpensesToPPMShipments(mtoShipments, moveCode); const orderId = move?.ordersId; const { data: { orders } = {}, ...orderQuery } = useQuery( @@ -854,7 +856,7 @@ export const useMoveDetailsQueries = (moveCode) => { }); // attach ppm documents to their respective ppm shipments - const ppmDocsQueriesResults = useAddWeightTicketsToPPMShipments(mtoShipments, moveCode); + const ppmDocsQueriesResults = useAddExpensesToPPMShipments(mtoShipments, moveCode); const customerId = order?.customerID; const { data: { customer } = {}, ...customerQuery } = useQuery({ diff --git a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx index 2d88c616cad..a6435ea4470 100644 --- a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx +++ b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { Button, Alert } from '@trussworks/react-uswds'; import { useNavigate, useParams } from 'react-router-dom'; import { useQueryClient, useMutation } from '@tanstack/react-query'; @@ -7,6 +7,7 @@ import DocumentViewerSidebar from '../DocumentViewerSidebar/DocumentViewerSideba import reviewBillableWeightStyles from './ReviewBillableWeight.module.scss'; +import ReviewDocumentsSidePanel from 'components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel'; import ShipmentModificationTag from 'components/ShipmentModificationTag/ShipmentModificationTag'; import { WEIGHT_ADJUSTMENT, shipmentModificationTypes } from 'constants/shipments'; import { MOVES, MTO_SHIPMENTS, ORDERS } from 'constants/queryKeys'; @@ -32,6 +33,7 @@ import { SHIPMENT_OPTIONS } from 'shared/constants'; export default function ReviewBillableWeight() { const [selectedShipmentIndex, setSelectedShipmentIndex] = React.useState(0); + const [selectedShipment, setSelectedShipment] = React.useState({}); const [sidebarType, setSidebarType] = React.useState('MAX'); const { moveCode } = useParams(); @@ -67,12 +69,47 @@ export default function ReviewBillableWeight() { return uploads; }; - // filter out PPMs, as they're not including in TIO review - const excludePPMShipments = mtoShipments?.filter((shipment) => shipment.shipmentType !== 'PPM'); + const getAllPPMShipmentFiles = (ppmShipment) => { + const weightTicketDocs = []; + if (ppmShipment !== undefined) { + if (ppmShipment.weightTickets !== undefined) { + weightTicketDocs.push( + ppmShipment.weightTickets.map((weightTicket) => { + return weightTicket.emptyDocument ?? []; + }), + ppmShipment.weightTickets.map((weightTicket) => { + return weightTicket.fullDocument ?? []; + }), + ); + } + if (ppmShipment.proGearWeightTickets !== undefined) { + weightTicketDocs.push( + ppmShipment.proGearWeightTickets.map((proGearWeightTicket) => { + return proGearWeightTicket.document ?? []; + }), + ); + } + if (ppmShipment.movingExpenses !== undefined) { + weightTicketDocs.push( + ppmShipment.movingExpenses.map((movingExpense) => { + return movingExpense.document ?? []; + }), + ); + } + } + const uploadedWeightDocs = weightTicketDocs.flat(); + const uploadedWeightFiles = uploadedWeightDocs.flatMap((doc) => { + return doc.uploads; + }); + + let uploads = []; + uploads = uploads.concat(uploadedWeightFiles); + return uploads; + }; + /* Only show shipments in statuses of approved, diversion requested, or cancellation requested */ - const filteredShipments = excludePPMShipments?.filter((shipment) => - includedStatusesForCalculatingWeights(shipment.status), - ); + const filteredShipments = mtoShipments?.filter((shipment) => includedStatusesForCalculatingWeights(shipment.status)); + const readOnly = true; const isLastShipment = filteredShipments && selectedShipmentIndex === filteredShipments.length - 1; const totalBillableWeight = useCalculatedTotalBillableWeight(filteredShipments, WEIGHT_ADJUSTMENT); @@ -94,8 +131,11 @@ export default function ReviewBillableWeight() { }); }; - const selectedShipment = - filteredShipments && filteredShipments.length > 0 ? filteredShipments[selectedShipmentIndex] : {}; + useEffect(() => { + setSelectedShipment( + filteredShipments && filteredShipments.length > 0 ? filteredShipments[selectedShipmentIndex] : {}, + ); + }, [filteredShipments, selectedShipmentIndex]); const queryClient = useQueryClient(); const { mutate: mutateMTOShipment } = useMutation(updateMTOShipment, { @@ -204,11 +244,15 @@ export default function ReviewBillableWeight() { if (isError) return ; const fileList = getAllFiles(); - + const ppmFileList = getAllPPMShipmentFiles(selectedShipment.ppmShipment); return (
- {fileList.length > 0 ? :

No documents provided

} + {selectedShipment.shipmentType !== 'PPM' ? ( + + ) : ( + + )}
{sidebarType === 'MAX' ? ( @@ -243,14 +287,16 @@ export default function ReviewBillableWeight() { shipments={filteredShipments} />
- + {selectedShipment.shipmentType !== 'PPM' && ( + + )}
-
- + +
+ ) : ( + - + )}
From 8ef8c6668fe9e78325e514e757bf28a2bd902b76 Mon Sep 17 00:00:00 2001 From: antgmann Date: Tue, 15 Oct 2024 20:18:33 +0000 Subject: [PATCH 02/13] All data populating --- .../PPM/PPMHeaderSummary/PPMHeaderSummary.jsx | 5 ++--- .../ReviewDocumentsSidePanel.jsx | 19 ++++++++++++++----- .../PPM/ReviewExpense/ReviewExpense.jsx | 2 +- .../PPM/ReviewProGear/ReviewProGear.jsx | 2 +- .../ReviewWeightTicket/ReviewWeightTicket.jsx | 2 +- .../Office/WeightSummary/WeightSummary.jsx | 2 +- .../ReviewBillableWeight.jsx | 19 ++++++++++++++++++- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx index a8050752421..a75d110d039 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { number, bool } from 'prop-types'; +import { string, bool } from 'prop-types'; import classnames from 'classnames'; import HeaderSection, { sectionTypes } from './HeaderSection'; @@ -63,7 +63,6 @@ const GCCAndIncentiveInfo = ({ ppmShipmentInfo, updatedItemName, setUpdatedItemN }; export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFields, readOnly }) { const [updatedItemName, setUpdatedItemName] = useState(''); - const shipmentInfo = { plannedMoveDate: ppmShipmentInfo.expectedDepartureDate, actualMoveDate: ppmShipmentInfo.actualMoveDate, @@ -111,7 +110,7 @@ export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFi } PPMHeaderSummary.propTypes = { - ppmNumber: number.isRequired, + ppmNumber: string.isRequired, showAllFields: bool.isRequired, }; diff --git a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx index 8ba4d63db5a..831e39d15b5 100644 --- a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx +++ b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx @@ -4,7 +4,7 @@ import { Form } from '@trussworks/react-uswds'; import { Formik } from 'formik'; import classnames from 'classnames'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { arrayOf, func, number, object } from 'prop-types'; +import { arrayOf, bool, func, string, object } from 'prop-types'; import moment from 'moment'; import PPMHeaderSummary from '../PPMHeaderSummary/PPMHeaderSummary'; @@ -30,9 +30,11 @@ export default function ReviewDocumentsSidePanel({ proGearTickets, weightTickets, readOnly, + showAllFields, }) { let status; let showReason; + const showAllFieldsBool = showAllFields; const { mutate: patchDocumentsSetStatusMutation } = useMutation(patchPPMDocumentsSetStatus, { onSuccess, @@ -100,10 +102,15 @@ export default function ReviewDocumentsSidePanel({ return (
-
- +
+
-
+

{readOnly ? 'Sent to customer' : 'Send to customer?'}

@@ -260,13 +267,14 @@ export default function ReviewDocumentsSidePanel({ ReviewDocumentsSidePanel.propTypes = { ppmShipment: PPMShipmentShape, - ppmNumber: number, + ppmNumber: string, formRef: object, onSuccess: func, onError: func, expenseTickets: arrayOf(ExpenseShape), proGearTickets: arrayOf(ProGearTicketShape), weightTickets: arrayOf(WeightTicketShape), + showAllFields: bool, }; ReviewDocumentsSidePanel.defaultProps = { @@ -278,4 +286,5 @@ ReviewDocumentsSidePanel.defaultProps = { expenseTickets: [], proGearTickets: [], weightTickets: [], + showAllFields: false, }; diff --git a/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx b/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx index c7900ed78a6..5aaf64b279f 100644 --- a/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx +++ b/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx @@ -304,7 +304,7 @@ export default function ReviewExpense({
diff --git a/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx b/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx index d668da5cb03..38267908d09 100644 --- a/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx +++ b/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx @@ -127,7 +127,7 @@ export default function ReviewProGear({
diff --git a/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx b/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx index ff81e74d67c..0cceebc5da0 100644 --- a/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx +++ b/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx @@ -261,7 +261,7 @@ function ReviewWeightTicket({ { @@ -137,6 +138,21 @@ export default function ReviewBillableWeight() { ); }, [filteredShipments, selectedShipmentIndex]); + useEffect(() => { + if (selectedShipment.shipmentType === 'PPM') { + let currentTotalWeight = 0; + selectedShipment.ppmShipment.weightTickets.forEach((weight) => { + currentTotalWeight += weight.fullWeight - weight.emptyWeight; + }); + const updatedPpmShipmentInfo = { + ...selectedShipment.ppmShipment, + miles: selectedShipment.distance, + actualWeight: currentTotalWeight, + }; + setPpmShipmentInfo(updatedPpmShipmentInfo); + } + }, [selectedShipment]); + const queryClient = useQueryClient(); const { mutate: mutateMTOShipment } = useMutation(updateMTOShipment, { onSuccess: (updatedMTOShipment) => { @@ -386,12 +402,13 @@ export default function ReviewBillableWeight() { ) : ( )} From a7a0d4eb86972edc1403dcee3b37faca6d282d6f Mon Sep 17 00:00:00 2001 From: antgmann Date: Tue, 15 Oct 2024 20:42:06 +0000 Subject: [PATCH 03/13] Fix existing tests --- .../ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx | 2 +- src/hooks/queries.test.jsx | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx index 831e39d15b5..fef53a588a0 100644 --- a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx +++ b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx @@ -286,5 +286,5 @@ ReviewDocumentsSidePanel.defaultProps = { expenseTickets: [], proGearTickets: [], weightTickets: [], - showAllFields: false, + showAllFields: true, }; diff --git a/src/hooks/queries.test.jsx b/src/hooks/queries.test.jsx index 7e3ac191391..df5d822dd18 100644 --- a/src/hooks/queries.test.jsx +++ b/src/hooks/queries.test.jsx @@ -590,6 +590,8 @@ describe('useMoveDetailsQueries', () => { shipmentType: 'PPM', ppmShipment: { id: 'p1', + movingExpenses: [], + proGearWeightTickets: [], shipmentId: 'c3', estimatedWeight: 100, weightTickets: [ @@ -705,6 +707,8 @@ describe('useMoveTaskOrderQueries', () => { shipmentType: 'PPM', ppmShipment: { id: 'p1', + movingExpenses: [], + proGearWeightTickets: [], shipmentId: 'c3', estimatedWeight: 100, weightTickets: [ @@ -1104,6 +1108,8 @@ describe('useReviewShipmentWeightsQuery', () => { shipmentType: 'PPM', ppmShipment: { id: 'p1', + movingExpenses: [], + proGearWeightTickets: [], shipmentId: 'c3', estimatedWeight: 100, weightTickets: [ From 8b2da8bcb679966944cfcd892cbb0da9684cc6b2 Mon Sep 17 00:00:00 2001 From: antgmann Date: Wed, 16 Oct 2024 13:16:12 +0000 Subject: [PATCH 04/13] Resolve color contrast and prevent flaky refresh error --- .../DocumentViewerSidebar/DocumentViewerSidebar.module.scss | 2 +- .../Office/ReviewBillableWeight/ReviewBillableWeight.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Office/DocumentViewerSidebar/DocumentViewerSidebar.module.scss b/src/pages/Office/DocumentViewerSidebar/DocumentViewerSidebar.module.scss index ba53df410de..acc0f978f53 100644 --- a/src/pages/Office/DocumentViewerSidebar/DocumentViewerSidebar.module.scss +++ b/src/pages/Office/DocumentViewerSidebar/DocumentViewerSidebar.module.scss @@ -88,7 +88,7 @@ .container:not(.defaultH3) h3 { font-size: 15px; - color: $base; + color: #3d4551; font-weight: normal; text-transform: uppercase; @include u-margin-top(0.5); diff --git a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx index 3b21cce797a..d150c583e5b 100644 --- a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx +++ b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx @@ -139,7 +139,7 @@ export default function ReviewBillableWeight() { }, [filteredShipments, selectedShipmentIndex]); useEffect(() => { - if (selectedShipment.shipmentType === 'PPM') { + if (!isLoading && selectedShipment.shipmentType === 'PPM') { let currentTotalWeight = 0; selectedShipment.ppmShipment.weightTickets.forEach((weight) => { currentTotalWeight += weight.fullWeight - weight.emptyWeight; @@ -151,7 +151,7 @@ export default function ReviewBillableWeight() { }; setPpmShipmentInfo(updatedPpmShipmentInfo); } - }, [selectedShipment]); + }, [isLoading, selectedShipment]); const queryClient = useQueryClient(); const { mutate: mutateMTOShipment } = useMutation(updateMTOShipment, { From 84698252fb618e9b381a48991a99a25ea51bd5d3 Mon Sep 17 00:00:00 2001 From: antgmann Date: Wed, 16 Oct 2024 17:09:00 +0000 Subject: [PATCH 05/13] Additional console cleanup --- .../Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx | 2 -- .../Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx | 5 ++++- .../ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx | 2 +- src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx | 6 +++--- .../Office/PPM/ReviewExpense/ReviewExpense.stories.jsx | 6 +++--- src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx | 6 +++--- .../Office/PPM/ReviewProGear/ReviewProGear.stories.jsx | 4 ++-- .../Office/PPM/ReviewProGear/ReviewProGear.test.jsx | 2 +- .../Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx | 6 +++--- .../PPM/ReviewWeightTicket/ReviewWeightTicket.stories.jsx | 6 +++--- .../PPM/ReviewWeightTicket/ReviewWeightTicket.test.jsx | 2 +- src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.jsx | 6 +++--- .../Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx | 1 - .../Office/ReviewBillableWeight/ReviewBillableWeight.jsx | 2 +- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx index 05e0fc2528e..a75d110d039 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx @@ -77,7 +77,6 @@ export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFi miles: ppmShipmentInfo.miles, estimatedWeight: ppmShipmentInfo.estimatedWeight, actualWeight: ppmShipmentInfo.actualWeight, - allowableWeight: ppmShipmentInfo.allowableWeight, }; return ( @@ -95,7 +94,6 @@ export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFi updatedItemName={updatedItemName} setUpdatedItemName={setUpdatedItemName} readOnly={readOnly} - expanded /> {showAllFields && ( diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx index 08718e2771a..441ee99fa55 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx @@ -1,5 +1,6 @@ import React from 'react'; import { waitFor, screen, fireEvent } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import PPMHeaderSummary from './PPMHeaderSummary'; @@ -159,8 +160,9 @@ const defaultProps = { estimatedWeight: 3000, actualWeight: 3500, }, - ppmNumber: 1, + ppmNumber: '1', showAllFields: false, + readOnly: false, }; describe('PPMHeaderSummary component', () => { @@ -173,6 +175,7 @@ describe('PPMHeaderSummary component', () => { await waitFor(() => { expect(screen.getByRole('heading', { level: 3, name: 'PPM 1' })).toBeInTheDocument(); }); + await userEvent.click(screen.getByTestId('shipmentInfo-showRequestDetailsButton')); expect(screen.getByText('Planned Move Start Date')).toBeInTheDocument(); expect(screen.getByText('02-Dec-2022')).toBeInTheDocument(); diff --git a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx index ba6afe478fb..aaa262c8db9 100644 --- a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx +++ b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx @@ -275,7 +275,7 @@ ReviewDocumentsSidePanel.propTypes = { ReviewDocumentsSidePanel.defaultProps = { ppmShipment: undefined, - ppmNumber: 1, + ppmNumber: '1', formRef: null, onSuccess: () => {}, onError: () => {}, diff --git a/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx b/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx index 5aaf64b279f..045aa5c0066 100644 --- a/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx +++ b/src/components/Office/PPM/ReviewExpense/ReviewExpense.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useCallback } from 'react'; import { useMutation } from '@tanstack/react-query'; -import { func, number, object } from 'prop-types'; +import { func, number, string, object } from 'prop-types'; import { Formik, Field } from 'formik'; import classnames from 'classnames'; import { FormGroup, Label, Radio, Textarea } from '@trussworks/react-uswds'; @@ -304,7 +304,7 @@ export default function ReviewExpense({
@@ -557,7 +557,7 @@ export default function ReviewExpense({ ReviewExpense.propTypes = { expense: ExpenseShape, tripNumber: number.isRequired, - ppmNumber: number.isRequired, + ppmNumber: string.isRequired, onSuccess: func, formRef: object, }; diff --git a/src/components/Office/PPM/ReviewExpense/ReviewExpense.stories.jsx b/src/components/Office/PPM/ReviewExpense/ReviewExpense.stories.jsx index 7db33106fbb..fe4a954eb98 100644 --- a/src/components/Office/PPM/ReviewExpense/ReviewExpense.stories.jsx +++ b/src/components/Office/PPM/ReviewExpense/ReviewExpense.stories.jsx @@ -146,7 +146,7 @@ Blank.args = { documentSets: documentSetsProps, documentSetIndex, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', }; export const NonStorage = Template.bind({}); @@ -155,7 +155,7 @@ NonStorage.args = { documentSets: documentSetsProps, documentSetIndex, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', categoryIndex: 1, expense: { movingExpenseType: expenseTypes.PACKING_MATERIALS, @@ -170,7 +170,7 @@ Storage.args = { documentSetIndex, ppmShipmentInfo: PPMShipmentInfo, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', categoryIndex: 1, expense: { movingExpenseType: expenseTypes.STORAGE, diff --git a/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx b/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx index 38267908d09..4c8850bf66d 100644 --- a/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx +++ b/src/components/Office/PPM/ReviewProGear/ReviewProGear.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import { useMutation } from '@tanstack/react-query'; -import { func, number, object } from 'prop-types'; +import { func, number, string, object } from 'prop-types'; import { Field, Formik } from 'formik'; import classnames from 'classnames'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -127,7 +127,7 @@ export default function ReviewProGear({
@@ -292,7 +292,7 @@ export default function ReviewProGear({ ReviewProGear.propTypes = { proGear: ProGearTicketShape, tripNumber: number.isRequired, - ppmNumber: number.isRequired, + ppmNumber: string.isRequired, onSuccess: func, formRef: object, }; diff --git a/src/components/Office/PPM/ReviewProGear/ReviewProGear.stories.jsx b/src/components/Office/PPM/ReviewProGear/ReviewProGear.stories.jsx index c375eb92f04..76428dc5a2b 100644 --- a/src/components/Office/PPM/ReviewProGear/ReviewProGear.stories.jsx +++ b/src/components/Office/PPM/ReviewProGear/ReviewProGear.stories.jsx @@ -33,14 +33,14 @@ export const Blank = Template.bind({}); Blank.args = { ppmShipmentInfo: PPMShipmentInfo, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', }; export const FilledIn = Template.bind({}); FilledIn.args = { ppmShipmentInfo: PPMShipmentInfo, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', proGear: { belongsToSelf: true, proGearDocument: [], diff --git a/src/components/Office/PPM/ReviewProGear/ReviewProGear.test.jsx b/src/components/Office/PPM/ReviewProGear/ReviewProGear.test.jsx index 5a147bdfa8c..88192433bb4 100644 --- a/src/components/Office/PPM/ReviewProGear/ReviewProGear.test.jsx +++ b/src/components/Office/PPM/ReviewProGear/ReviewProGear.test.jsx @@ -22,7 +22,7 @@ const defaultProps = { actualWeight: 3500, }, tripNumber: 1, - ppmNumber: 1, + ppmNumber: '1', showAllFields: false, }; diff --git a/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx b/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx index ef02a8a4751..612cf52f22d 100644 --- a/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx +++ b/src/components/Office/PPM/ReviewWeightTicket/ReviewWeightTicket.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState, useRef } from 'react'; import { useMutation } from '@tanstack/react-query'; -import { func, number, object, PropTypes } from 'prop-types'; +import { func, number, string, object, PropTypes } from 'prop-types'; import { Field, Formik } from 'formik'; import classnames from 'classnames'; import { Alert, FormGroup, Label, Radio, Textarea } from '@trussworks/react-uswds'; @@ -240,7 +240,7 @@ function ReviewWeightTicket({ { key={documentSetIndex} weightTicket={currentDocumentSet.documentSet} ppmShipmentInfo={ppmShipmentInfo} - ppmNumber={1} + ppmNumber="1" tripNumber={currentTripNumber} mtoShipment={mtoShipment} order={order} @@ -310,7 +310,7 @@ export const ReviewDocuments = ({ readOnly }) => { { documentSets={documentSets} documentSetIndex={documentSetIndex} categoryIndex={currentDocumentCategoryIndex} - ppmNumber={1} + ppmNumber="1" tripNumber={currentTripNumber} mtoShipment={mtoShipment} onError={onErrorMessage} diff --git a/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx b/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx index ec2f277d650..41e7431a866 100644 --- a/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx +++ b/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx @@ -335,7 +335,6 @@ describe('ReviewDocuments', () => { }); expect(await screen.findByRole('heading', { name: 'Send to customer?', level: 3 })).toBeInTheDocument(); - await userEvent.click(screen.getByTestId('shipmentInfo-showRequestDetailsButton')); await waitFor(() => { expect(screen.getByText('Show Details', { exact: false })).toBeInTheDocument(); }); diff --git a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx index d150c583e5b..5f318ef5565 100644 --- a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx +++ b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx @@ -267,7 +267,7 @@ export default function ReviewBillableWeight() { {selectedShipment.shipmentType !== 'PPM' ? ( ) : ( - + )}
From f0a23fcd600aad6058927ca27774780ad3f08e1e Mon Sep 17 00:00:00 2001 From: antgmann Date: Wed, 16 Oct 2024 18:30:37 +0000 Subject: [PATCH 06/13] Playwright fixes --- .../office/servicescounseling/servicesCounselingFlows.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js index 56b4ac2d3c1..bf712eb71e1 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js @@ -469,6 +469,7 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); + await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Actual Move Start Date await page.getByTestId('actualMoveDate').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); @@ -485,6 +486,7 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); + await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Starting Address await page.getByTestId('pickupAddress').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); @@ -501,6 +503,7 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); + await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Ending Address await page.getByTestId('destinationAddress').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); From ac416c03d93e02a3771f685c295089e7134d44e8 Mon Sep 17 00:00:00 2001 From: antgmann Date: Wed, 16 Oct 2024 19:02:30 +0000 Subject: [PATCH 07/13] Additional playwright fix --- .../servicescounseling/servicesCounselingWeightTickets.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js index 7bd3389f69d..29df6aac747 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js @@ -85,6 +85,7 @@ test('A services counselor can edit allowable weight', async ({ page, scPage }) await page.getByRole('link', { name: 'Review Documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); + await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); await page.getByTestId('editAllowableWeightButton').click(); await page.getByText('Cancel').click(); From 144089f11c385b2589f753c79339163c6a48d59d Mon Sep 17 00:00:00 2001 From: antgmann Date: Wed, 16 Oct 2024 20:13:58 +0000 Subject: [PATCH 08/13] Missed removal --- src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx index a75d110d039..0fc34548185 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx @@ -77,6 +77,7 @@ export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFi miles: ppmShipmentInfo.miles, estimatedWeight: ppmShipmentInfo.estimatedWeight, actualWeight: ppmShipmentInfo.actualWeight, + allowableWeight: ppmShipmentInfo.allowableWeight, }; return ( From 0edc540364a4e5b2c712dd339352cc86653f3d30 Mon Sep 17 00:00:00 2001 From: antgmann Date: Thu, 17 Oct 2024 13:53:07 +0000 Subject: [PATCH 09/13] Added render test, subcomponent testing best with playwright --- .../ReviewBillableWeight.test.jsx | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.test.jsx b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.test.jsx index 14fc3ac2259..21bfd2ba795 100644 --- a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.test.jsx +++ b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.test.jsx @@ -6,9 +6,11 @@ import ReviewBillableWeight from './ReviewBillableWeight'; import { formatWeight, formatDateFromIso } from 'utils/formatters'; import { useMovePaymentRequestsQueries } from 'hooks/queries'; -import { shipmentStatuses } from 'constants/shipments'; +import { shipmentStatuses, ppmShipmentStatuses } from 'constants/shipments'; import { tioRoutes } from 'constants/routes'; import { MockProviders, ReactQueryWrapper } from 'testUtils'; +import { createPPMShipmentWithFinalIncentive } from 'utils/test/factories/ppmShipment'; +import createUpload from 'utils/test/factories/upload'; // Mock the document viewer since we're not really testing that aspect here. // Document Viewer tests should be covered in the component itself. @@ -244,6 +246,44 @@ const mockDivertedMtoShipments = [ }, ]; +const mtoShipment = createPPMShipmentWithFinalIncentive({ + ppmShipment: { status: ppmShipmentStatuses.NEEDS_CLOSEOUT }, + id: 'shipment123', +}); + +const weightTicketEmptyDocumentCreatedDate = new Date(); +// The factory used above doesn't handle overrides for uploads correctly, so we need to do it manually. +const weightTicketEmptyDocumentUpload = createUpload({ + fileName: 'emptyWeightTicket.pdf', + createdAtDate: weightTicketEmptyDocumentCreatedDate, +}); + +const weightTicketFullDocumentCreatedDate = new Date(weightTicketEmptyDocumentCreatedDate); +weightTicketFullDocumentCreatedDate.setDate(weightTicketFullDocumentCreatedDate.getDate() + 1); +const weightTicketFullDocumentUpload = createUpload( + { fileName: 'fullWeightTicket.xls', createdAtDate: weightTicketFullDocumentCreatedDate }, + { contentType: 'application/vnd.ms-excel' }, +); + +const progearWeightTicketDocumentCreatedDate = new Date(weightTicketFullDocumentCreatedDate); +progearWeightTicketDocumentCreatedDate.setDate(progearWeightTicketDocumentCreatedDate.getDate() + 1); +const progearWeightTicketDocumentUpload = createUpload({ + fileName: 'progearWeightTicket.pdf', + createdAtDate: progearWeightTicketDocumentCreatedDate, +}); + +const movingExpenseDocumentCreatedDate = new Date(progearWeightTicketDocumentCreatedDate); +movingExpenseDocumentCreatedDate.setDate(movingExpenseDocumentCreatedDate.getDate() + 1); +const movingExpenseDocumentUpload = createUpload( + { fileName: 'movingExpense.jpg', createdAtDate: movingExpenseDocumentCreatedDate }, + { contentType: 'image/jpeg' }, +); + +mtoShipment.ppmShipment.weightTickets[0].emptyDocument.uploads = [weightTicketEmptyDocumentUpload]; +mtoShipment.ppmShipment.weightTickets[0].fullDocument.uploads = [weightTicketFullDocumentUpload]; +mtoShipment.ppmShipment.proGearWeightTickets[0].document.uploads = [progearWeightTicketDocumentUpload]; +mtoShipment.ppmShipment.movingExpenses[0].document.uploads = [movingExpenseDocumentUpload]; + const mockPaymentRequest = [ { proofOfServiceDocs: [ @@ -314,6 +354,15 @@ const useDivertedMovePaymentRequestsReturnValue = { paymentRequests: mockPaymentRequest, }; +const useMovePaymentRequestQueriesReturnValueAllDocs = { + paymentRequests: [], + order: mockOrders['1'], + mtoShipments: [mtoShipment], + move, + isLoading: false, + isError: false, +}; + const loadingReturnValue = { isLoading: true, isError: false, @@ -720,4 +769,25 @@ describe('ReviewBillableWeight', () => { expect(screen.queryByTestId('tag', { name: 'DIVERSION' })).not.toBeInTheDocument(); }); }); + + describe('handles PPM shipments', () => { + it('displays PPM information', async () => { + useMovePaymentRequestsQueries.mockReturnValue(useMovePaymentRequestQueriesReturnValueAllDocs); + + renderWithProviders(); + + expect(screen.getByText('Review weights')).toBeInTheDocument(); + expect(screen.getByText('Max billable weight')).toBeInTheDocument(); + expect(screen.getByText('Actual weight')).toBeInTheDocument(); + expect(screen.getByTestId('maxBillableWeight').textContent).toBe( + formatWeight(useMovePaymentRequestQueriesReturnValueAllDocs.order.entitlement.authorizedWeight), + ); + expect(screen.getByTestId('weightAllowance').textContent).toBe( + formatWeight(useMovePaymentRequestQueriesReturnValueAllDocs.order.entitlement.totalWeight), + ); + + expect(screen.getByText('Weight allowance')).toBeInTheDocument(); + expect(screen.getByText('Actual billable weight')).toBeInTheDocument(); + }); + }); }); From eb6927ad54bd47a13c1382736f3dd96d590bd7ed Mon Sep 17 00:00:00 2001 From: antgmann Date: Thu, 17 Oct 2024 16:01:38 +0000 Subject: [PATCH 10/13] Introduce new playwright test --- playwright/tests/office/txo/tioFlows.spec.js | 57 +++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/playwright/tests/office/txo/tioFlows.spec.js b/playwright/tests/office/txo/tioFlows.spec.js index a21466a0858..2fbc65904fd 100644 --- a/playwright/tests/office/txo/tioFlows.spec.js +++ b/playwright/tests/office/txo/tioFlows.spec.js @@ -19,13 +19,16 @@ class TioFlowPage extends OfficePage { /** * @param {OfficePage} officePage * @param {Object} move + * @param {Boolean} usePaymentRequest * @override */ - constructor(officePage, move) { + constructor(officePage, move, usePaymentRequest) { super(officePage.page, officePage.request); this.move = move; this.moveLocator = move.locator; - this.paymentRequest = this.findPaymentRequestBySequenceNumber(1); + if (usePaymentRequest !== false) { + this.paymentRequest = this.findPaymentRequestBySequenceNumber(1); + } } /** @@ -182,7 +185,7 @@ test.describe('TIO user', () => { testMove = await officePage.testHarness.buildHHGMoveWithServiceItemsandPaymentRequestsForTIO(); await officePage.signInAsNewTIOUser(); - tioFlowPage = new TioFlowPage(officePage, testMove); + tioFlowPage = new TioFlowPage(officePage, testMove, true); const searchTab = officePage.page.getByTitle(TIOTabsTitles[1]); await searchTab.click(); @@ -330,7 +333,7 @@ test.describe('TIO user', () => { const move = await officePage.testHarness.buildHHGMoveWithServiceItemsandPaymentRequestsForTIO(); await officePage.signInAsNewTIOUser(); - tioFlowPage = new TioFlowPage(officePage, move); + tioFlowPage = new TioFlowPage(officePage, move, true); await tioFlowPage.waitForLoading(); await officePage.tioNavigateToMove(tioFlowPage.moveLocator); await officePage.page.getByRole('heading', { name: 'Payment Requests', exact: true }).waitFor(); @@ -646,7 +649,7 @@ test.describe('TIO user', () => { const move = await officePage.testHarness.buildNTSRMoveWithPaymentRequest(); await officePage.signInAsNewTIOUser(); - tioFlowPage = new TioFlowPage(officePage, move); + tioFlowPage = new TioFlowPage(officePage, move, true); await tioFlowPage.waitForLoading(); await officePage.tioNavigateToMove(tioFlowPage.moveLocator); await officePage.page.getByRole('heading', { name: 'Payment Requests', exact: true }).waitFor(); @@ -778,7 +781,7 @@ test.describe('TIO user', () => { const move = await officePage.testHarness.buildNTSRMoveWithServiceItemsAndPaymentRequest(); await officePage.signInAsNewTIOUser(); - tioFlowPage = new TioFlowPage(officePage, move); + tioFlowPage = new TioFlowPage(officePage, move, true); await tioFlowPage.waitForLoading(); await officePage.tioNavigateToMove(tioFlowPage.moveLocator); await officePage.page.getByRole('heading', { name: 'Payment Requests', exact: true }).waitFor(); @@ -864,4 +867,46 @@ test.describe('TIO user', () => { await expect(page.getByRole('heading', { name: 'Payment requests' })).toBeVisible(); }); }); + + test.describe('with PPM moves with weight tickets and documents', () => { + test.beforeEach(async ({ officePage }) => { + testMove = await officePage.testHarness.buildApprovedMoveWithPPMMovingExpenseOffice(); + await officePage.signInAsNewTIOUser(); + tioFlowPage = new TioFlowPage(officePage, testMove, false); + const searchTab = officePage.page.getByTitle(TIOTabsTitles[1]); + await searchTab.click(); + }); + + test('can view PPM review documents', async ({ page }) => { + const locator = `PPM ${testMove.locator}`; + const selectedRadio = page.getByRole('group').locator(`label:text("${SearchRBSelection[0]}")`); + await selectedRadio.click(); + await page.getByTestId('searchText').fill(testMove.locator); + await page.getByTestId('searchTextSubmit').click(); + + await expect(page.getByText('Results')).toBeVisible(); + await expect(page.getByTestId('locator-0')).toContainText(testMove.locator); + await page.getByTestId('locator-0').click(); + await page.getByRole('button', { name: 'Review shipment weights' }).click(); + await page.getByRole('button', { name: 'Review shipment weights' }).click(); + await expect(page.getByText(locator)).toBeVisible(); + await expect(page.getByText('Shipment Info')).toBeVisible(); + + await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); + await expect(page.getByText('Planned Move Start Date')).toBeVisible(); + await expect(page.getByText('Actual Move Start Date')).toBeVisible(); + await expect(page.getByText('Starting Address')).toBeVisible(); + await expect(page.getByText('Ending Address')).toBeVisible(); + await expect(page.getByText('Miles')).toBeVisible(); + await expect(page.getByText('Estimated Net Weight')).toBeVisible(); + await expect(page.getByText('Actual Net Weight')).toBeVisible(); + await expect(page.getByText('Allowable Weight')).toBeVisible(); + await expect(page.getByText('SENT TO CUSTOMER')).toBeVisible(); + await expect(page.getByText('TRIP 1')).toBeVisible(); + await expect(page.getByText('RECEIPT 1')).toBeVisible(); + await expect(page.getByText('RECEIPT 2')).toBeVisible(); + + await page.getByRole('button', { name: 'Done' }).click(); + }); + }); }); From 1b47b5ba87a39be9f62aeb458e39c2b80510fe44 Mon Sep 17 00:00:00 2001 From: antgmann Date: Fri, 18 Oct 2024 18:52:28 +0000 Subject: [PATCH 11/13] Cleanup --- .../ReviewBillableWeight/ReviewBillableWeight.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx index 5f318ef5565..3d39a5d2c48 100644 --- a/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx +++ b/src/pages/Office/ReviewBillableWeight/ReviewBillableWeight.jsx @@ -259,16 +259,12 @@ export default function ReviewBillableWeight() { if (isLoading) return ; if (isError) return ; - const fileList = getAllFiles(); - const ppmFileList = getAllPPMShipmentFiles(selectedShipment.ppmShipment); + const fileList = + selectedShipment.shipmentType !== 'PPM' ? getAllFiles() : getAllPPMShipmentFiles(selectedShipment.ppmShipment); return (
- {selectedShipment.shipmentType !== 'PPM' ? ( - - ) : ( - - )} +
{sidebarType === 'MAX' ? ( From b1b10c6b6183ff03624298d72caee0f021f39360 Mon Sep 17 00:00:00 2001 From: antgmann Date: Mon, 21 Oct 2024 19:18:36 +0000 Subject: [PATCH 12/13] Review feedback --- .../Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx | 1 + .../PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx | 2 -- .../ReviewDocumentsSidePanel.jsx | 10 +++++++++- .../ReviewDocumentsSidePanel.module.scss | 6 ++++++ .../PPM/ReviewDocuments/ReviewDocuments.test.jsx | 1 + 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx index 0fc34548185..05e0fc2528e 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.jsx @@ -95,6 +95,7 @@ export default function PPMHeaderSummary({ ppmShipmentInfo, ppmNumber, showAllFi updatedItemName={updatedItemName} setUpdatedItemName={setUpdatedItemName} readOnly={readOnly} + expanded /> {showAllFields && ( diff --git a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx index 441ee99fa55..3515969f645 100644 --- a/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx +++ b/src/components/Office/PPM/PPMHeaderSummary/PPMHeaderSummary.test.jsx @@ -1,6 +1,5 @@ import React from 'react'; import { waitFor, screen, fireEvent } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; import PPMHeaderSummary from './PPMHeaderSummary'; @@ -175,7 +174,6 @@ describe('PPMHeaderSummary component', () => { await waitFor(() => { expect(screen.getByRole('heading', { level: 3, name: 'PPM 1' })).toBeInTheDocument(); }); - await userEvent.click(screen.getByTestId('shipmentInfo-showRequestDetailsButton')); expect(screen.getByText('Planned Move Start Date')).toBeInTheDocument(); expect(screen.getByText('02-Dec-2022')).toBeInTheDocument(); diff --git a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx index aaa262c8db9..4b1314d877d 100644 --- a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx +++ b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.jsx @@ -68,7 +68,7 @@ export default function ReviewDocumentsSidePanel({
); showReason = true; - } else { + } else if (ticket.status === PPMDocumentsStatus.REJECTED) { status = (
@@ -76,6 +76,14 @@ export default function ReviewDocumentsSidePanel({
); showReason = true; + } else { + status = ( +
+ + Pending +
+ ); + showReason = true; } return status; }; diff --git a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.module.scss b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.module.scss index 069561c21ef..748c5acb080 100644 --- a/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.module.scss +++ b/src/components/Office/PPM/ReviewDocumentsSidePanel/ReviewDocumentsSidePanel.module.scss @@ -126,6 +126,12 @@ margin-left: 17px; margin-right: 9px; } + + [data-icon='rotate-right'] { + color: $warning; + margin-left: 17px; + margin-right: 9px; + } } .container .ReviewDocumentsSidePanel main { diff --git a/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx b/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx index 41e7431a866..ec2f277d650 100644 --- a/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx +++ b/src/pages/Office/PPM/ReviewDocuments/ReviewDocuments.test.jsx @@ -335,6 +335,7 @@ describe('ReviewDocuments', () => { }); expect(await screen.findByRole('heading', { name: 'Send to customer?', level: 3 })).toBeInTheDocument(); + await userEvent.click(screen.getByTestId('shipmentInfo-showRequestDetailsButton')); await waitFor(() => { expect(screen.getByText('Show Details', { exact: false })).toBeInTheDocument(); }); From be9a89ffe2ca892cc1fe9e3f47f95c93b9fe9fa0 Mon Sep 17 00:00:00 2001 From: antgmann Date: Mon, 21 Oct 2024 19:45:55 +0000 Subject: [PATCH 13/13] Playwright adjustments --- .../office/servicescounseling/servicesCounselingFlows.spec.js | 3 --- .../servicescounseling/servicesCounselingWeightTickets.spec.js | 1 - playwright/tests/office/txo/tioFlows.spec.js | 1 - 3 files changed, 5 deletions(-) diff --git a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js index bf712eb71e1..56b4ac2d3c1 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js @@ -469,7 +469,6 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); - await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Actual Move Start Date await page.getByTestId('actualMoveDate').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); @@ -486,7 +485,6 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); - await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Starting Address await page.getByTestId('pickupAddress').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); @@ -503,7 +501,6 @@ test.describe('Services counselor user', () => { await page.getByRole('button', { name: 'Review documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); - await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); // Edit Ending Address await page.getByTestId('destinationAddress').getByTestId('editTextButton').click(); await page.waitForSelector('text="Edit Shipment Info"'); diff --git a/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js index 29df6aac747..7bd3389f69d 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingWeightTickets.spec.js @@ -85,7 +85,6 @@ test('A services counselor can edit allowable weight', async ({ page, scPage }) await page.getByRole('link', { name: 'Review Documents' }).click(); await scPage.waitForPage.reviewWeightTicket(); - await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); await page.getByTestId('editAllowableWeightButton').click(); await page.getByText('Cancel').click(); diff --git a/playwright/tests/office/txo/tioFlows.spec.js b/playwright/tests/office/txo/tioFlows.spec.js index 2fbc65904fd..9a9ad93b8eb 100644 --- a/playwright/tests/office/txo/tioFlows.spec.js +++ b/playwright/tests/office/txo/tioFlows.spec.js @@ -892,7 +892,6 @@ test.describe('TIO user', () => { await expect(page.getByText(locator)).toBeVisible(); await expect(page.getByText('Shipment Info')).toBeVisible(); - await page.getByTestId('shipmentInfo-showRequestDetailsButton').click(); await expect(page.getByText('Planned Move Start Date')).toBeVisible(); await expect(page.getByText('Actual Move Start Date')).toBeVisible(); await expect(page.getByText('Starting Address')).toBeVisible();