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 21773 main #14373

Merged
merged 27 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
66b1638
bluebark rules
deandreJones Dec 10, 2024
c3f7b41
Merge remote-tracking branch 'origin/main' into B-21773-main
deandreJones Dec 11, 2024
48fd228
add test
deandreJones Dec 11, 2024
fa4e830
add test
deandreJones Dec 16, 2024
3c6ecf3
Merge remote-tracking branch 'origin/main' into B-21773-main
deandreJones Dec 30, 2024
3d0f4bc
hide emplid
deandreJones Dec 11, 2024
85fa79d
updates
deandreJones Dec 13, 2024
03958ad
fix test
deandreJones Dec 13, 2024
f03251b
remove what was removed
deandreJones Dec 13, 2024
a7529c1
add timeout
deandreJones Dec 16, 2024
e0847f1
move to lower
deandreJones Dec 16, 2024
d069b1c
dont be a flake
deandreJones Dec 16, 2024
beaf6f4
add safety type test
deandreJones Dec 16, 2024
28c8181
special moves section
deandreJones Dec 17, 2024
cce3db9
lowercase
deandreJones Dec 17, 2024
fc4e17e
fix capturing the order type in adding orders detail info
deandreJones Dec 21, 2024
3e1e8aa
use contant values
deandreJones Dec 26, 2024
7174bd1
fix test
deandreJones Dec 26, 2024
df5f8fc
caps
deandreJones Jan 2, 2025
b8c9e1f
put back
deandreJones Jan 2, 2025
cea9ade
put test order type back to caps
deandreJones Jan 2, 2025
b57afab
caps on the const
deandreJones Jan 2, 2025
cc69631
no cap on the move details header
deandreJones Jan 2, 2025
f23c0d1
trash basket
deandreJones Jan 2, 2025
70e658e
Merge branch 'main' into B-21773-main
danieljordan-caci Jan 6, 2025
54d6e9d
Merge branch 'main' into B-21773-main
deandreJones Jan 8, 2025
e59da8f
Merge branch 'main' into B-21773-main
deandreJones Jan 9, 2025
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
7 changes: 3 additions & 4 deletions pkg/models/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
41 changes: 41 additions & 0 deletions pkg/models/order_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,3 +485,44 @@ 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(" 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)
})

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)
})
}
11 changes: 9 additions & 2 deletions src/components/Office/AddOrdersForm/AddOrdersForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ import ConnectedFlashMessage from 'containers/FlashMessage/FlashMessage';

