@nerdjs/sales-kit 2.0.77 → 2.0.78
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.
- package/dist/hooks/load/loadDetailsStatus.js +2 -4
- package/dist/hooks/load/loadDetailsStatus.js.map +1 -1
- package/dist/hooks/load/loadLastLocation.js +2 -3
- package/dist/hooks/load/loadLastLocation.js.map +1 -1
- package/dist/hooks/load/loadsSearchInput.js +1 -1
- package/dist/hooks/load/loadsSearchInput.js.map +1 -1
- package/dist/hooks/locationsForm/locationsForm.js +30 -19
- package/dist/hooks/locationsForm/locationsForm.js.map +1 -1
- package/dist/hooks/locationsForm/locationsFormSales.js +23 -14
- package/dist/hooks/locationsForm/locationsFormSales.js.map +1 -1
- package/dist/hooks/quote/constants.d.ts +4 -4
- package/dist/hooks/quote/constants.js +12 -5
- package/dist/hooks/quote/constants.js.map +1 -1
- package/dist/hooks/quote/form.js +192 -160
- package/dist/hooks/quote/form.js.map +1 -1
- package/dist/hooks/quote/helpers.d.ts +1 -2
- package/dist/hooks/quote/helpers.js +82 -69
- package/dist/hooks/quote/helpers.js.map +1 -1
- package/dist/hooks/quote/result.js +132 -131
- package/dist/hooks/quote/result.js.map +1 -1
- package/dist/hooks/quote/template.js +21 -22
- package/dist/hooks/quote/template.js.map +1 -1
- package/dist/hooks/statusStepper/statusStepper.js +6 -6
- package/dist/hooks/statusStepper/statusStepper.js.map +1 -1
- package/dist/hooks/tender/form.js +67 -33
- package/dist/hooks/tender/form.js.map +1 -1
- package/dist/hooks/tender/helpers.js +42 -40
- package/dist/hooks/tender/helpers.js.map +1 -1
- package/dist/hooks/tender/template.js +21 -1
- package/dist/hooks/tender/template.js.map +1 -1
- package/dist/redux/quote/quoteReducer.js +4 -2
- package/dist/redux/quote/quoteReducer.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Chip,
|
|
3
|
-
import {
|
|
2
|
+
import { Button, Chip, Table, Typography, LinearProgress, Alert, Link, useColorScheme, Menu, MenuItem, Dropdown, MenuButton, Sheet, useTheme, Box, CircularProgress, Modal, ModalDialog, DialogActions, DialogContent, DialogTitle, Divider, Grid, Tooltip, Accordion, AccordionDetails, AccordionSummary, AccordionGroup, accordionClasses, IconButton, } from "@mui/joy";
|
|
3
|
+
import { alpha, darken, styled } from "@mui/system";
|
|
4
4
|
import { LocalizationProvider, PickersDay, StaticDatePicker, } from "@mui/x-date-pickers";
|
|
5
5
|
import { Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
6
6
|
import { useTranslation } from "react-i18next";
|
|
@@ -9,11 +9,9 @@ import { restartQuote, setCostBreakdownOpen, setFormOpen, setMarketCostOpen, set
|
|
|
9
9
|
import { useLazyGetCostBreakdownQuery, useGetMarketCostQuery, useLazyGetMarketCostQuery, } from "../../redux/quote/quoteEndpoints";
|
|
10
10
|
import { costBreakdownOpenSelector, formOpenSelector, quoteBodySelector, quoteResultSelector, selectedDateSelector, selectedServiceLevelSelector, } from "../../redux/quote/quoteSelector";
|
|
11
11
|
import { SALES_QUOTE_EXPIRATION, CUSTOMER_PORTAL_QUOTE_EXPIRATION, LTL_DOC, TL_DOC, serviceLevelColors, serviceLevelIcons, usdFormatter, } from "./constants";
|
|
12
|
-
import { CalendarMonth, Check, Clear, ExpandMore, Warning, } from "@mui/icons-material";
|
|
13
12
|
import { DateTime } from "luxon";
|
|
14
13
|
import { Link as RouterLink } from "react-router-dom";
|
|
15
14
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
16
|
-
import { grey } from "@mui/material/colors";
|
|
17
15
|
import { useGetCustomerCreditQuery } from "../../redux";
|
|
18
16
|
import { nanoid } from "@reduxjs/toolkit";
|
|
19
17
|
import { CustomAdapterLuxon } from "@nerdjs/nerd-ui";
|
|
@@ -29,8 +27,6 @@ export function QuoteResult(props) {
|
|
|
29
27
|
const response = useSelector(quoteResultSelector);
|
|
30
28
|
const body = useSelector(quoteBodySelector);
|
|
31
29
|
const { t } = useTranslation("salesKit");
|
|
32
|
-
const theme = useTheme();
|
|
33
|
-
const sm = useMediaQuery(theme.breakpoints.down(600));
|
|
34
30
|
const expired = response
|
|
35
31
|
? DateTime.now() >
|
|
36
32
|
DateTime.fromISO(response.createdAt).plus({
|
|
@@ -54,15 +50,19 @@ export function QuoteResult(props) {
|
|
|
54
50
|
flex: 1,
|
|
55
51
|
display: "flex",
|
|
56
52
|
flexDirection: "column",
|
|
57
|
-
p:
|
|
53
|
+
p: { xs: 0, sm: 2 },
|
|
58
54
|
gap: 2,
|
|
59
|
-
}, children: [!customerPortal && (_jsxs(
|
|
55
|
+
}, children: [!customerPortal && (_jsxs(Sheet, { sx: {
|
|
56
|
+
p: 2,
|
|
57
|
+
display: "flex",
|
|
58
|
+
gap: 1,
|
|
59
|
+
borderRadius: "sm",
|
|
60
|
+
boxShadow: "md",
|
|
61
|
+
}, children: [_jsxs(Chip, { startDecorator: _jsx("i", { className: "fa-regular fa-map-location" }), variant: "outlined", color: "neutral", children: [response?.totalMiles, " ", t("miles")] }), _jsxs(Chip, { startDecorator: _jsx("i", { className: "fa-solid fa-timer" }), variant: "outlined", color: "neutral", children: [Math.round(response?.transitTime ?? 0), " ", t("hours")] })] })), !customerPortal && !response?.customerId ? (_jsx(Alert, { color: "warning", variant: "soft", startDecorator: _jsx("i", { className: "fa-solid fa-triangle-exclamation" }), children: "No customer selected, select a customer and run the quote again." })) : null, expired && (_jsx(Alert, { color: "warning", variant: "soft", startDecorator: _jsx("i", { className: "fa-solid fa-triangle-exclamation" }), children: customerPortal
|
|
60
62
|
? 'Quote is expired, click on "Run Quote" to create a new one.'
|
|
61
|
-
: "Quote is expired" })), body.loadId && (_jsxs(Alert, { color: "warning", variant: "soft", startDecorator: _jsx(
|
|
63
|
+
: "Quote is expired" })), body.loadId && (_jsxs(Alert, { color: "warning", variant: "soft", startDecorator: _jsx("i", { className: "fa-solid fa-triangle-exclamation" }), children: ['Quote has already been tendered, click on "Run Quote" to create a new one.', "\u00A0", openLoadLink ? (_jsx(Link, { component: RouterLink, to: openLoadLink, children: "Open Shipment" })) : null] })), _jsx(ServiceLevels, { customerPortal: customerPortal }), _jsx(CostBreakdown, {}), _jsx(Summary, { customerPortal: customerPortal, handleOnTenderLoadClick: handleOnTenderLoadClick }), customerPortal ? (_jsxs(Box, { textAlign: "center", sx: {
|
|
62
64
|
lineHeight: 0.6,
|
|
63
|
-
}, children: [_jsx(
|
|
64
|
-
color: (theme) => theme.palette.warning.main,
|
|
65
|
-
} }) }), _jsxs(MUITypography, { variant: "caption", display: "inline", sx: { opacity: 0.5 }, children: [`${t("quoteRateWarning")} `, _jsx(Link, { sx: { fontSize: "inherit" }, target: "_blank", href: LTL_DOC, children: "LTL" }), " ", "-", " ", _jsx(Link, { sx: { fontSize: "inherit" }, target: "_blank", href: TL_DOC, children: "TL" })] })] })) : null] }) }));
|
|
65
|
+
}, children: [_jsx(Typography, { level: "body-sm", display: "inline", color: "warning", children: _jsx(Box, { className: "fa-duotone fa-circle-info pright", component: "i" }) }), _jsxs(Typography, { level: "body-sm", display: "inline", sx: { opacity: 0.5 }, children: [`${t("quoteRateWarning")} `, _jsx(Link, { sx: { fontSize: "inherit" }, target: "_blank", href: LTL_DOC, children: "LTL" }), " ", "-", " ", _jsx(Link, { sx: { fontSize: "inherit" }, target: "_blank", href: TL_DOC, children: "TL" })] })] })) : null] }) }));
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
*
|
|
@@ -71,8 +71,6 @@ export function QuoteResult(props) {
|
|
|
71
71
|
*/
|
|
72
72
|
function Wrapper(props) {
|
|
73
73
|
const { customerPortal } = props;
|
|
74
|
-
const theme = useTheme();
|
|
75
|
-
const sm = useMediaQuery(theme.breakpoints.down(600));
|
|
76
74
|
const open = useSelector(formOpenSelector("result"));
|
|
77
75
|
const { t } = useTranslation("salesKit");
|
|
78
76
|
const shrink = true;
|
|
@@ -81,11 +79,6 @@ function Wrapper(props) {
|
|
|
81
79
|
const selectedServiceLevel = useSelector(selectedServiceLevelSelector);
|
|
82
80
|
const ref = useRef();
|
|
83
81
|
const dispatch = useDispatch();
|
|
84
|
-
useEffect(() => {
|
|
85
|
-
if (sm) {
|
|
86
|
-
dispatch(setFormOpen({ formID: "result", isOpen: true }));
|
|
87
|
-
}
|
|
88
|
-
}, [sm]);
|
|
89
82
|
useLayoutEffect(() => {
|
|
90
83
|
if (selectedServiceLevel && ref)
|
|
91
84
|
setTimeout(() => {
|
|
@@ -96,21 +89,20 @@ function Wrapper(props) {
|
|
|
96
89
|
});
|
|
97
90
|
}, 60);
|
|
98
91
|
}, [selectedDate, selectedServiceLevel, ref]);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, children: [_jsx(Toolbar, { customerPortal: customerPortal, shrink: shrink }), props.children] }));
|
|
92
|
+
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: open ?? false, onClose: () => dispatch(setFormOpen({ formID: "result", isOpen: false })), sx: {
|
|
93
|
+
display: { xs: "initial", md: "none" },
|
|
94
|
+
}, children: _jsxs(ModalDialog, { layout: "fullscreen", children: [_jsxs(DialogTitle, { component: "div", children: [_jsx(Typography, { level: "h4", sx: {
|
|
95
|
+
display: "inline",
|
|
96
|
+
fontWeight: 600,
|
|
97
|
+
fontSize: shrink ? "22px !important" : "36px !important",
|
|
98
|
+
transition: "font-size .3s ease-in-out",
|
|
99
|
+
}, children: t("Quote") }), "\u00A0", _jsxs(Typography, { display: "inline", level: "body-sm", children: ["#", response?.id] }), customerPortal ? null : (_jsxs(Box, { sx: { display: "flex", gap: 1 }, children: [_jsxs(Button, { onClick: () => dispatch(setMarketCostOpen(true)), size: shrink ? "sm" : "md", variant: "outlined", children: [_jsx("i", { className: "fa-solid fa-money-bill-trend-up pright" }), t("Market")] }), _jsxs(Button, { onClick: () => dispatch(setCostBreakdownOpen(true)), size: shrink ? "sm" : "md", variant: "outlined", children: [_jsx("i", { className: "fa-solid fa-filter-circle-dollar pright" }), t("Breakdown")] })] }))] }), _jsx(DialogContent, { children: props.children }), _jsx(DialogActions, { children: _jsx(Button, { fullWidth: true, variant: "soft", color: "neutral", onClick: () => dispatch(setFormOpen({ formID: "result", isOpen: false })), children: t("Close") }) })] }) }), _jsxs(Box, { ref: ref, sx: {
|
|
100
|
+
height: "100%",
|
|
101
|
+
width: "100%",
|
|
102
|
+
overflow: "auto",
|
|
103
|
+
borderLeft: "solid 1px rgba(155,155,155,0.3)",
|
|
104
|
+
display: { xs: "none", md: "block" },
|
|
105
|
+
}, children: [_jsx(Toolbar, { customerPortal: customerPortal, shrink: shrink }), props.children] })] }));
|
|
114
106
|
}
|
|
115
107
|
/**
|
|
116
108
|
* Service Levels. Displays prices for each service levels
|
|
@@ -124,12 +116,13 @@ function ServiceLevels({ customerPortal }) {
|
|
|
124
116
|
const response = useSelector(quoteResultSelector);
|
|
125
117
|
const selectedServiceLevel = useSelector(selectedServiceLevelSelector);
|
|
126
118
|
const { t } = useTranslation("salesKit");
|
|
119
|
+
const theme = useTheme();
|
|
127
120
|
return (_jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [customerPortal && response ? (_jsx(ServiceLevelsDetails, { quoteResponse: response })) : (_jsx(Box, { sx: { display: "flex", gap: 2 }, children: response?.serviceLevels?.map((l) => {
|
|
128
121
|
const swatch = response.type === "LTL"
|
|
129
|
-
? serviceLevelColors.LTL[l.serviceLevel]
|
|
130
|
-
: serviceLevelColors.TL[l.serviceLevel];
|
|
122
|
+
? serviceLevelColors(theme).LTL[l.serviceLevel]
|
|
123
|
+
: serviceLevelColors(theme).TL[l.serviceLevel];
|
|
131
124
|
const color = swatch[500];
|
|
132
|
-
return (_jsxs(
|
|
125
|
+
return (_jsxs(Sheet, { sx: {
|
|
133
126
|
flex: 1,
|
|
134
127
|
p: 1,
|
|
135
128
|
color,
|
|
@@ -137,29 +130,33 @@ function ServiceLevels({ customerPortal }) {
|
|
|
137
130
|
flexDirection: "column",
|
|
138
131
|
gap: 1,
|
|
139
132
|
background: alpha(color, 0.1),
|
|
133
|
+
borderRadius: "sm",
|
|
134
|
+
boxShadow: "md",
|
|
140
135
|
}, children: [_jsxs(Box, { sx: { textAlign: "center" }, children: [_jsxs(Box, { sx: { display: "flex", gap: 1, justifyContent: "center" }, children: [_jsx("img", { src: l.serviceLevel === "guaranteed"
|
|
141
136
|
? response.getGuaranteedIcon()
|
|
142
137
|
: l.serviceLevel === "premium"
|
|
143
138
|
? response.getPremiumIcon()
|
|
144
|
-
: response.getEconomyIcon(), style: { height: 20 } }), _jsx(Typography, { sx: { textTransform: "capitalize", fontWeight: 500 }, children: l.name })] }), _jsx(Typography, { level: "body-sm", children: l.description })] }), _jsxs(Box, { children: [_jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Base") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.baseRate) })] }), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Fuel") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.fuelRate) })] }), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Extra") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.extra) })] })] }), _jsx(Divider, {}), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsxs(Typography, { level: "body-md", children: [t("Total"), ":"] }), _jsx(Typography, { level: "body-md", children: usdFormatter.format(l.totalRate) })] }), _jsx(
|
|
139
|
+
: response.getEconomyIcon(), style: { height: 20 } }), _jsx(Typography, { sx: { textTransform: "capitalize", fontWeight: 500 }, children: l.name })] }), _jsx(Typography, { level: "body-sm", children: l.description })] }), _jsxs(Box, { children: [_jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Base") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.baseRate) })] }), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Fuel") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.fuelRate) })] }), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsx(Typography, { level: "body-sm", children: t("Extra") }), _jsx(Typography, { level: "body-sm", children: usdFormatter.format(l.extra) })] })] }), _jsx(Divider, { sx: { mt: "auto" } }), _jsxs(Box, { sx: { display: "flex", justifyContent: "space-between" }, children: [_jsxs(Typography, { level: "body-md", children: [t("Total"), ":"] }), _jsx(Typography, { level: "body-md", children: usdFormatter.format(l.totalRate) })] }), _jsx(Button, { onClick: () => {
|
|
145
140
|
dispatch(setSelectedDate(null));
|
|
146
141
|
dispatch(setSelectedServiceLevel(l));
|
|
147
142
|
}, sx: {
|
|
148
143
|
background: color,
|
|
149
144
|
color: "white",
|
|
150
145
|
"&:hover": {
|
|
151
|
-
background: swatch[
|
|
146
|
+
background: swatch[600],
|
|
152
147
|
},
|
|
153
148
|
}, children: _jsxs(Box, { children: [!l.flexible
|
|
154
149
|
? t("Select delivery date")
|
|
155
150
|
: t("Select delivery window"), _jsx("br", {}), _jsxs(Typography, { level: "body-sm", display: "block", sx: { color: "inherit" }, children: [DateTime.fromFormat(l.from, "yyyy-L-d").toFormat(DATE_FORMAT), l.from != l.to
|
|
156
151
|
? ` - ${DateTime.fromFormat(l.to, "yyyy-L-d").toFormat(DATE_FORMAT)}`
|
|
157
152
|
: []] })] }) })] }, l.id));
|
|
158
|
-
}) })), selectedServiceLevel && response ? (_jsx(
|
|
153
|
+
}) })), selectedServiceLevel && response ? (_jsx(Sheet, { sx: {
|
|
159
154
|
overflow: "hidden",
|
|
155
|
+
borderRadius: "sm",
|
|
156
|
+
boxShadow: "md",
|
|
160
157
|
}, children: _jsx(LocalizationProvider, { dateAdapter: CustomAdapterLuxon, children: _jsx(StaticDatePicker, { displayStaticWrapperAs: "desktop", value: DateTime.fromFormat(selectedServiceLevel.from, "yyyy-L-d"), onChange: () => {
|
|
161
158
|
// Empty function
|
|
162
|
-
}, disableHighlightToday: true, renderDay: (date, _s, pickersDayProps) => (_jsx(RenderDay, { date: date, pickersDayProps: pickersDayProps, serviceLevel: selectedServiceLevel, type: response.type }, date.toString())), renderInput: (
|
|
159
|
+
}, disableHighlightToday: true, renderDay: (date, _s, pickersDayProps) => (_jsx(RenderDay, { date: date, pickersDayProps: pickersDayProps, serviceLevel: selectedServiceLevel, type: response.type }, date.toString())), renderInput: () => _jsx(_Fragment, {}), inputFormat: "'Week of' MMM d" }) }) })) : ([])] }));
|
|
163
160
|
}
|
|
164
161
|
/**
|
|
165
162
|
*
|
|
@@ -178,18 +175,12 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
178
175
|
const guaranteed = serviceLevels?.find((s) => s.serviceLevel == "guaranteed");
|
|
179
176
|
return { economy, premium, guaranteed };
|
|
180
177
|
}, [serviceLevels]);
|
|
181
|
-
return (_jsx(
|
|
182
|
-
borderRadius: "
|
|
178
|
+
return (_jsx(Sheet, { sx: {
|
|
179
|
+
borderRadius: "sm",
|
|
180
|
+
boxShadow: "md",
|
|
183
181
|
}, children: _jsxs(Table, { sx: {
|
|
184
182
|
"& td": { textAlign: "center" },
|
|
185
|
-
}, size: "lg", children: [_jsx(
|
|
186
|
-
"& th:first-of-type": {
|
|
187
|
-
borderTopLeftRadius: "10px!important",
|
|
188
|
-
},
|
|
189
|
-
"& th:last-of-type": {
|
|
190
|
-
borderTopRightRadius: "10px!important",
|
|
191
|
-
},
|
|
192
|
-
}, children: [_jsx("th", { style: {
|
|
183
|
+
}, size: "lg", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: {
|
|
193
184
|
width: "50px",
|
|
194
185
|
} }), _jsx("th", { style: {
|
|
195
186
|
width: "125px",
|
|
@@ -199,67 +190,43 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
199
190
|
textAlign: "center",
|
|
200
191
|
}, children: [_jsx("img", { width: 60, alt: "premium", src: quoteResponse.getPremiumIcon() }), _jsx(Typography, { children: premium.name })] })), economy && (_jsxs("th", { style: {
|
|
201
192
|
textAlign: "center",
|
|
202
|
-
}, children: [_jsx("img", { width: 60, alt: "economy", src: quoteResponse.getEconomyIcon() }), _jsx(Typography, { children: economy.name })] }))] }) }), _jsxs(
|
|
203
|
-
"& tr th:first-of-type": {
|
|
204
|
-
borderLeft: `1px solid ${grey[200]}`,
|
|
205
|
-
},
|
|
206
|
-
"& tr td:last-of-type": {
|
|
207
|
-
borderRight: `1px solid ${grey[200]}`,
|
|
208
|
-
},
|
|
209
|
-
"& tr:last-of-type td": {
|
|
210
|
-
borderBottomWidth: "0px",
|
|
211
|
-
},
|
|
212
|
-
}, children: [_jsxs(TableRow, { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-truck-clock" }) }), _jsx("th", { style: {
|
|
193
|
+
}, children: [_jsx("img", { width: 60, alt: "economy", src: quoteResponse.getEconomyIcon() }), _jsx(Typography, { children: economy.name })] }))] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-truck-clock" }) }), _jsx("th", { style: {
|
|
213
194
|
whiteSpace: "normal",
|
|
214
195
|
wordBreak: "break-word",
|
|
215
|
-
}, children: t("Transit Time") }), guaranteed && _jsx(
|
|
196
|
+
}, children: t("Transit Time") }), guaranteed && _jsx("td", { children: guaranteed.description }), premium && _jsx("td", { children: premium.description }), economy && _jsx("td", { children: economy.description })] }), _jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-calendar-days" }) }), _jsx("th", { style: {
|
|
216
197
|
whiteSpace: "normal",
|
|
217
198
|
wordBreak: "break-word",
|
|
218
|
-
}, children: t("Appointment") }), guaranteed && _jsx(
|
|
199
|
+
}, children: t("Appointment") }), guaranteed && _jsx("td", { children: t("Strict") }), premium && _jsx("td", { children: t("4h Window") }), economy && _jsx("td", { children: t("8h Window") })] }), _jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-up" }) }), _jsx("th", { style: {
|
|
219
200
|
whiteSpace: "normal",
|
|
220
201
|
wordBreak: "break-word",
|
|
221
|
-
}, children: t("loadToRide") }), guaranteed && (_jsx(
|
|
202
|
+
}, children: t("loadToRide") }), guaranteed && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) })), premium && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) })), economy && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) }))] }), _jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-truck-ramp-box" }) }), _jsx("th", { style: {
|
|
222
203
|
whiteSpace: "normal",
|
|
223
204
|
wordBreak: "break-word",
|
|
224
|
-
}, children: t("floorLoad") }), quoteResponse.type === "TL" ? (_jsxs(_Fragment, { children: [_jsx(
|
|
205
|
+
}, children: t("floorLoad") }), quoteResponse.type === "TL" ? (_jsxs(_Fragment, { children: [guaranteed && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) })), premium && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) })), economy && (_jsx("td", { children: _jsx(Typography, { color: "success", children: _jsx("i", { className: "fa-solid fa-check" }) }) }))] })) : (_jsxs(_Fragment, { children: [guaranteed && (_jsx("td", { children: _jsx("i", { className: "fa-solid fa-xmark" }) })), premium && (_jsx("td", { children: _jsx("i", { className: "fa-solid fa-xmark" }) })), economy && (_jsx("td", { children: _jsx("i", { className: "fa-solid fa-xmark" }) }))] }))] }), _jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-clock" }) }), _jsx("th", { style: {
|
|
225
206
|
whiteSpace: "normal",
|
|
226
207
|
wordBreak: "break-word",
|
|
227
|
-
}, children: t("Same Day Pickup") }), guaranteed && (_jsxs(
|
|
208
|
+
}, children: t("Same Day Pickup") }), guaranteed && (_jsxs("td", { children: [_jsx(Typography, { children: "99.9%" }), _jsx(LinearProgress, { value: 99.9, determinate: true, thickness: 5 })] })), premium && (_jsxs("td", { children: [_jsx(Typography, { children: "85%" }), _jsx(LinearProgress, { value: 85, determinate: true, thickness: 5 })] })), economy && (_jsxs("td", { children: [_jsx(Typography, { children: "50%" }), _jsx(LinearProgress, { value: 50, determinate: true, thickness: 5 })] }))] }), _jsxs("tr", { children: [_jsx("th", { children: _jsx("i", { className: "fa-solid fa-truck-front" }) }), _jsx("th", { style: {
|
|
228
209
|
whiteSpace: "normal",
|
|
229
210
|
wordBreak: "break-word",
|
|
230
|
-
}, children: t("Driver / Equipment Allocation") }), guaranteed && (_jsxs(
|
|
211
|
+
}, children: t("Driver / Equipment Allocation") }), guaranteed && (_jsxs("td", { children: [_jsx(Typography, { children: "99.9%" }), _jsx(LinearProgress, { value: 99.9, determinate: true, thickness: 5 })] })), premium && (_jsxs("td", { children: [_jsx(Typography, { children: "85%" }), _jsx(LinearProgress, { value: 85, determinate: true, thickness: 5 })] })), economy && (_jsxs("td", { children: [_jsx(Typography, { children: "50%" }), _jsx(LinearProgress, { value: 50, determinate: true, thickness: 5 })] }))] }), _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
231
212
|
whiteSpace: "normal",
|
|
232
213
|
wordBreak: "break-word",
|
|
233
|
-
}, children: t("Base") }), guaranteed &&
|
|
214
|
+
}, children: t("Base") }), guaranteed && _jsx("td", { children: usdFormatter.format(guaranteed.baseRate) }), premium && _jsx("td", { children: usdFormatter.format(premium.baseRate) }), economy && _jsx("td", { children: usdFormatter.format(economy.baseRate) })] }), _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
234
215
|
whiteSpace: "normal",
|
|
235
216
|
wordBreak: "break-word",
|
|
236
|
-
}, children: t("Fuel") }), guaranteed &&
|
|
217
|
+
}, children: t("Fuel") }), guaranteed && _jsx("td", { children: usdFormatter.format(guaranteed.fuelRate) }), premium && _jsx("td", { children: usdFormatter.format(premium.fuelRate) }), economy && _jsx("td", { children: usdFormatter.format(economy.fuelRate) })] }), _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
237
218
|
whiteSpace: "normal",
|
|
238
219
|
wordBreak: "break-word",
|
|
239
|
-
}, children: t("Extra") }), guaranteed &&
|
|
220
|
+
}, children: t("Extra") }), guaranteed && _jsx("td", { children: usdFormatter.format(guaranteed.extra) }), premium && _jsx("td", { children: usdFormatter.format(premium.extra) }), economy && _jsx("td", { children: usdFormatter.format(economy.extra) })] }), _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
240
221
|
whiteSpace: "normal",
|
|
241
222
|
wordBreak: "break-word",
|
|
242
|
-
}, children: t("Total") }), guaranteed &&
|
|
223
|
+
}, children: t("Total") }), guaranteed && _jsx("td", { children: usdFormatter.format(guaranteed.totalRate) }), premium && _jsx("td", { children: usdFormatter.format(premium.totalRate) }), economy && _jsx("td", { children: usdFormatter.format(economy.totalRate) })] })] }), _jsx("tfoot", { style: {
|
|
243
224
|
height: 70,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
"& tr:last-of-type": {
|
|
251
|
-
"& th:nth-of-type(1),th:nth-of-type(2)": {
|
|
252
|
-
borderBottomWidth: "1px",
|
|
253
|
-
borderBottomStyle: "solid",
|
|
254
|
-
},
|
|
255
|
-
"& th:first-of-type": {
|
|
256
|
-
borderBottomLeftRadius: "10px",
|
|
257
|
-
},
|
|
258
|
-
"& td:last-of-type": {
|
|
259
|
-
borderBottomRightRadius: "10px",
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
}, children: _jsxs(TableRow, { children: [_jsx("th", {}), _jsx("th", {}), guaranteed && (_jsx(TableCell, { children: _jsx(JoyButton, { onClick: () => {
|
|
225
|
+
}, children: _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
226
|
+
borderBottomRightRadius: 0,
|
|
227
|
+
} }), guaranteed && (_jsx("td", { style: {
|
|
228
|
+
borderBottomLeftRadius: 0,
|
|
229
|
+
}, children: _jsx(Button, { onClick: () => {
|
|
263
230
|
dispatch(setSelectedDate(null));
|
|
264
231
|
dispatch(setSelectedServiceLevel(guaranteed));
|
|
265
232
|
}, sx: {
|
|
@@ -271,7 +238,9 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
271
238
|
},
|
|
272
239
|
}, children: _jsxs(Box, { children: [t("Select delivery date"), _jsx("br", {}), _jsxs(Typography, { level: "body-sm", display: "block", sx: { color: "inherit" }, children: [DateTime.fromFormat(guaranteed.from, "yyyy-L-d").toFormat(DATE_FORMAT), guaranteed.from != guaranteed.to
|
|
273
240
|
? ` - ${DateTime.fromFormat(guaranteed.to, "yyyy-L-d").toFormat(DATE_FORMAT)}`
|
|
274
|
-
: []] })] }) }) })), premium && (_jsx(
|
|
241
|
+
: []] })] }) }) })), premium && (_jsx("td", { style: {
|
|
242
|
+
borderBottomLeftRadius: 0,
|
|
243
|
+
}, children: _jsx(Button, { onClick: () => {
|
|
275
244
|
dispatch(setSelectedDate(null));
|
|
276
245
|
dispatch(setSelectedServiceLevel(premium));
|
|
277
246
|
}, sx: {
|
|
@@ -283,7 +252,9 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
283
252
|
},
|
|
284
253
|
}, children: _jsxs(Box, { children: [t("Select delivery window"), _jsx("br", {}), _jsxs(Typography, { level: "body-sm", display: "block", sx: { color: "inherit" }, children: [DateTime.fromFormat(premium.from, "yyyy-L-d").toFormat(DATE_FORMAT), premium.from != premium.to
|
|
285
254
|
? ` - ${DateTime.fromFormat(premium.to, "yyyy-L-d").toFormat(DATE_FORMAT)}`
|
|
286
|
-
: []] })] }) }) })), economy && (_jsx(
|
|
255
|
+
: []] })] }) }) })), economy && (_jsx("td", { style: {
|
|
256
|
+
borderBottomLeftRadius: 0,
|
|
257
|
+
}, children: _jsx(Button, { onClick: () => {
|
|
287
258
|
dispatch(setSelectedDate(null));
|
|
288
259
|
dispatch(setSelectedServiceLevel(economy));
|
|
289
260
|
}, sx: {
|
|
@@ -333,7 +304,7 @@ function Toolbar({ shrink = false, customerPortal, }) {
|
|
|
333
304
|
fontWeight: 600,
|
|
334
305
|
fontSize: shrink ? "22px !important" : "36px !important",
|
|
335
306
|
transition: "font-size .3s ease-in-out",
|
|
336
|
-
}, children: t("Quote") }), "\u00A0", _jsxs(Typography, { display: "inline", level: "body-sm", children: ["#", response?.id] })] }), customerPortal ? null : (_jsx(Box, { sx: { display: "flex", gap: 1 }, children: _jsxs(
|
|
307
|
+
}, children: t("Quote") }), "\u00A0", _jsxs(Typography, { display: "inline", level: "body-sm", children: ["#", response?.id] })] }), customerPortal ? null : (_jsx(Box, { sx: { display: "flex", gap: 1 }, children: _jsxs(Button, { onClick: () => dispatch(setCostBreakdownOpen(true)), size: shrink ? "sm" : "md", variant: "outlined", children: [_jsx("i", { className: "fa-solid fa-filter-circle-dollar pright" }), t("Breakdown")] }) }))] }) }));
|
|
337
308
|
}
|
|
338
309
|
const RenderDay = ({ date, pickersDayProps, serviceLevel, type, }) => {
|
|
339
310
|
const response = useSelector(quoteResultSelector);
|
|
@@ -378,7 +349,10 @@ const CustomPickersDay = styled(PickersDay, {
|
|
|
378
349
|
"quoteType",
|
|
379
350
|
].includes(prop.toString()),
|
|
380
351
|
})(({ theme, enabled, first, last, serviceLevel, selectedDate, day, quoteType, }) => {
|
|
381
|
-
const
|
|
352
|
+
const _theme = useTheme();
|
|
353
|
+
const swatch = quoteType === "LTL"
|
|
354
|
+
? serviceLevelColors(_theme).LTL
|
|
355
|
+
: serviceLevelColors(_theme).TL;
|
|
382
356
|
return {
|
|
383
357
|
...(enabled && {
|
|
384
358
|
...(!serviceLevel.flexible
|
|
@@ -387,7 +361,7 @@ const CustomPickersDay = styled(PickersDay, {
|
|
|
387
361
|
? swatch[serviceLevel.serviceLevel][600]
|
|
388
362
|
: theme.palette.common.white,
|
|
389
363
|
border: selectedDate?.toMillis() === day.toMillis()
|
|
390
|
-
? `2px ${swatch[serviceLevel.serviceLevel][
|
|
364
|
+
? `2px ${swatch[serviceLevel.serviceLevel][500]} solid`
|
|
391
365
|
: "0px",
|
|
392
366
|
backgroundColor: selectedDate?.toMillis() === day.toMillis()
|
|
393
367
|
? theme.palette.common.white
|
|
@@ -408,15 +382,15 @@ const CustomPickersDay = styled(PickersDay, {
|
|
|
408
382
|
borderBottomRightRadius: !last ? "0%" : "100%",
|
|
409
383
|
borderLeft: !first || !selectedDate
|
|
410
384
|
? "0px"
|
|
411
|
-
: `2px ${swatch[serviceLevel.serviceLevel][
|
|
385
|
+
: `2px ${swatch[serviceLevel.serviceLevel][500]} solid`,
|
|
412
386
|
borderRight: !last || !selectedDate
|
|
413
387
|
? "0px"
|
|
414
|
-
: `2px ${swatch[serviceLevel.serviceLevel][
|
|
388
|
+
: `2px ${swatch[serviceLevel.serviceLevel][500]} solid`,
|
|
415
389
|
borderTop: selectedDate
|
|
416
|
-
? `2px ${swatch[serviceLevel.serviceLevel][
|
|
390
|
+
? `2px ${swatch[serviceLevel.serviceLevel][500]} solid`
|
|
417
391
|
: "0px",
|
|
418
392
|
borderBottom: selectedDate
|
|
419
|
-
? `2px ${swatch[serviceLevel.serviceLevel][
|
|
393
|
+
? `2px ${swatch[serviceLevel.serviceLevel][500]} solid`
|
|
420
394
|
: "0px",
|
|
421
395
|
backgroundColor: selectedDate
|
|
422
396
|
? theme.palette.common.white
|
|
@@ -509,30 +483,53 @@ const CostBreakdown = () => {
|
|
|
509
483
|
setExpand(false);
|
|
510
484
|
setKey(nanoid());
|
|
511
485
|
});
|
|
512
|
-
return (
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
486
|
+
return (_jsx(Modal, { open: open, onClose: handleClose, children: _jsxs(ModalDialog, { layout: "fullscreen", children: [_jsx(DialogContent, { children: !marketCost || !costBreakdown.length ? (_jsx(Box, { sx: {
|
|
487
|
+
display: "flex",
|
|
488
|
+
height: "100%",
|
|
489
|
+
alignItems: "center",
|
|
490
|
+
justifyContent: "center",
|
|
491
|
+
}, children: _jsx(CircularProgress, {}) })) : (_jsxs(Box, { sx: {
|
|
492
|
+
maxHeight: "100%",
|
|
493
|
+
height: "100%",
|
|
494
|
+
display: "flex",
|
|
495
|
+
flexDirection: "column",
|
|
496
|
+
}, children: [_jsx(MarketCost, {}), _jsx(Sheet, { sx: {
|
|
497
|
+
borderRadius: (theme) => theme.radius.md,
|
|
498
|
+
p: 1,
|
|
499
|
+
mt: 1,
|
|
500
|
+
overflow: "auto",
|
|
501
|
+
}, variant: "outlined", children: _jsxs(Grid, { container: true, spacing: 1, children: [_jsx(Grid, { xs: 12, children: _jsx(Typography, { level: "h4", children: "Cost Breakdown" }) }), _jsx(Grid, { xs: 12, children: _jsx(Box, { sx: { display: "flex", gap: 1 }, children: costBreakdown.map((serviceLevel, k) => (_jsxs(Box, { children: [_jsxs(Typography, { sx: { mb: 3, textTransform: "capitalize" }, level: "title-md", children: [_jsx("img", { src: serviceLevelIcons[serviceLevel.name], style: { height: 20, marginRight: 8 } }), serviceLevel.name] }), _jsx(AccordionGroup, { sx: {
|
|
502
|
+
[`& .${accordionClasses.root}`]: {
|
|
503
|
+
marginTop: "0.5rem",
|
|
504
|
+
transition: "0.2s ease",
|
|
505
|
+
'& button:not([aria-expanded="true"])': {
|
|
506
|
+
transition: "0.2s ease",
|
|
507
|
+
paddingBottom: "0.625rem",
|
|
508
|
+
},
|
|
509
|
+
"& button:hover": {
|
|
510
|
+
background: "transparent",
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
[`& .${accordionClasses.root}.${accordionClasses.expanded}`]: {
|
|
514
|
+
bgcolor: "background.level1",
|
|
515
|
+
borderRadius: "md",
|
|
516
|
+
borderBottom: "1px solid",
|
|
517
|
+
borderColor: "background.level2",
|
|
518
|
+
},
|
|
519
|
+
'& [aria-expanded="true"]': {
|
|
520
|
+
boxShadow: (theme) => `inset 0 -1px 0 ${theme.vars.palette.divider}`,
|
|
521
|
+
},
|
|
522
|
+
}, children: serviceLevel.sections.map((s) => (_jsxs(Accordion, { defaultExpanded: expand, children: [_jsxs(AccordionSummary, { children: [_jsx(Typography, { level: "body-md", sx: { fontWeight: 600 }, children: s.name }), _jsx(Chip, { variant: "soft", size: "sm", sx: { ml: "auto", mr: 1 }, children: usdFormatter.format(s.content.total) })] }), _jsx(AccordionDetails, { children: _jsx(Grid, { container: true, spacing: 1, justifyContent: "space-between", children: s.content.paths.map((p, i) => (_jsxs(Fragment, { children: [_jsx(Grid, { xs: 8, children: _jsx(Typography, { level: "body-sm", children: p.description }) }), _jsx(Grid, { xs: 4, display: "flex", justifyContent: "flex-end", children: _jsx(Typography, { fontWeight: 600, level: "body-sm", children: usdFormatter.format(p.cost_amount) }) }), i < s.content.paths.length - 1 ? (_jsx(Grid, { xs: 12, children: _jsx(Divider, {}) })) : null] }, i))) }) })] }, s.name))) })] }, k))) }, key) })] }) })] })) }), _jsx(DialogActions, { children: _jsxs(Dropdown, { children: [_jsx(Button, { onClick: handleClose, children: t("Close") }), _jsx(MenuButton, { sx: {
|
|
528
523
|
mr: "auto",
|
|
529
524
|
}, size: "sm", color: "neutral", variant: "soft", startDecorator: _jsx("i", { className: "fa-solid fa-keyboard" }), children: "Keyboard Shortcuts" }), _jsxs(Menu, { sx: {
|
|
530
|
-
zIndex:
|
|
525
|
+
zIndex: (t) => t.zIndex.modal,
|
|
531
526
|
}, children: [_jsx(MenuItem, { onClick: () => {
|
|
532
527
|
setExpand(true);
|
|
528
|
+
setKey(nanoid());
|
|
533
529
|
}, children: _jsxs(Box, { sx: { display: "flex", gap: 1, alignItems: "baseline" }, children: [_jsx(Letter, { children: "ctrl" }), " ", _jsx(Typography, { level: "body-sm", children: "+" }), _jsx(Letter, { children: "e" }), ": Expand all"] }) }), _jsx(MenuItem, { onClick: () => {
|
|
534
530
|
setExpand(false);
|
|
535
|
-
|
|
531
|
+
setKey(nanoid());
|
|
532
|
+
}, children: _jsxs(Box, { sx: { display: "flex", gap: 1, alignItems: "baseline" }, children: [_jsx(Letter, { children: "ctrl" }), " ", _jsx(Typography, { level: "body-sm", children: "+" }), _jsx(Letter, { children: "shift" }), " ", _jsx(Typography, { level: "body-sm", children: "+" }), " ", _jsx(Letter, { children: "e" }), ": Collapse all"] }) })] })] }) })] }) }));
|
|
536
533
|
};
|
|
537
534
|
const Letter = (props) => {
|
|
538
535
|
return (_jsx(Box, { sx: {
|
|
@@ -556,7 +553,7 @@ const MarketCost = () => {
|
|
|
556
553
|
return (_jsx(Sheet, { sx: {
|
|
557
554
|
borderRadius: (theme) => theme.radius.md,
|
|
558
555
|
p: 1,
|
|
559
|
-
}, variant: "outlined", children: _jsxs(Grid, { container: true, spacing:
|
|
556
|
+
}, variant: "outlined", children: _jsxs(Grid, { container: true, spacing: 0.5, children: [_jsx(Grid, { xs: 12, children: _jsx(Typography, { level: "h4", children: t("Market Cost") }) }), _jsxs(Grid, { xs: 6, container: true, children: [_jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("Linehaul Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.linehaul_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("Fuel Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.fuel_cost) }) }), _jsx(Grid, { xs: 12, children: _jsx(Divider, {}) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), t("TL Total Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.truckload_total_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), t("LTL Pallet Percentage")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: marketCosts.ltl_pallet_percentage }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("Stop Off Fees")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.stop_fees) }) }), _jsx(Grid, { xs: 12, children: _jsx(Divider, {}) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), t("Market Price")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.total_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("Margin")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.margin) }) }), _jsx(Grid, { xs: 12, children: _jsx(Divider, {}) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), t("Total Cost With Margin")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.total_cost_with_margin) }) })] }), marketCosts.market_data ? (_jsxs(Grid, { xs: 6, container: true, children: [_jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Miles") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: marketCosts.otr_miles }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Fuel Rate per Mile") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.market_data.fuel_rate) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Line Haul Rate per Mile") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.market_data.linehaul_rate) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Line Haul Total") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: usdFormatter.format(marketCosts.market_data.linehaul_total) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Market Type") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: marketCosts.market_data.market_type }) }), _jsx(Grid, { xs: 6, children: _jsx(Typography, { display: "block", children: t("• Market Lane") }) }), _jsx(Grid, { xs: 6, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: marketCosts.market_data.market_lane }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("• Market Days") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { size: "sm", variant: "soft", children: marketCosts.market_data.market_days }) })] })) : ([])] }) }));
|
|
560
557
|
};
|
|
561
558
|
const Summary = ({ handleOnTenderLoadClick, customerPortal, }) => {
|
|
562
559
|
const selectedDate = useSelector(selectedDateSelector);
|
|
@@ -568,6 +565,7 @@ const Summary = ({ handleOnTenderLoadClick, customerPortal, }) => {
|
|
|
568
565
|
const dispatch = useDispatch();
|
|
569
566
|
const { t } = useTranslation("salesKit");
|
|
570
567
|
const DATE_FORMAT = "LLLL d yyyy";
|
|
568
|
+
const theme = useTheme();
|
|
571
569
|
const expired = response
|
|
572
570
|
? DateTime.now() >
|
|
573
571
|
DateTime.fromISO(response.createdAt).plus({
|
|
@@ -577,22 +575,24 @@ const Summary = ({ handleOnTenderLoadClick, customerPortal, }) => {
|
|
|
577
575
|
})
|
|
578
576
|
: false;
|
|
579
577
|
const { data: customerCredit } = useGetCustomerCreditQuery(response?.customerId || 0, { skip: !response?.customerId || customerPortal });
|
|
580
|
-
const swatch = response?.type === "LTL"
|
|
578
|
+
const swatch = response?.type === "LTL"
|
|
579
|
+
? serviceLevelColors(theme).LTL
|
|
580
|
+
: serviceLevelColors(theme).TL;
|
|
581
581
|
if (!selectedDate || !selectedServiceLevel)
|
|
582
582
|
return null;
|
|
583
|
-
return (_jsxs(
|
|
583
|
+
return (_jsxs(Sheet, { sx: { p: 2, borderRadius: "sm", boxShadow: "md" }, children: [_jsxs(Typography, { level: "title-lg", children: [_jsx("i", { className: "fa-duotone fa-truck pright" }), " ", t("Summary")] }), _jsxs(Grid, { container: true, spacing: 1, rowGap: 2, sx: {
|
|
584
584
|
mt: 2,
|
|
585
|
-
}, children: [_jsxs(Grid, {
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
585
|
+
}, children: [_jsxs(Grid, { xs: 12, children: [_jsx(Typography, { level: "title-md", children: t("About") }), _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { width: "11%" }, children: t("Quote ID") }), _jsx("th", { style: { width: "10%" }, children: t("Service") }), _jsx("th", { style: { width: "8%" }, children: t("Mode") }), response?.temp && _jsx("th", { children: t("Temperature") }), _jsx("th", { children: t("Commodity Description") }), _jsx("th", { children: t("Total Weight") }), !customerPortal && _jsx("th", { children: t("Freight Class") }), _jsx("th", { style: { width: "10%" }, children: t("Feet") }), _jsx("th", { style: { width: "10%" }, children: t("Pallets") })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsxs("td", { children: ["#", response?.id] }), _jsx("td", { children: response?.type }), _jsx("td", { children: response?.temp ? t("Reefer") : t("Dry") }), response?.temp && _jsx("td", { children: response.temp }), _jsx("td", { children: response?.commodityDescription }), _jsx("td", { children: response?.weight }), !customerPortal && _jsx("td", { children: response?.freightClass }), _jsx("td", { children: response?.feet }), _jsx("td", { children: response?.pallets })] }) })] })] }), _jsxs(Grid, { xs: 12, container: true, children: [_jsx(Grid, { xs: 12, children: _jsx(Typography, { level: "title-md", children: t("Stops") }) }), !customerPortal && (_jsxs(Grid, { xs: 12, children: [_jsxs(Chip, { startDecorator: _jsx("i", { className: "fa-regular fa-map-location" }), variant: "outlined", color: "neutral", children: [response?.totalMiles, " ", t("miles")] }), _jsxs(Chip, { startDecorator: _jsx("i", { className: "fa-solid fa-timer" }), variant: "outlined", color: "neutral", sx: {
|
|
586
|
+
ml: 1,
|
|
587
|
+
}, children: [Math.round(response?.transitTime ?? 0), " ", t("hours")] })] })), _jsxs(Grid, { container: true, xs: 4, children: [_jsxs(Grid, { xs: 12, children: [_jsx("i", { className: "fa-regular fa-arrow-up" }), _jsx(Typography, { ml: 1, display: "inline", level: "body-sm", children: t("From") })] }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: from?.address.line1 || t("Unknown Location") }) }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: from?.city }) }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: from?.zip }) }), _jsx(Grid, { xs: 12, children: _jsx(Chip, { startDecorator: _jsx("i", { className: "fa-solid fa-calendar-days" }), variant: "soft", children: from?.date
|
|
588
|
+
? DateTime.fromFormat(from.date, "yyyy-L-d").toFormat(DATE_FORMAT)
|
|
589
|
+
: "" }) })] }), _jsxs(Grid, { xs: 4, container: true, children: [_jsxs(Grid, { xs: 12, children: [_jsx("i", { className: "fa-regular fa-arrow-down" }), _jsx(Typography, { ml: 1, display: "inline", level: "body-sm", children: t("To") })] }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: to?.address.line1 || t("Unknown Location") }) }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: to?.city }) }), _jsx(Grid, { xs: 12, children: _jsx(Typography, { children: to?.zip }) }), _jsx(Grid, { xs: 12, children: _jsx(Chip, { startDecorator: _jsx("i", { className: "fa-solid fa-calendar-days" }), variant: "soft", children: selectedServiceLevel.serviceLevel == "guaranteed"
|
|
590
|
+
? selectedDate?.toFormat(DATE_FORMAT)
|
|
591
|
+
: `${DateTime.fromFormat(selectedServiceLevel.from, "yyyy-L-d").toFormat(DATE_FORMAT)} - ${DateTime.fromFormat(selectedServiceLevel.to, "yyyy-L-d").toFormat(DATE_FORMAT)}` }) })] })] }), _jsxs(Grid, { xs: 12, children: [_jsx(Typography, { level: "title-md", children: t("Costs") }), _jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t("Service Level") }), _jsx("th", { children: t("Description") }), _jsx("th", { children: t("Base Rate") }), _jsx("th", { children: t("Fuel Rate") }), _jsx("th", { children: t("Extra") })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { children: _jsx("img", { src: selectedServiceLevel.serviceLevel === "guaranteed"
|
|
592
592
|
? response?.getGuaranteedIcon()
|
|
593
593
|
: selectedServiceLevel.serviceLevel === "premium"
|
|
594
594
|
? response?.getPremiumIcon()
|
|
595
|
-
: response?.getEconomyIcon(), style: { height: 20 } }) }), _jsx(
|
|
595
|
+
: response?.getEconomyIcon(), style: { height: 20 } }) }), _jsx("td", { children: selectedServiceLevel?.description }), _jsx("td", { children: usdFormatter.format(selectedServiceLevel.baseRate) }), _jsx("td", { children: usdFormatter.format(selectedServiceLevel.fuelRate) }), _jsx("td", { children: usdFormatter.format(selectedServiceLevel.extra) })] }) })] })] }), _jsxs(Grid, { xs: 12, textAlign: "right", justifyContent: "end", container: true, children: [_jsxs(Grid, { children: [_jsx(Typography, { children: t("Total") }), _jsx(Typography, { level: "title-md", children: usdFormatter.format(selectedServiceLevel.totalRate) })] }), !customerPortal ? (_jsxs(_Fragment, { children: [_jsx(Grid, { children: _jsx(Divider, { orientation: "vertical" }) }), _jsxs(Grid, { children: [_jsx(Typography, { children: t("Customer Credit") }), _jsx(Typography, { level: "title-md", children: usdFormatter.format(customerCredit?.availableCredit || 0) })] })] })) : null] }), _jsx(Grid, { xs: 12, textAlign: "right", children: _jsx(Tooltip, { title: expired && customerPortal
|
|
596
596
|
? 'Quote is expired, click on "Run Quote" to create a new one.'
|
|
597
597
|
: body.loadId
|
|
598
598
|
? 'Quote has already been tendered, click on "Run Quote" to create a new one.'
|
|
@@ -610,16 +610,17 @@ const Summary = ({ handleOnTenderLoadClick, customerPortal, }) => {
|
|
|
610
610
|
? swatch[selectedServiceLevel.serviceLevel][700]
|
|
611
611
|
: undefined,
|
|
612
612
|
},
|
|
613
|
-
"&.
|
|
613
|
+
"&.Mui-disabled": {
|
|
614
614
|
background: response
|
|
615
615
|
? swatch[selectedServiceLevel.serviceLevel][300]
|
|
616
616
|
: undefined,
|
|
617
|
+
color: "white",
|
|
617
618
|
},
|
|
618
619
|
}, onClick: () => {
|
|
619
620
|
if (response && selectedServiceLevel) {
|
|
620
621
|
handleOnTenderLoadClick(response.id, customerPortal
|
|
621
622
|
? selectedServiceLevel.id
|
|
622
|
-
: selectedServiceLevel.serviceLevel, selectedDate, customerCredit?.availableCredit &&
|
|
623
|
+
: selectedServiceLevel.serviceLevel, !selectedServiceLevel.flexible ? selectedDate : null, customerCredit?.availableCredit &&
|
|
623
624
|
customerCredit.availableCredit <
|
|
624
625
|
selectedServiceLevel.totalRate
|
|
625
626
|
? customerCredit.availableCredit -
|