@nerdjs/sales-kit 2.2.11 → 2.3.0

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 (147) hide show
  1. package/dist/entities/cargoConsolidation/cargoConsolidation.d.ts +1 -0
  2. package/dist/entities/cargoConsolidation/cargoConsolidation.js +2 -0
  3. package/dist/entities/cargoConsolidation/cargoConsolidation.js.map +1 -1
  4. package/dist/hooks/lep/checkList.js +14 -8
  5. package/dist/hooks/lep/checkList.js.map +1 -1
  6. package/dist/hooks/lep/helpers.js +2 -0
  7. package/dist/hooks/lep/helpers.js.map +1 -1
  8. package/dist/hooks/lep/index.d.ts +1 -0
  9. package/dist/hooks/lep/index.js +1 -0
  10. package/dist/hooks/lep/index.js.map +1 -1
  11. package/dist/hooks/lep/lepAccessorials.js +85 -63
  12. package/dist/hooks/lep/lepAccessorials.js.map +1 -1
  13. package/dist/hooks/lep/lepActionBar.js +602 -73
  14. package/dist/hooks/lep/lepActionBar.js.map +1 -1
  15. package/dist/hooks/lep/lepAdjustments.js +16 -23
  16. package/dist/hooks/lep/lepAdjustments.js.map +1 -1
  17. package/dist/hooks/lep/lepAppointmentArrivals.js +5 -5
  18. package/dist/hooks/lep/lepAppointmentArrivals.js.map +1 -1
  19. package/dist/hooks/lep/lepClaims.js +10 -10
  20. package/dist/hooks/lep/lepClaims.js.map +1 -1
  21. package/dist/hooks/lep/lepCommodities.js +65 -64
  22. package/dist/hooks/lep/lepCommodities.js.map +1 -1
  23. package/dist/hooks/lep/lepConsolidations.js +5 -5
  24. package/dist/hooks/lep/lepConsolidations.js.map +1 -1
  25. package/dist/hooks/lep/lepCustomerContacts.js +11 -13
  26. package/dist/hooks/lep/lepCustomerContacts.js.map +1 -1
  27. package/dist/hooks/lep/lepCustomerInfo.js +15 -12
  28. package/dist/hooks/lep/lepCustomerInfo.js.map +1 -1
  29. package/dist/hooks/lep/lepCustomerPeople.js +15 -20
  30. package/dist/hooks/lep/lepCustomerPeople.js.map +1 -1
  31. package/dist/hooks/lep/lepCustomerSalesNotes.js +7 -5
  32. package/dist/hooks/lep/lepCustomerSalesNotes.js.map +1 -1
  33. package/dist/hooks/lep/lepCustomersAccessorials.js +12 -5
  34. package/dist/hooks/lep/lepCustomersAccessorials.js.map +1 -1
  35. package/dist/hooks/lep/lepDateInputCell.js +11 -1
  36. package/dist/hooks/lep/lepDateInputCell.js.map +1 -1
  37. package/dist/hooks/lep/lepDispatches.js +6 -6
  38. package/dist/hooks/lep/lepDispatches.js.map +1 -1
  39. package/dist/hooks/lep/lepDocuments.js +41 -42
  40. package/dist/hooks/lep/lepDocuments.js.map +1 -1
  41. package/dist/hooks/lep/lepEDI.js +8 -8
  42. package/dist/hooks/lep/lepEDI.js.map +1 -1
  43. package/dist/hooks/lep/lepHosLogs.js +9 -9
  44. package/dist/hooks/lep/lepHosLogs.js.map +1 -1
  45. package/dist/hooks/lep/lepInvoiceAdjustment.d.ts +3 -0
  46. package/dist/hooks/lep/lepInvoiceAdjustment.js +9 -6
  47. package/dist/hooks/lep/lepInvoiceAdjustment.js.map +1 -1
  48. package/dist/hooks/lep/lepInvoiceDetails.d.ts +3 -0
  49. package/dist/hooks/lep/lepInvoiceDetails.js +37 -26
  50. package/dist/hooks/lep/lepInvoiceDetails.js.map +1 -1
  51. package/dist/hooks/lep/lepInvoiceLineItems.js +15 -22
  52. package/dist/hooks/lep/lepInvoiceLineItems.js.map +1 -1
  53. package/dist/hooks/lep/lepKickbacks.js +13 -13
  54. package/dist/hooks/lep/lepKickbacks.js.map +1 -1
  55. package/dist/hooks/lep/lepLoadChanges.js +10 -10
  56. package/dist/hooks/lep/lepLoadChanges.js.map +1 -1
  57. package/dist/hooks/lep/lepLoadInfo.js +213 -172
  58. package/dist/hooks/lep/lepLoadInfo.js.map +1 -1
  59. package/dist/hooks/lep/lepLoadLocation.d.ts +5 -0
  60. package/dist/hooks/lep/lepLoadLocation.js +13 -8
  61. package/dist/hooks/lep/lepLoadLocation.js.map +1 -1
  62. package/dist/hooks/lep/lepLoadNotes.js +14 -10
  63. package/dist/hooks/lep/lepLoadNotes.js.map +1 -1
  64. package/dist/hooks/lep/lepLoadSummary.d.ts +5 -0
  65. package/dist/hooks/lep/lepLoadSummary.js +37 -0
  66. package/dist/hooks/lep/lepLoadSummary.js.map +1 -0
  67. package/dist/hooks/lep/lepNotifications.js +5 -5
  68. package/dist/hooks/lep/lepNotifications.js.map +1 -1
  69. package/dist/hooks/lep/lepPossibleIssues.js +8 -6
  70. package/dist/hooks/lep/lepPossibleIssues.js.map +1 -1
  71. package/dist/hooks/lep/lepQuoteResult.d.ts +3 -0
  72. package/dist/hooks/lep/lepQuoteResult.js +20 -9
  73. package/dist/hooks/lep/lepQuoteResult.js.map +1 -1
  74. package/dist/hooks/lep/lepRateLogs.js +5 -5
  75. package/dist/hooks/lep/lepRateLogs.js.map +1 -1
  76. package/dist/hooks/lep/lepRateReviews.js +15 -23
  77. package/dist/hooks/lep/lepRateReviews.js.map +1 -1
  78. package/dist/hooks/lep/lepShipcons.d.ts +2 -0
  79. package/dist/hooks/lep/lepShipcons.js +215 -166
  80. package/dist/hooks/lep/lepShipcons.js.map +1 -1
  81. package/dist/hooks/lep/lepTendersWidget.js +7 -7
  82. package/dist/hooks/lep/lepTendersWidget.js.map +1 -1
  83. package/dist/hooks/lep/lepTimeInputCell.js +7 -1
  84. package/dist/hooks/lep/lepTimeInputCell.js.map +1 -1
  85. package/dist/hooks/lep/lepUserNotes.js +20 -22
  86. package/dist/hooks/lep/lepUserNotes.js.map +1 -1
  87. package/dist/hooks/lep/lepWidget.d.ts +1 -0
  88. package/dist/hooks/lep/lepWidget.js +22 -16
  89. package/dist/hooks/lep/lepWidget.js.map +1 -1
  90. package/dist/hooks/lep/lepWorkflowEvents.js +5 -5
  91. package/dist/hooks/lep/lepWorkflowEvents.js.map +1 -1
  92. package/dist/hooks/lep/loadEditPanel.d.ts +22 -0
  93. package/dist/hooks/lep/loadEditPanel.js +157 -139
  94. package/dist/hooks/lep/loadEditPanel.js.map +1 -1
  95. package/dist/hooks/lep/nerdMap/nerdMap.js +1 -0
  96. package/dist/hooks/lep/nerdMap/nerdMap.js.map +1 -1
  97. package/dist/hooks/load/loadsSearchInput.d.ts +1 -0
  98. package/dist/hooks/load/loadsSearchInput.js +16 -3
  99. package/dist/hooks/load/loadsSearchInput.js.map +1 -1
  100. package/dist/hooks/quote/constants.d.ts +1 -1
  101. package/dist/hooks/quote/constants.js +325 -42
  102. package/dist/hooks/quote/constants.js.map +1 -1
  103. package/dist/hooks/quote/helpers.js +3 -2
  104. package/dist/hooks/quote/helpers.js.map +1 -1
  105. package/dist/hooks/quote/result.js +8 -12
  106. package/dist/hooks/quote/result.js.map +1 -1
  107. package/dist/locales/en/common.json +2 -1
  108. package/dist/locales/en/components.json +1 -0
  109. package/dist/locales/en/entities.json +2 -2
  110. package/dist/locales/index.d.ts +2 -0
  111. package/dist/redux/archerFile/archerFileEndpoints.d.ts +2 -0
  112. package/dist/redux/archerFile/archerFileEndpoints.js +2 -0
  113. package/dist/redux/archerFile/archerFileEndpoints.js.map +1 -1
  114. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSelectors.d.ts +2 -3
  115. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSelectors.js +3 -4
  116. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSelectors.js.map +1 -1
  117. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSlice.d.ts +18 -4
  118. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSlice.js +5 -3
  119. package/dist/redux/commoditiesTasksSlice/commoditiesTasksSlice.js.map +1 -1
  120. package/dist/redux/lep/lepSelectors.d.ts +6 -7
  121. package/dist/redux/lep/lepSelectors.js +11 -14
  122. package/dist/redux/lep/lepSelectors.js.map +1 -1
  123. package/dist/redux/lep/lepSlice.d.ts +33 -9
  124. package/dist/redux/lep/lepSlice.js +21 -14
  125. package/dist/redux/lep/lepSlice.js.map +1 -1
  126. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSelectors.d.ts +2 -3
  127. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSelectors.js +2 -2
  128. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSelectors.js.map +1 -1
  129. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSlice.d.ts +18 -4
  130. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSlice.js +6 -3
  131. package/dist/redux/loadInfoTasksSlice/loadInfoTasksSlice.js.map +1 -1
  132. package/dist/redux/quote/quoteAction.d.ts +5 -1
  133. package/dist/redux/quote/quoteAction.js +3 -2
  134. package/dist/redux/quote/quoteAction.js.map +1 -1
  135. package/dist/redux/quote/quoteReducer.d.ts +1 -1
  136. package/dist/redux/quote/quoteReducer.js +2 -1
  137. package/dist/redux/quote/quoteReducer.js.map +1 -1
  138. package/dist/redux/quote/quoteSelectors.d.ts +1 -1
  139. package/dist/redux/quote/quoteSelectors.js +1 -1
  140. package/dist/redux/quote/quoteSelectors.js.map +1 -1
  141. package/dist/redux/shipconsTasksSlice/shipconsTasksSelectors.d.ts +2 -3
  142. package/dist/redux/shipconsTasksSlice/shipconsTasksSelectors.js +2 -2
  143. package/dist/redux/shipconsTasksSlice/shipconsTasksSelectors.js.map +1 -1
  144. package/dist/redux/shipconsTasksSlice/shipconsTasksSlice.d.ts +11 -3
  145. package/dist/redux/shipconsTasksSlice/shipconsTasksSlice.js +4 -2
  146. package/dist/redux/shipconsTasksSlice/shipconsTasksSlice.js.map +1 -1
  147. package/package.json +2 -2
