@nerdjs/sales-kit 2.4.15 → 2.4.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/dist/entities/load/load.d.ts +2 -2
  2. package/dist/entities/load/load.js +1 -1
  3. package/dist/entities/load/load.js.map +1 -1
  4. package/dist/entities/shipcon/helper.d.ts +1 -0
  5. package/dist/entities/shipcon/helper.js +16 -0
  6. package/dist/entities/shipcon/helper.js.map +1 -1
  7. package/dist/hooks/lep/constants.d.ts +2 -0
  8. package/dist/hooks/lep/constants.js +71 -0
  9. package/dist/hooks/lep/constants.js.map +1 -1
  10. package/dist/hooks/lep/lepActionBar.d.ts +2 -1
  11. package/dist/hooks/lep/lepActionBar.js +32 -4
  12. package/dist/hooks/lep/lepActionBar.js.map +1 -1
  13. package/dist/hooks/lep/loadEditPanel.d.ts +2 -1
  14. package/dist/hooks/lep/loadEditPanel.js +2 -2
  15. package/dist/hooks/lep/loadEditPanel.js.map +1 -1
  16. package/dist/hooks/load/loadCommodityPieces.js +4 -4
  17. package/dist/hooks/load/loadCommodityPieces.js.map +1 -1
  18. package/dist/hooks/load/loadLastLocation.js +14 -4
  19. package/dist/hooks/load/loadLastLocation.js.map +1 -1
  20. package/dist/hooks/locationsForm/index.d.ts +2 -2
  21. package/dist/hooks/locationsForm/index.js +2 -2
  22. package/dist/hooks/locationsForm/index.js.map +1 -1
  23. package/dist/hooks/locationsForm/{locationsForm.js → locationForm.js} +1 -1
  24. package/dist/hooks/locationsForm/locationForm.js.map +1 -0
  25. package/dist/hooks/locationsForm/locationFormSales/archerLocationAutocomplete.d.ts +6 -0
  26. package/dist/hooks/locationsForm/locationFormSales/archerLocationAutocomplete.js +41 -0
  27. package/dist/hooks/locationsForm/locationFormSales/archerLocationAutocomplete.js.map +1 -0
  28. package/dist/hooks/locationsForm/locationFormSales/index.d.ts +5 -0
  29. package/dist/hooks/locationsForm/locationFormSales/index.js +6 -0
  30. package/dist/hooks/locationsForm/locationFormSales/index.js.map +1 -0
  31. package/dist/hooks/locationsForm/locationFormSales/locationAccessorialsList.d.ts +8 -0
  32. package/dist/hooks/locationsForm/locationFormSales/locationAccessorialsList.js +181 -0
  33. package/dist/hooks/locationsForm/locationFormSales/locationAccessorialsList.js.map +1 -0
  34. package/dist/hooks/locationsForm/locationFormSales/locationDocumentsList.d.ts +8 -0
  35. package/dist/hooks/locationsForm/locationFormSales/locationDocumentsList.js +149 -0
  36. package/dist/hooks/locationsForm/locationFormSales/locationDocumentsList.js.map +1 -0
  37. package/dist/hooks/locationsForm/locationFormSales/locationFormSales.d.ts +19 -0
  38. package/dist/hooks/locationsForm/locationFormSales/locationFormSales.js +119 -0
  39. package/dist/hooks/locationsForm/locationFormSales/locationFormSales.js.map +1 -0
  40. package/dist/hooks/locationsForm/locationFormSales/locationFormSalesMain.d.ts +26 -0
  41. package/dist/hooks/locationsForm/locationFormSales/locationFormSalesMain.js +671 -0
  42. package/dist/hooks/locationsForm/locationFormSales/locationFormSalesMain.js.map +1 -0
  43. package/dist/hooks/quote/helpers.js +1 -1
  44. package/dist/hooks/quote/helpers.js.map +1 -1
  45. package/dist/locales/en/components.json +2 -1
  46. package/dist/locales/index.d.ts +1 -0
  47. package/dist/redux/api/salesApi.d.ts +1 -1
  48. package/dist/redux/apiTender/apiTenderEndpoints.d.ts +10 -10
  49. package/dist/redux/appointmentArrival/appointmentArrivalEndpoints.d.ts +12 -12
  50. package/dist/redux/appointmentIssue/appointmentIssueEndpoints.d.ts +10 -10
  51. package/dist/redux/appointmentIssueCategory/appointmentIssueCategoryEndpoints.d.ts +11 -11
  52. package/dist/redux/appointmentIssueSubcategory/appointmentIssueSubcategoryEndpoints.d.ts +10 -10
  53. package/dist/redux/appointmentNote/appointmentNoteEndpoints.d.ts +10 -10
  54. package/dist/redux/appointmentNoteType/appointmentNoteTypeEndpoints.d.ts +10 -10
  55. package/dist/redux/appointmentTrip/appointmentTripEndpoints.d.ts +10 -10
  56. package/dist/redux/archerFile/archerFileEndpoints.d.ts +13 -13
  57. package/dist/redux/area/areaEndpoints.d.ts +9 -9
  58. package/dist/redux/asset/assetEndpoints.d.ts +12 -12
  59. package/dist/redux/billingKickback/billingKickbackEndpoints.d.ts +11 -11
  60. package/dist/redux/billingKickbackResponse/billingKickbackResponseEndpoints.d.ts +10 -10
  61. package/dist/redux/billingKickbackResponseAccessorial/billingKickbackResponseAccessorialEndpoints.d.ts +10 -10
  62. package/dist/redux/billingMessage/billingMessageEndpoints.d.ts +9 -9
  63. package/dist/redux/billingNote/billingNoteEndpoints.d.ts +10 -10
  64. package/dist/redux/cargoConsolidation/cargoConsolidationEndpoints.d.ts +19 -19
  65. package/dist/redux/cargoConsolidationCommodityPiece/cargoConsolidationCommodityPieceEndpoints.d.ts +10 -10
  66. package/dist/redux/carrier/carrierEndpoints.d.ts +19 -19
  67. package/dist/redux/carrierInsurance/carrierInsuranceEndpoints.d.ts +10 -10
  68. package/dist/redux/carrierName/carrierNameEndpoints.d.ts +12 -12
  69. package/dist/redux/carrierPayContract/carrierPayContractEndpoints.d.ts +11 -11
  70. package/dist/redux/carrierTender/carrierTenderEndpoints.d.ts +10 -10
  71. package/dist/redux/carrierTenderAccessorial/carrierTenderAccessorialEndpoints.d.ts +10 -10
  72. package/dist/redux/carrierTenderDeduction/carrierTenderDeductionEndpoints.d.ts +10 -10
  73. package/dist/redux/carrierTenderEdge/carrierTenderEdgeEndpoints.d.ts +9 -9
  74. package/dist/redux/carrierTenderV1/carrierTenderV1Endpoints.d.ts +20 -20
  75. package/dist/redux/claim/claimEndpoints.d.ts +16 -16
  76. package/dist/redux/claimStatus/claimStatusEndpoints.d.ts +9 -9
  77. package/dist/redux/commodity/commodityEndpoints.d.ts +10 -10
  78. package/dist/redux/commodityV1/commodityV1Endpoints.d.ts +11 -11
  79. package/dist/redux/companyLocation/companyLocationEndpoints.d.ts +10 -10
  80. package/dist/redux/contact/contactEndpoints.d.ts +10 -10
  81. package/dist/redux/contract/contractEndpoints.d.ts +10 -10
  82. package/dist/redux/contractsRecord/contractsRecordEndpoints.d.ts +12 -12
  83. package/dist/redux/creditTerm/creditTermEndpoints.d.ts +9 -9
  84. package/dist/redux/customer/customerEndpoints.d.ts +18 -18
  85. package/dist/redux/customerContract/customerContractEndpoints.d.ts +10 -10
  86. package/dist/redux/customersAccessorial/customersAccessorialEndpoints.d.ts +9 -9
  87. package/dist/redux/deduction/deductionEndpoints.d.ts +9 -9
  88. package/dist/redux/departmentPhone/departmentPhoneEndpoints.d.ts +10 -10
  89. package/dist/redux/dispatch/dispatchEndpoints.d.ts +10 -10
  90. package/dist/redux/driver/driverEndpoints.d.ts +10 -10
  91. package/dist/redux/driverName/driverNameEndpoints.d.ts +9 -9
  92. package/dist/redux/driverV1/driverV1Endpoints.d.ts +9 -9
  93. package/dist/redux/ediAccount/ediAccountEndpoints.d.ts +10 -10
  94. package/dist/redux/ediLoadTender/ediLoadTenderEndpoints.d.ts +10 -10
  95. package/dist/redux/employeeName/employeeNameEndpoints.d.ts +9 -9
  96. package/dist/redux/flag/flagEndpoints.d.ts +9 -9
  97. package/dist/redux/generalLedgerAccount/generalLedgerAccountEndpoints.d.ts +10 -10
  98. package/dist/redux/genericTender/genericTenderEndpoints.d.ts +12 -12
  99. package/dist/redux/holiday/holidayEndpoints.d.ts +10 -10
  100. package/dist/redux/invoice/invoiceEndpoints.d.ts +10 -10
  101. package/dist/redux/invoiceAdjustment/invoiceAdjustmentEndpoints.d.ts +10 -10
  102. package/dist/redux/invoiceV1/invoiceV1Endpoints.d.ts +11 -11
  103. package/dist/redux/load/loadEndpoints.d.ts +12 -12
  104. package/dist/redux/loadAdjustment/loadAdjustmentEndpoints.d.ts +10 -10
  105. package/dist/redux/loadAdjustmentV1/loadAdjustmentV1Endpoints.d.ts +10 -10
  106. package/dist/redux/loadTender/loadTenderEndpoints.d.ts +12 -12
  107. package/dist/redux/loadTenderView/loadTenderViewEndpoints.d.ts +10 -10
  108. package/dist/redux/loadV1/loadV1Endpoints.d.ts +58 -58
  109. package/dist/redux/location/locationEndpoints.d.ts +16 -15
  110. package/dist/redux/location/locationEndpoints.js +7 -1
  111. package/dist/redux/location/locationEndpoints.js.map +1 -1
  112. package/dist/redux/locationV1/locationV1Endpoints.d.ts +19 -19
  113. package/dist/redux/manualCheckCall/manualCheckCallEndpoints.d.ts +10 -10
  114. package/dist/redux/mapUpdate/mapUpdateEndpoints.d.ts +3 -3
  115. package/dist/redux/nmfcClass/nmfcClassEndpoints.d.ts +9 -9
  116. package/dist/redux/node/nodeEndpoints.d.ts +8 -8
  117. package/dist/redux/nodeName/nodeNameEndpoints.d.ts +10 -10
  118. package/dist/redux/nodeType/nodeTypeEndpoints.d.ts +8 -8
  119. package/dist/redux/nodeTypeNode/nodeTypeNodeEndpoints.d.ts +8 -8
  120. package/dist/redux/notification/notificationEndpoints.d.ts +13 -13
  121. package/dist/redux/otrDispatch/otrDispatchEndpoints.d.ts +23 -23
  122. package/dist/redux/person/personEndpoints.d.ts +12 -12
  123. package/dist/redux/personName/personNameEndpoints.d.ts +10 -10
  124. package/dist/redux/position/positionEndpoints.d.ts +10 -10
  125. package/dist/redux/possibleIssueItem/possibleIssueItemEndpoints.d.ts +10 -10
  126. package/dist/redux/quote/quoteCustomerPortalEndpoints.d.ts +15 -15
  127. package/dist/redux/quote/quoteHooks.d.ts +2 -2
  128. package/dist/redux/quote/quoteSalesEndpoints.d.ts +16 -16
  129. package/dist/redux/quoteAccessorial/quoteAccessorialEndpoints.d.ts +9 -9
  130. package/dist/redux/quoteAccessorialV1/quoteAccessorialV1Endpoints.d.ts +10 -10
  131. package/dist/redux/rateReview/rateReviewEndpoints.d.ts +10 -10
  132. package/dist/redux/rejectionReason/rejectionReasonEndpoints.d.ts +9 -9
  133. package/dist/redux/relayCode/relayCodeEndpoints.d.ts +11 -11
  134. package/dist/redux/shipConDispatch/shipConDispatchEndpoints.d.ts +11 -11
  135. package/dist/redux/shipConETA/shipConETAEndpoints.d.ts +10 -10
  136. package/dist/redux/shipcon/shipconEndpoints.d.ts +11 -11
  137. package/dist/redux/shipconV1/shipconV1Endpoints.d.ts +18 -18
  138. package/dist/redux/tender/tenderEndpoints.d.ts +9 -9
  139. package/dist/redux/trailerAvailability/customerEndpoints.d.ts +4 -4
  140. package/dist/redux/trailerCode/trailerCodeEndpoints.d.ts +9 -9
  141. package/dist/redux/unitV1/unitV1Endpoints.d.ts +9 -9
  142. package/dist/redux/userNoteV1/userNoteV1Endpoints.d.ts +10 -10
  143. package/package.json +1 -1
  144. package/dist/hooks/locationsForm/locationsForm.js.map +0 -1
  145. /package/dist/hooks/locationsForm/{locationsForm.d.ts → locationForm.d.ts} +0 -0
