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

B 20473 int #13957

Merged
merged 63 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4ec32e8
cancel move for SC and TOO
pambecker Oct 1, 2024
249bdb7
updates to button and modal
pambecker Oct 4, 2024
31fcb59
connect cancel to backend call
pambecker Oct 4, 2024
903e2ae
cleanup
pambecker Oct 7, 2024
65d6e3c
fix issue with PPM only not canceling
pambecker Oct 8, 2024
29804ed
Fix MTO Canceled label for PPM
pambecker Oct 8, 2024
bf5634f
button placement
pambecker Oct 9, 2024
9fc955c
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 9, 2024
5710bc5
update tests
pambecker Oct 10, 2024
abca4eb
updates to refresh page
pambecker Oct 10, 2024
dc08742
update shipment labels on cards
pambecker Oct 11, 2024
d305f72
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 11, 2024
6dd1149
update
pambecker Oct 11, 2024
71165cd
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 15, 2024
aaaf0ff
address is_oconus implementation
TevinAdams Oct 16, 2024
4f68d5b
update with main
TevinAdams Oct 16, 2024
81e6332
Merge remote-tracking branch 'origin/B-21077-Move-Shipment-Button-MAI…
pambecker Oct 17, 2024
b65c621
button alignment, css changes
pambecker Oct 17, 2024
82ba4ea
Merge branch 'B-21077-Move-Shipment-Button-MAIN' into B-20473-Office-…
pambecker Oct 18, 2024
8798f41
Merge branch 'B-21077-Move-Shipment-Button-MAIN' into B-20473-Office-…
pambecker Oct 18, 2024
20fa246
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 18, 2024
7e5ab75
spelling updates, happo changes
pambecker Oct 18, 2024
beebc64
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 18, 2024
3bcb558
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 21, 2024
4670835
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 21, 2024
e466457
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 21, 2024
dca783f
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 21, 2024
850a530
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 22, 2024
41780d4
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 22, 2024
0e8c62f
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 22, 2024
4349c30
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 22, 2024
d4382f7
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 22, 2024
63e0a67
changes per peer review, not needed code
pambecker Oct 22, 2024
440bffa
Merge branch 'main' into B-21362-MAIN
traskowskycaci Oct 22, 2024
fcc3012
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 22, 2024
4feb66d
fix merge conflict
pambecker Oct 22, 2024
c4d8494
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 22, 2024
ec00a7f
Merge branch 'main' into B-21363-MAIN
traskowskycaci Oct 22, 2024
1fdd432
Merge branch 'B-21363-MAIN' into B-21362-MAIN
traskowskycaci Oct 22, 2024
cda7294
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 23, 2024
a752a61
adding tests
pambecker Oct 23, 2024
54dba27
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 23, 2024
a22e862
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 23, 2024
eac5df5
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 23, 2024
d0f8216
Merge branch 'main' into B-21427-Update-addresses-is-oconus
TevinAdams Oct 23, 2024
0b0a376
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 23, 2024
cdaa231
Adding the rest of the changes from int PR
TevinAdams Oct 23, 2024
0d1ae65
Remove change thats not in int PR
TevinAdams Oct 23, 2024
248a1dc
Merge branch 'main' into B-21362-MAIN
traskowskycaci Oct 23, 2024
be70c0b
Missed this test addition
TevinAdams Oct 23, 2024
2a60d60
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 23, 2024
3d8884a
fix merge conflict
pambecker Oct 23, 2024
c3f1059
more tests
pambecker Oct 23, 2024
1cb9982
increasing statement timeout
TevinAdams Oct 15, 2024
794a7ea
Merge pull request #13984 from transcom/B-21427-Update-addresses-is-o…
cameroncaci Oct 23, 2024
d900991
Merge branch 'main' into B-21362-MAIN
traskowskycaci Oct 23, 2024
21cd8c8
Merge pull request #13985 from transcom/B-21362-MAIN
deandreJones Oct 23, 2024
f39352c
Merge branch 'main' into B-20473-Office-user-cancel-move
pambecker Oct 23, 2024
5dd7ce1
Merge branch 'B-20473-Office-user-cancel-move' into B-20473-INT
pambecker Oct 23, 2024
2167646
test case
pambecker Oct 24, 2024
67ef509
undoing changes that I thought help test case issues to pass
pambecker Oct 24, 2024
907df90
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 24, 2024
53b02e3
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 24, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"bytes": "^3.1.2",
"classnames": "^2.5.1",
"connected-react-router": "^6.9.3",
"core-js": "^3.37.1",
"core-js": "^3.38.1",
"customize-cra": "^1.0.0",
"deep-object-diff": "^1.1.9",
"dotenv": "^16.3.1",
Expand Down
24 changes: 16 additions & 8 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/gen/ghcapi/ghcoperations/move/search_moves.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/gen/ghcmessages/p_p_m_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pkg/handlers/authentication/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var TOO = RolePermissions{
"update.closeoutOffice",
"update.MTOPage",
"create.TXOShipment",
"update.cancelMoveFlag",
},
}