@@ -1,31 +1,31 @@
1
1
  import { createElement as _createElement } from "react";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Autocomplete, AutocompleteOption, Button, Checkbox, CircularProgress, FormControl, FormLabel, Grid, Input, ListItemContent, Modal, ModalDialog, Option, Select, Skeleton, Switch, Textarea, Typography, Box, Tooltip, Sheet, } from "@mui/joy";
4
3
  import { Popper } from "@mui/base";
4
+ import { Autocomplete, AutocompleteOption, Box, Button, Checkbox, CircularProgress, FormControl, FormLabel, Grid, Input, ListItemContent, Modal, ModalDialog, Option, Select, Sheet, Skeleton, Switch, Textarea, Tooltip, Typography, } from "@mui/joy";
5
5
  import { ListItemIcon, Menu, MenuItem } from "@mui/material";
6
+ import { GRID_REORDER_COL_DEF, GridActionsCellItem, useGridApiRef, } from "@mui/x-data-grid-premium";
7
+ import { NerdEmailValidator, useGetCurrentUserQuery, } from "@nerdjs/account-kit";
6
8
  import { CopyInputDecorator, NerdDatePicker, NerdTimePicker, showNotification, } from "@nerdjs/nerd-ui";
9
+ import { nanoid } from "@reduxjs/toolkit";
7
10
  import { DateTime } from "luxon";
