Skip to content

Commit

Permalink
Merge branch 'main' into B-20043
Browse files Browse the repository at this point in the history
  • Loading branch information
loganwc authored Jun 10, 2024
2 parents 331664f + 5d36987 commit de3caaf
Show file tree
Hide file tree
Showing 22 changed files with 243 additions and 47 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
github.com/disintegration/imaging v1.6.2
github.com/dustin/go-humanize v1.0.1
github.com/felixge/httpsnoop v1.0.4
github.com/gabriel-vasile/mimetype v1.4.2
github.com/gabriel-vasile/mimetype v1.4.3
github.com/go-chi/chi/v5 v5.0.10
github.com/go-gomail/gomail v0.0.0-20160411212932-81ebce5c23df
github.com/go-logr/zapr v1.3.0
Expand All @@ -36,7 +36,7 @@ require (
github.com/go-openapi/strfmt v0.22.0
github.com/go-openapi/swag v0.23.0
github.com/go-openapi/validate v0.23.0
github.com/go-playground/validator/v10 v10.15.4
github.com/go-playground/validator/v10 v10.21.0
github.com/go-swagger/go-swagger v0.30.5
github.com/gobuffalo/envy v1.10.2
github.com/gobuffalo/fizz v1.14.4
Expand Down Expand Up @@ -210,7 +210,7 @@ require (
github.com/kr/fs v0.1.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/luna-duclos/instrumentedsql v1.1.3 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk=
github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
Expand Down Expand Up @@ -201,8 +201,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.15.4 h1:zMXza4EpOdooxPel5xDqXEdXG5r+WggpvnAKMsalBjs=
github.com/go-playground/validator/v10 v10.15.4/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.21.0 h1:4fZA11ovvtkdgaeev9RGWPgc1uj3H8W+rNYyH/ySBb0=
github.com/go-playground/validator/v10 v10.21.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
Expand Down Expand Up @@ -420,8 +420,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A=
github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y=
github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ=
Expand Down Expand Up @@ -619,7 +619,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
Expand Down
16 changes: 14 additions & 2 deletions pkg/gen/ghcapi/embedded_spec.go

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

2 changes: 1 addition & 1 deletion pkg/gen/ghcmessages/customer.go

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

3 changes: 3 additions & 0 deletions pkg/gen/ghcmessages/m_t_o_service_item.go

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

3 changes: 2 additions & 1 deletion pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ func Customer(customer *models.ServiceMember) *ghcmessages.Customer {
SecondaryTelephone: customer.SecondaryTelephone,
PhoneIsPreferred: swag.BoolValue(customer.PhoneIsPreferred),
EmailIsPreferred: swag.BoolValue(customer.EmailIsPreferred),
CacValidated: swag.BoolValue(&customer.CacValidated),
CacValidated: &customer.CacValidated,
}
return &payload
}
Expand Down Expand Up @@ -1514,6 +1514,7 @@ func MTOServiceItemModel(s *models.MTOServiceItem, storer storage.FileStorer) *g
ConvertToCustomerExpense: *handlers.FmtBool(s.CustomerExpense),
CustomerExpenseReason: handlers.FmtStringPtr(s.CustomerExpenseReason),
SitDeliveryMiles: handlers.FmtIntPtrToInt64(s.SITDeliveryMiles),
EstimatedPrice: handlers.FmtCost(s.PricingEstimate),
StandaloneCrate: s.StandaloneCrate,
}
}
Expand Down
24 changes: 0 additions & 24 deletions src/components/DocumentViewer/Content/Content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,3 @@ DocViewerContent.propTypes = {
};

export default DocViewerContent;

/**
* TODO
*
* - add className prop to file viewer
* - add rotate left/right:
* <Button unstyled>
<RotateLeft />
Rotate left
</Button>
<Button unstyled>
<RotateRight />
Rotate right
</Button>
* - implement pagination for multi-page PDFs & nav render prop:
* <div className={`${styles.docArrows}`}>
<Button unstyled className={`${styles.arrowButton}`}>
<ArrowLeft />
</Button>
<Button unstyled className={`${styles.arrowButton}`}>
<ArrowRight />
</Button>
</div>
*/
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Formik } from 'formik';
import { Field, Formik } from 'formik';
import * as Yup from 'yup';
import PropTypes from 'prop-types';
import { Checkbox, Grid } from '@trussworks/react-uswds';
import { Checkbox, Radio, FormGroup, Grid } from '@trussworks/react-uswds';

import styles from './CustomerContactInfoForm.module.scss';

Expand All @@ -15,6 +15,7 @@ import formStyles from 'styles/form.module.scss';
import WizardNavigation from 'components/Customer/WizardNavigation/WizardNavigation';
import { phoneSchema, requiredAddressSchema } from 'utils/validation';
import { ResidentialAddressShape } from 'types/address';
import Hint from 'components/Hint';

