@nerdjs/sales-kit 3.1.24 → 3.1.25
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/quote/result.d.ts +5 -2
- package/dist/hooks/quote/result.js +239 -245
- package/dist/hooks/quote/result.js.map +1 -1
- package/dist/hooks/quote/template.d.ts +1 -0
- package/dist/hooks/quote/template.js +2 -2
- package/dist/hooks/quote/template.js.map +1 -1
- package/dist/hooks/tender/form.js +4 -4
- package/dist/hooks/tender/form.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Accordion, AccordionDetails, AccordionGroup, AccordionSummary, Alert, Box, Button, Chip, CircularProgress, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, Grid, IconButton, Link, Menu, MenuButton, MenuItem, Modal, ModalDialog, Sheet, Table, Tooltip, Typography, accordionClasses, useColorScheme, useTheme, } from "@mui/joy";
|
|
2
|
+
import { Accordion, AccordionDetails, AccordionGroup, AccordionSummary, Alert, Box, Button, Chip, CircularProgress, DialogActions, DialogContent, DialogTitle, Divider, Dropdown, FormControl, FormLabel, Grid, IconButton, Link, Menu, MenuButton, MenuItem, Modal, ModalDialog, Sheet, Table, Tooltip, Typography, accordionClasses, useColorScheme, useTheme, } from "@mui/joy";
|
|
3
3
|
import { alpha, styled } from "@mui/system";
|
|
4
4
|
import { LocalizationProvider, PickersDay, StaticDatePicker, } from "@mui/x-date-pickers-pro";
|
|
5
|
-
import { CustomAdapterLuxon } from "@nerdjs/nerd-ui";
|
|
5
|
+
import { CustomAdapterLuxon, NerdCurrencyField } from "@nerdjs/nerd-ui";
|
|
6
6
|
import { nanoid } from "@reduxjs/toolkit";
|
|
7
7
|
import { DateTime } from "luxon";
|
|
8
8
|
import { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
@@ -12,18 +12,12 @@ import { useDispatch, useSelector } from "react-redux";
|
|
|
12
12
|
import { Link as RouterLink } from "react-router-dom";
|
|
13
13
|
import salesKitI18n from "../../i18n";
|
|
14
14
|
import { useGetCustomerCreditQuery } from "../../redux";
|
|
15
|
-
import { restartQuote, setCostBreakdownOpen,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import { useGetMarketCostQuery, useLazyGetCostBreakdownQuery, useLazyGetMarketCostQuery, } from "../../redux/quote/quoteCustomerPortalEndpoints";
|
|
19
|
-
import { costBreakdownOpenSelector,
|
|
20
|
-
// cargoLiabilitySelector,
|
|
21
|
-
formOpenSelector,
|
|
22
|
-
// quoteResultSelector,
|
|
23
|
-
selectedDateSelector, selectedServiceLevelSelector, } from "../../redux/quote/quoteSelectors";
|
|
15
|
+
import { restartQuote, setCostBreakdownOpen, setCargoLiability, setFormOpen, setMarketCostOpen, setQuoteResult, setSelectedDate, setSelectedServiceLevel, } from "../../redux/quote";
|
|
16
|
+
import { useCalculateLoadLiabilityCostMutation, useGetMarketCostQuery, useLazyGetCostBreakdownQuery, useLazyGetMarketCostQuery, } from "../../redux/quote/quoteCustomerPortalEndpoints";
|
|
17
|
+
import { costBreakdownOpenSelector, cargoLiabilitySelector, formOpenSelector, quoteResultSelector, selectedDateSelector, selectedServiceLevelSelector, } from "../../redux/quote/quoteSelectors";
|
|
24
18
|
import { CUSTOMER_PORTAL_QUOTE_EXPIRATION, LTL_DOC, SALES_QUOTE_EXPIRATION, TL_DOC, quoteResultToEmail, serviceLevelColors, serviceLevelIcons, } from "./constants";
|
|
25
19
|
const DATE_FORMAT = "LLL d";
|
|
26
|
-
|
|
20
|
+
const FIXED_CACHE_KEY = "cargoLiability";
|
|
27
21
|
const usdFormatter = new Intl.NumberFormat("en-US", {
|
|
28
22
|
style: "currency",
|
|
29
23
|
currency: "USD",
|
|
@@ -36,7 +30,7 @@ const usdFormatter = new Intl.NumberFormat("en-US", {
|
|
|
36
30
|
* @returns {ReactElement} Response drawer
|
|
37
31
|
*/
|
|
38
32
|
export function QuoteResult(props) {
|
|
39
|
-
const { customerPortal, handleOnTenderLoadClick, openLoadLink, body, response, } = props;
|
|
33
|
+
const { customerPortal, handleOnTenderLoadClick, openLoadLink, body, response, cargoLiability: showCargoLiability, } = props;
|
|
40
34
|
const { t } = useTranslation("common", { i18n: salesKitI18n });
|
|
41
35
|
const expired = response
|
|
42
36
|
? DateTime.now() >
|
|
@@ -78,7 +72,7 @@ export function QuoteResult(props) {
|
|
|
78
72
|
ml: "auto",
|
|
79
73
|
}, children: _jsx("i", { className: "fa-solid fa-copy" }) }) }), _jsx(Tooltip, { title: "Copy Full Email", children: _jsx(IconButton, { onClick: () => onCopyClick(true), color: "neutral", variant: "soft", children: _jsx("i", { className: "fa-solid fa-file-invoice" }) }) })] })) : null] })), !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
|
|
80
74
|
? 'Quote is expired, click on "Run Quote" to create a new one.'
|
|
81
|
-
: "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, response: response }), _jsx(CostBreakdown, { response: response }), _jsx(Summary, { response: response, body: body, customerPortal: customerPortal, handleOnTenderLoadClick: handleOnTenderLoadClick }), customerPortal ? (_jsxs(Box, { textAlign: "center", sx: {
|
|
75
|
+
: "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, response: response, showCargoLiability: showCargoLiability }), _jsx(CostBreakdown, { response: response }), _jsx(Summary, { response: response, body: body, customerPortal: customerPortal, handleOnTenderLoadClick: handleOnTenderLoadClick, showCargoLiability: showCargoLiability }), customerPortal ? (_jsxs(Box, { textAlign: "center", sx: {
|
|
82
76
|
lineHeight: 0.6,
|
|
83
77
|
}, 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("global.quoteRateWarning", {
|
|
84
78
|
clientName: window._APP_CONFIG?.client?.name,
|
|
@@ -131,7 +125,7 @@ function Wrapper(props) {
|
|
|
131
125
|
* @param {boolean} props.response response
|
|
132
126
|
* @returns {ReactElement} Response drawer
|
|
133
127
|
*/
|
|
134
|
-
export function ServiceLevels({ customerPortal, response, }) {
|
|
128
|
+
export function ServiceLevels({ customerPortal, response, showCargoLiability, }) {
|
|
135
129
|
const dispatch = useDispatch();
|
|
136
130
|
const selectedServiceLevel = useSelector(selectedServiceLevelSelector);
|
|
137
131
|
const { t } = useTranslation("common", { i18n: salesKitI18n });
|
|
@@ -141,7 +135,7 @@ export function ServiceLevels({ customerPortal, response, }) {
|
|
|
141
135
|
flexDirection: "column",
|
|
142
136
|
gap: 2,
|
|
143
137
|
margin: 1,
|
|
144
|
-
}, children: [customerPortal && response ? (_jsx(ServiceLevelsDetails, { quoteResponse: response })) : (_jsx(Box, { sx: { display: "flex", gap: 2 }, children: response?.serviceLevels?.map((l) => {
|
|
138
|
+
}, children: [customerPortal && response ? (_jsx(ServiceLevelsDetails, { quoteResponse: response, showCargoLiability: showCargoLiability })) : (_jsx(Box, { sx: { display: "flex", gap: 2 }, children: response?.serviceLevels?.map((l) => {
|
|
145
139
|
const swatch = response.type === "LTL"
|
|
146
140
|
? serviceLevelColors(theme).LTL[l.serviceLevel]
|
|
147
141
|
: serviceLevelColors(theme).TL[l.serviceLevel];
|
|
@@ -216,43 +210,33 @@ export function ServiceLevels({ customerPortal, response, }) {
|
|
|
216
210
|
* @param props.quoteResponse
|
|
217
211
|
* @returns {ReactElement} ServiceLevelsDetails
|
|
218
212
|
*/
|
|
219
|
-
function ServiceLevelsDetails({ quoteResponse, }) {
|
|
213
|
+
function ServiceLevelsDetails({ quoteResponse, showCargoLiability, }) {
|
|
220
214
|
const { serviceLevels } = quoteResponse;
|
|
221
215
|
const dispatch = useDispatch();
|
|
222
216
|
const { t } = useTranslation("common", { i18n: salesKitI18n });
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
217
|
+
const [openCargoLiabilityForm, setOpenCargoLiabilityForm] = useState({
|
|
218
|
+
open: false,
|
|
219
|
+
initialValue: 0,
|
|
220
|
+
});
|
|
227
221
|
const { economy, guaranteed, premium } = useMemo(() => {
|
|
228
222
|
const economy = serviceLevels?.find((s) => s.serviceLevel == "economy");
|
|
229
223
|
const premium = serviceLevels?.find((s) => s.serviceLevel == "premium");
|
|
230
224
|
const guaranteed = serviceLevels?.find((s) => s.serviceLevel == "guaranteed");
|
|
231
225
|
return { economy, premium, guaranteed };
|
|
232
226
|
}, [serviceLevels]);
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
// useCalculateLoadLiabilityCostMutation({
|
|
247
|
-
// fixedCacheKey: FIXED_CACHE_KEY,
|
|
248
|
-
// })[1];
|
|
249
|
-
// const cargoLiability = useSelector(cargoLiabilitySelector);
|
|
250
|
-
// useEffect(() => {
|
|
251
|
-
// return () => {
|
|
252
|
-
// dispatch(setCargoLiability(0));
|
|
253
|
-
// reset();
|
|
254
|
-
// };
|
|
255
|
-
// }, []);
|
|
227
|
+
const minEconomyLiabilityCoverage = useMemo(() => economy?.liabilityCoverage || 0, [economy?.liabilityCoverage]);
|
|
228
|
+
const minPremiumLiabilityCoverage = useMemo(() => premium?.liabilityCoverage || 0, [premium?.liabilityCoverage]);
|
|
229
|
+
const minGuaranteedLiabilityCoverage = useMemo(() => guaranteed?.liabilityCoverage || 0, [guaranteed?.liabilityCoverage]);
|
|
230
|
+
const { data: cargoLiabilityCost, reset } = useCalculateLoadLiabilityCostMutation({
|
|
231
|
+
fixedCacheKey: FIXED_CACHE_KEY,
|
|
232
|
+
})[1];
|
|
233
|
+
const cargoLiability = useSelector(cargoLiabilitySelector);
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
return () => {
|
|
236
|
+
dispatch(setCargoLiability(0));
|
|
237
|
+
reset();
|
|
238
|
+
};
|
|
239
|
+
}, []);
|
|
256
240
|
return (_jsx(Sheet, { sx: {
|
|
257
241
|
borderRadius: "sm",
|
|
258
242
|
boxShadow: "md",
|
|
@@ -274,7 +258,59 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
274
258
|
}, children: t("global.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: {
|
|
275
259
|
whiteSpace: "normal",
|
|
276
260
|
wordBreak: "break-word",
|
|
277
|
-
}, children: t("global.Appointment") }), guaranteed && _jsx("td", { children: t("global.Strict") }), premium && _jsx("td", { children: t("global.4h Window") }), economy && _jsx("td", { children: t("global.8h Window") })] }),
|
|
261
|
+
}, children: t("global.Appointment") }), guaranteed && _jsx("td", { children: t("global.Strict") }), premium && _jsx("td", { children: t("global.4h Window") }), economy && _jsx("td", { children: t("global.8h Window") })] }), showCargoLiability &&
|
|
262
|
+
!quoteResponse.loadId &&
|
|
263
|
+
quoteResponse.type == "LTL" ? (_jsxs(_Fragment, { children: [_jsxs("tr", { children: [_jsx("th", {}), _jsxs("th", { style: {
|
|
264
|
+
whiteSpace: "normal",
|
|
265
|
+
wordBreak: "break-word",
|
|
266
|
+
}, children: ["Cargo Liability", _jsx(Button, { sx: {
|
|
267
|
+
mt: 0.5,
|
|
268
|
+
}, size: "sm", variant: "soft", onClick: () => setOpenCargoLiabilityForm({
|
|
269
|
+
open: true,
|
|
270
|
+
initialValue: minEconomyLiabilityCoverage,
|
|
271
|
+
}), startDecorator: _jsx("i", { className: "fa-solid fa-plus" }), children: "Add More" })] }), guaranteed && (_jsx("td", { children: _jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, children: [_jsx(Chip, { color: cargoLiability > minGuaranteedLiabilityCoverage
|
|
272
|
+
? "neutral"
|
|
273
|
+
: "primary", startDecorator: cargoLiability >
|
|
274
|
+
minGuaranteedLiabilityCoverage ? null : (_jsx("i", { className: "fa-solid fa-circle-check" })), sx: {
|
|
275
|
+
textDecoration: cargoLiability > minGuaranteedLiabilityCoverage
|
|
276
|
+
? "line-through"
|
|
277
|
+
: undefined,
|
|
278
|
+
}, size: cargoLiability > minGuaranteedLiabilityCoverage
|
|
279
|
+
? "sm"
|
|
280
|
+
: "md", children: usdFormatter.format(minGuaranteedLiabilityCoverage) }), cargoLiability > minGuaranteedLiabilityCoverage ? (_jsx(Chip, { color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiability) })) : null] }) })), premium && (_jsx("td", { children: _jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, children: [_jsx(Chip, { color: cargoLiability > minPremiumLiabilityCoverage
|
|
281
|
+
? "neutral"
|
|
282
|
+
: "primary", startDecorator: cargoLiability >
|
|
283
|
+
minPremiumLiabilityCoverage ? null : (_jsx("i", { className: "fa-solid fa-circle-check" })), sx: {
|
|
284
|
+
textDecoration: cargoLiability > minPremiumLiabilityCoverage
|
|
285
|
+
? "line-through"
|
|
286
|
+
: undefined,
|
|
287
|
+
}, size: cargoLiability > minPremiumLiabilityCoverage
|
|
288
|
+
? "sm"
|
|
289
|
+
: "md", children: usdFormatter.format(minPremiumLiabilityCoverage) }), cargoLiability > minPremiumLiabilityCoverage ? (_jsx(Chip, { color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiability) })) : null] }) })), economy && (_jsx("td", { children: _jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "center", gap: 0.5, children: [_jsx(Chip, { color: cargoLiability > minEconomyLiabilityCoverage
|
|
290
|
+
? "neutral"
|
|
291
|
+
: "primary", startDecorator: cargoLiability >
|
|
292
|
+
minEconomyLiabilityCoverage ? null : (_jsx("i", { className: "fa-solid fa-circle-check" })), sx: {
|
|
293
|
+
textDecoration: cargoLiability > minEconomyLiabilityCoverage
|
|
294
|
+
? "line-through"
|
|
295
|
+
: undefined,
|
|
296
|
+
}, size: cargoLiability > minEconomyLiabilityCoverage
|
|
297
|
+
? "sm"
|
|
298
|
+
: "md", children: usdFormatter.format(minEconomyLiabilityCoverage) }), cargoLiability > minEconomyLiabilityCoverage ? (_jsx(Chip, { color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiability) })) : null] }) })), _jsx(EditCargoLiabilityModal, { onClose: () => setOpenCargoLiabilityForm({ open: false, initialValue: 0 }), initialValue: openCargoLiabilityForm.initialValue, open: openCargoLiabilityForm.open, value: cargoLiability, setValue: (v) => dispatch(setCargoLiability(v)) })] }), _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
299
|
+
whiteSpace: "normal",
|
|
300
|
+
wordBreak: "break-word",
|
|
301
|
+
}, children: "Cargo Liability Cost" }), guaranteed && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { sx: {
|
|
302
|
+
textDecoration: cargoLiabilityCost?.guaranteed
|
|
303
|
+
? "line-through"
|
|
304
|
+
: undefined,
|
|
305
|
+
}, color: cargoLiabilityCost?.guaranteed ? "neutral" : "primary", size: "sm", startDecorator: cargoLiabilityCost?.guaranteed ? undefined : (_jsx("i", { className: "fa-solid fa-circle-check" })), children: "Included" }), cargoLiabilityCost?.guaranteed ? (_jsx(Chip, { color: "primary", size: "sm", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiabilityCost.guaranteed || 0) })) : null] }) })), premium && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { sx: {
|
|
306
|
+
textDecoration: cargoLiabilityCost?.premium
|
|
307
|
+
? "line-through"
|
|
308
|
+
: undefined,
|
|
309
|
+
}, color: cargoLiabilityCost?.premium ? "neutral" : "primary", size: "sm", startDecorator: cargoLiabilityCost?.premium ? undefined : (_jsx("i", { className: "fa-solid fa-circle-check" })), children: "Included" }), cargoLiabilityCost?.premium ? (_jsx(Chip, { color: "primary", size: "sm", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiabilityCost.premium || 0) })) : null] }) })), economy && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { sx: {
|
|
310
|
+
textDecoration: cargoLiabilityCost?.economy
|
|
311
|
+
? "line-through"
|
|
312
|
+
: undefined,
|
|
313
|
+
}, color: cargoLiabilityCost?.economy ? "neutral" : "primary", size: "sm", startDecorator: cargoLiabilityCost?.economy ? undefined : (_jsx("i", { className: "fa-solid fa-circle-check" })), children: "Included" }), cargoLiabilityCost?.economy ? (_jsx(Chip, { color: "primary", size: "sm", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(cargoLiabilityCost.economy || 0) })) : null] }) }))] })] })) : null, _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
278
314
|
whiteSpace: "normal",
|
|
279
315
|
wordBreak: "break-word",
|
|
280
316
|
}, children: t("global.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: {
|
|
@@ -286,43 +322,52 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
286
322
|
}, children: t("global.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: {
|
|
287
323
|
whiteSpace: "normal",
|
|
288
324
|
wordBreak: "break-word",
|
|
289
|
-
}, children: t("global.Total") }), guaranteed && (_jsx("td", { children:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
325
|
+
}, children: t("global.Total") }), guaranteed && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { size: "sm", ...(showCargoLiability
|
|
326
|
+
? {
|
|
327
|
+
sx: {
|
|
328
|
+
textDecoration: cargoLiabilityCost?.guaranteed
|
|
329
|
+
? "line-through"
|
|
330
|
+
: undefined,
|
|
331
|
+
},
|
|
332
|
+
color: !cargoLiabilityCost?.guaranteed
|
|
333
|
+
? "primary"
|
|
334
|
+
: "neutral",
|
|
335
|
+
startDecorator: !cargoLiabilityCost?.guaranteed ? (_jsx("i", { className: "fa-solid fa-circle-check" })) : null,
|
|
336
|
+
}
|
|
337
|
+
: {
|
|
338
|
+
color: "primary",
|
|
339
|
+
startDecorator: (_jsx("i", { className: "fa-solid fa-circle-check" })),
|
|
340
|
+
}), children: usdFormatter.format(guaranteed.totalRate) }), cargoLiabilityCost?.guaranteed && showCargoLiability ? (_jsx(Chip, { size: "sm", color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(guaranteed.totalRate + cargoLiabilityCost.guaranteed) })) : null] }) })), premium && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { size: "sm", ...(showCargoLiability
|
|
341
|
+
? {
|
|
342
|
+
sx: {
|
|
343
|
+
textDecoration: cargoLiabilityCost?.premium
|
|
344
|
+
? "line-through"
|
|
345
|
+
: undefined,
|
|
346
|
+
},
|
|
347
|
+
color: !cargoLiabilityCost?.premium
|
|
348
|
+
? "primary"
|
|
349
|
+
: "neutral",
|
|
350
|
+
startDecorator: !cargoLiabilityCost?.premium ? (_jsx("i", { className: "fa-solid fa-circle-check" })) : null,
|
|
351
|
+
}
|
|
352
|
+
: {
|
|
353
|
+
color: "primary",
|
|
354
|
+
startDecorator: (_jsx("i", { className: "fa-solid fa-circle-check" })),
|
|
355
|
+
}), children: usdFormatter.format(premium.totalRate) }), cargoLiabilityCost?.premium && showCargoLiability ? (_jsx(Chip, { size: "sm", color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(premium.totalRate + cargoLiabilityCost.premium) })) : null] }) })), economy && (_jsx("td", { children: _jsxs(Box, { display: "flex", alignItems: "center", flexDirection: "column", gap: 0.5, children: [_jsx(Chip, { size: "sm", ...(showCargoLiability
|
|
356
|
+
? {
|
|
357
|
+
sx: {
|
|
358
|
+
textDecoration: cargoLiabilityCost?.economy
|
|
359
|
+
? "line-through"
|
|
360
|
+
: undefined,
|
|
361
|
+
},
|
|
362
|
+
color: !cargoLiabilityCost?.economy
|
|
363
|
+
? "primary"
|
|
364
|
+
: "neutral",
|
|
365
|
+
startDecorator: !cargoLiabilityCost?.economy ? (_jsx("i", { className: "fa-solid fa-circle-check" })) : null,
|
|
366
|
+
}
|
|
367
|
+
: {
|
|
368
|
+
color: "primary",
|
|
369
|
+
startDecorator: (_jsx("i", { className: "fa-solid fa-circle-check" })),
|
|
370
|
+
}), children: usdFormatter.format(economy.totalRate) }), cargoLiabilityCost?.economy && showCargoLiability ? (_jsx(Chip, { size: "sm", color: "primary", startDecorator: _jsx("i", { className: "fa-solid fa-circle-check" }), children: usdFormatter.format(economy.totalRate + cargoLiabilityCost.economy) })) : null] }) }))] })] }), _jsx("tfoot", { style: {
|
|
326
371
|
height: 70,
|
|
327
372
|
}, children: _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { style: {
|
|
328
373
|
borderBottomRightRadius: 0,
|
|
@@ -349,147 +394,84 @@ function ServiceLevelsDetails({ quoteResponse, }) {
|
|
|
349
394
|
? ` - ${DateTime.fromFormat(economy.to, "yyyy-L-d").toFormat(DATE_FORMAT)}`
|
|
350
395
|
: []] })] }) }) }))] }) })] }) }));
|
|
351
396
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
//
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
// border: 0,
|
|
431
|
-
// borderRadius: 0,
|
|
432
|
-
// transform: "initial",
|
|
433
|
-
// maxWidth: "initial",
|
|
434
|
-
// maxHeight: "initial",
|
|
435
|
-
// width: "initial",
|
|
436
|
-
// },
|
|
437
|
-
// })}
|
|
438
|
-
// >
|
|
439
|
-
// <DialogTitle>Cargo Liability</DialogTitle>
|
|
440
|
-
// <DialogContent>
|
|
441
|
-
// <form
|
|
442
|
-
// onSubmit={(event) => {
|
|
443
|
-
// event.preventDefault();
|
|
444
|
-
// if (_value) handleSave();
|
|
445
|
-
// }}
|
|
446
|
-
// >
|
|
447
|
-
// <Typography level="body-sm">
|
|
448
|
-
// Feel free to increase the Cargo Liability; the cost will be
|
|
449
|
-
// calculated automatically.
|
|
450
|
-
// </Typography>
|
|
451
|
-
// <Box mt={1}>
|
|
452
|
-
// <FormControl>
|
|
453
|
-
// <FormLabel>Cargo Liability</FormLabel>
|
|
454
|
-
// <NerdCurrencyField
|
|
455
|
-
// value={_value}
|
|
456
|
-
// inputProps={{
|
|
457
|
-
// fullWidth: true,
|
|
458
|
-
// placeholder: usdFormatter.format(initialValue).substring(1),
|
|
459
|
-
// }}
|
|
460
|
-
// onChange={(v) => {
|
|
461
|
-
// _setValue(v);
|
|
462
|
-
// }}
|
|
463
|
-
// />
|
|
464
|
-
// </FormControl>
|
|
465
|
-
// </Box>
|
|
466
|
-
// </form>
|
|
467
|
-
// </DialogContent>
|
|
468
|
-
// <DialogActions>
|
|
469
|
-
// <Button
|
|
470
|
-
// loading={isLoading2}
|
|
471
|
-
// color="neutral"
|
|
472
|
-
// variant="soft"
|
|
473
|
-
// onClick={handleReset}
|
|
474
|
-
// >
|
|
475
|
-
// {t("global.Reset")}
|
|
476
|
-
// </Button>
|
|
477
|
-
// <Button color="neutral" variant="soft" onClick={handleClose}>
|
|
478
|
-
// {t("global.Cancel")}
|
|
479
|
-
// </Button>
|
|
480
|
-
// <Button
|
|
481
|
-
// loading={isLoading}
|
|
482
|
-
// color="primary"
|
|
483
|
-
// onClick={handleSave}
|
|
484
|
-
// disabled={!_value}
|
|
485
|
-
// >
|
|
486
|
-
// {t("global.Confirm")}
|
|
487
|
-
// </Button>
|
|
488
|
-
// </DialogActions>
|
|
489
|
-
// </ModalDialog>
|
|
490
|
-
// </Modal>
|
|
491
|
-
// );
|
|
492
|
-
// };
|
|
397
|
+
const EditCargoLiabilityModal = ({ value, setValue, open, onClose, initialValue, }) => {
|
|
398
|
+
const { t } = useTranslation("common", { i18n: salesKitI18n });
|
|
399
|
+
const [_value, _setValue] = useState(value ? value : undefined);
|
|
400
|
+
const [calculateCost] = useCalculateLoadLiabilityCostMutation({
|
|
401
|
+
fixedCacheKey: FIXED_CACHE_KEY,
|
|
402
|
+
});
|
|
403
|
+
const result = useSelector(quoteResultSelector);
|
|
404
|
+
//Cannot use the isLoading attribute from the useCalculateLoadLiabilityCostMutation hook
|
|
405
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
406
|
+
const [isLoading2, setIsLoading2] = useState(false);
|
|
407
|
+
const handleSave = () => {
|
|
408
|
+
if (result && _value !== undefined) {
|
|
409
|
+
setIsLoading(true);
|
|
410
|
+
calculateCost({
|
|
411
|
+
statedValue: _value,
|
|
412
|
+
quoteID: result.id,
|
|
413
|
+
})
|
|
414
|
+
.unwrap()
|
|
415
|
+
.then(() => {
|
|
416
|
+
setValue(_value);
|
|
417
|
+
handleClose();
|
|
418
|
+
})
|
|
419
|
+
.catch(() => {
|
|
420
|
+
return;
|
|
421
|
+
})
|
|
422
|
+
.finally(() => setIsLoading(false));
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
const handleReset = () => {
|
|
426
|
+
if (result) {
|
|
427
|
+
setIsLoading2(true);
|
|
428
|
+
calculateCost({
|
|
429
|
+
statedValue: 0,
|
|
430
|
+
quoteID: result.id,
|
|
431
|
+
})
|
|
432
|
+
.unwrap()
|
|
433
|
+
.then(() => {
|
|
434
|
+
setValue(0);
|
|
435
|
+
handleClose();
|
|
436
|
+
})
|
|
437
|
+
.catch(() => {
|
|
438
|
+
return;
|
|
439
|
+
})
|
|
440
|
+
.finally(() => setIsLoading2(false));
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
const handleClose = () => {
|
|
444
|
+
onClose();
|
|
445
|
+
_setValue(value ? value : undefined);
|
|
446
|
+
};
|
|
447
|
+
useEffect(() => {
|
|
448
|
+
_setValue(value ? value : undefined);
|
|
449
|
+
}, [open]);
|
|
450
|
+
return (_jsx(Modal, { open: open, onClose: handleClose, children: _jsxs(ModalDialog, { layout: "center", sx: (theme) => ({
|
|
451
|
+
width: 450,
|
|
452
|
+
[theme.breakpoints.only("xs")]: {
|
|
453
|
+
top: 0,
|
|
454
|
+
left: 0,
|
|
455
|
+
right: 0,
|
|
456
|
+
bottom: 0,
|
|
457
|
+
border: 0,
|
|
458
|
+
borderRadius: 0,
|
|
459
|
+
transform: "initial",
|
|
460
|
+
maxWidth: "initial",
|
|
461
|
+
maxHeight: "initial",
|
|
462
|
+
width: "initial",
|
|
463
|
+
},
|
|
464
|
+
}), children: [_jsx(DialogTitle, { children: "Cargo Liability" }), _jsx(DialogContent, { children: _jsxs("form", { onSubmit: (event) => {
|
|
465
|
+
event.preventDefault();
|
|
466
|
+
if (_value)
|
|
467
|
+
handleSave();
|
|
468
|
+
}, children: [_jsx(Typography, { level: "body-sm", children: "Feel free to increase the Cargo Liability; the cost will be calculated automatically." }), _jsx(Box, { mt: 1, children: _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Cargo Liability" }), _jsx(NerdCurrencyField, { value: _value, inputProps: {
|
|
469
|
+
fullWidth: true,
|
|
470
|
+
placeholder: usdFormatter.format(initialValue).substring(1),
|
|
471
|
+
}, onChange: (v) => {
|
|
472
|
+
_setValue(v);
|
|
473
|
+
} })] }) })] }) }), _jsxs(DialogActions, { children: [_jsx(Button, { loading: isLoading2, color: "neutral", variant: "soft", onClick: handleReset, children: t("global.Reset") }), _jsx(Button, { color: "neutral", variant: "soft", onClick: handleClose, children: t("global.Cancel") }), _jsx(Button, { loading: isLoading, color: "primary", onClick: handleSave, disabled: !_value, children: t("global.Confirm") })] })] }) }));
|
|
474
|
+
};
|
|
493
475
|
/**
|
|
494
476
|
* Quote toolbar. Contains actions like restart, run quote or find a quote.
|
|
495
477
|
*
|
|
@@ -790,7 +772,7 @@ const MarketCost = ({ response }) => {
|
|
|
790
772
|
p: 1,
|
|
791
773
|
}, variant: "outlined", children: _jsxs(Grid, { container: true, spacing: 0.5, children: [_jsx(Grid, { xs: 12, children: _jsx(Typography, { level: "h4", children: t("global.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("global.Linehaul Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.format(marketCosts.linehaul_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("global.Fuel Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.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("global.TL Total Cost")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.format(marketCosts.truckload_total_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), t("global.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("global.Stop Off Fees")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.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("global.Market Price")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.format(marketCosts.total_cost) }) }), _jsx(Grid, { xs: 8, children: _jsxs(Typography, { display: "block", children: [_jsx("i", { className: "fa-solid fa-plus pright" }), " ", t("global.Margin")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.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("global.Total Cost With Margin")] }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.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("global.• 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("global.• Fuel Rate per Mile") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _4FractionDigitUSDFormatter.format(marketCosts.market_data.fuel_rate) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("global.• Line Haul Rate per Mile") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _4FractionDigitUSDFormatter.format(marketCosts.market_data.linehaul_rate) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("global.• Line Haul Total") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { variant: "soft", size: "sm", children: _2FractionDigitUSDFormatter.format(marketCosts.market_data.linehaul_total) }) }), _jsx(Grid, { xs: 8, children: _jsx(Typography, { display: "block", children: t("global.• 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("global.• 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("global.• Market Days") }) }), _jsx(Grid, { xs: 4, style: { textAlign: "right" }, children: _jsx(Chip, { size: "sm", variant: "soft", children: marketCosts.market_data.market_days }) })] })) : ([])] }) }));
|
|
792
774
|
};
|
|
793
|
-
export const Summary = ({ handleOnTenderLoadClick, customerPortal, response, body, hideTenderButton, }) => {
|
|
775
|
+
export const Summary = ({ handleOnTenderLoadClick, customerPortal, response, body, hideTenderButton, showCargoLiability, }) => {
|
|
794
776
|
const selectedDate = useSelector(selectedDateSelector);
|
|
795
777
|
const selectedServiceLevel = useSelector(selectedServiceLevelSelector);
|
|
796
778
|
const from = response?.stops.find((stop) => stop.type == "shipper");
|
|
@@ -807,22 +789,22 @@ export const Summary = ({ handleOnTenderLoadClick, customerPortal, response, bod
|
|
|
807
789
|
})
|
|
808
790
|
: false;
|
|
809
791
|
const { data: customerCredit } = useGetCustomerCreditQuery(response?.customerId || 0, { skip: !response?.customerId || customerPortal });
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
792
|
+
const { data: _cargoLiabilityCost } = useCalculateLoadLiabilityCostMutation({
|
|
793
|
+
fixedCacheKey: FIXED_CACHE_KEY,
|
|
794
|
+
})[1];
|
|
795
|
+
const cargoLiabilityCost = useMemo(() => {
|
|
796
|
+
switch (selectedServiceLevel?.serviceLevel) {
|
|
797
|
+
case "economy":
|
|
798
|
+
return _cargoLiabilityCost?.economy || 0;
|
|
799
|
+
case "premium":
|
|
800
|
+
return _cargoLiabilityCost?.premium || 0;
|
|
801
|
+
case "guaranteed":
|
|
802
|
+
return _cargoLiabilityCost?.guaranteed || 0;
|
|
803
|
+
default:
|
|
804
|
+
return 0;
|
|
805
|
+
}
|
|
806
|
+
}, [_cargoLiabilityCost, selectedServiceLevel?.serviceLevel]);
|
|
807
|
+
const cargoLiability = useSelector(cargoLiabilitySelector);
|
|
826
808
|
if (!selectedDate || !selectedServiceLevel)
|
|
827
809
|
return null;
|
|
828
810
|
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("global.Summary")] }), _jsxs(Grid, { container: true, spacing: 1, rowGap: 1.5, sx: {
|
|
@@ -839,11 +821,23 @@ export const Summary = ({ handleOnTenderLoadClick, customerPortal, response, bod
|
|
|
839
821
|
width: "60%",
|
|
840
822
|
}, children: t("components:lepShipcons.stop") }), _jsx("th", { style: {
|
|
841
823
|
width: "10%",
|
|
842
|
-
}, children: t("components:lepAdjustments.amount") })] }) }), _jsx("tbody", { children: response.accessorials.map((a, i) => (_jsxs("tr", { children: [_jsx("td", { children: a.name }), _jsx("td", { children: a.stopName }), _jsx("td", { children: usdFormatter.format(a.costAmount || 0) })] }, i))) })] })] })) : null, _jsxs(Grid, { xs: 12, children: [_jsx(Typography, { level: "title-lg", children: t("global.Costs") }), _jsxs(Table, { size: "sm", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t("global.Service Level") }), _jsx("th", { children: t("global.Description") }),
|
|
824
|
+
}, children: t("components:lepAdjustments.amount") })] }) }), _jsx("tbody", { children: response.accessorials.map((a, i) => (_jsxs("tr", { children: [_jsx("td", { children: a.name }), _jsx("td", { children: a.stopName }), _jsx("td", { children: usdFormatter.format(a.costAmount || 0) })] }, i))) })] })] })) : null, _jsxs(Grid, { xs: 12, children: [_jsx(Typography, { level: "title-lg", children: t("global.Costs") }), _jsxs(Table, { size: "sm", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: t("global.Service Level") }), _jsx("th", { children: t("global.Description") }), !response?.loadId &&
|
|
825
|
+
response?.type == "LTL" &&
|
|
826
|
+
showCargoLiability ? (_jsx("th", { style: {
|
|
827
|
+
width: 150,
|
|
828
|
+
}, children: "Cargo Liability Cost" })) : null, _jsx("th", { children: t("global.Base Rate") }), _jsx("th", { children: t("global.Fuel Rate") }), _jsx("th", { children: t("global.Extra") })] }) }), _jsx("tbody", { children: _jsxs("tr", { children: [_jsx("td", { children: _jsx("img", { src: selectedServiceLevel.serviceLevel === "guaranteed"
|
|
843
829
|
? response?.getGuaranteedIcon()
|
|
844
830
|
: selectedServiceLevel.serviceLevel === "premium"
|
|
845
831
|
? response?.getPremiumIcon()
|
|
846
|
-
: response?.getEconomyIcon(), style: { height: 20 } }) }), _jsx("td", { children: selectedServiceLevel?.description }),
|
|
832
|
+
: response?.getEconomyIcon(), style: { height: 20 } }) }), _jsx("td", { children: selectedServiceLevel?.description }), !response?.loadId &&
|
|
833
|
+
response?.type == "LTL" &&
|
|
834
|
+
showCargoLiability ? (_jsx("td", { children: _jsx(Chip, { size: "sm", color: cargoLiabilityCost ? "primary" : "neutral", sx: {
|
|
835
|
+
backgroundColor: cargoLiabilityCost
|
|
836
|
+
? undefined
|
|
837
|
+
: "inherit",
|
|
838
|
+
}, children: cargoLiabilityCost === 0
|
|
839
|
+
? "Included"
|
|
840
|
+
: usdFormatter.format(cargoLiabilityCost) }) })) : null, _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("global.Total") }), _jsx(Typography, { level: "title-md", sx: {
|
|
847
841
|
color: "inherit",
|
|
848
842
|
}, children: usdFormatter.format(selectedServiceLevel.totalRate) })] }), !customerPortal ? (_jsxs(_Fragment, { children: [_jsx(Grid, { children: _jsx(Divider, { orientation: "vertical" }) }), _jsxs(Grid, { children: [_jsx(Typography, { children: t("global.Customer Credit") }), _jsx(Typography, { level: "title-md", children: usdFormatter.format(customerCredit?.availableCredit || 0) })] })] })) : null] }), !hideTenderButton ? (_jsx(Grid, { xs: 12, textAlign: "right", children: _jsx(Tooltip, { title: expired && customerPortal
|
|
849
843
|
? 'Quote is expired, click on "Run Quote" to create a new one.'
|
|
@@ -868,9 +862,9 @@ export const Summary = ({ handleOnTenderLoadClick, customerPortal, response, bod
|
|
|
868
862
|
selectedServiceLevel.totalRate
|
|
869
863
|
? customerCredit.availableCredit -
|
|
870
864
|
selectedServiceLevel.totalRate
|
|
871
|
-
: undefined
|
|
872
|
-
|
|
873
|
-
|
|
865
|
+
: undefined, cargoLiabilityCost !== 0 && showCargoLiability
|
|
866
|
+
? cargoLiability
|
|
867
|
+
: undefined);
|
|
874
868
|
dispatch(restartQuote());
|
|
875
869
|
dispatch(setQuoteResult(undefined));
|
|
876
870
|
}
|