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

Open
wants to merge 51 commits into
base: integrationTesting
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 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
c3cfaf1
wrapped in changes from previous merge
WeatherfordAaron 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
90c28f3
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
WeatherfordAaron Oct 9, 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
b161971
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
WeatherfordAaron Oct 10, 2024
abca4eb
updates to refresh page
pambecker Oct 10, 2024
e4da453
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
WeatherfordAaron Oct 11, 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
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
742f698
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
WeatherfordAaron Oct 17, 2024
4d4b9b9
removed extra code
WeatherfordAaron Oct 17, 2024
2cb6991
re-added the formatForBoatShipment import
WeatherfordAaron Oct 17, 2024
42289dd
added additional testing
WeatherfordAaron Oct 3, 2024
bf109e7
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
WeatherfordAaron Oct 18, 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
efbd5b8
Merge branch 'main' into b20884-MAIN2-fix_prime_weight_tool_tip
JamesHawks224 Oct 18, 2024
3bcb558
Merge branch 'integrationTesting' into B-20473-INT
pambecker Oct 21, 2024
dffc793
Merge branch 'main' into b20884-MAIN2-fix_prime_weight_tool_tip
JamesHawks224 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
9025926
Merge branch 'main' into MAIN-remerge-B20617-SC-TOO-Creating-Mobile-H…
taeJungCaci Oct 22, 2024
bfebbf3
remove comment
taeJungCaci Oct 22, 2024
c0564c6
fixing changes to match IntegrationBranch
taeJungCaci Oct 22, 2024
d702365
Merge pull request #13839 from transcom/MAIN-remerge-B20617-SC-TOO-Cr…
taeJungCaci Oct 22, 2024
1fbf38b
Merge branch 'main' into b20884-MAIN2-fix_prime_weight_tool_tip
taeJungCaci Oct 22, 2024
ff71810
Merge pull request #13958 from transcom/b20884-MAIN2-fix_prime_weight…
taeJungCaci Oct 22, 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
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
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
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
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 @@ -97,8 +97,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 @@ -91,9 +91,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
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const diversionInfo = {
counselorRemarks: 'counselor approved',
};

export const cancelledInfo = {
export const canceledInfo = {
heading: 'HHG',
shipmentId: 'testShipmentId394',
isDiversion: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Office/ShipmentHeading/ShipmentHeading.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ShipmentHeading({ shipmentInfo, handleShowCancellationModal, isMoveLock
<span className={styles.marketCodeIndicator}>{shipmentInfo.marketCode}</span>
{shipmentInfo.shipmentType}
</h2>
{shipmentStatus === shipmentStatuses.CANCELED && <Tag className="usa-tag--red">cancelled</Tag>}
{shipmentStatus === shipmentStatuses.CANCELED && <Tag className="usa-tag--red">canceled</Tag>}
{shipmentInfo.isDiversion && <Tag>diversion</Tag>}
{!shipmentInfo.isDiversion && shipmentStatus === shipmentStatuses.DIVERSION_REQUESTED && (
<Tag>diversion requested</Tag>
Expand Down
Loading