const CustomerContactInfoForm = ({ initialValues, onSubmit, onBack }) => {
const validationSchema = Yup.object().shape({
Expand All @@ -38,14 +39,14 @@ const CustomerContactInfoForm = ({ initialValues, onSubmit, onBack }) => {
.required('Required'), // min 12 includes hyphens
phoneIsPreferred: Yup.boolean(),
emailIsPreferred: Yup.boolean(),
cacUser: Yup.boolean().required('Required'),
});

return (
<Grid row>
<Grid col>
<div className={styles.customerContactForm}>
<Formik initialValues={initialValues} onSubmit={onSubmit} validationSchema={validationSchema} validateOnMount>
{({ isValid, isSubmitting, handleSubmit }) => {
{({ isValid, handleSubmit }) => {
return (
<Form className={formStyles.form}>
<SectionWrapper className={`${formStyles.formSection} ${styles.formSectionHeader}`}>
Expand Down Expand Up @@ -73,10 +74,42 @@ const CustomerContactInfoForm = ({ initialValues, onSubmit, onBack }) => {

<BackupContactInfoFields />
</SectionWrapper>
<SectionWrapper className={`${formStyles.formSection} ${styles.formSectionHeader}`}>
<h3>CAC Validation</h3>
<FormGroup>
<legend className="usa-label">
Is the customer a non-CAC user or do they need to bypass CAC validation?
</legend>
<Hint>
If this is checked yes, then the customer has already validated their CAC or their identity has
been validated by a trusted office user.
</Hint>
<div className="grid-row grid-gap">
<Field
as={Radio}
id="yesCacUser"
label="Yes"
name="cacUser"
value="true"
data-testid="cac-user-yes"
type="radio"
/>
<Field
as={Radio}
id="NonCacUser"
label="No"
name="cacUser"
value="false"
data-testid="cac-user-no"
type="radio"
/>
</div>
</FormGroup>
</SectionWrapper>
<div className={formStyles.formActions}>
<WizardNavigation
editMode
disableNext={!isValid || isSubmitting}
disableNext={!isValid}
onCancelClick={onBack}
onNextClick={handleSubmit}
/>
Expand All @@ -103,6 +136,7 @@ CustomerContactInfoForm.propTypes = {
telephone: PropTypes.string,
email: PropTypes.string,
customerAddress: ResidentialAddressShape,
cacUser: PropTypes.bool,
}).isRequired,
onSubmit: PropTypes.func,
onBack: PropTypes.func,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,39 @@ describe('CustomerContactInfoForm Component', () => {
name: '',
telephone: '',
email: '',
cacUser: true,
};
const testProps = {
initialValues,
onSubmit: jest.fn(),
onBack: jest.fn(),
};

const initialValuesCacValidated = {
firstName: 'joe',
middleName: 'bob',
lastName: 'bob',
suffix: 'jr',
customerTelephone: '855-222-1111',
customerEmail: '[email protected]',
customerAddress: {
streetAddress1: '123 Happy St',
streetAddress2: 'Unit 4',
city: 'Missoula',
state: 'MT',
postalCode: '59802',
},
name: 'joe bob',
telephone: '855-222-1111',
email: '[email protected]',
cacUser: null,
};
const testPropsCacValidated = {
initialValuesCacValidated,
onSubmit: jest.fn(),
onBack: jest.fn(),
};

it('renders the form inputs', async () => {
render(<CustomerContactInfoForm {...testProps} />);

Expand Down Expand Up @@ -63,6 +89,38 @@ describe('CustomerContactInfoForm Component', () => {
expect(screen.getByLabelText('Name')).toBeInstanceOf(HTMLInputElement);
expect(screen.getAllByLabelText('Phone')[1]).toBeInstanceOf(HTMLInputElement);
expect(screen.getAllByLabelText('Email')[1]).toBeInstanceOf(HTMLInputElement);

expect(screen.getByText('CAC Validation')).toBeInstanceOf(HTMLHeadingElement);
expect(
screen.getByText('Is the customer a non-CAC user or do they need to bypass CAC validation?'),
).toBeInTheDocument();
expect(
screen.getByText(
'If this is checked yes, then the customer has already validated their CAC or their identity has been validated by a trusted office user.',
),
).toBeInTheDocument();
expect(screen.getByTestId('cac-user-yes')).toBeInTheDocument();
expect(screen.getByTestId('cac-user-no')).toBeInTheDocument();
});
});

it('does not allow submission without cac_validated value', async () => {
render(<CustomerContactInfoForm {...testPropsCacValidated} />);

await waitFor(() => {
expect(screen.getByText('CAC Validation')).toBeInstanceOf(HTMLHeadingElement);
expect(
screen.getByText('Is the customer a non-CAC user or do they need to bypass CAC validation?'),
).toBeInTheDocument();
expect(
screen.getByText(
'If this is checked yes, then the customer has already validated their CAC or their identity has been validated by a trusted office user.',
),
).toBeInTheDocument();
expect(screen.getByTestId('cac-user-yes')).toBeInTheDocument();
expect(screen.getByTestId('cac-user-no')).toBeInTheDocument();
});
expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Save' })).toBeDisabled();
});
});
20 changes: 19 additions & 1 deletion src/components/Office/ServiceItemDetails/ServiceItemDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { ShipmentShape } from 'types/shipment';
import { SitStatusShape } from 'types/sitStatusShape';
import { formatDateWithUTC } from 'shared/dates';
import { formatCityStateAndPostalCode } from 'utils/shipmentDisplay';
import { formatWeight, convertFromThousandthInchToInch } from 'utils/formatters';
import { formatWeight, convertFromThousandthInchToInch, formatCents, toDollarString } from 'utils/formatters';

function generateDetailText(details, id, className) {
const detailList = Object.keys(details).map((detail) => (
Expand Down Expand Up @@ -453,6 +453,24 @@ const ServiceItemDetails = ({ id, code, details, serviceRequestDocs, shipment, s
);
break;
}
case 'DLH':
case 'DSH':
case 'FSC':
case 'DOP':
case 'DDP':
case 'DPK':
case 'DUPK': {
detailSection = (
<div>
<dl>
{generateDetailText({
'Estimated Price': details.estimatedPrice ? toDollarString(formatCents(details.estimatedPrice)) : '-',
})}
</dl>
</div>
);
break;
}
default:
detailSection = (
<div>
Expand Down
Loading

0 comments on commit de3caaf

Please sign in to comment.