let originMeta;
let newDutyMeta = '';
const AddOrdersForm = ({ onSubmit, ordersTypeOptions, initialValues, onBack, isSafetyMoveSelected }) => {
const AddOrdersForm = ({
onSubmit,
ordersTypeOptions,
initialValues,
onBack,
isSafetyMoveSelected,
isBluebarkMoveSelected,
}) => {
const payGradeOptions = dropdownInputOptions(ORDERS_PAY_GRADE_OPTIONS);
const [currentDutyLocation, setCurrentDutyLocation] = useState('');
const [newDutyLocation, setNewDutyLocation] = useState('');
Expand Down Expand Up @@ -122,7 +129,7 @@ const AddOrdersForm = ({ onSubmit, ordersTypeOptions, initialValues, onBack, isS
name="ordersType"
options={ordersTypeOptions}
required
isDisabled={isSafetyMoveSelected}
isDisabled={isSafetyMoveSelected || isBluebarkMoveSelected}
/>
<DatePickerInput name="issueDate" label="Orders date" required />
<DatePickerInput name="reportByDate" label="Report by date" required />
Expand Down
20 changes: 20 additions & 0 deletions src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isSafetyMoveSelected />
</Provider>,
);

expect(screen.getByLabelText('Orders type')).toBeDisabled();
});

it('disables orders type when bluebark move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isBluebarkMoveSelected />
</Provider>,
);
expect(screen.getByLabelText('Orders type')).toBeDisabled();
});
});
13 changes: 11 additions & 2 deletions src/components/Office/OrdersDetailForm/OrdersDetailForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -82,12 +83,20 @@ const OrdersDetailForm = ({
<DropdownInput
name="ordersType"
label="Orders type"
options={formOrdersType === 'SAFETY' ? dropdownInputOptions({ SAFETY: 'Safety' }) : ordersTypeOptions}
options={
formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY_NON_LABEL || formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK
? dropdownInputOptions({ SAFETY: 'Safety', BLUEBARK: 'Bluebark' })
: ordersTypeOptions
}
onChange={(e) => {
setFormOrdersType(e.target.value);
setFieldValue('ordersType', e.target.value);
}}
isDisabled={formIsDisabled || formOrdersType === 'SAFETY'}
isDisabled={
formIsDisabled ||
formOrdersType === SPECIAL_ORDERS_TYPES.SAFETY_NON_LABEL ||
formOrdersType === SPECIAL_ORDERS_TYPES.BLUEBARK
}
/>
{showOrdersTypeDetail && (
<DropdownInput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ describe('OrdersDetailForm', () => {
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
expect(await screen.findByLabelText('Orders type')).toBeDisabled();
});
Expand Down
1 change: 1 addition & 0 deletions src/constants/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const SPECIAL_ORDERS_TYPES = {
WOUNDED_WARRIOR: 'Wounded Warrior',
BLUEBARK: 'BLUEBARK',
SAFETY: 'Safety',
SAFETY_NON_LABEL: 'SAFETY',
};

export const CHECK_SPECIAL_ORDERS_TYPES = (ordersType) => {
Expand Down
67 changes: 61 additions & 6 deletions src/pages/Office/CustomerOnboarding/CreateCustomerForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -96,6 +97,7 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
create_okta_account: '',
cac_user: '',
is_safety_move: 'false',
is_bluebark: 'false',
};

const handleBack = () => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -227,6 +229,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);
Expand Down Expand Up @@ -275,11 +278,34 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
});
}
};
const handleBluebarkChange = (e) => {
if (e.target.value === 'true') {
setIsBluebarkMove(true);
setIsSafetyMove(false);
setShowEmplid(false);
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 (
<Form className={classnames(formStyles.form, styles.form)}>
<h1 className={styles.header}>Create Customer Profile</h1>
<SectionWrapper className={sectionStyles}>
<h3>Customer Affiliation</h3>
<h3>Special Moves</h3>
{isSafetyPrivileged && (
<Fieldset className={styles.trailerOwnershipFieldset}>
<legend className="usa-label">Is this a Safety move?</legend>
Expand Down Expand Up @@ -307,10 +333,39 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
</div>
</Fieldset>
)}
<Fieldset className={styles.trailerOwnershipFieldset}>
<legend className="usa-label">Is this a Bluebark move?</legend>
<div className="grid-row grid-gap">
<Field
as={Radio}
id="isBluebarkYes"
label="Yes"
name="is_bluebark"
value="true"
data-testid="is-bluebark-yes"
onChange={handleBluebarkChange}
checked={values.is_bluebark === 'true'}
/>
<Field
as={Radio}
id="isBluebarkNo"
label="No"
name="is_bluebark"
value="false"
data-testid="is-bluebark-no"
onChange={handleBluebarkChange}
checked={values.is_bluebark === 'false'}
/>
</div>
</Fieldset>
</SectionWrapper>
<SectionWrapper className={sectionStyles}>
<h3>Customer Affiliation</h3>
<DropdownInput
label="Branch of service"
name="affiliation"
id="affiliation"
data-testid="affiliationInput"
required
onChange={(e) => {
handleChange(e);
Expand Down Expand Up @@ -410,8 +465,8 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
required
/>
</SectionWrapper>
{values.is_safety_move !== 'true' && (
<SectionWrapper className={sectionStyles}>
{values.is_safety_move !== 'true' && values.is_bluebark !== 'true' && (
<SectionWrapper className={formStyles.formSection}>
<h3>Okta Account</h3>
<Fieldset className={styles.trailerOwnershipFieldset}>
<legend className="usa-label">Do you want to create an Okta account for this customer?</legend>
Expand All @@ -436,8 +491,8 @@ export const CreateCustomerForm = ({ userPrivileges, setFlashMessage, setCanAddO
</Fieldset>
</SectionWrapper>
)}
{values.is_safety_move !== 'true' && (
<SectionWrapper className={sectionStyles}>
{values.is_safety_move !== 'true' && values.is_bluebark !== 'true' && (
<SectionWrapper className={formStyles.formSection}>
<h3>Non-CAC Users</h3>
<Fieldset className={styles.trailerOwnershipFieldset}>
<legend className="usa-label">Does the customer have a CAC?</legend>
Expand Down
Loading
Loading