8
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
- import salesKitI18n from "../../i18n";
11
+ import { useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
10
12
  import { useTranslation } from "react-i18next";
11
- import { useParams } from "react-router-dom";
12
13
  import { useDispatch, useSelector } from "react-redux";
14
+ import { Person, locationEntityTypeGuard, } from "../../entities";
15
+ import salesKitI18n from "../../i18n";
16
+ import { getAppointmentIssueSubcategoriesSelectors, getAppointmentNotesSelectors, getCarriersSelectors, getDriverNamesSelectors, getNodeNamesSelectors, getPeopleSelectors, getShipconsSelectors, useCreateAppointmentIssueMutation, useCreateShipconV1Mutation, useDeleteShipconV1Mutation, useEmailArcherFileMutation, useGetAppointmentIssueCategoryFilteredByRoleQuery, useGetAppointmentNoteTypesQuery, useGetAppointmentNotesQuery, useGetCarriersQuery, useGetCustomerPeopleQuery, useGetDriverNamesQuery, useGetLoadFilesQuery, useGetLoadQuery, useGetLocationV1Query, useGetNodeNamesQuery, useGetPeopleQuery, useGetShipconQuery, useGetShipconsQuery, useLazyGetAppointmentIssueSubcategoriesQuery, useReorderShipconsMutation, useShipconCreateUserNoteMutation, useUpdateLoadV1Mutation, useUpdateLocationV1Mutation, useUpdateShipconV1Mutation, } from "../../redux";
17
+ import { addLoadInfoTask } from "../../redux/loadInfoTasksSlice/loadInfoTasksSlice";
18
+ import { setRecalculateBody } from "../../redux/quote";
19
+ import { quoteRecalculateBodySelector } from "../../redux/quote/quoteSelectors";
20
+ import { addShipconsTask, setShipconsTasks, } from "../../redux/shipconsTasksSlice/shipconsTasksSlice";
21
+ import { LocationFormSales } from "../locationsForm";
22
+ import { LocationCell, LocationInput, LocationInputCell } from "../quote";
23
+ import { getCSRS } from "./helpers";
13
24
  import { LepDateInputCell } from "./lepDateInputCell";
25
+ import { LepStyledDataGrid } from "./lepStyledDataGrid";
14
26
  import { LepTimeInputCell } from "./lepTimeInputCell";
27
+ import { LoadIDContext } from "./loadEditPanel";
15
28
  import { VirtualizedAutocompleteList } from "./virtualizedAutocompleteList";
16
- import { addShipconsTask, setShipconsTasks, } from "../../redux/shipconsTasksSlice/shipconsTasksSlice";
17
- import { nanoid } from "@reduxjs/toolkit";
18
- import { GridActionsCellItem, useGridApiRef, } from "@mui/x-data-grid-premium";
19
- import { LepStyledDataGrid } from "./lepStyledDataGrid";
20
- import { NerdEmailValidator, useGetCurrentUserQuery, } from "@nerdjs/account-kit";
21
- import { quoteRecalculateBodySelector } from "../../redux/quote/quoteSelectors";
22
- import { setRecalculateBody } from "../../redux/quote";
23
- import { addLoadInfoTask } from "../../redux/loadInfoTasksSlice/loadInfoTasksSlice";
24
- import { getCSRS } from "./helpers";
25
- import { locationEntityTypeGuard, Person, } from "../../entities";
26
- import { useGetShipconsQuery, useGetLoadQuery, useGetPeopleQuery, useGetCustomerPeopleQuery, useUpdateShipconV1Mutation, useDeleteShipconV1Mutation, useReorderShipconsMutation, getShipconsSelectors, useShipconCreateUserNoteMutation, useEmailArcherFileMutation, useGetLoadFilesQuery, useGetShipconQuery, useCreateShipconV1Mutation, useGetAppointmentNotesQuery, getAppointmentNotesSelectors, useGetAppointmentNoteTypesQuery, useGetLocationV1Query, useUpdateLocationV1Mutation, useCreateAppointmentIssueMutation, useGetAppointmentIssueCategoryFilteredByRoleQuery, useLazyGetAppointmentIssueSubcategoriesQuery, getAppointmentIssueSubcategoriesSelectors, useGetNodeNamesQuery, getNodeNamesSelectors, useGetDriverNamesQuery, getDriverNamesSelectors, getPeopleSelectors, useUpdateLoadV1Mutation, useGetCarriersQuery, getCarriersSelectors, } from "../../redux";
27
- import { LocationFormSales } from "../locationsForm";
28
- import { LocationInputCell, LocationCell, LocationInput } from "../quote";
29
29
  const KEYS_MAP = {
30
30
  stopNumber: "stop_number",
31
31
  shipConsType: "ship_cons_type",
@@ -41,10 +41,12 @@ const KEYS_MAP = {
41
41
  /**
42
42
  * LepShipcons
43
43
  *
44
+ * @param root0
45
+ * @param root0.quoteRoute
44
46
  * @returns {null} LepShipcons
45
47
  */
46
48
  export function LepShipcons({ quoteRoute }) {
47
- const { id } = useParams();
49
+ const id = useContext(LoadIDContext);
48
50
  const params = {
49
51
  filters: JSON.stringify([
50
52
  { name: "ship_cons.load_id", comparison: "eq", value: id },
@@ -70,10 +72,7 @@ export function LepShipcons({ quoteRoute }) {
70
72
  if (isLoading || isFetchingContacts || isFetching || isLoadingLoad) {
71
73
  return (_jsxs(Box, { height: "100%", children: [_jsx(Box, { display: "flex", sx: {
72
74
  mb: 1,
73
- }, children: _jsx(Box, { ml: { xs: "0", lg: "auto" }, children: _jsxs(Grid, { container: true, spacing: 1, alignItems: "center", children: [_jsx(Grid, { xs: 12, md: "auto", children: _jsx(Skeleton, { variant: "rectangular", width: 160, height: 35 }) }), _jsx(Grid, { xs: 12, md: "auto", children: _jsx(Skeleton, { variant: "rectangular", width: 160, height: 35 }) }), _jsx(Grid, { xs: 12, md: "auto", children: _jsx(Skeleton, { variant: "rectangular", width: 100, height: 35 }) })] }) }) }), _jsx(Skeleton, { variant: "rectangular", width: "100%", height: 80 }), _jsx(Box, { display: "flex", sx: {
74
- mt: 2,
75
- mb: 1,
76
- }, children: _jsx(Skeleton, { variant: "rectangular", width: 92, height: 28 }) })] }));
75
+ }, children: _jsxs(Grid, { container: true, spacing: 1, alignItems: "center", width: "100%", children: [_jsx(Grid, { xs: 12, sm: "auto", children: _jsx(Skeleton, { variant: "rectangular", width: 160, height: 35 }) }), _jsx(Grid, { xs: 12, sm: "auto", children: _jsx(Skeleton, { variant: "rectangular", width: 160, height: 35 }) }), _jsx(Grid, { xs: 12, sm: "auto", ml: { xs: "0", sm: "auto" }, children: _jsx(Skeleton, { variant: "rectangular", width: 100, height: 35 }) })] }) }), _jsx(Skeleton, { variant: "rectangular", width: "100%", height: 80 })] }));
77
76
  }
78
77
  else
79
78
  return _jsx(Content, { quoteRoute: quoteRoute });
@@ -81,6 +80,8 @@ export function LepShipcons({ quoteRoute }) {
81
80
  /**
82
81
  * LepShipcons
83
82
  *
83
+ * @param root0
84
+ * @param root0.quoteRoute
84
85
  * @returns {null} LepShipcons
85
86
  */
86
87
  function Content({ quoteRoute }) {
@@ -89,7 +90,7 @@ function Content({ quoteRoute }) {
89
90
  const [updateShipcon] = useUpdateShipconV1Mutation();
90
91
  const [deleteShipcon] = useDeleteShipconV1Mutation();
91
92
  const [reorderShipcons] = useReorderShipconsMutation();
92
- const { id } = useParams();
93
+ const id = useContext(LoadIDContext);
93
94
  const params = {
94
95
  filters: JSON.stringify([
95
96
  { name: "ship_cons.load_id", comparison: "eq", value: id },
@@ -108,6 +109,7 @@ function Content({ quoteRoute }) {
108
109
  const [issueShipconID, setIssueShipconID] = useState();
109
110
  const [showIssuesShipconID, setShowIssuesShipconID] = useState(null);
110
111
  const [stagedShipcon, setStagedShipcon] = useState(null);
112
+ const [open, setOpen] = useState(false);
111
113
  const [scheduleEmailStagedShipcon, setScheduleEmailStagedShipcon] = useState(null);
112
114
  const [anchorEl, setAnchorEl] = useState(null);
113
115
  const [createNote] = useShipconCreateUserNoteMutation();
@@ -212,6 +214,7 @@ function Content({ quoteRoute }) {
212
214
  return {
213
215
  shipconID: s.id,
214
216
  task,
217
+ loadID: Number(id),
215
218
  };
216
219
  };
217
220
  useEffect(() => {
@@ -221,11 +224,7 @@ function Content({ quoteRoute }) {
221
224
  const item = test(s);
222
225
  tasks = { ...tasks, [item.shipconID]: item.task };
223
226
  });
224
- dispatch(setShipconsTasks(tasks));
225
- setTimeout(() => apiRef.current?.autosizeColumns({
226
- includeHeaders: true,
227
- includeOutliers: true,
228
- }), 200);
227
+ dispatch(setShipconsTasks({ loadID: Number(id), tasks: tasks }));
229
228
  }
230
229
  }, [shipcons]);
231
230
  const handleDeleteShipcon = (id) => {
@@ -238,47 +237,55 @@ function Content({ quoteRoute }) {
238
237
  reorderShipcons(rowsClone.map((r) => r.id));
239
238
  }, [shipcons]);
240
239
  const columns = useMemo(() => [
240
+ {
241
+ ...GRID_REORDER_COL_DEF,
242
+ width: 20,
243
+ },
241
244
  {
242
245
  field: "stopNumber",
243
- headerName: "Stop #",
246
+ headerName: "#",
244
247
  editable: true,
245
248
  sortable: false,
249
+ width: 30,
246
250
  },
247
251
  {
248
252
  field: "shipConsType",
249
- headerName: "Kind",
253
+ headerName: "T",
250
254
  type: "singleSelect",
251
255
  editable: true,
252
256
  valueOptions: [
253
- { value: "shipper", label: "Shipper" },
254
- { value: "consignee", label: "Consignee" },
257
+ { value: "shipper", label: "S" },
258
+ { value: "consignee", label: "C" },
255
259
  ],
256
260
  sortable: false,
261
+ width: 30,
257
262
  },
258
263
  {
259
264
  field: "dropStop",
260
- headerName: "Drop Stop",
265
+ headerName: "Dr",
261
266
  type: "boolean",
262
267
  renderCell(params) {
263
268
  return params.value ? (_jsx("i", { className: "fa-solid fa-check" })) : (_jsx("i", { className: "fa-solid fa-xmark" }));
264
269
  },
265
270
  editable: true,
266
271
  sortable: false,
272
+ width: 30,
267
273
  },
268
274
  {
269
275
  field: "standbyAppointment",
270
- headerName: "Standby apt",
276
+ headerName: "Sby",
271
277
  type: "boolean",
272
278
  renderCell(params) {
273
279
  return params.value ? (_jsx("i", { className: "fa-solid fa-check" })) : (_jsx("i", { className: "fa-solid fa-xmark" }));
274
280
  },
275
281
  editable: true,
276
282
  sortable: false,
283
+ width: 30,
277
284
  },
278
285
  {
279
286
  field: "stopDate",
280
287
  headerName: "Date",
281
- minWidth: 162,
288
+ width: 110,
282
289
  editable: true,
283
290
  renderCell: (p) => p.row.stopDate
284
291
  ? DateTime.fromISO(p.row.stopDate).toUTC().toFormat("LL/dd/yyyy")
@@ -293,7 +300,7 @@ function Content({ quoteRoute }) {
293
300
  field: "timeFrom",
294
301
  headerName: "From",
295
302
  editable: true,
296
- minWidth: 102,
303
+ width: 100,
297
304
  renderCell: (p) => p.row.timeFrom
298
305
  ? DateTime.fromISO(p.row.timeFrom).toUTC().toFormat("HH:mm")
299
306
  : "",
@@ -307,7 +314,7 @@ function Content({ quoteRoute }) {
307
314
  field: "timeTo",
308
315
  headerName: "To",
309
316
  editable: true,
310
- minWidth: 102,
317
+ width: 100,
311
318
  renderCell: (p) => p.row.timeTo
312
319
  ? DateTime.fromISO(p.row.timeTo).toUTC().toFormat("HH:mm")
313
320
  : "",
@@ -354,7 +361,7 @@ function Content({ quoteRoute }) {
354
361
  return { ...params.row, locationID: 0 };
355
362
  },
356
363
  editable: true,
357
- minWidth: 250,
364
+ width: 200,
358
365
  cellClassName: (p) => `ShipconsTaskItem-${p.id}-location`,
359
366
  sortable: false,
360
367
  },
@@ -373,6 +380,7 @@ function Content({ quoteRoute }) {
373
380
  type: "string",
374
381
  editable: true,
375
382
  sortable: false,
383
+ width: 65,
376
384
  },
377
385
  {
378
386
  field: "city",
@@ -380,6 +388,7 @@ function Content({ quoteRoute }) {
380
388
  type: "string",
381
389
  editable: false,
382
390
  sortable: false,
391
+ width: 90,
383
392
  },
384
393
  {
385
394
  field: "state",
@@ -387,6 +396,7 @@ function Content({ quoteRoute }) {
387
396
  type: "string",
388
397
  editable: false,
389
398
  sortable: false,
399
+ width: 30,
390
400
  },
391
401
  {
392
402
  field: "referenceNumber",
@@ -395,6 +405,8 @@ function Content({ quoteRoute }) {
395
405
  editable: true,
396
406
  cellClassName: (p) => `ShipconsTaskItem-${p.id}-referenceNumber`,
397
407
  sortable: false,
408
+ flex: 1,
409
+ minWidth: 190,
398
410
  },
399
411
  {
400
412
  field: "confirmationNumber",
@@ -402,12 +414,14 @@ function Content({ quoteRoute }) {
402
414
  type: "string",
403
415
  editable: true,
404
416
  sortable: false,
417
+ flex: 1,
418
+ minWidth: 190,
405
419
  },
406
420
  {
407
421
  field: "actions",
408
422
  type: "actions",
409
423
  headerName: "Actions",
410
- width: 100,
424
+ width: 60,
411
425
  cellClassName: "actions",
412
426
  getActions: ({ row }) => [
413
427
  _jsx(GridActionsCellItem, { showInMenu: true, icon: _jsx("i", { className: "fa-duotone fa-notes" }), label: "Show Appointment Notes", onClick: () => {
@@ -440,7 +454,7 @@ function Content({ quoteRoute }) {
440
454
  {
441
455
  field: "appointmentIssues",
442
456
  headerName: "Issues",
443
- width: 60,
457
+ width: 30,
444
458
  cellClassName: "actions",
445
459
  renderCell(params) {
446
460
  const [anchorEl, setAnchorEl] = useState(null);
@@ -483,34 +497,34 @@ function Content({ quoteRoute }) {
483
497
  }, 100);
484
498
  }
485
499
  };
486
- return (_jsxs(Box, { sx: { display: "grid", width: "100%" }, children: [_jsx(Box, { display: "flex", sx: {
500
+ return (_jsxs(Box, { width: "100%", children: [_jsx(Box, { sx: {
487
501
  mb: 1,
488
- }, children: _jsx(ActionBar, { quoteRoute: quoteRoute }) }), _jsx(LepStyledDataGrid, { loading: isFetching, rows: shipcons, autoHeight: true, rowReordering: true, onRowOrderChange: handleRowOrderChange, hideFooter: true, apiRef: apiRef, editMode: "row", onCellClick: (e) => {
489
- if (apiRef.current.isCellEditable(e) &&
490
- apiRef.current.getRowMode(e.id) === "view")
491
- apiRef.current?.startRowEditMode({ id: e.id });
492
- }, processRowUpdate: onRowUpdate, density: "compact", initialState: {
493
- pinnedColumns: {
494
- right: ["actions", "appointmentIssues"],
495
- },
496
- }, columns: columns, getRowClassName: (params) => {
497
- if (params.row.quoteCity?.toLowerCase() !=
498
- params.row.city?.toLowerCase() ||
499
- params.row.quoteState != params.row.state ||
500
- params.row.quoteZip != params.row.zip)
501
- return "grid-row-red";
502
- else if (!params.row.locationID ||
503
- !params.row.stopDate ||
504
- (params.row.shipConsType == "shipper" && !params.row.timeTo) ||
505
- !params.row.timeFrom ||
506
- !params.row.referenceNumber) {
507
- return "grid-row-yellow";
508
- }
509
- else if (!params.row.address?.verified)
510
- return "grid-row-green";
511
- else
512
- return "";
513
- } }), _jsx(LocationFormSales, { onCreateLocation: handleSaveLocation, onSaveLocation: handleSaveLocation, open: locationFormOpen.open, place: locationFormOpen.place, onClose: () => setLocationFormOpen({ open: false }) }), _jsx(AptNotes, { close: () => setAptNotesShipConID(null), shipConID: aptNotesShipConID }), _jsx(LocationContact, { locationID: contactLocationID, close: () => setContactLocationID(null) }), _jsx(LocationNotes, { locationID: notesLocationID, close: () => setNotesLocationID(null) }), _jsx(AppointmentIssueForm, { shipconID: issueShipconID, loadID: Number.isNaN(Number(id)) ? undefined : Number(id), close: () => setIssueShipconID(undefined) }), _jsx(AppointmentIssues, { shipconID: showIssuesShipconID, close: () => setShowIssuesShipconID(null) }), _jsx(ScheduleEmail, { shipcon: scheduleEmailStagedShipcon, close: () => setScheduleEmailStagedShipcon(null), shipcons: shipcons }), _jsxs(Menu, { anchorEl: anchorEl, open: openSchedulingMenu, onClose: handleClose, slotProps: {
502
+ }, children: _jsx(ActionBar, { quoteRoute: quoteRoute }) }), _jsxs(Box, { display: "flex", gap: 0.5, width: "100%", children: [_jsxs(Box, { sx: { display: "grid", gap: 1, width: "100%" }, children: [_jsx(LepStyledDataGrid, { sx: { flexGrow: 1 }, loading: isFetching, rows: shipcons, autoHeight: true, rowReordering: true, onRowOrderChange: handleRowOrderChange, hideFooter: true, apiRef: apiRef, editMode: "row", onCellClick: (e) => {
503
+ if (apiRef.current.isCellEditable(e) &&
504
+ apiRef.current.getRowMode(e.id) === "view")
505
+ apiRef.current?.startRowEditMode({ id: e.id });
506
+ }, processRowUpdate: onRowUpdate, density: "compact", initialState: {
507
+ pinnedColumns: {
508
+ right: ["actions", "appointmentIssues"],
509
+ },
510
+ }, columns: columns, getRowClassName: (params) => {
511
+ if (params.row.quoteCity?.toLowerCase() !=
512
+ params.row.city?.toLowerCase() ||
513
+ params.row.quoteState != params.row.state ||
514
+ params.row.quoteZip != params.row.zip)
515
+ return "grid-row-red";
516
+ else if (!params.row.locationID ||
517
+ !params.row.stopDate ||
518
+ (params.row.shipConsType == "shipper" && !params.row.timeTo) ||
519
+ !params.row.timeFrom ||
520
+ !params.row.referenceNumber) {
521
+ return "grid-row-yellow";
522
+ }
523
+ else if (!params.row.address?.verified)
524
+ return "grid-row-green";
525
+ else
526
+ return "";
527
+ } }), _jsx(AddStop, { open: open, close: () => setOpen(false) })] }), _jsx(Button, { size: "sm", variant: "soft", onClick: () => setOpen(true), children: _jsx("i", { className: "fa-solid fa-plus" }) })] }), _jsx(LocationFormSales, { onCreateLocation: handleSaveLocation, onSaveLocation: handleSaveLocation, open: locationFormOpen.open, place: locationFormOpen.place, onClose: () => setLocationFormOpen({ open: false }) }), _jsx(AptNotes, { close: () => setAptNotesShipConID(null), shipConID: aptNotesShipConID }), _jsx(LocationContact, { locationID: contactLocationID, close: () => setContactLocationID(null) }), _jsx(LocationNotes, { locationID: notesLocationID, close: () => setNotesLocationID(null) }), _jsx(AppointmentIssueForm, { shipconID: issueShipconID, loadID: Number.isNaN(Number(id)) ? undefined : Number(id), close: () => setIssueShipconID(undefined) }), _jsx(AppointmentIssues, { shipconID: showIssuesShipconID, close: () => setShowIssuesShipconID(null) }), _jsx(ScheduleEmail, { shipcon: scheduleEmailStagedShipcon, close: () => setScheduleEmailStagedShipcon(null), shipcons: shipcons }), _jsxs(Menu, { anchorEl: anchorEl, open: openSchedulingMenu, onClose: handleClose, slotProps: {
514
528
  paper: {
515
529
  elevation: 1,
516
530
  },
@@ -550,6 +564,11 @@ function Content({ quoteRoute }) {
550
564
  setShowIssuesShipconID(stagedShipcon?.id || null);
551
565
  }, children: [_jsx(ListItemIcon, { children: _jsx("i", { className: "fa-duotone fa-circle-exclamation" }) }), t("components:lepShipcons.view_appointment_issues")] })] })] }));
552
566
  }
567
+ const FROM = [
568
+ "cs@whitearrow.com",
569
+ "scheduling@whitearrow.com",
570
+ "logistics@whitearrow.com",
571
+ ];
553
572
  const ScheduleEmail = ({ shipcon, shipcons, close, }) => {
554
573
  const { t } = useTranslation("common", { i18n: salesKitI18n });
555
574
  const dispatch = useDispatch();
@@ -615,7 +634,7 @@ const ScheduleEmail = ({ shipcon, shipcons, close, }) => {
615
634
  setEmail(e.target.value);
616
635
  const isValid = await NerdEmailValidator(e.target.value);
617
636
  setIsEmailValid(isValid);
618
- } })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.subject") }), _jsx(Input, { value: subject, onChange: (e) => setSubject(e.target.value) })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.from_email") }), _jsxs(Select, { value: fromEmail, onChange: (_e, v) => setFromEmail(v), children: [_jsx(Option, { value: "cs@whitearrow.com", children: "cs@whitearrow.com" }), _jsx(Option, { value: "scheduling@whitearrow.com", children: "scheduling@whitearrow.com" })] })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.file") }), _jsx(Autocomplete, { value: selectedFiles, onChange: (_e, v) => setSelectedFiles(v), multiple: true, options: files?.filter((f) => ["PickUp Document", "Location Form"].includes(f.description)) || [], getOptionLabel: (o) => o.name, renderOption: (props, option) => (_createElement(AutocompleteOption, { ...props, key: option.id },
637
+ } })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.subject") }), _jsx(Input, { value: subject, onChange: (e) => setSubject(e.target.value) })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.from_email") }), _jsx(Select, { value: fromEmail, onChange: (_e, v) => setFromEmail(v), children: FROM.map((a) => (_jsx(Option, { value: a, children: a }, a))) })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.file") }), _jsx(Autocomplete, { value: selectedFiles, onChange: (_e, v) => setSelectedFiles(v), multiple: true, options: files?.filter((f) => ["PickUp Document", "Location Form"].includes(f.description)) || [], getOptionLabel: (o) => o.name, renderOption: (props, option) => (_createElement(AutocompleteOption, { ...props, key: option.id },
619
638
  _jsxs(ListItemContent, { sx: { fontSize: "sm" }, children: [_jsx("b", { children: option.description }), _jsxs(Typography, { level: "body-xs", children: ["(", option.name, ")"] })] }))) })] }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("components:lepShipcons.message") }), _jsx(Textarea, { value: message, onChange: (e) => setMessage(e.target.value), minRows: 8 })] }) })] }), _jsxs(Box, { sx: {
620
639
  display: "flex",
621
640
  gap: 1,
@@ -625,7 +644,10 @@ const ScheduleEmail = ({ shipcon, shipcons, close, }) => {
625
644
  }, children: [_jsx(Button, { onClick: close, color: "neutral", variant: "soft", children: t("global.Cancel") }), _jsx(Button, { loading: isLoading, disabled: !email || !fromEmail, onClick: () => {
626
645
  if (email && fromEmail)
627
646
  sendEmail({
628
- cc: `${fromEmail}${currentUser?.email ? `, ${currentUser.email}` : ""}`,
647
+ cc: `${fromEmail}${currentUser?.email &&
648
+ fromEmail == "scheduling@whitearrow.com"
649
+ ? `, ${currentUser.email}`
650
+ : ""}`,
629
651
  email,
630
652
  file_ids: selectedFiles.map((f) => f.id).toString(),
631
653
  from: fromEmail,
@@ -648,7 +670,7 @@ const ScheduleEmail = ({ shipcon, shipcons, close, }) => {
648
670
  .catch(() => {
649
671
  return;
650
672
  });
651
- }, startDecorator: _jsx("i", { className: "fa-solid fa-paper-plane-top" }), children: t("send") })] })] }) }));
673
+ }, startDecorator: _jsx("i", { className: "fa-solid fa-paper-plane-top" }), children: t("global.send") })] })] }) }));
652
674
  };
