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 21983 MAIN - Display Counseling Office in Move Details (Review After B-21977) #14736

Merged
merged 17 commits into from
Feb 14, 2025
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
18 changes: 18 additions & 0 deletions pkg/gen/ghcapi/embedded_spec.go

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

71 changes: 71 additions & 0 deletions pkg/gen/ghcmessages/move.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/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func Move(move *models.Move, storer storage.FileStorer) (*ghcmessages.Move, erro
SCAssignedUser: AssignedOfficeUser(move.SCAssignedUser),
TOOAssignedUser: AssignedOfficeUser(move.TOOAssignedUser),
TIOAssignedUser: AssignedOfficeUser(move.TIOAssignedUser),
CounselingOfficeID: handlers.FmtUUIDPtr(move.CounselingOfficeID),
CounselingOffice: TransportationOffice(move.CounselingOffice),
}

return payload, nil
Expand Down
1 change: 0 additions & 1 deletion pkg/handlers/ghcapi/transportation_offices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ func (suite *HandlerSuite) TestShowCounselingOfficesHandler() {
},
},
}, nil)
suite.MustSave(&origDutyLocation)

path := fmt.Sprintf("/transportation_offices/%v/counseling_offices/%v", origDutyLocation.ID.String(), serviceMember.ID.String())
req := httptest.NewRequest("GET", path, nil)
Expand Down
1 change: 0 additions & 1 deletion pkg/handlers/internalapi/transportation_offices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ func (suite *HandlerSuite) TestShowCounselingOfficesHandler() {
},
},
}, nil)
suite.MustSave(&origDutyLocation)

path := fmt.Sprintf("/transportation_offices/%v/counseling_offices", origDutyLocation.ID.String())
req := httptest.NewRequest("GET", path, nil)
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/move/move_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (f moveFetcher) FetchMove(appCtx appcontext.AppContext, locator string, sea
move := &models.Move{}
query := appCtx.DB().
EagerPreload("CloseoutOffice.Address", "Contractor", "ShipmentGBLOC", "LockedByOfficeUser", "LockedByOfficeUser.TransportationOffice", "AdditionalDocuments",
"AdditionalDocuments.UserUploads").
"AdditionalDocuments.UserUploads", "CounselingOffice").
LeftJoin("move_to_gbloc", "move_to_gbloc.move_id = moves.id").
LeftJoin("office_users", "office_users.id = moves.locked_by").
Where("locator = $1", locator)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ describe('AddOrdersForm - With Counseling Office', () => {
);

await userEvent.selectOptions(await screen.findByLabelText(/Orders type/), 'PERMANENT_CHANGE_OF_STATION');
await userEvent.type(screen.getByLabelText(/Orders date/), '08 Nov 2020');
await userEvent.type(screen.getByLabelText(/Report by date/), '26 Nov 2020');
await userEvent.paste(screen.getByLabelText(/Orders date/), '08 Nov 2020');
await userEvent.paste(screen.getByLabelText(/Report by date/), '26 Nov 2020');
await userEvent.click(screen.getByLabelText('No'));
await userEvent.selectOptions(screen.getByLabelText(/Pay grade/), ['E_5']);

Expand Down
11 changes: 9 additions & 2 deletions src/components/Office/DefinitionLists/OrdersList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
ordersTypeDetailReadable,
} from 'utils/formatters';

