diff --git a/pkg/gen/ghcapi/embedded_spec.go b/pkg/gen/ghcapi/embedded_spec.go index 4c615768b70..458c840828f 100644 --- a/pkg/gen/ghcapi/embedded_spec.go +++ b/pkg/gen/ghcapi/embedded_spec.go @@ -3820,8 +3820,8 @@ func init() { "items": { "enum": [ "SUBMITTED", - "APPROVALS REQUESTED", - "APPROVED" + "SERVICE COUNSELING COMPLETED", + "APPROVALS REQUESTED" ], "type": "string" }, @@ -17146,8 +17146,8 @@ func init() { "items": { "enum": [ "SUBMITTED", - "APPROVALS REQUESTED", - "APPROVED" + "SERVICE COUNSELING COMPLETED", + "APPROVALS REQUESTED" ], "type": "string" }, diff --git a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go index 47e3dee71a6..fc3ab67853a 100644 --- a/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go +++ b/pkg/gen/ghcapi/ghcoperations/queues/get_moves_queue_parameters.go @@ -489,7 +489,7 @@ func (o *GetMovesQueueParams) bindStatus(rawData []string, hasKey bool, formats for i, statusIV := range statusIC { statusI := statusIV - if err := validate.EnumCase(fmt.Sprintf("%s.%v", "status", i), "query", statusI, []interface{}{"SUBMITTED", "APPROVALS REQUESTED", "APPROVED"}, true); err != nil { + if err := validate.EnumCase(fmt.Sprintf("%s.%v", "status", i), "query", statusI, []interface{}{"SUBMITTED", "SERVICE COUNSELING COMPLETED", "APPROVALS REQUESTED"}, true); err != nil { return err } diff --git a/pkg/handlers/ghcapi/queues.go b/pkg/handlers/ghcapi/queues.go index a49a2245462..0b2a81d0cb3 100644 --- a/pkg/handlers/ghcapi/queues.go +++ b/pkg/handlers/ghcapi/queues.go @@ -58,6 +58,11 @@ func (h GetMovesQueueHandler) Handle(params queues.GetMovesQueueParams) middlewa OrderType: params.OrderType, } + // When no status filter applied, TOO should only see moves with status of New Move, Service Counseling Completed, or Approvals Requested + if params.Status == nil { + ListOrderParams.Status = []string{string(models.MoveStatusServiceCounselingCompleted), string(models.MoveStatusAPPROVALSREQUESTED), string(models.MoveStatusSUBMITTED)} + } + // Let's set default values for page and perPage if we don't get arguments for them. We'll use 1 for page and 20 // for perPage. if params.Page == nil { diff --git a/pkg/handlers/ghcapi/queues_test.go b/pkg/handlers/ghcapi/queues_test.go index a05f0b3fe5a..84ee35dd18f 100644 --- a/pkg/handlers/ghcapi/queues_test.go +++ b/pkg/handlers/ghcapi/queues_test.go @@ -376,8 +376,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerStatuses() { suite.Equal(ghcmessages.MoveStatus("SUBMITTED"), result.Status) - // let's test for the Move approved status - hhgMove.Status = models.MoveStatusAPPROVED + // let's test for the ServiceCounselingCompleted status + hhgMove.Status = models.MoveStatusServiceCounselingCompleted _, _ = suite.DB().ValidateAndSave(&hhgMove) // Validate incoming payload: no body to validate @@ -392,7 +392,7 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerStatuses() { result = payload.QueueMoves[0] - suite.Equal(ghcmessages.MoveStatus("APPROVED"), result.Status) + suite.Equal(ghcmessages.MoveStatus("SERVICE COUNSELING COMPLETED"), result.Status) // Now let's test Approvals requested hhgMove.Status = models.MoveStatusAPPROVALSREQUESTED @@ -463,11 +463,11 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() { }, }, nil) - // Move approved + // Service Counseling Completed Move factory.BuildMTOShipment(suite.DB(), []factory.Customization{ { Model: models.Move{ - Status: models.MoveStatusAPPROVED, + Status: models.MoveStatusServiceCounselingCompleted, }, }, { @@ -515,8 +515,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() { HTTPRequest: request, Status: []string{ string(models.MoveStatusSUBMITTED), - string(models.MoveStatusAPPROVED), string(models.MoveStatusAPPROVALSREQUESTED), + string(models.MoveStatusServiceCounselingCompleted), }, } @@ -540,8 +540,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() { HTTPRequest: request, Status: []string{ string(models.MoveStatusSUBMITTED), - string(models.MoveStatusAPPROVED), string(models.MoveStatusAPPROVALSREQUESTED), + string(models.MoveStatusServiceCounselingCompleted), }, PerPage: models.Int64Pointer(1), Page: models.Int64Pointer(1), @@ -604,7 +604,7 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() { for _, move := range moves { actualStatuses = append(actualStatuses, string(move.Status)) } - expectedStatuses := [3]string{"SUBMITTED", "APPROVED", "APPROVALS REQUESTED"} + expectedStatuses := [3]string{"SUBMITTED", "APPROVALS REQUESTED", "SERVICE COUNSELING COMPLETED"} suite.EqualValues(3, payload.TotalCount) suite.Len(payload.QueueMoves, 3) diff --git a/pkg/services/move/move_searcher.go b/pkg/services/move/move_searcher.go index 6dd994b8cc7..724902cb967 100644 --- a/pkg/services/move/move_searcher.go +++ b/pkg/services/move/move_searcher.go @@ -156,16 +156,9 @@ func destinationPostalCodeFilter(postalCode *string) QueryOption { func moveStatusFilter(statuses []string) QueryOption { return func(query *pop.Query) { + // If we have statuses let's use them if len(statuses) > 0 { - var translatedStatuses []string - for _, status := range statuses { - if strings.EqualFold(status, string(models.MoveStatusSUBMITTED)) { - translatedStatuses = append(translatedStatuses, string(models.MoveStatusSUBMITTED), string(models.MoveStatusServiceCounselingCompleted)) - } else { - translatedStatuses = append(translatedStatuses, status) - } - } - query.Where("moves.status in (?)", translatedStatuses) + query.Where("moves.status IN (?)", statuses) } } } diff --git a/pkg/services/order/order_fetcher.go b/pkg/services/order/order_fetcher.go index 890cfa6d257..81f0cec6f25 100644 --- a/pkg/services/order/order_fetcher.go +++ b/pkg/services/order/order_fetcher.go @@ -371,19 +371,7 @@ func moveStatusFilter(statuses []string) QueryOption { return func(query *pop.Query) { // If we have statuses let's use them if len(statuses) > 0 { - var translatedStatuses []string - for _, status := range statuses { - if strings.EqualFold(status, string(models.MoveStatusSUBMITTED)) { - translatedStatuses = append(translatedStatuses, string(models.MoveStatusSUBMITTED), string(models.MoveStatusServiceCounselingCompleted)) - } else { - translatedStatuses = append(translatedStatuses, status) - } - } - query.Where("moves.status IN (?)", translatedStatuses) - } - // The TOO should never see moves that are in the following statuses: Draft, Canceled, Needs Service Counseling - if len(statuses) <= 0 { - query.Where("moves.status NOT IN (?)", models.MoveStatusDRAFT, models.MoveStatusCANCELED, models.MoveStatusNeedsServiceCounseling) + query.Where("moves.status IN (?)", statuses) } } } diff --git a/pkg/services/order/order_fetcher_test.go b/pkg/services/order/order_fetcher_test.go index 16cbb5cea9a..4c4e1bc83d2 100644 --- a/pkg/services/order/order_fetcher_test.go +++ b/pkg/services/order/order_fetcher_test.go @@ -1828,7 +1828,7 @@ func (suite *OrderServiceSuite) TestListOrdersForTOOWithPPMWithDeletedShipment() move := factory.BuildMove(suite.DB(), []factory.Customization{ { Model: models.Move{ - Status: models.MoveStatusAPPROVED, + Status: models.MoveStatusSUBMITTED, }, }, }, nil) @@ -1867,7 +1867,7 @@ func (suite *OrderServiceSuite) TestListOrdersForTOOWithPPMWithDeletedShipment() } orderFetcher := NewOrderFetcher() - moves, moveCount, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), tooOfficeUser.ID, &services.ListOrderParams{}) + moves, moveCount, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), tooOfficeUser.ID, &services.ListOrderParams{Status: []string{string(models.MoveStatusSUBMITTED)}}) suite.FatalNoError(err) suite.Equal(0, moveCount) suite.Len(moves, 0) diff --git a/pkg/testdatagen/testharness/make_move.go b/pkg/testdatagen/testharness/make_move.go index 3fa39d1a104..7b853faf409 100644 --- a/pkg/testdatagen/testharness/make_move.go +++ b/pkg/testdatagen/testharness/make_move.go @@ -4473,7 +4473,7 @@ func MakeHHGMoveInSIT(appCtx appcontext.AppContext) models.Move { }, { Model: models.Move{ - Status: models.MoveStatusAPPROVED, + Status: models.MoveStatusAPPROVALSREQUESTED, AvailableToPrimeAt: &now, }, }, @@ -4739,7 +4739,7 @@ func MakeHHGMoveInSITWithPendingExtension(appCtx appcontext.AppContext) models.M }, { Model: models.Move{ - Status: models.MoveStatusAPPROVED, + Status: models.MoveStatusAPPROVALSREQUESTED, AvailableToPrimeAt: &now, }, }, @@ -5124,7 +5124,7 @@ func MakeHHGMoveInSITEndsToday(appCtx appcontext.AppContext) models.Move { }, { Model: models.Move{ - Status: models.MoveStatusAPPROVED, + Status: models.MoveStatusAPPROVALSREQUESTED, AvailableToPrimeAt: &now, }, }, diff --git a/playwright/tests/office/txo/tooFlows.spec.js b/playwright/tests/office/txo/tooFlows.spec.js index 3e7ae7f4b41..9bb0e41dc10 100644 --- a/playwright/tests/office/txo/tooFlows.spec.js +++ b/playwright/tests/office/txo/tooFlows.spec.js @@ -748,7 +748,8 @@ test.describe('TOO user', () => { await page.locator('input[name="locator"]').type(shipmentAddressUpdate.Shipment.MoveTaskOrder.locator); await page.locator('input[name="locator"]').blur(); - await expect(page.getByText('Move approved')).toBeVisible(); + // once the move is in the Move approved status, it will no longer show up in the TOO queue + await expect(page.getByText('Move approved')).not.toBeVisible(); await expect(page.getByText('Approvals requested')).not.toBeVisible(); }); }); diff --git a/playwright/tests/office/txo/tooFlowsNTS.spec.js b/playwright/tests/office/txo/tooFlowsNTS.spec.js index 6d4db9b71b5..38d0e34fe9a 100644 --- a/playwright/tests/office/txo/tooFlowsNTS.spec.js +++ b/playwright/tests/office/txo/tooFlowsNTS.spec.js @@ -9,6 +9,9 @@ import { test, expect } from '../../utils/office/officeTest'; import { TooFlowPage } from './tooTestFixture'; +const TOOTabsTitles = ['Move Queue', 'Search']; +const SearchRBSelection = ['Move Code', 'DOD ID', 'Customer Name']; + test.describe('TOO user', () => { /** @type {TooFlowPage} */ let tooFlowPage; @@ -170,19 +173,33 @@ test.describe('TOO user', () => { }); test.describe('with approved HHG + NTS Move', () => { + let move; + test.beforeEach(async ({ officePage }) => { - const move = await officePage.testHarness.buildHHGMoveWithApprovedNTSShipmentsForTOO(); + move = await officePage.testHarness.buildHHGMoveWithApprovedNTSShipmentsForTOO(); await officePage.signInAsNewTOOUser(); tooFlowPage = new TooFlowPage(officePage, move); - await officePage.tooNavigateToMove(move.locator); + + const searchTab = officePage.page.getByTitle(TOOTabsTitles[1]); + await searchTab.click(); }); test('TOO can view and edit Domestic NTS Shipments handled by the Prime on the MTO page', async ({ page }) => { // This test is almost exactly a duplicate of the test in // tooFlowsNTSR. + const selectedRadio = page.getByRole('group').locator(`label:text("${SearchRBSelection[0]}")`); + await selectedRadio.click(); + await page.getByTestId('searchText').type(move.locator); + await page.getByTestId('searchTextSubmit').click(); + + await expect(page.getByText('Results (1)')).toBeVisible(); + await expect(page.getByTestId('locator-0')).toContainText(move.locator); + + // await page.getByTestId('MoveTaskOrder-Tab').click(); + await page.getByTestId('locator-0').click(); + await page.getByTestId('MoveTaskOrder-Tab').click(); await tooFlowPage.waitForLoading(); - await expect( page.locator('[id="move-weights"] div').getByText('1 shipment not moved by GHC prime.'), ).not.toBeVisible(); diff --git a/playwright/tests/office/txo/tooFlowsNTSR.spec.js b/playwright/tests/office/txo/tooFlowsNTSR.spec.js index a01c5e73e83..d31126cb8fc 100644 --- a/playwright/tests/office/txo/tooFlowsNTSR.spec.js +++ b/playwright/tests/office/txo/tooFlowsNTSR.spec.js @@ -9,6 +9,9 @@ import { test, expect } from '../../utils/office/officeTest'; import { TooFlowPage } from './tooTestFixture'; +const TOOTabsTitles = ['Move Queue', 'Search']; +const SearchRBSelection = ['Move Code', 'DOD ID', 'Customer Name']; + test.describe('TOO user', () => { /** @type {TooFlowPage} */ let tooFlowPage; @@ -190,16 +193,32 @@ test.describe('TOO user', () => { }); test.describe('with approved HHG + NTSR Move', () => { + let move; + test.beforeEach(async ({ officePage }) => { - const move = await officePage.testHarness.buildHHGMoveWithApprovedNTSRShipmentsForTOO(); + move = await officePage.testHarness.buildHHGMoveWithApprovedNTSRShipmentsForTOO(); await officePage.signInAsNewTOOUser(); tooFlowPage = new TooFlowPage(officePage, move); - await officePage.tooNavigateToMove(move.locator); + + const searchTab = officePage.page.getByTitle(TOOTabsTitles[1]); + await searchTab.click(); }); test('TOO can view and edit Domestic NTS-R Shipments handled by the Prime on the MTO page', async ({ page }) => { // This test is almost exactly a duplicate of the test in // tooFlowsNTS. + + const selectedRadio = page.getByRole('group').locator(`label:text("${SearchRBSelection[0]}")`); + await selectedRadio.click(); + await page.getByTestId('searchText').type(move.locator); + await page.getByTestId('searchTextSubmit').click(); + + await expect(page.getByText('Results (1)')).toBeVisible(); + await expect(page.getByTestId('locator-0')).toContainText(move.locator); + + // await page.getByTestId('MoveTaskOrder-Tab').click(); + await page.getByTestId('locator-0').click(); + await page.getByTestId('MoveTaskOrder-Tab').click(); await tooFlowPage.waitForLoading(); diff --git a/src/constants/queues.js b/src/constants/queues.js index 2d6c3abcf8d..494138cdd26 100644 --- a/src/constants/queues.js +++ b/src/constants/queues.js @@ -6,8 +6,8 @@ import MOVE_STATUSES from 'constants/moves'; export const MOVE_STATUS_OPTIONS = [ { value: MOVE_STATUSES.SUBMITTED, label: 'New move' }, + { value: MOVE_STATUSES.SERVICE_COUNSELING_COMPLETED, label: 'Service Counseling Completed' }, { value: MOVE_STATUSES.APPROVALS_REQUESTED, label: 'Approvals requested' }, - { value: MOVE_STATUSES.APPROVED, label: 'Move approved' }, ]; // Both moves that progressed straight from customer submission to the TOO diff --git a/swagger-def/ghc.yaml b/swagger-def/ghc.yaml index 85c867a56d7..09019939ef2 100644 --- a/swagger-def/ghc.yaml +++ b/swagger-def/ghc.yaml @@ -3207,8 +3207,8 @@ paths: type: string enum: - SUBMITTED + - SERVICE COUNSELING COMPLETED - APPROVALS REQUESTED - - APPROVED - in: query name: orderType type: string @@ -3583,15 +3583,15 @@ paths: required: true description: Parameter Name responses: - "200": + '200': description: Application Parameters schema: - $ref: "#/definitions/ApplicationParameters" - "400": + $ref: '#/definitions/ApplicationParameters' + '400': description: invalid request - "401": + '401': description: request requires user authentication - "500": + '500': description: server error definitions: ApplicationParameters: diff --git a/swagger/ghc.yaml b/swagger/ghc.yaml index 1aff3095838..bac9f532a9b 100644 --- a/swagger/ghc.yaml +++ b/swagger/ghc.yaml @@ -3337,8 +3337,8 @@ paths: type: string enum: - SUBMITTED + - SERVICE COUNSELING COMPLETED - APPROVALS REQUESTED - - APPROVED - in: query name: orderType type: string