@@ -0,0 +1,671 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Button, FormControl, FormLabel, Input, Checkbox, CircularProgress, Select, Option, FormHelperText, Textarea, Box, Autocomplete, Divider, } from "@mui/joy";
3
+ import { NerdDatePicker, NerdPhoneField, NerdTimePicker, } from "@nerdjs/nerd-ui";
4
+ import { useEffect, useState } from "react";
5
+ import salesKitI18n from "../../../i18n";
6
+ import { useTranslation } from "react-i18next";
7
+ import { DateTime } from "luxon";
8
+ import { locationEntityTypeGuard } from "../../../entities";
9
+ import { useGetLocationV1Query, useUpdateLocationV1Mutation, } from "../../../redux";
10
+ /**
11
+ *
12
+ * @param {LocationFormSalesMainProps} props props
13
+ * @returns {ReactElement} locationsFormSalesMain
14
+ */
15
+ export function LocationFormSalesMain({ place, onValidate, onChange: setLocation, value: location, }) {
16
+ const { t } = useTranslation("common", { i18n: salesKitI18n });
17
+ const [validationObject, _setValidationObject] = useState({
18
+ name: true,
19
+ address: true,
20
+ phone: true,
21
+ openTime: true,
22
+ closeTime: true,
23
+ FCFSIN: true,
24
+ FCFSOUT: true,
25
+ });
26
+ const { data, isLoading } = useGetLocationV1Query(locationEntityTypeGuard(place) && place.id ? place.id : 0, { skip: locationEntityTypeGuard(place) && place.id ? false : true });
27
+ const [updateLocation] = useUpdateLocationV1Mutation();
28
+ const googleMapsAutocompleteService = new google.maps.places.AutocompleteService();
29
+ const googleMapsGeocoder = new google.maps.Geocoder();
30
+ const [googleMapsPredictions, setGoogleMapsPredictions] = useState(null);
31
+ const [value, setValue] = useState(null);
32
+ const [loadingMapsLocations, setLoadingMapsLocations] = useState(place ? true : false);
33
+ const addressFormGeocoder = (place) => {
34
+ const address = {};
35
+ const _ref = place.address_components;
36
+ const _len = _ref.length;
37
+ for (let _i = 0; _i < _len; _i++) {
38
+ const i = _ref[_i];
39
+ const _ref1 = i.types;
40
+ const _len1 = _ref1.length;
41
+ for (let _j = 0; _j < _len1; _j++) {
42
+ const t = _ref1[_j];
43
+ address[t] = i.short_name;
44
+ address[`${t}_long`] = i.long_name;
45
+ }
46
+ }
47
+ const line1 = `${address.street_number ? `${address.street_number} ` : ""}${address.route}`.trim();
48
+ const city = address.locality_long ||
49
+ address.sublocality_long ||
50
+ address.sublocality_level_1_long ||
51
+ address.neighborhood_long;
52
+ const state = address.administrative_area_level_1;
53
+ const zip = address.postal_code;
54
+ const formatted_address = place.formatted_address;
55
+ return { line1, city, state, zip, formatted_address };
56
+ };
57
+ useEffect(() => {
58
+ // If place is an Archer location v3 object, fetch the matching v1 object and populate the google maps autocomplete
59
+ if (locationEntityTypeGuard(place) &&
60
+ data?.id &&
61
+ place?.id &&
62
+ data.id === place.id) {
63
+ setLocation(data);
64
+ setValidationObject({
65
+ ...validationObject,
66
+ address: data?.address_id ? true : false,
67
+ name: data?.name ? true : false,
68
+ phone: data?.phone ? true : false,
69
+ });
70
+ if (data.formatted_address) {
71
+ getGoogleAddresses(data.formatted_address, true);
72
+ }
73
+ else {
74
+ setLoadingMapsLocations(false);
75
+ }
76
+ }
77
+ else if (place && locationEntityTypeGuard(place)) {
78
+ setLocation({
79
+ line1: place.address.line1,
80
+ city: place.address.city,
81
+ state: place.address.state,
82
+ zip: place.address.zip,
83
+ formatted_address: place.address.formattedAddress,
84
+ place_id: place.address.placeId,
85
+ });
86
+ setValidationObject({
87
+ ...validationObject,
88
+ name: false,
89
+ });
90
+ if (place.address.formattedAddress) {
91
+ getGoogleAddresses(place.address.formattedAddress, true);
92
+ }
93
+ else {
94
+ setLoadingMapsLocations(false);
95
+ }
96
+ }
97
+ else if (place) {
98
+ const address = addressFormGeocoder(place);
99
+ setLocation({ ...address });
100
+ setLoadingMapsLocations(false);
101
+ getGoogleAddresses(place.formatted_address, true);
102
+ }
103
+ }, [data?.id, place]);
104
+ useEffect(() => {
105
+ if (!loadingMapsLocations) {
106
+ setValue(googleMapsPredictions?.find((l) => location.place_id === l.place_id) ||
107
+ googleMapsPredictions?.[0] ||
108
+ null);
109
+ }
110
+ }, [loadingMapsLocations]);
111
+ const setValidationObject = (validationObject) => {
112
+ _setValidationObject(validationObject);
113
+ onValidate?.(validationObject);
114
+ };
115
+ const getGoogleAddresses = (searchText, init) => {
116
+ if (init)
117
+ setLoadingMapsLocations(true);
118
+ googleMapsAutocompleteService.getPlacePredictions({
119
+ input: searchText,
120
+ componentRestrictions: { country: "us" },
121
+ types: ["address"],
122
+ language: "en",
123
+ }, (googleSuggestions) => {
124
+ setGoogleMapsPredictions(googleSuggestions);
125
+ if (init)
126
+ setLoadingMapsLocations(false);
127
+ });
128
+ };
129
+ return (_jsx(_Fragment, { children: isLoading ? (_jsx(Box, { sx: {
130
+ display: "flex",
131
+ justifyContent: "center",
132
+ alignItems: "center",
133
+ height: { xs: "100%", sm: "none" },
134
+ }, children: _jsx(CircularProgress, {}) })) : (_jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, children: [_jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", children: [_jsxs(FormControl, { required: true, sx: {
135
+ flex: "1 1 220px",
136
+ }, children: [_jsx(FormLabel, { children: t("Name") }), _jsx(Input, { fullWidth: true, error: !validationObject.name, onChange: (e) => {
137
+ setValidationObject({
138
+ ...validationObject,
139
+ name: e.target.value ? true : false,
140
+ });
141
+ setLocation({ ...location, name: e.target.value });
142
+ }, onBlur: (e) => {
143
+ if (location.id && data?.name !== e.target.value)
144
+ updateLocation({
145
+ id: location.id,
146
+ body: {
147
+ location: {
148
+ name: e.target.value,
149
+ },
150
+ },
151
+ });
152
+ }, size: "sm", value: location?.name ?? "", placeholder: t("Facility's name") })] }), _jsxs(FormControl, { required: true, sx: {
153
+ flex: "1 1 300px",
154
+ }, children: [_jsx(FormLabel, { children: "Address" }), _jsx(Autocomplete, { size: "sm", value: value, error: !validationObject.address, options: googleMapsPredictions || [], onInputChange: (_e, v) => {
155
+ getGoogleAddresses(v, false);
156
+ }, endDecorator: loadingMapsLocations ? (_jsx(CircularProgress, { sx: {
157
+ "--CircularProgress-size": "18px",
158
+ "--CircularProgress-trackThickness": "3px",
159
+ "--CircularProgress-progressThickness": "3px",
160
+ } })) : null, onChange: (_e, v) => {
161
+ setValue(v);
162
+ if (v && v.place_id !== location.place_id) {
163
+ googleMapsGeocoder.geocode({ placeId: v.place_id }, (result) => {
164
+ const place = result?.[0];
165
+ if (place) {
166
+ const address = addressFormGeocoder(place);
167
+ setLocation({
168
+ ...location,
169
+ ...address,
170
+ place_id: place.place_id,
171
+ });
172
+ if (location.id && place.place_id !== data?.place_id)
173
+ updateLocation({
174
+ id: location.id,
175
+ body: {
176
+ location: {
177
+ ...address,
178
+ place_id: place.place_id,
179
+ },
180
+ },
181
+ });
182
+ }
183
+ });
184
+ }
185
+ setValidationObject({
186
+ ...validationObject,
187
+ address: !v ? false : true,
188
+ });
189
+ }, getOptionLabel: (option) => `${option.structured_formatting.main_text}, ${option.structured_formatting.secondary_text}`, isOptionEqualToValue: (o, v) => o.place_id === v.place_id })] })] }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: 1, children: [_jsxs(FormControl, { sx: {
190
+ flex: "1.5 1 auto",
191
+ }, children: [_jsx(FormLabel, { children: "Line 1" }), _jsx(Input, { readOnly: true, size: "sm", value: location?.line1 ?? "", placeholder: t("Line 1") })] }), _jsxs(FormControl, { sx: {
192
+ flex: "1 1 auto",
193
+ }, children: [_jsx(FormLabel, { children: "#" }), _jsx(Input, { size: "sm", value: location?.line2 ?? "", onChange: (e) => {
194
+ setLocation({ ...location, line2: e.target.value });
195
+ }, onBlur: (e) => {
196
+ if (location.id && data?.line2 !== e.target.value)
197
+ updateLocation({
198
+ id: location.id,
199
+ body: {
200
+ location: {
201
+ line2: e.target.value,
202
+ },
203
+ },
204
+ });
205
+ } })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "City" }), _jsx(Input, { readOnly: true, size: "sm", value: location?.city ?? "", placeholder: t("City") })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "State" }), _jsx(Input, { sx: {
206
+ width: "45px",
207
+ }, readOnly: true, size: "sm", value: location?.state ?? "", placeholder: t("State") })] }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "ZIP" }), _jsx(Input, { sx: {
208
+ width: "70px",
209
+ }, readOnly: true, size: "sm", value: location?.zip ?? "", placeholder: t("ZIP") })] })] }), _jsx(Box, { flex: "1 1 100%", mt: 0.5, mb: 0.5, children: _jsx(Divider, {}) }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", children: [_jsxs(FormControl, { sx: {
210
+ flex: "1 1 auto",
211
+ }, children: [_jsx(FormLabel, { children: "Emails" }), _jsx(Input, { fullWidth: true, onChange: (e) => {
212
+ setLocation({ ...location, email_addresses: e.target.value });
213
+ }, onBlur: (e) => {
214
+ if (location.id && data?.email_addresses !== e.target.value)
215
+ updateLocation({
216
+ id: location.id,
217
+ body: {
218
+ location: {
219
+ email_addresses: e.target.value,
220
+ },
221
+ },
222
+ });
223
+ }, size: "sm", value: location?.email_addresses || "", placeholder: "one@email.com; two@email.com..." })] }), _jsxs(FormControl, { sx: {
224
+ flex: "1 1 auto",
225
+ }, children: [_jsx(FormLabel, { children: "Contact" }), _jsx(Input, { fullWidth: true, onChange: (e) => {
226
+ setLocation({ ...location, contact: e.target.value });
227
+ }, onBlur: (e) => {
228
+ if (location.id && data?.contact !== e.target.value)
229
+ updateLocation({
230
+ id: location.id,
231
+ body: {
232
+ location: {
233
+ contact: e.target.value,
234
+ },
235
+ },
236
+ });
237
+ }, size: "sm", value: location.contact || "", placeholder: "Contact" }), _jsx(FormHelperText, { sx: {
238
+ display: { xs: "none", lg: "initial" },
239
+ }, children: " " })] }), _jsx(NerdPhoneField, { value: location.phone, label: t("Phone"), inputProps: {
240
+ placeholder: t("Phone"),
241
+ size: "sm",
242
+ fullWidth: true,
243
+ error: !validationObject.phone,
244
+ }, onAccept: (value) => {
245
+ setValidationObject({
246
+ ...validationObject,
247
+ phone: true,
248
+ });
249
+ setLocation({ ...location, phone: value });
250
+ if (location.id && data?.phone !== value)
251
+ updateLocation({
252
+ id: location.id,
253
+ body: {
254
+ location: {
255
+ phone: value,
256
+ },
257
+ },
258
+ });
259
+ }, onError: () => {
260
+ setValidationObject({
261
+ ...validationObject,
262
+ phone: false,
263
+ });
264
+ } }), _jsxs(FormControl, { children: [_jsx(FormLabel, { children: "Ext" }), _jsx(Input, { value: location.ext_number || "", placeholder: "Ext", size: "sm", sx: {
265
+ width: 80,
266
+ }, onChange: (e) => {
267
+ setLocation({ ...location, ext_number: e.target.value });
268
+ }, onBlur: (e) => {
269
+ if (location.id && data?.ext_number !== e.target.value)
270
+ updateLocation({
271
+ id: location.id,
272
+ body: {
273
+ location: {
274
+ ext_number: e.target.value,
275
+ },
276
+ },
277
+ });
278
+ } })] })] }), _jsx(Box, { flex: "1 1 100%", mt: 0.5, mb: 0.5, children: _jsx(Divider, {}) }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", mb: 0.5, children: [_jsx(Checkbox, { label: "Need File", checked: location.needs_file || false, onChange: (e) => {
279
+ setLocation({ ...location, needs_file: e.target.checked });
280
+ if (location.id && data?.needs_file !== e.target.checked)
281
+ updateLocation({
282
+ id: location.id,
283
+ body: {
284
+ location: {
285
+ needs_file: e.target.checked,
286
+ },
287
+ },
288
+ });
289
+ }, sx: {
290
+ flex: "1 1 auto",
291
+ } }), _jsx(Checkbox, { label: "Need Liquor Permit", checked: location.needs_liquor_permit || false, onChange: (e) => {
292
+ setLocation({
293
+ ...location,
294
+ needs_liquor_permit: e.target.checked,
295
+ });
296
+ if (location.id &&
297
+ data?.needs_liquor_permit !== e.target.checked)
298
+ updateLocation({
299
+ id: location.id,
300
+ body: {
301
+ location: {
302
+ needs_liquor_permit: e.target.checked,
303
+ },
304
+ },
305
+ });
306
+ }, sx: {
307
+ flex: "1 1 auto",
308
+ } }), _jsx(Checkbox, { label: "First come first serve(FCFS)", checked: location.first_come_first_serve || false, onChange: (e) => {
309
+ setLocation({
310
+ ...location,
311
+ first_come_first_serve: e.target.checked,
312
+ });
313
+ if (location.id &&
314
+ data?.first_come_first_serve !== e.target.checked)
315
+ updateLocation({
316
+ id: location.id,
317
+ body: {
318
+ location: {
319
+ first_come_first_serve: e.target.checked,
320
+ },
321
+ },
322
+ });
323
+ }, sx: {
324
+ flex: "1 1 auto",
325
+ } }), _jsx(Checkbox, { label: "Strict Scheduling", checked: location.strict_scheduling || false, onChange: (e) => {
326
+ setLocation({
327
+ ...location,
328
+ strict_scheduling: e.target.checked,
329
+ });
330
+ if (location.id && data?.strict_scheduling !== e.target.checked)
331
+ updateLocation({
332
+ id: location.id,
333
+ body: {
334
+ location: {
335
+ strict_scheduling: e.target.checked,
336
+ },
337
+ },
338
+ });
339
+ }, sx: {
340
+ flex: "1 1 auto",
341
+ } })] }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", justifyContent: "space-between", children: [_jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, children: [_jsx(NerdDatePicker, { inputProps: {
342
+ size: "sm",
343
+ }, value: location.first_come_date
344
+ ? DateTime.fromISO(location.first_come_date)
345
+ : null, onChange: (newDate) => {
346
+ setLocation({
347
+ ...location,
348
+ first_come_date: newDate?.toISO() || "",
349
+ });
350
+ if (location.id &&
351
+ data?.first_come_date !== (newDate?.toISO() || ""))
352
+ updateLocation({
353
+ id: location.id,
354
+ body: {
355
+ location: {
356
+ first_come_date: newDate?.toISO() || "",
357
+ },
358
+ },
359
+ });
360
+ } }), _jsx(NerdTimePicker, { label: "FCFS IN", inputProps: {
361
+ sx: {
362
+ width: 100,
363
+ },
364
+ size: "sm",
365
+ slotProps: {
366
+ input: {
367
+ sx: {
368
+ p: 0.5,
369
+ },
370
+ },
371
+ },
372
+ }, value: location.first_come_in
373
+ ? DateTime.fromISO(location.first_come_in)
374
+ .toUTC()
375
+ .toFormat("HH:mm")
376
+ : null, onChange: (time) => {
377
+ if (!time.isValid) {
378
+ setValidationObject({
379
+ ...validationObject,
380
+ FCFSIN: false,
381
+ });
382
+ }
383
+ else {
384
+ setValidationObject({
385
+ ...validationObject,
386
+ FCFSIN: true,
387
+ });
388
+ const newTime = time.duration
389
+ ? DateTime.now()
390
+ .toUTC()
391
+ .set({
392
+ hour: time.duration.hours,
393
+ minute: time.duration.minutes,
394
+ second: 0,
395
+ })
396
+ .toISO() || ""
397
+ : "";
398
+ setLocation({ ...location, first_come_in: newTime });
399
+ if (location.id && data?.first_come_in !== newTime)
400
+ updateLocation({
401
+ id: location.id,
402
+ body: {
403
+ location: {
404
+ first_come_in: newTime,
405
+ },
406
+ },
407
+ });
408
+ }
409
+ } }), _jsx(NerdTimePicker, { label: "FCFS OUT", inputProps: {
410
+ sx: {
411
+ width: 100,
412
+ },
413
+ size: "sm",
414
+ slotProps: {
415
+ input: {
416
+ sx: {
417
+ p: 0.5,
418
+ },
419
+ },
420
+ },
421
+ }, value: location.first_come_out
422
+ ? DateTime.fromISO(location.first_come_out)
423
+ .toUTC()
424
+ .toFormat("HH:mm")
425
+ : null, onChange: (time) => {
426
+ if (!time.isValid) {
427
+ setValidationObject({
428
+ ...validationObject,
429
+ FCFSOUT: false,
430
+ });
431
+ }
432
+ else {
433
+ setValidationObject({
434
+ ...validationObject,
435
+ FCFSOUT: true,
436
+ });
437
+ const newTime = time.duration
438
+ ? DateTime.now()
439
+ .toUTC()
440
+ .set({
441
+ hour: time.duration.hours,
442
+ minute: time.duration.minutes,
443
+ second: 0,
444
+ })
445
+ .toISO() || ""
446
+ : "";
447
+ setLocation({ ...location, first_come_out: newTime });
448
+ if (location.id && data?.first_come_out !== newTime)
449
+ updateLocation({
450
+ id: location.id,
451
+ body: {
452
+ location: {
453
+ first_come_out: newTime,
454
+ },
455
+ },
456
+ });
457
+ }
458
+ } })] }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { children: "PSR Days" }), _jsxs(Select, { size: "sm", defaultValue: location.preschedule_days || 0, onChange: (_e, value) => {
459
+ setLocation({ ...location, preschedule_days: value || 0 });
460
+ if (location.id && data?.preschedule_days !== (value || 0))
461
+ updateLocation({
462
+ id: location.id,
463
+ body: {
464
+ location: {
465
+ preschedule_days: value || 0,
466
+ },
467
+ },
468
+ });
469
+ }, slotProps: {
470
+ listbox: {
471
+ sx: {
472
+ zIndex: (theme) => theme.zIndex.modal,
473
+ },
474
+ },
475
+ }, children: [_jsx(Option, { value: 0, children: "None" }, 0), [1, 2, 3, 4, 5].map((v) => (_jsx(Option, { value: v, children: v }, v))), _jsx(Option, { value: 14, children: "ASAP" }, 14)] })] }), _jsx(NerdTimePicker, { inputProps: {
476
+ sx: {
477
+ width: 100,
478
+ },
479
+ size: "sm",
480
+ }, label: "Open Time", value: location.time_from
481
+ ? DateTime.fromISO(location.time_from)
482
+ .toUTC()
483
+ .toFormat("HH:mm")
484
+ : null, onChange: (time) => {
485
+ if (!time.isValid) {
486
+ setValidationObject({
487
+ ...validationObject,
488
+ openTime: false,
489
+ });
490
+ }
491
+ else {
492
+ setValidationObject({
493
+ ...validationObject,
494
+ openTime: true,
495
+ });
496
+ const newTime = time.duration
497
+ ? DateTime.now()
498
+ .toUTC()
499
+ .set({
500
+ hour: time.duration.hours,
501
+ minute: time.duration.minutes,
502
+ second: 0,
503
+ })
504
+ .toISO() || ""
505
+ : "";
506
+ setLocation({ ...location, time_from: newTime });
507
+ if (location.id && data?.time_from !== newTime)
508
+ updateLocation({
509
+ id: location.id,
510
+ body: {
511
+ location: {
512
+ time_from: newTime,
513
+ },
514
+ },
515
+ });
516
+ }
517
+ } }), _jsx(NerdTimePicker, { inputProps: {
518
+ sx: {
519
+ width: 100,
520
+ },
521
+ size: "sm",
522
+ }, label: "Close Time", value: location.time_to
523
+ ? DateTime.fromISO(location.time_to)
524
+ .toUTC()
525
+ .toFormat("HH:mm")
526
+ : null, onChange: (time) => {
527
+ if (!time.isValid) {
528
+ setValidationObject({
529
+ ...validationObject,
530
+ closeTime: false,
531
+ });
532
+ }
533
+ else {
534
+ setValidationObject({
535
+ ...validationObject,
536
+ closeTime: true,
537
+ });
538
+ const newTime = time.duration
539
+ ? DateTime.now()
540
+ .toUTC()
541
+ .set({
542
+ hour: time.duration.hours,
543
+ minute: time.duration.minutes,
544
+ second: 0,
545
+ })
546
+ .toISO() || ""
547
+ : "";
548
+ setLocation({ ...location, time_to: newTime });
549
+ if (location.id && data?.time_to !== newTime)
550
+ updateLocation({
551
+ id: location.id,
552
+ body: {
553
+ location: {
554
+ time_to: newTime,
555
+ },
556
+ },
557
+ });
558
+ }
559
+ } })] })] }), _jsxs(FormControl, { sx: {
560
+ flex: 1,
561
+ }, children: [_jsx(FormLabel, { children: "TMS Link" }), _jsx(Input, { fullWidth: true, onChange: (e) => {
562
+ setLocation({ ...location, tms_link: e.target.value });
563
+ }, onBlur: (e) => {
564
+ if (location.id && data?.tms_link !== e.target.value)
565
+ updateLocation({
566
+ id: location.id,
567
+ body: {
568
+ location: {
569
+ tms_link: e.target.value,
570
+ },
571
+ },
572
+ });
573
+ }, size: "sm", value: location.tms_link || "", placeholder: "TMS Link", endDecorator: _jsx(Button, { variant: "soft", size: "sm", component: location.tms_link ? "a" : "button", href: location.tms_link
574
+ ? location.tms_link.match(/^https?:\/{2}/)
575
+ ? location.tms_link
576
+ : `//${location.tms_link}`
577
+ : "", startDecorator: _jsx("i", { className: "fa-solid fa-arrow-up-right-from-square" }), target: "_blank", rel: "noopener noreferrer", sx: {
578
+ mr: -1,
579
+ height: "100%",
580
+ textDecoration: "none!important",
581
+ }, children: "GO" }) })] }), _jsxs(FormControl, { sx: {
582
+ flex: 1,
583
+ }, children: [_jsx(FormLabel, { children: "Channel" }), _jsx(Select, { size: "sm", defaultValue: location.scheduling_channel, onChange: (_e, value) => {
584
+ setLocation({ ...location, scheduling_channel: value || "" });
585
+ if (location.id && data?.scheduling_channel !== (value || ""))
586
+ updateLocation({
587
+ id: location.id,
588
+ body: {
589
+ location: {
590
+ scheduling_channel: value || "",
591
+ },
592
+ },
593
+ });
594
+ }, slotProps: {
595
+ listbox: {
596
+ sx: {
597
+ zIndex: (theme) => theme.zIndex.modal,
598
+ },
599
+ },
600
+ }, children: [
601
+ { label: "None", value: "" },
602
+ { label: "Email", value: "email" },
603
+ { label: "Call", value: "call" },
604
+ { label: "Portal", value: "portal" },
605
+ { label: "Customer", value: "customer" },
606
+ ].map((v) => (_jsx(Option, { value: v.value, children: v.label }, v.value))) }), _jsx(FormHelperText, { children: " " })] }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", children: [_jsxs(FormControl, { sx: {
607
+ flex: 1,
608
+ }, children: [_jsx(FormLabel, { children: "Prev. Appts." }), _jsx(Textarea, { maxRows: 4, minRows: 4, onChange: (e) => {
609
+ setLocation({ ...location, prev_apts: e.target.value });
610
+ }, onBlur: (e) => {
611
+ if (location.id && data?.prev_apts !== e.target.value)
612
+ updateLocation({
613
+ id: location.id,
614
+ body: {
615
+ location: {
616
+ prev_apts: e.target.value,
617
+ },
618
+ },
619
+ });
620
+ }, size: "sm", value: location.prev_apts || "" })] }), _jsxs(FormControl, { sx: {
621
+ flex: 1,
622
+ }, children: [_jsx(FormLabel, { children: "Location Notes" }), _jsx(Textarea, { maxRows: 4, minRows: 4, onChange: (e) => {
623
+ setLocation({ ...location, notes: e.target.value });
624
+ }, onBlur: (e) => {
625
+ if (location.id && data?.notes !== e.target.value)
626
+ updateLocation({
627
+ id: location.id,
628
+ body: {
629
+ location: {
630
+ notes: e.target.value,
631
+ },
632
+ },
633
+ });
634
+ }, size: "sm", value: location.notes || "" })] })] }), _jsxs(Box, { display: "flex", flexWrap: "wrap", gap: 0.5, flex: "1 1 100%", children: [_jsxs(FormControl, { sx: {
635
+ flex: 1,
636
+ }, children: [_jsx(FormLabel, { children: "Location Scheduling Notes" }), _jsx(Textarea, { maxRows: 4, minRows: 4, onChange: (e) => {
637
+ setLocation({
638
+ ...location,
639
+ scheduling_notes: e.target.value,
640
+ });
641
+ }, onBlur: (e) => {
642
+ if (location.id && data?.scheduling_notes !== e.target.value)
643
+ updateLocation({
644
+ id: location.id,
645
+ body: {
646
+ location: {
647
+ scheduling_notes: e.target.value,
648
+ },
649
+ },
650
+ });
651
+ }, size: "sm", value: location.scheduling_notes || "" })] }), _jsxs(FormControl, { sx: {
652
+ flex: 1,
653
+ }, children: [_jsx(FormLabel, { children: "Driver Instructions" }), _jsx(Textarea, { maxRows: 4, minRows: 4, onChange: (e) => {
654
+ setLocation({
655
+ ...location,
656
+ driver_instructions: e.target.value,
657
+ });
658
+ }, onBlur: (e) => {
659
+ if (location.id &&
660
+ data?.driver_instructions !== e.target.value)
661
+ updateLocation({
662
+ id: location.id,
663
+ body: {
664
+ location: {
665
+ driver_instructions: e.target.value,
666
+ },
667
+ },
668
+ });
669
+ }, size: "sm", value: location.driver_instructions || "" })] })] })] })) }));
670
+ }
671
+ //# sourceMappingURL=locationFormSalesMain.js.map