@nerdjs/sales-kit 2.0.77 → 2.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/hooks/load/loadDetailsStatus.js +2 -4
  2. package/dist/hooks/load/loadDetailsStatus.js.map +1 -1
  3. package/dist/hooks/load/loadLastLocation.js +2 -3
  4. package/dist/hooks/load/loadLastLocation.js.map +1 -1
  5. package/dist/hooks/load/loadsSearchInput.js +1 -1
  6. package/dist/hooks/load/loadsSearchInput.js.map +1 -1
  7. package/dist/hooks/locationsForm/locationsForm.js +30 -19
  8. package/dist/hooks/locationsForm/locationsForm.js.map +1 -1
  9. package/dist/hooks/locationsForm/locationsFormSales.js +101 -101
  10. package/dist/hooks/locationsForm/locationsFormSales.js.map +1 -1
  11. package/dist/hooks/quote/constants.d.ts +4 -4
  12. package/dist/hooks/quote/constants.js +12 -5
  13. package/dist/hooks/quote/constants.js.map +1 -1
  14. package/dist/hooks/quote/form.js +192 -160
  15. package/dist/hooks/quote/form.js.map +1 -1
  16. package/dist/hooks/quote/helpers.d.ts +1 -2
  17. package/dist/hooks/quote/helpers.js +82 -69
  18. package/dist/hooks/quote/helpers.js.map +1 -1
  19. package/dist/hooks/quote/result.js +132 -131
  20. package/dist/hooks/quote/result.js.map +1 -1
  21. package/dist/hooks/quote/template.js +21 -22
  22. package/dist/hooks/quote/template.js.map +1 -1
  23. package/dist/hooks/statusStepper/statusStepper.js +6 -6
  24. package/dist/hooks/statusStepper/statusStepper.js.map +1 -1
  25. package/dist/hooks/tender/form.js +67 -33
  26. package/dist/hooks/tender/form.js.map +1 -1
  27. package/dist/hooks/tender/helpers.js +42 -40
  28. package/dist/hooks/tender/helpers.js.map +1 -1
  29. package/dist/hooks/tender/template.js +21 -1
  30. package/dist/hooks/tender/template.js.map +1 -1
  31. package/dist/redux/quote/quoteEndpoints.js +2 -1
  32. package/dist/redux/quote/quoteEndpoints.js.map +1 -1
  33. package/dist/redux/quote/quoteReducer.js +4 -2
  34. package/dist/redux/quote/quoteReducer.js.map +1 -1
  35. package/package.json +5 -5
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Checkbox, FormControl, FormLabel, Input, Alert, Button, IconButton, Typography as JoyTypography, Option, Select, Sheet, Tab, TabList, Tabs, useColorScheme, CircularProgress, } from "@mui/joy";
3
- import { Backdrop, Box, Dialog, DialogActions, DialogContent, DialogTitle, Divider, FormHelperText, Grid, Paper, Tooltip, Typography, useMediaQuery, useTheme, } from "@mui/material";
2
+ import { Checkbox, FormControl, FormLabel, Input, Alert, Button, IconButton, Typography, Option, Select, Sheet, Tab, TabList, Tabs, useColorScheme, CircularProgress, Tooltip, Grid, Divider, Box, Modal, ModalDialog, DialogActions, DialogContent, DialogTitle, FormHelperText, } from "@mui/joy";
4
3
  import { DataGridPremium, useGridApiRef, } from "@mui/x-data-grid-premium";
5
4
  import { NerdDatePicker } from "@nerdjs/nerd-ui";
6
5
  import { DateTime } from "luxon";