Expand Down Expand Up @@ -86,6 +87,7 @@ var ServicesCounselor = RolePermissions{
"update.customer",
"update.closeoutOffice",
"view.closeoutOffice",
"update.cancelMoveFlag",
},
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/services/event/ghc_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ const GhcUpdateMaxBillableWeightAsTIOEndpointKey = "Ghc.UpdateMaxBillableWeightA
// GhcAcknowledgeExcessWeightRiskEndpointKey is the key for the AcknowledgeExcessWeightRisk endpoint in ghc
const GhcAcknowledgeExcessWeightRiskEndpointKey = "Ghc.AcknowledgeExcessWeightRisk"

// GhcMoveCancelerEndpointKey is the key for the moveCanceler endpoint in ghc
const GhcMoveCancelerEndpointKey = "Ghc.MoveCanceler"

// -------------------- ENDPOINT MAP ENTRIES --------------------
var ghcEndpoints = EndpointMapType{
GhcGetCustomerEndpointKey: {
Expand Down Expand Up @@ -285,4 +288,8 @@ var ghcEndpoints = EndpointMapType{
APIName: GhcAPIName,
OperationID: "AcknowledgeExcessWeightRisk",
},
GhcMoveCancelerEndpointKey: {
APIName: GhcAPIName,
OperationID: "moveCanceler",
},
}
6 changes: 2 additions & 4 deletions pkg/services/move/move_canceler.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (f *moveCanceler) CancelMove(appCtx appcontext.AppContext, moveID uuid.UUID

if shipment.PPMShipment != nil {
if shipment.PPMShipment.Status == models.PPMShipmentStatusCloseoutComplete {
return apperror.NewConflictError(move.ID, " cannot cancel move with approved shipment.")
return apperror.NewConflictError(move.ID, " cannot cancel move with a closeout complete shipment.")
pambecker marked this conversation as resolved.
Show resolved Hide resolved
}
var ppmshipment models.PPMShipment
qerr := appCtx.DB().Where("id = ?", shipment.PPMShipment.ID).First(&ppmshipment)
Expand All @@ -55,9 +55,7 @@ func (f *moveCanceler) CancelMove(appCtx appcontext.AppContext, moveID uuid.UUID
} else if err != nil {
return apperror.NewQueryError("PPM Shipment", err, "Failed to update status for ppm shipment")
}
}

if shipment.Status != models.MTOShipmentStatusApproved {
} else if shipment.Status != models.MTOShipmentStatusApproved {
verrs, err := txnAppCtx.DB().ValidateAndUpdate(&shipmentDelta)
if verrs != nil && verrs.HasAny() {
return apperror.NewInvalidInputError(shipment.ID, err, verrs, "Validation errors found while setting shipment status")
Expand Down
45 changes: 45 additions & 0 deletions src/components/ConfirmationModals/CancelMoveConfirmationModal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from '@trussworks/react-uswds';

import Modal, { ModalTitle, ModalClose, ModalActions, connectModal } from 'components/Modal/Modal';

export const CancelMoveConfirmationModal = ({ onClose, onSubmit, moveID, title, content, submitText, closeText }) => (
<Modal>
<ModalClose handleClick={() => onClose()} />
<ModalTitle>
<h3>{title}</h3>
</ModalTitle>
<p>{content}</p>
<ModalActions autofocus="true">
<Button data-focus="true" className="usa-button--destructive" type="submit" onClick={() => onSubmit(moveID)}>
{submitText}
</Button>
<Button className="usa-button--secondary" type="button" onClick={() => onClose()} data-testid="modalBackButton">
{closeText}
</Button>
</ModalActions>
</Modal>
);

CancelMoveConfirmationModal.propTypes = {
onClose: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,

title: PropTypes.string,
content: PropTypes.string,
submitText: PropTypes.string,
closeText: PropTypes.string,
};

CancelMoveConfirmationModal.defaultProps = {
title: 'Are you sure?',
content:
'You’ll lose all the information in this move. If you want it back later, you’ll have to request a new move.',
submitText: 'Cancel move',
closeText: 'Keep move',
};

CancelMoveConfirmationModal.displayName = 'CancelMoveConfirmationModal';

export default connectModal(CancelMoveConfirmationModal);
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';

import CancelMoveConfirmationModal from './CancelMoveConfirmationModal';

export default {
title: 'Components/CancelMoveConfirmationModal',
component: CancelMoveConfirmationModal,
args: {
moveID: '111',
},
argTypes: {
onClose: { action: 'close button clicked' },
onSubmit: { action: 'submit button clicked' },
},
};

const Template = (args) => <CancelMoveConfirmationModal {...args} />;

export const Basic = Template.bind({});

export const WithOverrides = Template.bind({});
WithOverrides.args = {
title: 'This is a sample title',
content: 'Some sample description',
submitText: 'YES!',
closeText: 'NO',
};

const ConnectedTemplate = (args) => <CancelMoveConfirmationModal {...args} />;
export const ConnectedModal = ConnectedTemplate.bind({});
ConnectedModal.args = {
isOpen: true,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';

import { CancelMoveConfirmationModal } from 'components/ConfirmationModals/CancelMoveConfirmationModal';

let onClose;
let onSubmit;
beforeEach(() => {
onClose = jest.fn();
onSubmit = jest.fn();
});

describe('CancelMoveConfirmationModal', () => {
const moveID = '123456';

it('renders the component', async () => {
render(<CancelMoveConfirmationModal onSubmit={onSubmit} onClose={onClose} moveID={moveID} />);

expect(await screen.findByRole('heading', { level: 3, name: 'Are you sure?' })).toBeInTheDocument();
});

it('closes the modal when close icon is clicked', async () => {
render(<CancelMoveConfirmationModal onSubmit={onSubmit} onClose={onClose} shipmentID={moveID} />);

const closeButton = await screen.findByTestId('modalCloseButton');

await userEvent.click(closeButton);

expect(onClose).toHaveBeenCalledTimes(1);
});

it('closes the modal when the keep button is clicked', async () => {
render(<CancelMoveConfirmationModal onSubmit={onSubmit} onClose={onClose} moveID={moveID} />);

const keepButton = await screen.findByRole('button', { name: 'Keep move' });

await userEvent.click(keepButton);

expect(onClose).toHaveBeenCalledTimes(1);
});

it('calls the submit function when cancel button is clicked', async () => {
render(<CancelMoveConfirmationModal onSubmit={onSubmit} onClose={onClose} moveID={moveID} />);

const cancelButton = await screen.findByRole('button', { name: 'Cancel move' });

await userEvent.click(cancelButton);

expect(onSubmit).toHaveBeenCalledWith(moveID);
expect(onSubmit).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const EvaluationReportShipmentDisplay = ({
<label id={`shipment-display-label-${shipmentId}`}>{displayInfo.heading}</label>
</h5>
{displayInfo.isDiversion && <Tag>diversion</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.CANCELED && <Tag className="usa-tag--red">cancelled</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.CANCELED && <Tag className="usa-tag--red">canceled</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.DIVERSION_REQUESTED && <Tag>diversion requested</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.CANCELLATION_REQUESTED && (
<Tag>cancellation requested</Tag>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Office/ShipmentDisplay/ShipmentDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ const ShipmentDisplay = ({
</h3>
<div>
{displayInfo.isDiversion && <Tag>diversion</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.CANCELED && (
<Tag className="usa-tag--red">cancelled</Tag>
{(displayInfo.shipmentStatus === shipmentStatuses.CANCELED ||
displayInfo.status === shipmentStatuses.CANCELED ||
displayInfo.ppmShipment?.status === ppmShipmentStatuses.CANCELED) && (
<Tag className="usa-tag--red">canceled</Tag>
)}
{displayInfo.shipmentStatus === shipmentStatuses.DIVERSION_REQUESTED && <Tag>diversion requested</Tag>}
{displayInfo.shipmentStatus === shipmentStatuses.CANCELLATION_REQUESTED && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
ntsReleaseMissingInfo,
postalOnlyInfo,
diversionInfo,
cancelledInfo,
canceledInfo,
ppmInfo,
ppmInfoApprovedOrExcluded,
ppmInfoRejected,
Expand Down Expand Up @@ -250,11 +250,11 @@ export const DivertedShipment = () => (
</div>
);

export const CancelledShipment = () => (
export const CanceledShipment = () => (
<div style={{ padding: '20px' }}>
<ShipmentDisplay
shipmentId="1"
displayInfo={cancelledInfo}
displayInfo={canceledInfo}
ordersLOA={ordersLOA}
shipmentType={SHIPMENT_OPTIONS.HHG}
isSubmitted
Expand Down Expand Up @@ -533,11 +533,11 @@ export const DivertedShipmentReadOnly = () => (
</div>
);

export const CancelledShipmentReadOnly = () => (
export const CanceledShipmentReadOnly = () => (
<div style={{ padding: '20px' }}>
<ShipmentDisplay
shipmentId="1"
displayInfo={cancelledInfo}
displayInfo={canceledInfo}
ordersLOA={ordersLOA}
shipmentType={SHIPMENT_OPTIONS.HHG}
isSubmitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ntsMissingInfo,
postalOnlyInfo,
diversionInfo,
cancelledInfo,
canceledInfo,
ntsReleaseInfo,
ntsReleaseMissingInfo,
ordersLOA,
Expand Down Expand Up @@ -78,9 +78,9 @@ describe('Shipment Container', () => {
render(<ShipmentDisplay shipmentId="1" displayInfo={diversionInfo} onChange={jest.fn()} isSubmitted={false} />);
expect(screen.getByText('diversion')).toBeInTheDocument();
});
it('renders with cancelled tag', () => {
render(<ShipmentDisplay shipmentId="1" displayInfo={cancelledInfo} onChange={jest.fn()} isSubmitted={false} />);
expect(screen.getByText('cancelled')).toBeInTheDocument();
it('renders with canceled tag', () => {
render(<ShipmentDisplay shipmentId="1" displayInfo={canceledInfo} onChange={jest.fn()} isSubmitted={false} />);
expect(screen.getByText('canceled')).toBeInTheDocument();
});
it('renders a disabled button when move is locked', () => {
render(
Expand Down
Loading