@nerdjs/sales-kit 1.0.2 → 1.0.3
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/entities/accessorial/accessorial.d.ts +12 -0
- package/dist/entities/accessorial/accessorial.js +41 -0
- package/dist/entities/accessorial/accessorial.js.map +1 -0
- package/dist/entities/accessorial/helper.d.ts +5 -0
- package/dist/entities/accessorial/helper.js +16 -0
- package/dist/entities/accessorial/helper.js.map +1 -0
- package/dist/entities/accessorial/index.d.ts +2 -0
- package/dist/entities/accessorial/index.js +3 -0
- package/dist/entities/accessorial/index.js.map +1 -0
- package/dist/entities/accessorials/accessorials.d.ts +7 -0
- package/dist/entities/accessorials/accessorials.js +29 -0
- package/dist/entities/accessorials/accessorials.js.map +1 -0
- package/dist/entities/accessorials/helper.d.ts +5 -0
- package/dist/entities/accessorials/helper.js +16 -0
- package/dist/entities/accessorials/helper.js.map +1 -0
- package/dist/entities/accessorials/index.d.ts +2 -0
- package/dist/entities/accessorials/index.js +3 -0
- package/dist/entities/accessorials/index.js.map +1 -0
- package/dist/{cjs/entities → entities}/customer/customer.d.ts +16 -16
- package/dist/entities/customer/customer.js +63 -0
- package/dist/entities/customer/customer.js.map +1 -0
- package/dist/{cjs/entities → entities}/customer/helper.d.ts +5 -5
- package/dist/entities/customer/helper.js +16 -0
- package/dist/entities/customer/helper.js.map +1 -0
- package/dist/{cjs/entities → entities}/customer/index.d.ts +1 -1
- package/dist/entities/customer/index.js +2 -0
- package/dist/entities/customer/index.js.map +1 -0
- package/dist/entities/holiday/helper.d.ts +5 -0
- package/dist/entities/holiday/helper.js +16 -0
- package/dist/entities/holiday/helper.js.map +1 -0
- package/dist/entities/holiday/holiday.d.ts +7 -0
- package/dist/entities/holiday/holiday.js +31 -0
- package/dist/entities/holiday/holiday.js.map +1 -0
- package/dist/entities/holiday/index.d.ts +2 -0
- package/dist/entities/holiday/index.js +3 -0
- package/dist/entities/holiday/index.js.map +1 -0
- package/dist/entities/index.d.ts +12 -0
- package/dist/entities/index.js +13 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/load/helper.d.ts +6 -0
- package/dist/entities/load/helper.js +28 -0
- package/dist/entities/load/helper.js.map +1 -0
- package/dist/entities/load/index.d.ts +2 -0
- package/dist/entities/load/index.js +3 -0
- package/dist/entities/load/index.js.map +1 -0
- package/dist/entities/load/load.d.ts +102 -0
- package/dist/entities/load/load.js +224 -0
- package/dist/entities/load/load.js.map +1 -0
- package/dist/entities/loadAdjustment/helper.d.ts +5 -0
- package/dist/entities/loadAdjustment/helper.js +16 -0
- package/dist/entities/loadAdjustment/helper.js.map +1 -0
- package/dist/entities/loadAdjustment/index.d.ts +2 -0
- package/dist/entities/loadAdjustment/index.js +3 -0
- package/dist/entities/loadAdjustment/index.js.map +1 -0
- package/dist/entities/loadAdjustment/loadAdjustment.d.ts +15 -0
- package/dist/entities/loadAdjustment/loadAdjustment.js +48 -0
- package/dist/entities/loadAdjustment/loadAdjustment.js.map +1 -0
- package/dist/{cjs/entities → entities}/location/helper.d.ts +5 -5
- package/dist/entities/location/helper.js +16 -0
- package/dist/entities/location/helper.js.map +1 -0
- package/dist/{cjs/entities → entities}/location/index.d.ts +2 -2
- package/dist/entities/location/index.js +3 -0
- package/dist/entities/location/index.js.map +1 -0
- package/dist/{cjs/entities → entities}/location/location.d.ts +33 -32
- package/dist/entities/location/location.js +47 -0
- package/dist/entities/location/location.js.map +1 -0
- package/dist/{cjs/entities → entities}/marketCosts/helper.d.ts +5 -5
- package/dist/entities/marketCosts/helper.js +16 -0
- package/dist/entities/marketCosts/helper.js.map +1 -0
- package/dist/{cjs/entities → entities}/marketCosts/index.d.ts +2 -2
- package/dist/entities/marketCosts/index.js +3 -0
- package/dist/entities/marketCosts/index.js.map +1 -0
- package/dist/{cjs/entities → entities}/marketCosts/marketCosts.d.ts +22 -22
- package/dist/entities/marketCosts/marketCosts.js +60 -0
- package/dist/entities/marketCosts/marketCosts.js.map +1 -0
- package/dist/{cjs/entities → entities}/quote/helper.d.ts +5 -5
- package/dist/entities/quote/helper.js +16 -0
- package/dist/entities/quote/helper.js.map +1 -0
- package/dist/{cjs/entities → entities}/quote/index.d.ts +2 -2
- package/dist/entities/quote/index.js +3 -0
- package/dist/entities/quote/index.js.map +1 -0
- package/dist/entities/quote/quote.d.ts +76 -0
- package/dist/entities/quote/quote.js +46 -0
- package/dist/entities/quote/quote.js.map +1 -0
- package/dist/entities/quoteAccessorial/helper.d.ts +5 -0
- package/dist/entities/quoteAccessorial/helper.js +16 -0
- package/dist/entities/quoteAccessorial/helper.js.map +1 -0
- package/dist/entities/quoteAccessorial/index.d.ts +2 -0
- package/dist/entities/quoteAccessorial/index.js +3 -0
- package/dist/entities/quoteAccessorial/index.js.map +1 -0
- package/dist/entities/quoteAccessorial/quoteAccessorial.d.ts +29 -0
- package/dist/entities/quoteAccessorial/quoteAccessorial.js +77 -0
- package/dist/entities/quoteAccessorial/quoteAccessorial.js.map +1 -0
- package/dist/entities/quoteResponse/helper.d.ts +5 -0
- package/dist/entities/quoteResponse/helper.js +16 -0
- package/dist/entities/quoteResponse/helper.js.map +1 -0
- package/dist/entities/quoteResponse/index.d.ts +2 -0
- package/dist/entities/quoteResponse/index.js +3 -0
- package/dist/entities/quoteResponse/index.js.map +1 -0
- package/dist/entities/quoteResponse/quoteResponse.d.ts +72 -0
- package/dist/entities/quoteResponse/quoteResponse.js +67 -0
- package/dist/entities/quoteResponse/quoteResponse.js.map +1 -0
- package/dist/entities/shipcon/helper.d.ts +6 -0
- package/dist/entities/shipcon/helper.js +20 -0
- package/dist/entities/shipcon/helper.js.map +1 -0
- package/dist/entities/shipcon/index.d.ts +2 -0
- package/dist/entities/shipcon/index.js +3 -0
- package/dist/entities/shipcon/index.js.map +1 -0
- package/dist/entities/shipcon/shipcon.d.ts +27 -0
- package/dist/entities/shipcon/shipcon.js +74 -0
- package/dist/entities/shipcon/shipcon.js.map +1 -0
- package/dist/helpers.d.ts +18 -0
- package/dist/helpers.js +29 -0
- package/dist/helpers.js.map +1 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/locationsForm/index.d.ts +1 -0
- package/dist/hooks/locationsForm/index.js +2 -0
- package/dist/hooks/locationsForm/index.js.map +1 -0
- package/dist/hooks/locationsForm/locationsForm.d.ts +2 -0
- package/dist/hooks/locationsForm/locationsForm.js +35 -0
- package/dist/hooks/locationsForm/locationsForm.js.map +1 -0
- package/dist/hooks/quote/constants.d.ts +187 -0
- package/dist/hooks/quote/constants.js +137 -0
- package/dist/hooks/quote/constants.js.map +1 -0
- package/dist/hooks/quote/form.d.ts +7 -0
- package/dist/hooks/quote/form.js +203 -0
- package/dist/hooks/quote/form.js.map +1 -0
- package/dist/hooks/quote/helpers.d.ts +39 -0
- package/dist/hooks/quote/helpers.js +366 -0
- package/dist/hooks/quote/helpers.js.map +1 -0
- package/dist/hooks/quote/index.d.ts +5 -0
- package/dist/hooks/quote/index.js +6 -0
- package/dist/hooks/quote/index.js.map +1 -0
- package/dist/hooks/quote/result.d.ts +7 -0
- package/dist/hooks/quote/result.js +196 -0
- package/dist/hooks/quote/result.js.map +1 -0
- package/dist/hooks/quote/template.d.ts +7 -0
- package/dist/hooks/quote/template.js +113 -0
- package/dist/hooks/quote/template.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/redux/appState.d.ts +4 -0
- package/dist/redux/appState.js +2 -0
- package/dist/redux/appState.js.map +1 -0
- package/dist/redux/customer/customerActions.d.ts +97 -0
- package/dist/redux/customer/customerActions.js +210 -0
- package/dist/redux/customer/customerActions.js.map +1 -0
- package/dist/redux/customer/customerReducer.d.ts +2 -0
- package/dist/redux/customer/customerReducer.js +42 -0
- package/dist/redux/customer/customerReducer.js.map +1 -0
- package/dist/redux/customer/customerSelector.d.ts +27 -0
- package/dist/redux/customer/customerSelector.js +38 -0
- package/dist/redux/customer/customerSelector.js.map +1 -0
- package/dist/redux/customer/customerState.d.ts +11 -0
- package/dist/redux/customer/customerState.js +2 -0
- package/dist/redux/customer/customerState.js.map +1 -0
- package/dist/redux/customer/index.d.ts +4 -0
- package/dist/redux/customer/index.js +5 -0
- package/dist/redux/customer/index.js.map +1 -0
- package/dist/redux/index.d.ts +8 -0
- package/dist/redux/index.js +9 -0
- package/dist/redux/index.js.map +1 -0
- package/dist/redux/load/index.d.ts +4 -0
- package/dist/redux/load/index.js +5 -0
- package/dist/redux/load/index.js.map +1 -0
- package/dist/redux/load/loadActions.d.ts +80 -0
- package/dist/redux/load/loadActions.js +172 -0
- package/dist/redux/load/loadActions.js.map +1 -0
- package/dist/redux/load/loadReducer.d.ts +2 -0
- package/dist/redux/load/loadReducer.js +35 -0
- package/dist/redux/load/loadReducer.js.map +1 -0
- package/dist/redux/load/loadSelector.d.ts +27 -0
- package/dist/redux/load/loadSelector.js +19 -0
- package/dist/redux/load/loadSelector.js.map +1 -0
- package/dist/redux/load/loadState.d.ts +8 -0
- package/dist/redux/load/loadState.js +2 -0
- package/dist/redux/load/loadState.js.map +1 -0
- package/dist/redux/loadAdjustment/index.d.ts +4 -0
- package/dist/redux/loadAdjustment/index.js +5 -0
- package/dist/redux/loadAdjustment/index.js.map +1 -0
- package/dist/redux/loadAdjustment/loadAdjustmentActions.d.ts +80 -0
- package/dist/redux/loadAdjustment/loadAdjustmentActions.js +172 -0
- package/dist/redux/loadAdjustment/loadAdjustmentActions.js.map +1 -0
- package/dist/redux/loadAdjustment/loadAdjustmentReducer.d.ts +2 -0
- package/dist/redux/loadAdjustment/loadAdjustmentReducer.js +35 -0
- package/dist/redux/loadAdjustment/loadAdjustmentReducer.js.map +1 -0
- package/dist/redux/loadAdjustment/loadAdjustmentSelector.d.ts +15 -0
- package/dist/redux/loadAdjustment/loadAdjustmentSelector.js +12 -0
- package/dist/redux/loadAdjustment/loadAdjustmentSelector.js.map +1 -0
- package/dist/redux/loadAdjustment/loadAdjustmentState.d.ts +8 -0
- package/dist/redux/loadAdjustment/loadAdjustmentState.js +2 -0
- package/dist/redux/loadAdjustment/loadAdjustmentState.js.map +1 -0
- package/dist/redux/location/index.d.ts +4 -0
- package/dist/redux/location/index.js +5 -0
- package/dist/redux/location/index.js.map +1 -0
- package/dist/redux/location/locationActions.d.ts +101 -0
- package/dist/redux/location/locationActions.js +218 -0
- package/dist/redux/location/locationActions.js.map +1 -0
- package/dist/redux/location/locationReducer.d.ts +2 -0
- package/dist/redux/location/locationReducer.js +54 -0
- package/dist/redux/location/locationReducer.js.map +1 -0
- package/dist/redux/location/locationSelector.d.ts +53 -0
- package/dist/redux/location/locationSelector.js +32 -0
- package/dist/redux/location/locationSelector.js.map +1 -0
- package/dist/redux/location/locationState.d.ts +15 -0
- package/dist/redux/location/locationState.js +2 -0
- package/dist/redux/location/locationState.js.map +1 -0
- package/dist/{cjs/redux → redux}/quote/index.d.ts +5 -4
- package/dist/redux/quote/index.js +6 -0
- package/dist/redux/quote/index.js.map +1 -0
- package/dist/redux/quote/quoteAction.d.ts +177 -0
- package/dist/redux/quote/quoteAction.js +351 -0
- package/dist/redux/quote/quoteAction.js.map +1 -0
- package/dist/redux/quote/quoteMiddleware.d.ts +2 -0
- package/dist/redux/quote/quoteMiddleware.js +31 -0
- package/dist/redux/quote/quoteMiddleware.js.map +1 -0
- package/dist/redux/quote/quoteReducer.d.ts +27 -0
- package/dist/redux/quote/quoteReducer.js +207 -0
- package/dist/redux/quote/quoteReducer.js.map +1 -0
- package/dist/redux/quote/quoteSelector.d.ts +199 -0
- package/dist/redux/quote/quoteSelector.js +141 -0
- package/dist/redux/quote/quoteSelector.js.map +1 -0
- package/dist/redux/quote/quoteState.d.ts +9 -0
- package/dist/redux/quote/quoteState.js +2 -0
- package/dist/redux/quote/quoteState.js.map +1 -0
- package/dist/redux/quoteAccessorial/index.d.ts +3 -0
- package/dist/redux/quoteAccessorial/index.js +4 -0
- package/dist/redux/quoteAccessorial/index.js.map +1 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialActions.d.ts +70 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialActions.js +149 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialActions.js.map +1 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialReducer.d.ts +2 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialReducer.js +29 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialReducer.js.map +1 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialState.d.ts +8 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialState.js +2 -0
- package/dist/redux/quoteAccessorial/quoteAccessorialState.js.map +1 -0
- package/dist/redux/salesKitReducer.d.ts +25 -0
- package/dist/redux/salesKitReducer.js +18 -0
- package/dist/redux/salesKitReducer.js.map +1 -0
- package/dist/redux/shipcon/index.d.ts +4 -0
- package/dist/redux/shipcon/index.js +5 -0
- package/dist/redux/shipcon/index.js.map +1 -0
- package/dist/redux/shipcon/shipconActions.d.ts +80 -0
- package/dist/redux/shipcon/shipconActions.js +172 -0
- package/dist/redux/shipcon/shipconActions.js.map +1 -0
- package/dist/redux/shipcon/shipconReducer.d.ts +2 -0
- package/dist/redux/shipcon/shipconReducer.js +35 -0
- package/dist/redux/shipcon/shipconReducer.js.map +1 -0
- package/dist/redux/shipcon/shipconSelector.d.ts +22 -0
- package/dist/redux/shipcon/shipconSelector.js +19 -0
- package/dist/redux/shipcon/shipconSelector.js.map +1 -0
- package/dist/redux/shipcon/shipconState.d.ts +8 -0
- package/dist/redux/shipcon/shipconState.js +2 -0
- package/dist/redux/shipcon/shipconState.js.map +1 -0
- package/package.json +39 -70
- package/dist/cjs/components/calendar/calendar.d.ts +0 -5
- package/dist/cjs/components/calendar/day/day.d.ts +0 -8
- package/dist/cjs/components/calendar/day/index.d.ts +0 -1
- package/dist/cjs/components/calendar/day/typings.d.ts +0 -16
- package/dist/cjs/components/calendar/index.d.ts +0 -2
- package/dist/cjs/components/calendar/typings.d.ts +0 -27
- package/dist/cjs/components/customerFinder/customerFinder.d.ts +0 -11
- package/dist/cjs/components/customerFinder/index.d.ts +0 -2
- package/dist/cjs/components/customerFinder/optionTemplate.d.ts +0 -6
- package/dist/cjs/components/index.d.ts +0 -4
- package/dist/cjs/components/locationFinder/editLocation.d.ts +0 -15
- package/dist/cjs/components/locationFinder/index.d.ts +0 -1
- package/dist/cjs/components/locationFinder/locationByAddress.d.ts +0 -18
- package/dist/cjs/components/locationFinder/locationFinder.d.ts +0 -7
- package/dist/cjs/components/locationFinder/locationsFound.d.ts +0 -12
- package/dist/cjs/components/locationFinder/newLocationForm.d.ts +0 -20
- package/dist/cjs/components/locationFinder/optionTemplate.d.ts +0 -8
- package/dist/cjs/components/locationFinder/typings.d.ts +0 -23
- package/dist/cjs/components/salesQuote/components/aboutQuote/aboutQuote.d.ts +0 -5
- package/dist/cjs/components/salesQuote/components/aboutQuote/commodityDescription.d.ts +0 -16
- package/dist/cjs/components/salesQuote/components/aboutQuote/index.d.ts +0 -2
- package/dist/cjs/components/salesQuote/components/aboutQuote/quoteCheck.d.ts +0 -6
- package/dist/cjs/components/salesQuote/components/pallet/editPallet.d.ts +0 -11
- package/dist/cjs/components/salesQuote/components/pallet/palletChecker.d.ts +0 -15
- package/dist/cjs/components/salesQuote/components/pallet/palletCount.d.ts +0 -13
- package/dist/cjs/components/salesQuote/components/quoteCalendar/quoteCalendar.d.ts +0 -24
- package/dist/cjs/components/salesQuote/components/quoteResultAccordion/costBreakdown.d.ts +0 -14
- package/dist/cjs/components/salesQuote/components/quoteResultAccordion/marketCosts.d.ts +0 -7
- package/dist/cjs/components/salesQuote/components/quoteResultAccordion/quoteResultAccessorials.d.ts +0 -13
- package/dist/cjs/components/salesQuote/components/quoteResultAccordion/quoteResultAccordion.d.ts +0 -17
- package/dist/cjs/components/salesQuote/components/quoteSelect.d.ts +0 -4
- package/dist/cjs/components/salesQuote/components/quoteSummary/quoteSummary.d.ts +0 -4
- package/dist/cjs/components/salesQuote/components/quoteSummary/quoteSummaryBody.d.ts +0 -12
- package/dist/cjs/components/salesQuote/components/quoteSummary/quoteSummaryHeader.d.ts +0 -10
- package/dist/cjs/components/salesQuote/components/quoteSummary/typings.d.ts +0 -47
- package/dist/cjs/components/salesQuote/index.d.ts +0 -4
- package/dist/cjs/components/salesQuote/salesQuote.d.ts +0 -17
- package/dist/cjs/components/salesQuote/typings.d.ts +0 -156
- package/dist/cjs/components/shared/bootstrapDialogTitle/bootstrapDialogTitle.d.ts +0 -11
- package/dist/cjs/components/shared/bootstrapDialogTitle/index.d.ts +0 -1
- package/dist/cjs/components/shared/index.d.ts +0 -2
- package/dist/cjs/components/shared/loading/index.d.ts +0 -1
- package/dist/cjs/components/shared/loading/loading.d.ts +0 -6
- package/dist/cjs/components/stop/index.d.ts +0 -2
- package/dist/cjs/components/stop/menuAccessorials.d.ts +0 -27
- package/dist/cjs/components/stop/stop.d.ts +0 -4
- package/dist/cjs/components/stop/stopDetail.d.ts +0 -5
- package/dist/cjs/components/stop/stopDetailHeader.d.ts +0 -6
- package/dist/cjs/entities/index.d.ts +0 -4
- package/dist/cjs/entities/quote/quote.d.ts +0 -80
- package/dist/cjs/index.d.ts +0 -4
- package/dist/cjs/index.js +0 -3169
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/redux/calendar/calendarSlice.d.ts +0 -12
- package/dist/cjs/redux/calendar/index.d.ts +0 -1
- package/dist/cjs/redux/index.d.ts +0 -3
- package/dist/cjs/redux/nerdSalesKitReducer.d.ts +0 -10
- package/dist/cjs/redux/quote/quoteAction.d.ts +0 -125
- package/dist/cjs/redux/quote/quoteReducer.d.ts +0 -28
- package/dist/cjs/redux/quote/quoteSelector.d.ts +0 -22
- package/dist/cjs/redux/quote/quoteState.d.ts +0 -124
- package/dist/cjs/utils/constants.d.ts +0 -5
- package/dist/cjs/utils/helpers.d.ts +0 -17
- package/dist/cjs/utils/index.d.ts +0 -2
package/dist/cjs/index.js
DELETED
|
@@ -1,3169 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var Grid = require('@mui/material/Grid');
|
|
7
|
-
var Typography = require('@mui/material/Typography');
|
|
8
|
-
var toolkit = require('@reduxjs/toolkit');
|
|
9
|
-
var moment$1 = require('moment');
|
|
10
|
-
var styles = require('@mui/material/styles');
|
|
11
|
-
var React = require('react');
|
|
12
|
-
var WarningIcon = require('@mui/icons-material/Warning');
|
|
13
|
-
var LocalShippingIcon = require('@mui/icons-material/LocalShipping');
|
|
14
|
-
var Box = require('@mui/material/Box');
|
|
15
|
-
var nerdNetwork = require('@nerdjs/nerd-network');
|
|
16
|
-
var TextField = require('@mui/material/TextField');
|
|
17
|
-
var Autocomplete = require('@mui/material/Autocomplete');
|
|
18
|
-
var nerdUi = require('@nerdjs/nerd-ui');
|
|
19
|
-
var BusinessIcon = require('@mui/icons-material/Business');
|
|
20
|
-
var IconButton = require('@mui/material/IconButton');
|
|
21
|
-
var CloseIcon = require('@mui/icons-material/Close');
|
|
22
|
-
var Avatar = require('@mui/material/Avatar');
|
|
23
|
-
var CardHeader = require('@mui/material/CardHeader');
|
|
24
|
-
var colors = require('@mui/material/colors');
|
|
25
|
-
var CorporateFareIcon = require('@mui/icons-material/CorporateFare');
|
|
26
|
-
var Paper = require('@mui/material/Paper');
|
|
27
|
-
var Fab = require('@mui/material/Fab');
|
|
28
|
-
var useMediaQuery = require('@mui/material/useMediaQuery');
|
|
29
|
-
var PreviewIcon = require('@mui/icons-material/Preview');
|
|
30
|
-
var Divider = require('@mui/material/Divider');
|
|
31
|
-
var Container = require('@mui/material/Container');
|
|
32
|
-
var Stack = require('@mui/material/Stack');
|
|
33
|
-
var Skeleton = require('@mui/material/Skeleton');
|
|
34
|
-
var DialogTitle = require('@mui/material/DialogTitle');
|
|
35
|
-
var FormControl = require('@mui/material/FormControl');
|
|
36
|
-
var FormHelperText = require('@mui/material/FormHelperText');
|
|
37
|
-
var InputLabel = require('@mui/material/InputLabel');
|
|
38
|
-
var MenuItem = require('@mui/material/MenuItem');
|
|
39
|
-
var NativeSelect = require('@mui/material/NativeSelect');
|
|
40
|
-
var Select = require('@mui/material/Select');
|
|
41
|
-
var EditIcon = require('@mui/icons-material/Edit');
|
|
42
|
-
var Tooltip = require('@mui/material/Tooltip');
|
|
43
|
-
var Chip = require('@mui/material/Chip');
|
|
44
|
-
var CheckIcon = require('@mui/icons-material/Check');
|
|
45
|
-
var CircularProgress = require('@mui/material/CircularProgress');
|
|
46
|
-
var Dialog = require('@mui/material/Dialog');
|
|
47
|
-
var DialogContent = require('@mui/material/DialogContent');
|
|
48
|
-
var DialogContentText = require('@mui/material/DialogContentText');
|
|
49
|
-
var FormGroup = require('@mui/material/FormGroup');
|
|
50
|
-
var FormControlLabel = require('@mui/material/FormControlLabel');
|
|
51
|
-
var Switch = require('@mui/material/Switch');
|
|
52
|
-
var DialogActions = require('@mui/material/DialogActions');
|
|
53
|
-
var Button = require('@mui/material/Button');
|
|
54
|
-
var AddIcon = require('@mui/icons-material/Add');
|
|
55
|
-
var material = require('@mui/material');
|
|
56
|
-
var PlaceIcon = require('@mui/icons-material/Place');
|
|
57
|
-
var LocationOnTwoToneIcon = require('@mui/icons-material/LocationOnTwoTone');
|
|
58
|
-
var List = require('@mui/material/List');
|
|
59
|
-
var ListItem$1 = require('@mui/material/ListItem');
|
|
60
|
-
var ListItemButton = require('@mui/material/ListItemButton');
|
|
61
|
-
var ListItemAvatar = require('@mui/material/ListItemAvatar');
|
|
62
|
-
var ListItemText = require('@mui/material/ListItemText');
|
|
63
|
-
var ArrowUpwardIcon = require('@mui/icons-material/ArrowUpward');
|
|
64
|
-
var ArrowDownwardIcon = require('@mui/icons-material/ArrowDownward');
|
|
65
|
-
var Menu = require('@mui/material/Menu');
|
|
66
|
-
var AddCircleOutlineRoundedIcon = require('@mui/icons-material/AddCircleOutlineRounded');
|
|
67
|
-
var FormLabel = require('@mui/material/FormLabel');
|
|
68
|
-
var Radio = require('@mui/material/Radio');
|
|
69
|
-
var RadioGroup = require('@mui/material/RadioGroup');
|
|
70
|
-
var Accordion = require('@mui/material/Accordion');
|
|
71
|
-
var AccordionDetails = require('@mui/material/AccordionDetails');
|
|
72
|
-
var AccordionSummary = require('@mui/material/AccordionSummary');
|
|
73
|
-
var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
|
|
74
|
-
var ListAltIcon = require('@mui/icons-material/ListAlt');
|
|
75
|
-
var BarChartIcon = require('@mui/icons-material/BarChart');
|
|
76
|
-
var AddBoxIcon = require('@mui/icons-material/AddBox');
|
|
77
|
-
var Card = require('@mui/material/Card');
|
|
78
|
-
var CardContent = require('@mui/material/CardContent');
|
|
79
|
-
var Table = require('@mui/material/Table');
|
|
80
|
-
var TableBody = require('@mui/material/TableBody');
|
|
81
|
-
var TableCell = require('@mui/material/TableCell');
|
|
82
|
-
var TableContainer = require('@mui/material/TableContainer');
|
|
83
|
-
var TableRow = require('@mui/material/TableRow');
|
|
84
|
-
var CalendarMonthIcon = require('@mui/icons-material/CalendarMonth');
|
|
85
|
-
var TableHead = require('@mui/material/TableHead');
|
|
86
|
-
|
|
87
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
88
|
-
|
|
89
|
-
var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
|
|
90
|
-
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
91
|
-
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment$1);
|
|
92
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
93
|
-
var WarningIcon__default = /*#__PURE__*/_interopDefaultLegacy(WarningIcon);
|
|
94
|
-
var LocalShippingIcon__default = /*#__PURE__*/_interopDefaultLegacy(LocalShippingIcon);
|
|
95
|
-
var Box__default = /*#__PURE__*/_interopDefaultLegacy(Box);
|
|
96
|
-
var TextField__default = /*#__PURE__*/_interopDefaultLegacy(TextField);
|
|
97
|
-
var Autocomplete__default = /*#__PURE__*/_interopDefaultLegacy(Autocomplete);
|
|
98
|
-
var BusinessIcon__default = /*#__PURE__*/_interopDefaultLegacy(BusinessIcon);
|
|
99
|
-
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
100
|
-
var CloseIcon__default = /*#__PURE__*/_interopDefaultLegacy(CloseIcon);
|
|
101
|
-
var Avatar__default = /*#__PURE__*/_interopDefaultLegacy(Avatar);
|
|
102
|
-
var CardHeader__default = /*#__PURE__*/_interopDefaultLegacy(CardHeader);
|
|
103
|
-
var CorporateFareIcon__default = /*#__PURE__*/_interopDefaultLegacy(CorporateFareIcon);
|
|
104
|
-
var Paper__default = /*#__PURE__*/_interopDefaultLegacy(Paper);
|
|
105
|
-
var Fab__default = /*#__PURE__*/_interopDefaultLegacy(Fab);
|
|
106
|
-
var useMediaQuery__default = /*#__PURE__*/_interopDefaultLegacy(useMediaQuery);
|
|
107
|
-
var PreviewIcon__default = /*#__PURE__*/_interopDefaultLegacy(PreviewIcon);
|
|
108
|
-
var Divider__default = /*#__PURE__*/_interopDefaultLegacy(Divider);
|
|
109
|
-
var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
|
|
110
|
-
var Stack__default = /*#__PURE__*/_interopDefaultLegacy(Stack);
|
|
111
|
-
var Skeleton__default = /*#__PURE__*/_interopDefaultLegacy(Skeleton);
|
|
112
|
-
var DialogTitle__default = /*#__PURE__*/_interopDefaultLegacy(DialogTitle);
|
|
113
|
-
var FormControl__default = /*#__PURE__*/_interopDefaultLegacy(FormControl);
|
|
114
|
-
var FormHelperText__default = /*#__PURE__*/_interopDefaultLegacy(FormHelperText);
|
|
115
|
-
var InputLabel__default = /*#__PURE__*/_interopDefaultLegacy(InputLabel);
|
|
116
|
-
var MenuItem__default = /*#__PURE__*/_interopDefaultLegacy(MenuItem);
|
|
117
|
-
var NativeSelect__default = /*#__PURE__*/_interopDefaultLegacy(NativeSelect);
|
|
118
|
-
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
119
|
-
var EditIcon__default = /*#__PURE__*/_interopDefaultLegacy(EditIcon);
|
|
120
|
-
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
|
121
|
-
var Chip__default = /*#__PURE__*/_interopDefaultLegacy(Chip);
|
|
122
|
-
var CheckIcon__default = /*#__PURE__*/_interopDefaultLegacy(CheckIcon);
|
|
123
|
-
var CircularProgress__default = /*#__PURE__*/_interopDefaultLegacy(CircularProgress);
|
|
124
|
-
var Dialog__default = /*#__PURE__*/_interopDefaultLegacy(Dialog);
|
|
125
|
-
var DialogContent__default = /*#__PURE__*/_interopDefaultLegacy(DialogContent);
|
|
126
|
-
var DialogContentText__default = /*#__PURE__*/_interopDefaultLegacy(DialogContentText);
|
|
127
|
-
var FormGroup__default = /*#__PURE__*/_interopDefaultLegacy(FormGroup);
|
|
128
|
-
var FormControlLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormControlLabel);
|
|
129
|
-
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
130
|
-
var DialogActions__default = /*#__PURE__*/_interopDefaultLegacy(DialogActions);
|
|
131
|
-
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
132
|
-
var AddIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddIcon);
|
|
133
|
-
var PlaceIcon__default = /*#__PURE__*/_interopDefaultLegacy(PlaceIcon);
|
|
134
|
-
var LocationOnTwoToneIcon__default = /*#__PURE__*/_interopDefaultLegacy(LocationOnTwoToneIcon);
|
|
135
|
-
var List__default = /*#__PURE__*/_interopDefaultLegacy(List);
|
|
136
|
-
var ListItem__default = /*#__PURE__*/_interopDefaultLegacy(ListItem$1);
|
|
137
|
-
var ListItemButton__default = /*#__PURE__*/_interopDefaultLegacy(ListItemButton);
|
|
138
|
-
var ListItemAvatar__default = /*#__PURE__*/_interopDefaultLegacy(ListItemAvatar);
|
|
139
|
-
var ListItemText__default = /*#__PURE__*/_interopDefaultLegacy(ListItemText);
|
|
140
|
-
var ArrowUpwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowUpwardIcon);
|
|
141
|
-
var ArrowDownwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(ArrowDownwardIcon);
|
|
142
|
-
var Menu__default = /*#__PURE__*/_interopDefaultLegacy(Menu);
|
|
143
|
-
var AddCircleOutlineRoundedIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddCircleOutlineRoundedIcon);
|
|
144
|
-
var FormLabel__default = /*#__PURE__*/_interopDefaultLegacy(FormLabel);
|
|
145
|
-
var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
|
|
146
|
-
var RadioGroup__default = /*#__PURE__*/_interopDefaultLegacy(RadioGroup);
|
|
147
|
-
var Accordion__default = /*#__PURE__*/_interopDefaultLegacy(Accordion);
|
|
148
|
-
var AccordionDetails__default = /*#__PURE__*/_interopDefaultLegacy(AccordionDetails);
|
|
149
|
-
var AccordionSummary__default = /*#__PURE__*/_interopDefaultLegacy(AccordionSummary);
|
|
150
|
-
var ExpandMoreIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExpandMoreIcon);
|
|
151
|
-
var ListAltIcon__default = /*#__PURE__*/_interopDefaultLegacy(ListAltIcon);
|
|
152
|
-
var BarChartIcon__default = /*#__PURE__*/_interopDefaultLegacy(BarChartIcon);
|
|
153
|
-
var AddBoxIcon__default = /*#__PURE__*/_interopDefaultLegacy(AddBoxIcon);
|
|
154
|
-
var Card__default = /*#__PURE__*/_interopDefaultLegacy(Card);
|
|
155
|
-
var CardContent__default = /*#__PURE__*/_interopDefaultLegacy(CardContent);
|
|
156
|
-
var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
|
|
157
|
-
var TableBody__default = /*#__PURE__*/_interopDefaultLegacy(TableBody);
|
|
158
|
-
var TableCell__default = /*#__PURE__*/_interopDefaultLegacy(TableCell);
|
|
159
|
-
var TableContainer__default = /*#__PURE__*/_interopDefaultLegacy(TableContainer);
|
|
160
|
-
var TableRow__default = /*#__PURE__*/_interopDefaultLegacy(TableRow);
|
|
161
|
-
var CalendarMonthIcon__default = /*#__PURE__*/_interopDefaultLegacy(CalendarMonthIcon);
|
|
162
|
-
var TableHead__default = /*#__PURE__*/_interopDefaultLegacy(TableHead);
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* @param x
|
|
166
|
-
*/
|
|
167
|
-
function formattedPrice(x) {
|
|
168
|
-
const formatter = new Intl.NumberFormat("en-US", {
|
|
169
|
-
style: "currency",
|
|
170
|
-
currency: "USD",
|
|
171
|
-
});
|
|
172
|
-
return formatter.format(x);
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* @param date
|
|
176
|
-
*/
|
|
177
|
-
function safariFix(date) {
|
|
178
|
-
return date && date.replace && date.replace(/-/g, "/");
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* @param {Date | moment} start The start date
|
|
182
|
-
* @param {Date | moment} end The end date
|
|
183
|
-
* @param startDate
|
|
184
|
-
* @param endDate
|
|
185
|
-
* @param {string} type The range type. eg: 'days', 'hours' etc
|
|
186
|
-
*/
|
|
187
|
-
function getRange(startDate, endDate, type = "days") {
|
|
188
|
-
const fromDate = moment__default["default"](startDate);
|
|
189
|
-
const toDate = moment__default["default"](endDate);
|
|
190
|
-
const diff = toDate.diff(fromDate, type);
|
|
191
|
-
const range = [];
|
|
192
|
-
for (let i = 0; i < diff; i++) {
|
|
193
|
-
range.push(moment__default["default"](startDate).add(i, type));
|
|
194
|
-
}
|
|
195
|
-
return range;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function styleInject(css, ref) {
|
|
199
|
-
if ( ref === void 0 ) ref = {};
|
|
200
|
-
var insertAt = ref.insertAt;
|
|
201
|
-
|
|
202
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
203
|
-
|
|
204
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
205
|
-
var style = document.createElement('style');
|
|
206
|
-
style.type = 'text/css';
|
|
207
|
-
|
|
208
|
-
if (insertAt === 'top') {
|
|
209
|
-
if (head.firstChild) {
|
|
210
|
-
head.insertBefore(style, head.firstChild);
|
|
211
|
-
} else {
|
|
212
|
-
head.appendChild(style);
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
head.appendChild(style);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (style.styleSheet) {
|
|
219
|
-
style.styleSheet.cssText = css;
|
|
220
|
-
} else {
|
|
221
|
-
style.appendChild(document.createTextNode(css));
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
var css_248z$3 = ".container-day {\n background: rgba(155, 155, 155, 0.2);\n width: 27px;\n height: 27px;\n display: flex;\n justify-content: center;\n position: relative;\n align-items: center;\n transition: width 0.1s, height 0.1s;\n transition-timing-function: ease-in;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n margin: 0;\n color: #607d8b; }\n\n.rightBorderPatch {\n width: 2;\n height: 23;\n position: absolute;\n background: white;\n right: -2;\n top: 0;\n z-index: 99; }\n\n.leftBorderPatch {\n width: 2;\n height: 23px;\n position: absolute;\n background: white;\n left: -2;\n top: 0;\n z-index: 99; }\n";
|
|
226
|
-
styleInject(css_248z$3);
|
|
227
|
-
|
|
228
|
-
const DAY_SIZE = 35;
|
|
229
|
-
/**
|
|
230
|
-
* @param props
|
|
231
|
-
*/
|
|
232
|
-
function Day(props) {
|
|
233
|
-
const { selectable, transit, pickup, color, selected, grouped, first, last, day, onSelect, flexible, } = props;
|
|
234
|
-
const theme = styles.createTheme();
|
|
235
|
-
const [invariantViolation, setInvariantViolation] = React__default["default"].useState(false);
|
|
236
|
-
let background = selectable ? color : undefined;
|
|
237
|
-
if (selected)
|
|
238
|
-
background = "white";
|
|
239
|
-
if (transit)
|
|
240
|
-
background = theme.palette.mode === "dark" ? "white" : "#607d8b";
|
|
241
|
-
let col = selectable ? "white" : undefined;
|
|
242
|
-
if (selected)
|
|
243
|
-
col = color;
|
|
244
|
-
let width = selected ? DAY_SIZE - 10 : undefined;
|
|
245
|
-
if (transit)
|
|
246
|
-
width = DAY_SIZE;
|
|
247
|
-
let height = selected ? DAY_SIZE - 10 : undefined;
|
|
248
|
-
if (transit)
|
|
249
|
-
height = 10;
|
|
250
|
-
if (selectable) {
|
|
251
|
-
height = DAY_SIZE - 12;
|
|
252
|
-
width = DAY_SIZE - 12;
|
|
253
|
-
}
|
|
254
|
-
if (flexible) {
|
|
255
|
-
width = DAY_SIZE;
|
|
256
|
-
height = DAY_SIZE - 12;
|
|
257
|
-
}
|
|
258
|
-
let borderTopLeftRadius = DAY_SIZE;
|
|
259
|
-
if (transit || flexible)
|
|
260
|
-
borderTopLeftRadius = first ? DAY_SIZE : 0;
|
|
261
|
-
let borderBottomLeftRadius = DAY_SIZE;
|
|
262
|
-
if (transit || flexible)
|
|
263
|
-
borderBottomLeftRadius = first ? DAY_SIZE : 0;
|
|
264
|
-
let borderTopRightRadius = DAY_SIZE;
|
|
265
|
-
if (transit || flexible)
|
|
266
|
-
borderTopRightRadius = last ? DAY_SIZE : 0;
|
|
267
|
-
let borderBottomRightRadius = DAY_SIZE;
|
|
268
|
-
if (transit || flexible)
|
|
269
|
-
borderBottomRightRadius = last ? DAY_SIZE : 0;
|
|
270
|
-
let margin = !transit ? "4px" : "0";
|
|
271
|
-
if (flexible)
|
|
272
|
-
margin = "4px 0px 4px 0px";
|
|
273
|
-
if (flexible && first) {
|
|
274
|
-
margin = "4px 0px 4px 4px";
|
|
275
|
-
width = DAY_SIZE - 4;
|
|
276
|
-
}
|
|
277
|
-
if (flexible && last) {
|
|
278
|
-
margin = "4px 4px 4px 0px";
|
|
279
|
-
width = DAY_SIZE - 4;
|
|
280
|
-
}
|
|
281
|
-
// This logic represents variations
|
|
282
|
-
React.useEffect(() => {
|
|
283
|
-
if ((selectable && transit) || (selectable && pickup)) {
|
|
284
|
-
setInvariantViolation(true);
|
|
285
|
-
}
|
|
286
|
-
}, [selectable, transit, pickup]);
|
|
287
|
-
if (invariantViolation) {
|
|
288
|
-
return jsxRuntime.jsx(WarningIcon__default["default"], { style: { color: "#ff9800", fontSize: "19px" } });
|
|
289
|
-
}
|
|
290
|
-
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "div", sx: {
|
|
291
|
-
paddingTop: transit ? "10px" : "",
|
|
292
|
-
paddingBottom: transit ? "10px" : "",
|
|
293
|
-
width: DAY_SIZE + "px",
|
|
294
|
-
} }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ component: "div", className: "container-day", onClick: () => {
|
|
295
|
-
if (selectable && onSelect) {
|
|
296
|
-
onSelect(day);
|
|
297
|
-
}
|
|
298
|
-
}, sx: {
|
|
299
|
-
cursor: selectable ? "pointer" : "not-allowed",
|
|
300
|
-
margin,
|
|
301
|
-
background: background,
|
|
302
|
-
color: col,
|
|
303
|
-
width,
|
|
304
|
-
height,
|
|
305
|
-
borderTop: selectable ? `solid 2px ${color}` : "",
|
|
306
|
-
borderBottom: selectable ? `solid 2px ${color}` : "",
|
|
307
|
-
borderRight: (flexible && last) || (selectable && !flexible)
|
|
308
|
-
? `solid 2px ${color}`
|
|
309
|
-
: "",
|
|
310
|
-
borderLeft: (flexible && first) || (selectable && !flexible)
|
|
311
|
-
? `solid 2px ${color}`
|
|
312
|
-
: "",
|
|
313
|
-
borderTopLeftRadius,
|
|
314
|
-
borderBottomLeftRadius,
|
|
315
|
-
borderTopRightRadius,
|
|
316
|
-
borderBottomRightRadius,
|
|
317
|
-
} }, { children: [!transit && !pickup && day.format("D"), pickup ? (jsxRuntime.jsx(LocalShippingIcon__default["default"], { color: "inherit", style: { fontSize: "19px" } })) : ([]), selected && grouped && !last ? (jsxRuntime.jsx("div", { className: "rightBorderPatch" })) : ([]), selected && grouped && !first ? (jsxRuntime.jsx("div", { className: "leftBorderPatch" })) : ([])] })) })));
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
var css_248z$2 = ".calendar-container {\n display: flex;\n align-items: center;\n width: 245px;\n flex-wrap: wrap; }\n\n.containerCalendar {\n display: flex; }\n";
|
|
321
|
-
styleInject(css_248z$2);
|
|
322
|
-
|
|
323
|
-
// * MomentJS require be used as CJS when we build the library
|
|
324
|
-
const Moment = require("moment");
|
|
325
|
-
const MomentRange = require("moment-range");
|
|
326
|
-
require("moment-range");
|
|
327
|
-
const weekDays = ["s", "m", "t", "w", "t", "f", "s"];
|
|
328
|
-
const DAY_REF = {
|
|
329
|
-
Sunday: 0,
|
|
330
|
-
Monday: 1,
|
|
331
|
-
Tuesday: 2,
|
|
332
|
-
Wednesday: 3,
|
|
333
|
-
Thursday: 4,
|
|
334
|
-
Friday: 5,
|
|
335
|
-
Saturday: 6,
|
|
336
|
-
};
|
|
337
|
-
const moment = MomentRange.extendMoment(Moment);
|
|
338
|
-
const Calendar = (props) => {
|
|
339
|
-
const { serviceLevel, pickupDate, onSelect, selected } = props;
|
|
340
|
-
const theme = styles.createTheme();
|
|
341
|
-
// Setup format date
|
|
342
|
-
const pickup = moment(safariFix(pickupDate));
|
|
343
|
-
const from = moment(safariFix(serviceLevel.from));
|
|
344
|
-
const to = moment(safariFix(serviceLevel.to));
|
|
345
|
-
// check date format
|
|
346
|
-
const dateError = !pickup.isValid() || !from.isValid() || !to.isValid();
|
|
347
|
-
// Set first sunday
|
|
348
|
-
const firstSunday = pickup
|
|
349
|
-
.clone()
|
|
350
|
-
.subtract(DAY_REF[pickup.format("dddd")], "d");
|
|
351
|
-
// Set last sunday
|
|
352
|
-
const lastSunday = to.clone().add(7 - DAY_REF[to.format("dddd")], "d");
|
|
353
|
-
switch (lastSunday.diff(firstSunday, "days")) {
|
|
354
|
-
case 7:
|
|
355
|
-
lastSunday.add(21, "d");
|
|
356
|
-
break;
|
|
357
|
-
case 14:
|
|
358
|
-
lastSunday.add(14, "d");
|
|
359
|
-
break;
|
|
360
|
-
case 21:
|
|
361
|
-
lastSunday.add(7, "d");
|
|
362
|
-
break;
|
|
363
|
-
}
|
|
364
|
-
if (dateError) {
|
|
365
|
-
return jsxRuntime.jsx("div", { children: "Error: Check date" });
|
|
366
|
-
}
|
|
367
|
-
return (jsxRuntime.jsxs(Box__default["default"], Object.assign({ component: "div", sx: {
|
|
368
|
-
color: theme.palette.mode === "dark" ? "white" : "#607d8b",
|
|
369
|
-
padding: "0px 10px 0px 10px",
|
|
370
|
-
} }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, justifyContent: "space-between" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center", spacing: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx("img", { src: serviceLevel.iconProps.icon, alt: serviceLevel.serviceLevel, style: { width: 35 } }) })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true }, { children: [jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6", style: {
|
|
371
|
-
color: serviceLevel.iconProps.color,
|
|
372
|
-
textTransform: "capitalize",
|
|
373
|
-
} }, { children: serviceLevel.serviceLevel })), jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", style: { marginTop: -6 } }, { children: serviceLevel.description }))] }))] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6" }, { children: formattedPrice(serviceLevel.totalRate) })) }))] })), jsxRuntime.jsx(CalendarDaysWrapper, {}), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", color: "#607d8b", variant: "caption" }, { children: pickup.format("MMMM YY") })) })), jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "div", className: "calendar-container" }, { children: genCalendar({
|
|
374
|
-
firstSunday,
|
|
375
|
-
from,
|
|
376
|
-
to,
|
|
377
|
-
pickup,
|
|
378
|
-
lastSunday,
|
|
379
|
-
serviceLevel,
|
|
380
|
-
onSelect,
|
|
381
|
-
selected,
|
|
382
|
-
}) }))] })));
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
*
|
|
386
|
-
*/
|
|
387
|
-
function CalendarDaysWrapper() {
|
|
388
|
-
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "div", className: "calendar-container", sx: {
|
|
389
|
-
justifyContent: "space-between",
|
|
390
|
-
padding: "0px 15px 0px 10px",
|
|
391
|
-
textAlign: "center",
|
|
392
|
-
marginTop: 2.5,
|
|
393
|
-
color: "#607d8b",
|
|
394
|
-
} }, { children: weekDays.map((weekDay) => (jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", color: "inherit", style: { fontWeight: 600 } }, { children: weekDay.toUpperCase() }), toolkit.nanoid()))) })));
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* @param root0
|
|
398
|
-
* @param root0.firstSunday
|
|
399
|
-
* @param root0.from
|
|
400
|
-
* @param root0.to
|
|
401
|
-
* @param root0.pickup
|
|
402
|
-
* @param root0.lastSunday
|
|
403
|
-
* @param root0.serviceLevel
|
|
404
|
-
* @param root0.onSelect
|
|
405
|
-
* @param root0.selected
|
|
406
|
-
*/
|
|
407
|
-
function genCalendar({ firstSunday, from, to, pickup, lastSunday, serviceLevel, onSelect, selected, }) {
|
|
408
|
-
const JSX = [];
|
|
409
|
-
const d = firstSunday.clone();
|
|
410
|
-
const serviceLevelRange = moment().range(from, to);
|
|
411
|
-
const firstTransitDay = pickup.clone().add(1, "d");
|
|
412
|
-
const lastTransitDay = from.clone().subtract(1, "d");
|
|
413
|
-
const transitRange = moment().range(firstTransitDay, lastTransitDay);
|
|
414
|
-
while (!d.isSame(lastSunday, "day")) {
|
|
415
|
-
JSX.push(jsxRuntime.jsx(Day, { day: d.clone(), selectable: serviceLevelRange.contains(d), grouped: serviceLevel.grouped && serviceLevelRange.contains(d), color: serviceLevel.iconProps.color, onSelect: (daySelected) => onSelect({
|
|
416
|
-
date: daySelected.format("YYYY-MM-DD"),
|
|
417
|
-
element: serviceLevel,
|
|
418
|
-
}), pickup: d.isSame(pickup, "day"), transit: transitRange.contains(d), flexible: serviceLevel.flexible && serviceLevelRange.contains(d), selected: selected &&
|
|
419
|
-
selected.element.serviceLevel === serviceLevel.serviceLevel &&
|
|
420
|
-
(serviceLevel.flexible
|
|
421
|
-
? serviceLevelRange.contains(d)
|
|
422
|
-
: d.isSame(moment(selected.date), "day")), first: d.isSame(firstTransitDay, "day") || d.isSame(from, "day"), last: d.isSame(lastTransitDay, "day") || d.isSame(to, "day") }, d.toDate().getTime()));
|
|
423
|
-
d.add(1, "d");
|
|
424
|
-
}
|
|
425
|
-
return JSX;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
const RenderOptionTemplate$1 = ({ renderOptionProps, option, }) => {
|
|
429
|
-
return (jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "li", sx: {
|
|
430
|
-
backgroundColor: "transparent",
|
|
431
|
-
svg: { flexShrink: 0, color: "white" },
|
|
432
|
-
cursor: "pointer",
|
|
433
|
-
"&:hover": {
|
|
434
|
-
backgroundColor: "rgba(0, 0, 0, 0.08)",
|
|
435
|
-
},
|
|
436
|
-
} }, renderOptionProps, { children: jsxRuntime.jsx(CardHeader__default["default"], { avatar: jsxRuntime.jsx(Avatar__default["default"], Object.assign({ sx: {
|
|
437
|
-
bgcolor: colors.blue[500],
|
|
438
|
-
}, "aria-label": "Customer" }, { children: jsxRuntime.jsx(CorporateFareIcon__default["default"], { fontSize: "medium" }) })), title: setTemplateContentByType$1(option), titleTypographyProps: {
|
|
439
|
-
fontWeight: "500",
|
|
440
|
-
variant: "body1",
|
|
441
|
-
}, subheader: setTemplateContentByType$1(option), sx: {
|
|
442
|
-
py: 1,
|
|
443
|
-
px: 1,
|
|
444
|
-
} }) })));
|
|
445
|
-
};
|
|
446
|
-
/**
|
|
447
|
-
* @param option
|
|
448
|
-
*/
|
|
449
|
-
function setTemplateContentByType$1(option) {
|
|
450
|
-
return option.name;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
// Enums
|
|
454
|
-
var QuoteAuxContent;
|
|
455
|
-
(function (QuoteAuxContent) {
|
|
456
|
-
QuoteAuxContent["LTL"] = "LTL";
|
|
457
|
-
QuoteAuxContent["EXPEDITED"] = "Expedited";
|
|
458
|
-
QuoteAuxContent["TL"] = "TL";
|
|
459
|
-
QuoteAuxContent["FEET"] = "feet";
|
|
460
|
-
QuoteAuxContent["DRY"] = "Dry";
|
|
461
|
-
QuoteAuxContent["REEFER"] = "Reefer";
|
|
462
|
-
QuoteAuxContent["CONSIGNEE"] = "Drop-off";
|
|
463
|
-
QuoteAuxContent["SHIPPER"] = "Pick-up";
|
|
464
|
-
QuoteAuxContent["DROP_OFF"] = "Drop-off";
|
|
465
|
-
QuoteAuxContent["PICK_UP"] = "Pick-up";
|
|
466
|
-
QuoteAuxContent["INCHES"] = "inches";
|
|
467
|
-
})(QuoteAuxContent || (QuoteAuxContent = {}));
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Customer type guard.
|
|
471
|
-
*
|
|
472
|
-
* @param {any} customerJson Customer object from API
|
|
473
|
-
* @returns {boolean} Return true if type is Customer_Entity
|
|
474
|
-
*/
|
|
475
|
-
function isCustomer_Entity(customerJson) {
|
|
476
|
-
if (typeof customerJson === "object" && customerJson != null) {
|
|
477
|
-
Customer_Entity.requiredFields.forEach((element) => {
|
|
478
|
-
if (!Object.keys(customerJson).includes(element))
|
|
479
|
-
throw new Error(`Field ${element} is null or undefined`);
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
return true;
|
|
483
|
-
}
|
|
484
|
-
class Customer_Entity {
|
|
485
|
-
constructor(customerJson) {
|
|
486
|
-
if (isCustomer_Entity(customerJson)) {
|
|
487
|
-
this.id = customerJson.id;
|
|
488
|
-
this.name = customerJson.name;
|
|
489
|
-
this.company_id = customerJson.company_id;
|
|
490
|
-
this.credit_on_hold = customerJson.credit_on_hold;
|
|
491
|
-
this.inactivity_hold = customerJson.inactivity_hold;
|
|
492
|
-
this.credit_term_id = customerJson.credit_term_id;
|
|
493
|
-
this.line1 = customerJson.line1;
|
|
494
|
-
this.city = customerJson.city;
|
|
495
|
-
this.state = customerJson.state;
|
|
496
|
-
this.zip = customerJson.zip;
|
|
497
|
-
this.is_active = customerJson.is_active;
|
|
498
|
-
this.credit_term_name = customerJson.credit_term_name;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
Customer_Entity.requiredFields = [
|
|
503
|
-
"id",
|
|
504
|
-
"name",
|
|
505
|
-
"company_id",
|
|
506
|
-
"credit_on_hold",
|
|
507
|
-
"inactivity_hold",
|
|
508
|
-
"credit_term_id",
|
|
509
|
-
"line1",
|
|
510
|
-
"city",
|
|
511
|
-
"state",
|
|
512
|
-
"zip",
|
|
513
|
-
"is_active",
|
|
514
|
-
"credit_term_name",
|
|
515
|
-
];
|
|
516
|
-
|
|
517
|
-
class Customer extends Customer_Entity {
|
|
518
|
-
static fromList(customersJSON) {
|
|
519
|
-
const customers = [];
|
|
520
|
-
if (customersJSON)
|
|
521
|
-
Array.isArray(customersJSON) &&
|
|
522
|
-
customersJSON.forEach((userJSON) => {
|
|
523
|
-
customers.push(new Customer(userJSON));
|
|
524
|
-
});
|
|
525
|
-
return customers;
|
|
526
|
-
}
|
|
527
|
-
toJson() {
|
|
528
|
-
return JSON.stringify(this);
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Customer type guard.
|
|
534
|
-
*
|
|
535
|
-
* @param {any} locationJson Customer object from API
|
|
536
|
-
* @returns {boolean} Return true if type is Customer_Entity
|
|
537
|
-
*/
|
|
538
|
-
function isLocation_Entity(locationJson) {
|
|
539
|
-
if (typeof locationJson === "object" && locationJson != null) {
|
|
540
|
-
Location_Entity.requiredFields.forEach((element) => {
|
|
541
|
-
if (!Object.keys(locationJson).includes(element))
|
|
542
|
-
throw new Error(`Field ${element} is null or undefined`);
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
return true;
|
|
546
|
-
}
|
|
547
|
-
class Location_Entity {
|
|
548
|
-
constructor(customerJson) {
|
|
549
|
-
if (isLocation_Entity(customerJson)) {
|
|
550
|
-
this.id = customerJson.id;
|
|
551
|
-
this.name = customerJson.name;
|
|
552
|
-
this.contact = customerJson.contact;
|
|
553
|
-
this.phone = customerJson.phone;
|
|
554
|
-
this.accessorials = customerJson.accessorials;
|
|
555
|
-
this.address = customerJson.address;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
Location_Entity.requiredFields = [
|
|
560
|
-
"id",
|
|
561
|
-
"name",
|
|
562
|
-
"contact",
|
|
563
|
-
"phone",
|
|
564
|
-
"accessorials",
|
|
565
|
-
"address",
|
|
566
|
-
];
|
|
567
|
-
|
|
568
|
-
class Location extends Location_Entity {
|
|
569
|
-
static fromList(locationJSON) {
|
|
570
|
-
const locations = [];
|
|
571
|
-
if (locationJSON)
|
|
572
|
-
Array.isArray(locationJSON) &&
|
|
573
|
-
locationJSON.forEach((locationJSON) => {
|
|
574
|
-
locations.push(new Location(locationJSON));
|
|
575
|
-
});
|
|
576
|
-
return locations;
|
|
577
|
-
}
|
|
578
|
-
toJson() {
|
|
579
|
-
return JSON.stringify(this);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Market Costs type guard.
|
|
585
|
-
*
|
|
586
|
-
* @param {any} marketCostsJSON Quote object from API
|
|
587
|
-
* @returns {boolean} Return true if type is MarketCosts_Entity
|
|
588
|
-
*/
|
|
589
|
-
function isMarketCosts_Entity(marketCostsJSON) {
|
|
590
|
-
if (typeof marketCostsJSON === "object" && marketCostsJSON != null) {
|
|
591
|
-
MarketCosts_Entity.requiredFields.forEach((element) => {
|
|
592
|
-
if (!Object.keys(marketCostsJSON).includes(element))
|
|
593
|
-
throw new Error(`Field ${element} is null or undefined`);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
return true;
|
|
597
|
-
}
|
|
598
|
-
class MarketCosts_Entity {
|
|
599
|
-
constructor(marketCostsJSON) {
|
|
600
|
-
if (isMarketCosts_Entity(marketCostsJSON)) {
|
|
601
|
-
this.id = marketCostsJSON.id;
|
|
602
|
-
this.total_cost = marketCostsJSON.total_cost;
|
|
603
|
-
this.total_cost_with_margin = marketCostsJSON.total_cost_with_margin;
|
|
604
|
-
this.margin = marketCostsJSON.margin;
|
|
605
|
-
this.otr_miles = marketCostsJSON.otr_miles;
|
|
606
|
-
this.fuel_cost = marketCostsJSON.fuel_cost;
|
|
607
|
-
this.linehaul_cost = marketCostsJSON.linehaul_cost;
|
|
608
|
-
this.truckload_total_cost = marketCostsJSON.truckload_total_cost;
|
|
609
|
-
this.ltl_pallet_percentage = marketCostsJSON.ltl_pallet_percentage;
|
|
610
|
-
this.stop_fees = marketCostsJSON.stop_fees;
|
|
611
|
-
this.market_data = marketCostsJSON.market_data;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
MarketCosts_Entity.requiredFields = [
|
|
616
|
-
"id",
|
|
617
|
-
"total_cost",
|
|
618
|
-
"total_cost_with_margin",
|
|
619
|
-
"margin",
|
|
620
|
-
"otr_miles",
|
|
621
|
-
"fuel_cost",
|
|
622
|
-
"linehaul_cost",
|
|
623
|
-
"truckload_total_cost",
|
|
624
|
-
"ltl_pallet_percentage",
|
|
625
|
-
"stop_fees",
|
|
626
|
-
"market_data",
|
|
627
|
-
];
|
|
628
|
-
|
|
629
|
-
class MarketCosts extends MarketCosts_Entity {
|
|
630
|
-
static fromList(quoteJSON) {
|
|
631
|
-
const quotes = [];
|
|
632
|
-
if (quoteJSON)
|
|
633
|
-
Array.isArray(quoteJSON) &&
|
|
634
|
-
quoteJSON.forEach((quoteJSON) => {
|
|
635
|
-
quotes.push(new MarketCosts(quoteJSON));
|
|
636
|
-
});
|
|
637
|
-
return quotes;
|
|
638
|
-
}
|
|
639
|
-
toJson() {
|
|
640
|
-
return JSON.stringify(this);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Quote type guard.
|
|
646
|
-
*
|
|
647
|
-
* @param {any} quoteJson Quote object from API
|
|
648
|
-
* @returns {boolean} Return true if type is Quote_Entity
|
|
649
|
-
*/
|
|
650
|
-
function isQuote_Entity(quoteJson) {
|
|
651
|
-
if (typeof quoteJson === "object" && quoteJson != null) {
|
|
652
|
-
Quote_Entity.requiredFields.forEach((element) => {
|
|
653
|
-
if (!Object.keys(quoteJson).includes(element))
|
|
654
|
-
throw new Error(`Field ${element} is null or undefined`);
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
return true;
|
|
658
|
-
}
|
|
659
|
-
class Quote_Entity {
|
|
660
|
-
constructor(quoteJson) {
|
|
661
|
-
if (isQuote_Entity(quoteJson)) {
|
|
662
|
-
this.id = quoteJson.id;
|
|
663
|
-
this.customerId = quoteJson.customerId;
|
|
664
|
-
this.customerName = quoteJson.customerName;
|
|
665
|
-
this.createdAt = quoteJson.createdAt;
|
|
666
|
-
this.commodityDescription = quoteJson.commodityDescription;
|
|
667
|
-
this.commodityDescriptionId = quoteJson.commodityDescriptionId;
|
|
668
|
-
this.totalMiles = quoteJson.totalMiles;
|
|
669
|
-
this.pallets = quoteJson.pallets;
|
|
670
|
-
this.pieces = quoteJson.pieces;
|
|
671
|
-
this.freightClass = quoteJson.freightClass;
|
|
672
|
-
this.dryVanOnly = quoteJson.dryVanOnly;
|
|
673
|
-
this.feet = quoteJson.feet;
|
|
674
|
-
this.weight = quoteJson.weight;
|
|
675
|
-
this.type = quoteJson.type;
|
|
676
|
-
this.stops = quoteJson.stops;
|
|
677
|
-
this.serviceLevels = quoteJson.serviceLevels;
|
|
678
|
-
this.accessorials = quoteJson.accessorials;
|
|
679
|
-
this.units = quoteJson.units;
|
|
680
|
-
this.api = quoteJson.api;
|
|
681
|
-
this.version = quoteJson.version;
|
|
682
|
-
this.transitTime = quoteJson.transitTime;
|
|
683
|
-
this.temp = quoteJson.temp;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
Quote_Entity.requiredFields = [
|
|
688
|
-
"id",
|
|
689
|
-
"customerId",
|
|
690
|
-
"customerName",
|
|
691
|
-
"createdAt",
|
|
692
|
-
"commodityDescription",
|
|
693
|
-
"commodityDescriptionId",
|
|
694
|
-
"pallets",
|
|
695
|
-
"pieces",
|
|
696
|
-
"dryVanOnly",
|
|
697
|
-
"feet",
|
|
698
|
-
"weight",
|
|
699
|
-
"type",
|
|
700
|
-
"stops",
|
|
701
|
-
"serviceLevels",
|
|
702
|
-
"units",
|
|
703
|
-
"api",
|
|
704
|
-
"version",
|
|
705
|
-
];
|
|
706
|
-
|
|
707
|
-
class QuoteRequest extends Quote_Entity {
|
|
708
|
-
static fromList(quoteJSON) {
|
|
709
|
-
const quotes = [];
|
|
710
|
-
if (quoteJSON)
|
|
711
|
-
Array.isArray(quoteJSON) &&
|
|
712
|
-
quoteJSON.forEach((quoteJSON) => {
|
|
713
|
-
quotes.push(new QuoteRequest(quoteJSON));
|
|
714
|
-
});
|
|
715
|
-
return quotes;
|
|
716
|
-
}
|
|
717
|
-
toJson() {
|
|
718
|
-
return JSON.stringify(this);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
const getQuoteAccessorials = toolkit.createAction("newQuote/getAccessorials", function prepare() {
|
|
723
|
-
const request = new nerdNetwork.GetAction("/quote-service/accessorials");
|
|
724
|
-
request.decodeResponse = (dispatch, json) => {
|
|
725
|
-
const accessorials = json;
|
|
726
|
-
dispatch(getQuoteAccessorialsSuccess(accessorials));
|
|
727
|
-
};
|
|
728
|
-
return {
|
|
729
|
-
payload: {
|
|
730
|
-
id: toolkit.nanoid(),
|
|
731
|
-
request,
|
|
732
|
-
},
|
|
733
|
-
};
|
|
734
|
-
});
|
|
735
|
-
const getQuoteAccessorialsSuccess = toolkit.createAction("quote/getQuoteSuccess", function prepare(accessorials) {
|
|
736
|
-
return {
|
|
737
|
-
payload: {
|
|
738
|
-
accessorials,
|
|
739
|
-
id: toolkit.nanoid(),
|
|
740
|
-
createdAt: new Date().toISOString(),
|
|
741
|
-
},
|
|
742
|
-
};
|
|
743
|
-
});
|
|
744
|
-
// Get commodity description
|
|
745
|
-
const getQuoteCommodityDescription = toolkit.createAction("newQuote/getQuoteCommodityDescription", function prepare() {
|
|
746
|
-
const request = new nerdNetwork.GetAction("/commodity_descriptions", {}, "v1");
|
|
747
|
-
request.decodeResponse = (dispatch, json) => {
|
|
748
|
-
const commodity_descriptions = json;
|
|
749
|
-
dispatch(getQuoteCommodityDescirptionSuccess(commodity_descriptions));
|
|
750
|
-
};
|
|
751
|
-
return {
|
|
752
|
-
payload: {
|
|
753
|
-
id: toolkit.nanoid(),
|
|
754
|
-
request,
|
|
755
|
-
},
|
|
756
|
-
};
|
|
757
|
-
});
|
|
758
|
-
const getQuoteCommodityDescirptionSuccess = toolkit.createAction("quote/getCommodityDescriptionSuccess", function prepare(commodityDescriptions) {
|
|
759
|
-
return {
|
|
760
|
-
payload: {
|
|
761
|
-
commodityDescriptions,
|
|
762
|
-
id: toolkit.nanoid(),
|
|
763
|
-
createdAt: new Date().toISOString(),
|
|
764
|
-
},
|
|
765
|
-
};
|
|
766
|
-
});
|
|
767
|
-
// Store Pallet
|
|
768
|
-
const storePallets = toolkit.createAction("quote/storePallets", function prepare(pallets) {
|
|
769
|
-
const request = new nerdNetwork.PostAction("/quote-service/pallets", pallets);
|
|
770
|
-
request.decodeResponse = (dispatch, json) => {
|
|
771
|
-
const pallet = json;
|
|
772
|
-
dispatch(storePalletUnitSuccess(pallet));
|
|
773
|
-
dispatch(storePalletError({ uuid: "", status: 0 }));
|
|
774
|
-
};
|
|
775
|
-
return {
|
|
776
|
-
payload: {
|
|
777
|
-
id: toolkit.nanoid(),
|
|
778
|
-
createdAt: new Date().toISOString(),
|
|
779
|
-
request,
|
|
780
|
-
},
|
|
781
|
-
};
|
|
782
|
-
});
|
|
783
|
-
const storePalletUnitSuccess = toolkit.createAction("quote/storePalletUnitSuccess", function prepare(units) {
|
|
784
|
-
return {
|
|
785
|
-
payload: {
|
|
786
|
-
units,
|
|
787
|
-
id: toolkit.nanoid(),
|
|
788
|
-
createdAt: new Date().toISOString(),
|
|
789
|
-
},
|
|
790
|
-
};
|
|
791
|
-
});
|
|
792
|
-
const storePalletError = toolkit.createAction("quote/storePalletError", function prepare(error) {
|
|
793
|
-
return {
|
|
794
|
-
payload: {
|
|
795
|
-
error,
|
|
796
|
-
id: toolkit.nanoid(),
|
|
797
|
-
createdAt: new Date().toISOString(),
|
|
798
|
-
},
|
|
799
|
-
};
|
|
800
|
-
});
|
|
801
|
-
// Search customer
|
|
802
|
-
const getCustomers = toolkit.createAction("customers/search/getCustomers", function prepare(query) {
|
|
803
|
-
const request = new nerdNetwork.GetAction("/customers/search", query, "v1");
|
|
804
|
-
request.decodeResponse = (dispatch, json) => {
|
|
805
|
-
const customers = Customer.fromList(json);
|
|
806
|
-
dispatch(getCustomersSuccess(customers));
|
|
807
|
-
};
|
|
808
|
-
return {
|
|
809
|
-
payload: {
|
|
810
|
-
id: toolkit.nanoid(),
|
|
811
|
-
request,
|
|
812
|
-
},
|
|
813
|
-
};
|
|
814
|
-
});
|
|
815
|
-
const getCustomersSuccess = toolkit.createAction("customers/search/getCustomersSuccess", function prepare(customers) {
|
|
816
|
-
return {
|
|
817
|
-
payload: {
|
|
818
|
-
customers,
|
|
819
|
-
id: toolkit.nanoid(),
|
|
820
|
-
createdAt: new Date().toISOString(),
|
|
821
|
-
},
|
|
822
|
-
};
|
|
823
|
-
});
|
|
824
|
-
// Facility search
|
|
825
|
-
const getFacility = toolkit.createAction("locations/search/getFacility", function prepare(query) {
|
|
826
|
-
const request = new nerdNetwork.GetAction("/locations/search", query);
|
|
827
|
-
request.decodeResponse = (dispatch, json) => {
|
|
828
|
-
const locations = Location.fromList(json);
|
|
829
|
-
dispatch(getArcherLocationsSuccess(locations));
|
|
830
|
-
};
|
|
831
|
-
return {
|
|
832
|
-
payload: {
|
|
833
|
-
id: toolkit.nanoid(),
|
|
834
|
-
request,
|
|
835
|
-
},
|
|
836
|
-
};
|
|
837
|
-
});
|
|
838
|
-
const getArcherLocationsSuccess = toolkit.createAction("locations/search/getArcherLocationsSuccess", function prepare(locations) {
|
|
839
|
-
return {
|
|
840
|
-
payload: {
|
|
841
|
-
locations,
|
|
842
|
-
id: toolkit.nanoid(),
|
|
843
|
-
createdAt: new Date().toISOString(),
|
|
844
|
-
},
|
|
845
|
-
};
|
|
846
|
-
});
|
|
847
|
-
const removeArcherLocations = toolkit.createAction("locations/search/removeArcherLocations", function prepare() {
|
|
848
|
-
return {
|
|
849
|
-
payload: {},
|
|
850
|
-
};
|
|
851
|
-
});
|
|
852
|
-
// Facility search
|
|
853
|
-
const storeNewLocation = toolkit.createAction("locations/saveNewLocation", function prepare(newLocation) {
|
|
854
|
-
const request = new nerdNetwork.PostAction("/locations", newLocation);
|
|
855
|
-
request.decodeResponse = (dispatch) => {
|
|
856
|
-
dispatch(setSavingActionLocation(true, "POST"));
|
|
857
|
-
};
|
|
858
|
-
return {
|
|
859
|
-
payload: {
|
|
860
|
-
id: toolkit.nanoid(),
|
|
861
|
-
createdAt: new Date().toISOString(),
|
|
862
|
-
request,
|
|
863
|
-
},
|
|
864
|
-
};
|
|
865
|
-
});
|
|
866
|
-
const setSavingActionLocation = toolkit.createAction("locations/setSavingActionLocation", function prepare(isSuccess, method) {
|
|
867
|
-
return {
|
|
868
|
-
payload: {
|
|
869
|
-
changeLocationSucess: {
|
|
870
|
-
isSuccess,
|
|
871
|
-
method,
|
|
872
|
-
},
|
|
873
|
-
id: toolkit.nanoid(),
|
|
874
|
-
createdAt: new Date().toISOString(),
|
|
875
|
-
},
|
|
876
|
-
};
|
|
877
|
-
});
|
|
878
|
-
// Facility search
|
|
879
|
-
const updateLocation = toolkit.createAction("locations/updateLocation", function prepare(id, newLocation) {
|
|
880
|
-
const request = new nerdNetwork.PutAction(`/locations/${id}`, newLocation);
|
|
881
|
-
request.decodeResponse = (dispatch) => {
|
|
882
|
-
dispatch(setSavingActionLocation(true, "PUT"));
|
|
883
|
-
};
|
|
884
|
-
return {
|
|
885
|
-
payload: {
|
|
886
|
-
id: toolkit.nanoid(),
|
|
887
|
-
createdAt: new Date().toISOString(),
|
|
888
|
-
request,
|
|
889
|
-
},
|
|
890
|
-
};
|
|
891
|
-
});
|
|
892
|
-
// Store QuoteForm
|
|
893
|
-
const storeQuoteFormData = toolkit.createAction("locations/storeQuoteFormData", function prepare(quoteFormData) {
|
|
894
|
-
return {
|
|
895
|
-
payload: {
|
|
896
|
-
quoteFormData,
|
|
897
|
-
},
|
|
898
|
-
};
|
|
899
|
-
});
|
|
900
|
-
// Store QuoteForm
|
|
901
|
-
const setIsQuoteFormSubmitted = toolkit.createAction("quote/isQuoteFormSubmitted", function prepare(isQuoteFormSubmitted) {
|
|
902
|
-
return {
|
|
903
|
-
payload: {
|
|
904
|
-
isQuoteFormSubmitted,
|
|
905
|
-
},
|
|
906
|
-
};
|
|
907
|
-
});
|
|
908
|
-
// POST Form
|
|
909
|
-
const sendFormData = toolkit.createAction("quote-service/quotes/multistop", function prepare(quoteFormData) {
|
|
910
|
-
const request = new nerdNetwork.PostAction(`/quote-service/quotes/multistop`, quoteFormData);
|
|
911
|
-
request.decodeResponse = (dispatch, json) => {
|
|
912
|
-
const quoteResponse = new QuoteRequest(json);
|
|
913
|
-
dispatch(getQuoteResponseSuccess(quoteResponse));
|
|
914
|
-
};
|
|
915
|
-
return {
|
|
916
|
-
payload: {
|
|
917
|
-
id: toolkit.nanoid(),
|
|
918
|
-
createdAt: new Date().toISOString(),
|
|
919
|
-
request,
|
|
920
|
-
},
|
|
921
|
-
};
|
|
922
|
-
});
|
|
923
|
-
const getQuoteResponseSuccess = toolkit.createAction("quote/getQuoteResponseSuccess", function prepare(quoteResponse) {
|
|
924
|
-
return {
|
|
925
|
-
payload: {
|
|
926
|
-
quoteResponse,
|
|
927
|
-
},
|
|
928
|
-
};
|
|
929
|
-
});
|
|
930
|
-
// Get Market Costs
|
|
931
|
-
const getMarketCosts = toolkit.createAction("quote/getMarketCosts", function prepare(quoteId) {
|
|
932
|
-
const request = new nerdNetwork.GetAction(`/quotes/${quoteId}/market_costs`, {}, "v1");
|
|
933
|
-
request.decodeResponse = (dispatch, json) => {
|
|
934
|
-
const marketCosts = new MarketCosts(json);
|
|
935
|
-
dispatch(getMarketCostsSuccess(marketCosts));
|
|
936
|
-
};
|
|
937
|
-
return {
|
|
938
|
-
payload: {
|
|
939
|
-
id: toolkit.nanoid(),
|
|
940
|
-
request,
|
|
941
|
-
},
|
|
942
|
-
};
|
|
943
|
-
});
|
|
944
|
-
const getMarketCostsSuccess = toolkit.createAction("quote/getMarketCosts/getMarketCostsSuccess", function prepare(marketCosts) {
|
|
945
|
-
return {
|
|
946
|
-
payload: {
|
|
947
|
-
marketCosts,
|
|
948
|
-
id: toolkit.nanoid(),
|
|
949
|
-
createdAt: new Date().toISOString(),
|
|
950
|
-
},
|
|
951
|
-
};
|
|
952
|
-
});
|
|
953
|
-
// Get QuoteById
|
|
954
|
-
const getQuoteById = toolkit.createAction("quote-service/quotes/:id", function prepare(quoteId) {
|
|
955
|
-
const request = new nerdNetwork.GetAction(`/quote-service/quotes/${quoteId}`);
|
|
956
|
-
request.decodeResponse = (dispatch, json) => {
|
|
957
|
-
const quoteResponse = new QuoteRequest(json);
|
|
958
|
-
dispatch(getQuoteResponseSuccess(quoteResponse));
|
|
959
|
-
};
|
|
960
|
-
return {
|
|
961
|
-
payload: {
|
|
962
|
-
id: toolkit.nanoid(),
|
|
963
|
-
request,
|
|
964
|
-
},
|
|
965
|
-
};
|
|
966
|
-
});
|
|
967
|
-
// Get QuoteById
|
|
968
|
-
const getQuotePathEdgeCosts = toolkit.createAction("quote_path_edge_costs", function prepare(query) {
|
|
969
|
-
const request = new nerdNetwork.GetAction(`/quote_path_edge_costs`, query, "v1");
|
|
970
|
-
request.decodeResponse = (dispatch, json) => {
|
|
971
|
-
const costBreakdown = json;
|
|
972
|
-
dispatch(getQuotePathEdgeCostsSucess(costBreakdown));
|
|
973
|
-
};
|
|
974
|
-
return {
|
|
975
|
-
payload: {
|
|
976
|
-
id: toolkit.nanoid(),
|
|
977
|
-
request,
|
|
978
|
-
},
|
|
979
|
-
};
|
|
980
|
-
});
|
|
981
|
-
const getQuotePathEdgeCostsSucess = toolkit.createAction("quote/quote_path_edge_costs/getQuotePathEdgeCostsSucess", function prepare(costsBreakdown) {
|
|
982
|
-
return {
|
|
983
|
-
payload: {
|
|
984
|
-
costsBreakdown,
|
|
985
|
-
id: toolkit.nanoid(),
|
|
986
|
-
createdAt: new Date().toISOString(),
|
|
987
|
-
},
|
|
988
|
-
};
|
|
989
|
-
});
|
|
990
|
-
|
|
991
|
-
const initState = {
|
|
992
|
-
accessorials: {
|
|
993
|
-
ltlAccessorials: [],
|
|
994
|
-
tlAccessorials: [],
|
|
995
|
-
},
|
|
996
|
-
commodity_descriptions: [],
|
|
997
|
-
units: {
|
|
998
|
-
feet: 0,
|
|
999
|
-
height: 0,
|
|
1000
|
-
palletPositions: 0,
|
|
1001
|
-
pallets: 0,
|
|
1002
|
-
pieces: 0,
|
|
1003
|
-
weight: 0,
|
|
1004
|
-
},
|
|
1005
|
-
error: {
|
|
1006
|
-
uuid: "",
|
|
1007
|
-
status: 0,
|
|
1008
|
-
},
|
|
1009
|
-
customers: [],
|
|
1010
|
-
archerLocations: [],
|
|
1011
|
-
newLocation: {},
|
|
1012
|
-
changeLocationSucess: {
|
|
1013
|
-
isSuccess: false,
|
|
1014
|
-
method: "",
|
|
1015
|
-
},
|
|
1016
|
-
quoteFormData: {
|
|
1017
|
-
service: QuoteAuxContent.LTL,
|
|
1018
|
-
commodityDescriptionId: 0,
|
|
1019
|
-
freightClass: "",
|
|
1020
|
-
mode: QuoteAuxContent.DRY,
|
|
1021
|
-
dryVanOnly: false,
|
|
1022
|
-
shippers: [],
|
|
1023
|
-
consignees: [],
|
|
1024
|
-
units: {
|
|
1025
|
-
palletDimensions: [],
|
|
1026
|
-
totalDimensions: {
|
|
1027
|
-
totalWeight: "",
|
|
1028
|
-
},
|
|
1029
|
-
},
|
|
1030
|
-
reefer: {
|
|
1031
|
-
reeferTemp: "",
|
|
1032
|
-
reeferCont: false,
|
|
1033
|
-
},
|
|
1034
|
-
},
|
|
1035
|
-
isQuoteFormSubmitted: false,
|
|
1036
|
-
quoteResponse: {},
|
|
1037
|
-
marketCosts: {},
|
|
1038
|
-
costsBreakdown: [],
|
|
1039
|
-
};
|
|
1040
|
-
const quoteReducer = toolkit.createReducer(initState, (builder) => {
|
|
1041
|
-
builder.addCase(getQuoteAccessorialsSuccess, (state, action) => {
|
|
1042
|
-
console.log("[nerd-sales-kit]: getQuoteAccessorialsSuccess", action.payload);
|
|
1043
|
-
state.accessorials = {
|
|
1044
|
-
ltlAccessorials: action.payload.accessorials.ltlAccessorials,
|
|
1045
|
-
tlAccessorials: action.payload.accessorials.tlAccessorials,
|
|
1046
|
-
};
|
|
1047
|
-
return state;
|
|
1048
|
-
});
|
|
1049
|
-
builder.addCase(getQuoteCommodityDescirptionSuccess, (state, action) => {
|
|
1050
|
-
console.log("[nerd-sales-kit]: getQuoteCommodityDescriptionSuccess", action.payload);
|
|
1051
|
-
console.log("STATEABOUT", action.payload.commodityDescriptions);
|
|
1052
|
-
state.commodity_descriptions = action.payload.commodityDescriptions;
|
|
1053
|
-
return state;
|
|
1054
|
-
});
|
|
1055
|
-
builder.addCase(storePalletUnitSuccess, (state, action) => {
|
|
1056
|
-
console.log("[nerd-sales-kit]: storePalletUnitSuccess", action.payload);
|
|
1057
|
-
state.units = action.payload.units;
|
|
1058
|
-
return state;
|
|
1059
|
-
});
|
|
1060
|
-
builder.addCase(storePalletError, (state, action) => {
|
|
1061
|
-
console.log("[nerd-sales-kit]: storePalletError", action.payload);
|
|
1062
|
-
// console.log("ERROR", action.payload.errors)
|
|
1063
|
-
state.error = action.payload.error;
|
|
1064
|
-
return state;
|
|
1065
|
-
});
|
|
1066
|
-
builder.addCase(getCustomersSuccess, (state, action) => {
|
|
1067
|
-
console.log("[nerd-sales-kit]: getCustomersSuccess", action.payload);
|
|
1068
|
-
state.customers = [...action.payload.customers];
|
|
1069
|
-
return state;
|
|
1070
|
-
});
|
|
1071
|
-
builder.addCase(getArcherLocationsSuccess, (state, action) => {
|
|
1072
|
-
console.log("[nerd-sales-kit]: getArcherLocationsSuccess", action.payload);
|
|
1073
|
-
state.archerLocations = [...action.payload.locations];
|
|
1074
|
-
return state;
|
|
1075
|
-
});
|
|
1076
|
-
builder.addCase(removeArcherLocations, (state, action) => {
|
|
1077
|
-
console.log("[nerd-sales-kit]: removeArcherLocations", action.payload);
|
|
1078
|
-
state.archerLocations = [];
|
|
1079
|
-
return state;
|
|
1080
|
-
});
|
|
1081
|
-
builder.addCase(storeNewLocation, (state, action) => {
|
|
1082
|
-
console.log("[nerd-sales-kit]: storeNewLocation", action.payload);
|
|
1083
|
-
state.newLocation = action.payload.request.body;
|
|
1084
|
-
return state;
|
|
1085
|
-
});
|
|
1086
|
-
builder.addCase(updateLocation, (state, action) => {
|
|
1087
|
-
console.log("[nerd-sales-kit]: storeNewLocation", action.payload);
|
|
1088
|
-
state.newLocation = Object.assign({}, action.payload.request.body);
|
|
1089
|
-
return state;
|
|
1090
|
-
});
|
|
1091
|
-
builder.addCase(setSavingActionLocation, (state, action) => {
|
|
1092
|
-
console.log("[nerd-sales-kit]: setSavingActionLocation", action.payload);
|
|
1093
|
-
state.changeLocationSucess = action.payload.changeLocationSucess;
|
|
1094
|
-
return state;
|
|
1095
|
-
});
|
|
1096
|
-
builder.addCase(storeQuoteFormData, (state, action) => {
|
|
1097
|
-
state.quoteFormData = Object.assign(Object.assign({}, state.quoteFormData), action.payload.quoteFormData);
|
|
1098
|
-
return state;
|
|
1099
|
-
});
|
|
1100
|
-
builder.addCase(setIsQuoteFormSubmitted, (state, action) => {
|
|
1101
|
-
state.isQuoteFormSubmitted = action.payload.isQuoteFormSubmitted;
|
|
1102
|
-
return state;
|
|
1103
|
-
});
|
|
1104
|
-
builder.addCase(getQuoteResponseSuccess, (state, action) => {
|
|
1105
|
-
state.quoteResponse = action.payload.quoteResponse;
|
|
1106
|
-
return state;
|
|
1107
|
-
});
|
|
1108
|
-
builder.addCase(getMarketCostsSuccess, (state, action) => {
|
|
1109
|
-
state.marketCosts = action.payload.marketCosts;
|
|
1110
|
-
return state;
|
|
1111
|
-
});
|
|
1112
|
-
builder.addCase(getQuotePathEdgeCostsSucess, (state, action) => {
|
|
1113
|
-
state.costsBreakdown = action.payload.costsBreakdown;
|
|
1114
|
-
return state;
|
|
1115
|
-
});
|
|
1116
|
-
});
|
|
1117
|
-
|
|
1118
|
-
const quoteAccessorialsSelector = (state) => state.quoteState.accessorials;
|
|
1119
|
-
const quoteCommodityDescriptionSelector = (state) => state.quoteState.commodity_descriptions;
|
|
1120
|
-
const quoteUnitsSelector = (state) => state.quoteState.units;
|
|
1121
|
-
const quoteErrorSelector = (state) => state.quoteState.error;
|
|
1122
|
-
const quoteCustomersSelector = (state) => state.quoteState.customers;
|
|
1123
|
-
const quoteArcherLocationsSelector = (state) => state.quoteState.archerLocations;
|
|
1124
|
-
|
|
1125
|
-
const Loading = (props) => {
|
|
1126
|
-
var _a;
|
|
1127
|
-
return (jsxRuntime.jsx(Skeleton__default["default"], Object.assign({ animation: "wave", variant: "rectangular", width: "100%", height: (_a = props.height) !== null && _a !== void 0 ? _a : 50 }, props)));
|
|
1128
|
-
};
|
|
1129
|
-
|
|
1130
|
-
/******************************************************************************
|
|
1131
|
-
Copyright (c) Microsoft Corporation.
|
|
1132
|
-
|
|
1133
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1134
|
-
purpose with or without fee is hereby granted.
|
|
1135
|
-
|
|
1136
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1137
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1138
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1139
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1140
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1141
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1142
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1143
|
-
***************************************************************************** */
|
|
1144
|
-
|
|
1145
|
-
function __rest(s, e) {
|
|
1146
|
-
var t = {};
|
|
1147
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1148
|
-
t[p] = s[p];
|
|
1149
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1150
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1151
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1152
|
-
t[p[i]] = s[p[i]];
|
|
1153
|
-
}
|
|
1154
|
-
return t;
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1158
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1159
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1160
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1161
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1162
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1163
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* @param props
|
|
1169
|
-
*/
|
|
1170
|
-
function BootstrapDialogTitle(props) {
|
|
1171
|
-
const { children, onClose } = props, other = __rest(props, ["children", "onClose"]);
|
|
1172
|
-
return (jsxRuntime.jsxs(DialogTitle__default["default"], Object.assign({ sx: { m: 0, p: 2, display: "flex", justifyContent: "space-between" } }, other, { children: [children, onClose ? (jsxRuntime.jsx(IconButton__default["default"], Object.assign({ "aria-label": "close", onClick: onClose }, { children: jsxRuntime.jsx(CloseIcon__default["default"], {}) }))) : null] })));
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
const calendarInitialState = {
|
|
1176
|
-
date: "",
|
|
1177
|
-
element: {
|
|
1178
|
-
id: "0",
|
|
1179
|
-
description: "",
|
|
1180
|
-
serviceLevel: "",
|
|
1181
|
-
baseRate: 0,
|
|
1182
|
-
extra: 0,
|
|
1183
|
-
fuelRate: 0,
|
|
1184
|
-
totalRate: 0,
|
|
1185
|
-
flexible: true,
|
|
1186
|
-
from: "0",
|
|
1187
|
-
to: "0",
|
|
1188
|
-
},
|
|
1189
|
-
};
|
|
1190
|
-
const calendarSlice = toolkit.createSlice({
|
|
1191
|
-
name: "calendarSlice",
|
|
1192
|
-
initialState: calendarInitialState,
|
|
1193
|
-
reducers: {
|
|
1194
|
-
DateSelectedHandler: (state, action) => {
|
|
1195
|
-
state = action.payload;
|
|
1196
|
-
return state;
|
|
1197
|
-
},
|
|
1198
|
-
},
|
|
1199
|
-
});
|
|
1200
|
-
const { DateSelectedHandler } = calendarSlice.actions;
|
|
1201
|
-
var calendarSlice$1 = calendarSlice.reducer;
|
|
1202
|
-
|
|
1203
|
-
const nerdSalesKitReducer = toolkit.combineReducers({
|
|
1204
|
-
selectedDateRange: calendarSlice$1,
|
|
1205
|
-
quoteState: quoteReducer,
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
const QuoteSelect = ({ isMobile, selectOptions, onChange, value, labelId, inputLabel, required, }) => {
|
|
1209
|
-
return (jsxRuntime.jsxs(FormControl__default["default"], Object.assign({ component: "fieldset", fullWidth: true }, { children: [inputLabel && (jsxRuntime.jsx(InputLabel__default["default"], Object.assign({ variant: "standard", htmlFor: nerdUi.setAxeValue(labelId), margin: "dense" }, { children: inputLabel }))), isMobile ? (jsxRuntime.jsx(NativeSelect__default["default"], Object.assign({ defaultValue: 30, sx: { width: "100%" } }, { children: selectOptions.map((option, i) => (jsxRuntime.jsx("option", Object.assign({ value: option }, { children: option }), i))) }))) : (jsxRuntime.jsx(Select__default["default"], Object.assign({ labelId: nerdUi.setAxeValue(labelId), id: `select-${nerdUi.setAxeValue(labelId)}`, "aria-label": nerdUi.setAxeValue(labelId), "aria-labelledby": nerdUi.setAxeValue(labelId), value: value, onChange: onChange, variant: "standard", defaultValue: value, label: inputLabel, fullWidth: true }, { children: selectOptions.map((option) => (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ value: option }, { children: option }), option))) }))), required && (jsxRuntime.jsx(FormHelperText__default["default"], Object.assign({ sx: { marginLeft: 0 } }, { children: "required" })))] })));
|
|
1210
|
-
};
|
|
1211
|
-
|
|
1212
|
-
const PalletCount = ({ palletDimensions, tmpPallet, onChange, onKeyPress, onBlur, onDelete, onDimensionEdit, }) => {
|
|
1213
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: 4 }, { children: jsxRuntime.jsx(TextField__default["default"], { id: "palletCount", label: jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "Pallets size will be verified on server side to check the equipment compability.", variant: "body1" }, { children: "Pallet Count" })), placeholder: "Enter Pallet Count", value: tmpPallet ? tmpPallet.count : "", onChange: onChange, fullWidth: true, variant: "standard", InputLabelProps: {
|
|
1214
|
-
shrink: true,
|
|
1215
|
-
}, sx: {
|
|
1216
|
-
"& .MuiInputLabel-root": {
|
|
1217
|
-
display: "flex",
|
|
1218
|
-
},
|
|
1219
|
-
}, required: palletDimensions && palletDimensions.length > 0 ? false : true, helperText: palletDimensions && palletDimensions.length > 0 ? "" : "required", onKeyPress: onKeyPress, onBlur: onBlur }) })), palletDimensions &&
|
|
1220
|
-
palletDimensions.map((p, index) => {
|
|
1221
|
-
const { units, length, width, height, count } = p;
|
|
1222
|
-
const unitSymbol = units === QuoteAuxContent.INCHES ? "″" : "′";
|
|
1223
|
-
return (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, xs: 6, sm: 2 }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center", spacing: 1, mb: 1, flexWrap: "nowrap" }, { children: [p.stackable && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Tooltip__default["default"], Object.assign({ title: "Stackable" }, { children: jsxRuntime.jsx("img", { src: "https://storage.googleapis.com/archer-public/assets/stack.png", alt: "Stackable", height: "15" }) })) }))), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx("img", { src: "https://storage.googleapis.com/archer-public/assets/dimension.png", alt: "dimension", height: "15" }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { children: `${length}${unitSymbol}x${width}${unitSymbol}x${height}${unitSymbol}` }) }))] })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "flex-start", spacing: 1, justifyContent: "space-between", className: "container", sx: {
|
|
1224
|
-
background: "#EBEBEB",
|
|
1225
|
-
minWidth: 120,
|
|
1226
|
-
borderRadius: 1,
|
|
1227
|
-
paddingLeft: "0.5rem",
|
|
1228
|
-
paddingRight: "0.5rem",
|
|
1229
|
-
} }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, sx: { fontWeight: "400" } }, { children: count })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(EditIcon__default["default"], { onClick: () => onDimensionEdit(index), style: { cursor: "pointer" } }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(CloseIcon__default["default"], { onClick: () => onDelete(index), style: { cursor: "pointer" } }) }))] })) }))] }))] }), index));
|
|
1230
|
-
})] }));
|
|
1231
|
-
};
|
|
1232
|
-
|
|
1233
|
-
// Regular Expressions allow only numbers
|
|
1234
|
-
const re$1 = /^[0-9\b]+$/;
|
|
1235
|
-
// New Quote
|
|
1236
|
-
const FREIGHT_CLASS = [
|
|
1237
|
-
"500",
|
|
1238
|
-
"400",
|
|
1239
|
-
"300",
|
|
1240
|
-
"250",
|
|
1241
|
-
"200",
|
|
1242
|
-
"175",
|
|
1243
|
-
"150",
|
|
1244
|
-
"125",
|
|
1245
|
-
"110",
|
|
1246
|
-
"100",
|
|
1247
|
-
"92",
|
|
1248
|
-
"85",
|
|
1249
|
-
"77",
|
|
1250
|
-
"70",
|
|
1251
|
-
"65",
|
|
1252
|
-
"60",
|
|
1253
|
-
"55",
|
|
1254
|
-
"50",
|
|
1255
|
-
];
|
|
1256
|
-
const QUOTE_MAX_STOPS = 10;
|
|
1257
|
-
const options$2 = [
|
|
1258
|
-
QuoteAuxContent.LTL,
|
|
1259
|
-
QuoteAuxContent.TL,
|
|
1260
|
-
QuoteAuxContent.EXPEDITED,
|
|
1261
|
-
];
|
|
1262
|
-
|
|
1263
|
-
const PalletChecker = (props) => {
|
|
1264
|
-
const { totalWeight, palletDimensions, dispatch, networkCompletionStack, units, stateError, } = props;
|
|
1265
|
-
const initialValue = 0;
|
|
1266
|
-
const [loading, setLoading] = React.useState(false);
|
|
1267
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
1268
|
-
const totalPalletCount = palletDimensions.reduce((previousValue, currentValue) => previousValue + +currentValue.count, initialValue);
|
|
1269
|
-
const totalDimension = units.feet ? units.feet : totalPalletCount * 2;
|
|
1270
|
-
const storePallet = React.useCallback((pallets) => {
|
|
1271
|
-
setLoading(true);
|
|
1272
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, storePallets(pallets));
|
|
1273
|
-
setRequestUUID(uuid);
|
|
1274
|
-
}, []);
|
|
1275
|
-
React.useEffect(() => {
|
|
1276
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
1277
|
-
setLoading(false);
|
|
1278
|
-
}
|
|
1279
|
-
}, [requestUUID, networkCompletionStack]);
|
|
1280
|
-
React.useEffect(() => {
|
|
1281
|
-
if (totalWeight !== "" && palletDimensions.length > 0) {
|
|
1282
|
-
const overridePallet = palletDimensions.map((item) => (Object.assign(Object.assign({}, item), { count: +item.count, weight: +totalWeight / totalPalletCount })));
|
|
1283
|
-
setLoading(true);
|
|
1284
|
-
storePallet(overridePallet);
|
|
1285
|
-
}
|
|
1286
|
-
setTimeout(() => {
|
|
1287
|
-
setLoading(false);
|
|
1288
|
-
}, 1000);
|
|
1289
|
-
}, [totalWeight, palletDimensions]);
|
|
1290
|
-
if (loading) {
|
|
1291
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(CircularProgress__default["default"], { size: 20 }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { display: "block", variant: "caption", text: "Checking Equipment Compatibility ..." }) }))] }));
|
|
1292
|
-
}
|
|
1293
|
-
if (stateError.uuid !== "" ||
|
|
1294
|
-
palletDimensions.filter((e) => e.units === QuoteAuxContent.FEET).length > 0) {
|
|
1295
|
-
return (jsxRuntime.jsx(React__default["default"].Fragment, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Chip__default["default"], { avatar: jsxRuntime.jsx(Avatar__default["default"], Object.assign({ style: { color: "white", background: "#ff9800" } }, { children: jsxRuntime.jsx(WarningIcon__default["default"], { sx: { width: "0.8em" } }) })), sx: { fontWeight: 400, border: "1px solid #ff9800" }, label: "Equipment compatibility issue" }) })) }));
|
|
1296
|
-
}
|
|
1297
|
-
return (jsxRuntime.jsx(React__default["default"].Fragment, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Chip__default["default"], { avatar: jsxRuntime.jsx(Avatar__default["default"], Object.assign({ style: { color: "white", background: "#4caf50" } }, { children: jsxRuntime.jsx(CheckIcon__default["default"], {}) })), sx: { fontWeight: 400, border: "1px solid #4caf50" }, label: `Total: ${totalDimension} ft, ${totalWeight} lb, ${totalPalletCount} Pallet${palletDimensions.length > 1 ? "s" : ""} ` }) })) }));
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
const EditPallet = ({ fullScreen, open, close, pallet, save, }) => {
|
|
1301
|
-
const theme = styles.useTheme();
|
|
1302
|
-
const isMobile = useMediaQuery__default["default"](theme.breakpoints.down("sm"));
|
|
1303
|
-
const [tmpPallet, setTmpPallet] = React.useState(Object.assign({}, pallet));
|
|
1304
|
-
const { length, width, height, count } = tmpPallet;
|
|
1305
|
-
const onChangeHanlder = (type) => (event) => {
|
|
1306
|
-
const value = event.target.value;
|
|
1307
|
-
if (["count", "length", "width", "height", "units"].includes(type)) {
|
|
1308
|
-
setTmpPallet(Object.assign(Object.assign({}, tmpPallet), { [type]: value }));
|
|
1309
|
-
}
|
|
1310
|
-
};
|
|
1311
|
-
return (jsxRuntime.jsxs(Dialog__default["default"], Object.assign({ fullScreen: isMobile || fullScreen, open: open, scroll: "paper", onClose: close, "aria-labelledby": "responsive-dialog-title" }, { children: [jsxRuntime.jsx(DialogTitle__default["default"], Object.assign({ id: "alert-dialog-title" }, { children: "Custom Dimension" })), jsxRuntime.jsxs(DialogContent__default["default"], { children: [jsxRuntime.jsx(DialogContentText__default["default"], { children: "Enter custom pallet information" }), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, mt: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "count", label: "Count", placeholder: "Count", value: count, onChange: onChangeHanlder("count"), type: "text", fullWidth: true }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "pieces", label: "Pieces", placeholder: "Count", fullWidth: true }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(QuoteSelect, { inputLabel: "Units", label: "Inches", selectOptions: options$1, onChange: onChangeHanlder("units"), value: tmpPallet.units, isMobile: false, required: false, labelId: nerdUi.setAxeValue("units") }) }))] })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, mt: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "length", label: "Length per pallet", placeholder: "in inches", value: length, onChange: onChangeHanlder("length"), fullWidth: true }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "width", label: "Width per pallet", placeholder: "in inches", value: width, onChange: onChangeHanlder("width"), fullWidth: true }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 4 }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "height", label: "Height per pallet", placeholder: "in inches", value: height, onChange: onChangeHanlder("height"), fullWidth: true }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(FormGroup__default["default"], Object.assign({ row: true }, { children: jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Switch__default["default"], { value: tmpPallet.stackable, checked: tmpPallet.stackable, color: "primary", onChange: () => {
|
|
1312
|
-
setTmpPallet(Object.assign(Object.assign({}, tmpPallet), { stackable: !tmpPallet.stackable }));
|
|
1313
|
-
} }), label: "Stackable" }) })) }))] }))] }), jsxRuntime.jsxs(DialogActions__default["default"], Object.assign({ sx: { justifyContent: "space-between" } }, { children: [jsxRuntime.jsxs(Button__default["default"], Object.assign({ onClick: close, color: "inherit" }, { children: [jsxRuntime.jsx(CloseIcon__default["default"], {}), "\u00A0Close"] })), jsxRuntime.jsxs(Button__default["default"], Object.assign({ color: "primary", onClick: () => {
|
|
1314
|
-
save(tmpPallet);
|
|
1315
|
-
close();
|
|
1316
|
-
} }, { children: [jsxRuntime.jsx(CheckIcon__default["default"], {}), "Save"] }))] }))] })));
|
|
1317
|
-
};
|
|
1318
|
-
const options$1 = [QuoteAuxContent.FEET, QuoteAuxContent.INCHES];
|
|
1319
|
-
|
|
1320
|
-
var css_248z$1 = "";
|
|
1321
|
-
styleInject(css_248z$1);
|
|
1322
|
-
|
|
1323
|
-
//TODO: replace image to
|
|
1324
|
-
const RenderOptionTemplate = ({ renderOptionProps, option, renderTemplateOptions, }) => {
|
|
1325
|
-
const uniqueArray = renderTemplateOptions.filter((item, index) => renderTemplateOptions.indexOf(item) === index);
|
|
1326
|
-
const ListFoot = () => {
|
|
1327
|
-
return uniqueArray[uniqueArray.length - 1] === option ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Divider__default["default"], {}), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center", justifyContent: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, py: 1 }, { children: jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block", variant: "caption", color: "textSecondary" }, { children: ["Powered by ", jsxRuntime.jsx("b", { children: "Google" }), " and"] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Box__default["default"], Object.assign({ sx: {
|
|
1328
|
-
background: "#424242",
|
|
1329
|
-
borderRadius: 20,
|
|
1330
|
-
opacity: 0.8,
|
|
1331
|
-
marginLeft: 1,
|
|
1332
|
-
} }, { children: jsxRuntime.jsx("img", { src: "https://storage.googleapis.com/archer-app/logos/ArcherLogo.png", alt: "Archer", height: "15" }) })) }))] }))] })) : null;
|
|
1333
|
-
};
|
|
1334
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "li", sx: {
|
|
1335
|
-
backgroundColor: "transparent",
|
|
1336
|
-
svg: { flexShrink: 0, color: "white" },
|
|
1337
|
-
cursor: "pointer",
|
|
1338
|
-
"&:hover": {
|
|
1339
|
-
backgroundColor: "rgba(0, 0, 0, 0.08)",
|
|
1340
|
-
},
|
|
1341
|
-
} }, renderOptionProps, { children: jsxRuntime.jsx(CardHeader__default["default"], { avatar: jsxRuntime.jsx(Avatar__default["default"], Object.assign({ sx: {
|
|
1342
|
-
bgcolor: setTemplateIconColorByType(option),
|
|
1343
|
-
}, "aria-label": "Facility" }, { children: jsxRuntime.jsx(LocationOnTwoToneIcon__default["default"], { fontSize: "medium" }) })), title: setTemplateContentByType(option), titleTypographyProps: {
|
|
1344
|
-
fontWeight: "500",
|
|
1345
|
-
variant: "body1",
|
|
1346
|
-
}, subheader: setTemplateContentByType(option), sx: {
|
|
1347
|
-
py: 1,
|
|
1348
|
-
px: 1,
|
|
1349
|
-
} }) })), jsxRuntime.jsx(ListFoot, {})] }));
|
|
1350
|
-
};
|
|
1351
|
-
/**
|
|
1352
|
-
* @param option
|
|
1353
|
-
*/
|
|
1354
|
-
function setTemplateIconColorByType(option) {
|
|
1355
|
-
if (option.name) {
|
|
1356
|
-
return colors.blue[500];
|
|
1357
|
-
}
|
|
1358
|
-
return colors.grey[500];
|
|
1359
|
-
}
|
|
1360
|
-
/**
|
|
1361
|
-
* @param option
|
|
1362
|
-
*/
|
|
1363
|
-
function setTemplateContentByType(option) {
|
|
1364
|
-
if (option.description) {
|
|
1365
|
-
return `${option.description}`;
|
|
1366
|
-
}
|
|
1367
|
-
return option.name;
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* @param props
|
|
1372
|
-
*/
|
|
1373
|
-
function LocationsFound(props) {
|
|
1374
|
-
const { items, theme, onLocationSelected } = props;
|
|
1375
|
-
if (!items) {
|
|
1376
|
-
return (jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: { display: "block" }, variant: "h6", color: "#000", fontWeight: 500 }, { children: "No locations found" })));
|
|
1377
|
-
}
|
|
1378
|
-
return (jsxRuntime.jsx(List__default["default"], Object.assign({ sx: {
|
|
1379
|
-
overflowY: "scroll",
|
|
1380
|
-
maxHeight: "450px",
|
|
1381
|
-
"&::-webkit-scrollbar": {
|
|
1382
|
-
"-webkit-appearance": "none",
|
|
1383
|
-
width: "7px",
|
|
1384
|
-
},
|
|
1385
|
-
"&::-webkit-scrollbar-thumb": {
|
|
1386
|
-
backgroundColor: theme.palette.grey[300],
|
|
1387
|
-
borderRadius: "4px",
|
|
1388
|
-
marginTop: "2px",
|
|
1389
|
-
},
|
|
1390
|
-
} }, { children: items.length > 0 &&
|
|
1391
|
-
items.map((item) => {
|
|
1392
|
-
if (item instanceof Location) {
|
|
1393
|
-
const { name, id, contact, phone, accessorials: { ltlAccessorials }, } = item;
|
|
1394
|
-
return (jsxRuntime.jsx(ListItem__default["default"], Object.assign({ disablePadding: true }, { children: jsxRuntime.jsx(ListItemButton__default["default"], Object.assign({ onClick: () => onLocationSelected(item) }, { children: jsxRuntime.jsxs(Item$2, { children: [jsxRuntime.jsx(ListItemAvatar__default["default"], { children: jsxRuntime.jsx(Avatar__default["default"], Object.assign({ sx: { background: theme.palette.primary.light } }, { children: jsxRuntime.jsx(PlaceIcon__default["default"], { fontSize: "medium" }) })) }), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(ListItemText__default["default"], { primary: jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: { display: "block" }, variant: "h6", color: "#000", fontWeight: 500, textAlign: "left" }, { children: name })), secondary: jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: { display: "block" }, component: "span", variant: "body1", color: "text.primary", textAlign: "left" }, { children: `Contact: ${contact}` })), jsxRuntime.jsx(Typography__default["default"], Object.assign({ sx: { display: "block" }, component: "span", variant: "body1", color: "text.primary", textAlign: "left" }, { children: `Phone: ${phone}` }))] }) }) })), ltlAccessorials && ltlAccessorials.length > 0 && (jsxRuntime.jsx(Stack__default["default"], Object.assign({ direction: "row", spacing: 1 }, { children: ltlAccessorials.map((accessorial) => (jsxRuntime.jsx(Chip__default["default"], { label: `${accessorial.name}, ${accessorial.costAmount}` }, toolkit.nanoid()))) })))] }))] }) })) }), id));
|
|
1395
|
-
}
|
|
1396
|
-
return item;
|
|
1397
|
-
}) })));
|
|
1398
|
-
}
|
|
1399
|
-
const Item$2 = styles.styled(Paper__default["default"])(({ theme }) => (Object.assign(Object.assign({ backgroundColor: theme.palette.mode === "dark" ? "#1A2027" : "#fff" }, theme.typography.body2), { padding: theme.spacing(1), textAlign: "center", color: theme.palette.text.secondary, display: "flex", width: "100%", alignItems: "center" })));
|
|
1400
|
-
|
|
1401
|
-
const re = /^[0-9\b]+$/;
|
|
1402
|
-
/**
|
|
1403
|
-
* @param props
|
|
1404
|
-
* @param props.isMobile
|
|
1405
|
-
* @param props.handleCallback
|
|
1406
|
-
* @param props.editLocationData
|
|
1407
|
-
*/
|
|
1408
|
-
function NewLocationForm(props) {
|
|
1409
|
-
const { isMobile, handleCallback, editLocationData } = props;
|
|
1410
|
-
const [values, setValues] = React__default["default"].useState({
|
|
1411
|
-
name: (editLocationData === null || editLocationData === void 0 ? void 0 : editLocationData.name) || "",
|
|
1412
|
-
contact: (editLocationData === null || editLocationData === void 0 ? void 0 : editLocationData.contact) || "",
|
|
1413
|
-
phone: (editLocationData === null || editLocationData === void 0 ? void 0 : editLocationData.phone) || "",
|
|
1414
|
-
grocery: false,
|
|
1415
|
-
liftgate: false,
|
|
1416
|
-
liquor_permit: false,
|
|
1417
|
-
});
|
|
1418
|
-
const handleChange = (prop) => (event) => {
|
|
1419
|
-
if (prop === "phone" && re.test(event.target.value)) {
|
|
1420
|
-
setValues(Object.assign(Object.assign({}, values), { phone: event.target.value }));
|
|
1421
|
-
}
|
|
1422
|
-
setValues(Object.assign(Object.assign({}, values), { [prop]: event.target.value }));
|
|
1423
|
-
};
|
|
1424
|
-
const handleChangeSwitch = (prop) => (event) => {
|
|
1425
|
-
setValues(Object.assign(Object.assign({}, values), { [prop]: event.target.checked }));
|
|
1426
|
-
};
|
|
1427
|
-
React__default["default"].useEffect(() => {
|
|
1428
|
-
if (values.name !== "" &&
|
|
1429
|
-
values.contact !== "" &&
|
|
1430
|
-
values.phone.length > 4) {
|
|
1431
|
-
handleCallback(false, values);
|
|
1432
|
-
}
|
|
1433
|
-
else {
|
|
1434
|
-
handleCallback(true);
|
|
1435
|
-
}
|
|
1436
|
-
}, [values]);
|
|
1437
|
-
return (jsxRuntime.jsxs(Box__default["default"], Object.assign({ component: "form", autoComplete: "off" }, { children: [jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "div" }, { children: jsxRuntime.jsx(TextField__default["default"], { id: "standard-name", label: "Name", InputLabelProps: {
|
|
1438
|
-
shrink: true,
|
|
1439
|
-
}, placeholder: "Location's Name", value: values.name, onChange: handleChange("name"), variant: "standard", fullWidth: true, required: values.name === "", helperText: values.name === "" ? "Required" : "" }) })), jsxRuntime.jsxs(Box__default["default"], Object.assign({ component: "div", sx: {
|
|
1440
|
-
"& > :not(style)": { width: !isMobile ? "25ch" : "100%", mt: 2 },
|
|
1441
|
-
} }, { children: [jsxRuntime.jsx(TextField__default["default"], { id: "standard-contact-name", label: "Contact", InputLabelProps: {
|
|
1442
|
-
shrink: true,
|
|
1443
|
-
}, placeholder: "Contact Full Name", value: values.contact, onChange: handleChange("contact"), variant: "standard", required: values.contact === "", sx: {
|
|
1444
|
-
mr: !isMobile ? "1rem" : "0",
|
|
1445
|
-
}, helperText: values.contact === "" ? "Required" : "" }), jsxRuntime.jsx(TextField__default["default"], { id: "standard-contact-phone", label: "Phone", value: formatMobileNumber(values.phone), onChange: handleChange("phone"), variant: "standard", InputLabelProps: {
|
|
1446
|
-
shrink: true,
|
|
1447
|
-
}, placeholder: "Contact Phone", required: values.phone === "", sx: {
|
|
1448
|
-
ml: !isMobile ? "1rem" : "0",
|
|
1449
|
-
}, inputProps: { inputMode: "numeric", pattern: "[0-9]*" }, helperText: values.phone === "" ? "Required" : "" })] })), jsxRuntime.jsx(Box__default["default"], Object.assign({ component: "div", sx: {
|
|
1450
|
-
"& > :not(style)": { mt: 2 },
|
|
1451
|
-
} }, { children: jsxRuntime.jsx(FormControl__default["default"], Object.assign({ component: "fieldset", variant: "standard" }, { children: jsxRuntime.jsxs(FormGroup__default["default"], Object.assign({ sx: {
|
|
1452
|
-
flexDirection: !isMobile ? "row" : "column",
|
|
1453
|
-
justifyContent: "space-between",
|
|
1454
|
-
} }, { children: [jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Switch__default["default"], { checked: values.liftgate, onChange: handleChangeSwitch("liftgate"), name: "Lift Gate Required" }), label: "Lift Gate Required", sx: {
|
|
1455
|
-
color: !values.liftgate ? "GrayText" : "inherit",
|
|
1456
|
-
} }), jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Switch__default["default"], { checked: values.grocery, onChange: handleChangeSwitch("grocery"), name: "Grocery Warehouse" }), label: "Grocery Warehouse", sx: {
|
|
1457
|
-
color: !values.grocery ? "GrayText" : "inherit",
|
|
1458
|
-
} }), jsxRuntime.jsx(FormControlLabel__default["default"], { control: jsxRuntime.jsx(Switch__default["default"], { checked: values.liquor_permit, onChange: handleChangeSwitch("liquor_permit"), name: "Liquor Permit" }), label: "Liquor Permit", sx: {
|
|
1459
|
-
color: !values.liquor_permit ? "GrayText" : "inherit",
|
|
1460
|
-
} })] })) })) }))] })));
|
|
1461
|
-
}
|
|
1462
|
-
const formatMobileNumber = (text) => {
|
|
1463
|
-
const cleaned = ("" + text).replace(/\D/g, "");
|
|
1464
|
-
const match = cleaned.match(/^(1|)?(\d{3})(\d{3})(\d{4})$/);
|
|
1465
|
-
if (match) {
|
|
1466
|
-
const intlCode = match[1] ? "+1 " : "", number = [intlCode, "(", match[2], ") ", match[3], "-", match[4]].join("");
|
|
1467
|
-
return number;
|
|
1468
|
-
}
|
|
1469
|
-
return text;
|
|
1470
|
-
};
|
|
1471
|
-
|
|
1472
|
-
const editLocation = (props) => {
|
|
1473
|
-
const { isMobile, openDialog, handleClose, handleCallback, locationData: { name }, onUpdateLocation, isDisabled, } = props;
|
|
1474
|
-
return (jsxRuntime.jsxs(Dialog__default["default"], Object.assign({ fullScreen: isMobile, open: openDialog, onClose: handleClose, "aria-labelledby": "responsive-dialog-title", sx: {
|
|
1475
|
-
"& .MuiDialog-container": {
|
|
1476
|
-
py: 3,
|
|
1477
|
-
},
|
|
1478
|
-
} }, { children: [jsxRuntime.jsx(BootstrapDialogTitle, Object.assign({ id: "edit-location", onClose: () => handleClose("closedEdit") }, { children: name })), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, spacing: 2, flexDirection: "column", alignItems: "center" }, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mt: 1, flexDirection: "row", md: true }, { children: jsxRuntime.jsx(NewLocationForm, { isMobile: isMobile, handleCallback: handleCallback, editLocationData: props.locationData }) })) })) }), jsxRuntime.jsx(DialogActions__default["default"], Object.assign({ sx: {
|
|
1479
|
-
display: "flex",
|
|
1480
|
-
justifyContent: "flex-end",
|
|
1481
|
-
} }, { children: jsxRuntime.jsxs(Button__default["default"], Object.assign({ onClick: () => {
|
|
1482
|
-
onUpdateLocation();
|
|
1483
|
-
}, color: "success", disabled: isDisabled }, { children: [jsxRuntime.jsx(CheckIcon__default["default"], { fontSize: "medium" }), jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "body2", textTransform: "uppercase", fontSize: "1rem" }, { children: "Save" }))] })) }))] })));
|
|
1484
|
-
};
|
|
1485
|
-
|
|
1486
|
-
const LocationByAddress = (props) => {
|
|
1487
|
-
const { openDialog, setOpenLocationsByAddress, selectedLocation, isDialogClosed, dispatch, networkCompletionStack, locationState, isMobile, editLocation: editLocation$1, } = props;
|
|
1488
|
-
// TODO: Find a better approach to add responsive from root
|
|
1489
|
-
const theme = styles.useTheme();
|
|
1490
|
-
//console.log("ONEDITHANDLEBACKPROPS", props);
|
|
1491
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
1492
|
-
const [requestPending, setRequestPending] = React.useState(true);
|
|
1493
|
-
const [savingLocation, setSavingLocation] = React.useState(false);
|
|
1494
|
-
const [newLocation, setNewLocation] = React.useState(false);
|
|
1495
|
-
const [isDisabled, setIsDisabled] = React.useState(true);
|
|
1496
|
-
//const [deleteLocation, setDeleteLocation] = useState(false); //! Uncomment to enable delete location
|
|
1497
|
-
const [saveNewLocation, setSaveNewLocation] = React.useState({
|
|
1498
|
-
name: "",
|
|
1499
|
-
contact: "",
|
|
1500
|
-
phone: "",
|
|
1501
|
-
accessorialTags: [],
|
|
1502
|
-
address: {},
|
|
1503
|
-
});
|
|
1504
|
-
const archerLocations = [...locationState.quoteState.archerLocations];
|
|
1505
|
-
const isLocationEditable = editLocation$1 &&
|
|
1506
|
-
(editLocation$1.name !== "" ||
|
|
1507
|
-
editLocation$1.contact !== "" ||
|
|
1508
|
-
editLocation$1.phone !== "");
|
|
1509
|
-
const fetchPaceById = React.useCallback((placeId) => {
|
|
1510
|
-
setRequestPending(true);
|
|
1511
|
-
setNewLocation(true);
|
|
1512
|
-
const query = {
|
|
1513
|
-
placeId,
|
|
1514
|
-
};
|
|
1515
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getFacility(query));
|
|
1516
|
-
setRequestUUID(uuid);
|
|
1517
|
-
}, [dispatch]);
|
|
1518
|
-
const postNewLocation = React.useCallback((location) => {
|
|
1519
|
-
setSavingLocation(true);
|
|
1520
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, storeNewLocation(location));
|
|
1521
|
-
setRequestUUID(uuid);
|
|
1522
|
-
}, [dispatch]);
|
|
1523
|
-
const updateNewLocation = React.useCallback((id, updatelocationData) => {
|
|
1524
|
-
setSavingLocation(true);
|
|
1525
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, updateLocation(id, updatelocationData));
|
|
1526
|
-
setRequestUUID(uuid);
|
|
1527
|
-
}, [dispatch]);
|
|
1528
|
-
const handleClose = (reason, item) => {
|
|
1529
|
-
setOpenLocationsByAddress(false);
|
|
1530
|
-
isDialogClosed(reason, item);
|
|
1531
|
-
};
|
|
1532
|
-
const handleCallback = (disabled, newLocationData) => {
|
|
1533
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1534
|
-
const line1 = [];
|
|
1535
|
-
setIsDisabled(disabled);
|
|
1536
|
-
//TODO: Refactor this to decrease its Cognitive Complexity
|
|
1537
|
-
if (newLocationData) {
|
|
1538
|
-
const { grocery, liftgate, liquor_permit } = newLocationData, splittedNewLocationObject = __rest(newLocationData, ["grocery", "liftgate", "liquor_permit"]);
|
|
1539
|
-
//* Save Edit Location
|
|
1540
|
-
if (isLocationEditable) {
|
|
1541
|
-
const newLocationObject = Object.assign(Object.assign({}, splittedNewLocationObject), { accessorialTags: [
|
|
1542
|
-
...(grocery ? ["grocery"] : []),
|
|
1543
|
-
...(liftgate ? ["liftgate"] : []),
|
|
1544
|
-
...(liquor_permit ? ["liquor_permit"] : []),
|
|
1545
|
-
], address: {
|
|
1546
|
-
formattedAddress: ((_a = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _a === void 0 ? void 0 : _a.formattedAddress) || "",
|
|
1547
|
-
line1: ((_b = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _b === void 0 ? void 0 : _b.line1) || "",
|
|
1548
|
-
line2: ((_c = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _c === void 0 ? void 0 : _c.line2) || "",
|
|
1549
|
-
city: ((_d = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _d === void 0 ? void 0 : _d.city) || "",
|
|
1550
|
-
state: ((_e = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _e === void 0 ? void 0 : _e.state) || "",
|
|
1551
|
-
zip: ((_f = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _f === void 0 ? void 0 : _f.zip) || "",
|
|
1552
|
-
country: ((_g = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _g === void 0 ? void 0 : _g.country) || "",
|
|
1553
|
-
latitude: ((_h = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _h === void 0 ? void 0 : _h.latitude) || 0,
|
|
1554
|
-
longitude: ((_j = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _j === void 0 ? void 0 : _j.longitude) || 0,
|
|
1555
|
-
verified: ((_k = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _k === void 0 ? void 0 : _k.verified) || false,
|
|
1556
|
-
placeId: ((_l = editLocation$1 === null || editLocation$1 === void 0 ? void 0 : editLocation$1.address) === null || _l === void 0 ? void 0 : _l.placeId) || "",
|
|
1557
|
-
} });
|
|
1558
|
-
setSaveNewLocation(newLocationObject);
|
|
1559
|
-
}
|
|
1560
|
-
//* Save New Location
|
|
1561
|
-
else {
|
|
1562
|
-
const locationpreview = Object.assign(Object.assign({}, splittedNewLocationObject), { accessorialTags: [
|
|
1563
|
-
...(grocery ? ["grocery"] : []),
|
|
1564
|
-
...(liftgate ? ["liftgate"] : []),
|
|
1565
|
-
...(liquor_permit ? ["liquor_permit"] : []),
|
|
1566
|
-
] });
|
|
1567
|
-
const newLocationObject = Object.assign(Object.assign({}, locationpreview), { address: {
|
|
1568
|
-
formattedAddress: selectedLocation.formatted_address,
|
|
1569
|
-
latitude: selectedLocation.geometry.location.lat(),
|
|
1570
|
-
longitude: selectedLocation.geometry.location.lng(),
|
|
1571
|
-
placeId: selectedLocation.place_id,
|
|
1572
|
-
verified: true,
|
|
1573
|
-
} });
|
|
1574
|
-
/*
|
|
1575
|
-
This foreach loops google maps 'address_components' object in order to assign the equivalent values
|
|
1576
|
-
to the new address object to be sent via POST
|
|
1577
|
-
*/
|
|
1578
|
-
selectedLocation.address_components.forEach((item) => {
|
|
1579
|
-
if (item.types.includes("street_number") ||
|
|
1580
|
-
item.types.includes("route")) {
|
|
1581
|
-
line1.push(item.long_name);
|
|
1582
|
-
}
|
|
1583
|
-
else if (item.types.includes("locality")) {
|
|
1584
|
-
newLocationObject.address.city = item.long_name;
|
|
1585
|
-
}
|
|
1586
|
-
else if (item.types.includes("country")) {
|
|
1587
|
-
newLocationObject.address.country = item.short_name;
|
|
1588
|
-
}
|
|
1589
|
-
else if (item.types.includes("administrative_area_level_1")) {
|
|
1590
|
-
newLocationObject.address.state = item.short_name;
|
|
1591
|
-
}
|
|
1592
|
-
else if (item.types.includes("postal_code")) {
|
|
1593
|
-
newLocationObject.address.zip = item.long_name;
|
|
1594
|
-
}
|
|
1595
|
-
else if (item.types.includes("neighborhood")) {
|
|
1596
|
-
newLocationObject.address.line2 = item.long_name;
|
|
1597
|
-
}
|
|
1598
|
-
newLocationObject.address.line1 = line1.join(" ");
|
|
1599
|
-
});
|
|
1600
|
-
// console.log("ONEDITHANDLEBACKSAVEFORM1", newLocationObject);
|
|
1601
|
-
setSaveNewLocation(newLocationObject);
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
};
|
|
1605
|
-
React.useEffect(() => {
|
|
1606
|
-
if (selectedLocation.place_id) {
|
|
1607
|
-
fetchPaceById(selectedLocation.place_id);
|
|
1608
|
-
}
|
|
1609
|
-
}, [selectedLocation]);
|
|
1610
|
-
React.useEffect(() => {
|
|
1611
|
-
if (locationState &&
|
|
1612
|
-
locationState.quoteState.changeLocationSucess.isSuccess) {
|
|
1613
|
-
const notifierTitleSucessMethod = locationState.quoteState.changeLocationSucess.method === "POST"
|
|
1614
|
-
? "created"
|
|
1615
|
-
: "updated";
|
|
1616
|
-
dispatch(nerdUi.showNotification({
|
|
1617
|
-
notification: {
|
|
1618
|
-
uuid: toolkit.nanoid(),
|
|
1619
|
-
title: `Location has been ${notifierTitleSucessMethod}.`,
|
|
1620
|
-
severity: "success",
|
|
1621
|
-
variant: "intrusive",
|
|
1622
|
-
autohide: true,
|
|
1623
|
-
autoHideDuration: 3000,
|
|
1624
|
-
},
|
|
1625
|
-
}));
|
|
1626
|
-
handleClose("closedEdit");
|
|
1627
|
-
dispatch(setSavingActionLocation(false, ""));
|
|
1628
|
-
}
|
|
1629
|
-
}, [locationState === null || locationState === void 0 ? void 0 : locationState.quoteState.changeLocationSucess]);
|
|
1630
|
-
React.useEffect(() => {
|
|
1631
|
-
let timerActions;
|
|
1632
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
1633
|
-
timerActions = setTimeout(() => {
|
|
1634
|
-
setSavingLocation(false);
|
|
1635
|
-
setRequestPending(false);
|
|
1636
|
-
if (!archerLocations.length) {
|
|
1637
|
-
setNewLocation(false);
|
|
1638
|
-
}
|
|
1639
|
-
}, 2000);
|
|
1640
|
-
}
|
|
1641
|
-
return () => clearTimeout(timerActions);
|
|
1642
|
-
}, [requestUUID, networkCompletionStack, archerLocations]);
|
|
1643
|
-
if (savingLocation) {
|
|
1644
|
-
return (jsxRuntime.jsxs(Dialog__default["default"], Object.assign({ fullScreen: isMobile, open: openDialog, onClose: handleClose, "aria-labelledby": "responsive-dialog-title", sx: {
|
|
1645
|
-
"& .MuiPaper-root": {
|
|
1646
|
-
minWidth: "450px",
|
|
1647
|
-
minHeight: "200px",
|
|
1648
|
-
},
|
|
1649
|
-
} }, { children: [jsxRuntime.jsx(DialogTitle__default["default"], Object.assign({ id: "responsive-dialog-title" }, { children: "Creating the location..." })), jsxRuntime.jsx(Loading, {})] })));
|
|
1650
|
-
}
|
|
1651
|
-
//! This code is commented because it is not used anymore but could be used in the future
|
|
1652
|
-
// if (deleteLocation) {
|
|
1653
|
-
// return (
|
|
1654
|
-
// <DeleteLocationDialog
|
|
1655
|
-
// {...{ isMobile, openDialog }}
|
|
1656
|
-
// onCancel={() => {
|
|
1657
|
-
// setDeleteLocation(false);
|
|
1658
|
-
// }}
|
|
1659
|
-
// onConfirm={() => {
|
|
1660
|
-
// console.log("deleteLocation", editLocation, saveNewLocation);
|
|
1661
|
-
// }}
|
|
1662
|
-
// />
|
|
1663
|
-
// );
|
|
1664
|
-
// }
|
|
1665
|
-
//* Open the form to edit the location with the selected location
|
|
1666
|
-
if (editLocation$1 &&
|
|
1667
|
-
isLocationEditable &&
|
|
1668
|
-
Object.keys(editLocation$1).length > 0) {
|
|
1669
|
-
return (jsxRuntime.jsx(editLocation, Object.assign({}, { isMobile, openDialog, handleClose, isDisabled, handleCallback }, { locationData: editLocation$1, onUpdateLocation: () => {
|
|
1670
|
-
updateNewLocation(editLocation$1.id, saveNewLocation);
|
|
1671
|
-
} })));
|
|
1672
|
-
}
|
|
1673
|
-
return (jsxRuntime.jsx(Dialog__default["default"], Object.assign({ fullScreen: isMobile, open: openDialog, onClose: handleClose, "aria-labelledby": "responsive-dialog-title" }, { children: jsxRuntime.jsx(React__default["default"].Fragment, { children: requestPending ? (jsxRuntime.jsx(DialogMainBodyRequestPending, Object.assign({}, { newLocation, selectedLocation, handleClose }))) : (jsxRuntime.jsx(DialogMainBodyNoRequestPending, Object.assign({}, {
|
|
1674
|
-
archerLocations,
|
|
1675
|
-
handleClose,
|
|
1676
|
-
newLocation,
|
|
1677
|
-
selectedLocation,
|
|
1678
|
-
isMobile,
|
|
1679
|
-
handleCallback,
|
|
1680
|
-
theme,
|
|
1681
|
-
dispatch,
|
|
1682
|
-
postNewLocation,
|
|
1683
|
-
saveNewLocation,
|
|
1684
|
-
isDisabled,
|
|
1685
|
-
}))) }) })));
|
|
1686
|
-
};
|
|
1687
|
-
/**
|
|
1688
|
-
* @param root0
|
|
1689
|
-
* @param root0.newLocation
|
|
1690
|
-
* @param root0.selectedLocation
|
|
1691
|
-
* @param root0.handleClose
|
|
1692
|
-
*/
|
|
1693
|
-
function DialogMainBodyRequestPending({ newLocation, selectedLocation, handleClose, }) {
|
|
1694
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(DialogTitle__default["default"], Object.assign({ id: "responsive-dialog-title" }, { children: "Searching Locations..." })), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, flexDirection: "column", alignItems: "center" }, { children: [newLocation && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: 12 }, { children: jsxRuntime.jsx(DialogContentText__default["default"], Object.assign({ sx: {
|
|
1695
|
-
fontWeight: "400",
|
|
1696
|
-
fontSize: "1.25rem",
|
|
1697
|
-
color: "text.primary",
|
|
1698
|
-
textAlign: "center",
|
|
1699
|
-
} }, { children: selectedLocation.formatted_address })) }))), jsxRuntime.jsx(Loading, { sx: { marginTop: 6 } })] })) }), jsxRuntime.jsx(DialogActions__default["default"], { children: jsxRuntime.jsxs(Button__default["default"], Object.assign({ onClick: () => handleClose("closed"), color: "inherit" }, { children: [jsxRuntime.jsx(CloseIcon__default["default"], { fontSize: "medium" }), jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "body2", textTransform: "uppercase", fontSize: "1rem" }, { children: "cancel" }))] })) })] }));
|
|
1700
|
-
}
|
|
1701
|
-
/**
|
|
1702
|
-
* @param root0
|
|
1703
|
-
* @param root0.archerLocations
|
|
1704
|
-
* @param root0.handleClose
|
|
1705
|
-
* @param root0.newLocation
|
|
1706
|
-
* @param root0.selectedLocation
|
|
1707
|
-
* @param root0.isMobile
|
|
1708
|
-
* @param root0.handleCallback
|
|
1709
|
-
* @param root0.theme
|
|
1710
|
-
* @param root0.dispatch
|
|
1711
|
-
* @param root0.postNewLocation
|
|
1712
|
-
* @param root0.saveNewLocation
|
|
1713
|
-
* @param root0.isDisabled
|
|
1714
|
-
*/
|
|
1715
|
-
function DialogMainBodyNoRequestPending({ archerLocations, handleClose, newLocation, selectedLocation, isMobile, handleCallback, theme, dispatch, postNewLocation, saveNewLocation, isDisabled, }) {
|
|
1716
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(WrapperDialogTitle, { item: archerLocations, renderItem: (item) => item, handleClose: () => handleClose("closed") }), jsxRuntime.jsx(DialogContent__default["default"], { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, flexDirection: "column", alignItems: "flex-start" }, { children: [newLocation && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: 12 }, { children: jsxRuntime.jsx(DialogContentText__default["default"], Object.assign({ sx: {
|
|
1717
|
-
fontWeight: "400",
|
|
1718
|
-
fontSize: "1.25rem",
|
|
1719
|
-
color: "text.primary",
|
|
1720
|
-
textAlign: "center",
|
|
1721
|
-
} }, { children: selectedLocation.formatted_address })) }))), !archerLocations.length ? (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mt: 1, flexDirection: "row", md: true }, { children: jsxRuntime.jsx(NewLocationForm, { isMobile: isMobile, handleCallback: handleCallback }) }))) : (jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, mt: 1, flexDirection: "column" }, { children: jsxRuntime.jsx(LocationsFoundContainer, { archerLocations: archerLocations, theme: theme, handleClose: handleClose, handleCallback: () => dispatch(removeArcherLocations()) }) })))] })) }), jsxRuntime.jsx(DialogActions__default["default"], { children: archerLocations.length > 0 ? (jsxRuntime.jsxs(Button__default["default"], Object.assign({ onClick: () => handleClose("closed"), color: "inherit" }, { children: [jsxRuntime.jsx(CloseIcon__default["default"], { fontSize: "medium" }), jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "body2", textTransform: "uppercase", fontSize: "1rem" }, { children: "cancel" }))] }))) : (jsxRuntime.jsxs(Button__default["default"], Object.assign({ onClick: () => {
|
|
1722
|
-
postNewLocation(saveNewLocation);
|
|
1723
|
-
}, color: "success", disabled: isDisabled }, { children: [jsxRuntime.jsx(CheckIcon__default["default"], { fontSize: "medium" }), jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "body2", textTransform: "uppercase", fontSize: "1rem" }, { children: "Save" }))] }))) })] }));
|
|
1724
|
-
}
|
|
1725
|
-
/**
|
|
1726
|
-
* @param props
|
|
1727
|
-
* @param props.archerLocations
|
|
1728
|
-
* @param props.requestPending
|
|
1729
|
-
* @param props.theme
|
|
1730
|
-
* @param props.handleClose
|
|
1731
|
-
* @param props.handleCallback
|
|
1732
|
-
*/
|
|
1733
|
-
function LocationsFoundContainer(props) {
|
|
1734
|
-
const { archerLocations, theme, handleClose, handleCallback } = props;
|
|
1735
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsx(LocationsFound, { items: archerLocations, theme: theme, onLocationSelected: (item) => {
|
|
1736
|
-
handleClose("closed", item);
|
|
1737
|
-
} }), jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body2", textAlign: "center", mb: 2 }, { children: "Can't find the spot you are looking for ?" })), jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: () => {
|
|
1738
|
-
// TODO: set Open
|
|
1739
|
-
handleCallback();
|
|
1740
|
-
}, color: "inherit", sx: {
|
|
1741
|
-
width: "30%",
|
|
1742
|
-
alignSelf: "center",
|
|
1743
|
-
} }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body2", textTransform: "uppercase", color: theme.palette.primary.main }, { children: "New Location" })) }))] }));
|
|
1744
|
-
}
|
|
1745
|
-
//! Uncomment later if delete location will be used
|
|
1746
|
-
// function DeleteLocationDialog(props: {
|
|
1747
|
-
// isMobile: boolean;
|
|
1748
|
-
// openDialog: boolean;
|
|
1749
|
-
// onCancel: () => void;
|
|
1750
|
-
// onConfirm: () => void;
|
|
1751
|
-
// }) {
|
|
1752
|
-
// const { isMobile, openDialog, onCancel, onConfirm } = props;
|
|
1753
|
-
// return (
|
|
1754
|
-
// <Dialog
|
|
1755
|
-
// fullScreen={isMobile}
|
|
1756
|
-
// open={openDialog}
|
|
1757
|
-
// TransitionComponent={Transition}
|
|
1758
|
-
// aria-labelledby="responsive-delete-dialod-location"
|
|
1759
|
-
// sx={{
|
|
1760
|
-
// textAlign: "center",
|
|
1761
|
-
// }}
|
|
1762
|
-
// >
|
|
1763
|
-
// <Transition in={openDialog} timeout={300}>
|
|
1764
|
-
// <CancelOutlinedIcon
|
|
1765
|
-
// color="error"
|
|
1766
|
-
// fontSize="large"
|
|
1767
|
-
// sx={{ alignSelf: "center", fontSize: "5rem", mt: 2 }}
|
|
1768
|
-
// />
|
|
1769
|
-
// </Transition>
|
|
1770
|
-
// <DialogTitle id="responsive-delete-dialod-location-title" variant="h6">
|
|
1771
|
-
// {"Are you sure?"}
|
|
1772
|
-
// </DialogTitle>
|
|
1773
|
-
// <DialogContent>
|
|
1774
|
-
// <DialogContentText
|
|
1775
|
-
// id="responsive-delete-dialod-location-description"
|
|
1776
|
-
// color="inherit"
|
|
1777
|
-
// >
|
|
1778
|
-
// If you delete this location, you won't be able to recover it.
|
|
1779
|
-
// </DialogContentText>
|
|
1780
|
-
// </DialogContent>
|
|
1781
|
-
// <DialogActions sx={{ alignSelf: "center", my: 2 }}>
|
|
1782
|
-
// <Button
|
|
1783
|
-
// onClick={onCancel}
|
|
1784
|
-
// variant="contained"
|
|
1785
|
-
// sx={{
|
|
1786
|
-
// backgroundColor: "#999999",
|
|
1787
|
-
// "&:hover": {
|
|
1788
|
-
// backgroundColor: "#999999",
|
|
1789
|
-
// boxShadow:
|
|
1790
|
-
// "0 14px 26px -12px rgba(153, 153, 153, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(153, 153, 153, 0.2)",
|
|
1791
|
-
// },
|
|
1792
|
-
// }}
|
|
1793
|
-
// >
|
|
1794
|
-
// <Typography variant="body2" textTransform="uppercase" fontSize="1rem">
|
|
1795
|
-
// Cancel
|
|
1796
|
-
// </Typography>
|
|
1797
|
-
// </Button>
|
|
1798
|
-
// <Button variant="contained" color="error" onClick={onConfirm}>
|
|
1799
|
-
// <Typography variant="body2" textTransform="uppercase" fontSize="1rem">
|
|
1800
|
-
// I am sure
|
|
1801
|
-
// </Typography>
|
|
1802
|
-
// </Button>
|
|
1803
|
-
// </DialogActions>
|
|
1804
|
-
// </Dialog>
|
|
1805
|
-
// );
|
|
1806
|
-
// }
|
|
1807
|
-
const WrapperDialogTitle = (props) => {
|
|
1808
|
-
if (Array.isArray(props.item) && props.item.length > 0) {
|
|
1809
|
-
const plural = props.item.length > 1 ? "s" : "";
|
|
1810
|
-
return (jsxRuntime.jsx(BootstrapDialogTitle, Object.assign({ id: "customized-dialog-title" }, { children: `${props.item.length} Location${plural} Found:` })));
|
|
1811
|
-
}
|
|
1812
|
-
return (jsxRuntime.jsx(BootstrapDialogTitle, Object.assign({ id: "customized-dialog-title", onClose: props.handleClose }, { children: "Let's Create a New Location" })));
|
|
1813
|
-
};
|
|
1814
|
-
|
|
1815
|
-
/**
|
|
1816
|
-
* @param props
|
|
1817
|
-
*/
|
|
1818
|
-
function LocationFinder(props) {
|
|
1819
|
-
// Component props
|
|
1820
|
-
const { service, dispatch, networkCompletionStack, zipLocation, className, stopType, onLocationSelectedHandler, } = props;
|
|
1821
|
-
const theme = styles.useTheme();
|
|
1822
|
-
const isMobile = useMediaQuery__default["default"](theme.breakpoints.down("md"));
|
|
1823
|
-
const [open, setOpen] = React.useState(false);
|
|
1824
|
-
const [googleSuggestionsOptions, setGoogleSuggestionsOptions] = React.useState([]);
|
|
1825
|
-
const [requestUUID, setRequestUUID] = React__default["default"].useState("");
|
|
1826
|
-
// This state is used to set the bounds of the autocomplete search to accouracy of the user's location
|
|
1827
|
-
const [bounds, setBounds] = React__default["default"].useState({
|
|
1828
|
-
east: 0,
|
|
1829
|
-
north: 0,
|
|
1830
|
-
south: 0,
|
|
1831
|
-
west: 0,
|
|
1832
|
-
});
|
|
1833
|
-
const [isOptionSelected, setIsOptionSelected] = React.useState(false);
|
|
1834
|
-
// This state represents the value selected by the user
|
|
1835
|
-
const [value, setValue] = React__default["default"].useState(null);
|
|
1836
|
-
// This state represents the value displayed in the textbox
|
|
1837
|
-
const [inputValue, setInputValue] = React.useState("");
|
|
1838
|
-
// This state represents the location selected by the user
|
|
1839
|
-
const [selectedLocation, setSelectedLocation] = React.useState({
|
|
1840
|
-
address_components: [],
|
|
1841
|
-
formatted_address: "",
|
|
1842
|
-
geometry: {},
|
|
1843
|
-
place_id: "",
|
|
1844
|
-
types: [],
|
|
1845
|
-
});
|
|
1846
|
-
const [openLocationsByAddress, setOpenLocationsByAddress] = React__default["default"].useState(false);
|
|
1847
|
-
// This state represents the locaton to be Updated or deleted
|
|
1848
|
-
const [editLocation, setEditLocation] = React__default["default"].useState({
|
|
1849
|
-
name: "",
|
|
1850
|
-
contact: "",
|
|
1851
|
-
phone: "",
|
|
1852
|
-
address: {},
|
|
1853
|
-
});
|
|
1854
|
-
const [requestPending, setRequestPending] = React.useState(false);
|
|
1855
|
-
const geocoder = service ? new service.googleService.maps.Geocoder() : null;
|
|
1856
|
-
const mapsAutocompleteService = service
|
|
1857
|
-
? new service.googleService.maps.places.AutocompleteService()
|
|
1858
|
-
: null;
|
|
1859
|
-
const renderTemplateOptions = [];
|
|
1860
|
-
// Set the facility input value to the created location
|
|
1861
|
-
React.useEffect(() => {
|
|
1862
|
-
//console.log("ADDVALUETOINPUT", service?.quoteState.newLocation);
|
|
1863
|
-
if (service && service.quoteState.newLocation.name) {
|
|
1864
|
-
setValue(service.quoteState.newLocation.name);
|
|
1865
|
-
setIsOptionSelected(true);
|
|
1866
|
-
setEditLocation(service.quoteState.newLocation);
|
|
1867
|
-
}
|
|
1868
|
-
}, [service === null || service === void 0 ? void 0 : service.quoteState.newLocation]);
|
|
1869
|
-
React.useEffect(() => {
|
|
1870
|
-
// console.log("CLOSEDDIALOG2", value);
|
|
1871
|
-
// Send location object to state form
|
|
1872
|
-
if (onLocationSelectedHandler && value && Object.keys(value).length > 0) {
|
|
1873
|
-
onLocationSelectedHandler(value);
|
|
1874
|
-
}
|
|
1875
|
-
}, [value]);
|
|
1876
|
-
const fetchFacility = React.useCallback((location, zip) => {
|
|
1877
|
-
setRequestPending(true);
|
|
1878
|
-
const query = {
|
|
1879
|
-
zip,
|
|
1880
|
-
location,
|
|
1881
|
-
};
|
|
1882
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getFacility(query));
|
|
1883
|
-
setRequestUUID(uuid);
|
|
1884
|
-
}, [dispatch]);
|
|
1885
|
-
// This function is called when the user fill location input and set the bound to get more accurate results
|
|
1886
|
-
/**
|
|
1887
|
-
* @param googleGeocoder
|
|
1888
|
-
* @param boundValue
|
|
1889
|
-
* @param actionType
|
|
1890
|
-
*/
|
|
1891
|
-
function setGeoCodeData(googleGeocoder, boundValue, actionType) {
|
|
1892
|
-
if (googleGeocoder) {
|
|
1893
|
-
googleGeocoder.geocode({ address: boundValue }, (results, status) => {
|
|
1894
|
-
if (status === google.maps.GeocoderStatus.OK &&
|
|
1895
|
-
results &&
|
|
1896
|
-
results.length > 0) {
|
|
1897
|
-
switch (actionType) {
|
|
1898
|
-
case "setBound": {
|
|
1899
|
-
const lat = results[0].geometry.location.lat();
|
|
1900
|
-
const lng = results[0].geometry.location.lng();
|
|
1901
|
-
const geoCodeBounds = new google.maps.LatLngBounds(new google.maps.LatLng(lat, lng), new google.maps.LatLng(lat, lng));
|
|
1902
|
-
setBounds(geoCodeBounds);
|
|
1903
|
-
break;
|
|
1904
|
-
}
|
|
1905
|
-
case "setLocationGoogle": {
|
|
1906
|
-
setSelectedLocation([...results][0]);
|
|
1907
|
-
break;
|
|
1908
|
-
}
|
|
1909
|
-
case "setLocationArcher": {
|
|
1910
|
-
setSelectedLocation([...results][0]);
|
|
1911
|
-
break;
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
});
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
// This function is called when the user selects an option from the list
|
|
1919
|
-
/**
|
|
1920
|
-
* @param newValue
|
|
1921
|
-
*/
|
|
1922
|
-
function onLocationSelect(newValue) {
|
|
1923
|
-
if (newValue instanceof Location) {
|
|
1924
|
-
setGeoCodeData(geocoder, newValue.name, "setLocationArcher");
|
|
1925
|
-
}
|
|
1926
|
-
// If location is selected from Google autocomplete
|
|
1927
|
-
setGeoCodeData(geocoder, newValue.description, "setLocationGoogle");
|
|
1928
|
-
}
|
|
1929
|
-
/**
|
|
1930
|
-
* @param inputChangeValue
|
|
1931
|
-
*/
|
|
1932
|
-
function setGoogleLocationsArray(inputChangeValue) {
|
|
1933
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1934
|
-
const getGeocoderResponse = yield setGoogleLocations(mapsAutocompleteService, bounds, inputChangeValue);
|
|
1935
|
-
if (getGeocoderResponse) {
|
|
1936
|
-
const { predictions } = getGeocoderResponse;
|
|
1937
|
-
setGoogleSuggestionsOptions(predictions);
|
|
1938
|
-
}
|
|
1939
|
-
});
|
|
1940
|
-
}
|
|
1941
|
-
// This function handles the autocomplete changes made by the user
|
|
1942
|
-
const onChangeHandler = (_event, newValue) => {
|
|
1943
|
-
onLocationSelect(newValue);
|
|
1944
|
-
// Validate to thow new address location dialog
|
|
1945
|
-
if ("description" in newValue) {
|
|
1946
|
-
setIsOptionSelected(false);
|
|
1947
|
-
setInputValue("");
|
|
1948
|
-
setOpenLocationsByAddress(true);
|
|
1949
|
-
}
|
|
1950
|
-
else {
|
|
1951
|
-
setIsOptionSelected(true);
|
|
1952
|
-
setValue(newValue);
|
|
1953
|
-
}
|
|
1954
|
-
};
|
|
1955
|
-
React__default["default"].useEffect(() => {
|
|
1956
|
-
if (inputValue) {
|
|
1957
|
-
fetchFacility(inputValue, zipLocation ? zipLocation : undefined);
|
|
1958
|
-
setGoogleLocationsArray(inputValue);
|
|
1959
|
-
}
|
|
1960
|
-
}, [inputValue]);
|
|
1961
|
-
React__default["default"].useEffect(() => {
|
|
1962
|
-
if (zipLocation) {
|
|
1963
|
-
setGeoCodeData(geocoder, zipLocation, "setBound");
|
|
1964
|
-
}
|
|
1965
|
-
}, [zipLocation]);
|
|
1966
|
-
React.useEffect(() => {
|
|
1967
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
1968
|
-
setRequestPending(false);
|
|
1969
|
-
}
|
|
1970
|
-
}, [requestUUID, networkCompletionStack]);
|
|
1971
|
-
// This function is called when the user clicks the close facility button
|
|
1972
|
-
const closeInput = () => {
|
|
1973
|
-
setInputValue("");
|
|
1974
|
-
setValue(null);
|
|
1975
|
-
setOpen(false);
|
|
1976
|
-
setIsOptionSelected(false);
|
|
1977
|
-
setEditLocation({});
|
|
1978
|
-
isLocationByAddressDialogClosed("closed");
|
|
1979
|
-
};
|
|
1980
|
-
const isLocationByAddressDialogClosed = (reason, item) => {
|
|
1981
|
-
console.log("CLOSEDDIALOG", reason, item);
|
|
1982
|
-
if (item && item instanceof Location) {
|
|
1983
|
-
onLocationSelect(item);
|
|
1984
|
-
setValue(item.name);
|
|
1985
|
-
setIsOptionSelected(true);
|
|
1986
|
-
setEditLocation(item);
|
|
1987
|
-
}
|
|
1988
|
-
switch (reason) {
|
|
1989
|
-
case "closed": {
|
|
1990
|
-
setSelectedLocation({
|
|
1991
|
-
address_components: [],
|
|
1992
|
-
formatted_address: "",
|
|
1993
|
-
geometry: {},
|
|
1994
|
-
place_id: "",
|
|
1995
|
-
types: [],
|
|
1996
|
-
});
|
|
1997
|
-
break;
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
};
|
|
2001
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 1, alignItems: "center" }, { children: [isOptionSelected && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(PlaceIcon__default["default"], { color: "primary" }) }))), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: true, xs: 12 }, { children: jsxRuntime.jsx(Autocomplete__default["default"], { id: `location-finder-${stopType}`, fullWidth: true, open: open, onOpen: () => {
|
|
2002
|
-
setOpen(true);
|
|
2003
|
-
}, sx: {
|
|
2004
|
-
"& .MuiAutocomplete-inputRoot": {
|
|
2005
|
-
paddingRight: "5px !important", // TODO: find a better approach
|
|
2006
|
-
},
|
|
2007
|
-
}, onClose: () => {
|
|
2008
|
-
setOpen(false);
|
|
2009
|
-
}, value: value, onChange: onChangeHandler, inputValue: inputValue, onInputChange: (_event, newInputValue, reason) => {
|
|
2010
|
-
console.log("INPUTCHANGE", newInputValue, reason);
|
|
2011
|
-
if (reason === "reset" && newInputValue === "") {
|
|
2012
|
-
return;
|
|
2013
|
-
}
|
|
2014
|
-
setInputValue(newInputValue);
|
|
2015
|
-
}, isOptionEqualToValue: (option, optionValue) => {
|
|
2016
|
-
console.log("ISOPTIONEQUALTOVALUE", option, optionValue);
|
|
2017
|
-
if (optionValue) {
|
|
2018
|
-
if (typeof optionValue !== "string") {
|
|
2019
|
-
if (option instanceof Location) {
|
|
2020
|
-
return option.name === optionValue.name;
|
|
2021
|
-
}
|
|
2022
|
-
return option.description === optionValue.description;
|
|
2023
|
-
}
|
|
2024
|
-
return option.name === optionValue;
|
|
2025
|
-
}
|
|
2026
|
-
return false;
|
|
2027
|
-
}, getOptionLabel: (option) => {
|
|
2028
|
-
if (typeof option !== "string") {
|
|
2029
|
-
if (option instanceof Location) {
|
|
2030
|
-
return option.name;
|
|
2031
|
-
}
|
|
2032
|
-
return option.description;
|
|
2033
|
-
}
|
|
2034
|
-
return option;
|
|
2035
|
-
}, options: !(service === null || service === void 0 ? void 0 : service.quoteState.archerLocations.length)
|
|
2036
|
-
? [...googleSuggestionsOptions]
|
|
2037
|
-
: service === null || service === void 0 ? void 0 : service.quoteState.archerLocations, loading: requestPending, renderInput: (params) => (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, params, { label: "Facility", InputLabelProps: {
|
|
2038
|
-
shrink: true,
|
|
2039
|
-
}, placeholder: "Enter Location or Address", variant: "standard", InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: null }) }))), renderOption: (renderOptionProps, option) => {
|
|
2040
|
-
renderTemplateOptions.push(option);
|
|
2041
|
-
//console.log("RENDEROPTION", renderOptionProps, option);
|
|
2042
|
-
return (jsxRuntime.jsx(RenderOptionTemplate, { renderOptionProps: renderOptionProps, option: option, renderTemplateOptions: renderTemplateOptions }, toolkit.nanoid()));
|
|
2043
|
-
}, PaperComponent: (paperProps) => {
|
|
2044
|
-
if (!inputValue || requestPending) {
|
|
2045
|
-
return (React.createElement(nerdUi.PaperComponentOnLoad, Object.assign({}, { inputValue }, { key: toolkit.nanoid(), className: !isMobile && className ? className : "", props: paperProps, loading: requestPending, autocompleteType: nerdUi.AutocompleteType.ADDRESS })));
|
|
2046
|
-
}
|
|
2047
|
-
return (React.createElement(Paper__default["default"], Object.assign({}, paperProps, { key: toolkit.nanoid(), className: !isMobile && className ? className : "" }), paperProps.children));
|
|
2048
|
-
} }) })), isOptionSelected && (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, flexDirection: "column", display: "flex" }, { children: [jsxRuntime.jsx(IconButton__default["default"], Object.assign({ size: "small", onClick: () => {
|
|
2049
|
-
setOpenLocationsByAddress(true);
|
|
2050
|
-
//* Edit a new location created
|
|
2051
|
-
if (editLocation instanceof Location) {
|
|
2052
|
-
setEditLocation(editLocation);
|
|
2053
|
-
}
|
|
2054
|
-
//* Edit an existing archer location
|
|
2055
|
-
if (value instanceof Location) {
|
|
2056
|
-
setEditLocation(value);
|
|
2057
|
-
}
|
|
2058
|
-
} }, { children: jsxRuntime.jsx(EditIcon__default["default"], { fontSize: "small" }) })), jsxRuntime.jsx(IconButton__default["default"], Object.assign({ size: "small", onClick: closeInput }, { children: jsxRuntime.jsx(CloseIcon__default["default"], { fontSize: "small" }) }))] })))] })), openLocationsByAddress && (jsxRuntime.jsx(LocationByAddress, { openDialog: openLocationsByAddress, setOpenLocationsByAddress: setOpenLocationsByAddress, selectedLocation: selectedLocation, isDialogClosed: isLocationByAddressDialogClosed, dispatch: dispatch, networkCompletionStack: networkCompletionStack, locationState: service, isMobile: isMobile, editLocation: editLocation }))] }));
|
|
2059
|
-
}
|
|
2060
|
-
/**
|
|
2061
|
-
* @param mapsAutocompleteService
|
|
2062
|
-
* @param bounds
|
|
2063
|
-
* @param inputValue
|
|
2064
|
-
*/
|
|
2065
|
-
function setGoogleLocations(mapsAutocompleteService, bounds, inputValue) {
|
|
2066
|
-
return (mapsAutocompleteService &&
|
|
2067
|
-
mapsAutocompleteService.getPlacePredictions({
|
|
2068
|
-
input: inputValue,
|
|
2069
|
-
componentRestrictions: { country: "us" },
|
|
2070
|
-
types: ["address"],
|
|
2071
|
-
bounds,
|
|
2072
|
-
}, (googleSuggestions) => {
|
|
2073
|
-
return googleSuggestions;
|
|
2074
|
-
}));
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
/**
|
|
2078
|
-
* @param props
|
|
2079
|
-
*/
|
|
2080
|
-
function StopDetailHeader(props) {
|
|
2081
|
-
const { type, index } = props;
|
|
2082
|
-
return (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center", justifyContent: "space-between", spacing: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: type === QuoteAuxContent.PICK_UP ? (jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {})) : (jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {})) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { display: "block", variant: "h6", text: `${type} #${index + 1}` }) }))] })));
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
|
-
/**
|
|
2086
|
-
*
|
|
2087
|
-
* @param {any} root0 root
|
|
2088
|
-
* @param {HTMLElement} root0.anchorEl - HTMLElement ref
|
|
2089
|
-
* @param {boolean} root0.openAccessorials boolean to open/close the menu
|
|
2090
|
-
* @param {() => {}} root0.handleClose function to close the menu
|
|
2091
|
-
* @returns {React.ReactElement<any>} return as a function to avoid re-render
|
|
2092
|
-
*/
|
|
2093
|
-
/**
|
|
2094
|
-
* @param root0
|
|
2095
|
-
* @param root0.openCard
|
|
2096
|
-
* @param root0.onCloseCard
|
|
2097
|
-
* @param root0.stopCardIndex
|
|
2098
|
-
* @param root0.handleSelectAccessorial
|
|
2099
|
-
* @param root0.copyAccessorials
|
|
2100
|
-
*/
|
|
2101
|
-
function MenuAccessorials({ openCard, onCloseCard, stopCardIndex, handleSelectAccessorial, copyAccessorials, }) {
|
|
2102
|
-
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
2103
|
-
const openAccessorials = Boolean(anchorEl);
|
|
2104
|
-
const setAnchorHandler = (event) => {
|
|
2105
|
-
setAnchorEl(event.currentTarget);
|
|
2106
|
-
};
|
|
2107
|
-
const handleClose = () => {
|
|
2108
|
-
setAnchorEl(null);
|
|
2109
|
-
};
|
|
2110
|
-
return (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center", justifyContent: `${openCard ? "space-between" : "flex-end"}`, flexWrap: "nowrap" }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true }, { children: [jsxRuntime.jsx(Chip__default["default"], { icon: jsxRuntime.jsx(AddCircleOutlineRoundedIcon__default["default"], {}), label: "Accessorials", variant: "outlined", onClick: setAnchorHandler }), jsxRuntime.jsx(MenuAccessorialList, { openAccessorials: openAccessorials, anchorEl: anchorEl, handleClose: handleClose, handleSelectAccessorial: handleSelectAccessorial, copyAccessorials: copyAccessorials })] })), openCard && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Button__default["default"], Object.assign({ onClick: () => onCloseCard(stopCardIndex), color: "inherit" }, { children: jsxRuntime.jsx(CloseIcon__default["default"], {}) })) })))] })));
|
|
2111
|
-
}
|
|
2112
|
-
const MenuAccessorialList = ({ copyAccessorials, handleSelectAccessorial, openAccessorials, handleClose, anchorEl, }) => {
|
|
2113
|
-
return (jsxRuntime.jsxs(Menu__default["default"], Object.assign({ id: "demo-positioned-menu", "aria-labelledby": "demo-positioned-button", anchorEl: anchorEl, open: openAccessorials, onClose: handleClose, anchorOrigin: {
|
|
2114
|
-
vertical: "top",
|
|
2115
|
-
horizontal: "left",
|
|
2116
|
-
}, transformOrigin: {
|
|
2117
|
-
vertical: "top",
|
|
2118
|
-
horizontal: "left",
|
|
2119
|
-
} }, { children: [!copyAccessorials.length && jsxRuntime.jsx(MenuItem__default["default"], { children: "No item" }), copyAccessorials.map((accessorial, i) => {
|
|
2120
|
-
if (accessorial.quoteVisible) {
|
|
2121
|
-
return (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ onClick: () => {
|
|
2122
|
-
handleSelectAccessorial(i);
|
|
2123
|
-
handleClose();
|
|
2124
|
-
} }, { children: jsxRuntime.jsx(ListItemText__default["default"], { primary: accessorial.name, secondary: `$${accessorial.costAmount} / ${accessorial.unitType}` }) }), accessorial.accessorialId));
|
|
2125
|
-
}
|
|
2126
|
-
return [];
|
|
2127
|
-
})] })));
|
|
2128
|
-
};
|
|
2129
|
-
|
|
2130
|
-
const StopDetail = (props) => {
|
|
2131
|
-
// Props
|
|
2132
|
-
const { stopCardIndex, openCard, onCloseCard, quoteAccessorials, CardContainer, stopType, dispatch, networkCompletionStack, onChange, } = props;
|
|
2133
|
-
const [date, setDate] = React.useState(null);
|
|
2134
|
-
const [open, setOpen] = React.useState(false);
|
|
2135
|
-
const [zipLocation, setZipLocation] = React.useState("");
|
|
2136
|
-
const [copyAccessorials, setCopyAccessorials] = React__default["default"].useState(quoteAccessorials);
|
|
2137
|
-
const [chipAccessorialData, setChipAccessorialData] = React__default["default"].useState([]);
|
|
2138
|
-
const service = React__default["default"].useContext(ServiceContext);
|
|
2139
|
-
const [copyFacility, setCopyFacility] = React__default["default"].useState({
|
|
2140
|
-
zip: "",
|
|
2141
|
-
accessorialIds: [],
|
|
2142
|
-
date: null,
|
|
2143
|
-
});
|
|
2144
|
-
React__default["default"].useEffect(() => {
|
|
2145
|
-
setCopyAccessorials(quoteAccessorials);
|
|
2146
|
-
const chipAccessorialDataFilteredByService = quoteAccessorials.filter(function (o1) {
|
|
2147
|
-
return chipAccessorialData.some(function (o2) {
|
|
2148
|
-
return o1.accessorialId === o2.accessorialId; // id is unnique both array object
|
|
2149
|
-
});
|
|
2150
|
-
});
|
|
2151
|
-
setChipAccessorialData(chipAccessorialDataFilteredByService);
|
|
2152
|
-
}, [quoteAccessorials]);
|
|
2153
|
-
React__default["default"].useEffect(() => {
|
|
2154
|
-
if (onChange) {
|
|
2155
|
-
onChange({
|
|
2156
|
-
name: copyFacility.name || "",
|
|
2157
|
-
type: stopType === QuoteAuxContent.PICK_UP ? "shipper" : "consignee",
|
|
2158
|
-
date: date ? date.format("YYYY-MM-DD") : null,
|
|
2159
|
-
locationId: copyFacility.id || undefined,
|
|
2160
|
-
city: copyFacility.address ? copyFacility.address.city : "",
|
|
2161
|
-
state: copyFacility.address ? copyFacility.address.state : "",
|
|
2162
|
-
zip: zipLocation,
|
|
2163
|
-
address: {
|
|
2164
|
-
locationId: copyFacility.id || undefined,
|
|
2165
|
-
line1: copyFacility.address ? copyFacility.address.line1 : "",
|
|
2166
|
-
city: copyFacility.address ? copyFacility.address.city : "",
|
|
2167
|
-
state: copyFacility.address ? copyFacility.address.state : "",
|
|
2168
|
-
zip: copyFacility.address ? copyFacility.address.zip : "",
|
|
2169
|
-
latitude: copyFacility.address ? copyFacility.address.latitude : 0,
|
|
2170
|
-
longitude: copyFacility.address ? copyFacility.address.longitude : 0,
|
|
2171
|
-
},
|
|
2172
|
-
accessorialIds: chipAccessorialData.map((item) => Number(item.accessorialId)),
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
}, [chipAccessorialData, zipLocation, date, copyFacility]);
|
|
2176
|
-
if (!CardContainer) {
|
|
2177
|
-
return null;
|
|
2178
|
-
}
|
|
2179
|
-
const handleClick = (event) => {
|
|
2180
|
-
if (event.target instanceof HTMLInputElement) {
|
|
2181
|
-
setOpen(true);
|
|
2182
|
-
}
|
|
2183
|
-
};
|
|
2184
|
-
const onClose = () => {
|
|
2185
|
-
setOpen(false);
|
|
2186
|
-
};
|
|
2187
|
-
const handleSelectAccessorial = (i) => {
|
|
2188
|
-
setCopyAccessorials(copyAccessorials.filter((_, index) => index !== i));
|
|
2189
|
-
setChipAccessorialData([...chipAccessorialData, copyAccessorials[i]]);
|
|
2190
|
-
};
|
|
2191
|
-
const handleDelete = (chipToDelete) => () => {
|
|
2192
|
-
setChipAccessorialData((chips) => chips.filter((chip) => chip.accessorialId !== chipToDelete.accessorialId));
|
|
2193
|
-
setCopyAccessorials([...copyAccessorials, chipToDelete]);
|
|
2194
|
-
};
|
|
2195
|
-
const stopCardTypeSize = stopType === QuoteAuxContent.PICK_UP ? 4 : 6;
|
|
2196
|
-
return (jsxRuntime.jsx(React__default["default"].Fragment, { children: jsxRuntime.jsxs(CardContainer, Object.assign({ className: "Stop" }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, rowSpacing: 2, justifyContent: "space-between" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, marginBottom: 1 }, { children: jsxRuntime.jsx(StopDetailHeader, { type: stopType, index: stopCardIndex }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(MenuAccessorials, { openCard: openCard, onCloseCard: onCloseCard, stopCardIndex: stopCardIndex, handleSelectAccessorial: handleSelectAccessorial, copyAccessorials: copyAccessorials }) }))] })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2 }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: stopCardTypeSize }, { children: [jsxRuntime.jsx(material.TextField, { id: "zip", label: "Location", value: zipLocation, onChange: (e) => {
|
|
2197
|
-
setZipLocation(e.target.value);
|
|
2198
|
-
onClose();
|
|
2199
|
-
}, onClick: (e) => handleClick(e), placeholder: "Zipcode or City, State", required: !zipLocation ? true : false, fullWidth: true, variant: "standard", InputLabelProps: {
|
|
2200
|
-
shrink: true,
|
|
2201
|
-
}, sx: {
|
|
2202
|
-
"& .MuiInputLabel-root": {
|
|
2203
|
-
display: "flex",
|
|
2204
|
-
},
|
|
2205
|
-
}, helperText: !zipLocation ? "required" : "" }), open && jsxRuntime.jsx(RenderNotifier, { onClose: onClose })] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: stopCardTypeSize }, { children: jsxRuntime.jsx(LocationFinder, Object.assign({}, {
|
|
2206
|
-
stopType,
|
|
2207
|
-
dispatch,
|
|
2208
|
-
networkCompletionStack,
|
|
2209
|
-
service,
|
|
2210
|
-
zipLocation,
|
|
2211
|
-
}, { className: stopType === QuoteAuxContent.PICK_UP ? "autocompleteSmall" : "", onLocationSelectedHandler: (location) => {
|
|
2212
|
-
setCopyFacility(location);
|
|
2213
|
-
} })) })), stopType === QuoteAuxContent.PICK_UP && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: stopCardTypeSize }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "pickupDate", label: "Pickup Date", placeholder: "Pickup Date", fullWidth: true, type: "date", required: true, onChange: (newDate) => {
|
|
2214
|
-
if (newDate) {
|
|
2215
|
-
setDate(newDate);
|
|
2216
|
-
}
|
|
2217
|
-
}, value: date }) })))] })), chipAccessorialData.length > 0 && (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, mt: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: 12 }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { text: "Accessorials:", variant: "subtitle2" }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, component: "ul", sx: {
|
|
2218
|
-
display: "flex",
|
|
2219
|
-
justifyContent: "flex-start",
|
|
2220
|
-
flexWrap: "wrap",
|
|
2221
|
-
listStyle: "none",
|
|
2222
|
-
p: 0.5,
|
|
2223
|
-
m: 0,
|
|
2224
|
-
boxShadow: "none",
|
|
2225
|
-
} }, { children: chipAccessorialData.map((accessorial) => {
|
|
2226
|
-
let icon;
|
|
2227
|
-
if (!accessorial) {
|
|
2228
|
-
return null;
|
|
2229
|
-
}
|
|
2230
|
-
return (jsxRuntime.jsx(ListItem, { children: jsxRuntime.jsx(Chip__default["default"], { icon: icon, label: `${accessorial.name}, $${accessorial.costAmount} / ${accessorial.unitType}`, onDelete: handleDelete(accessorial), sx: {
|
|
2231
|
-
fontWeight: "400",
|
|
2232
|
-
} }) }, accessorial.accessorialId));
|
|
2233
|
-
}) }))] })))] })) }));
|
|
2234
|
-
};
|
|
2235
|
-
/**
|
|
2236
|
-
* @param {() => {}} onClose - function to close the notifier
|
|
2237
|
-
* @returns {React.ReactElement<any>} - returns the notifier component
|
|
2238
|
-
*/
|
|
2239
|
-
function RenderNotifier({ onClose }) {
|
|
2240
|
-
return (jsxRuntime.jsx(nerdUi.NerdNotifier, { notification: {
|
|
2241
|
-
uuid: toolkit.nanoid(),
|
|
2242
|
-
subtitle: "Inaccurate locations may lead to a higher price and may void the quote discount",
|
|
2243
|
-
body: "You should select a facility in addition to the zipcode.",
|
|
2244
|
-
autohide: false,
|
|
2245
|
-
position: {
|
|
2246
|
-
vertical: "bottom",
|
|
2247
|
-
horizontal: "center",
|
|
2248
|
-
},
|
|
2249
|
-
color: "rgb(49, 49, 49)",
|
|
2250
|
-
}, onClose: onClose }));
|
|
2251
|
-
}
|
|
2252
|
-
const ListItem = styles.styled("li")(({ theme }) => ({
|
|
2253
|
-
margin: theme.spacing(0.5),
|
|
2254
|
-
}));
|
|
2255
|
-
var StopDetail$1 = React__default["default"].memo(StopDetail);
|
|
2256
|
-
|
|
2257
|
-
const Stop = (props) => {
|
|
2258
|
-
const { stopCards, CardContainer, openCard, onCloseCard, stopType, addMoreStopHandler, disabled, accessorials, serviceType, dispatch, networkCompletionStack, onChange, } = props;
|
|
2259
|
-
const quoteAccessorials = serviceType !== QuoteAuxContent.EXPEDITED
|
|
2260
|
-
? getAccessorialFiltered(accessorials, serviceType)
|
|
2261
|
-
: [];
|
|
2262
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [stopCards &&
|
|
2263
|
-
stopCards.map((stopCard, stopCardIndex) => (jsxRuntime.jsx(StopDetail$1, { CardContainer: CardContainer, stopCard: stopCard, stopCardIndex: stopCardIndex, openCard: openCard ? openCard : false, onCloseCard: onCloseCard, quoteAccessorials: quoteAccessorials, stopType: stopType, dispatch: dispatch, networkCompletionStack: networkCompletionStack, onChange: onChange }, stopCardIndex))), jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: `Add ${stopType}, ${QUOTE_MAX_STOPS - stopCards.length} Stops Max`, anchorOrigin: { vertical: "bottom", horizontal: "center" }, transformOrigin: { vertical: "top", horizontal: "center" }, variant: "caption" }, { children: jsxRuntime.jsxs(QuoteButton, Object.assign({ variant: "outlined", sx: { marginBottom: "0.5rem" }, onClick: addMoreStopHandler, disabled: disabled }, { children: [jsxRuntime.jsx(AddIcon__default["default"], {}), jsxRuntime.jsx(nerdUi.NerdHeading, { text: stopType, uppercase: true, sx: { marginLeft: "0.2rem" } })] })) }))] }));
|
|
2264
|
-
};
|
|
2265
|
-
const QuoteButton = styles.styled(Button__default["default"])({
|
|
2266
|
-
background: "#fff",
|
|
2267
|
-
border: "1px solid rgba(0, 0, 0, 0.53)",
|
|
2268
|
-
borderRadius: 3,
|
|
2269
|
-
color: "rgba(0, 0, 0, 0.87)",
|
|
2270
|
-
padding: "5px 15px",
|
|
2271
|
-
"&:hover": {
|
|
2272
|
-
color: "#fff",
|
|
2273
|
-
background: "rgb(130 129 129 / 80%)",
|
|
2274
|
-
border: "1px solid #fff",
|
|
2275
|
-
},
|
|
2276
|
-
});
|
|
2277
|
-
/**
|
|
2278
|
-
* @param accessorials
|
|
2279
|
-
* @param serviceType
|
|
2280
|
-
*/
|
|
2281
|
-
function getAccessorialFiltered(accessorials, serviceType) {
|
|
2282
|
-
let accessorialsFiltered = [];
|
|
2283
|
-
const accessorialObjKeyArray = Object.keys(accessorials).filter((item) => item.startsWith(serviceType.toLowerCase()));
|
|
2284
|
-
for (const [key, value] of Object.entries(accessorials)) {
|
|
2285
|
-
if (key === accessorialObjKeyArray[0]) {
|
|
2286
|
-
accessorialsFiltered = value;
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
return accessorialsFiltered;
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
/**
|
|
2293
|
-
* @param props
|
|
2294
|
-
*/
|
|
2295
|
-
function CommodityDescription(props) {
|
|
2296
|
-
const { commodityDescriptionAxeValue, t, isMobile, commodityDescriptions, commodity, handleSelectChange, } = props;
|
|
2297
|
-
return (jsxRuntime.jsxs(FormControl__default["default"], Object.assign({ component: "fieldset", fullWidth: true }, { children: [jsxRuntime.jsx(InputLabel__default["default"], Object.assign({ variant: "standard", htmlFor: nerdUi.setAxeValue(commodityDescriptionAxeValue), shrink: true }, { children: t("quote.commodity_description") })), isMobile ? (jsxRuntime.jsx(NativeSelect__default["default"], Object.assign({ defaultValue: 30, sx: { width: "100%" } }, { children: commodityDescriptions.map((option, i) => (jsxRuntime.jsx("option", Object.assign({ value: option.id }, { children: option.name }), i))) }))) : (jsxRuntime.jsx(Select__default["default"], Object.assign({ labelId: nerdUi.setAxeValue(commodityDescriptionAxeValue), id: `select-${nerdUi.setAxeValue(commodityDescriptionAxeValue)}`, "aria-label": nerdUi.setAxeValue(commodityDescriptionAxeValue), "aria-labelledby": nerdUi.setAxeValue(t("quote.commodity_description")), value: commodity, onChange: (event) => handleSelectChange(event, "commodity_description"), variant: "standard", defaultValue: commodity }, { children: commodityDescriptions.map((option) => (jsxRuntime.jsx(MenuItem__default["default"], Object.assign({ value: option.name }, { children: option.name }), option.id))) }))), jsxRuntime.jsx(FormHelperText__default["default"], Object.assign({ sx: { marginLeft: 0 } }, { children: "required" }))] })));
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
|
-
const options = [
|
|
2301
|
-
QuoteAuxContent.LTL,
|
|
2302
|
-
QuoteAuxContent.TL,
|
|
2303
|
-
QuoteAuxContent.EXPEDITED,
|
|
2304
|
-
];
|
|
2305
|
-
/**
|
|
2306
|
-
* @param props
|
|
2307
|
-
*/
|
|
2308
|
-
function QuoteCheck(props) {
|
|
2309
|
-
const { onChange, service, mode, isMobile = false, dispatch, state } = props;
|
|
2310
|
-
const [reeferTemp, setReeferTemp] = React.useState("");
|
|
2311
|
-
const columnSize = mode === QuoteAuxContent.REEFER && service !== QuoteAuxContent.EXPEDITED
|
|
2312
|
-
? 3
|
|
2313
|
-
: 4;
|
|
2314
|
-
const temperatureError = service === QuoteAuxContent.LTL
|
|
2315
|
-
? reeferTemp < "40" || reeferTemp > "80"
|
|
2316
|
-
: reeferTemp < "-20" || reeferTemp > "80";
|
|
2317
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: columnSize }, { children: [jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "Select LTL (Less Than Truckload) or TL (Truckload)", variant: "body1" }, { children: jsxRuntime.jsx(FormLabel__default["default"], Object.assign({ component: "legend" }, { children: "Service" })) })), jsxRuntime.jsx(QuoteSelect, { labelId: "Service", selectOptions: options, onChange: (event) => onChange(event, "service"), isMobile: isMobile, value: service, required: false })] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 6, sm: service !== QuoteAuxContent.EXPEDITED ? 2 : 4 }, { children: jsxRuntime.jsxs(FormControl__default["default"], Object.assign({ component: "fieldset" }, { children: [jsxRuntime.jsx(FormLabel__default["default"], Object.assign({ component: "legend" }, { children: "Mode" })), jsxRuntime.jsxs(RadioGroup__default["default"], Object.assign({ "aria-label": "Mode", name: "mode", value: mode, onChange: (event) => onChange(event, "mode") }, { children: [jsxRuntime.jsx(FormControlLabel__default["default"], { value: QuoteAuxContent.DRY, control: jsxRuntime.jsx(Radio__default["default"], { color: "primary" }), label: QuoteAuxContent.DRY }), jsxRuntime.jsx(FormControlLabel__default["default"], { value: QuoteAuxContent.REEFER, control: jsxRuntime.jsx(Radio__default["default"], { color: "primary" }), disabled: service === QuoteAuxContent.EXPEDITED, label: QuoteAuxContent.REEFER })] }))] })) })), mode === QuoteAuxContent.REEFER &&
|
|
2318
|
-
service !== QuoteAuxContent.EXPEDITED && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, md: columnSize }, { children: jsxRuntime.jsx(nerdUi.NerdInput, { id: "Temperature", label: jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "Temperature range depends on the service you selected.", variant: "body1" }, { children: "Temperature" })), placeholder: "in Fahrenheit", helperText: service === QuoteAuxContent.LTL
|
|
2319
|
-
? "Between 40℉ and 80℉"
|
|
2320
|
-
: "Between -20℉ and 80℉", fullWidth: true, value: reeferTemp, onChange: (event) => {
|
|
2321
|
-
setReeferTemp(event.target.value);
|
|
2322
|
-
dispatch(storeQuoteFormData({
|
|
2323
|
-
reefer: Object.assign(Object.assign({}, state.reefer), { reeferTemp: event.target.value }),
|
|
2324
|
-
}));
|
|
2325
|
-
}, type: "text", error: reeferTemp !== "" && temperatureError }) }))), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 6, sm: columnSize }, { children: jsxRuntime.jsx(FormGroup__default["default"], Object.assign({ row: true }, { children: RenderQuoteSwitch(mode, dispatch, state) })) }))] }));
|
|
2326
|
-
}
|
|
2327
|
-
const RenderQuoteSwitch = (mode, dispatch, state) => {
|
|
2328
|
-
const [dryVanOnly, setChecked] = React.useState(false);
|
|
2329
|
-
const [reeferCont, setReeferCont] = React.useState(false);
|
|
2330
|
-
const handleCheckboxChange = (event, value) => {
|
|
2331
|
-
if (value === "dryVanOnly") {
|
|
2332
|
-
setChecked(event.target.checked);
|
|
2333
|
-
dispatch(storeQuoteFormData({
|
|
2334
|
-
dryVanOnly: event.target.checked,
|
|
2335
|
-
}));
|
|
2336
|
-
}
|
|
2337
|
-
else {
|
|
2338
|
-
setReeferCont(event.target.checked);
|
|
2339
|
-
dispatch(storeQuoteFormData({
|
|
2340
|
-
reefer: Object.assign(Object.assign({}, state.reefer), { reeferCont: event.target.checked }),
|
|
2341
|
-
}));
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
const controlSwitch = mode === QuoteAuxContent.REEFER ? (jsxRuntime.jsx(Switch__default["default"], { checked: reeferCont, onChange: (e) => handleCheckboxChange(e, "reeferCont"), value: "Continuous Running", color: "primary" })) : (jsxRuntime.jsx(Switch__default["default"], { checked: dryVanOnly, onChange: (e) => handleCheckboxChange(e, "dryVanOnly"), value: "Dry Van Only", color: "primary" }));
|
|
2345
|
-
const labelSwitch = mode === QuoteAuxContent.REEFER ? "Continuous Running" : "Dry Van Only";
|
|
2346
|
-
return jsxRuntime.jsx(FormControlLabel__default["default"], { control: controlSwitch, label: labelSwitch });
|
|
2347
|
-
};
|
|
2348
|
-
|
|
2349
|
-
const initPalletState = {
|
|
2350
|
-
units: QuoteAuxContent.INCHES,
|
|
2351
|
-
length: 48,
|
|
2352
|
-
width: 40,
|
|
2353
|
-
height: 48,
|
|
2354
|
-
count: "",
|
|
2355
|
-
stackable: false,
|
|
2356
|
-
key: Date.now(),
|
|
2357
|
-
};
|
|
2358
|
-
const initStopState = {
|
|
2359
|
-
zip: "",
|
|
2360
|
-
facility: "",
|
|
2361
|
-
accessorialIds: [],
|
|
2362
|
-
date: null,
|
|
2363
|
-
};
|
|
2364
|
-
const AboutQuote = (props) => {
|
|
2365
|
-
const { dispatch, networkCompletionStack, isCustomer, children = null, submitForm, } = props;
|
|
2366
|
-
const { t, isMobile, quoteState } = React__default["default"].useContext(ServiceContext);
|
|
2367
|
-
const { commodity_descriptions, quoteFormData, units, error, accessorials } = quoteState;
|
|
2368
|
-
const [commodity, setCommodity] = React.useState("");
|
|
2369
|
-
const [totalWeight, setTotalWeight] = React.useState("");
|
|
2370
|
-
const [freightClass, setFreightClass] = React.useState("");
|
|
2371
|
-
const [tmpPallet, setTmpPallet] = React.useState(initPalletState);
|
|
2372
|
-
const [palletToUpdate, setPalletToUpdate] = React.useState(tmpPallet);
|
|
2373
|
-
const [palletDimensions, setPalletDimensions] = React.useState([]);
|
|
2374
|
-
const [palletDimensionsIndex, setPalletDimensionsIndex] = React.useState(0);
|
|
2375
|
-
const [palletOpen, setPalletOpen] = React.useState(false);
|
|
2376
|
-
const [pickups, setPickups] = React.useState([
|
|
2377
|
-
initStopState,
|
|
2378
|
-
]);
|
|
2379
|
-
const [dropOffs, setDropoffs] = React.useState([initStopState]);
|
|
2380
|
-
const [closePickupCard, setClosePickupCard] = React.useState(false);
|
|
2381
|
-
const [closeDropoffCard, setCloseDropoffCard] = React.useState(false);
|
|
2382
|
-
const [disabled, setDisabled] = React.useState(false);
|
|
2383
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
2384
|
-
const [pending, setPending] = React.useState(false);
|
|
2385
|
-
const [service, setService] = React.useState(QuoteAuxContent.LTL);
|
|
2386
|
-
const [mode, setMode] = React.useState(QuoteAuxContent.DRY);
|
|
2387
|
-
const [pickupData, setPickupData] = React.useState();
|
|
2388
|
-
const [dropoffData, setDropoffData] = React.useState();
|
|
2389
|
-
const [isSubmitDisabled, setIsSubmitDisabled] = React.useState(true);
|
|
2390
|
-
// AXE values
|
|
2391
|
-
const commodityDescriptionAxeValue = t("quote.commodity_description") || "";
|
|
2392
|
-
/** Fetch Data */
|
|
2393
|
-
const fetchAccessorials = React.useCallback(() => {
|
|
2394
|
-
setPending(true);
|
|
2395
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getQuoteAccessorials());
|
|
2396
|
-
setRequestUUID(uuid);
|
|
2397
|
-
}, [dispatch]);
|
|
2398
|
-
const fetchCommodityDescription = React.useCallback(() => {
|
|
2399
|
-
setPending(true);
|
|
2400
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getQuoteCommodityDescription());
|
|
2401
|
-
setRequestUUID(uuid);
|
|
2402
|
-
}, [dispatch]);
|
|
2403
|
-
// Fetch the data only once
|
|
2404
|
-
React.useEffect(() => {
|
|
2405
|
-
fetchAccessorials();
|
|
2406
|
-
fetchCommodityDescription();
|
|
2407
|
-
}, []);
|
|
2408
|
-
// Check network completion
|
|
2409
|
-
React.useEffect(() => {
|
|
2410
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
2411
|
-
setPending(false);
|
|
2412
|
-
}
|
|
2413
|
-
}, [requestUUID, networkCompletionStack]);
|
|
2414
|
-
// Set commodity description content
|
|
2415
|
-
React.useEffect(() => {
|
|
2416
|
-
if (commodity_descriptions &&
|
|
2417
|
-
commodity_descriptions.length > 0 &&
|
|
2418
|
-
commodity_descriptions[0].name) {
|
|
2419
|
-
dispatch(storeQuoteFormData({
|
|
2420
|
-
commodityDescriptionId: commodity_descriptions[0].id,
|
|
2421
|
-
}));
|
|
2422
|
-
setCommodity(commodity_descriptions[0].name);
|
|
2423
|
-
}
|
|
2424
|
-
}, [commodity_descriptions]);
|
|
2425
|
-
// Detect Pallet change
|
|
2426
|
-
React.useEffect(() => {
|
|
2427
|
-
dispatch(storeQuoteFormData({
|
|
2428
|
-
units: {
|
|
2429
|
-
palletDimensions: palletDimensions,
|
|
2430
|
-
totalDimensions: {
|
|
2431
|
-
totalWeight: totalWeight,
|
|
2432
|
-
},
|
|
2433
|
-
},
|
|
2434
|
-
}));
|
|
2435
|
-
}, [palletDimensions]);
|
|
2436
|
-
// Check required inputs to disabled calculate button
|
|
2437
|
-
React.useEffect(() => {
|
|
2438
|
-
const isPickupLocationEnabled = (pickupData === null || pickupData === void 0 ? void 0 : pickupData.zip) === undefined || (pickupData === null || pickupData === void 0 ? void 0 : pickupData.zip.toString()) === "";
|
|
2439
|
-
const isPickupDateEnabled = (pickupData === null || pickupData === void 0 ? void 0 : pickupData.date) === null;
|
|
2440
|
-
const isDropoffLocationEnabled = (dropoffData === null || dropoffData === void 0 ? void 0 : dropoffData.zip) === undefined || (dropoffData === null || dropoffData === void 0 ? void 0 : dropoffData.zip.toString()) === "";
|
|
2441
|
-
const isEnabled = totalWeight === "" ||
|
|
2442
|
-
isPickupLocationEnabled ||
|
|
2443
|
-
isDropoffLocationEnabled ||
|
|
2444
|
-
!palletDimensions.length ||
|
|
2445
|
-
isPickupDateEnabled;
|
|
2446
|
-
if (!isCustomer) {
|
|
2447
|
-
setIsSubmitDisabled(quoteFormData.customerId ? false : true);
|
|
2448
|
-
}
|
|
2449
|
-
setIsSubmitDisabled(isEnabled);
|
|
2450
|
-
dispatch(setIsQuoteFormSubmitted(!isEnabled));
|
|
2451
|
-
}, [totalWeight, dropoffData, pickupData, palletDimensions]);
|
|
2452
|
-
/**
|
|
2453
|
-
* Handle Pallet functionality start
|
|
2454
|
-
*
|
|
2455
|
-
* @param event
|
|
2456
|
-
*/
|
|
2457
|
-
const handlePalletChange = (event) => {
|
|
2458
|
-
if (event.target.value === "" || re$1.test(event.target.value)) {
|
|
2459
|
-
setTmpPallet((prevState) => {
|
|
2460
|
-
return Object.assign(Object.assign({}, prevState), { count: event.target.value });
|
|
2461
|
-
});
|
|
2462
|
-
}
|
|
2463
|
-
};
|
|
2464
|
-
const onEventPalletHanlder = (event) => {
|
|
2465
|
-
addPallet(event, tmpPallet, palletDimensions, setPalletDimensions);
|
|
2466
|
-
if (event.key === "Enter" || event.type === "blur") {
|
|
2467
|
-
setTmpPallet((prevState) => {
|
|
2468
|
-
return Object.assign(Object.assign({}, prevState), { count: "" });
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
};
|
|
2472
|
-
const onDeletePalletHanlder = (index) => {
|
|
2473
|
-
setPalletDimensions((prevState) => {
|
|
2474
|
-
return prevState.filter((_p, i) => i !== index);
|
|
2475
|
-
});
|
|
2476
|
-
};
|
|
2477
|
-
const onEditPalletHanlder = (index) => {
|
|
2478
|
-
setPalletOpen(true);
|
|
2479
|
-
setPalletToUpdate(palletDimensions[index]);
|
|
2480
|
-
setPalletDimensionsIndex(index);
|
|
2481
|
-
};
|
|
2482
|
-
const onCloseEditPallet = () => setPalletOpen(false);
|
|
2483
|
-
const updatePallet = (pallet) => {
|
|
2484
|
-
setPalletToUpdate(pallet);
|
|
2485
|
-
setPalletDimensions((prevState) => {
|
|
2486
|
-
return prevState.map((p, i) => {
|
|
2487
|
-
if (palletToUpdate.key === p.key && i === palletDimensionsIndex) {
|
|
2488
|
-
return pallet;
|
|
2489
|
-
}
|
|
2490
|
-
return p;
|
|
2491
|
-
});
|
|
2492
|
-
});
|
|
2493
|
-
};
|
|
2494
|
-
/** Handle Pallet functionality end */
|
|
2495
|
-
/* Select handlers begin */
|
|
2496
|
-
const handleSelectChange = (event, type) => {
|
|
2497
|
-
switch (type) {
|
|
2498
|
-
case "mode":
|
|
2499
|
-
setMode(event.target.value);
|
|
2500
|
-
dispatch(storeQuoteFormData({
|
|
2501
|
-
mode: event.target.value,
|
|
2502
|
-
}));
|
|
2503
|
-
break;
|
|
2504
|
-
case "service":
|
|
2505
|
-
setService(event.target.value);
|
|
2506
|
-
dispatch(storeQuoteFormData({
|
|
2507
|
-
service: event.target.value,
|
|
2508
|
-
}));
|
|
2509
|
-
break;
|
|
2510
|
-
case "commodity_description": {
|
|
2511
|
-
setCommodity(event.target.value);
|
|
2512
|
-
const commodityDescriptionsFiltered = commodity_descriptions.filter((item) => { var _a; return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === event.target.value.toLowerCase(); });
|
|
2513
|
-
if (commodityDescriptionsFiltered.length > 0) {
|
|
2514
|
-
const commodityObject = commodityDescriptionsFiltered[0];
|
|
2515
|
-
if (commodityObject.id) {
|
|
2516
|
-
const { id } = commodityObject;
|
|
2517
|
-
dispatch(storeQuoteFormData({
|
|
2518
|
-
commodityDescriptionId: id,
|
|
2519
|
-
}));
|
|
2520
|
-
}
|
|
2521
|
-
}
|
|
2522
|
-
break;
|
|
2523
|
-
}
|
|
2524
|
-
case "freight_class": {
|
|
2525
|
-
setFreightClass(event.target.value);
|
|
2526
|
-
dispatch(storeQuoteFormData({
|
|
2527
|
-
freightClass: event.target.value,
|
|
2528
|
-
}));
|
|
2529
|
-
break;
|
|
2530
|
-
}
|
|
2531
|
-
}
|
|
2532
|
-
};
|
|
2533
|
-
/* Select handlers end */
|
|
2534
|
-
/* Inputs handlers begin */
|
|
2535
|
-
const inputHandleChange = (event, type) => {
|
|
2536
|
-
switch (type) {
|
|
2537
|
-
case "total_weight":
|
|
2538
|
-
setTotalWeight(event.target.value);
|
|
2539
|
-
dispatch(storeQuoteFormData({
|
|
2540
|
-
units: {
|
|
2541
|
-
palletDimensions: palletDimensions,
|
|
2542
|
-
totalDimensions: {
|
|
2543
|
-
totalWeight: event.target.value,
|
|
2544
|
-
},
|
|
2545
|
-
},
|
|
2546
|
-
}));
|
|
2547
|
-
break;
|
|
2548
|
-
}
|
|
2549
|
-
};
|
|
2550
|
-
/* Inputs handlers end */
|
|
2551
|
-
/* Stop Handlers begin */
|
|
2552
|
-
const onCloseStopHandler = (stopType, index) => {
|
|
2553
|
-
switch (stopType) {
|
|
2554
|
-
case QuoteAuxContent.PICK_UP:
|
|
2555
|
-
setPickups((prevState) => {
|
|
2556
|
-
return prevState.filter((_, i) => i !== index);
|
|
2557
|
-
});
|
|
2558
|
-
if (pickups.length - 1 === 1) {
|
|
2559
|
-
setClosePickupCard(false);
|
|
2560
|
-
}
|
|
2561
|
-
break;
|
|
2562
|
-
case QuoteAuxContent.DROP_OFF:
|
|
2563
|
-
setDropoffs((prevState) => {
|
|
2564
|
-
return prevState.filter((_, i) => i !== index);
|
|
2565
|
-
});
|
|
2566
|
-
if (dropOffs.length - 1 === 1) {
|
|
2567
|
-
setCloseDropoffCard(false);
|
|
2568
|
-
}
|
|
2569
|
-
break;
|
|
2570
|
-
}
|
|
2571
|
-
};
|
|
2572
|
-
const addMoreStopHandler = (stopType) => {
|
|
2573
|
-
if (pickups.length > QUOTE_MAX_STOPS ||
|
|
2574
|
-
pickups.length + 1 === QUOTE_MAX_STOPS ||
|
|
2575
|
-
dropOffs.length > QUOTE_MAX_STOPS ||
|
|
2576
|
-
dropOffs.length + 1 === QUOTE_MAX_STOPS) {
|
|
2577
|
-
setDisabled(true);
|
|
2578
|
-
}
|
|
2579
|
-
if (stopType === QuoteAuxContent.PICK_UP) {
|
|
2580
|
-
setPickups((prevState) => {
|
|
2581
|
-
return [...prevState, initStopState];
|
|
2582
|
-
});
|
|
2583
|
-
setClosePickupCard(true);
|
|
2584
|
-
}
|
|
2585
|
-
else {
|
|
2586
|
-
setDropoffs((prevState) => {
|
|
2587
|
-
return [...prevState, initStopState];
|
|
2588
|
-
});
|
|
2589
|
-
setCloseDropoffCard(true);
|
|
2590
|
-
}
|
|
2591
|
-
};
|
|
2592
|
-
React.useEffect(() => {
|
|
2593
|
-
if (pickupData && Object.keys(pickupData).length > 0) {
|
|
2594
|
-
dispatch(storeQuoteFormData({
|
|
2595
|
-
shippers: [...pickups, Object.assign({}, pickupData)].filter((data) => data.zip !== "" && data.date !== ""),
|
|
2596
|
-
}));
|
|
2597
|
-
}
|
|
2598
|
-
}, [pickups, pickupData]);
|
|
2599
|
-
React.useEffect(() => {
|
|
2600
|
-
if (dropoffData && Object.keys(dropoffData).length > 0) {
|
|
2601
|
-
dispatch(storeQuoteFormData({
|
|
2602
|
-
consignees: [...dropOffs, Object.assign({}, dropoffData)].filter((data) => data.zip),
|
|
2603
|
-
}));
|
|
2604
|
-
}
|
|
2605
|
-
}, [dropOffs, dropoffData]);
|
|
2606
|
-
/* Stop Handlers ends */
|
|
2607
|
-
if (pending) {
|
|
2608
|
-
return jsxRuntime.jsx(Loading, { height: 50 });
|
|
2609
|
-
}
|
|
2610
|
-
return (jsxRuntime.jsxs(React__default["default"].Fragment, { children: [jsxRuntime.jsxs(nerdUi.NerdCard, { children: [children, jsxRuntime.jsx(React.Suspense, Object.assign({ fallback: jsxRuntime.jsx(Loading, { height: 50 }) }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, mt: 1 }, { children: [!isCustomer && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(CustomerFinder, { dispatch: dispatch, networkCompletionStack: networkCompletionStack }) }))), jsxRuntime.jsx(QuoteCheck, { onChange: handleSelectChange, service: service, mode: mode, isMobile: isMobile, dispatch: dispatch, state: quoteFormData })] })) })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, mt: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: 4 }, { children: jsxRuntime.jsx(CommodityDescription, { commodityDescriptions: commodity_descriptions, handleSelectChange: handleSelectChange, t: t, isMobile: isMobile, commodity: commodity, commodityDescriptionAxeValue: commodityDescriptionAxeValue }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: 4 }, { children: jsxRuntime.jsx(material.TextField, { id: "totalWeight", value: totalWeight, onChange: (event) => {
|
|
2611
|
-
const re = /^[0-9\b]+$/;
|
|
2612
|
-
if (event.target.value === "" || re.test(event.target.value)) {
|
|
2613
|
-
inputHandleChange(event, "total_weight");
|
|
2614
|
-
}
|
|
2615
|
-
}, label: jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "Weight will be verified on server side to check the equipment compability.", variant: "body1" }, { children: t("quote.total_weigth") })), placeholder: t("quote.in_pounds"), fullWidth: true, variant: "standard", InputLabelProps: {
|
|
2616
|
-
shrink: true,
|
|
2617
|
-
}, sx: {
|
|
2618
|
-
"& .MuiInputLabel-root": {
|
|
2619
|
-
display: "flex",
|
|
2620
|
-
},
|
|
2621
|
-
}, required: !totalWeight ? true : false, helperText: !totalWeight ? "required" : "" }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, sm: 4 }, { children: jsxRuntime.jsx(QuoteSelect, { inputLabel: t("quote.freight_class"), labelId: nerdUi.setAxeValue(commodityDescriptionAxeValue), selectOptions: FREIGHT_CLASS, onChange: (event) => handleSelectChange(event, "freight_class"), isMobile: isMobile, value: freightClass, required: false }) }))] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, spacing: 2, mt: 1 }, { children: jsxRuntime.jsx(PalletCount, { onChange: handlePalletChange, onKeyPress: onEventPalletHanlder, onBlur: onEventPalletHanlder, onDelete: (e) => onDeletePalletHanlder(e), onDimensionEdit: (e) => onEditPalletHanlder(e), palletDimensions: palletDimensions, tmpPallet: tmpPallet }) })), totalWeight !== "" && palletDimensions.length > 0 && (jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, spacing: 1, alignItems: "center", justifyContent: "end", mt: 1 }, { children: jsxRuntime.jsx(PalletChecker, { totalWeight: totalWeight, palletDimensions: palletDimensions, dispatch: dispatch, networkCompletionStack: networkCompletionStack, units: units, stateError: error }) }))), palletOpen && (jsxRuntime.jsx(EditPallet, { open: palletOpen, close: onCloseEditPallet, pallet: palletToUpdate, save: updatePallet }))] }), jsxRuntime.jsx(Stack__default["default"], Object.assign({ spacing: 2, alignItems: "center" }, { children: jsxRuntime.jsx(Stop, { CardContainer: nerdUi.NerdCard, openCard: closePickupCard, onCloseCard: (index) => onCloseStopHandler(QuoteAuxContent.PICK_UP, index), accessorials: accessorials, stopCards: pickups, stopType: QuoteAuxContent.PICK_UP, addMoreStopHandler: () => addMoreStopHandler(QuoteAuxContent.PICK_UP), disabled: disabled, serviceType: service, dispatch: dispatch, networkCompletionStack: networkCompletionStack, onChange: (data) => {
|
|
2622
|
-
setPickupData(data);
|
|
2623
|
-
} }) })), jsxRuntime.jsx(Stack__default["default"], Object.assign({ spacing: 2, alignItems: "center" }, { children: jsxRuntime.jsx(Stop, { CardContainer: nerdUi.NerdCard, openCard: closeDropoffCard, onCloseCard: (index) => onCloseStopHandler(QuoteAuxContent.DROP_OFF, index), accessorials: accessorials, stopCards: dropOffs, stopType: QuoteAuxContent.DROP_OFF, addMoreStopHandler: () => addMoreStopHandler(QuoteAuxContent.DROP_OFF), disabled: disabled, serviceType: service, dispatch: dispatch, networkCompletionStack: networkCompletionStack, onChange: (data) => {
|
|
2624
|
-
setDropoffData(data);
|
|
2625
|
-
} }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12, display: "flex", justifyContent: "center" }, { children: jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "Calculate the Quote", anchorOrigin: { vertical: "top", horizontal: "center" }, transformOrigin: { vertical: "bottom", horizontal: "center" }, variant: "caption" }, { children: jsxRuntime.jsx(Button__default["default"], Object.assign({ color: "primary", variant: "contained", disabled: isSubmitDisabled, onClick: () => {
|
|
2626
|
-
submitForm();
|
|
2627
|
-
} }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { variant: "button", text: "Calculate", fontWeight: 700, display: "block", px: 1, py: "0.25rem" }) })) })) }))] }));
|
|
2628
|
-
};
|
|
2629
|
-
/**
|
|
2630
|
-
* @param event
|
|
2631
|
-
* @param tmpPallet
|
|
2632
|
-
* @param palletDimensions
|
|
2633
|
-
* @param setState
|
|
2634
|
-
*/
|
|
2635
|
-
function addPallet(event, tmpPallet, palletDimensions, setState) {
|
|
2636
|
-
const keyPress = event
|
|
2637
|
-
.key;
|
|
2638
|
-
const onBlur = event.type;
|
|
2639
|
-
if ((keyPress === "Enter" &&
|
|
2640
|
-
tmpPallet.count &&
|
|
2641
|
-
tmpPallet.count !== 0) ||
|
|
2642
|
-
(onBlur === "blur" &&
|
|
2643
|
-
tmpPallet.count &&
|
|
2644
|
-
tmpPallet.count !== 0)) {
|
|
2645
|
-
setState([...palletDimensions, tmpPallet]);
|
|
2646
|
-
}
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
/**
|
|
2650
|
-
* @param marketCosts
|
|
2651
|
-
*/
|
|
2652
|
-
function MarketCostsComponent(marketCosts) {
|
|
2653
|
-
const { t } = React.useContext(ServiceContext);
|
|
2654
|
-
const { linehaul_cost, fuel_cost, truckload_total_cost, ltl_pallet_percentage, stop_fees, total_cost, margin, total_cost_with_margin, otr_miles, } = marketCosts;
|
|
2655
|
-
let rowsAuxTable = [];
|
|
2656
|
-
if (marketCosts && marketCosts.market_data) {
|
|
2657
|
-
const { market_data: { fuel_rate, linehaul_rate, linehaul_total, market_type, market_lane, }, } = marketCosts;
|
|
2658
|
-
rowsAuxTable = [
|
|
2659
|
-
createMarketCostsAuxData(t("quote.miles"), otr_miles),
|
|
2660
|
-
createMarketCostsAuxData(t("quote.fuel_rate_per_mile"), formattedPrice(fuel_rate)),
|
|
2661
|
-
createMarketCostsAuxData("Line Haul Rate per Mile", formattedPrice(linehaul_rate)),
|
|
2662
|
-
createMarketCostsAuxData("Line Haul Total", formattedPrice(linehaul_total)),
|
|
2663
|
-
createMarketCostsAuxData("Market Type", market_type),
|
|
2664
|
-
createMarketCostsAuxData("Market Lane", market_lane),
|
|
2665
|
-
];
|
|
2666
|
-
}
|
|
2667
|
-
const rowsFirstTable = [
|
|
2668
|
-
createMarketCostsData("+", "Linehaul Cost", linehaul_cost),
|
|
2669
|
-
createMarketCostsData("+", "Fuel Cost", fuel_cost),
|
|
2670
|
-
];
|
|
2671
|
-
const rowsSecondTable = [
|
|
2672
|
-
createMarketCostsData("x", "LTL Pallet Percentage", ltl_pallet_percentage),
|
|
2673
|
-
createMarketCostsData("+", "Stop Off Fees", stop_fees),
|
|
2674
|
-
];
|
|
2675
|
-
const rowsThirdTable = [createMarketCostsData("+", "Margin", margin)];
|
|
2676
|
-
return (jsxRuntime.jsx(Card__default["default"], Object.assign({ elevation: 0 }, { children: jsxRuntime.jsx(CardContent__default["default"], { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2, sx: { paddingLeft: 0 } }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, sm: 6 }, { children: [jsxRuntime.jsx(TableContainer__default["default"], { children: jsxRuntime.jsx(Table__default["default"], Object.assign({ "aria-label": "simple table" }, { children: jsxRuntime.jsxs(TableBody__default["default"], { children: [rowsFirstTable.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2677
|
-
"td, th": { border: 0, padding: "4px" },
|
|
2678
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row" }, { children: jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: [jsxRuntime.jsx("b", { children: row.symbol }), " ", row.name] })) })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(row.cost) })) }))] }), row.name))), jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2679
|
-
"td, th": { border: 0, padding: "4px" },
|
|
2680
|
-
"&:last-child td, &:last-child th": { borderTop: 1 },
|
|
2681
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: " = TL Total Cost" })) }), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(truckload_total_cost) })) }))] }))] }) })) }), jsxRuntime.jsx(TableContainer__default["default"], { children: jsxRuntime.jsx(Table__default["default"], Object.assign({ "aria-label": "simple table" }, { children: jsxRuntime.jsxs(TableBody__default["default"], { children: [rowsSecondTable.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2682
|
-
"td, th": { border: 0, padding: "5px" },
|
|
2683
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row" }, { children: jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: [jsxRuntime.jsx("b", { children: row.symbol }), " ", row.name] })) })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(row.cost) })) }))] }), row.name))), jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2684
|
-
"td, th": { border: 0, padding: "5px" },
|
|
2685
|
-
"&:last-child td, &:last-child th": { borderTop: 1 },
|
|
2686
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: " = Total Cost" })) }), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(total_cost) })) }))] }))] }) })) }), jsxRuntime.jsx(TableContainer__default["default"], { children: jsxRuntime.jsx(Table__default["default"], Object.assign({ "aria-label": "simple table" }, { children: jsxRuntime.jsxs(TableBody__default["default"], { children: [rowsThirdTable.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2687
|
-
"td, th": { border: 0, padding: "5px" },
|
|
2688
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row" }, { children: jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: [jsxRuntime.jsx("b", { children: row.symbol }), " ", row.name] })) })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(row.cost) })) }))] }), row.name))), jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2689
|
-
"td, th": { border: 0, padding: "5px" },
|
|
2690
|
-
"&:last-child td, &:last-child th": { borderTop: 1 },
|
|
2691
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: " = Total Cost With Margin" })) }), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: formattedPrice(total_cost_with_margin) })) }))] }))] }) })) })] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, sm: 6 }, { children: jsxRuntime.jsx(TableContainer__default["default"], { children: jsxRuntime.jsx(Table__default["default"], Object.assign({ "aria-label": "simple table" }, { children: jsxRuntime.jsx(TableBody__default["default"], { children: rowsAuxTable.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2692
|
-
"td, th": { border: 0, padding: "4px" },
|
|
2693
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: row.name })) })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: row.value })) }))] }), row.name))) }) })) }) }))] })) }) })));
|
|
2694
|
-
}
|
|
2695
|
-
/**
|
|
2696
|
-
* @param symbol
|
|
2697
|
-
* @param name
|
|
2698
|
-
* @param cost
|
|
2699
|
-
*/
|
|
2700
|
-
function createMarketCostsData(symbol, name, cost) {
|
|
2701
|
-
return { symbol, name, cost };
|
|
2702
|
-
}
|
|
2703
|
-
/**
|
|
2704
|
-
* @param name
|
|
2705
|
-
* @param value
|
|
2706
|
-
*/
|
|
2707
|
-
function createMarketCostsAuxData(name, value) {
|
|
2708
|
-
return { name, value };
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
/**
|
|
2712
|
-
* @param accessorials
|
|
2713
|
-
*/
|
|
2714
|
-
function QuoteResultAccessorials(accessorials) {
|
|
2715
|
-
return (jsxRuntime.jsx(Stack__default["default"], Object.assign({ direction: "row", divider: jsxRuntime.jsx(Divider__default["default"], { orientation: "vertical", flexItem: true }), spacing: 2 }, { children: accessorials.length > 0 ? (accessorials.map((accessorial, index) => {
|
|
2716
|
-
const stopName = accessorial.stopName.split(" - ");
|
|
2717
|
-
return (jsxRuntime.jsxs(Item$1, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, justifyContent: "space-between", alignItems: "center", mb: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: stopName[0].replace(":", " ") })) }), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1" }, { children: stopName[1] })) })] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true }, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Chip__default["default"], { label: `${accessorial.name}, ${formattedPrice(accessorial.costAmount)}` }) })) }))] }, index));
|
|
2718
|
-
})) : (jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1" }, { children: "No accessorials" }))) })));
|
|
2719
|
-
}
|
|
2720
|
-
const Item$1 = styles.styled(Paper__default["default"])(({ theme }) => (Object.assign(Object.assign({ backgroundColor: theme.palette.mode === "dark" ? "#1A2027" : "#fff" }, theme.typography.body2), { padding: theme.spacing(1), textAlign: "center", color: theme.palette.text.secondary })));
|
|
2721
|
-
|
|
2722
|
-
/**
|
|
2723
|
-
* @param root0
|
|
2724
|
-
* @param root0.id
|
|
2725
|
-
* @param root0.dispatch
|
|
2726
|
-
* @param root0.networkCompletionStack
|
|
2727
|
-
*/
|
|
2728
|
-
function CostBreakdown({ id, dispatch, networkCompletionStack, }) {
|
|
2729
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
2730
|
-
const [pending, setPending] = React.useState(false);
|
|
2731
|
-
const { quoteState: { costsBreakdown }, appConfigServiceLevels, } = React.useContext(ServiceContext);
|
|
2732
|
-
const filter = `[{"property":"quote_path_edges.quote_id","value":${id}}]`;
|
|
2733
|
-
// Get Costs Breakdown
|
|
2734
|
-
React.useEffect(() => {
|
|
2735
|
-
setPending(true);
|
|
2736
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getQuotePathEdgeCosts({ filter }));
|
|
2737
|
-
setRequestUUID(uuid);
|
|
2738
|
-
}, [filter]);
|
|
2739
|
-
React.useEffect(() => {
|
|
2740
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
2741
|
-
setPending(false);
|
|
2742
|
-
}
|
|
2743
|
-
}, [requestUUID, networkCompletionStack]);
|
|
2744
|
-
if (pending) {
|
|
2745
|
-
jsxRuntime.jsx(Skeleton__default["default"], { animation: "wave", variant: "rectangular", width: "100%", height: 50 });
|
|
2746
|
-
}
|
|
2747
|
-
/**
|
|
2748
|
-
* @param description
|
|
2749
|
-
* @param cost_amount
|
|
2750
|
-
*/
|
|
2751
|
-
function createData(description, cost_amount) {
|
|
2752
|
-
return { description, cost_amount };
|
|
2753
|
-
}
|
|
2754
|
-
return (jsxRuntime.jsx(Stack__default["default"], Object.assign({ direction: { xs: "column", sm: "row" }, divider: jsxRuntime.jsx(Divider__default["default"], { orientation: "vertical", flexItem: true }), spacing: { xs: 1, sm: 2, md: 4 }, justifyContent: "center" }, { children: Object.entries(appConfigServiceLevels)
|
|
2755
|
-
.reverse()
|
|
2756
|
-
.map((item, i) => {
|
|
2757
|
-
const breakDownFilter = costsBreakdown.filter((cost) => cost.service_level === item[0]);
|
|
2758
|
-
const breakDownRes = breakDownFilter.reduce((acc, curr) => {
|
|
2759
|
-
if (!acc[curr.group]) {
|
|
2760
|
-
acc[curr.group] = [];
|
|
2761
|
-
}
|
|
2762
|
-
acc[curr.group].push(curr);
|
|
2763
|
-
return acc;
|
|
2764
|
-
}, {});
|
|
2765
|
-
return (jsxRuntime.jsxs(Item, Object.assign({ elevation: 0 }, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, mb: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mr: 1 }, { children: jsxRuntime.jsx("img", { src: item[1].icon, alt: item[0], style: { width: 35 } }) })), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6", style: {
|
|
2766
|
-
color: item[1].color,
|
|
2767
|
-
textTransform: "capitalize",
|
|
2768
|
-
} }, { children: item[0] })) })] })), Object.entries(breakDownRes)
|
|
2769
|
-
.sort()
|
|
2770
|
-
.map((breakDownData, i) => {
|
|
2771
|
-
const breakdownDataArray = breakDownData[1];
|
|
2772
|
-
const rows = [];
|
|
2773
|
-
{
|
|
2774
|
-
breakdownDataArray.forEach((breakdownData) => {
|
|
2775
|
-
const { description, cost_amount } = breakdownData;
|
|
2776
|
-
rows.push(createData(description, cost_amount));
|
|
2777
|
-
});
|
|
2778
|
-
}
|
|
2779
|
-
return (jsxRuntime.jsxs(Accordion__default["default"], { children: [jsxRuntime.jsx(AccordionSummary__default["default"], Object.assign({ expandIcon: jsxRuntime.jsx(ExpandMoreIcon__default["default"], {}), "aria-controls": `panel${i + 1}a-content`, id: `panel${i + 1}a-header` }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "flex-end", justifyContent: "space-between" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1" }, { children: breakDownData[0] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "primary" }, { children: costBreakdownPrice(breakDownData) })) }))] })) })), jsxRuntime.jsx(AccordionDetails__default["default"], { children: jsxRuntime.jsx(TableContainer__default["default"], Object.assign({ component: Paper__default["default"], elevation: 0 }, { children: jsxRuntime.jsx(Table__default["default"], Object.assign({ "aria-label": "cost Breakdown table" }, { children: jsxRuntime.jsx(TableBody__default["default"], { children: rows.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: {
|
|
2780
|
-
"&:last-child td, &:last-child th": {
|
|
2781
|
-
border: 0,
|
|
2782
|
-
},
|
|
2783
|
-
} }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row" }, { children: row.description })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "right" }, { children: formattedPrice(row.cost_amount || 0) }))] }), row.id))) }) })) })) })] }, i));
|
|
2784
|
-
})] }), i));
|
|
2785
|
-
}) })));
|
|
2786
|
-
}
|
|
2787
|
-
/**
|
|
2788
|
-
* @param breakDownData
|
|
2789
|
-
*/
|
|
2790
|
-
function costBreakdownPrice(breakDownData) {
|
|
2791
|
-
const breakdownDataArray = breakDownData[1];
|
|
2792
|
-
return formattedPrice(breakdownDataArray.reduce((acc, curr) => {
|
|
2793
|
-
if (curr.group === "Total") {
|
|
2794
|
-
return curr.cost_amount;
|
|
2795
|
-
}
|
|
2796
|
-
return acc + curr.cost_amount;
|
|
2797
|
-
}, 0));
|
|
2798
|
-
}
|
|
2799
|
-
const Item = styles.styled(Paper__default["default"])(({ theme }) => (Object.assign(Object.assign({ backgroundColor: theme.palette.mode === "dark" ? "#1A2027" : "#fff" }, theme.typography.body2), { padding: theme.spacing(1), textAlign: "center", color: theme.palette.text.secondary })));
|
|
2800
|
-
|
|
2801
|
-
/**
|
|
2802
|
-
* @param props
|
|
2803
|
-
* @param props.responseState
|
|
2804
|
-
* @param props.networkCompletionStack
|
|
2805
|
-
* @param props.dispatch
|
|
2806
|
-
* @param props.marketCosts
|
|
2807
|
-
*/
|
|
2808
|
-
function QuoteResultAccorion(props) {
|
|
2809
|
-
const { responseState: { id, accessorials = [] }, networkCompletionStack, dispatch, marketCosts, } = props;
|
|
2810
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
2811
|
-
const [pending, setPending] = React.useState(false);
|
|
2812
|
-
const accordionSummaries = [
|
|
2813
|
-
createData$2("Cost Breakdown", ListAltIcon__default["default"], CostBreakdown({ id, dispatch, networkCompletionStack })),
|
|
2814
|
-
createData$2("Market Costs", BarChartIcon__default["default"], MarketCostsComponent(marketCosts)),
|
|
2815
|
-
createData$2("Accessorials", AddBoxIcon__default["default"], QuoteResultAccessorials(accessorials)),
|
|
2816
|
-
];
|
|
2817
|
-
React.useEffect(() => {
|
|
2818
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
2819
|
-
setPending(false);
|
|
2820
|
-
}
|
|
2821
|
-
}, [requestUUID, networkCompletionStack]);
|
|
2822
|
-
// Get market Costs
|
|
2823
|
-
React.useEffect(() => {
|
|
2824
|
-
setPending(true);
|
|
2825
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getMarketCosts(id));
|
|
2826
|
-
setRequestUUID(uuid);
|
|
2827
|
-
}, []);
|
|
2828
|
-
// Get Accessorials
|
|
2829
|
-
React.useEffect(() => {
|
|
2830
|
-
setPending(true);
|
|
2831
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getQuoteById(id));
|
|
2832
|
-
setRequestUUID(uuid);
|
|
2833
|
-
}, []);
|
|
2834
|
-
{
|
|
2835
|
-
if (pending || !marketCosts) {
|
|
2836
|
-
return (jsxRuntime.jsx(Skeleton__default["default"], { animation: "wave", variant: "rectangular", width: "100%", height: 118 }));
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
return (jsxRuntime.jsx(Box__default["default"], { children: accordionSummaries.map((accordionData, index) => {
|
|
2840
|
-
const { summary, SummaryIcon, SummaryComponent } = accordionData;
|
|
2841
|
-
return (jsxRuntime.jsxs(Accordion__default["default"], { children: [jsxRuntime.jsx(AccordionSummary__default["default"], Object.assign({ expandIcon: jsxRuntime.jsx(ExpandMoreIcon__default["default"], {}), "aria-controls": `panel${index + 1}a-content`, id: `panel${index + 1}a-header` }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "flex-end" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mr: 1 }, { children: jsxRuntime.jsx(SummaryIcon, { fontSize: "small" }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6" }, { children: summary })) }))] })) })), jsxRuntime.jsx(AccordionDetails__default["default"], { children: SummaryComponent })] }, index));
|
|
2842
|
-
}) }));
|
|
2843
|
-
}
|
|
2844
|
-
/**
|
|
2845
|
-
* @param summary
|
|
2846
|
-
* @param SummaryIcon
|
|
2847
|
-
* @param SummaryComponent
|
|
2848
|
-
*/
|
|
2849
|
-
function createData$2(summary, SummaryIcon, SummaryComponent) {
|
|
2850
|
-
return {
|
|
2851
|
-
summary,
|
|
2852
|
-
SummaryIcon,
|
|
2853
|
-
SummaryComponent,
|
|
2854
|
-
};
|
|
2855
|
-
}
|
|
2856
|
-
|
|
2857
|
-
var css_248z = ".cardContainer {\n padding: 8px; }\n";
|
|
2858
|
-
styleInject(css_248z);
|
|
2859
|
-
|
|
2860
|
-
/**
|
|
2861
|
-
* @param props
|
|
2862
|
-
* @param props.setIsDateSelected
|
|
2863
|
-
* @param props.isDateSelected
|
|
2864
|
-
* @param props.responseState
|
|
2865
|
-
* @param props.selectedDateRange
|
|
2866
|
-
* @param props.dispatch
|
|
2867
|
-
* @param props.appConfigServiceLevels
|
|
2868
|
-
*/
|
|
2869
|
-
function QuoteCalendar(props) {
|
|
2870
|
-
const { responseState: { id, serviceLevels, stops }, selectedDateRange, dispatch, appConfigServiceLevels, } = props;
|
|
2871
|
-
const pickUpDate = (stops &&
|
|
2872
|
-
stops.filter((stop) => stop.type === "shipper")[0]
|
|
2873
|
-
.date) ||
|
|
2874
|
-
"";
|
|
2875
|
-
return (jsxRuntime.jsxs(nerdUi.NerdCard, { children: [jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, justifyContent: "space-between", mb: 1, alignItems: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ justifyContent: "center", display: "flex", mr: 1 }, { children: jsxRuntime.jsx(CalendarMonthIcon__default["default"], {}) })), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6" }, { children: "Drop-off Date" })) })] })) })), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block" }, { children: ["Quote ID: ", jsxRuntime.jsx("b", { children: id })] })) })] })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, justifyContent: "space-between", spacing: 1, alignItems: "center" }, { children: serviceLevels &&
|
|
2876
|
-
serviceLevels.map((serviceLevel) => {
|
|
2877
|
-
return (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, sx: {
|
|
2878
|
-
opacity: selectedDateRange.element.serviceLevel ===
|
|
2879
|
-
serviceLevel.serviceLevel || !props.isDateSelected
|
|
2880
|
-
? 1
|
|
2881
|
-
: 0.3,
|
|
2882
|
-
} }, { children: jsxRuntime.jsx(Calendar, { serviceLevel: Object.assign(Object.assign({}, serviceLevel), { iconProps: appConfigServiceLevels[serviceLevel.serviceLevel] }), pickupDate: pickUpDate, onSelect: (data) => {
|
|
2883
|
-
dispatch(DateSelectedHandler(data));
|
|
2884
|
-
props.setIsDateSelected(true);
|
|
2885
|
-
}, selected: selectedDateRange }) }), serviceLevel.id));
|
|
2886
|
-
}) }))] }));
|
|
2887
|
-
}
|
|
2888
|
-
|
|
2889
|
-
const QuoteSummaryHeader = ({ serviceLevelIconColor, serviceLevelSelected, }) => (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, justifyContent: "space-between", mb: 1 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ justifyContent: "center", display: "flex", mr: 1 }, { children: jsxRuntime.jsx(LocalShippingIcon__default["default"], {}) })), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6" }, { children: "Summary" })) })] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mr: 1 }, { children: jsxRuntime.jsx("img", { src: serviceLevelIconColor.icon, alt: serviceLevelSelected.serviceLevel, style: { width: 35 } }) })), jsxRuntime.jsx(Grid__default["default"], { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6", style: {
|
|
2890
|
-
color: serviceLevelIconColor.color,
|
|
2891
|
-
textTransform: "capitalize",
|
|
2892
|
-
} }, { children: serviceLevelSelected.serviceLevel })) })] })) }))] })));
|
|
2893
|
-
|
|
2894
|
-
const defaultProps = {
|
|
2895
|
-
dateSelected: moment__default["default"]().format("MMMM Do YYYY"),
|
|
2896
|
-
};
|
|
2897
|
-
const QuoteSummaryBody = ({ totalMiles, rowsSummaryAbout, stops, serviceLevelSelected, dateSelected, appConfigServiceLevels, }) => {
|
|
2898
|
-
const firstDropOff = stops.find((s) => s.type === "consignee");
|
|
2899
|
-
const { baseRate, fuelRate, extra, totalRate, serviceLevel } = serviceLevelSelected;
|
|
2900
|
-
const serviceLevelIconColor = appConfigServiceLevels[serviceLevel];
|
|
2901
|
-
const rowsPrices = [
|
|
2902
|
-
createData$1("Base", baseRate),
|
|
2903
|
-
createData$1("Fuel", fuelRate),
|
|
2904
|
-
createData$1("Extra", extra),
|
|
2905
|
-
];
|
|
2906
|
-
return (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: [jsxRuntime.jsx(TableContainer__default["default"], { children: jsxRuntime.jsxs(Table__default["default"], Object.assign({ sx: { minWidth: 650 }, "aria-label": "Quote summary table" }, { children: [jsxRuntime.jsx(TableHead__default["default"], { children: jsxRuntime.jsxs(TableRow__default["default"], { children: [jsxRuntime.jsx(TableCell__default["default"], { children: "Quote Id" }), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Service" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Mode" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Commodity Description" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Total Weight" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Freight Class" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Feet" })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: "Pallets" })), jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: "center" }, { children: ["Mile", totalMiles && totalMiles > 1 ? "s" : ""] }))] }) }), jsxRuntime.jsx(TableBody__default["default"], { children: rowsSummaryAbout.map((row) => (jsxRuntime.jsxs(TableRow__default["default"], Object.assign({ sx: { "&:last-child td, &:last-child th": { border: 0 } } }, { children: [jsxRuntime.jsx(TableCell__default["default"], Object.assign({ component: "th", scope: "row", align: "left" }, { children: row.id })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.service })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.mode })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.commodityDescription })), jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: "center" }, { children: [row.totalWeight, " Lbs"] })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.freightClass })), jsxRuntime.jsxs(TableCell__default["default"], Object.assign({ align: "center" }, { children: [row.feet, " ft"] })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.pallets })), jsxRuntime.jsx(TableCell__default["default"], Object.assign({ align: "center" }, { children: row.miles }))] }), row.id))) })] })) }), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "subtitle1", color: "primary" }, { children: "Stops" })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, alignItems: "stretch" }, { children: stops.map((s, _index) => (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, py: 1, flexBasis: "30%" }, { children: [jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body1", color: "textSecondary" }, { children: s.type === "shipper" ? "From" : "To" })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, mr: 1, alignSelf: "end" }, { children: s.type === "shipper" ? (jsxRuntime.jsx(ArrowUpwardIcon__default["default"], {})) : (jsxRuntime.jsx(ArrowDownwardIcon__default["default"], {})) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h6" }, { children: s.name ? s.name : s.zip })) }))] })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true }, { children: [jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block" }, { children: s.address && s.address.line1
|
|
2907
|
-
? s.address.line1
|
|
2908
|
-
: "Unknown Location" })), jsxRuntime.jsxs(Typography__default["default"], Object.assign({ display: "block", mb: 1 }, { children: [s.address.zip, " ", s.address.city, " ", s.address.state] })), s.date && (jsxRuntime.jsx(Chip__default["default"], { label: moment__default["default"](s.date).format("MMMM Do YYYY"), avatar: jsxRuntime.jsx(Avatar__default["default"], { children: jsxRuntime.jsx(CalendarMonthIcon__default["default"], { fontSize: "small" }) }) })), firstDropOff &&
|
|
2909
|
-
s.id === firstDropOff.id &&
|
|
2910
|
-
serviceLevelSelected && (jsxRuntime.jsx(Chip__default["default"], { label: serviceLevelSelected.grouped
|
|
2911
|
-
? `${moment__default["default"](serviceLevelSelected.from).format("MMMM Do YYYY")} - ${moment__default["default"](serviceLevelSelected.to).format("MMMM Do YYYY")}`
|
|
2912
|
-
: moment__default["default"](dateSelected).format("MMMM Do YYYY"), avatar: jsxRuntime.jsx(Avatar__default["default"], { children: jsxRuntime.jsx(CalendarMonthIcon__default["default"], { fontSize: "small" }) }) }))] }))] }), _index))) })) })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ item: true, xs: 12, style: { textAlign: "right" } }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ container: true, justifyContent: "flex-end", flexDirection: "column" }, { children: rowsPrices.map((price, i) => (jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, justifyContent: "flex-end" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, flex: "0 0 5%", justifyContent: "flex-start", display: "flex" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body2", color: "textSecondary" }, { children: price.typePrice })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, flex: "0 0 7%", justifyContent: "flex-end", display: "flex" }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "body2", color: "textSecondary" }, { children: formattedPrice(price.price) })) }))] })) }), i))) })), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, alignItems: "flex-start", justifyContent: "flex-end", sx: { margin: "5px 0" } }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h5", color: "textSecondary", mr: 1 }, { children: "Total" })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "h4", mb: 1 }, { children: formattedPrice(totalRate) })) }))] })), jsxRuntime.jsx(Button__default["default"], Object.assign({ size: "large", style: {
|
|
2913
|
-
background: serviceLevelIconColor.color,
|
|
2914
|
-
color: "white",
|
|
2915
|
-
}, onClick: () => {
|
|
2916
|
-
console.log("click");
|
|
2917
|
-
} }, { children: jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: "To go to the next step and tender the load, click on this button.", variant: "body1" }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ component: "div", sx: {
|
|
2918
|
-
display: "flex",
|
|
2919
|
-
alignItems: "center",
|
|
2920
|
-
} }, { children: [jsxRuntime.jsx("img", { alt: "service-level-icon", src: serviceLevelIconColor.icon, height: 20, style: { paddingRight: 10 } }), " ", jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "button", textTransform: "uppercase" }, { children: "Tender Load" }))] })) })) }))] }))] })));
|
|
2921
|
-
};
|
|
2922
|
-
QuoteSummaryBody.defaultProps = defaultProps;
|
|
2923
|
-
/**
|
|
2924
|
-
* @param typePrice
|
|
2925
|
-
* @param price
|
|
2926
|
-
*/
|
|
2927
|
-
function createData$1(typePrice, price) {
|
|
2928
|
-
return {
|
|
2929
|
-
typePrice,
|
|
2930
|
-
price,
|
|
2931
|
-
};
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
const QuoteSummary = (props) => {
|
|
2935
|
-
const { dateSelected, serviceLevelSelected, quoteResponse, t, appConfigServiceLevels, } = props;
|
|
2936
|
-
const { id, type, temp, commodityDescription, weight, freightClass, feet, pallets, stops, totalMiles, } = quoteResponse;
|
|
2937
|
-
const { serviceLevel } = serviceLevelSelected;
|
|
2938
|
-
const mode = temp && temp.length ? "Reefer" : "Dry";
|
|
2939
|
-
const serviceLevelIconColor = appConfigServiceLevels[serviceLevel];
|
|
2940
|
-
const rowsSummaryAbout = [
|
|
2941
|
-
createData(id, type, mode, commodityDescription, weight, freightClass || "", feet, pallets, totalMiles || 0),
|
|
2942
|
-
];
|
|
2943
|
-
return (jsxRuntime.jsxs(nerdUi.NerdCard, { children: [jsxRuntime.jsx(QuoteSummaryHeader, { serviceLevelIconColor: serviceLevelIconColor, serviceLevelSelected: serviceLevelSelected }), jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 2 }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ display: "block", variant: "subtitle1", color: "primary" }, { children: t("quote.about") })) })), jsxRuntime.jsx(QuoteSummaryBody, Object.assign({}, {
|
|
2944
|
-
totalMiles,
|
|
2945
|
-
rowsSummaryAbout,
|
|
2946
|
-
stops,
|
|
2947
|
-
serviceLevelSelected,
|
|
2948
|
-
dateSelected,
|
|
2949
|
-
appConfigServiceLevels,
|
|
2950
|
-
}))] }))] }));
|
|
2951
|
-
};
|
|
2952
|
-
/**
|
|
2953
|
-
* @param id
|
|
2954
|
-
* @param service
|
|
2955
|
-
* @param mode
|
|
2956
|
-
* @param commodityDescription
|
|
2957
|
-
* @param totalWeight
|
|
2958
|
-
* @param freightClass
|
|
2959
|
-
* @param feet
|
|
2960
|
-
* @param pallets
|
|
2961
|
-
* @param miles
|
|
2962
|
-
*/
|
|
2963
|
-
function createData(id, service, mode, commodityDescription, totalWeight, freightClass, feet, pallets, miles) {
|
|
2964
|
-
return {
|
|
2965
|
-
id,
|
|
2966
|
-
service,
|
|
2967
|
-
mode,
|
|
2968
|
-
commodityDescription,
|
|
2969
|
-
totalWeight,
|
|
2970
|
-
freightClass,
|
|
2971
|
-
feet,
|
|
2972
|
-
pallets,
|
|
2973
|
-
miles,
|
|
2974
|
-
};
|
|
2975
|
-
}
|
|
2976
|
-
|
|
2977
|
-
// use google object
|
|
2978
|
-
const google$1 = window.google;
|
|
2979
|
-
// Google maps
|
|
2980
|
-
const googleService = {
|
|
2981
|
-
maps: google$1.maps,
|
|
2982
|
-
};
|
|
2983
|
-
// Service context, default
|
|
2984
|
-
const ServiceContext = React.createContext(null);
|
|
2985
|
-
/**
|
|
2986
|
-
* Nerd Sales Quote view
|
|
2987
|
-
*
|
|
2988
|
-
* @param props
|
|
2989
|
-
* @param props.theme
|
|
2990
|
-
* @param props.dispatch
|
|
2991
|
-
* @param props.nerdSalesKitState
|
|
2992
|
-
* @param props.t
|
|
2993
|
-
* @param props.networkCompletionStack
|
|
2994
|
-
* @param props.isCustomer
|
|
2995
|
-
* @param props.appConfigServiceLevels
|
|
2996
|
-
* @returns {React.ReactElement<any>} return as a function component
|
|
2997
|
-
*/
|
|
2998
|
-
const SalesQuote = ({ theme, dispatch, nerdSalesKitState, t, networkCompletionStack, isCustomer, appConfigServiceLevels, }) => {
|
|
2999
|
-
// Constants
|
|
3000
|
-
const appTheme = styles.createTheme(theme);
|
|
3001
|
-
const isMobile = useMediaQuery__default["default"](appTheme.breakpoints.down("sm"), {
|
|
3002
|
-
noSsr: true,
|
|
3003
|
-
});
|
|
3004
|
-
const el = React.useRef(null);
|
|
3005
|
-
const { quoteState, quoteState: { quoteFormData, quoteResponse }, selectedDateRange, } = nerdSalesKitState;
|
|
3006
|
-
// States
|
|
3007
|
-
const [showFormData, setShowFormData] = React.useState(false);
|
|
3008
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
3009
|
-
const [pending, setPending] = React.useState(false);
|
|
3010
|
-
const [isDateSelected, setIsDateSelected] = React.useState(false);
|
|
3011
|
-
// Actions
|
|
3012
|
-
const showFormDataHandler = () => {
|
|
3013
|
-
setShowFormData(!showFormData);
|
|
3014
|
-
};
|
|
3015
|
-
/**
|
|
3016
|
-
*
|
|
3017
|
-
*/
|
|
3018
|
-
function onSubmitFormHandler() {
|
|
3019
|
-
setPending(true);
|
|
3020
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, sendFormData(quoteFormData));
|
|
3021
|
-
setRequestUUID(uuid);
|
|
3022
|
-
}
|
|
3023
|
-
// React hooks
|
|
3024
|
-
React.useEffect(() => {
|
|
3025
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
3026
|
-
setPending(false);
|
|
3027
|
-
}
|
|
3028
|
-
}, [requestUUID, networkCompletionStack]);
|
|
3029
|
-
return (jsxRuntime.jsx(ServiceContext.Provider, Object.assign({ value: { googleService, quoteState, t, isMobile, appConfigServiceLevels } }, { children: jsxRuntime.jsx(styles.ThemeProvider, Object.assign({ theme: appTheme }, { children: jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: showFormData ? 9 : 12, sm: showFormData ? 8 : 12 }, { children: jsxRuntime.jsxs(Box__default["default"], Object.assign({ sx: {
|
|
3030
|
-
display: "flex",
|
|
3031
|
-
flexWrap: "wrap",
|
|
3032
|
-
justifyContent: "flex-end",
|
|
3033
|
-
} }, { children: [jsxRuntime.jsx(Fab__default["default"], Object.assign({ variant: "extended", size: "small", "aria-label": "show form data", sx: { mr: 2, my: 1, color: "#61614F" }, onClick: showFormDataHandler }, { children: !isMobile ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(PreviewIcon__default["default"], { sx: { mr: 1 } }), t("quote.check_form_data")] })) : (jsxRuntime.jsx(nerdUi.NerdHelp, Object.assign({ explanation: t("quote.check_form_data"), variant: "body1" }, { children: jsxRuntime.jsx(PreviewIcon__default["default"], {}) }))) })), jsxRuntime.jsx(Divider__default["default"], { sx: { flexBasis: "100%" } }), jsxRuntime.jsxs(Container__default["default"], Object.assign({ className: "NerdQuote" }, { children: [jsxRuntime.jsx(nerdUi.NerdHeading, { variant: "h4", text: t("quote.new_quote"), fontWeight: 700, display: "block", mt: 2 }), jsxRuntime.jsxs(Stack__default["default"], Object.assign({ spacing: 4, mt: 1, mb: 2 }, { children: [jsxRuntime.jsx(AboutQuote, Object.assign({ dispatch: dispatch, networkCompletionStack: networkCompletionStack, isCustomer: isCustomer, submitForm: onSubmitFormHandler }, { children: jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, xs: 12 }, { children: jsxRuntime.jsx(nerdUi.NerdHeading, { alignItems: "center", variant: "h6", text: t("quote.about_load_library"), icon: jsxRuntime.jsx(nerdUi.NerdIcon, { icon: "info-circle", size: "lg", iconColor: "primary", "aria-owns": "mouse-over-popover", "aria-haspopup": "true" }) }) })) })), pending && jsxRuntime.jsx(Loading, {}), !pending && quoteState.quoteResponse.id && (jsxRuntime.jsxs(Stack__default["default"], Object.assign({ spacing: 2, ref: el }, { children: [jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "h4" }, { children: t("quote.result") })), jsxRuntime.jsx(QuoteResultAccorion, { dispatch: dispatch, networkCompletionStack: networkCompletionStack, marketCosts: quoteState.marketCosts, responseState: quoteResponse }), jsxRuntime.jsx(QuoteCalendar, { setIsDateSelected: setIsDateSelected, isDateSelected: isDateSelected, responseState: quoteResponse, selectedDateRange: selectedDateRange, dispatch: dispatch, appConfigServiceLevels: appConfigServiceLevels }), isDateSelected && (jsxRuntime.jsx(QuoteSummary, { dateSelected: selectedDateRange.date, serviceLevelSelected: selectedDateRange.element, quoteResponse: quoteResponse, t: t, appConfigServiceLevels: appConfigServiceLevels }))] })))] }))] }))] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: 3, sm: 4, sx: {
|
|
3034
|
-
display: showFormData ? "block" : "none",
|
|
3035
|
-
background: "#282c34",
|
|
3036
|
-
color: "#abb2bf",
|
|
3037
|
-
width: "100%",
|
|
3038
|
-
} }, { children: jsxRuntime.jsx(PrettyPrintJson, { state: quoteFormData }) }))] })) })) })));
|
|
3039
|
-
};
|
|
3040
|
-
const PrettyPrintJson = ({ state }) => {
|
|
3041
|
-
return (jsxRuntime.jsx(Box__default["default"], { children: jsxRuntime.jsx("pre", { children: jsxRuntime.jsx(Typography__default["default"], Object.assign({ variant: "body2" }, { children: JSON.stringify(state, null, "\t") })) }) }));
|
|
3042
|
-
};
|
|
3043
|
-
|
|
3044
|
-
/**
|
|
3045
|
-
* @param props
|
|
3046
|
-
*/
|
|
3047
|
-
function CustomerFinder(props) {
|
|
3048
|
-
const { dispatch, networkCompletionStack } = props;
|
|
3049
|
-
const customersState = React.useContext(ServiceContext);
|
|
3050
|
-
const [open, setOpen] = React.useState(false);
|
|
3051
|
-
// This state represents the value displayed in the textbox.
|
|
3052
|
-
const [inputValue, setInputValue] = React.useState("");
|
|
3053
|
-
// This state represents the network request UUID
|
|
3054
|
-
const [requestPending, setRequestPending] = React.useState(false);
|
|
3055
|
-
const [requestUUID, setRequestUUID] = React.useState("");
|
|
3056
|
-
const customers = [
|
|
3057
|
-
...((customersState === null || customersState === void 0 ? void 0 : customersState.quoteState.customers) || []),
|
|
3058
|
-
];
|
|
3059
|
-
// This state This state represents the value selected by the user,
|
|
3060
|
-
const [value, setValue] = React.useState(customers[0]);
|
|
3061
|
-
// Fetch the data to get get the customers
|
|
3062
|
-
const fetchCustomers = React.useCallback((queryString) => {
|
|
3063
|
-
setRequestPending(true);
|
|
3064
|
-
const query = {
|
|
3065
|
-
query: queryString,
|
|
3066
|
-
start: 0,
|
|
3067
|
-
limit: 25,
|
|
3068
|
-
};
|
|
3069
|
-
const uuid = nerdNetwork.withNetworkCompletionDispatch(dispatch, getCustomers(query));
|
|
3070
|
-
setRequestUUID(uuid);
|
|
3071
|
-
}, [dispatch]);
|
|
3072
|
-
// Set URL query params and fetch the data
|
|
3073
|
-
React.useEffect(() => {
|
|
3074
|
-
//console.log("CHANGEINPUT", inputValue, value);
|
|
3075
|
-
if (inputValue !== "") {
|
|
3076
|
-
fetchCustomers(inputValue);
|
|
3077
|
-
//console.log("Fetching customers", inputValue, customers);
|
|
3078
|
-
}
|
|
3079
|
-
if (value && value.id) {
|
|
3080
|
-
dispatch(storeQuoteFormData({
|
|
3081
|
-
customerId: value.id,
|
|
3082
|
-
customerName: value.name,
|
|
3083
|
-
}));
|
|
3084
|
-
}
|
|
3085
|
-
}, [inputValue]);
|
|
3086
|
-
React.useEffect(() => {
|
|
3087
|
-
if (!networkCompletionStack.some((e) => e[requestUUID])) {
|
|
3088
|
-
setRequestPending(false);
|
|
3089
|
-
}
|
|
3090
|
-
}, [requestUUID, networkCompletionStack]);
|
|
3091
|
-
return (jsxRuntime.jsxs(Grid__default["default"], Object.assign({ container: true, spacing: 1, alignItems: "center" }, { children: [jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsxs(nerdUi.NerdHelp, Object.assign({ explanation: "Select the customer you are quoting for. This could affect the final prices for customer who have special agreements.", variant: "body1" }, { children: [jsxRuntime.jsx(BusinessIcon__default["default"], {}), " "] })) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true, md: true, xs: 9, sm: 10 }, { children: jsxRuntime.jsx(Autocomplete__default["default"], { id: "customer-autocomplete", open: open, onOpen: () => {
|
|
3092
|
-
setOpen(true);
|
|
3093
|
-
}, onClose: () => {
|
|
3094
|
-
setOpen(false);
|
|
3095
|
-
}, value: value || null, onChange: (_event, newValue) => {
|
|
3096
|
-
setValue(newValue);
|
|
3097
|
-
}, inputValue: inputValue, onInputChange: (_event, newInputValue) => {
|
|
3098
|
-
setInputValue(newInputValue);
|
|
3099
|
-
}, isOptionEqualToValue: (option, optionValue) => option.name === optionValue.name, getOptionLabel: (option) => {
|
|
3100
|
-
if (option.name) {
|
|
3101
|
-
return option.name;
|
|
3102
|
-
}
|
|
3103
|
-
return "";
|
|
3104
|
-
}, options: customers, loading: requestPending, renderInput: (params) => (jsxRuntime.jsx(TextField__default["default"], Object.assign({}, params, { label: "Customer", variant: "standard", placeholder: "Enter customer", fullWidth: true, InputLabelProps: {
|
|
3105
|
-
shrink: true,
|
|
3106
|
-
}, InputProps: Object.assign(Object.assign({}, params.InputProps), { endAdornment: null }), required: !inputValue ? true : false, helperText: inputValue === "" ? "Required" : "" }))), renderOption: (renderOptionProps, option) => {
|
|
3107
|
-
return (jsxRuntime.jsx(RenderOptionTemplate$1, { renderOptionProps: renderOptionProps, option: option }, toolkit.nanoid()));
|
|
3108
|
-
}, PaperComponent: (paperProps) => {
|
|
3109
|
-
if (!inputValue || requestPending) {
|
|
3110
|
-
return (React.createElement(nerdUi.PaperComponentOnLoad, Object.assign({}, { inputValue }, { key: toolkit.nanoid(), props: paperProps, loading: requestPending, autocompleteType: nerdUi.AutocompleteType.CUSTOMER })));
|
|
3111
|
-
}
|
|
3112
|
-
return (React.createElement(Paper__default["default"], Object.assign({}, paperProps, { key: toolkit.nanoid() }), paperProps.children));
|
|
3113
|
-
} }) })), jsxRuntime.jsx(Grid__default["default"], Object.assign({ item: true }, { children: jsxRuntime.jsx(IconButton__default["default"], Object.assign({ size: "small", onClick: () => {
|
|
3114
|
-
setValue(null);
|
|
3115
|
-
dispatch(storeQuoteFormData({
|
|
3116
|
-
customerId: undefined,
|
|
3117
|
-
}));
|
|
3118
|
-
} }, { children: jsxRuntime.jsx(CloseIcon__default["default"], { fontSize: "small" }) })) }))] })));
|
|
3119
|
-
}
|
|
3120
|
-
|
|
3121
|
-
exports.AboutQuote = AboutQuote;
|
|
3122
|
-
exports.Calendar = Calendar;
|
|
3123
|
-
exports.DateSelectedHandler = DateSelectedHandler;
|
|
3124
|
-
exports.FREIGHT_CLASS = FREIGHT_CLASS;
|
|
3125
|
-
exports.Loading = Loading;
|
|
3126
|
-
exports.LocationFinder = LocationFinder;
|
|
3127
|
-
exports.QUOTE_MAX_STOPS = QUOTE_MAX_STOPS;
|
|
3128
|
-
exports.RenderOptionTemplate = RenderOptionTemplate$1;
|
|
3129
|
-
exports.SalesQuote = SalesQuote;
|
|
3130
|
-
exports.ServiceContext = ServiceContext;
|
|
3131
|
-
exports.calendarSlice = calendarSlice;
|
|
3132
|
-
exports.formattedPrice = formattedPrice;
|
|
3133
|
-
exports.getArcherLocationsSuccess = getArcherLocationsSuccess;
|
|
3134
|
-
exports.getCustomers = getCustomers;
|
|
3135
|
-
exports.getCustomersSuccess = getCustomersSuccess;
|
|
3136
|
-
exports.getFacility = getFacility;
|
|
3137
|
-
exports.getMarketCosts = getMarketCosts;
|
|
3138
|
-
exports.getMarketCostsSuccess = getMarketCostsSuccess;
|
|
3139
|
-
exports.getQuoteAccessorials = getQuoteAccessorials;
|
|
3140
|
-
exports.getQuoteAccessorialsSuccess = getQuoteAccessorialsSuccess;
|
|
3141
|
-
exports.getQuoteById = getQuoteById;
|
|
3142
|
-
exports.getQuoteCommodityDescirptionSuccess = getQuoteCommodityDescirptionSuccess;
|
|
3143
|
-
exports.getQuoteCommodityDescription = getQuoteCommodityDescription;
|
|
3144
|
-
exports.getQuotePathEdgeCosts = getQuotePathEdgeCosts;
|
|
3145
|
-
exports.getQuotePathEdgeCostsSucess = getQuotePathEdgeCostsSucess;
|
|
3146
|
-
exports.getQuoteResponseSuccess = getQuoteResponseSuccess;
|
|
3147
|
-
exports.getRange = getRange;
|
|
3148
|
-
exports.nerdSalesKitReducer = nerdSalesKitReducer;
|
|
3149
|
-
exports.options = options$2;
|
|
3150
|
-
exports.quoteAccessorialsSelector = quoteAccessorialsSelector;
|
|
3151
|
-
exports.quoteArcherLocationsSelector = quoteArcherLocationsSelector;
|
|
3152
|
-
exports.quoteCommodityDescriptionSelector = quoteCommodityDescriptionSelector;
|
|
3153
|
-
exports.quoteCustomersSelector = quoteCustomersSelector;
|
|
3154
|
-
exports.quoteErrorSelector = quoteErrorSelector;
|
|
3155
|
-
exports.quoteReducer = quoteReducer;
|
|
3156
|
-
exports.quoteUnitsSelector = quoteUnitsSelector;
|
|
3157
|
-
exports.re = re$1;
|
|
3158
|
-
exports.removeArcherLocations = removeArcherLocations;
|
|
3159
|
-
exports.safariFix = safariFix;
|
|
3160
|
-
exports.sendFormData = sendFormData;
|
|
3161
|
-
exports.setIsQuoteFormSubmitted = setIsQuoteFormSubmitted;
|
|
3162
|
-
exports.setSavingActionLocation = setSavingActionLocation;
|
|
3163
|
-
exports.storeNewLocation = storeNewLocation;
|
|
3164
|
-
exports.storePalletError = storePalletError;
|
|
3165
|
-
exports.storePalletUnitSuccess = storePalletUnitSuccess;
|
|
3166
|
-
exports.storePallets = storePallets;
|
|
3167
|
-
exports.storeQuoteFormData = storeQuoteFormData;
|
|
3168
|
-
exports.updateLocation = updateLocation;
|
|
3169
|
-
//# sourceMappingURL=index.js.map
|