@@ -35,29 +34,40 @@ export function QuoteForm(props) {
35
34
  const { customerPortal, quoteRoute, perPalletClass } = props;
36
35
  const { t } = useTranslation("salesKit");
37
36
  const errors = useSelector(quoteErrorsSelector);
38
- const theme = useTheme();
39
37
  const result = useSelector(quoteResultSelector);
40
- const sm = useMediaQuery(theme.breakpoints.down(600));
41
38
  const dispatch = useDispatch();
42
39
  const running = useSelector(quoteRunningSelector);
43
- return (_jsx(_Fragment, { children: _jsxs(Box, { sx: { flex: 1, height: "100%", overflowY: "auto" }, children: [_jsx(Toolbar, { quoteRoute: quoteRoute }), _jsx(Typography, { pl: 2, display: "inline", color: "red", children: "*" }), " ", _jsx(Typography, { display: "inline", variant: "body2", children: t("requiredField") }), _jsxs(Box, { sx: {
40
+ return (_jsx(_Fragment, { children: _jsxs(Box, { sx: {
41
+ flex: 1,
42
+ height: "100%",
43
+ overflowY: !running ? "auto" : "hidden",
44
+ }, children: [_jsx(Toolbar, { quoteRoute: quoteRoute }), _jsx(Typography, { pl: 2, display: "inline", color: "danger", children: "*" }), " ", _jsx(Typography, { display: "inline", level: "body-sm", children: t("requiredField") }), _jsxs(Box, { sx: {
44
45
  display: "flex",
45
46
  flexDirection: "column",
46
47
  gap: 2,
47
48
  p: 2,
48
- }, children: [errors ? (_jsx(Alert, { color: "danger", children: _jsx("ul", { style: { margin: 0 }, children: errors.map((e) => (_jsx("li", { children: e }, e))) }) })) : ([]), running ? (_jsx(_Fragment, { children: _jsx(Backdrop, { open: true, sx: {
49
- zIndex: (theme) => theme.zIndex.modal,
50
- position: "absolute",
51
- top: 49,
52
- }, children: _jsx(CircularProgress, {}) }) })) : null, _jsx(AboutTheLoad, { customerPortal: customerPortal, perPalletClass: perPalletClass }), _jsx(ShipCons, { customerPortal: customerPortal }), sm ? _jsx(FormStop, { customerPortal: customerPortal }) : [], _jsxs(Box, { sx: { textAlign: "center", lineHeight: 0.6 }, children: [_jsx(Typography, { variant: "caption", display: "inline", children: _jsx(Box, { className: "fa-duotone fa-circle-info pright", component: "i", sx: {
53
- color: (theme) => theme.palette.warning.main,
54
- } }) }), _jsxs(Typography, { display: "inline", variant: "caption", sx: { opacity: 0.5 }, children: [t("inaccurateWarning"), _jsx("br", {}), t("selectLocationWarning")] })] })] }), sm && result ? (_jsx(Box, { onClick: () => dispatch(setFormOpen({ formID: "result", isOpen: true })), sx: {
49
+ }, children: [errors ? (_jsx(Alert, { color: "danger", children: _jsx("ul", { style: { margin: 0 }, children: errors.map((e) => (_jsx("li", { children: e }, e))) }) })) : ([]), running ? (_jsx(_Fragment, { children: _jsx(Modal, { disablePortal: true, open: true, sx: {
50
+ zIndex: 200,
51
+ "& .MuiModal-backdrop": {
52
+ mt: "50px",
53
+ },
54
+ display: "flex",
55
+ justifyContent: "center",
56
+ alignItems: "center",
57
+ }, children: _jsx(CircularProgress, { sx: {
58
+ outline: "none",
59
+ } }) }) })) : null, _jsx(AboutTheLoad, { customerPortal: customerPortal, perPalletClass: perPalletClass }), _jsx(ShipCons, { customerPortal: customerPortal }), _jsx(Box, { sx: {
60
+ display: { sm: "initial", md: "none" },
61
+ }, children: _jsx(FormStop, { customerPortal: customerPortal }) }), _jsxs(Box, { sx: { textAlign: "center", lineHeight: 0.6 }, children: [_jsx(Typography, { level: "body-sm", display: "inline", children: _jsx(Box, { className: "fa-duotone fa-circle-info pright", component: "i", sx: {
62
+ color: (theme) => theme.palette.warning[500],
63
+ } }) }), _jsxs(Typography, { display: "inline", level: "body-sm", sx: { opacity: 0.5 }, children: [t("inaccurateWarning"), _jsx("br", {}), t("selectLocationWarning")] })] })] }), result ? (_jsx(Box, { onClick: () => dispatch(setFormOpen({ formID: "result", isOpen: true })), sx: {
55
64
  position: "sticky",
56
65
  bottom: 0,
57
66
  p: 1,
58
67
  backdropFilter: "blur(10px)",
59
68
  borderTop: "solid 1px rgba(155,155,155, 0.3)",
60
69
  background: "rgba(255,255,255,0.4)",
70
+ display: { sm: "block", md: "none" },
61
71
  }, children: _jsx(Button, { color: "danger", fullWidth: true, children: t("viewQuoteResult") }) })) : ([])] }) }));
62
72
  }
63
73
  /**
@@ -148,11 +158,11 @@ function Toolbar(props) {
148
158
  p: 2,
149
159
  pt: shrink ? 1 : 2,
150
160
  pb: shrink ? 1 : 2,
151
- }, children: [_jsx(Typography, { variant: "h4", sx: {
161
+ }, children: [_jsx(Typography, { level: "h4", sx: {
152
162
  fontWeight: 600,
153
163
  fontSize: shrink ? "22px !important" : "36px !important",
154
164
  transition: "font-size .3s ease-in-out",
155
- }, children: t("Form") }), _jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [_jsx(Tooltip, { title: "ctrl+r", children: _jsxs(Button, { size: shrink ? "sm" : "md", onClick: resetQuote, variant: "soft", color: "neutral", children: [_jsx("i", { className: "fa-sharp fa-solid fa-arrows-rotate pright" }), t("restart")] }) }), _jsx(Tooltip, { title: "ctrl+x", children: _jsxs(Button, { variant: "solid", size: shrink ? "sm" : "md", onClick: () => {
165
+ }, children: t("Form") }), _jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [_jsx(Tooltip, { title: "ctrl+r", children: _jsxs(Button, { disabled: running, size: shrink ? "sm" : "md", onClick: resetQuote, variant: "soft", color: "neutral", children: [_jsx("i", { className: "fa-sharp fa-solid fa-arrows-rotate pright" }), t("restart")] }) }), _jsx(Tooltip, { title: "ctrl+x", children: _jsxs(Button, { variant: "solid", size: shrink ? "sm" : "md", onClick: () => {
156
166
  setTimeout(() => runQuote(), 200);
157
167
  }, loading: running, children: [_jsx("i", { className: "fa-duotone fa-play" }), _jsx("span", { style: { paddingLeft: 4 }, children: t("runQuote") })] }) })] })] }) }));
158
168
  }
@@ -174,8 +184,6 @@ function AboutTheLoad({ customerPortal, perPalletClass, }) {
174
184
  const [getCustomer, { data: _customer, isFetching }] = useLazyGetCustomerQuery();
175
185
  const { data: commodities } = useGetQuoteCommodityDescriptionQuery(customerPortal);
176
186
  const [value, setValue] = useState(_customer || null);
177
- const theme = useTheme();
178
- const sm = useMediaQuery(theme.breakpoints.down(600));
179
187
  const _error = error;
180
188
  useEffect(() => {
181
189
  if (palletDimensions?.length) {
@@ -234,49 +242,50 @@ function AboutTheLoad({ customerPortal, perPalletClass, }) {
234
242
  : !TL_TEMPERATURE.test(reeferTemp);
235
243
  // const perPalletWeightDisabled = useSelector(perPalletWeightDisabledSelector);
236
244
  // const totalWeightDisabled = useSelector(totalWeightDisabledSelector);
237
- return (_jsxs(Paper, { sx: { p: 2 }, children: [_jsxs(Typography, { variant: "h6", children: [_jsx("i", { className: "fa-duotone fa-truck-ramp-box pright" }), " ", t("aboutTheLoad")] }), _jsxs(Grid, { container: true, spacing: 2, sx: { pt: 1 }, children: [!customerPortal ? (_jsx(Grid, { item: true, xs: 12, children: _jsx(CustomerAutocomplete, { isLoading: isFetching, value: value, onChange: (v) => {
245
+ return (_jsxs(Sheet, { sx: { p: 2, borderRadius: "sm", boxShadow: "md" }, children: [_jsxs(Typography, { level: "title-lg", children: [_jsx("i", { className: "fa-duotone fa-truck-ramp-box pright" }), " ", t("aboutTheLoad")] }), _jsxs(Grid, { container: true, spacing: 2, sx: { pt: 1 }, children: [!customerPortal ? (_jsx(Grid, { xs: 12, children: _jsx(CustomerAutocomplete, { isLoading: isFetching, value: value, onChange: (v) => {
238
246
  dispatch(setCustomerID(v?.id));
239
247
  setValue(v);
240
- } }) })) : ([]), _jsx(Grid, { item: true, children: _jsx(Tabs, { "aria-label": "Vertical tabs", orientation: "vertical", value: body.service, onChange: (_e, v) => {
248
+ } }) })) : ([]), _jsx(Grid, { children: _jsx(Tabs, { "aria-label": "Vertical tabs", orientation: "vertical", value: body.service, onChange: (_e, v) => {
241
249
  const _v = v;
242
250
  if (_v)
243
251
  s({ service: _v });
244
- }, sx: { borderRadius: "lg" }, children: _jsx(TabList, { children: loadTypeOptions(customerPortal).map((i) => (_jsx(Tab, { value: i, children: _jsx(JoyTypography, { level: "body-sm", startDecorator: icons[i], children: i }) }, i))) }) }) }), _jsx(Grid, { item: true, children: _jsx(Tabs, { "aria-label": "Vertical tabs", orientation: "vertical", value: body.mode, onChange: (_e, v) => {
252
+ }, sx: { borderRadius: "lg" }, children: _jsx(TabList, { children: loadTypeOptions(customerPortal).map((i) => (_jsx(Tab, { value: i, children: _jsx(Typography, { level: "body-sm", startDecorator: icons[i], children: i }) }, i))) }) }) }), _jsx(Grid, { children: _jsx(Tabs, { "aria-label": "Vertical tabs", orientation: "vertical", value: body.mode, onChange: (_e, v) => {
245
253
  const _v = v;
246
254
  if (_v)
247
255
  s({ mode: _v });
248
256
  if (_v === DRY)
249
257
  r({ reeferTemp: undefined });
250
- }, sx: { borderRadius: "lg" }, children: _jsx(TabList, { children: [DRY, REEFER].map((i) => (_jsx(Tab, { value: i, children: _jsx(JoyTypography, { level: "body-sm", startDecorator: icons[i], children: i }) }, i))) }) }) }), body.mode === REEFER ? (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { required: true, children: t("temperature") }), _jsx(Input, { autoFocus: true, value: body.reefer?.reeferTemp ?? "", onChange: (e) => r({ reeferTemp: e.target.value }), error: temperatureError }), _jsx(FormHelperText, { children: body.service === LTL
258
+ }, sx: { borderRadius: "lg" }, children: _jsx(TabList, { children: [DRY, REEFER].map((i) => (_jsx(Tab, { value: i, children: _jsx(Typography, { level: "body-sm", startDecorator: icons[i], children: i }) }, i))) }) }) }), body.mode === REEFER ? (_jsxs(_Fragment, { children: [_jsx(Grid, { xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { required: true, children: t("temperature") }), _jsx(Input, { autoFocus: true, value: body.reefer?.reeferTemp ?? "", onChange: (e) => r({ reeferTemp: e.target.value }), error: temperatureError }), _jsx(FormHelperText, { children: body.service === LTL
251
259
  ? "Between 40℉ and 80℉"
252
- : "Between -20℉ and 80℉" })] }) }), _jsx(Grid, { item: true, xs: 12, md: 4, children: _jsxs(Button, { color: "neutral", sx: { textTransform: "none" }, variant: body.reefer?.reeferCont ? "solid" : "outlined", onClick: () => r({ reeferCont: !(body.reefer?.reeferCont ?? false) }), children: [icons[CONTINUOUS_RUNNING], CONTINUOUS_RUNNING] }) })] })) : (_jsxs(_Fragment, { children: [!customerPortal ? (_jsx(Grid, { item: true, children: _jsx(Button, { startDecorator: _jsx("i", { className: "fa-duotone fa-truck-container-empty" }), color: "neutral", variant: body.emptyLoad ? "solid" : "outlined", onClick: handleEmptyLoadClick, children: t("emptyLoad") }) })) : null, _jsx(Grid, { item: true, children: _jsxs(Button, { sx: { textTransform: "none" }, color: "neutral", variant: body.dryVanOnly ? "solid" : "outlined", onClick: () => s({ dryVanOnly: !(body.dryVanOnly ?? false) }), children: [icons[DRY_VAN_ONLY], DRY_VAN_ONLY] }) })] })), _jsx(Grid, { item: true, xs: 12 }), body.emptyLoad && !customerPortal ? null : (_jsxs(_Fragment, { children: [_jsx(Grid, { item: true, xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { id: "commodity-select-helper-label", children: t("commodityDescription") }), _jsx(Select, { startDecorator: body.commodityDescriptionId &&
260
+ : "Between -20℉ and 80℉" })] }) }), _jsx(Grid, { xs: 12, md: 4, children: _jsxs(Button, { color: "neutral", sx: { textTransform: "none" }, variant: body.reefer?.reeferCont ? "solid" : "outlined", onClick: () => r({ reeferCont: !(body.reefer?.reeferCont ?? false) }), children: [icons[CONTINUOUS_RUNNING], CONTINUOUS_RUNNING] }) })] })) : (_jsxs(_Fragment, { children: [!customerPortal ? (_jsx(Grid, { children: _jsx(Button, { startDecorator: _jsx("i", { className: "fa-duotone fa-truck-container-empty" }), color: "neutral", variant: body.emptyLoad ? "solid" : "outlined", onClick: handleEmptyLoadClick, children: t("emptyLoad") }) })) : null, _jsx(Grid, { children: _jsxs(Button, { sx: { textTransform: "none" }, color: "neutral", variant: body.dryVanOnly ? "solid" : "outlined", onClick: () => s({ dryVanOnly: !(body.dryVanOnly ?? false) }), children: [icons[DRY_VAN_ONLY], DRY_VAN_ONLY] }) })] })), _jsx(Grid, { xs: 12 }), body.emptyLoad && !customerPortal ? null : (_jsxs(_Fragment, { children: [_jsx(Grid, { xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { id: "commodity-select-helper-label", children: t("commodityDescription") }), _jsx(Select, { startDecorator: body.commodityDescriptionId &&
253
261
  icons[body.commodityDescriptionId], value: commodities ? body.commodityDescriptionId || null : null, onChange: (_e, value) => s({
254
262
  commodityDescriptionId: value || undefined,
255
- }), children: commodities?.map((c) => (_jsxs(Option, { value: c.id, children: [c.id && icons[c.id], c.name] }, c.id))) }), _jsx(FormHelperText, { children: t("Note: No Haz Mat, Ice Cream.") })] }) }), _jsx(Grid, { item: true, xs: 12, md: 3, children: _jsxs(FormControl, { required: true, children: [_jsx(FormLabel, { slotProps: {
263
+ }), children: commodities?.map((c) => (_jsxs(Option, { value: c.id, children: [c.id && icons[c.id], c.name] }, c.id))) }), _jsx(FormHelperText, { children: t("Note: No Haz Mat, Ice Cream.") })] }) }), _jsx(Grid, { xs: 12, md: 3, children: _jsxs(FormControl, { required: true, children: [_jsx(FormLabel, { slotProps: {
256
264
  asterisk: {
257
265
  sx: {
258
266
  color: (theme) => theme.palette.danger[400],
259
267
  },
260
268
  },
261
- }, children: t("totalWeight") }), _jsx(Input, { error: errors && !body.units?.totalDimensions?.totalWeight, type: "number", placeholder: "in lbs", value: body.units?.totalDimensions?.totalWeight ?? "", onChange: (e) => d({ totalWeight: e.target.value }) })] }) }), !customerPortal && (_jsxs(_Fragment, { children: [!perPalletClass ? (_jsx(Grid, { item: true, xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("freightClass") }), _jsx(Select, { value: body.freightClass ?? null, onChange: (_e, v) => s({ freightClass: v || undefined }), children: FREIGHT_CLASS.map((f) => (_jsx(Option, { value: f, children: f }, f))) })] }) })) : null, _jsx(Grid, { item: true, xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("Miles") }), _jsx(Input, { value: body.manualMiles ?? "", onChange: (e) => s({ manualMiles: Number(e.target.value) || undefined }), type: "number" })] }) })] })), _jsxs(Grid, { item: true, xs: 12, children: [_jsx(PalletsDataGrid, { customerPortal: customerPortal, perPalletClass: perPalletClass }), _jsx(Tooltip, { title: "ctrl+p", children: _jsxs(Button, { size: "sm", sx: { mt: 2 }, variant: "soft", color: errors && body.units?.palletDimensions?.length === 0
269
+ }, children: t("totalWeight") }), _jsx(Input, { error: errors && !body.units?.totalDimensions?.totalWeight, type: "number", placeholder: "in lbs", value: body.units?.totalDimensions?.totalWeight ?? "", onChange: (e) => d({ totalWeight: e.target.value }) })] }) }), !customerPortal && (_jsxs(_Fragment, { children: [!perPalletClass ? (_jsx(Grid, { xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("freightClass") }), _jsx(Select, { value: body.freightClass ?? null, onChange: (_e, v) => s({ freightClass: v || undefined }), children: FREIGHT_CLASS.map((f) => (_jsx(Option, { value: f, children: f }, f))) })] }) })) : null, _jsx(Grid, { xs: 12, md: 3, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("Miles") }), _jsx(Input, { value: body.manualMiles ?? "", onChange: (e) => s({ manualMiles: Number(e.target.value) || undefined }), type: "number" })] }) })] })), _jsxs(Grid, { xs: 12, children: [_jsx(PalletsDataGrid, { customerPortal: customerPortal, perPalletClass: perPalletClass }), _jsx(Tooltip, { title: "ctrl+p", children: _jsxs(Button, { size: "sm", sx: { mt: 2, display: { xs: "none", sm: "initial" } }, variant: "soft", color: errors && body.units?.palletDimensions?.length === 0
262
270
  ? "danger"
263
271
  : "neutral", onClick: () => {
264
272
  dispatch(addPallet());
265
- if (sm)
266
- dispatch(setFormOpen({ isOpen: true, formID: "pallet" }));
267
- }, children: [_jsx("i", { className: "fa-duotone fa-pallet-boxes pright" }), " ", t("addPallet")] }) })] }), palletsCheck &&
273
+ }, children: [_jsx("i", { className: "fa-duotone fa-pallet-boxes pright" }), " ", t("addPallet")] }) }), _jsxs(Button, { size: "sm", sx: { mt: 2, display: { xs: "initial", sm: "none" } }, variant: "soft", color: errors && body.units?.palletDimensions?.length === 0
274
+ ? "danger"
275
+ : "neutral", onClick: () => {
276
+ dispatch(addPallet());
277
+ dispatch(setFormOpen({ isOpen: true, formID: "pallet" }));
278
+ }, children: [_jsx("i", { className: "fa-duotone fa-pallet-boxes pright" }), " ", t("addPallet")] })] }), palletsCheck &&
268
279
  palletDimensions &&
269
280
  palletDimensions.length > 0 &&
270
- !error ? (_jsx(Grid, { item: true, xs: 12, children: _jsxs(Alert, { startDecorator: _jsx("i", { className: "fa-solid fa-thumbs-up" }), color: "neutral", children: [t("validSpecs"), " ", _jsx("b", { children: t("totalSpecs", {
281
+ !error ? (_jsx(Grid, { xs: 12, children: _jsxs(Alert, { startDecorator: _jsx("i", { className: "fa-solid fa-thumbs-up" }), color: "neutral", children: [t("validSpecs"), " ", _jsx("b", { children: t("totalSpecs", {
271
282
  feet: palletsCheck.feet,
272
283
  weight: Math.floor(palletsCheck.weight),
273
284
  pallets: palletsCheck.pallets,
274
- }) })] }) })) : ([]), error ? (_jsx(Grid, { item: true, xs: 12, children: _jsxs(Alert, { color: "danger", variant: "solid", startDecorator: _jsx("i", { className: "fa-solid fa-triangle-exclamation" }), children: [t("equipmentIssue"), " ", _jsx("b", { children: _error?.data?.message })] }) })) : ([])] }))] }), sm && !body.emptyLoad ? _jsx(FormPallet, {}) : []] }));
285
+ }) })] }) })) : ([]), error ? (_jsx(Grid, { xs: 12, children: _jsxs(Alert, { color: "danger", variant: "solid", startDecorator: _jsx("i", { className: "fa-solid fa-triangle-exclamation" }), children: [t("equipmentIssue"), " ", _jsx("b", { children: _error?.data?.message })] }) })) : ([])] }))] }), !body.emptyLoad ? _jsx(FormPallet, {}) : []] }));
275
286
  }
276
287
  const PalletsDataGrid = ({ customerPortal, perPalletClass, }) => {
277
288
  const body = useSelector(quoteBodySelector);
278
- const theme = useTheme();
279
- const sm = useMediaQuery(theme.breakpoints.down(600));
280
289
  const dispatch = useDispatch();
281
290
  const apiRef = useGridApiRef();
282
291
  const palletUpdate = async (_pallet) => {
@@ -293,7 +302,7 @@ const PalletsDataGrid = ({ customerPortal, perPalletClass, }) => {
293
302
  });
294
303
  }, []);
295
304
  return (_jsx(DataGridPremium, { density: "compact", apiRef: apiRef, onCellClick: (e) => {
296
- if (sm) {
305
+ if (window.matchMedia("(max-width:600px)").matches) {
297
306
  dispatch(setStagedPallet(e.row));
298
307
  dispatch(setFormOpen({ formID: "pallet", isOpen: true }));
299
308
  }
@@ -317,7 +326,14 @@ const PalletsDataGrid = ({ customerPortal, perPalletClass, }) => {
317
326
  */
318
327
  function ShipCons({ customerPortal }) {
319
328
  const { t } = useTranslation("salesKit");
320
- return (_jsxs(Paper, { sx: { p: 2, display: "flex", flexDirection: "column", gap: 1 }, children: [_jsxs(Typography, { variant: "h6", children: [_jsx("i", { className: "fa-duotone fa-location-dot pright" }), t("stops")] }), _jsx(Stops, { stopKind: SHIPPERS, customerPortal: customerPortal }), _jsx(TrailerAvailability, { customerPortal: customerPortal }), _jsx(Divider, {}), _jsx(Stops, { stopKind: CONSIGNEES, customerPortal: customerPortal })] }));
329
+ return (_jsxs(Sheet, { sx: {
330
+ p: 2,
331
+ display: "flex",
332
+ flexDirection: "column",
333
+ gap: 1,
334
+ borderRadius: "sm",
335
+ boxShadow: "md",
336
+ }, children: [_jsxs(Typography, { level: "title-lg", children: [_jsx("i", { className: "fa-duotone fa-location-dot pright" }), t("stops")] }), _jsx(Stops, { stopKind: SHIPPERS, customerPortal: customerPortal }), _jsx(TrailerAvailability, { customerPortal: customerPortal }), _jsx(Divider, {}), _jsx(Stops, { stopKind: CONSIGNEES, customerPortal: customerPortal })] }));
321
337
  }
322
338
  /**
323
339
  * ShipCons. Form that contains input to gather stops.
@@ -418,8 +434,6 @@ function Stops({ stopKind, customerPortal, }) {
418
434
  const { t } = useTranslation("salesKit");
419
435
  const apiRef = useGridApiRef();
420
436
  const stops = stopKind === SHIPPERS ? shippers : consignees;
421
- const theme = useTheme();
422
- const sm = useMediaQuery(theme.breakpoints.down(600));
423
437
  useHotkeys(keyboardShortcuts[stopKind], () => {
424
438
  dispatch(addStop(stopKind));
425
439
  }, {
@@ -436,10 +450,10 @@ function Stops({ stopKind, customerPortal, }) {
436
450
  const stopPosition = (params) => {
437
451
  dispatch(reorderStop(stopKind, params.oldIndex, params.targetIndex));
438
452
  };
439
- return (_jsxs(Sheet, { sx: { p: 1 }, children: [_jsxs(Typography, { variant: "h6", sx: { textTransform: "capitalize" }, children: [icons[stopKind], stopKind] }), _jsx(DataGridPremium, { density: "compact", autoHeight: true, rowReordering: true, hideFooter: true, slotProps: {
453
+ return (_jsxs(Sheet, { sx: { p: 1 }, children: [_jsxs(Typography, { level: "body-lg", sx: { textTransform: "capitalize" }, children: [icons[stopKind], stopKind] }), _jsx(DataGridPremium, { density: "compact", autoHeight: true, rowReordering: true, hideFooter: true, slotProps: {
440
454
  cell: { tabIndex: 0 },
441
455
  }, apiRef: apiRef, onCellClick: (e) => {
442
- if (sm) {
456
+ if (window.matchMedia("(max-width:600px)").matches) {
443
457
  dispatch(setStagedStop(e.row));
444
458
  dispatch(setFormOpen({ formID: "stop", isOpen: true }));
445
459
  }
@@ -447,11 +461,24 @@ function Stops({ stopKind, customerPortal, }) {
447
461
  apiRef.current.getCellMode(e.id, e.field) === "view") {
448
462
  apiRef.current?.startCellEditMode({ id: e.id, field: e.field });
449
463
  }
450
- }, processRowUpdate: stopUpdate, onRowOrderChange: stopPosition, getRowId: (p) => p.key, rows: stops ?? [], columns: getStopsColumnDef(dispatch, stopKind, stops ?? [], customerPortal, errors) }), _jsx(Tooltip, { title: keyboardShortcuts[stopKind], children: _jsxs(Button, { size: "sm", sx: { mt: 2 }, variant: "soft", color: "neutral", onClick: () => {
464
+ }, processRowUpdate: stopUpdate, onRowOrderChange: stopPosition, getRowId: (p) => p.key, rows: stops ?? [], columns: getStopsColumnDef(dispatch, stopKind, stops ?? [], customerPortal, errors) }), _jsx(Tooltip, { title: keyboardShortcuts[stopKind], children: _jsxs(Button, { size: "sm", sx: {
465
+ mt: 2,
466
+ display: {
467
+ xs: "none",
468
+ sm: "initial",
469
+ },
470
+ }, variant: "soft", color: "neutral", onClick: () => {
451
471
  dispatch(addStop(stopKind));
452
- if (sm)
453
- dispatch(setFormOpen({ isOpen: true, formID: "stop" }));
454
- }, children: [_jsx("i", { className: "fa-solid fa-location-dot pright" }), t("addStop")] }) })] }));
472
+ }, children: [_jsx("i", { className: "fa-solid fa-location-dot pright" }), t("addStop")] }) }), _jsxs(Button, { size: "sm", sx: {
473
+ mt: 2,
474
+ display: {
475
+ xs: "initial",
476
+ sm: "none",
477
+ },
478
+ }, variant: "soft", color: "neutral", onClick: () => {
479
+ dispatch(addStop(stopKind));
480
+ dispatch(setFormOpen({ isOpen: true, formID: "stop" }));
481
+ }, children: [_jsx("i", { className: "fa-solid fa-location-dot pright" }), t("addStop")] })] }));
455
482
  }
456
483
  /**
457
484
  *
@@ -481,83 +508,88 @@ function FormPallet() {
481
508
  if (stagedPallet)
482
509
  setPallet(stagedPallet);
483
510
  }, [stagedPallet]);
484
- return (_jsxs(Dialog, { open: open ?? false, onClose: close, fullScreen: true, fullWidth: true, children: [_jsx(DialogTitle, { children: _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(JoyTypography, { startDecorator: _jsx("i", { className: "fa-solid fa-pallet-boxes" }), level: "title-md", children: t("palletDetails") }), _jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [_jsx(IconButton, { onClick: deletePallet, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-trash" }) }), _jsx(IconButton, { onClick: close, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-xmark" }) })] })] }) }), _jsx(Divider, {}), _jsx(DialogContent, { children: pallet ? (_jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [_jsx(Input, { onFocus: (event) => {
485
- event.target.select();
486
- }, type: "number", sx: {
487
- ".MuiInput-input": {
488
- textAlign: "right",
489
- },
490
- }, onChange: (e) => {
491
- setPallet((p) => {
492
- if (p)
493
- return { ...p, count: parseInt(e.target.value) };
494
- return p;
495
- });
496
- }, value: pallet?.count ?? "", startDecorator: "Count" }), _jsx(Checkbox, { checked: pallet?.stackable, onChange: (e) => {
497
- setPallet((p) => {
498
- if (p)
499
- return { ...p, stackable: e.target.checked };
500
- return p;
501
- });
502
- }, label: "Stackable" }), _jsx(Input, { type: "number", onFocus: (event) => {
503
- event.target.select();
504
- }, sx: {
505
- ".MuiInput-input": {
506
- textAlign: "right",
507
- },
508
- }, value: pallet?.length ?? "", onChange: (e) => {
509
- setPallet((p) => {
510
- if (p)
511
- return { ...p, length: parseInt(e.target.value) };
512
- return p;
513
- });
514
- }, startDecorator: "Length", placeholder: `In ${stagedPallet?.units}` }), _jsx(Input, { type: "number", onFocus: (event) => {
515
- event.target.select();
516
- }, sx: {
517
- ".MuiInput-input": {
518
- textAlign: "right",
519
- },
520
- }, value: pallet?.width ?? "", onChange: (e) => {
521
- setPallet((p) => {
522
- if (p)
523
- return { ...p, width: parseInt(e.target.value) };
524
- return p;
525
- });
526
- }, startDecorator: "Width", placeholder: `In ${stagedPallet?.units}` }), _jsx(Input, { type: "number", onFocus: (event) => {
527
- event.target.select();
528
- }, sx: {
529
- ".MuiInput-input": {
530
- textAlign: "right",
531
- },
532
- }, value: pallet?.height ?? "", onChange: (e) => {
533
- setPallet((p) => {
534
- if (p)
535
- return { ...p, height: parseInt(e.target.value) };
536
- return p;
537
- });
538
- }, startDecorator: "Height", placeholder: `In ${stagedPallet?.units}` }), _jsxs(Select, { startDecorator: "Units", sx: {
539
- ".MuiSelect-button": {
540
- justifyContent: "end",
541
- },
542
- }, value: stagedPallet?.units, onChange: (_e, value) => {
543
- setPallet((p) => {
544
- if (p)
545
- return { ...p, units: value };
546
- return p;
547
- });
548
- }, children: [_jsx(Option, { value: "inches", children: "Inches" }), _jsx(Option, { value: "feet", children: "Feet" })] }), _jsx(Input, { type: "number", onFocus: (event) => {
549
- event.target.select();
550
- }, sx: {
551
- ".MuiInput-input": {
552
- textAlign: "right",
553
- },
554
- }, value: pallet?.weight ?? "", onChange: (e) => {
555
- setPallet((p) => {
556
- if (p)
557
- return { ...p, weight: parseInt(e.target.value) };
558
- return p;
559
- });
560
- }, startDecorator: "Weight", placeholder: `In lbs` })] })) : ([]) }), _jsxs(DialogActions, { children: [_jsx(Button, { fullWidth: true, color: "neutral", variant: "soft", onClick: close, children: t("Cancel") }), _jsx(Button, { onClick: save, fullWidth: true, children: t("Save") })] })] }));
511
+ return (_jsx(Modal, { open: open ?? false, onClose: close, sx: {
512
+ display: {
513
+ sm: "initial",
514
+ md: "none",
515
+ },
516
+ }, children: _jsxs(ModalDialog, { layout: "fullscreen", children: [_jsx(DialogTitle, { children: _jsxs(Box, { sx: { display: "flex", width: "100%" }, children: [_jsx(Typography, { startDecorator: _jsx("i", { className: "fa-solid fa-pallet-boxes" }), level: "title-md", children: t("palletDetails") }), _jsxs(Box, { sx: { display: "flex", gap: 1, ml: "auto" }, children: [_jsx(IconButton, { onClick: deletePallet, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-trash" }) }), _jsx(IconButton, { onClick: close, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-xmark" }) })] })] }) }), _jsx(Divider, {}), _jsx(DialogContent, { children: pallet ? (_jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 1 }, children: [_jsx(Input, { onFocus: (event) => {
517
+ event.target.select();
518
+ }, type: "number", sx: {
519
+ ".MuiInput-input": {
520
+ textAlign: "right",
521
+ },
522
+ }, onChange: (e) => {
523
+ setPallet((p) => {
524
+ if (p)
525
+ return { ...p, count: parseInt(e.target.value) };
526
+ return p;
527
+ });
528
+ }, value: pallet?.count ?? "", startDecorator: "Count" }), _jsx(Checkbox, { checked: pallet?.stackable, onChange: (e) => {
529
+ setPallet((p) => {
530
+ if (p)
531
+ return { ...p, stackable: e.target.checked };
532
+ return p;
533
+ });
534
+ }, label: "Stackable" }), _jsx(Input, { type: "number", onFocus: (event) => {
535
+ event.target.select();
536
+ }, sx: {
537
+ ".MuiInput-input": {
538
+ textAlign: "right",
539
+ },
540
+ }, value: pallet?.length ?? "", onChange: (e) => {
541
+ setPallet((p) => {
542
+ if (p)
543
+ return { ...p, length: parseInt(e.target.value) };
544
+ return p;
545
+ });
546
+ }, startDecorator: "Length", placeholder: `In ${stagedPallet?.units}` }), _jsx(Input, { type: "number", onFocus: (event) => {
547
+ event.target.select();
548
+ }, sx: {
549
+ ".MuiInput-input": {
550
+ textAlign: "right",
551
+ },
552
+ }, value: pallet?.width ?? "", onChange: (e) => {
553
+ setPallet((p) => {
554
+ if (p)
555
+ return { ...p, width: parseInt(e.target.value) };
556
+ return p;
557
+ });
558
+ }, startDecorator: "Width", placeholder: `In ${stagedPallet?.units}` }), _jsx(Input, { type: "number", onFocus: (event) => {
559
+ event.target.select();
560
+ }, sx: {
561
+ ".MuiInput-input": {
562
+ textAlign: "right",
563
+ },
564
+ }, value: pallet?.height ?? "", onChange: (e) => {
565
+ setPallet((p) => {
566
+ if (p)
567
+ return { ...p, height: parseInt(e.target.value) };
568
+ return p;
569
+ });
570
+ }, startDecorator: "Height", placeholder: `In ${stagedPallet?.units}` }), _jsxs(Select, { startDecorator: "Units", sx: {
571
+ ".MuiSelect-button": {
572
+ justifyContent: "end",
573
+ },
574
+ }, value: stagedPallet?.units, onChange: (_e, value) => {
575
+ setPallet((p) => {
576
+ if (p)
577
+ return { ...p, units: value };
578
+ return p;
579
+ });
580
+ }, children: [_jsx(Option, { value: "inches", children: "Inches" }), _jsx(Option, { value: "feet", children: "Feet" })] }), _jsx(Input, { type: "number", onFocus: (event) => {
581
+ event.target.select();
582
+ }, sx: {
583
+ ".MuiInput-input": {
584
+ textAlign: "right",
585
+ },
586
+ }, value: pallet?.weight ?? "", onChange: (e) => {
587
+ setPallet((p) => {
588
+ if (p)
589
+ return { ...p, weight: parseInt(e.target.value) };
590
+ return p;
591
+ });
592
+ }, startDecorator: "Weight", placeholder: `In lbs` })] })) : ([]) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: save, fullWidth: true, children: t("Save") }), _jsx(Button, { fullWidth: true, color: "neutral", variant: "soft", onClick: close, children: t("Cancel") })] })] }) }));
561
593
  }
562
594
  /**
563
595
  *
@@ -593,48 +625,48 @@ function FormStop({ customerPortal }) {
593
625
  setStop(stagedStop);
594
626
  }
595
627
  }, [stagedStop]);
596
- return (_jsxs(Dialog, { open: open ?? false, onClose: close, fullScreen: true, fullWidth: true, children: [_jsx(DialogTitle, { children: _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(JoyTypography, { startDecorator: _jsx("i", { className: "fa-solid fa-location-dot" }), level: "title-md", children: t("stopDetails") }), _jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [_jsx(IconButton, { onClick: deleteStop, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-trash" }) }), _jsx(IconButton, { onClick: close, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-xmark" }) })] })] }) }), _jsx(Divider, {}), _jsx(DialogContent, { children: stop ? (_jsxs(Box, { sx: { display: "flex", gap: 2, flexDirection: "column" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(JoyTypography, { endDecorator: _jsx(JoyTypography, { color: "danger", children: "*" }), children: "Enter zip or city, state..." }) }), _jsx(Input, { onFocus: (event) => {
597
- event.target.select();
598
- }, type: "number", placeholder: "Enter zip or city, state...", autoComplete: "off", onChange: (e) => {
599
- setStop((p) => {
600
- if (p)
601
- return { ...p, zip: e.target.value };
602
- return p;
603
- });
604
- }, value: stop?.zip ?? "" })] }), _jsx(LocationInput, { customerPortal: customerPortal, zip: stop.zip, locationID: stop.locationId, onChange: (e) => {
605
- setStop((p) => {
606
- if (p)
607
- return { ...p, locationId: e?.id };
608
- return p;
609
- });
610
- } }), isShipper ? (_jsx(NerdDatePicker, { value: stop.date ? DateTime.fromISO(stop.date) : null, label: _jsx(JoyTypography, { endDecorator: _jsx(JoyTypography, { color: "danger", children: "*" }), children: "Pickup Date" }), inputProps: {
611
- placeholder: "Pickup Date",
612
- variant: "outlined",
613
- }, onChange: (e) => {
614
- setStop((p) => {
615
- if (p)
616
- return { ...p, date: e?.toISO() ?? "" };
617
- return p;
618
- });
619
- }, openCalendar: false, datePickerProps: {
620
- shouldDisableDate(d) {
621
- return typeof d != "string" && d < DateTime.now();
622
- },
623
- autoFocus: true,
624
- closeOnSelect: true,
625
- renderDay: (date, _selectedDay, props) => (_jsx(RenderDay, { handleChange: (e) => {
626
- setStop((p) => {
627
- if (p)
628
- return { ...p, date: e?.toISO() ?? "" };
629
- return p;
630
- });
631
- }, date: date, pickersDayProps: props }, date.toString())),
632
- } })) : ([]), _jsx(AccessorialInput, { accessorialIDs: stop.accessorialIds, onChange: (e) => {
633
- setStop((p) => {
634
- if (p)
635
- return { ...p, accessorialIds: e };
636
- return p;
637
- });
638
- } })] })) : ([]) }), _jsxs(DialogActions, { children: [_jsx(Button, { fullWidth: true, color: "neutral", variant: "soft", onClick: close, children: t("Cancel") }), _jsx(Button, { onClick: save, fullWidth: true, children: t("Save") })] })] }));
628
+ return (_jsx(Modal, { open: Boolean(open), onClose: close, children: _jsxs(ModalDialog, { layout: "fullscreen", children: [_jsx(DialogTitle, { children: _jsxs(Box, { sx: { display: "flex", width: "100%" }, children: [_jsx(Typography, { startDecorator: _jsx("i", { className: "fa-solid fa-location-dot" }), level: "title-md", children: t("stopDetails") }), _jsxs(Box, { sx: { display: "flex", gap: 1, ml: "auto" }, children: [_jsx(IconButton, { onClick: deleteStop, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-trash" }) }), _jsx(IconButton, { onClick: close, variant: "soft", color: "neutral", children: _jsx("i", { className: "fa-solid fa-xmark" }) })] })] }) }), _jsx(Divider, {}), _jsx(DialogContent, { children: stop ? (_jsxs(Box, { sx: { display: "flex", gap: 2, flexDirection: "column" }, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: _jsx(Typography, { endDecorator: _jsx(Typography, { color: "danger", children: "*" }), children: "Enter zip or city, state..." }) }), _jsx(Input, { onFocus: (event) => {
629
+ event.target.select();
630
+ }, type: "number", placeholder: "Enter zip or city, state...", autoComplete: "off", onChange: (e) => {
631
+ setStop((p) => {
632
+ if (p)
633
+ return { ...p, zip: e.target.value };
634
+ return p;
635
+ });
636
+ }, value: stop?.zip ?? "" })] }), _jsx(LocationInput, { customerPortal: customerPortal, zip: stop.zip, locationID: stop.locationId, onChange: (e) => {
637
+ setStop((p) => {
638
+ if (p)
639
+ return { ...p, locationId: e?.id };
640
+ return p;
641
+ });
642
+ } }), isShipper ? (_jsx(NerdDatePicker, { value: stop.date ? DateTime.fromISO(stop.date) : null, label: _jsx(Typography, { endDecorator: _jsx(Typography, { color: "danger", children: "*" }), children: "Pickup Date" }), inputProps: {
643
+ placeholder: "Pickup Date",
644
+ variant: "outlined",
645
+ }, onChange: (e) => {
646
+ setStop((p) => {
647
+ if (p)
648
+ return { ...p, date: e?.toISO() ?? "" };
649
+ return p;
650
+ });
651
+ }, openCalendar: false, datePickerProps: {
652
+ shouldDisableDate(d) {
653
+ return typeof d != "string" && d < DateTime.now();
654
+ },
655
+ autoFocus: true,
656
+ closeOnSelect: true,
657
+ renderDay: (date, _selectedDay, props) => (_jsx(RenderDay, { handleChange: (e) => {
658
+ setStop((p) => {
659
+ if (p)
660
+ return { ...p, date: e?.toISO() ?? "" };
661
+ return p;
662
+ });
663
+ }, date: date, pickersDayProps: props }, date.toString())),
664
+ } })) : ([]), _jsx(AccessorialInput, { accessorialIDs: stop.accessorialIds, onChange: (e) => {
665
+ setStop((p) => {
666
+ if (p)
667
+ return { ...p, accessorialIds: e };
668
+ return p;
669
+ });
670
+ } })] })) : ([]) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: save, fullWidth: true, children: t("Save") }), _jsx(Button, { fullWidth: true, color: "neutral", variant: "soft", onClick: close, children: t("Cancel") })] })] }) }));
639
671
  }
640
672
  //# sourceMappingURL=form.js.map