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-18314 (merge after B-18313) #12040

Merged
merged 8 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 pkg/gen/internalapi/embedded_spec.go

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

17 changes: 17 additions & 0 deletions pkg/gen/internalmessages/internal_move.go

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

1 change: 1 addition & 0 deletions pkg/handlers/internalapi/moves.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func payloadForInternalMove(storer storage.FileStorer, list models.Moves) []*int
CreatedAt: *handlers.FmtDateTime(move.CreatedAt),
ETag: eTag,
ID: *handlers.FmtUUID(move.ID),
Status: string(move.Status),
MtoShipments: *payloadShipments,
MoveCode: move.Locator,
Orders: move.Orders,
Expand Down
1 change: 1 addition & 0 deletions pkg/models/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ func FetchMovesByOrderID(db *pop.Connection, orderID uuid.UUID) (Moves, error) {
"Orders.UploadedOrders",
"Orders.ServiceMember",
"Orders.ServiceMember.User",
"Orders.OriginDutyLocation.Address",
"Orders.OriginDutyLocation.TransportationOffice",
"Orders.OriginDutyLocation.TransportationOffice.Address",
"Orders.NewDutyLocation.Address",
Expand Down
95 changes: 33 additions & 62 deletions src/pages/MyMove/Multi-Moves/MultiMovesLandingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ import { connect } from 'react-redux';
import styles from './MultiMovesLandingPage.module.scss';
import MultiMovesMoveHeader from './MultiMovesMoveHeader/MultiMovesMoveHeader';
import MultiMovesMoveContainer from './MultiMovesMoveContainer/MultiMovesMoveContainer';
import {
mockMovesPCS,
mockMovesSeparation,
mockMovesRetirement,
mockMovesNoPreviousMoves,
mockMovesNoCurrentMoveWithPreviousMoves,
mockMovesNoCurrentOrPreviousMoves,
} from './MultiMovesTestData';

import { detectFlags } from 'utils/featureFlags';
import { generatePageTitle } from 'hooks/custom';
Expand All @@ -28,57 +20,19 @@ import { customerRoutes } from 'constants/routes';
import { withContext } from 'shared/AppContext';
import withRouter from 'utils/routing';
import requireCustomerState from 'containers/requireCustomerState/requireCustomerState';
import {
selectCurrentMove,
selectIsProfileComplete,
selectServiceMemberFromLoggedInUser,
} from 'store/entities/selectors';
import { selectAllMoves, selectIsProfileComplete, selectServiceMemberFromLoggedInUser } from 'store/entities/selectors';

const MultiMovesLandingPage = () => {
const MultiMovesLandingPage = ({ serviceMember, serviceMemberMoves }) => {
const [setErrorState] = useState({ hasError: false, error: undefined, info: undefined });
const navigate = useNavigate();

// ! This is just used for testing and viewing different variations of data that MilMove will use
// user can add params of ?moveData=PCS, etc to view different views
let moves;
const currentUrl = new URL(window.location.href);
const moveDataSource = currentUrl.searchParams.get('moveData');
switch (moveDataSource) {
case 'PCS':
moves = mockMovesPCS;
break;
case 'retirement':
moves = mockMovesRetirement;
break;
case 'separation':
moves = mockMovesSeparation;
break;
case 'noPreviousMoves':
moves = mockMovesNoPreviousMoves;
break;
case 'noCurrentMove':
moves = mockMovesNoCurrentMoveWithPreviousMoves;
break;
case 'noMoves':
moves = mockMovesNoCurrentOrPreviousMoves;
break;
default:
moves = mockMovesPCS;
break;
}
// ! end of test data
useEffect(() => {
const fetchData = async () => {
try {
loadInternalSchema();
loadUser();
initOnboarding();
document.title = generatePageTitle('MilMove');

const script = document.createElement('script');
script.src = '//rum-static.pingdom.net/pa-6567b05deff3250012000426.js';
script.async = true;
document.body.appendChild(script);
} catch (error) {
const { message } = error;
milmoveLogger.error({ message, info: null });
Expand All @@ -100,7 +54,7 @@ const MultiMovesLandingPage = () => {
// if they have previous moves, they'll need to validate their profile
// if they do not have previous moves, then they don't need to validate
const handleCreateMoveBtnClick = () => {
if (moves.previousMoves.length > 0) {
if (serviceMemberMoves && serviceMemberMoves.previousMoves && serviceMemberMoves.previousMoves.length !== 0) {
const profileEditPath = customerRoutes.PROFILE_PATH;
navigate(profileEditPath, { state: { needsToVerifyProfile: true } });
} else {
Expand All @@ -114,16 +68,33 @@ const MultiMovesLandingPage = () => {
<div className={styles.homeContainer}>
<header data-testid="customerHeader" className={styles.customerHeader}>
<div className={`usa-prose grid-container ${styles['grid-container']}`}>
<h2>First Last</h2>
<h2>
{serviceMember.first_name} {serviceMember.last_name}
</h2>
</div>
</header>
<div className={`usa-prose grid-container ${styles['grid-container']}`}>
<Helper title="Welcome to MilMove!" className={styles['helper-paragraph-only']}>
<p data-testid="welcomeHeader">
We can put information at the top here - potentially important contact info or basic instructions on how
to start a move?
</p>
</Helper>
{serviceMemberMoves && serviceMemberMoves.previousMoves && serviceMemberMoves.previousMoves.length === 0 ? (
<Helper title="Welcome to MilMove!" className={styles['helper-paragraph-only']}>
<p data-testid="welcomeHeader">
Select &quot;Create a Move&quot; to get started. <br />
<br />
If you encounter any issues please contact your local Transportation Office or the Help Desk for further
assistance.
</p>
</Helper>
) : (
<Helper title="Welcome to MilMove!" className={styles['helper-paragraph-only']}>
<p data-testid="welcomeHeader">
Select &quot;Create a Move&quot; to get started. <br />
<br />
Once you have validated your profile, pleasee click the &quot;Validate&quot; button and proceed to
starting your move. <br />
If you encounter any issues please contact your local Transportation Office or the Help Desk for further
assistance.
</p>
</Helper>
)}
<div className={styles.centeredContainer}>
<Button className={styles.createMoveBtn} onClick={handleCreateMoveBtnClick} data-testid="createMoveBtn">
<span>Create a Move</span>
Expand All @@ -133,13 +104,13 @@ const MultiMovesLandingPage = () => {
</Button>
</div>
<div className={styles.movesContainer}>
{moves.currentMove.length > 0 ? (
{serviceMemberMoves && serviceMemberMoves.currentMove && serviceMemberMoves.currentMove.length !== 0 ? (
<>
<div data-testid="currentMoveHeader">
<MultiMovesMoveHeader title="Current Move" />
</div>
<div data-testid="currentMoveContainer">
<MultiMovesMoveContainer moves={moves.currentMove} />
<MultiMovesMoveContainer moves={serviceMemberMoves.currentMove} />
</div>
</>
) : (
Expand All @@ -150,13 +121,13 @@ const MultiMovesLandingPage = () => {
<div>You do not have a current move.</div>
</>
)}
{moves.previousMoves.length > 0 ? (
{serviceMemberMoves && serviceMemberMoves.previousMoves && serviceMemberMoves.previousMoves.length !== 0 ? (
<>
<div data-testid="prevMovesHeader">
<MultiMovesMoveHeader title="Previous Moves" />
</div>
<div data-testid="prevMovesContainer">
<MultiMovesMoveContainer moves={moves.previousMoves} />
<MultiMovesMoveContainer moves={serviceMemberMoves.previousMoves} />
</div>
</>
) : (
Expand All @@ -180,12 +151,12 @@ MultiMovesLandingPage.defaultProps = {

const mapStateToProps = (state) => {
const serviceMember = selectServiceMemberFromLoggedInUser(state);
const move = selectCurrentMove(state) || {};
const serviceMemberMoves = selectAllMoves(state);

return {
isProfileComplete: selectIsProfileComplete(state),
serviceMember,
move,
serviceMemberMoves,
};
};

Expand Down
Loading
Loading