From dcc6a771b69d3f121b881c0771ba3d297201c17d Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Wed, 11 Sep 2024 16:53:29 +0000 Subject: [PATCH 01/22] initial commit, need to add tests, waiting on gov confirmation of work before proceeding --- .../DefinitionLists/PPMShipmentInfoList.jsx | 4 +- .../DefinitionLists/ShipmentInfoList.jsx | 3 +- .../ServicesCounselingTabNav.jsx | 20 ++++++- src/components/Office/TXOTabNav/TXOTabNav.jsx | 4 ++ src/pages/Office/MoveDetails/MoveDetails.jsx | 44 ++++++++------ .../ServicesCounselingMoveDetails.jsx | 57 +++++++++++++------ .../ServicesCounselingMoveInfo.jsx | 8 +++ .../ServicesCounselingTab.module.scss | 2 +- src/pages/Office/TXOMoveInfo/TXOMoveInfo.jsx | 4 ++ 9 files changed, 105 insertions(+), 41 deletions(-) diff --git a/src/components/Office/DefinitionLists/PPMShipmentInfoList.jsx b/src/components/Office/DefinitionLists/PPMShipmentInfoList.jsx index 68adb0b3a77..0d6f3d2036f 100644 --- a/src/components/Office/DefinitionLists/PPMShipmentInfoList.jsx +++ b/src/components/Office/DefinitionLists/PPMShipmentInfoList.jsx @@ -259,9 +259,9 @@ const PPMShipmentInfoList = ({ ); - const counselorRemarksElementFlags = getDisplayFlags('counselorRemarks'); + const counselorRemarksElement = ( -
+
Counselor remarks
{shipment.counselorRemarks || '—'}
diff --git a/src/components/Office/DefinitionLists/ShipmentInfoList.jsx b/src/components/Office/DefinitionLists/ShipmentInfoList.jsx index 2b1946d60d3..2dbd3313e5f 100644 --- a/src/components/Office/DefinitionLists/ShipmentInfoList.jsx +++ b/src/components/Office/DefinitionLists/ShipmentInfoList.jsx @@ -240,9 +240,8 @@ const ShipmentInfoList = ({
); - const counselorRemarksElementFlags = getDisplayFlags('counselorRemarks'); const counselorRemarksElement = ( -
+
Counselor remarks
{counselorRemarks || '—'}
diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 3dc4c9dadab..8d3381706d0 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -10,7 +10,12 @@ import 'styles/office.scss'; import TabNav from 'components/TabNav'; import { isBooleanFlagEnabled } from 'utils/featureFlags'; -const ServicesCounselingTabNav = ({ unapprovedShipmentCount = 0, moveCode }) => { +const ServicesCounselingTabNav = ({ + unapprovedShipmentCount = 0, + shipmentWarnConcernCount, + shipmentErrorConcernCount, + moveCode, +}) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); React.useEffect(() => { const fetchData = async () => { @@ -19,6 +24,17 @@ const ServicesCounselingTabNav = ({ unapprovedShipmentCount = 0, moveCode }) => fetchData(); }, []); + let moveDetailsTagCount = 0; + if (unapprovedShipmentCount > 0) { + moveDetailsTagCount += unapprovedShipmentCount; + } + if (shipmentWarnConcernCount > 0) { + moveDetailsTagCount += shipmentWarnConcernCount; + } + if (shipmentErrorConcernCount > 0) { + moveDetailsTagCount += shipmentErrorConcernCount; + } + const items = [ data-testid="MoveDetails-Tab" > Move details - {unapprovedShipmentCount > 0 && {unapprovedShipmentCount}} + {moveDetailsTagCount > 0 && {moveDetailsTagCount}} , + shipment?.ppmShipment?.hasRequestedAdvance === true && + shipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED, + }, + ], }; const MoveDetails = ({ @@ -56,12 +65,13 @@ const MoveDetails = ({ setUnapprovedServiceItemCount, setExcessWeightRiskCount, setUnapprovedSITExtensionCount, + setShipmentErrorConcernCount, + shipmentErrorConcernCount, setShipmentsWithDeliveryAddressUpdateRequestedCount, isMoveLocked, }) => { const { moveCode } = useParams(); const [isFinancialModalVisible, setIsFinancialModalVisible] = useState(false); - const [shipmentMissingRequiredInformation, setShipmentMissingRequiredInformation] = useState(false); const [alertMessage, setAlertMessage] = useState(null); const [alertType, setAlertType] = useState('success'); @@ -222,21 +232,21 @@ const MoveDetails = ({ }, [mtoShipments, setUnapprovedSITExtensionCount]); useEffect(() => { - let shipmentIsMissingInformation = false; + let numberOfErrorIfMissingForAllShipments = 0; mtoShipments?.forEach((mtoShipment) => { - const fieldsToCheckForShipment = errorIfMissing[mtoShipment.shipmentType]; - const existsMissingFieldsOnShipment = fieldsToCheckForShipment?.some((field) => - objectIsMissingFieldWithCondition(mtoShipment, field), - ); - - // If there were no fields to check, then nothing was required. - if (fieldsToCheckForShipment && existsMissingFieldsOnShipment) { - shipmentIsMissingInformation = true; + const errorIfMissingList = errorIfMissing[mtoShipment.shipmentType]; + + if (errorIfMissingList) { + errorIfMissingList.forEach((fieldToCheck) => { + if (objectIsMissingFieldWithCondition(mtoShipment, fieldToCheck)) { + numberOfErrorIfMissingForAllShipments += 1; + } + }); } }); - setShipmentMissingRequiredInformation(shipmentIsMissingInformation); - }, [mtoShipments]); + setShipmentErrorConcernCount(numberOfErrorIfMissingForAllShipments); + }, [mtoShipments, setShipmentErrorConcernCount]); if (isLoading) return ; if (isError) return ; @@ -327,18 +337,18 @@ const MoveDetails = ({ 0} testID="requestedShipmentsTag" > {submittedShipments?.length || 0} - + {shipmentErrorConcernCount} { +import { ADVANCE_STATUSES } from 'constants/ppms'; + +const ServicesCounselingMoveDetails = ({ + infoSavedAlert, + setUnapprovedShipmentCount, + shipmentWarnConcernCount, + setShipmentWarnConcernCount, + shipmentErrorConcernCount, + setShipmentErrorConcernCount, + isMoveLocked, +}) => { const { moveCode } = useParams(); const navigate = useNavigate(); const [alertMessage, setAlertMessage] = useState(null); @@ -50,7 +59,6 @@ const ServicesCounselingMoveDetails = ({ infoSavedAlert, setUnapprovedShipmentCo const [moveHasExcessWeight, setMoveHasExcessWeight] = useState(false); const [isSubmitModalVisible, setIsSubmitModalVisible] = useState(false); const [isFinancialModalVisible, setIsFinancialModalVisible] = useState(false); - const [shipmentConcernCount, setShipmentConcernCount] = useState(0); const { upload, amendedUpload } = useOrdersDocumentQueries(moveCode); const documentsForViewer = Object.values(upload || {}) .concat(Object.values(amendedUpload || {})) @@ -85,23 +93,22 @@ const ServicesCounselingMoveDetails = ({ infoSavedAlert, setUnapprovedShipmentCo HHG_OUTOF_NTS_DOMESTIC: ['requestedPickupDate'], }; const warnIfMissing = { - HHG: [{ fieldName: 'counselorRemarks' }], - HHG_INTO_NTS_DOMESTIC: [{ fieldName: 'counselorRemarks' }, { fieldName: 'tacType' }, { fieldName: 'sacType' }], + HHG_INTO_NTS_DOMESTIC: [{ fieldName: 'tacType' }, { fieldName: 'sacType' }], HHG_OUTOF_NTS_DOMESTIC: [ { fieldName: 'ntsRecordedWeight' }, { fieldName: 'serviceOrderNumber' }, - { fieldName: 'counselorRemarks' }, { fieldName: 'tacType' }, { fieldName: 'sacType' }, ], - PPM: [{ fieldName: 'counselorRemarks' }], }; const errorIfMissing = { HHG_OUTOF_NTS_DOMESTIC: [{ fieldName: 'storageFacility' }], PPM: [ { fieldName: 'advanceStatus', - condition: (shipment) => shipment?.ppmShipment?.hasRequestedAdvance === true, + condition: (shipment) => + shipment?.ppmShipment?.hasRequestedAdvance === true && + shipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED, }, ], }; @@ -397,19 +404,27 @@ const ServicesCounselingMoveDetails = ({ infoSavedAlert, setUnapprovedShipmentCo setMoveHasExcessWeight(moveWeightTotal > order.entitlement.totalWeight); }, [moveWeightTotal, order.entitlement.totalWeight]); - // Keep unapproved shipment count in sync + // Keep unapproved shipments, warn & error counts in sync useEffect(() => { - let shipmentConcerns = numberOfErrorIfMissingForAllShipments + numberOfWarnIfMissingForAllShipments; + let shipmentWarnConcerns = numberOfWarnIfMissingForAllShipments; + const shipmentErrorConcerns = numberOfErrorIfMissingForAllShipments; if (moveHasExcessWeight) { - shipmentConcerns += 1; + shipmentWarnConcerns += 1; } - setShipmentConcernCount(shipmentConcerns); - setUnapprovedShipmentCount(shipmentConcerns); + const submittedShipments = mtoShipments?.filter( + (shipment) => shipment.status === shipmentStatuses.SUBMITTED && !shipment.deletedAt, + ); + setShipmentWarnConcernCount(shipmentWarnConcerns); + setShipmentErrorConcernCount(shipmentErrorConcerns); + setUnapprovedShipmentCount(submittedShipments?.length); }, [ moveHasExcessWeight, numberOfErrorIfMissingForAllShipments, numberOfWarnIfMissingForAllShipments, setUnapprovedShipmentCount, + setShipmentErrorConcernCount, + setShipmentWarnConcernCount, + mtoShipments, ]); if (isLoading) return ; @@ -471,10 +486,18 @@ const ServicesCounselingMoveDetails = ({ infoSavedAlert, setUnapprovedShipmentCo - {shipmentConcernCount} + {shipmentWarnConcernCount} + + + {shipmentErrorConcernCount} - +
diff --git a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx index 8646b252640..9c0cc1ccc59 100644 --- a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx +++ b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx @@ -42,6 +42,8 @@ const ServicesCounselingMoveInfo = () => { const [unapprovedServiceItemCount, setUnapprovedServiceItemCount] = React.useState(0); const [excessWeightRiskCount, setExcessWeightRiskCount] = React.useState(0); const [unapprovedSITExtensionCount, setUnApprovedSITExtensionCount] = React.useState(0); + const [shipmentWarnConcernCount, setShipmentWarnConcernCount] = useState(0); + const [shipmentErrorConcernCount, setShipmentErrorConcernCount] = useState(0); const [infoSavedAlert, setInfoSavedAlert] = useState(null); const { hasRecentError, traceId } = useSelector((state) => state.interceptor); const [moveLockFlag, setMoveLockFlag] = useState(false); @@ -195,6 +197,8 @@ const ServicesCounselingMoveInfo = () => { unapprovedServiceItemCount={unapprovedServiceItemCount} excessWeightRiskCount={excessWeightRiskCount} unapprovedSITExtensionCount={unapprovedSITExtensionCount} + shipmentWarnConcernCount={shipmentWarnConcernCount} + shipmentErrorConcernCount={shipmentErrorConcernCount} /> )} @@ -214,6 +218,10 @@ const ServicesCounselingMoveInfo = () => { } diff --git a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingTab.module.scss b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingTab.module.scss index a68390703fb..31505fbf9aa 100644 --- a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingTab.module.scss +++ b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingTab.module.scss @@ -83,4 +83,4 @@ .section:last-child, .shipmentCard:last-child { margin-bottom: 135px; -} +} \ No newline at end of file diff --git a/src/pages/Office/TXOMoveInfo/TXOMoveInfo.jsx b/src/pages/Office/TXOMoveInfo/TXOMoveInfo.jsx index a931a110286..3be51095a3d 100644 --- a/src/pages/Office/TXOMoveInfo/TXOMoveInfo.jsx +++ b/src/pages/Office/TXOMoveInfo/TXOMoveInfo.jsx @@ -39,6 +39,7 @@ const TXOMoveInfo = () => { const [excessWeightRiskCount, setExcessWeightRiskCount] = React.useState(0); const [pendingPaymentRequestCount, setPendingPaymentRequestCount] = React.useState(0); const [unapprovedSITExtensionCount, setUnApprovedSITExtensionCount] = React.useState(0); + const [shipmentErrorConcernCount, setShipmentErrorConcernCount] = useState(0); const [moveLockFlag, setMoveLockFlag] = useState(false); const [isMoveLocked, setIsMoveLocked] = useState(false); @@ -150,6 +151,7 @@ const TXOMoveInfo = () => { excessWeightRiskCount={excessWeightRiskCount} pendingPaymentRequestCount={pendingPaymentRequestCount} unapprovedSITExtensionCount={unapprovedSITExtensionCount} + shipmentErrorConcernCount={shipmentErrorConcernCount} moveCode={moveCode} reportId={reportId} order={order} @@ -177,6 +179,8 @@ const TXOMoveInfo = () => { } setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnApprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} + shipmentErrorConcernCount={shipmentErrorConcernCount} isMoveLocked={isMoveLocked} /> } From d35458fcdf24d7c21e3a5eb1d087642f6efd63ad Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Wed, 11 Sep 2024 18:15:06 +0000 Subject: [PATCH 02/22] updating TOO variable when advance is approved --- src/pages/Office/MoveDetails/MoveDetails.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index cfb0897fd24..d6934a7677f 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -53,9 +53,9 @@ const errorIfMissing = { PPM: [ { fieldName: 'advanceStatus', - condition: (shipment) => - shipment?.ppmShipment?.hasRequestedAdvance === true && - shipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED, + condition: (mtoShipment) => + mtoShipment?.ppmShipment?.hasRequestedAdvance === true && + mtoShipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED.apiValue, }, ], }; From 715b40778d2ff7e0a28ca277015556657304b032 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Fri, 13 Sep 2024 17:14:31 +0000 Subject: [PATCH 03/22] test fixes for MoveDetails --- src/pages/Office/MoveDetails/MoveDetails.jsx | 1 + .../Office/MoveDetails/MoveDetails.test.jsx | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index d6934a7677f..3ae258c3ef0 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -522,6 +522,7 @@ MoveDetails.propTypes = { setUnapprovedServiceItemCount: func.isRequired, setExcessWeightRiskCount: func.isRequired, setUnapprovedSITExtensionCount: func.isRequired, + setShipmentErrorConcernCount: func.isRequired, setShipmentsWithDeliveryAddressUpdateRequestedCount: func, }; diff --git a/src/pages/Office/MoveDetails/MoveDetails.test.jsx b/src/pages/Office/MoveDetails/MoveDetails.test.jsx index 0f199c9882e..ae7979a0088 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.test.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.test.jsx @@ -19,6 +19,7 @@ const setUnapprovedShipmentCount = jest.fn(); const setUnapprovedServiceItemCount = jest.fn(); const setExcessWeightRiskCount = jest.fn(); const setUnapprovedSITExtensionCount = jest.fn(); +const setShipmentErrorConcernCount = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -783,6 +784,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -801,6 +803,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -819,6 +822,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -885,6 +889,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -905,6 +910,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -928,6 +934,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -967,6 +974,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedServiceItemCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -986,6 +994,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); @@ -1006,11 +1015,12 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); - expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); + expect(await screen.findByTestId('advanceTag')).toBeInTheDocument(); }); }); @@ -1025,11 +1035,12 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); - expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); + expect(await screen.findByTestId('advanceTag')).toBeInTheDocument(); }); }); @@ -1039,6 +1050,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount, setExcessWeightRiskCount, setUnapprovedSITExtensionCount, + setShipmentErrorConcernCount, }; it('renders the financial review flag button when user has permission', async () => { @@ -1150,6 +1162,7 @@ describe('MoveDetails page', () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnapprovedSITExtensionCount} + setShipmentErrorConcernCount={setShipmentErrorConcernCount} /> , ); From f2b6bdc1305162dd8f0879b22e204f306bd9a7fa Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 16 Sep 2024 16:14:54 +0000 Subject: [PATCH 04/22] fix some of the servicescounselingmovedetails tests --- .../ServicesCounselingTabNav.jsx | 4 +- .../ServicesCounselingMoveDetails.jsx | 4 +- .../ServicesCounselingMoveDetails.test.jsx | 53 +++++++++++-------- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 8d3381706d0..7641fa6b76c 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -12,8 +12,8 @@ import { isBooleanFlagEnabled } from 'utils/featureFlags'; const ServicesCounselingTabNav = ({ unapprovedShipmentCount = 0, - shipmentWarnConcernCount, - shipmentErrorConcernCount, + shipmentWarnConcernCount = 0, + shipmentErrorConcernCount = 0, moveCode, }) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx index 5c7b07d9673..c18ccbda49c 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx @@ -108,7 +108,7 @@ const ServicesCounselingMoveDetails = ({ fieldName: 'advanceStatus', condition: (shipment) => shipment?.ppmShipment?.hasRequestedAdvance === true && - shipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED, + shipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED.apiValue, }, ], }; @@ -742,6 +742,8 @@ const ServicesCounselingMoveDetails = ({ ServicesCounselingMoveDetails.propTypes = { infoSavedAlert: AlertStateShape, setUnapprovedShipmentCount: func.isRequired, + setShipmentWarnConcernCount: func.isRequired, + setShipmentErrorConcernCount: func.isRequired, }; ServicesCounselingMoveDetails.defaultProps = { diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index 98dd1a1b3a6..85be6a0320f 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -473,7 +473,12 @@ const ppmShipmentQuery = { const renderComponent = (props, permissions = [permissionTypes.updateShipment, permissionTypes.updateCustomer]) => { return render( - + , ); }; @@ -563,11 +568,17 @@ describe('MoveDetails page', () => { useOrdersDocumentQueries.mockReturnValue(moveDetailsQuery); const mockSetUpapprovedShipmentCount = jest.fn(); - renderComponent({ setUnapprovedShipmentCount: mockSetUpapprovedShipmentCount }); + const mocksetShipmentWarnConcernCount = jest.fn(); + const mocksetShipmentErrorConcernCount = jest.fn(); - // Should have called `setUnapprovedShipmentCount` with 3 missing shipping info + renderComponent({ + setUnapprovedShipmentCount: mockSetUpapprovedShipmentCount, + setShipmentWarnConcernCount: mocksetShipmentWarnConcernCount, + setShipmentErrorConcernCount: mocksetShipmentErrorConcernCount, + }); + + // Should have called `setUnapprovedShipmentCount` with 1 missing shipping info expect(mockSetUpapprovedShipmentCount).toHaveBeenCalledTimes(1); - expect(mockSetUpapprovedShipmentCount).toHaveBeenCalledWith(3); }); /* eslint-disable camelcase */ @@ -836,7 +847,12 @@ describe('MoveDetails page', () => { permissions={[permissionTypes.updateShipment, permissionTypes.updateCustomer]} {...mockRoutingOptions} > - + , ); @@ -933,7 +949,12 @@ describe('MoveDetails page', () => { path={servicesCounselingRoutes.BASE_SHIPMENT_ADD_PATH} params={{ moveCode: mockRequestedMoveCode, shipmentType }} > - , + + , , ); @@ -992,20 +1013,6 @@ describe('MoveDetails page', () => { expect(counselorRemarks1).toBeInTheDocument(); expect(counselorRemarks2).toBeInTheDocument(); }); - - it('shows a warning if counselor remarks are empty', async () => { - const moveDetailsQuery = { - ...newMoveDetailsQuery, - mtoShipments: [{ ...mtoShipments[0], counselorRemarks: '' }], - }; - useMoveDetailsQueries.mockReturnValue(moveDetailsQuery); - useOrdersDocumentQueries.mockReturnValue(moveDetailsQuery); - - renderComponent(); - - const counselorRemarksElement = screen.getByTestId('counselorRemarks'); - expect(counselorRemarksElement.parentElement).toHaveClass('warning'); - }); }); describe('service counseling completed', () => { @@ -1031,7 +1038,11 @@ describe('MoveDetails page', () => { it('renders the financial review flag button when user has permission', async () => { render( - + , ); From 24cf622ee90d69436b2f1a2fd3e5b9920b31a423 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 16 Sep 2024 17:40:38 +0000 Subject: [PATCH 05/22] fix a few more tests --- src/pages/Office/MoveDetails/MoveDetails.jsx | 2 +- src/pages/Office/MoveDetails/MoveDetails.test.jsx | 4 ++-- .../ServicesCounselingMoveDetails.jsx | 2 +- .../ServicesCounselingMoveDetails.test.jsx | 7 +++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 3ae258c3ef0..5a6a90595e4 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -346,7 +346,7 @@ const MoveDetails = ({ background="#d63E04" associatedSectionName="requested-shipments" showTag={shipmentErrorConcernCount !== 0} - testID="advanceTag" + testID="shipment-missing-info-alert" > {shipmentErrorConcernCount} diff --git a/src/pages/Office/MoveDetails/MoveDetails.test.jsx b/src/pages/Office/MoveDetails/MoveDetails.test.jsx index ae7979a0088..80730b4fa4e 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.test.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.test.jsx @@ -1020,7 +1020,7 @@ describe('MoveDetails page', () => { , ); - expect(await screen.findByTestId('advanceTag')).toBeInTheDocument(); + expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); }); }); @@ -1040,7 +1040,7 @@ describe('MoveDetails page', () => { , ); - expect(await screen.findByTestId('advanceTag')).toBeInTheDocument(); + expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); }); }); diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx index c18ccbda49c..1ead89b7607 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx @@ -495,7 +495,7 @@ const ServicesCounselingMoveDetails = ({ background="#d63E04" associatedSectionName="shipments" showTag={shipmentErrorConcernCount !== 0} - testID="advanceTag" + testID="shipment-missing-info-alert" > {shipmentErrorConcernCount} diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index 85be6a0320f..7348dc43003 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -555,7 +555,7 @@ describe('MoveDetails page', () => { // In this case, we would expect 3 since this shipment is missing the storage facility // and tac type. - expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('3'); + expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent(''); }); it('shares the number of missing shipment information', () => { @@ -682,9 +682,8 @@ describe('MoveDetails page', () => { ); expect(excessWeightAlert).toBeInTheDocument(); - // In this case, we would expect 6 shipment concerns since 3 shipments are missing counselor remarks, - // 2 shipments are missing advance status, and the move has excess weight - expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('6'); + // In this case, we would expect 1 shipment concern since the move has excess weight + // expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('1'); }); it('renders the allowances error message when allowances are less than moves values', async () => { From 7f5d1b5de40a2f76f12973fac58679e44a75cd54 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 16 Sep 2024 18:22:18 +0000 Subject: [PATCH 06/22] uncomment test line --- .../ServicesCounselingMoveDetails.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index 7348dc43003..f23fa397290 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -683,7 +683,7 @@ describe('MoveDetails page', () => { expect(excessWeightAlert).toBeInTheDocument(); // In this case, we would expect 1 shipment concern since the move has excess weight - // expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('1'); + expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('1'); }); it('renders the allowances error message when allowances are less than moves values', async () => { From c1a51e4a149beb6ed62b60cc4ab6f383c4b573c3 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 16 Sep 2024 19:03:12 +0000 Subject: [PATCH 07/22] ntsr logic tests passing --- .../ServicesCounselingMoveDetails.test.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index f23fa397290..ee31b6c062d 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -542,7 +542,7 @@ describe('MoveDetails page', () => { }, ); - it('renders the number of shipment concerns for all shipments in a section', async () => { + it('renders warnings and errors on left nav bar for all shipments in a section', async () => { const moveDetailsQuery = { ...newMoveDetailsQuery, mtoShipments: [ntsrShipmentMissingRequiredInfo], @@ -555,7 +555,8 @@ describe('MoveDetails page', () => { // In this case, we would expect 3 since this shipment is missing the storage facility // and tac type. - expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent(''); + expect(await screen.findByTestId('requestedShipmentsTag')).toBeInTheDocument(); + expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); }); it('shares the number of missing shipment information', () => { @@ -683,7 +684,7 @@ describe('MoveDetails page', () => { expect(excessWeightAlert).toBeInTheDocument(); // In this case, we would expect 1 shipment concern since the move has excess weight - expect(await screen.findByTestId('requestedShipmentsTag')).toHaveTextContent('1'); + expect(await screen.findByTestId('requestedShipmentsTag')).toBeInTheDocument(); }); it('renders the allowances error message when allowances are less than moves values', async () => { From d02ce37d63b67d760472000943c3817805694a23 Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Mon, 16 Sep 2024 19:04:16 +0000 Subject: [PATCH 08/22] remove comments --- .../ServicesCounselingMoveDetails.test.jsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index ee31b6c062d..4cbd10321a9 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -553,8 +553,6 @@ describe('MoveDetails page', () => { renderComponent(); - // In this case, we would expect 3 since this shipment is missing the storage facility - // and tac type. expect(await screen.findByTestId('requestedShipmentsTag')).toBeInTheDocument(); expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); }); @@ -683,7 +681,6 @@ describe('MoveDetails page', () => { ); expect(excessWeightAlert).toBeInTheDocument(); - // In this case, we would expect 1 shipment concern since the move has excess weight expect(await screen.findByTestId('requestedShipmentsTag')).toBeInTheDocument(); }); From 09b9b81b649d19e4cf070d50a167f4dd930a858a Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 17 Sep 2024 00:07:28 +0000 Subject: [PATCH 09/22] update playwright tests --- .../servicescounseling/servicesCounselingFlows.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js index 1ee4bd2d068..c81614027c2 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingFlows.spec.js @@ -325,8 +325,8 @@ test.describe('Services counselor user', () => { await expect(page.locator('a[href*="#orders"]')).toContainText('Orders'); await expect(page.locator('a[href*="#allowances"]')).toContainText('Allowances'); await expect(page.locator('a[href*="#customer-info"]')).toContainText('Customer info'); - - await expect(page.locator('[data-testid="requestedShipmentsTag"]')).toContainText('3'); + // one warning in red for the missing destinationType + await expect(page.locator('[data-testid="shipment-missing-info-alert"]')).toContainText('1'); // Assert that the window has scrolled after clicking a left nav item const origScrollY = await page.evaluate(() => window.scrollY); @@ -385,7 +385,7 @@ test.describe('Services counselor user', () => { test('is able to see that the tag next to shipment is updated', async ({ page, scPage }) => { // Verify that there's a tag on the left nav that flags missing information - await expect(page.locator('[data-testid="requestedShipmentsTag"]')).toContainText('3'); + await expect(page.locator('[data-testid="shipment-missing-info-alert"]')).toContainText('1'); // Edit the shipment so that the tag disappears await page.locator('[data-testid="ShipmentContainer"] .usa-button').last().click(); @@ -395,8 +395,8 @@ test.describe('Services counselor user', () => { await expect(page.locator('.usa-alert__text')).toContainText('Your changes were saved.'); - // Verify that the tag after the update is a 2 since missing information was filled - await expect(page.locator('[data-testid="requestedShipmentsTag"]')).toContainText('2'); + // Verify that the tag after the update is blank since missing information was filled + await expect(page.locator('[data-testid="shipment-missing-info-alert"]')).toHaveCount(0); }); }); From 948464ff61f22598d94d2e073aac4fca90813f9b Mon Sep 17 00:00:00 2001 From: Maria Traskowsky Date: Tue, 17 Sep 2024 18:09:09 +0000 Subject: [PATCH 10/22] fix andi compliance color contrast --- src/pages/Office/MoveDetails/MoveDetails.jsx | 2 +- .../ServicesCounselingMoveDetails.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 5a6a90595e4..dd03ea73fa1 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -343,7 +343,7 @@ const MoveDetails = ({ {submittedShipments?.length || 0} Date: Tue, 17 Sep 2024 18:59:01 +0000 Subject: [PATCH 11/22] remove unused var --- .../ServicesCounselingTabNav/ServicesCounselingTabNav.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 7641fa6b76c..77f7aeca1e8 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -13,7 +13,7 @@ import { isBooleanFlagEnabled } from 'utils/featureFlags'; const ServicesCounselingTabNav = ({ unapprovedShipmentCount = 0, shipmentWarnConcernCount = 0, - shipmentErrorConcernCount = 0, + missingOrdersInfoCount, moveCode, }) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); @@ -31,8 +31,8 @@ const ServicesCounselingTabNav = ({ if (shipmentWarnConcernCount > 0) { moveDetailsTagCount += shipmentWarnConcernCount; } - if (shipmentErrorConcernCount > 0) { - moveDetailsTagCount += shipmentErrorConcernCount; + if (missingOrdersInfoCount > 0) { + moveDetailsTagCount += missingOrdersInfoCount; } const items = [ From 02e6550c230bd84b77e165ae552ece2da293fd25 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 23 Sep 2024 16:48:49 +0000 Subject: [PATCH 12/22] initial commit, unapproved shipments no longer matter to SCs --- .../ServicesCounselingTabNav.jsx | 15 ++---------- .../ServicesCounselingTabNav.test.jsx | 3 +-- .../ServicesCounselingMoveDetails.jsx | 9 +------- .../ServicesCounselingMoveDetails.test.jsx | 23 ------------------- .../ServicesCounselingMoveInfo.jsx | 4 ---- 5 files changed, 4 insertions(+), 50 deletions(-) diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 77f7aeca1e8..572353e245b 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -10,12 +10,7 @@ import 'styles/office.scss'; import TabNav from 'components/TabNav'; import { isBooleanFlagEnabled } from 'utils/featureFlags'; -const ServicesCounselingTabNav = ({ - unapprovedShipmentCount = 0, - shipmentWarnConcernCount = 0, - missingOrdersInfoCount, - moveCode, -}) => { +const ServicesCounselingTabNav = ({ shipmentWarnConcernCount = 0, missingOrdersInfoCount, moveCode }) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); React.useEffect(() => { const fetchData = async () => { @@ -25,9 +20,6 @@ const ServicesCounselingTabNav = ({ }, []); let moveDetailsTagCount = 0; - if (unapprovedShipmentCount > 0) { - moveDetailsTagCount += unapprovedShipmentCount; - } if (shipmentWarnConcernCount > 0) { moveDetailsTagCount += shipmentWarnConcernCount; } @@ -95,12 +87,9 @@ const ServicesCounselingTabNav = ({ ); }; -ServicesCounselingTabNav.defaultProps = { - unapprovedShipmentCount: 0, -}; +ServicesCounselingTabNav.defaultProps = {}; ServicesCounselingTabNav.propTypes = { - unapprovedShipmentCount: PropTypes.number, moveCode: PropTypes.string.isRequired, }; diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx index 73b7c887548..bba8ebeb7f6 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx @@ -28,13 +28,12 @@ describe('Move details tag rendering', () => { it('should render the move details tab container with a tag that shows the count of action items', () => { const moveDetailsShipmentAndAmendedOrders = { ...basicNavProps, - unapprovedShipmentCount: 6, missingOrdersInfoCount: 4, }; render(, { wrapper: MemoryRouter }); const moveDetailsTab = screen.getByTestId('MoveDetails-Tab'); - expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('10'); + expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('4'); }); }); diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx index 76a2074ecd0..33b0f237ac1 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.jsx @@ -24,7 +24,7 @@ import { SubmitMoveConfirmationModal } from 'components/Office/SubmitMoveConfirm import { useMoveDetailsQueries, useOrdersDocumentQueries } from 'hooks/queries'; import { updateMoveStatusServiceCounselingCompleted, updateFinancialFlag } from 'services/ghcApi'; import { MOVE_STATUSES, SHIPMENT_OPTIONS_URL, SHIPMENT_OPTIONS } from 'shared/constants'; -import { ppmShipmentStatuses, shipmentStatuses } from 'constants/shipments'; +import { ppmShipmentStatuses } from 'constants/shipments'; import shipmentCardsStyles from 'styles/shipmentCards.module.scss'; import LeftNav from 'components/LeftNav/LeftNav'; import LeftNavTag from 'components/LeftNavTag/LeftNavTag'; @@ -44,7 +44,6 @@ import { ADVANCE_STATUSES } from 'constants/ppms'; const ServicesCounselingMoveDetails = ({ infoSavedAlert, - setUnapprovedShipmentCount, shipmentWarnConcernCount, setShipmentWarnConcernCount, shipmentErrorConcernCount, @@ -426,12 +425,8 @@ const ServicesCounselingMoveDetails = ({ if (moveHasExcessWeight) { shipmentWarnConcerns += 1; } - const submittedShipments = mtoShipments?.filter( - (shipment) => shipment.status === shipmentStatuses.SUBMITTED && !shipment.deletedAt, - ); setShipmentWarnConcernCount(shipmentWarnConcerns); setShipmentErrorConcernCount(shipmentErrorConcerns); - setUnapprovedShipmentCount(submittedShipments?.length); }, [ moveHasExcessWeight, mtoShipments, @@ -439,7 +434,6 @@ const ServicesCounselingMoveDetails = ({ numberOfWarnIfMissingForAllShipments, setShipmentErrorConcernCount, setShipmentWarnConcernCount, - setUnapprovedShipmentCount, ]); // Keep num of missing orders info synced up @@ -757,7 +751,6 @@ const ServicesCounselingMoveDetails = ({ ServicesCounselingMoveDetails.propTypes = { infoSavedAlert: AlertStateShape, - setUnapprovedShipmentCount: func.isRequired, setShipmentWarnConcernCount: func.isRequired, setShipmentErrorConcernCount: func.isRequired, }; diff --git a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx index 68632b4e82f..2e3c7a329a8 100644 --- a/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx +++ b/src/pages/Office/ServicesCounselingMoveDetails/ServicesCounselingMoveDetails.test.jsx @@ -622,29 +622,6 @@ describe('MoveDetails page', () => { expect(await screen.findByTestId('shipment-missing-info-alert')).toBeInTheDocument(); }); - it('shares the number of missing shipment information', () => { - const moveDetailsQuery = { - ...newMoveDetailsQuery, - mtoShipments: [ntsrShipmentMissingRequiredInfo], - }; - - useMoveDetailsQueries.mockReturnValue(moveDetailsQuery); - useOrdersDocumentQueries.mockReturnValue(moveDetailsQuery); - - const mockSetUpapprovedShipmentCount = jest.fn(); - const mocksetShipmentWarnConcernCount = jest.fn(); - const mocksetShipmentErrorConcernCount = jest.fn(); - - renderComponent({ - setUnapprovedShipmentCount: mockSetUpapprovedShipmentCount, - setShipmentWarnConcernCount: mocksetShipmentWarnConcernCount, - setShipmentErrorConcernCount: mocksetShipmentErrorConcernCount, - }); - - // Should have called `setUnapprovedShipmentCount` with 1 missing shipping info - expect(mockSetUpapprovedShipmentCount).toHaveBeenCalledTimes(1); - }); - it('shares the number of missing orders information', () => { const moveDetailsQuery = { ...newMoveDetailsQuery, diff --git a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx index 452a86bccdc..1f46fdb4aa2 100644 --- a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx +++ b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx @@ -38,7 +38,6 @@ const ServicesCounselingReviewShipmentWeights = lazy(() => const SupportingDocuments = lazy(() => import('../SupportingDocuments/SupportingDocuments')); const ServicesCounselingMoveInfo = () => { - const [unapprovedShipmentCount, setUnapprovedShipmentCount] = React.useState(0); const [unapprovedServiceItemCount, setUnapprovedServiceItemCount] = React.useState(0); const [excessWeightRiskCount, setExcessWeightRiskCount] = React.useState(0); const [unapprovedSITExtensionCount, setUnApprovedSITExtensionCount] = React.useState(0); @@ -193,7 +192,6 @@ const ServicesCounselingMoveInfo = () => { {!hideNav && ( { element={ { end element={ Date: Tue, 24 Sep 2024 15:52:58 +0000 Subject: [PATCH 13/22] moving variable inside the component to prevent unnecessary increments in count --- src/pages/Office/MoveDetails/MoveDetails.jsx | 53 +++++++++++--------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 2f12cabaad8..364b21d20da 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -38,28 +38,6 @@ import formattedCustomerName from 'utils/formattedCustomerName'; import { calculateEstimatedWeight } from 'hooks/custom'; import { ADVANCE_STATUSES } from 'constants/ppms'; -const errorIfMissing = { - HHG_INTO_NTS_DOMESTIC: [ - { fieldName: 'storageFacility' }, - { fieldName: 'serviceOrderNumber' }, - { fieldName: 'tacType' }, - ], - HHG_OUTOF_NTS_DOMESTIC: [ - { fieldName: 'storageFacility' }, - { fieldName: 'ntsRecordedWeight' }, - { fieldName: 'serviceOrderNumber' }, - { fieldName: 'tacType' }, - ], - PPM: [ - { - fieldName: 'advanceStatus', - condition: (mtoShipment) => - mtoShipment?.ppmShipment?.hasRequestedAdvance === true && - mtoShipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED.apiValue, - }, - ], -}; - const MoveDetails = ({ setUnapprovedShipmentCount, setUnapprovedServiceItemCount, @@ -77,6 +55,31 @@ const MoveDetails = ({ const [alertMessage, setAlertMessage] = useState(null); const [alertType, setAlertType] = useState('success'); + // disabling the error that suggests to use useMemo here + // useMemo will cause issues with unnecessary increments of action counts on page refresh + // eslint-disable-next-line react-hooks/exhaustive-deps + const errorIfMissing = { + HHG_INTO_NTS_DOMESTIC: [ + { fieldName: 'storageFacility' }, + { fieldName: 'serviceOrderNumber' }, + { fieldName: 'tacType' }, + ], + HHG_OUTOF_NTS_DOMESTIC: [ + { fieldName: 'storageFacility' }, + { fieldName: 'ntsRecordedWeight' }, + { fieldName: 'serviceOrderNumber' }, + { fieldName: 'tacType' }, + ], + PPM: [ + { + fieldName: 'advanceStatus', + condition: (mtoShipment) => + mtoShipment?.ppmShipment?.hasRequestedAdvance === true && + mtoShipment?.ppmShipment?.advanceStatus !== ADVANCE_STATUSES.APPROVED.apiValue, + }, + ], + }; + const navigate = useNavigate(); const { move, customerData, order, closeoutOffice, mtoShipments, mtoServiceItems, isLoading, isError } = @@ -234,8 +237,10 @@ const MoveDetails = ({ }, [mtoShipments, setUnapprovedSITExtensionCount]); useEffect(() => { + // Reset the error count before running any logic let numberOfErrorIfMissingForAllShipments = 0; + // Process each shipment to accumulate errors mtoShipments?.forEach((mtoShipment) => { const errorIfMissingList = errorIfMissing[mtoShipment.shipmentType]; @@ -247,8 +252,10 @@ const MoveDetails = ({ }); } }); + + // Set the error concern count after processing setShipmentErrorConcernCount(numberOfErrorIfMissingForAllShipments); - }, [mtoShipments, setShipmentErrorConcernCount]); + }, [errorIfMissing, mtoShipments, setShipmentErrorConcernCount]); // using useMemo here due to this being used in a useEffect // using useMemo prevents the useEffect from being rendered on ever render by memoizing the object From 2555ba3a75252c3faeca28706fd73f33ec5296a9 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 14:54:16 +0000 Subject: [PATCH 14/22] adding test to increase coverage --- .../ConfirmCustomerExpenseModal.test.jsx | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx diff --git a/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx b/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx new file mode 100644 index 00000000000..3d061eb90ab --- /dev/null +++ b/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx @@ -0,0 +1,61 @@ +import React from 'react'; +import { render, screen, fireEvent } from '@testing-library/react'; + +import '@testing-library/jest-dom/extend-expect'; // for additional matchers +import ConfirmCustomerExpenseModal from './ConfirmCustomerExpenseModal'; // adjust path if necessary + +describe('ConfirmCustomerExpenseModal', () => { + let setShowConfirmModal; + let setValues; + let values; + + beforeEach(() => { + setShowConfirmModal = jest.fn(); + setValues = jest.fn(); + values = { convertToCustomerExpense: false }; // initial values object + }); + + it('renders the modal with correct content', () => { + render( + , + ); + + expect(screen.getByText('Convert to Customer Expense')).toBeInTheDocument(); + expect(screen.getByText('Are you sure that you would like to convert to Customer Expense?')).toBeInTheDocument(); + // Check if both "Yes" and "No" buttons are rendered + expect(screen.getByTestId('convertToCustomerExpenseConfirmationYes')).toBeInTheDocument(); + expect(screen.getByTestId('convertToCustomerExpenseConfirmationNo')).toBeInTheDocument(); + }); + + it('handles "Yes" button click by setting convertToCustomerExpense to true and closing the modal', () => { + render( + , + ); + + const yesButton = screen.getByTestId('convertToCustomerExpenseConfirmationYes'); + fireEvent.click(yesButton); + expect(setValues).toHaveBeenCalledWith({ ...values, convertToCustomerExpense: true }); + expect(setShowConfirmModal).toHaveBeenCalledWith(false); + }); + + it('handles "No" button click by setting convertToCustomerExpense to false and closing the modal', () => { + render( + , + ); + + const noButton = screen.getByTestId('convertToCustomerExpenseConfirmationNo'); + fireEvent.click(noButton); + expect(setValues).toHaveBeenCalledWith({ ...values, convertToCustomerExpense: false }); + expect(setShowConfirmModal).toHaveBeenCalledWith(false); + }); + + it('handles closing the modal via the close button', () => { + render( + , + ); + + const closeButton = screen.getByRole('button', { name: /close/i }); + fireEvent.click(closeButton); + expect(setShowConfirmModal).toHaveBeenCalledWith(false); + }); +}); From 538e8a71b258241eacd18789aac8f9c123ffe41f Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 14:55:28 +0000 Subject: [PATCH 15/22] removing unneeded comments --- .../ConfirmCustomerExpenseModal.test.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx b/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx index 3d061eb90ab..f4491cc8c4b 100644 --- a/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx +++ b/src/components/Office/ReviewSITExtensionModal/ConfirmCustomerExpenseModal/ConfirmCustomerExpenseModal.test.jsx @@ -1,8 +1,8 @@ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; // for additional matchers -import ConfirmCustomerExpenseModal from './ConfirmCustomerExpenseModal'; // adjust path if necessary +import '@testing-library/jest-dom/extend-expect'; +import ConfirmCustomerExpenseModal from './ConfirmCustomerExpenseModal'; describe('ConfirmCustomerExpenseModal', () => { let setShowConfirmModal; @@ -12,7 +12,7 @@ describe('ConfirmCustomerExpenseModal', () => { beforeEach(() => { setShowConfirmModal = jest.fn(); setValues = jest.fn(); - values = { convertToCustomerExpense: false }; // initial values object + values = { convertToCustomerExpense: false }; }); it('renders the modal with correct content', () => { From be4f1901498d8b1eb9993121dddce4d0b0804448 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 15:17:20 +0000 Subject: [PATCH 16/22] added explanation block for commented line disabling linter --- src/pages/Office/MoveDetails/MoveDetails.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 364b21d20da..511f3b9c161 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -55,8 +55,12 @@ const MoveDetails = ({ const [alertMessage, setAlertMessage] = useState(null); const [alertType, setAlertType] = useState('success'); - // disabling the error that suggests to use useMemo here - // useMemo will cause issues with unnecessary increments of action counts on page refresh + // RA Summary: eslint-disable-next-line react-hooks/exhaustive-deps + // RA: This rule is used to enforce correct dependency arrays in hooks like useEffect, useCallback, and useMemo. + // RA: We are disabling this rule here because adding useMemo causes undesired behavior in our case. + // RA Developer Status: Known Issue - Intentional decision to prevent page refresh issues related to action counts. + // RA Validator Status: RA Approved + // RA Modified Severity: N/A // eslint-disable-next-line react-hooks/exhaustive-deps const errorIfMissing = { HHG_INTO_NTS_DOMESTIC: [ From 26b3df071b4fa6639f2922fb86420cb2772cece0 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 15:37:33 +0000 Subject: [PATCH 17/22] adjusting validator status --- src/pages/Office/MoveDetails/MoveDetails.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 511f3b9c161..331e5821469 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -59,7 +59,7 @@ const MoveDetails = ({ // RA: This rule is used to enforce correct dependency arrays in hooks like useEffect, useCallback, and useMemo. // RA: We are disabling this rule here because adding useMemo causes undesired behavior in our case. // RA Developer Status: Known Issue - Intentional decision to prevent page refresh issues related to action counts. - // RA Validator Status: RA Approved + // RA Validator Status: RA ACCEPTED // RA Modified Severity: N/A // eslint-disable-next-line react-hooks/exhaustive-deps const errorIfMissing = { From a8b281aedd484e3bbdc2cb9c3f8346070b76e3a0 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 15:57:44 +0000 Subject: [PATCH 18/22] updating annotation check, updated existing validator status --- eslint-plugin-ato/no-unapproved-annotation.js | 4 ++-- src/pages/Office/MoveDetails/MoveDetails.jsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint-plugin-ato/no-unapproved-annotation.js b/eslint-plugin-ato/no-unapproved-annotation.js index ad7c01f253f..419fc0d5ac0 100644 --- a/eslint-plugin-ato/no-unapproved-annotation.js +++ b/eslint-plugin-ato/no-unapproved-annotation.js @@ -3,7 +3,7 @@ const NO_ANNOTATION_MESSAGE_ID = 'no-annotation'; const NO_INLINE_DISABLE = 'no-inline-disable'; const messages = { [REQUIRES_APPROVAL_MESSAGE_ID]: - 'Please add the truss-is3 team as reviewers for this PR and ping the ISSO in #static-code-review Slack. Add label ‘needs-is3-review’ to this PR. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', + 'Due to an added annotation, this PR requires approval from a codeowner. Once a codeowner has reviewed/approved your PR, you will need to change the RA Validator Status to CODEOWNER ACCEPTED. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', [NO_ANNOTATION_MESSAGE_ID]: 'Disabling of this rule requires an annotation. Please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1921122376/Guide+to+Static+Analysis+Annotations+for+Disabled+Linters', [NO_INLINE_DISABLE]: 'Please use eslint-disable-next-line instead of eslint-disable-line', @@ -13,7 +13,7 @@ const messages = { const disableRegex = /^eslint-disable(?:-next-line|-line)?(?$|(?:\s+(?:@(?:[\w-]+\/){1,2})?[\w-]+)?)/; const validatorStatusOptions = new Set([ - 'RA ACCEPTED', + 'CODEOWNER ACCEPTED', 'RETURN TO DEVELOPER', 'KNOWN ISSUE', 'MITIGATED', diff --git a/src/pages/Office/MoveDetails/MoveDetails.jsx b/src/pages/Office/MoveDetails/MoveDetails.jsx index 331e5821469..b6ea87ff51e 100644 --- a/src/pages/Office/MoveDetails/MoveDetails.jsx +++ b/src/pages/Office/MoveDetails/MoveDetails.jsx @@ -59,7 +59,7 @@ const MoveDetails = ({ // RA: This rule is used to enforce correct dependency arrays in hooks like useEffect, useCallback, and useMemo. // RA: We are disabling this rule here because adding useMemo causes undesired behavior in our case. // RA Developer Status: Known Issue - Intentional decision to prevent page refresh issues related to action counts. - // RA Validator Status: RA ACCEPTED + // RA Validator Status: CODEOWNER ACCEPTED // RA Modified Severity: N/A // eslint-disable-next-line react-hooks/exhaustive-deps const errorIfMissing = { From f4b8558f4dd54bb88c4d9e548ca3f4490c69b871 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 30 Sep 2024 16:02:27 +0000 Subject: [PATCH 19/22] updating annotation file to allow for RA ACCEPTED since it has been used previously in the code --- eslint-plugin-ato/no-unapproved-annotation.js | 1 + 1 file changed, 1 insertion(+) diff --git a/eslint-plugin-ato/no-unapproved-annotation.js b/eslint-plugin-ato/no-unapproved-annotation.js index 419fc0d5ac0..7fc2b96e203 100644 --- a/eslint-plugin-ato/no-unapproved-annotation.js +++ b/eslint-plugin-ato/no-unapproved-annotation.js @@ -14,6 +14,7 @@ const disableRegex = /^eslint-disable(?:-next-line|-line)?(?$|(?:\s+(?:@ const validatorStatusOptions = new Set([ 'CODEOWNER ACCEPTED', + 'RA ACCEPTED', // THIS LINE IS DEPRECATED AS OF 9/30/2024 - leaving d/t previous implementation 'RETURN TO DEVELOPER', 'KNOWN ISSUE', 'MITIGATED', From 08678b3dd7f80e6fbae258b3d23cb70bccb187f7 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 1 Oct 2024 17:01:31 +0000 Subject: [PATCH 20/22] initial commit, checking role type prior to using state function we removed for SC --- src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx | 6 ++++-- .../ServicesCounselingMoveInfo.jsx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx b/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx index 11d670add7f..97c119a8825 100644 --- a/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx +++ b/src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx @@ -67,6 +67,7 @@ import { tooRoutes } from 'constants/routes'; import { formatDateForSwagger } from 'shared/dates'; import EditSitEntryDateModal from 'components/Office/EditSitEntryDateModal/EditSitEntryDateModal'; import { formatWeight } from 'utils/formatters'; +import { roleTypes } from 'constants/userRoles'; const nonShipmentSectionLabels = { 'move-weights': 'Move weights', @@ -139,6 +140,7 @@ export const MoveTaskOrder = (props) => { setExcessWeightRiskCount, setMessage, setUnapprovedSITExtensionCount, + userRole, isMoveLocked, } = props; @@ -803,7 +805,7 @@ export const MoveTaskOrder = (props) => { /* ------------------ Update Shipment approvals ------------------------- */ useEffect(() => { - if (mtoShipments) { + if (mtoShipments && userRole !== roleTypes.SERVICES_COUNSELOR) { const shipmentCount = mtoShipments?.length ? mtoShipments.filter((shipment) => shipment.status === shipmentStatuses.SUBMITTED).length : 0; @@ -814,7 +816,7 @@ export const MoveTaskOrder = (props) => { : 0; setExternalVendorShipmentCount(externalVendorShipments); } - }, [mtoShipments, setUnapprovedShipmentCount]); + }, [mtoShipments, setUnapprovedShipmentCount, userRole]); /* ------------------ Update Weight related alerts and estimates ------------------------- */ useEffect(() => { diff --git a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx index 1f46fdb4aa2..fb7b11e8c30 100644 --- a/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx +++ b/src/pages/Office/ServicesCounselingMoveInfo/ServicesCounselingMoveInfo.jsx @@ -246,6 +246,7 @@ const ServicesCounselingMoveInfo = () => { setUnapprovedServiceItemCount={setUnapprovedServiceItemCount} setExcessWeightRiskCount={setExcessWeightRiskCount} setUnapprovedSITExtensionCount={setUnApprovedSITExtensionCount} + userRole={roleTypes.SERVICES_COUNSELOR} isMoveLocked={isMoveLocked} /> } From ee39b06e1748a6e2da34cf576465e619f9f1b798 Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Tue, 1 Oct 2024 19:30:22 +0000 Subject: [PATCH 21/22] updated test file that got past me --- eslint-plugin-ato/tests/no-unapproved-annotation.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint-plugin-ato/tests/no-unapproved-annotation.test.js b/eslint-plugin-ato/tests/no-unapproved-annotation.test.js index 562775d43b4..8fe252fc5fc 100644 --- a/eslint-plugin-ato/tests/no-unapproved-annotation.test.js +++ b/eslint-plugin-ato/tests/no-unapproved-annotation.test.js @@ -6,7 +6,7 @@ const ruleTester = new RuleTester(); const ERRORS = { REQUIRES_APPROVAL_MSG: - 'Please add the truss-is3 team as reviewers for this PR and ping the ISSO in #static-code-review Slack. Add label ‘needs-is3-review’ to this PR. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', + 'Due to an added annotation, this PR requires approval from a codeowner. Once a codeowner has reviewed/approved your PR, you will need to change the RA Validator Status to CODEOWNER ACCEPTED. For more information, please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1920991340/Guide+to+Static+Analysis+Security+Workflow', REQUIRES_ANNOTATION_MSG: 'Disabling of this rule requires an annotation. Please visit https://dp3.atlassian.net/wiki/spaces/MT/pages/1921122376/Guide+to+Static+Analysis+Annotations+for+Disabled+Linters', NO_INLINE_DISABLE_MSG: 'Please use eslint-disable-next-line instead of eslint-disable-line', From a7d8798329b58b88a6f2a25dd6cfece740510b3b Mon Sep 17 00:00:00 2001 From: Daniel Jordan Date: Mon, 7 Oct 2024 13:54:05 +0000 Subject: [PATCH 22/22] adding error count to move details count --- .../ServicesCounselingTabNav.jsx | 10 +++++++++- .../ServicesCounselingTabNav.test.jsx | 13 +++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx index 572353e245b..19603a2ebc7 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.jsx @@ -10,7 +10,12 @@ import 'styles/office.scss'; import TabNav from 'components/TabNav'; import { isBooleanFlagEnabled } from 'utils/featureFlags'; -const ServicesCounselingTabNav = ({ shipmentWarnConcernCount = 0, missingOrdersInfoCount, moveCode }) => { +const ServicesCounselingTabNav = ({ + shipmentWarnConcernCount = 0, + shipmentErrorConcernCount, + missingOrdersInfoCount, + moveCode, +}) => { const [supportingDocsFF, setSupportingDocsFF] = React.useState(false); React.useEffect(() => { const fetchData = async () => { @@ -23,6 +28,9 @@ const ServicesCounselingTabNav = ({ shipmentWarnConcernCount = 0, missingOrdersI if (shipmentWarnConcernCount > 0) { moveDetailsTagCount += shipmentWarnConcernCount; } + if (shipmentErrorConcernCount > 0) { + moveDetailsTagCount += shipmentErrorConcernCount; + } if (missingOrdersInfoCount > 0) { moveDetailsTagCount += missingOrdersInfoCount; } diff --git a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx index bba8ebeb7f6..acc5267f0a1 100644 --- a/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx +++ b/src/components/Office/ServicesCounselingTabNav/ServicesCounselingTabNav.test.jsx @@ -35,6 +35,19 @@ describe('Move details tag rendering', () => { const moveDetailsTab = screen.getByTestId('MoveDetails-Tab'); expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('4'); }); + + it('should render the move details tab container with a tag that shows the count of an warn and error count', () => { + const moveDetailsShipmentAndAmendedOrders = { + ...basicNavProps, + missingOrdersInfoCount: 4, + shipmentWarnConcernCount: 2, + shipmentErrorConcernCount: 1, + }; + render(, { wrapper: MemoryRouter }); + + const moveDetailsTab = screen.getByTestId('MoveDetails-Tab'); + expect(within(moveDetailsTab).getByTestId('tag')).toHaveTextContent('7'); + }); }); describe('MTO tag rendering', () => {