const OrdersList = ({ ordersInfo, showMissingWarnings }) => {
const OrdersList = ({ ordersInfo, moveInfo, showMissingWarnings }) => {
const { ordersType } = ordersInfo;
const isRetiree = ordersType === 'RETIREMENT';
const isSeparatee = ordersType === 'SEPARATION';
Expand Down Expand Up @@ -57,6 +57,12 @@ const OrdersList = ({ ordersInfo, showMissingWarnings }) => {
<dt>Current duty location</dt>
<dd data-testid="currentDutyLocation">{ordersInfo.currentDutyLocation?.name}</dd>
</div>
<div className={descriptionListStyles.row}>
<dt>Counseling office</dt>
<dd data-testid="counselingOffice">
{moveInfo?.counselingOffice?.name ? moveInfo.counselingOffice.name : '—'}
</dd>
</div>
<div
className={classnames(descriptionListStyles.row, {
[styles.missingInfoError]: !ordersInfo.newDutyLocation?.name,
Expand All @@ -66,7 +72,7 @@ const OrdersList = ({ ordersInfo, showMissingWarnings }) => {
{isRetiree || isSeparatee ? 'HOR, HOS, or PLEAD' : 'New duty location'}
</dt>
<dd data-testid="newDutyLocation">
{ordersInfo.newDutyLocation?.name ? ordersInfo.newDutyLocation?.name : '-'}
{ordersInfo.newDutyLocation?.name ? ordersInfo.newDutyLocation?.name : ''}
</dd>
</div>
<div
Expand Down Expand Up @@ -135,6 +141,7 @@ OrdersList.defaultProps = {

OrdersList.propTypes = {
ordersInfo: OrdersInfoShape.isRequired,
moveInfo: PropTypes.object.isRequired,
showMissingWarnings: PropTypes.bool,
};

Expand Down
18 changes: 18 additions & 0 deletions src/components/Office/DefinitionLists/OrdersList.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const Basic = () => (
NTStac: text('ordersInfo.NTStac', '9999'),
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
Expand Down Expand Up @@ -81,6 +84,9 @@ export const AsServiceCounselor = () => (
NTStac: '',
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
Expand All @@ -105,6 +111,9 @@ export const AsServiceCounselorProcessingRetirement = () => (
NTStac: '',
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
Expand All @@ -129,6 +138,9 @@ export const AsServiceCounselorProcessingSeparation = () => (
NTStac: '',
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
Expand Down Expand Up @@ -166,6 +178,9 @@ export const AsTOO = () => (
NTStac: '',
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
Expand Down Expand Up @@ -212,6 +227,9 @@ export const AsTOOProcessingSeparation = () => (
NTStac: '',
payGrade: text('ordersInfo.payGrade', 'E_5'),
}}
moveInfo={{
name: 'PPPO Los Angeles SFB - USAF',
}}
/>
</div>
);
9 changes: 8 additions & 1 deletion src/components/Office/DefinitionLists/OrdersList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ const ordersInfo = {
payGrade: 'E_7',
};

const moveInfo = {
counselingOffice: {
name: 'PPPO Los Angeles SFB - USAF',
},
};

// what ordersInfo from above should be rendered as
const expectedRenderedOrdersInfo = {
currentDutyLocation: 'JBSA Lackland',
counselingOffice: 'PPPO Los Angeles SFB - USAF',
newDutyLocation: 'JB Lewis-McChord',
issuedDate: '08 Mar 2020',
reportByDate: '01 Apr 2020',
Expand Down Expand Up @@ -65,7 +72,7 @@ const ordersInfoMissing = {

describe('OrdersList', () => {
it('renders formatted orders info', () => {
render(<OrdersList ordersInfo={ordersInfo} />);
render(<OrdersList ordersInfo={ordersInfo} moveInfo={moveInfo} />);
Object.keys(expectedRenderedOrdersInfo).forEach((key) => {
expect(screen.getByText(expectedRenderedOrdersInfo[key])).toBeInTheDocument();
});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Office/MoveDetails/MoveDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ const MoveDetails = ({
}
shipmentsInfoNonPpm={shipmentsInfoNonPPM}
>
<OrdersList ordersInfo={ordersInfo} />
<OrdersList ordersInfo={ordersInfo} moveInfo={move} />
</DetailsPanel>
</div>
<div className={styles.section} id="allowances">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ const ServicesCounselingMoveDetails = ({
}
ppmShipmentInfoNeedsApproval={ppmShipmentsInfoNeedsApproval}
>
<OrdersList ordersInfo={ordersInfo} />
<OrdersList ordersInfo={ordersInfo} moveInfo={move} />
</DetailsPanel>
</div>
<div className={styles.section} id="allowances">
Expand Down
7 changes: 7 additions & 0 deletions swagger-def/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5344,6 +5344,13 @@ definitions:
format: uuid
description: The transportation office that will handle reviewing PPM Closeout documentation for Army and Air Force service members
x-nullable: true
counselingOffice:
$ref: 'definitions/TransportationOffice.yaml'
counselingOfficeId:
type: string
format: uuid
description: The transportation office that will handle services counseling for this move
x-nullable: true
approvalsRequestedAt:
type: string
format: date-time
Expand Down
9 changes: 9 additions & 0 deletions swagger/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5574,6 +5574,15 @@ definitions:
The transportation office that will handle reviewing PPM Closeout
documentation for Army and Air Force service members
x-nullable: true
counselingOffice:
$ref: '#/definitions/TransportationOffice'
counselingOfficeId:
type: string
format: uuid
description: >-
The transportation office that will handle services counseling for
this move
x-nullable: true
approvalsRequestedAt:
type: string
format: date-time
Expand Down
Loading