From 66b1638b21414c6a2a429cf40dd3b798d63edec0 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Tue, 10 Dec 2024 15:24:08 +0000 Subject: [PATCH 01/22] bluebark rules --- pkg/models/order.go | 7 +- pkg/models/order_test.go | 28 +++++ .../Office/AddOrdersForm/AddOrdersForm.jsx | 11 +- src/constants/orders.js | 1 - .../CustomerOnboarding/CreateCustomerForm.jsx | 57 ++++++++- .../CreateCustomerForm.test.jsx | 109 +++++++++++++++++- .../ServicesCounselingAddOrders.jsx | 23 +++- 7 files changed, 220 insertions(+), 16 deletions(-) diff --git a/pkg/models/order.go b/pkg/models/order.go index add1e705938..747ce6ac4c2 100644 --- a/pkg/models/order.go +++ b/pkg/models/order.go @@ -342,9 +342,8 @@ func (o *Order) IsCompleteForGBL() bool { } func (o *Order) CanSendEmailWithOrdersType() bool { - if o.OrdersType != "BLUEBARK" && o.OrdersType != "SAFETY" { - return true + if o.OrdersType == internalmessages.OrdersTypeBLUEBARK || o.OrdersType == internalmessages.OrdersTypeSAFETY { + return false } - - return false + return true } diff --git a/pkg/models/order_test.go b/pkg/models/order_test.go index 9e3e84f50f8..4171045ee74 100644 --- a/pkg/models/order_test.go +++ b/pkg/models/order_test.go @@ -485,3 +485,31 @@ func (suite *ModelSuite) TestSaveOrderWithoutPPM() { suite.Equal(location.ID, orderUpdated.NewDutyLocationID, "Wrong order new_duty_location_id") suite.Equal(newPostalCode, order.NewDutyLocation.Address.PostalCode, "Wrong orig postal code") } + +func (suite *ModelSuite) TestOrderCanSendEmailWithOrdersType() { + suite.Run("Non safety or BB orders can send email", func() { + order := factory.BuildOrder(suite.DB(), []factory.Customization{ + { + Model: m.Order{ + OrdersType: internalmessages.OrdersTypePERMANENTCHANGEOFSTATION, + }, + }, + }, nil) + + canSendEmail := order.CanSendEmailWithOrdersType() + suite.True(canSendEmail) + }) + + suite.Run("Safety and BB orders cannot send email", func() { + order := factory.BuildOrder(suite.DB(), []factory.Customization{ + { + Model: m.Order{ + OrdersType: internalmessages.OrdersTypeBLUEBARK, + }, + }, + }, nil) + + canSendEmail := order.CanSendEmailWithOrdersType() + suite.False(canSendEmail) + }) +} diff --git a/src/components/Office/AddOrdersForm/AddOrdersForm.jsx b/src/components/Office/AddOrdersForm/AddOrdersForm.jsx index e8bae9cf10c..66e7eb45f39 100644 --- a/src/components/Office/AddOrdersForm/AddOrdersForm.jsx +++ b/src/components/Office/AddOrdersForm/AddOrdersForm.jsx @@ -13,7 +13,14 @@ import WizardNavigation from 'components/Customer/WizardNavigation/WizardNavigat import Callout from 'components/Callout'; import ConnectedFlashMessage from 'containers/FlashMessage/FlashMessage'; -const AddOrdersForm = ({ onSubmit, ordersTypeOptions, initialValues, onBack, isSafetyMoveSelected }) => { +const AddOrdersForm = ({ + onSubmit, + ordersTypeOptions, + initialValues, + onBack, + isSafetyMoveSelected, + isBluebarkMoveSelected, +}) => { const payGradeOptions = dropdownInputOptions(ORDERS_PAY_GRADE_OPTIONS); const validationSchema = Yup.object().shape({ @@ -47,7 +54,7 @@ const AddOrdersForm = ({ onSubmit, ordersTypeOptions, initialValues, onBack, isS name="ordersType" options={ordersTypeOptions} required - isDisabled={isSafetyMoveSelected} + isDisabled={isSafetyMoveSelected || isBluebarkMoveSelected} /> diff --git a/src/constants/orders.js b/src/constants/orders.js index eda945f3158..15f417cb51f 100644 --- a/src/constants/orders.js +++ b/src/constants/orders.js @@ -22,7 +22,6 @@ export const ORDERS_TYPE_OPTIONS = { RETIREMENT: 'Retirement', SEPARATION: 'Separation', WOUNDED_WARRIOR: 'Wounded Warrior', - BLUEBARK: 'BLUEBARK', TEMPORARY_DUTY: 'Temporary Duty (TDY)', }; diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx index fe1b3480932..d5eaba86190 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx @@ -36,6 +36,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO const [showEmplid, setShowEmplid] = useState(false); const [isSafetyMove, setIsSafetyMove] = useState(false); const [showSafetyMoveHint, setShowSafetyMoveHint] = useState(false); + const [isBluebarkMove, setIsBluebarkMove] = useState(false); const navigate = useNavigate(); const branchOptions = dropdownInputOptions(SERVICE_MEMBER_AGENCY_LABELS); @@ -96,6 +97,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO create_okta_account: '', cac_user: '', is_safety_move: 'false', + is_bluebark: 'false', }; const handleBack = () => { @@ -140,7 +142,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO generatePath(servicesCounselingRoutes.BASE_CUSTOMERS_ORDERS_ADD_PATH, { customerId, }), - { state: { isSafetyMoveSelected: isSafetyMove } }, + { state: { isSafetyMoveSelected: isSafetyMove, isBluebarkMoveSelected: isBluebarkMove } }, ); }) .catch((e) => { @@ -225,6 +227,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO create_okta_account: '', cac_user: 'true', is_safety_move: 'true', + is_bluebark: 'false', }); } else if (value === 'false') { setIsSafetyMove(false); @@ -273,6 +276,28 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO }); } }; + const handleBluebarkChange = (e) => { + if (e.target.value === 'true') { + setIsBluebarkMove(true); + setShowEmplid(true); + setValues({ + ...values, + affiliation: e.target.value, + create_okta_account: 'false', + cac_user: 'false', + is_bluebark: 'true', + is_safety_move: 'false', + }); + } else { + setIsBluebarkMove(false); + setShowEmplid(false); + setValues({ + ...values, + affiliation: e.target.value, + is_bluebark: 'false', + }); + } + }; return (

Create Customer Profile

@@ -305,10 +330,36 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO )} +
+ Is this a Bluebark Move? +
+ + +
+
{ handleChange(e); @@ -485,7 +536,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO required /> - {values.is_safety_move !== 'true' && ( + {values.is_safety_move !== 'true' && values.is_bluebark !== 'true' && (

Okta Account

@@ -511,7 +562,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
)} - {values.is_safety_move !== 'true' && ( + {values.is_safety_move !== 'true' && values.is_bluebark !== 'true' && (

Non-CAC Users

diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index c25d1de5c14..e84697d7bf2 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -73,6 +73,7 @@ const fakePayload = { create_okta_account: 'true', cac_user: 'false', is_safety_move: false, + is_bluebark: 'false', }; const fakeResponse = { @@ -160,6 +161,46 @@ const safetyPayload = { create_okta_account: 'true', cac_user: 'false', is_safety_move: 'true', + is_bluebark: 'false', +}; + +const bluebarkPayload = { + affiliation: 'Army', + edipi: '1234567890', + first_name: 'Shish', + middle_name: 'Ka', + last_name: 'Bob', + suffix: 'Mr.', + telephone: '555-555-5555', + secondary_telephone: '999-867-5309', + personal_email: 'tastyAndDelicious@mail.mil', + phone_is_preferred: true, + email_is_preferred: '', + residential_address: { + streetAddress1: '8711 S Hungry Ave.', + streetAddress2: '', + streetAddress3: '', + city: 'Starving', + state: 'OK', + postalCode: '74133', + }, + backup_mailing_address: { + streetAddress1: '420 S. Munchies Lane', + streetAddress2: '', + streetAddress3: '', + city: 'Mustang', + state: 'KS', + postalCode: '73064', + }, + backup_contact: { + name: 'Silly String', + telephone: '666-666-6666', + email: 'allOverDaPlace@mail.com', + }, + create_okta_account: 'falseQA!`', + cac_user: 'false', + is_safety_move: 'false', + is_bluebark: 'true', }; const mockUserPrivileges = [ @@ -269,6 +310,7 @@ describe('CreateCustomerForm', () => { expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { state: { isSafetyMoveSelected: false, + isBluebarkMoveSelected: false, }, }); }); @@ -345,6 +387,7 @@ describe('CreateCustomerForm', () => { expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { state: { isSafetyMoveSelected: false, + isBluebarkMoveSelected: false, }, }); }); @@ -417,6 +460,7 @@ describe('CreateCustomerForm', () => { expect(saveBtn).toBeInTheDocument(); await userEvent.type(getByTestId('is-safety-move-yes'), safetyPayload.is_safety_move); + await userEvent.type(getByTestId('is-bluebark-no'), safetyPayload.is_bluebark); await user.selectOptions(getByLabelText('Branch of service'), [safetyPayload.affiliation]); await user.type(getByLabelText('First name'), safetyPayload.first_name); @@ -449,6 +493,7 @@ describe('CreateCustomerForm', () => { expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { state: { isSafetyMoveSelected: true, + isBluebarkMoveSelected: false, }, }); }); @@ -471,7 +516,7 @@ describe('CreateCustomerForm', () => { // check the safety move box await userEvent.type(getByTestId('is-safety-move-yes'), safetyPayload.is_safety_move); - + await userEvent.type(getByTestId('is-bluebark-no'), safetyPayload.is_bluebark); expect(await screen.findByTestId('safetyMoveHint')).toBeInTheDocument(); await user.selectOptions(getByLabelText('Branch of service'), ['COAST_GUARD']); @@ -514,6 +559,7 @@ describe('CreateCustomerForm', () => { expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { state: { isSafetyMoveSelected: true, + isBluebarkMoveSelected: false, }, }); }); @@ -585,6 +631,67 @@ describe('CreateCustomerForm', () => { expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { state: { isSafetyMoveSelected: false, + isBluebarkMoveSelected: false, + }, + }); + }); + }, 10000); + + it('disables and populates DODID and EMPLID inputs when bluebark move is selected', async () => { + createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); + isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true)); + + const { getByLabelText, getByTestId, getByRole } = render( + + + , + ); + + const user = userEvent.setup(); + + const bluebark = await screen.findByTestId('is-bluebark-no'); + expect(bluebark).toBeChecked(); + + await user.click(getByTestId('is-bluebark-yes')); + + await user.selectOptions(getByLabelText('Branch of service'), [bluebarkPayload.affiliation]); + + await user.type(getByTestId('edipiInput'), bluebarkPayload.edipi); + // should be able to submit the form + await user.type(getByLabelText('First name'), bluebarkPayload.first_name); + await user.type(getByLabelText('Last name'), bluebarkPayload.last_name); + + await user.type(getByLabelText('Best contact phone'), bluebarkPayload.telephone); + await user.type(getByLabelText('Personal email'), bluebarkPayload.personal_email); + + await user.type(getByTestId('res-add-street1'), bluebarkPayload.residential_address.streetAddress1); + await user.type(getByTestId('res-add-city'), bluebarkPayload.residential_address.city); + await user.selectOptions(getByTestId('res-add-state'), bluebarkPayload.residential_address.state); + await user.type(getByTestId('res-add-zip'), bluebarkPayload.residential_address.postalCode); + + await user.type(getByTestId('backup-add-street1'), bluebarkPayload.backup_mailing_address.streetAddress1); + await user.type(getByTestId('backup-add-city'), bluebarkPayload.backup_mailing_address.city); + await user.selectOptions(getByTestId('backup-add-state'), bluebarkPayload.backup_mailing_address.state); + await user.type(getByTestId('backup-add-zip'), bluebarkPayload.backup_mailing_address.postalCode); + + await user.type(getByLabelText('Name'), bluebarkPayload.backup_contact.name); + await user.type(getByRole('textbox', { name: 'Email' }), bluebarkPayload.backup_contact.email); + await user.type(getByRole('textbox', { name: 'Phone' }), bluebarkPayload.backup_contact.telephone); + + const saveBtn = await screen.findByRole('button', { name: 'Save' }); + expect(saveBtn).toBeInTheDocument(); + + await waitFor(() => { + expect(saveBtn).toBeEnabled(); + }); + await user.click(saveBtn); + + await waitFor(() => { + expect(createCustomerWithOktaOption).toHaveBeenCalled(); + expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { + state: { + isSafetyMoveSelected: false, + isBluebarkMoveSelected: true, }, }); }); diff --git a/src/pages/Office/ServicesCounselingAddOrders/ServicesCounselingAddOrders.jsx b/src/pages/Office/ServicesCounselingAddOrders/ServicesCounselingAddOrders.jsx index af210a35b7e..94e966838c4 100644 --- a/src/pages/Office/ServicesCounselingAddOrders/ServicesCounselingAddOrders.jsx +++ b/src/pages/Office/ServicesCounselingAddOrders/ServicesCounselingAddOrders.jsx @@ -25,6 +25,7 @@ const ServicesCounselingAddOrders = ({ userPrivileges, canAddOrders, setCanAddOr const { customerId } = useParams(); const { state } = useLocation(); const isSafetyMoveSelected = state?.isSafetyMoveSelected; + const isBluebarkMoveSelected = state?.isBluebarkMoveSelected; const navigate = useNavigate(); const [isSafetyMoveFF, setSafetyMoveFF] = useState(false); const [hasSubmitted, setHasSubmitted] = useState(false); @@ -82,13 +83,25 @@ const ServicesCounselingAddOrders = ({ userPrivileges, canAddOrders, setCanAddOr ? userPrivileges?.some((privilege) => privilege.privilegeType === elevatedPrivilegeTypes.SAFETY) : false; - const allowedOrdersTypes = isSafetyPrivileged - ? { ...ORDERS_TYPE_OPTIONS, ...{ SAFETY: 'Safety' } } - : ORDERS_TYPE_OPTIONS; + const allowedOrdersTypes = { + ...ORDERS_TYPE_OPTIONS, + ...(isSafetyPrivileged ? { SAFETY: 'Safety' } : {}), + ...(isBluebarkMoveSelected ? { BLUEBARK: 'BLUEBARK' } : {}), + }; const ordersTypeOptions = dropdownInputOptions(allowedOrdersTypes); + const getInitialOrdersType = () => { + if (isSafetyMoveSelected) { + return 'SAFETY'; + } + if (isBluebarkMoveSelected) { + return 'BLUEBARK'; + } + return ''; + }; + const initialValues = { - ordersType: isSafetyMoveSelected ? 'SAFETY' : '', + ordersType: getInitialOrdersType(), issueDate: '', reportByDate: '', hasDependents: '', @@ -123,13 +136,13 @@ const ServicesCounselingAddOrders = ({ userPrivileges, canAddOrders, setCanAddOr initialValues={initialValues} onBack={handleBack} isSafetyMoveSelected={isSafetyMoveSelected} + isBluebarkMoveSelected={isBluebarkMoveSelected} /> ); }; - const mapStateToProps = (state) => { const canAddOrders = selectCanAddOrders(state); From 48fd228f78cc7873123609751953ec3524b87b88 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Wed, 11 Dec 2024 19:03:10 +0000 Subject: [PATCH 02/22] add test --- .../CreateCustomerForm.test.jsx | 78 ++++++------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index e84697d7bf2..15ec2cc5299 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -165,40 +165,6 @@ const safetyPayload = { }; const bluebarkPayload = { - affiliation: 'Army', - edipi: '1234567890', - first_name: 'Shish', - middle_name: 'Ka', - last_name: 'Bob', - suffix: 'Mr.', - telephone: '555-555-5555', - secondary_telephone: '999-867-5309', - personal_email: 'tastyAndDelicious@mail.mil', - phone_is_preferred: true, - email_is_preferred: '', - residential_address: { - streetAddress1: '8711 S Hungry Ave.', - streetAddress2: '', - streetAddress3: '', - city: 'Starving', - state: 'OK', - postalCode: '74133', - }, - backup_mailing_address: { - streetAddress1: '420 S. Munchies Lane', - streetAddress2: '', - streetAddress3: '', - city: 'Mustang', - state: 'KS', - postalCode: '73064', - }, - backup_contact: { - name: 'Silly String', - telephone: '666-666-6666', - email: 'allOverDaPlace@mail.com', - }, - create_okta_account: 'falseQA!`', - cac_user: 'false', is_safety_move: 'false', is_bluebark: 'true', }; @@ -649,34 +615,36 @@ describe('CreateCustomerForm', () => { const user = userEvent.setup(); - const bluebark = await screen.findByTestId('is-bluebark-no'); - expect(bluebark).toBeChecked(); + const safetyMove = await screen.findByTestId('is-safety-move-no'); + expect(safetyMove).toBeChecked(); - await user.click(getByTestId('is-bluebark-yes')); + // check the safety move box + await userEvent.type(getByTestId('is-safety-move-no'), bluebarkPayload.is_safety_move); + await userEvent.type(getByTestId('is-bluebark-yes'), bluebarkPayload.is_bluebark); - await user.selectOptions(getByLabelText('Branch of service'), [bluebarkPayload.affiliation]); + await user.selectOptions(getByLabelText('Branch of service'), ['ARMY']); + await user.type(getByTestId('edipiInput'), safetyPayload.edipi); - await user.type(getByTestId('edipiInput'), bluebarkPayload.edipi); // should be able to submit the form - await user.type(getByLabelText('First name'), bluebarkPayload.first_name); - await user.type(getByLabelText('Last name'), bluebarkPayload.last_name); + await user.type(getByLabelText('First name'), safetyPayload.first_name); + await user.type(getByLabelText('Last name'), safetyPayload.last_name); - await user.type(getByLabelText('Best contact phone'), bluebarkPayload.telephone); - await user.type(getByLabelText('Personal email'), bluebarkPayload.personal_email); + await user.type(getByLabelText('Best contact phone'), safetyPayload.telephone); + await user.type(getByLabelText('Personal email'), safetyPayload.personal_email); - await user.type(getByTestId('res-add-street1'), bluebarkPayload.residential_address.streetAddress1); - await user.type(getByTestId('res-add-city'), bluebarkPayload.residential_address.city); - await user.selectOptions(getByTestId('res-add-state'), bluebarkPayload.residential_address.state); - await user.type(getByTestId('res-add-zip'), bluebarkPayload.residential_address.postalCode); + await userEvent.type(getByTestId('res-add-street1'), safetyPayload.residential_address.streetAddress1); + await userEvent.type(getByTestId('res-add-city'), safetyPayload.residential_address.city); + await userEvent.selectOptions(getByTestId('res-add-state'), [safetyPayload.residential_address.state]); + await userEvent.type(getByTestId('res-add-zip'), safetyPayload.residential_address.postalCode); - await user.type(getByTestId('backup-add-street1'), bluebarkPayload.backup_mailing_address.streetAddress1); - await user.type(getByTestId('backup-add-city'), bluebarkPayload.backup_mailing_address.city); - await user.selectOptions(getByTestId('backup-add-state'), bluebarkPayload.backup_mailing_address.state); - await user.type(getByTestId('backup-add-zip'), bluebarkPayload.backup_mailing_address.postalCode); + await userEvent.type(getByTestId('backup-add-street1'), safetyPayload.backup_mailing_address.streetAddress1); + await userEvent.type(getByTestId('backup-add-city'), safetyPayload.backup_mailing_address.city); + await userEvent.selectOptions(getByTestId('backup-add-state'), [safetyPayload.backup_mailing_address.state]); + await userEvent.type(getByTestId('backup-add-zip'), safetyPayload.backup_mailing_address.postalCode); - await user.type(getByLabelText('Name'), bluebarkPayload.backup_contact.name); - await user.type(getByRole('textbox', { name: 'Email' }), bluebarkPayload.backup_contact.email); - await user.type(getByRole('textbox', { name: 'Phone' }), bluebarkPayload.backup_contact.telephone); + await userEvent.type(getByLabelText('Name'), safetyPayload.backup_contact.name); + await userEvent.type(getByRole('textbox', { name: 'Email' }), safetyPayload.backup_contact.email); + await userEvent.type(getByRole('textbox', { name: 'Phone' }), safetyPayload.backup_contact.telephone); const saveBtn = await screen.findByRole('button', { name: 'Save' }); expect(saveBtn).toBeInTheDocument(); @@ -684,7 +652,7 @@ describe('CreateCustomerForm', () => { await waitFor(() => { expect(saveBtn).toBeEnabled(); }); - await user.click(saveBtn); + await userEvent.click(saveBtn); await waitFor(() => { expect(createCustomerWithOktaOption).toHaveBeenCalled(); From fa4e8301c6a567d057663171ec37a3ada7b196bd Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 16 Dec 2024 09:32:58 -0600 Subject: [PATCH 03/22] add test --- .../AddOrdersForm/AddOrdersForm.test.jsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx b/src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx index f6c4f04e22f..611331d78a9 100644 --- a/src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx +++ b/src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx @@ -194,3 +194,23 @@ describe('AddOrdersForm - OCONUS and Accompanied Tour Test', () => { }); }); }); +describe('AddOrdersForm - Edge Cases and Additional Scenarios', () => { + it('disables orders type when safety move is selected', async () => { + render( + + + , + ); + + expect(screen.getByLabelText('Orders type')).toBeDisabled(); + }); + + it('disables orders type when bluebark move is selected', async () => { + render( + + + , + ); + expect(screen.getByLabelText('Orders type')).toBeDisabled(); + }); +}); From 3d0f4bcb4fbcbf27e448e42824b5e6c7f0a198b1 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Wed, 11 Dec 2024 22:17:27 +0000 Subject: [PATCH 04/22] hide emplid --- src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx index d51c45122e3..d8351e49f49 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx @@ -281,7 +281,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO const handleBluebarkChange = (e) => { if (e.target.value === 'true') { setIsBluebarkMove(true); - setShowEmplid(true); + setShowEmplid(false); setValues({ ...values, affiliation: e.target.value, From 85fa79d0a40bff75507d564bf437625d207a9a91 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 13 Dec 2024 11:21:34 -0600 Subject: [PATCH 05/22] updates --- .../CustomerOnboarding/CreateCustomerForm.jsx | 1 + .../CreateCustomerForm.test.jsx | 152 +++++++++++++++++- 2 files changed, 151 insertions(+), 2 deletions(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx index d8351e49f49..ed6e6c024da 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx @@ -281,6 +281,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO const handleBluebarkChange = (e) => { if (e.target.value === 'true') { setIsBluebarkMove(true); + setIsSafetyMove(false); setShowEmplid(false); setValues({ ...values, diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index 99e398a005c..adc7c505cb3 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -211,6 +211,11 @@ const safetyPayload = { is_bluebark: 'false', }; +const bluebarkPayload = { + is_safety_move: 'false', + is_bluebark: 'true', +}; + const mockUserPrivileges = [ { createdAt: '0001-01-01T00:00:00.000Z', @@ -615,7 +620,7 @@ describe('CreateCustomerForm', () => { safetyPayload.residential_address.streetAddress1, ); - const locationBox = screen.getAllByRole('combobox'); + const locationBox = screen.getAllByLabelText('Location lookup'); await act(async () => { await userEvent.type(locationBox[1], 'BEVERLY HILLS'); @@ -655,5 +660,148 @@ describe('CreateCustomerForm', () => { }, }); }); - }, 20000); + }, 10000); + + it('submits the form and tests for unsupported state validation', async () => { + createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); + + const { getByLabelText, getByTestId, getByRole } = render( + + + , + ); + + const user = userEvent.setup(); + + const saveBtn = await screen.findByRole('button', { name: 'Save' }); + expect(saveBtn).toBeInTheDocument(); + + await user.selectOptions(getByLabelText('Branch of service'), [fakePayload.affiliation]); + await userEvent.type(getByTestId('edipiInput'), fakePayload.edipi); + + await user.type(getByLabelText('First name'), fakePayload.first_name); + await user.type(getByLabelText('Last name'), fakePayload.last_name); + + await user.type(getByLabelText('Best contact phone'), fakePayload.telephone); + await user.type(getByLabelText('Personal email'), fakePayload.personal_email); + + await userEvent.type(getByTestId('backup-add-street1'), fakePayload.backup_mailing_address.streetAddress1); + await userEvent.type(getByTestId('backup-add-city'), fakePayload.backup_mailing_address.city); + await userEvent.selectOptions(getByTestId('backup-add-state'), [fakePayload.backup_mailing_address.state]); + await userEvent.type(getByTestId('backup-add-zip'), fakePayload.backup_mailing_address.postalCode); + + await userEvent.type(getByLabelText('Name'), fakePayload.backup_contact.name); + await userEvent.type(getByRole('textbox', { name: 'Email' }), fakePayload.backup_contact.email); + await userEvent.type(getByRole('textbox', { name: 'Phone' }), fakePayload.backup_contact.telephone); + + await userEvent.type(getByTestId('create-okta-account-yes'), fakePayload.create_okta_account); + + await userEvent.type(getByTestId('cac-user-no'), fakePayload.cac_user); + + await waitFor(() => { + expect(saveBtn).toBeEnabled(); + }); + + await userEvent.selectOptions(getByTestId('backup-add-state'), 'HI'); + await userEvent.tab(); + + const msg = screen.getByText('Moves to this state are not supported at this time.'); + expect(msg).toBeVisible(); + + await userEvent.selectOptions(getByTestId('backup-add-state'), [fakePayload.residential_address.state]); + await userEvent.tab(); + expect(msg).not.toBeVisible(); + + await waitFor(() => { + expect(saveBtn).toBeEnabled(); + }); + + await userEvent.click(saveBtn); + + await waitFor(() => { + expect(createCustomerWithOktaOption).toHaveBeenCalled(); + expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { + state: { + isSafetyMoveSelected: false, + isBluebarkMoveSelected: false, + }, + }); + }); + }, 10000); + + it('disables okta and non cac user inputs when bluebark move is selected', async () => { + createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); + isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true)); + searchLocationByZipCityState.mockImplementation(mockSearchPickupLocation); + + const { getByLabelText, getByTestId, getByRole } = render( + + + , + ); + + const user = userEvent.setup(); + + const safetyMove = await screen.findByTestId('is-safety-move-no'); + expect(safetyMove).toBeChecked(); + + // check the safety move box + await userEvent.type(getByTestId('is-safety-move-no'), bluebarkPayload.is_safety_move); + await userEvent.type(getByTestId('is-bluebark-yes'), bluebarkPayload.is_bluebark); + + await userEvent.selectOptions(getByLabelText('Branch of service'), ['ARMY']); + await user.type(getByTestId('edipiInput'), safetyPayload.edipi); + + await user.type(getByLabelText('First name'), safetyPayload.first_name); + await user.type(getByLabelText('Last name'), safetyPayload.last_name); + + await user.type(getByLabelText('Best contact phone'), safetyPayload.telephone); + await user.type(getByLabelText('Personal email'), safetyPayload.personal_email); + + await userEvent.type( + getByTestId('residential_address.streetAddress1'), + safetyPayload.residential_address.streetAddress1, + ); + + const locationBox = screen.getAllByRole('combobox'); + + await act(async () => { + await userEvent.type(locationBox[1], 'BEVERLY HILLS'); + const selectedResidentialLocation = await screen.findByText(/90210/); + await userEvent.click(selectedResidentialLocation); + }); + + await userEvent.type( + getByTestId('backup_mailing_address.streetAddress1'), + safetyPayload.backup_mailing_address.streetAddress1, + ); + + await act(async () => { + await userEvent.type(locationBox[1], 'DRYDEN'); + const selectedBackupLocation = await screen.findByText(/04225/); + await userEvent.click(selectedBackupLocation); + }); + + await userEvent.type(getByLabelText('Name'), safetyPayload.backup_contact.name); + await userEvent.type(getByRole('textbox', { name: 'Email' }), safetyPayload.backup_contact.email); + await userEvent.type(getByRole('textbox', { name: 'Phone' }), safetyPayload.backup_contact.telephone); + + const saveBtn = await screen.findByRole('button', { name: 'Save' }); + expect(saveBtn).toBeInTheDocument(); + + await waitFor(() => { + expect(saveBtn).toBeEnabled(); + }); + await userEvent.click(saveBtn); + + await waitFor(() => { + expect(createCustomerWithOktaOption).toHaveBeenCalled(); + expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { + state: { + isSafetyMoveSelected: false, + isBluebarkMoveSelected: true, + }, + }); + }); + }, 10000); }); From 03958adb0b083e0ef26d6348e93689fa412b5b83 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 13 Dec 2024 11:31:06 -0600 Subject: [PATCH 06/22] fix test --- .../CustomerOnboarding/CreateCustomerForm.test.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index adc7c505cb3..27947aacee7 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -620,7 +620,7 @@ describe('CreateCustomerForm', () => { safetyPayload.residential_address.streetAddress1, ); - const locationBox = screen.getAllByLabelText('Location lookup'); + const locationBox = screen.getAllByRole('combobox'); await act(async () => { await userEvent.type(locationBox[1], 'BEVERLY HILLS'); @@ -735,15 +735,15 @@ describe('CreateCustomerForm', () => { searchLocationByZipCityState.mockImplementation(mockSearchPickupLocation); const { getByLabelText, getByTestId, getByRole } = render( - + , ); const user = userEvent.setup(); - const safetyMove = await screen.findByTestId('is-safety-move-no'); - expect(safetyMove).toBeChecked(); + const saveBtn = await screen.findByRole('button', { name: 'Save' }); + expect(saveBtn).toBeInTheDocument(); // check the safety move box await userEvent.type(getByTestId('is-safety-move-no'), bluebarkPayload.is_safety_move); @@ -777,7 +777,7 @@ describe('CreateCustomerForm', () => { ); await act(async () => { - await userEvent.type(locationBox[1], 'DRYDEN'); + await userEvent.type(locationBox[2], 'DRYDEN'); const selectedBackupLocation = await screen.findByText(/04225/); await userEvent.click(selectedBackupLocation); }); @@ -786,7 +786,6 @@ describe('CreateCustomerForm', () => { await userEvent.type(getByRole('textbox', { name: 'Email' }), safetyPayload.backup_contact.email); await userEvent.type(getByRole('textbox', { name: 'Phone' }), safetyPayload.backup_contact.telephone); - const saveBtn = await screen.findByRole('button', { name: 'Save' }); expect(saveBtn).toBeInTheDocument(); await waitFor(() => { From f03251b2a3170a4ba7d191893f11661188073658 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Fri, 13 Dec 2024 11:39:17 -0600 Subject: [PATCH 07/22] remove what was removed --- .../CreateCustomerForm.test.jsx | 67 ------------------- 1 file changed, 67 deletions(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index 27947aacee7..efa59c88f0b 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -662,73 +662,6 @@ describe('CreateCustomerForm', () => { }); }, 10000); - it('submits the form and tests for unsupported state validation', async () => { - createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); - - const { getByLabelText, getByTestId, getByRole } = render( - - - , - ); - - const user = userEvent.setup(); - - const saveBtn = await screen.findByRole('button', { name: 'Save' }); - expect(saveBtn).toBeInTheDocument(); - - await user.selectOptions(getByLabelText('Branch of service'), [fakePayload.affiliation]); - await userEvent.type(getByTestId('edipiInput'), fakePayload.edipi); - - await user.type(getByLabelText('First name'), fakePayload.first_name); - await user.type(getByLabelText('Last name'), fakePayload.last_name); - - await user.type(getByLabelText('Best contact phone'), fakePayload.telephone); - await user.type(getByLabelText('Personal email'), fakePayload.personal_email); - - await userEvent.type(getByTestId('backup-add-street1'), fakePayload.backup_mailing_address.streetAddress1); - await userEvent.type(getByTestId('backup-add-city'), fakePayload.backup_mailing_address.city); - await userEvent.selectOptions(getByTestId('backup-add-state'), [fakePayload.backup_mailing_address.state]); - await userEvent.type(getByTestId('backup-add-zip'), fakePayload.backup_mailing_address.postalCode); - - await userEvent.type(getByLabelText('Name'), fakePayload.backup_contact.name); - await userEvent.type(getByRole('textbox', { name: 'Email' }), fakePayload.backup_contact.email); - await userEvent.type(getByRole('textbox', { name: 'Phone' }), fakePayload.backup_contact.telephone); - - await userEvent.type(getByTestId('create-okta-account-yes'), fakePayload.create_okta_account); - - await userEvent.type(getByTestId('cac-user-no'), fakePayload.cac_user); - - await waitFor(() => { - expect(saveBtn).toBeEnabled(); - }); - - await userEvent.selectOptions(getByTestId('backup-add-state'), 'HI'); - await userEvent.tab(); - - const msg = screen.getByText('Moves to this state are not supported at this time.'); - expect(msg).toBeVisible(); - - await userEvent.selectOptions(getByTestId('backup-add-state'), [fakePayload.residential_address.state]); - await userEvent.tab(); - expect(msg).not.toBeVisible(); - - await waitFor(() => { - expect(saveBtn).toBeEnabled(); - }); - - await userEvent.click(saveBtn); - - await waitFor(() => { - expect(createCustomerWithOktaOption).toHaveBeenCalled(); - expect(mockNavigate).toHaveBeenCalledWith(ordersPath, { - state: { - isSafetyMoveSelected: false, - isBluebarkMoveSelected: false, - }, - }); - }); - }, 10000); - it('disables okta and non cac user inputs when bluebark move is selected', async () => { createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true)); From a7529c1476a412fa16367db7d5620549a09efe87 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 16 Dec 2024 14:42:08 -0600 Subject: [PATCH 08/22] add timeout --- src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index efa59c88f0b..3636608f467 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -31,6 +31,7 @@ const mockPickupLocation = [ const mockSearchPickupLocation = () => Promise.resolve(mockPickupLocation); +jest.setTimeout(60000); const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), From e0847f17b0216bd336321dcaf3c949603dde0bd5 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 16 Dec 2024 15:38:07 -0600 Subject: [PATCH 09/22] move to lower --- src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index 3636608f467..876cb97962a 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -31,7 +31,6 @@ const mockPickupLocation = [ const mockSearchPickupLocation = () => Promise.resolve(mockPickupLocation); -jest.setTimeout(60000); const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -59,6 +58,7 @@ jest.mock('store/general/actions', () => ({ beforeEach(() => { jest.clearAllMocks(); + jest.setTimeout(60000); }); const serviceCounselorState = { From d069b1cf66c8064a80697dc6710b0ca9b70e4c97 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 16 Dec 2024 15:44:35 -0600 Subject: [PATCH 10/22] dont be a flake --- .../Office/CustomerOnboarding/CreateCustomerForm.test.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx index 876cb97962a..b49f6aea696 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.test.jsx @@ -58,7 +58,6 @@ jest.mock('store/general/actions', () => ({ beforeEach(() => { jest.clearAllMocks(); - jest.setTimeout(60000); }); const serviceCounselorState = { @@ -661,7 +660,7 @@ describe('CreateCustomerForm', () => { }, }); }); - }, 10000); + }, 50000); it('disables okta and non cac user inputs when bluebark move is selected', async () => { createCustomerWithOktaOption.mockImplementation(() => Promise.resolve(fakeResponse)); @@ -736,5 +735,5 @@ describe('CreateCustomerForm', () => { }, }); }); - }, 10000); + }, 50000); }); From beaf6f43e684cc32dce247b7ac25b6ca12538bda Mon Sep 17 00:00:00 2001 From: deandreJones Date: Mon, 16 Dec 2024 16:10:09 -0600 Subject: [PATCH 11/22] add safety type test --- pkg/models/order_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkg/models/order_test.go b/pkg/models/order_test.go index 4171045ee74..6ef09fe7598 100644 --- a/pkg/models/order_test.go +++ b/pkg/models/order_test.go @@ -500,7 +500,7 @@ func (suite *ModelSuite) TestOrderCanSendEmailWithOrdersType() { suite.True(canSendEmail) }) - suite.Run("Safety and BB orders cannot send email", func() { + suite.Run(" BB orders cannot send email", func() { order := factory.BuildOrder(suite.DB(), []factory.Customization{ { Model: m.Order{ @@ -512,4 +512,17 @@ func (suite *ModelSuite) TestOrderCanSendEmailWithOrdersType() { canSendEmail := order.CanSendEmailWithOrdersType() suite.False(canSendEmail) }) + + suite.Run("Safety orders cannot send email", func() { + order := factory.BuildOrder(suite.DB(), []factory.Customization{ + { + Model: m.Order{ + OrdersType: internalmessages.OrdersTypeSAFETY, + }, + }, + }, nil) + + canSendEmail := order.CanSendEmailWithOrdersType() + suite.False(canSendEmail) + }) } From 28c8181691791b42968e8be0ea7c9d5a25d1e24d Mon Sep 17 00:00:00 2001 From: deandreJones Date: Tue, 17 Dec 2024 09:13:09 -0600 Subject: [PATCH 12/22] special moves section --- src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx index ed6e6c024da..fbe210ce4e1 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx @@ -305,7 +305,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO

Create Customer Profile

-

Customer Affiliation

+

Special Moves

{isSafetyPrivileged && (
Is this a Safety move? @@ -358,6 +358,9 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO />
+
+ +

Customer Affiliation

Date: Tue, 17 Dec 2024 09:19:39 -0600 Subject: [PATCH 13/22] lowercase --- src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx index fbe210ce4e1..6b4bd9830cb 100644 --- a/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx +++ b/src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx @@ -334,7 +334,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
)}
- Is this a Bluebark Move? + Is this a Bluebark move?
Date: Sat, 21 Dec 2024 02:21:59 +0000 Subject: [PATCH 14/22] fix capturing the order type in adding orders detail info --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index b24ff3ae670..1c6897583b2 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -82,12 +82,16 @@ const OrdersDetailForm = ({ { setFormOrdersType(e.target.value); setFieldValue('ordersType', e.target.value); }} - isDisabled={formIsDisabled || formOrdersType === 'SAFETY'} + isDisabled={formIsDisabled || formOrdersType === 'SAFETY' || formOrdersType === 'BLUEBARK'} /> {showOrdersTypeDetail && ( Date: Thu, 26 Dec 2024 15:57:53 +0000 Subject: [PATCH 15/22] use contant values --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index 1c6897583b2..046c4ae9169 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -8,6 +8,7 @@ import { CheckboxField, DropdownInput, DatePickerInput, DutyLocationInput } from import TextField from 'components/form/fields/TextField/TextField'; import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; import { DropdownArrayOf } from 'types/form'; +import { SPECIAL_ORDERS_TYPES } from 'constants/orders'; const OrdersDetailForm = ({ deptIndicatorOptions, @@ -83,7 +84,7 @@ const OrdersDetailForm = ({ name="ordersType" label="Orders type" options={ - formOrdersType === 'SAFETY' || formOrdersType === 'BLUEBARK' + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK ? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' }) : ordersTypeOptions } @@ -91,7 +92,11 @@ const OrdersDetailForm = ({ setFormOrdersType(e.target.value); setFieldValue('ordersType', e.target.value); }} - isDisabled={formIsDisabled || formOrdersType === 'SAFETY' || formOrdersType === 'BLUEBARK'} + isDisabled={ + formIsDisabled || + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || + formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + } /> {showOrdersTypeDetail && ( Date: Thu, 26 Dec 2024 16:29:51 +0000 Subject: [PATCH 16/22] fix test --- .../OrdersDetailForm/OrdersDetailForm.test.jsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx index 37ec69d7645..37861c8b881 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx @@ -196,7 +196,23 @@ describe('OrdersDetailForm', () => { showNTSTac: false, showNTSSac: false, showOrdersAcknowledgement: false, - ordersType: 'SAFETY', + ordersType: 'Safety', + }); + + // correct labels are visible + expect(await screen.findByLabelText('Orders type')).toBeDisabled(); + }); + it('has orders type dropdown disabled if bluebark move', async () => { + renderOrdersDetailForm({ + showDepartmentIndicator: false, + showOrdersNumber: false, + showOrdersTypeDetail: false, + showHHGTac: false, + showHHGSac: false, + showNTSTac: false, + showNTSSac: false, + showOrdersAcknowledgement: false, + ordersType: 'BLUEBARK', }); // correct labels are visible From df5f8fc073e13933cc095127e4b20ba3df0efa5a Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 2 Jan 2025 13:08:22 -0600 Subject: [PATCH 17/22] caps --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index 046c4ae9169..e83bf2afcfb 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -84,7 +84,7 @@ const OrdersDetailForm = ({ name="ordersType" label="Orders type" options={ - formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + formOrdersType === 'SAFETY' || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK ? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' }) : ordersTypeOptions } @@ -92,11 +92,7 @@ const OrdersDetailForm = ({ setFormOrdersType(e.target.value); setFieldValue('ordersType', e.target.value); }} - isDisabled={ - formIsDisabled || - formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || - formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK - } + isDisabled={formIsDisabled || formOrdersType === 'SAFETY' || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK} /> {showOrdersTypeDetail && ( Date: Thu, 2 Jan 2025 13:38:52 -0600 Subject: [PATCH 18/22] put back --- src/constants/orders.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/orders.js b/src/constants/orders.js index 93e20b804c8..eb74a318b38 100644 --- a/src/constants/orders.js +++ b/src/constants/orders.js @@ -24,6 +24,7 @@ export const ORDERS_TYPE_OPTIONS = { RETIREMENT: 'Retirement', SEPARATION: 'Separation', WOUNDED_WARRIOR: 'Wounded Warrior', + BLUEBARK: 'BLUEBARK', TEMPORARY_DUTY: 'Temporary Duty (TDY)', EARLY_RETURN_OF_DEPENDENTS: 'Early Return of Dependents', STUDENT_TRAVEL: 'Student Travel', From cea9ade6f31d8f145ee301d34724754341850ea0 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 2 Jan 2025 13:55:30 -0600 Subject: [PATCH 19/22] put test order type back to caps --- .../Office/OrdersDetailForm/OrdersDetailForm.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx index 37861c8b881..59c860e300f 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.test.jsx @@ -196,7 +196,7 @@ describe('OrdersDetailForm', () => { showNTSTac: false, showNTSSac: false, showOrdersAcknowledgement: false, - ordersType: 'Safety', + ordersType: 'SAFETY', }); // correct labels are visible From b57afab09bbb175d3c269d280d7214075cfa5519 Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 2 Jan 2025 14:43:53 -0600 Subject: [PATCH 20/22] caps on the const --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 8 ++++++-- src/constants/orders.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index e83bf2afcfb..046c4ae9169 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -84,7 +84,7 @@ const OrdersDetailForm = ({ name="ordersType" label="Orders type" options={ - formOrdersType === 'SAFETY' || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK ? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' }) : ordersTypeOptions } @@ -92,7 +92,11 @@ const OrdersDetailForm = ({ setFormOrdersType(e.target.value); setFieldValue('ordersType', e.target.value); }} - isDisabled={formIsDisabled || formOrdersType === 'SAFETY' || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK} + isDisabled={ + formIsDisabled || + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || + formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + } /> {showOrdersTypeDetail && ( { From cc69631197162e8ac58f11ca83122a5ffb27007e Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 2 Jan 2025 14:55:00 -0600 Subject: [PATCH 21/22] no cap on the move details header --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 9 +++++---- src/constants/orders.js | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index 046c4ae9169..df282179f60 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -8,7 +8,7 @@ import { CheckboxField, DropdownInput, DatePickerInput, DutyLocationInput } from import TextField from 'components/form/fields/TextField/TextField'; import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; import { DropdownArrayOf } from 'types/form'; -import { SPECIAL_ORDERS_TYPES } from 'constants/orders'; +import { SPECIAL_ORDERS_TYPES_NON_LABEL } from 'constants/orders'; const OrdersDetailForm = ({ deptIndicatorOptions, @@ -84,7 +84,8 @@ const OrdersDetailForm = ({ name="ordersType" label="Orders type" options={ - formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.SAFETY || + formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.BLUEBARK ? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' }) : ordersTypeOptions } @@ -94,8 +95,8 @@ const OrdersDetailForm = ({ }} isDisabled={ formIsDisabled || - formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY || - formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK + formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.SAFETY || + formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.BLUEBARK } /> {showOrdersTypeDetail && ( diff --git a/src/constants/orders.js b/src/constants/orders.js index 56781f96b86..4f7b9dccd13 100644 --- a/src/constants/orders.js +++ b/src/constants/orders.js @@ -9,6 +9,12 @@ export const ORDERS_TYPE = { }; export const SPECIAL_ORDERS_TYPES = { + WOUNDED_WARRIOR: 'Wounded Warrior', + BLUEBARK: 'Bluebark', + SAFETY: 'Safety', +}; + +export const SPECIAL_ORDERS_TYPES_NON_LABEL = { WOUNDED_WARRIOR: 'Wounded Warrior', BLUEBARK: 'BLUEBARK', SAFETY: 'SAFETY', From f23c0d112831c781760e67291fc9a935a54baf9c Mon Sep 17 00:00:00 2001 From: deandreJones Date: Thu, 2 Jan 2025 15:03:38 -0600 Subject: [PATCH 22/22] trash basket --- .../Office/OrdersDetailForm/OrdersDetailForm.jsx | 9 ++++----- src/constants/orders.js | 9 ++------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx index df282179f60..26028b4ea69 100644 --- a/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx +++ b/src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx @@ -8,7 +8,7 @@ import { CheckboxField, DropdownInput, DatePickerInput, DutyLocationInput } from import TextField from 'components/form/fields/TextField/TextField'; import MaskedTextField from 'components/form/fields/MaskedTextField/MaskedTextField'; import { DropdownArrayOf } from 'types/form'; -import { SPECIAL_ORDERS_TYPES_NON_LABEL } from 'constants/orders'; +import { SPECIAL_ORDERS_TYPES } from 'constants/orders'; const OrdersDetailForm = ({ deptIndicatorOptions, @@ -84,8 +84,7 @@ const OrdersDetailForm = ({ name="ordersType" label="Orders type" options={ - formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.SAFETY || - formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.BLUEBARK + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY_NON_LABEL || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK ? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' }) : ordersTypeOptions } @@ -95,8 +94,8 @@ const OrdersDetailForm = ({ }} isDisabled={ formIsDisabled || - formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.SAFETY || - formOrdersType === SPECIAL_ORDERS_TYPES_NON_LABEL.BLUEBARK + formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY_NON_LABEL || + formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK } /> {showOrdersTypeDetail && ( diff --git a/src/constants/orders.js b/src/constants/orders.js index 4f7b9dccd13..7eeb4ab9e73 100644 --- a/src/constants/orders.js +++ b/src/constants/orders.js @@ -9,15 +9,10 @@ export const ORDERS_TYPE = { }; export const SPECIAL_ORDERS_TYPES = { - WOUNDED_WARRIOR: 'Wounded Warrior', - BLUEBARK: 'Bluebark', - SAFETY: 'Safety', -}; - -export const SPECIAL_ORDERS_TYPES_NON_LABEL = { WOUNDED_WARRIOR: 'Wounded Warrior', BLUEBARK: 'BLUEBARK', - SAFETY: 'SAFETY', + SAFETY: 'Safety', + SAFETY_NON_LABEL: 'SAFETY', }; export const CHECK_SPECIAL_ORDERS_TYPES = (ordersType) => {