653
675
  const AppointmentIssues = ({ shipconID, close, }) => {
654
676
  const { t } = useTranslation("common", { i18n: salesKitI18n });
@@ -717,19 +739,22 @@ const AppointmentIssues = ({ shipconID, close, }) => {
717
739
  }, children: _jsx(Button, { onClick: close, color: "neutral", variant: "soft", children: t("global.Cancel") }) })] })) }) }));
718
740
  };
719
741
  const AddStop = ({ open, close }) => {
720
- const { id } = useParams();
742
+ const _id = useContext(LoadIDContext);
743
+ const id = useMemo(() => Number(_id), []);
721
744
  const params = {
722
745
  filters: JSON.stringify([
723
746
  { name: "ship_cons.load_id", comparison: "eq", value: id },
724
747
  ]),
725
748
  sorter: JSON.stringify([{ name: "ship_cons.stop_number", asc: true }]),
726
749
  };
750
+ const recalculateBody = useSelector(quoteRecalculateBodySelector(Number(id)));
727
751
  const { data: load } = useGetLoadQuery(Number(id), { skip: !id || !open });
728
752
  const { t } = useTranslation("common", { i18n: salesKitI18n });
729
753
  const [zip, setZip] = useState("");
730
754
  const [locationID, setLocationID] = useState();
731
755
  const [type, setType] = useState("shipper");
732
756
  const [dropStop, setDropStop] = useState(false);
757
+ const [otr, setOTR] = useState(recalculateBody.otr_pickup);
733
758
  const [createShipcon, { isLoading }] = useCreateShipconV1Mutation();
734
759
  useGetShipconsQuery(params);
735
760
  const selectAllShipcons = useMemo(() => getShipconsSelectors(params).selectAll, [params]);
@@ -740,7 +765,11 @@ const AddStop = ({ open, close }) => {
740
765
  setType("shipper");
741
766
  setZip("");
742
767
  setLocationID(undefined);
768
+ setOTR(recalculateBody.otr_pickup);
743
769
  };
770
+ useEffect(() => {
771
+ setOTR(recalculateBody.otr_pickup);
772
+ }, [recalculateBody.otr_pickup]);
744
773
  const handleCreate = () => {
745
774
  const stopNumber = shipcons?.reduce((prev, current) => {
746
775
  if (prev?.stopNumber && current?.stopNumber) {
@@ -764,6 +793,7 @@ const AddStop = ({ open, close }) => {
764
793
  load_id: load?.id,
765
794
  quote_id: load?.quoteID,
766
795
  stop_number: stopNumber + 1,
796
+ otr_shipper: type == "shipper" ? otr : undefined,
767
797
  },
768
798
  })
769
799
  .unwrap()
@@ -788,7 +818,7 @@ const AddStop = ({ open, close }) => {
788
818
  maxHeight: "initial",
789
819
  width: "initial",
790
820
  },
791
- }), children: [_jsx(Typography, { id: "modal-dialog-title", level: "h2", children: t("components:lepShipcons.add_stop") }), _jsxs(Grid, { container: true, spacing: 1, overflow: "auto", height: "100%", children: [_jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("entities:load.attributes.type") }), _jsxs(Select, { value: type, onChange: (_e, v) => setType(v), children: [_jsx(Option, { value: "shipper", children: t("components:lepShipcons.shipper") }), _jsx(Option, { value: "consignee", children: t("components:lepShipcons.consignee") })] })] }) }), _jsx(Grid, { xs: 12, mt: 1, mb: 1, children: _jsx(FormControl, { children: _jsx(Checkbox, { label: t("components:lepShipcons.drop_stop"), checked: dropStop, onChange: (e) => setDropStop(e.target.checked) }) }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("entities:customer.attributes.zip") }), _jsx(Input, { type: "number", value: zip, onChange: (e) => setZip(e.target.value) })] }) }), _jsx(Grid, { xs: 12, children: _jsx(LocationInput, { zip: zip, locationID: locationID, onChange: (l) => {
821
+ }), children: [_jsx(Typography, { id: "modal-dialog-title", level: "h2", children: t("components:lepShipcons.add_stop") }), _jsxs(Grid, { container: true, spacing: 1, overflow: "auto", height: "100%", children: [_jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("entities:load.attributes.type") }), _jsxs(Select, { value: type, onChange: (_e, v) => setType(v), children: [_jsx(Option, { value: "shipper", children: t("components:lepShipcons.shipper") }), _jsx(Option, { value: "consignee", children: t("components:lepShipcons.consignee") })] })] }) }), _jsx(Grid, { xs: "auto", mt: 1, mb: 1, children: _jsx(FormControl, { children: _jsx(Checkbox, { label: t("components:lepShipcons.drop_stop"), checked: dropStop, onChange: (e) => setDropStop(e.target.checked) }) }) }), _jsx(Grid, { xs: "auto", mt: 1, mb: 1, children: _jsx(FormControl, { children: _jsx(Checkbox, { disabled: type == "consignee", label: t("entities:quote.others.otr_pickup"), checked: otr, onChange: (e) => setOTR(e.target.checked) }) }) }), _jsx(Grid, { xs: 12, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: t("entities:customer.attributes.zip") }), _jsx(Input, { type: "number", value: zip, onChange: (e) => setZip(e.target.value) })] }) }), _jsx(Grid, { xs: 12, children: _jsx(LocationInput, { zip: zip, locationID: locationID, onChange: (l) => {
792
822
  if (l) {
793
823
  setLocationID(l.id);
794
824
  if (locationEntityTypeGuard(l)) {
@@ -1199,9 +1229,9 @@ const renderComplexRow = (props) => {
1199
1229
  };
1200
1230
  const ActionBar = ({ quoteRoute }) => {
1201
1231
  const { t } = useTranslation("common", { i18n: salesKitI18n });
1202
- const { id } = useParams();
1232
+ const id = useContext(LoadIDContext);
1203
1233
  const dispatch = useDispatch();
1204
- const recalculateBody = useSelector(quoteRecalculateBodySelector);
1234
+ const recalculateBody = useSelector(quoteRecalculateBodySelector(Number(id)));
1205
1235
  const { data: load } = useGetLoadQuery(Number(id), {
1206
1236
  skip: Number.isNaN(Number(id)),
1207
1237
  });
@@ -1232,7 +1262,6 @@ const ActionBar = ({ quoteRoute }) => {
1232
1262
  const [_updateLoad, { isLoading }] = useUpdateLoadV1Mutation({
1233
1263
  fixedCacheKey: "shared-load-update",
1234
1264
  });
1235
- const [open, setOpen] = useState(false);
1236
1265
  const lastStopDate = useMemo(() => shipcons.find((s) => s.stopDate !== undefined)?.stopDate, [shipcons]);
1237
1266
  const updateLoad = useCallback((fieldV1, fieldV3, value) => {
1238
1267
  if (load?.id)
@@ -1247,112 +1276,132 @@ const ActionBar = ({ quoteRoute }) => {
1247
1276
  .unwrap()
1248
1277
  .catch(() => {
1249
1278
  dispatch(setRecalculateBody({
1250
- ...recalculateBody,
1251
- [fieldV1]: load[fieldV3],
1279
+ id: load.id,
1280
+ body: {
1281
+ ...recalculateBody,
1282
+ [fieldV1]: load[fieldV3],
1283
+ },
1252
1284
  }));
1253
1285
  return;
1254
1286
  });
1255
1287
  }, [load, recalculateBody]);
1256
1288
  const checkContacts = useCallback(() => {
1257
- if (recalculateBody.person_ids && recalculateBody.person_ids.length > 0)
1258
- dispatch(addLoadInfoTask({
1259
- task: {
1260
- order: 1,
1261
- label: "Customer contacts selected",
1262
- status: "success",
1263
- uuid: nanoid(),
1264
- },
1265
- field: "contacts",
1266
- }));
1267
- else {
1268
- dispatch(addLoadInfoTask({
1269
- task: {
1270
- order: 1,
1271
- label: "Please select at least one customer contact",
1272
- status: "danger",
1273
- uuid: nanoid(),
1274
- step: {
1275
- content: "Please select at least one customer contact",
1276
- selector: ".LoadInfoTaskItem-contacts",
1289
+ if (load?.id)
1290
+ if (recalculateBody.person_ids && recalculateBody.person_ids.length > 0)
1291
+ dispatch(addLoadInfoTask({
1292
+ loadID: load.id,
1293
+ task: {
1294
+ order: 1,
1295
+ label: "Customer contacts selected",
1296
+ status: "success",
1297
+ uuid: nanoid(),
1277
1298
  },
1278
- tabIndex: 0,
1279
- },
1280
- field: "contacts",
1281
- }));
1282
- }
1283
- }, [recalculateBody]);
1299
+ field: "contacts",
1300
+ }));
1301
+ else {
1302
+ dispatch(addLoadInfoTask({
1303
+ loadID: load.id,
1304
+ task: {
1305
+ order: 1,
1306
+ label: "Please select at least one customer contact",
1307
+ status: "danger",
1308
+ uuid: nanoid(),
1309
+ step: {
1310
+ content: "Please select at least one customer contact",
1311
+ selector: ".LoadInfoTaskItem-contacts",
1312
+ },
1313
+ tabIndex: 0,
1314
+ },
1315
+ field: "contacts",
1316
+ }));
1317
+ }
1318
+ }, [recalculateBody, load]);
1284
1319
  const checkCSR = useCallback(() => {
1285
- if (recalculateBody.booked_by_id) {
1286
- dispatch(addLoadInfoTask({
1287
- task: {
1288
- order: 0,
1289
- label: "CSR selected",
1290
- status: "success",
1291
- uuid: nanoid(),
1292
- },
1293
- field: "bookedBy",
1294
- }));
1295
- }
1296
- else {
1297
- dispatch(addLoadInfoTask({
1298
- task: {
1299
- order: 0,
1300
- label: "Please select a CSR",
1301
- status: "danger",
1302
- uuid: nanoid(),
1303
- step: {
1304
- content: "Please select a CSR",
1305
- selector: ".LoadInfoTaskItem-bookedBy",
1320
+ if (load?.id)
1321
+ if (recalculateBody.booked_by_id) {
1322
+ dispatch(addLoadInfoTask({
1323
+ loadID: load.id,
1324
+ task: {
1325
+ order: 0,
1326
+ label: "CSR selected",
1327
+ status: "success",
1328
+ uuid: nanoid(),
1306
1329
  },
1307
- tabIndex: 0,
1308
- },
1309
- field: "bookedBy",
1310
- }));
1311
- }
1312
- }, [recalculateBody]);
1330
+ field: "bookedBy",
1331
+ }));
1332
+ }
1333
+ else {
1334
+ dispatch(addLoadInfoTask({
1335
+ loadID: load.id,
1336
+ task: {
1337
+ order: 0,
1338
+ label: "Please select a CSR",
1339
+ status: "danger",
1340
+ uuid: nanoid(),
1341
+ step: {
1342
+ content: "Please select a CSR",
1343
+ selector: ".LoadInfoTaskItem-bookedBy",
1344
+ },
1345
+ tabIndex: 0,
1346
+ },
1347
+ field: "bookedBy",
1348
+ }));
1349
+ }
1350
+ }, [recalculateBody, load]);
1313
1351
  useEffect(() => {
1314
1352
  checkCSR();
1315
1353
  checkContacts();
1316
1354
  }, [recalculateBody.booked_by_id, recalculateBody.person_ids]);
1317
- return (_jsxs(_Fragment, { children: [_jsx(AddStop, { open: open, close: () => setOpen(false) }), _jsxs(Grid, { container: true, spacing: 1, width: "100%", sx: {
1318
- alignItems: "start",
1319
- }, children: [_jsx(Grid, { children: _jsxs(Button, { size: "sm", variant: "soft", color: "neutral", onClick: () => setOpen(true), children: [_jsx("i", { className: "fa-solid fa-location-dot pright" }), t("components:lepShipcons.add_stop")] }) }), _jsxs(Grid, { xs: 12, md: "auto", ml: { xs: undefined, lg: "auto" }, container: true, alignItems: "center", children: [_jsx(Grid, { xs: 12, md: "auto", children: _jsx(FormLabel, { children: t("components:lepShipcons.booked_by") }) }), _jsx(Grid, { xs: 12, md: "auto", children: _jsx(Autocomplete, { className: "LoadInfoTaskItem-bookedBy", error: !recalculateBody.booked_by_id, sx: {
1320
- maxWidth: 300,
1321
- }, loading: isFetching, options: csrs || [], getOptionLabel: (p) => {
1322
- return p ? new Person(p).name() : "";
1323
- }, size: "sm", value: csrs.find((c) => c.id === recalculateBody.booked_by_id) || null, onChange: (_e, v) => {
1355
+ return (_jsxs(Grid, { container: true, spacing: 1, width: "100%", alignItems: "start", justifyContent: "space-between", children: [_jsxs(Grid, { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 0.5, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: 0.5, children: [_jsx(FormLabel, { sx: {
1356
+ display: "inline",
1357
+ }, children: t("components:lepShipcons.booked_by") }), _jsx(Autocomplete, { className: "LoadInfoTaskItem-bookedBy", error: !recalculateBody.booked_by_id, sx: {
1358
+ maxWidth: 300,
1359
+ }, loading: isFetching, options: csrs || [], getOptionLabel: (p) => {
1360
+ return p ? new Person(p).name() : "";
1361
+ }, size: "sm", value: csrs.find((c) => c.id === recalculateBody.booked_by_id) || null, onChange: (_e, v) => {
1362
+ if (load?.id)
1324
1363
  dispatch(setRecalculateBody({
1325
- ...recalculateBody,
1326
- booked_by_id: v?.id || undefined,
1364
+ id: load.id,
1365
+ body: {
1366
+ ...recalculateBody,
1367
+ booked_by_id: v?.id || undefined,
1368
+ },
1327
1369
  }));
1328
- updateLoad("booked_by_id", "bookedByID", v?.id || null);
1329
- } }) })] }), _jsxs(Grid, { xs: 12, md: "auto", container: true, alignItems: "center", children: [_jsx(Grid, { xs: 12, md: "auto", children: _jsx(FormLabel, { children: t("components:lepShipcons.contacts") }) }), _jsx(Grid, { xs: 12, md: "auto", children: _jsx(Autocomplete, { disableCloseOnSelect: true, className: "LoadInfoTaskItem-contacts", sx: {
1330
- "& .MuiChip-label": {
1331
- maxWidth: 160,
1332
- },
1333
- }, error: !recalculateBody.person_ids ||
1334
- recalculateBody.person_ids.length === 0, loading: isFetchingContacts, options: customerPeople?.map((c) => c.id) || [], getOptionLabel: (id) => customerPeople?.find((c) => c.id === id)?.name || "", getOptionDisabled: (option) => !customerPeople?.find((p) => p.id === option)?.active
1335
- ? true
1336
- : false, renderOption: (props, option) => {
1337
- const person = customerPeople?.find((c) => c.id === option);
1338
- return (_createElement(AutocompleteOption, { ...props, key: person?.id },
1339
- _jsxs(ListItemContent, { sx: { fontSize: "sm", fontWeight: "md" }, children: [person?.name, _jsx(Typography, { level: "body-xs", sx: {
1340
- color: props["aria-disabled"] ? "inherit" : undefined,
1341
- }, children: person?.email })] })));
1342
- }, size: "sm", limitTags: 1, value: recalculateBody.person_ids || [], multiple: true, onChange: (_e, v) => {
1370
+ updateLoad("booked_by_id", "bookedByID", v?.id || null);
1371
+ } })] }), _jsxs(Box, { display: "flex", alignItems: "center", gap: 0.5, children: [_jsx(FormLabel, { sx: {
1372
+ display: "inline",
1373
+ }, children: t("components:lepShipcons.contacts") }), _jsx(Autocomplete, { disableCloseOnSelect: true, className: "LoadInfoTaskItem-contacts", sx: {
1374
+ "& .MuiChip-label": {
1375
+ maxWidth: 160,
1376
+ },
1377
+ maxWidth: 280,
1378
+ }, error: !recalculateBody.person_ids ||
1379
+ recalculateBody.person_ids.length === 0, loading: isFetchingContacts, options: customerPeople?.map((c) => c.id) || [], getOptionLabel: (id) => customerPeople?.find((c) => c.id === id)?.name || "", getOptionDisabled: (option) => !customerPeople?.find((p) => p.id === option)?.active
1380
+ ? true
1381
+ : false, renderOption: (props, option) => {
1382
+ const person = customerPeople?.find((c) => c.id === option);
1383
+ return (_createElement(AutocompleteOption, { ...props, key: person?.id },
1384
+ _jsxs(ListItemContent, { sx: { fontSize: "sm", fontWeight: "md" }, children: [person?.name, _jsx(Typography, { level: "body-xs", sx: {
1385
+ color: props["aria-disabled"] ? "inherit" : undefined,
1386
+ }, children: person?.email })] })));
1387
+ }, size: "sm", limitTags: 1, value: recalculateBody.person_ids || [], multiple: true, onChange: (_e, v) => {
1388
+ if (load?.id)
1343
1389
  dispatch(setRecalculateBody({
1344
- ...recalculateBody,
1345
- person_ids: v,
1390
+ id: load.id,
1391
+ body: {
1392
+ ...recalculateBody,
1393
+ person_ids: v,
1394
+ },
1346
1395
  }));
1347
- }, onBlur: () => {
1348
- if (load?.person_ids !== recalculateBody.person_ids)
1349
- updateLoad("person_ids", "person_ids", recalculateBody.person_ids);
1350
- } }) })] }), quoteRoute ? (_jsx(Grid, { xs: 12, md: "auto", children: _jsx(Button, { loading: isLoading, startDecorator: _jsx("i", { className: "fa-solid fa-arrow-up-right-from-square" }), size: "sm", component: "a", variant: "soft", href: `${quoteRoute}/${load?.quoteID}?date=${lastStopDate
1351
- ? DateTime.fromISO(lastStopDate).toUTC().toMillis()
1352
- : "null"}&serviceLevel=${load?.serviceLevel}`, target: "_blank", rel: "noopener noreferrer", sx: {
1353
- "&:hover": {
1354
- textDecoration: "none",
1355
- },
1356
- }, children: t("components:lepShipcons.open_quote") }) })) : null] })] }));
1396
+ }, onBlur: () => {
1397
+ if (load?.person_ids !== recalculateBody.person_ids)
1398
+ updateLoad("person_ids", "person_ids", recalculateBody.person_ids);
1399
+ } })] })] }), quoteRoute ? (_jsx(Grid, { children: _jsx(Button, { loading: isLoading, startDecorator: _jsx("i", { className: "fa-solid fa-arrow-up-right-from-square" }), size: "sm", component: "a", variant: "soft", href: `${quoteRoute}/${load?.quoteID}?date=${lastStopDate
1400
+ ? DateTime.fromISO(lastStopDate).toUTC().toMillis()
1401
+ : "null"}&serviceLevel=${load?.serviceLevel}`, target: "_blank", rel: "noopener noreferrer", sx: {
1402
+ "&:hover": {
1403
+ textDecoration: "none",
1404
+ },
1405
+ }, children: t("components:lepShipcons.open_quote") }) })) : null] }));
1357
1406
  };
1358
1407
  //# sourceMappingURL=lepShipcons.js.map