Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main b 21372 order files uploaded signifier #14243

Merged
merged 31 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2c704ff
B-21372 - 'Orders Document(s)' signifier created and working for coun…
ryan-mchugh Oct 22, 2024
422025d
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Oct 23, 2024
78b0ef4
B-21372 - initial tests and storybook stories.
ryan-mchugh Oct 23, 2024
e9977dc
B-21372 - fix tangential tests.
ryan-mchugh Oct 24, 2024
983ed56
B-21372 - restore commented tests.
ryan-mchugh Oct 24, 2024
a7fb790
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Oct 24, 2024
ee5db59
B-21372 - fix mocked queries.
ryan-mchugh Oct 24, 2024
a84374b
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Oct 28, 2024
0f67e02
B-21372 - fix tests (data).
ryan-mchugh Oct 29, 2024
dd350a2
B-21372 - fix for deleted documents.
ryan-mchugh Oct 29, 2024
61f4e89
B-21372 - minor update missed in fix for deleted files.
ryan-mchugh Oct 29, 2024
00abbed
B-21372 - change strategy to include amended uploads documents.
ryan-mchugh Oct 30, 2024
74f48c1
B-21372 - revert useMoveDetailsQueries
ryan-mchugh Oct 30, 2024
1109db9
B-21372 - fix MoveDetails test with useOrdersDocumentsQueries.
ryan-mchugh Oct 30, 2024
951fc2d
B-21372 - added test for missing orders doc error indicator increment.
ryan-mchugh Oct 31, 2024
9a1f540
B-21372 - swap 'Orders Document(s)' to 'Orders document(s)'
ryan-mchugh Nov 4, 2024
1a91482
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 5, 2024
faf0cab
B-21372 - back to using order uploads only.
ryan-mchugh Nov 6, 2024
2f33068
B-21372 - merge query back to useMoveDetailsQueries.
ryan-mchugh Nov 6, 2024
e778c58
B-21372 - fix tests.
ryan-mchugh Nov 7, 2024
bb873de
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 7, 2024
db9d7e3
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 7, 2024
4ed6f38
B-21372 - test cleanup.
ryan-mchugh Nov 7, 2024
482ceee
B-21372 - cleanup.
ryan-mchugh Nov 7, 2024
69df445
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 11, 2024
ca804c4
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 12, 2024
b3966e6
B-21372 - (pr feedback) bring testing object in-line with model shape.
ryan-mchugh Nov 12, 2024
96a7a12
B-21372 - remove hasOrdersDocuments and use .length instead.
ryan-mchugh Nov 13, 2024
aea9abc
Merge branch 'main' of github.com:transcom/mymove into MAIN-B-21372-o…
ryan-mchugh Nov 20, 2024
131bd02
Merge branch 'main' into MAIN-B-21372-order_files_uploaded_signifier
ryan-mchugh Nov 21, 2024
6d89287
Merge branch 'main' into MAIN-B-21372-order_files_uploaded_signifier
ryan-mchugh Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/Office/DefinitionLists/OrdersList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ const OrdersList = ({ ordersInfo, showMissingWarnings }) => {
<dt>Orders type detail</dt>
<dd data-testid="ordersTypeDetail">{ordersTypeDetailReadable(ordersInfo.ordersTypeDetail, missingText)}</dd>
</div>
<div
className={classnames(descriptionListStyles.row, {
[styles.missingInfoError]: showMissingWarnings && !ordersInfo.ordersDocuments,
})}
>
<dt>Orders document(s)</dt>
<dd data-testid="ordersDocuments">{!ordersInfo.ordersDocuments ? missingText : 'File(s) Uploaded'}</dd>
</div>
<div
className={classnames(descriptionListStyles.row, {
[styles.missingInfoError]: showMissingWarnings && !ordersInfo.tacMDC,
Expand Down
51 changes: 50 additions & 1 deletion src/components/Office/DefinitionLists/OrdersList.stories.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { object, text } from '@storybook/addon-knobs';
import { array, object, text } from '@storybook/addon-knobs';

import OrdersList from './OrdersList';

Expand All @@ -22,6 +22,21 @@ export const Basic = () => (
ordersNumber: text('ordersInfo.ordersNumber', '999999999'),
ordersType: text('ordersInfo.ordersType', ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION),
ordersTypeDetail: text('ordersInfo.ordersTypeDetail', 'HHG_PERMITTED'),
ordersDocuments: array('ordersInfo.ordersDocuments', [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
]),
tacMDC: text('ordersInfo.tacMDC', '9999'),
sacSDN: text('ordersInfo.sacSDN', '999 999999 999'),
NTSsac: text('ordersInfo.NTSsac', '999 999999 999'),
Expand All @@ -45,6 +60,21 @@ export const AsServiceCounselor = () => (
ordersNumber: '',
ordersType: '',
ordersTypeDetail: '',
ordersDocuments: array('ordersInfo.ordersDocuments', [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
]),
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand All @@ -68,6 +98,7 @@ export const AsServiceCounselorProcessingRetirement = () => (
ordersNumber: '',
ordersType: 'RETIREMENT',
ordersTypeDetail: '',
ordersDocuments: null,
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand All @@ -91,6 +122,7 @@ export const AsServiceCounselorProcessingSeparation = () => (
ordersNumber: '',
ordersType: 'SEPARATION',
ordersTypeDetail: '',
ordersDocuments: null,
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand All @@ -113,6 +145,21 @@ export const AsTOO = () => (
ordersNumber: '',
ordersType: '',
ordersTypeDetail: '',
ordersDocuments: array('ordersInfo.ordersDocuments', [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
]),
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand All @@ -135,6 +182,7 @@ export const AsTOOProcessingRetirement = () => (
ordersNumber: '',
ordersType: 'RETIREMENT',
ordersTypeDetail: '',
ordersDocuments: null,
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand All @@ -157,6 +205,7 @@ export const AsTOOProcessingSeparation = () => (
ordersNumber: '',
ordersType: 'SEPARATION',
ordersTypeDetail: '',
ordersDocuments: null,
tacMDC: '',
sacSDN: '',
NTSsac: '',
Expand Down
19 changes: 19 additions & 0 deletions src/components/Office/DefinitionLists/OrdersList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ const ordersInfo = {
ordersNumber: '999999999',
ordersType: 'PERMANENT_CHANGE_OF_STATION',
ordersTypeDetail: 'HHG_PERMITTED',
ordersDocuments: [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
],
tacMDC: '9999',
sacSDN: '999 999999 999',
payGrade: 'E_7',
Expand All @@ -27,6 +42,7 @@ const expectedRenderedOrdersInfo = {
ordersNumber: '999999999',
ordersType: 'Permanent Change Of Station (PCS)',
ordersTypeDetail: 'Shipment of HHG Permitted',
ordersDocuments: 'File(s) Uploaded',
tacMDC: '9999',
sacSDN: '999 999999 999',
payGrade: 'E-7',
Expand All @@ -41,6 +57,7 @@ const ordersInfoMissing = {
ordersNumber: '',
ordersType: '',
ordersTypeDetail: '',
ordersDocuments: null,
tacMDC: '',
sacSDN: '999 999999 999',
payGrade: '',
Expand All @@ -60,6 +77,7 @@ describe('OrdersList', () => {
expect(screen.getByTestId('ordersNumber').textContent).toEqual('Missing');
expect(screen.getByTestId('ordersType').textContent).toEqual('Missing');
expect(screen.getByTestId('ordersTypeDetail').textContent).toEqual('Missing');
expect(screen.getByTestId('ordersDocuments').textContent).toEqual('Missing');
expect(screen.getByTestId('tacMDC').textContent).toEqual('Missing');
expect(screen.getByTestId('payGrade').textContent).toEqual('Missing');
});
Expand All @@ -70,6 +88,7 @@ describe('OrdersList', () => {
expect(screen.getByTestId('ordersNumber').textContent).toEqual('—');
expect(screen.getByTestId('ordersType').textContent).toEqual('—');
expect(screen.getByTestId('ordersTypeDetail').textContent).toEqual('—');
expect(screen.getByTestId('ordersDocuments').textContent).toEqual('—');
expect(screen.getByTestId('tacMDC').textContent).toEqual('—');
expect(screen.getByTestId('payGrade').textContent).toEqual('—');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,21 @@ export const ordersInfo = {
ordersNumber: 'ORDER3',
ordersType: ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION,
ordersTypeDetail: 'TBD',
ordersDocuments: [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
],
tacMDC: '',
sacSDN: '',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ const ordersInfo = {
ordersNumber: 'ORDER3',
ordersType: 'PERMANENT_CHANGE_OF_STATION',
ordersTypeDetail: 'TBD',
ordersDocuments: [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
],
tacMDC: '',
sacSDN: '',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ const ordersInfo = {
ordersNumber: 'ORDER3',
ordersType: 'PERMANENT_CHANGE_OF_STATION',
ordersTypeDetail: 'TBD',
ordersDocuments: [
{
'c0a22a98-a806-47a2-ab54-2dac938667b3': {
bytes: 2202009,
contentType: 'application/pdf',
createdAt: '2024-10-23T16:31:21.085Z',
filename: 'testFile.pdf',
id: 'c0a22a98-a806-47a2-ab54-2dac938667b3',
status: 'PROCESSING',
updatedAt: '2024-10-23T16:31:21.085Z',
uploadType: 'USER',
url: '/storage/USER/uploads/c0a22a98-a806-47a2-ab54-2dac938667b3?contentType=application%2Fpdf',
},
},
],
tacMDC: '',
sacSDN: '',
};
Expand Down
8 changes: 6 additions & 2 deletions src/hooks/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export const useMoveTaskOrderQueries = (moveCode) => {
export const useGetDocumentQuery = (documentId) => {
const staleTime = 15 * 60000; // 15 * 60000 milliseconds = 15 mins
const cacheTime = staleTime;
const { data: { documents, uploads } = {}, ...documentsQuery } = useQuery(
const { data: { documents, upload } = {}, ...documentsQuery } = useQuery(
[ORDERS_DOCUMENTS, documentId],
({ queryKey }) => getDocument(...queryKey),
{
Expand All @@ -453,7 +453,7 @@ export const useGetDocumentQuery = (documentId) => {

return {
documents,
uploads,
upload,
isLoading,
isError,
isSuccess,
Expand Down Expand Up @@ -845,6 +845,8 @@ export const useMoveDetailsQueries = (moveCode) => {

const order = Object.values(orders || {})?.[0];

const { upload: orderDocuments, ...documentQuery } = useGetDocumentQuery(order.uploaded_order_id);

const { data: mtoShipments, ...mtoShipmentQuery } = useQuery({
queryKey: [MTO_SHIPMENTS, moveId, false],
queryFn: ({ queryKey }) => getMTOShipments(...queryKey),
Expand Down Expand Up @@ -877,6 +879,7 @@ export const useMoveDetailsQueries = (moveCode) => {
const { isLoading, isError, isSuccess } = getQueriesStatus([
moveQuery,
orderQuery,
documentQuery,
customerQuery,
mtoShipmentQuery,
mtoServiceItemQuery,
Expand All @@ -886,6 +889,7 @@ export const useMoveDetailsQueries = (moveCode) => {
return {
move,
order,
orderDocuments,
customerData,
closeoutOffice,
mtoShipments,
Expand Down
16 changes: 10 additions & 6 deletions src/hooks/queries.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ jest.mock('services/ghcApi', () => ({
documents: {
[id]: {
id,
uploads: [`${id}0`],
uploads: [`${id}`],
},
},
upload: {
id: `${id}0`,
id: `${id}`,
},
}),
getMovesQueue: () =>
Expand Down Expand Up @@ -501,6 +501,7 @@ describe('useMoveDetailsQueries', () => {
},
report_by_date: '2018-08-01',
},
orderDocuments: undefined,
mtoShipments: undefined,
mtoServiceItems: undefined,
isLoading: true,
Expand Down Expand Up @@ -540,6 +541,9 @@ describe('useMoveDetailsQueries', () => {
},
report_by_date: '2018-08-01',
},
orderDocuments: {
id: '2',
},
mtoShipments: [
{
id: 'a1',
Expand Down Expand Up @@ -863,21 +867,21 @@ describe('useOrdersDocumentQueries', () => {
documents: {
2: {
id: '2',
uploads: ['20'],
uploads: ['2'],
},
},
upload: {
id: '20',
id: '2',
},
amendedDocuments: {
3: {
id: '3',
uploads: ['30'],
uploads: ['3'],
},
},
amendedOrderDocumentId: '3',
amendedUpload: {
id: '30',
id: '3',
},
isLoading: false,
isError: false,
Expand Down
21 changes: 17 additions & 4 deletions src/pages/Office/MoveDetails/MoveDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,19 @@ const MoveDetails = ({

const navigate = useNavigate();

const { move, customerData, order, closeoutOffice, mtoShipments, mtoServiceItems, isLoading, isError } =
useMoveDetailsQueries(moveCode);
const {
move,
customerData,
order,
orderDocuments,
closeoutOffice,
mtoShipments,
mtoServiceItems,
isLoading,
isError,
} = useMoveDetailsQueries(moveCode);

const validOrdersDocuments = Object.values(orderDocuments || {})?.filter((file) => !file.deletedAt);

// for now we are only showing dest type on retiree and separatee orders
let isRetirementOrSeparation = false;
Expand Down Expand Up @@ -296,16 +307,17 @@ const MoveDetails = ({

// 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
// so that it only recognizes the change when the orders object changes
// so that it only recognizes the change when the orders or validOrdersDocuments objects change
const requiredOrdersInfo = useMemo(
() => ({
ordersNumber: order?.order_number || '',
ordersType: order?.order_type || '',
ordersTypeDetail: order?.order_type_detail || '',
ordersDocuments: validOrdersDocuments?.length ? validOrdersDocuments : null,
tacMDC: order?.tac || '',
departmentIndicator: order?.department_indicator || '',
}),
[order],
[order, validOrdersDocuments],
);

// Keep num of missing orders info synced up
Expand Down Expand Up @@ -338,6 +350,7 @@ const MoveDetails = ({
ordersNumber: order.order_number,
ordersType: order.order_type,
ordersTypeDetail: order.order_type_detail,
ordersDocuments: validOrdersDocuments?.length ? validOrdersDocuments : null,
uploadedAmendedOrderID: order.uploadedAmendedOrderID,
amendedOrdersAcknowledgedAt: order.amendedOrdersAcknowledgedAt,
tacMDC: order.tac,
Expand Down
Loading
Loading