@bjsdistribution/dms-client-return 0.1.22-prod → 0.1.23-prod
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/components/order-view/order-actions/actions/send-sms/SendSmsModal.d.ts +1 -0
- package/dist/components/store.d.ts +2 -1
- package/dist/dms-client-return.cjs.development.js +228 -83
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +229 -84
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/client-portal/DateFilterStore.ts +22 -5
- package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +14 -2
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +5 -3
- package/src/components/order-daily-overview/index.tsx +12 -5
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +48 -12
- package/src/components/order-view/order-actions/actions/send-sms/SendSmsModal.tsx +104 -51
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +6 -3
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +6 -3
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +9 -3
- package/src/components/store.ts +8 -1
- package/src/index.tsx +5 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useMemo, Suspense } from 'react';
|
|
2
2
|
import { useSearchParams, useNavigate, useParams, NavLink, useLocation, Routes, Route, Navigate } from 'react-router-dom';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Select, Spin, notification, Skeleton, Empty, DatePicker, Input as Input$3, Dropdown, Space } from 'antd';
|
|
4
|
+
import { Select, Spin, notification, Skeleton, Empty, DatePicker, Tooltip, Input as Input$3, Dropdown, Space } from 'antd';
|
|
5
5
|
import { useAtom, atom } from 'jotai';
|
|
6
6
|
import { format, isValid, parseISO } from 'date-fns';
|
|
7
7
|
import { atomWithReducer } from 'jotai/utils';
|
|
@@ -10,6 +10,7 @@ import dayjs from 'dayjs';
|
|
|
10
10
|
import { useReactTable, getCoreRowModel, getSortedRowModel, flexRender } from '@tanstack/react-table';
|
|
11
11
|
import Scrollbars from 'react-custom-scrollbars-2';
|
|
12
12
|
import { createPortal } from 'react-dom';
|
|
13
|
+
import TextArea$1 from 'antd/es/input/TextArea';
|
|
13
14
|
import 'tippy.js/dist/tippy.css';
|
|
14
15
|
import Tippy from '@tippyjs/react';
|
|
15
16
|
import 'react-datepicker/dist/react-datepicker.css';
|
|
@@ -554,10 +555,15 @@ function useSelectedData() {
|
|
|
554
555
|
function useNewReturnOrderData() {
|
|
555
556
|
return useAtom(newReturnOrderData);
|
|
556
557
|
}
|
|
558
|
+
//call
|
|
557
559
|
var isClientPortalAtom = /*#__PURE__*/atom(undefined);
|
|
558
560
|
function useClientPortal() {
|
|
559
561
|
return useAtom(isClientPortalAtom);
|
|
560
562
|
}
|
|
563
|
+
var isClientLoading = /*#__PURE__*/atom(true);
|
|
564
|
+
function useClientLoading() {
|
|
565
|
+
return useAtom(isClientLoading);
|
|
566
|
+
}
|
|
561
567
|
var activeCardIdAtom = /*#__PURE__*/atom(1);
|
|
562
568
|
var useActiveCardId = function useActiveCardId() {
|
|
563
569
|
return useAtom(activeCardIdAtom);
|
|
@@ -1198,6 +1204,8 @@ function SelectionFilter() {
|
|
|
1198
1204
|
var _useClientPortal = useClientPortal(),
|
|
1199
1205
|
clientPortal = _useClientPortal[0];
|
|
1200
1206
|
var navigate = useNavigate();
|
|
1207
|
+
var _useClientLoading = useClientLoading(),
|
|
1208
|
+
clientLoading = _useClientLoading[0];
|
|
1201
1209
|
//API for client data
|
|
1202
1210
|
var _useAxios = useAxios({
|
|
1203
1211
|
endpoint: "/v1/return/product/customers/",
|
|
@@ -1210,11 +1218,12 @@ function SelectionFilter() {
|
|
|
1210
1218
|
fetchedCustomerData = _useAxios.data,
|
|
1211
1219
|
loading = _useAxios.loading,
|
|
1212
1220
|
fetchData = _useAxios.fetchData;
|
|
1221
|
+
//need to fix
|
|
1213
1222
|
useEffect(function () {
|
|
1214
|
-
if (!clientPortal) {
|
|
1223
|
+
if (!clientPortal && !clientLoading) {
|
|
1215
1224
|
fetchData();
|
|
1216
1225
|
}
|
|
1217
|
-
}, []);
|
|
1226
|
+
}, [clientLoading]);
|
|
1218
1227
|
useEffect(function () {
|
|
1219
1228
|
if (fetchedCustomerData && fetchedCustomerData != null && fetchedCustomerData.data) {
|
|
1220
1229
|
setCustomers(fetchedCustomerData == null ? void 0 : fetchedCustomerData.data);
|
|
@@ -1521,19 +1530,33 @@ var overviewFilterReducer = function overviewFilterReducer(state, action) {
|
|
|
1521
1530
|
startDate = _action$payload.startDate,
|
|
1522
1531
|
endDate = _action$payload.endDate;
|
|
1523
1532
|
var filters = [];
|
|
1524
|
-
if (startDate) {
|
|
1533
|
+
if (startDate && !endDate) {
|
|
1534
|
+
var nextDay = dayjs(startDate).add(1, 'day').format('YYYY-MM-DD');
|
|
1525
1535
|
filters.push({
|
|
1526
1536
|
field: 'created_at',
|
|
1527
1537
|
op: '>=',
|
|
1528
1538
|
value: startDate + "T00:00:00+00:00"
|
|
1529
1539
|
});
|
|
1530
|
-
}
|
|
1531
|
-
if (endDate) {
|
|
1532
1540
|
filters.push({
|
|
1533
1541
|
field: 'created_at',
|
|
1534
1542
|
op: '<=',
|
|
1535
|
-
value:
|
|
1543
|
+
value: nextDay + "T00:00:00+00:00"
|
|
1536
1544
|
});
|
|
1545
|
+
} else {
|
|
1546
|
+
if (startDate) {
|
|
1547
|
+
filters.push({
|
|
1548
|
+
field: 'created_at',
|
|
1549
|
+
op: '>=',
|
|
1550
|
+
value: startDate + "T00:00:00+00:00"
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
if (endDate) {
|
|
1554
|
+
filters.push({
|
|
1555
|
+
field: 'created_at',
|
|
1556
|
+
op: '<=',
|
|
1557
|
+
value: endDate + "T23:59:59+00:00"
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1537
1560
|
}
|
|
1538
1561
|
return _extends({}, state, {
|
|
1539
1562
|
'x-filters': [].concat(state['x-filters'].filter(function (f) {
|
|
@@ -4989,12 +5012,15 @@ function ContactHome() {
|
|
|
4989
5012
|
hrefPrefix = '+44';
|
|
4990
5013
|
}
|
|
4991
5014
|
var finalHref = "tel:" + hrefPrefix + numberPart;
|
|
4992
|
-
return React.createElement(
|
|
5015
|
+
return React.createElement(Tooltip, {
|
|
5016
|
+
placement: "top",
|
|
5017
|
+
title: React.createElement("span", null, "Zoom")
|
|
5018
|
+
}, React.createElement("a", {
|
|
4993
5019
|
href: finalHref,
|
|
4994
5020
|
style: {
|
|
4995
5021
|
cursor: 'pointer'
|
|
4996
5022
|
}
|
|
4997
|
-
}, React.createElement(CallCustomer, null));
|
|
5023
|
+
}, React.createElement(CallCustomer, null)));
|
|
4998
5024
|
}()), errors.homeContactError && React.createElement(ErrorText$1, null, errors.homeContactError));
|
|
4999
5025
|
}
|
|
5000
5026
|
var InputContainer = /*#__PURE__*/styled.div(_templateObject$q || (_templateObject$q = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n align-items: center;\n"])));
|
|
@@ -5012,6 +5038,8 @@ function ContactWork() {
|
|
|
5012
5038
|
var _useOrderDetails = useOrderDetails(),
|
|
5013
5039
|
orderDetails = _useOrderDetails[0],
|
|
5014
5040
|
setOrderDetails = _useOrderDetails[1];
|
|
5041
|
+
var _useClientPortal = useClientPortal(),
|
|
5042
|
+
isClientPortal = _useClientPortal[0];
|
|
5015
5043
|
var orderRecipient = orderDetails == null ? void 0 : orderDetails.order_recipient;
|
|
5016
5044
|
var _usePrevOrderDetails = usePrevOrderDetails(),
|
|
5017
5045
|
prevOrderDetails = _usePrevOrderDetails[0];
|
|
@@ -5067,7 +5095,10 @@ function ContactWork() {
|
|
|
5067
5095
|
placeholder: "Work Number",
|
|
5068
5096
|
onKeyDown: handleKeyDown,
|
|
5069
5097
|
value: (orderRecipient == null ? void 0 : orderRecipient.contact_work) || '',
|
|
5070
|
-
onChange: onChange
|
|
5098
|
+
onChange: onChange,
|
|
5099
|
+
// minLength={10}
|
|
5100
|
+
// maxLength={10}
|
|
5101
|
+
disabled: isClientPortal
|
|
5071
5102
|
}), apiContactWork && function () {
|
|
5072
5103
|
var rawNumber = apiContactWork.replace(/\s+/g, '');
|
|
5073
5104
|
var formattedNumber = rawNumber.replace(/\D/g, '');
|
|
@@ -5103,12 +5134,15 @@ function ContactWork() {
|
|
|
5103
5134
|
hrefPrefix = '+44';
|
|
5104
5135
|
}
|
|
5105
5136
|
var finalHref = "tel:" + hrefPrefix + numberPart;
|
|
5106
|
-
return React.createElement(
|
|
5137
|
+
return React.createElement(Tooltip, {
|
|
5138
|
+
placement: "top",
|
|
5139
|
+
title: React.createElement("span", null, "Zoom")
|
|
5140
|
+
}, React.createElement("a", {
|
|
5107
5141
|
href: finalHref,
|
|
5108
5142
|
style: {
|
|
5109
5143
|
cursor: 'pointer'
|
|
5110
5144
|
}
|
|
5111
|
-
}, React.createElement(CallCustomer, null));
|
|
5145
|
+
}, React.createElement(CallCustomer, null)));
|
|
5112
5146
|
}()), errors.workCOntanctError && React.createElement(ErrorText$2, null, errors.workCOntanctError));
|
|
5113
5147
|
}
|
|
5114
5148
|
var InputContainer$1 = /*#__PURE__*/styled.div(_templateObject$r || (_templateObject$r = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n align-items: center;\n"])));
|
|
@@ -5225,12 +5259,15 @@ function ContactMobile() {
|
|
|
5225
5259
|
hrefPrefix = '+44';
|
|
5226
5260
|
}
|
|
5227
5261
|
var finalHref = "tel:" + hrefPrefix + numberPart;
|
|
5228
|
-
return React.createElement(
|
|
5262
|
+
return React.createElement(Tooltip, {
|
|
5263
|
+
placement: "top",
|
|
5264
|
+
title: React.createElement("span", null, "Zoom")
|
|
5265
|
+
}, React.createElement("a", {
|
|
5229
5266
|
href: finalHref,
|
|
5230
5267
|
style: {
|
|
5231
5268
|
cursor: 'pointer'
|
|
5232
5269
|
}
|
|
5233
|
-
}, React.createElement(CallCustomer, null));
|
|
5270
|
+
}, React.createElement(CallCustomer, null)));
|
|
5234
5271
|
}()), errors.mobileError && React.createElement(ErrorText$3, null, errors.mobileError));
|
|
5235
5272
|
}
|
|
5236
5273
|
var InputContainer$2 = /*#__PURE__*/styled.div(_templateObject$s || (_templateObject$s = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 7px;\n align-items: center;\n"])));
|
|
@@ -9880,22 +9917,20 @@ var HoldDatePickerWrap = /*#__PURE__*/styled.div(_templateObject18$1 || (_templa
|
|
|
9880
9917
|
var DatePickerWrap = /*#__PURE__*/styled.div(_templateObject19$1 || (_templateObject19$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n\n border-radius: 66px;\n border: 1px solid #e0e2e7;\n box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);\n\n input[type='text'] {\n border-radius: 20px;\n background: #fff;\n border: none;\n color: #6a7378;\n font-size: 14px;\n font-weight: 400;\n line-height: 18px;\n padding: 10px 0;\n padding-left: 33px;\n min-width: 18vw;\n &:focus-visible {\n outline: none;\n }\n }\n svg {\n position: absolute;\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n }\n .react-datepicker-wrapper {\n background-color: white;\n border-radius: 66px;\n }\n .ant-picker-outlined {\n border-style: none;\n border-radius: 66px;\n outline: none;\n width: 100%;\n }\n"])));
|
|
9881
9918
|
|
|
9882
9919
|
var _templateObject$1F, _templateObject2$1h;
|
|
9883
|
-
var CustomTextArea$3 = /*#__PURE__*/styled(TextArea)(_templateObject$1F || (_templateObject$1F = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 700px;\n height: 140px;\n resize: none;\n"])));
|
|
9884
|
-
var ErrorText$9 = /*#__PURE__*/styled.div(_templateObject2$1h || (_templateObject2$1h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: red;\n font-size: 12px;\n margin-top: 4px;\n"])));
|
|
9885
9920
|
function SendSmsModal() {
|
|
9886
|
-
var _orderDetails$order_r, _formData$to$trim;
|
|
9921
|
+
var _orderDetails$order_r, _orderDetails$order_r2, _orderDetails$order_r3, _formData$to$trim;
|
|
9887
9922
|
var _useCurrentAction = useCurrentAction(),
|
|
9888
9923
|
setCurrentAction = _useCurrentAction[1];
|
|
9889
9924
|
var _useOrderDetails = useOrderDetails(),
|
|
9890
9925
|
orderDetails = _useOrderDetails[0];
|
|
9891
9926
|
var _useOrderId = useOrderId(),
|
|
9892
9927
|
orderId = _useOrderId[0];
|
|
9893
|
-
var
|
|
9928
|
+
var VALID_UK_MOBILE_REGEX = /^(07\d{8,12}|447\d{7,11})$/;
|
|
9894
9929
|
var _useState = useState(''),
|
|
9895
9930
|
toError = _useState[0],
|
|
9896
9931
|
setToError = _useState[1];
|
|
9897
9932
|
var _useState2 = useState({
|
|
9898
|
-
to:
|
|
9933
|
+
to: [orderDetails == null || (_orderDetails$order_r = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r.contact_mobile, orderDetails == null || (_orderDetails$order_r2 = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r2.contact_home, orderDetails == null || (_orderDetails$order_r3 = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r3.contact_work].filter(Boolean).join(', '),
|
|
9899
9934
|
body: ''
|
|
9900
9935
|
}),
|
|
9901
9936
|
formData = _useState2[0],
|
|
@@ -9911,17 +9946,21 @@ function SendSmsModal() {
|
|
|
9911
9946
|
name = _e$target.name,
|
|
9912
9947
|
value = _e$target.value;
|
|
9913
9948
|
if (name === 'to') {
|
|
9914
|
-
var
|
|
9915
|
-
var
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9949
|
+
var rawValue = value;
|
|
9950
|
+
var numbers = rawValue.split(',').map(function (num) {
|
|
9951
|
+
return num.trim();
|
|
9952
|
+
});
|
|
9953
|
+
var invalids = numbers.filter(function (num) {
|
|
9954
|
+
return !VALID_UK_MOBILE_REGEX.test(num);
|
|
9955
|
+
});
|
|
9956
|
+
if (invalids.length === numbers.length) {
|
|
9957
|
+
setToError('Enter at least one valid UK mobile number.');
|
|
9958
|
+
} else {
|
|
9959
|
+
setToError('');
|
|
9920
9960
|
}
|
|
9921
|
-
setToError(error);
|
|
9922
9961
|
setFormData(function (prev) {
|
|
9923
9962
|
return _extends({}, prev, {
|
|
9924
|
-
to:
|
|
9963
|
+
to: rawValue
|
|
9925
9964
|
});
|
|
9926
9965
|
});
|
|
9927
9966
|
} else {
|
|
@@ -9933,50 +9972,86 @@ function SendSmsModal() {
|
|
|
9933
9972
|
};
|
|
9934
9973
|
var handleSubmit = /*#__PURE__*/function () {
|
|
9935
9974
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9936
|
-
var _formData$
|
|
9937
|
-
var
|
|
9975
|
+
var _formData$body;
|
|
9976
|
+
var trimmedBody, rawContacts, validContacts, _iterator, _step, number, payload, response, _err$response, _err$response2, err, errMsg;
|
|
9938
9977
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9939
9978
|
while (1) switch (_context.prev = _context.next) {
|
|
9940
9979
|
case 0:
|
|
9941
|
-
trimmedTo = formData == null || (_formData$to = formData.to) == null ? void 0 : _formData$to.trim();
|
|
9942
9980
|
trimmedBody = formData == null || (_formData$body = formData.body) == null ? void 0 : _formData$body.trim();
|
|
9943
|
-
if (
|
|
9944
|
-
_context.next =
|
|
9981
|
+
if (trimmedBody) {
|
|
9982
|
+
_context.next = 3;
|
|
9945
9983
|
break;
|
|
9946
9984
|
}
|
|
9947
|
-
setToError('Phone number must be exactly 10 digits');
|
|
9948
9985
|
return _context.abrupt("return");
|
|
9949
|
-
case
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
};
|
|
9956
|
-
if (!(
|
|
9986
|
+
case 3:
|
|
9987
|
+
rawContacts = formData.to.split(',').map(function (num) {
|
|
9988
|
+
return num.trim();
|
|
9989
|
+
});
|
|
9990
|
+
validContacts = rawContacts.filter(function (num) {
|
|
9991
|
+
return VALID_UK_MOBILE_REGEX.test(num);
|
|
9992
|
+
});
|
|
9993
|
+
if (!(validContacts.length === 0)) {
|
|
9957
9994
|
_context.next = 8;
|
|
9958
9995
|
break;
|
|
9959
9996
|
}
|
|
9997
|
+
notification.warning({
|
|
9998
|
+
message: 'No Valid UK Mobile Numbers',
|
|
9999
|
+
description: 'Please provide at least one valid UK mobile number (e.g., 07123...).'
|
|
10000
|
+
});
|
|
9960
10001
|
return _context.abrupt("return");
|
|
9961
10002
|
case 8:
|
|
9962
10003
|
_context.prev = 8;
|
|
9963
|
-
|
|
10004
|
+
_iterator = _createForOfIteratorHelperLoose(validContacts);
|
|
10005
|
+
case 10:
|
|
10006
|
+
if ((_step = _iterator()).done) {
|
|
10007
|
+
_context.next = 19;
|
|
10008
|
+
break;
|
|
10009
|
+
}
|
|
10010
|
+
number = _step.value;
|
|
10011
|
+
payload = {
|
|
10012
|
+
order_id: +orderId,
|
|
10013
|
+
receiver: number,
|
|
10014
|
+
message: trimmedBody,
|
|
10015
|
+
notification_type: 'Send SMS'
|
|
10016
|
+
};
|
|
10017
|
+
_context.next = 15;
|
|
9964
10018
|
return callSendSms({
|
|
9965
10019
|
payload: payload
|
|
9966
10020
|
});
|
|
9967
|
-
case
|
|
10021
|
+
case 15:
|
|
10022
|
+
response = _context.sent;
|
|
10023
|
+
if (response.code === 200) {
|
|
10024
|
+
notification.success({
|
|
10025
|
+
message: 'SMS Sent',
|
|
10026
|
+
description: "Message sent to " + number
|
|
10027
|
+
});
|
|
10028
|
+
} else {
|
|
10029
|
+
notification.error({
|
|
10030
|
+
message: 'SMS Failed',
|
|
10031
|
+
description: "Failed to send to " + number + ": " + ((response == null ? void 0 : response.error) || 'Unknown error')
|
|
10032
|
+
});
|
|
10033
|
+
}
|
|
10034
|
+
case 17:
|
|
10035
|
+
_context.next = 10;
|
|
10036
|
+
break;
|
|
10037
|
+
case 19:
|
|
9968
10038
|
closeModal();
|
|
9969
|
-
_context.next =
|
|
10039
|
+
_context.next = 27;
|
|
9970
10040
|
break;
|
|
9971
|
-
case
|
|
9972
|
-
_context.prev =
|
|
10041
|
+
case 22:
|
|
10042
|
+
_context.prev = 22;
|
|
9973
10043
|
_context.t0 = _context["catch"](8);
|
|
9974
|
-
|
|
9975
|
-
|
|
10044
|
+
err = _context.t0;
|
|
10045
|
+
errMsg = (err == null || (_err$response = err.response) == null || (_err$response = _err$response.data) == null ? void 0 : _err$response.error) || (err == null || (_err$response2 = err.response) == null || (_err$response2 = _err$response2.data) == null ? void 0 : _err$response2.message) || (err == null ? void 0 : err.message) || 'An unexpected error occurred.';
|
|
10046
|
+
notification.error({
|
|
10047
|
+
message: 'Request Failed',
|
|
10048
|
+
description: errMsg
|
|
10049
|
+
});
|
|
10050
|
+
case 27:
|
|
9976
10051
|
case "end":
|
|
9977
10052
|
return _context.stop();
|
|
9978
10053
|
}
|
|
9979
|
-
}, _callee, null, [[8,
|
|
10054
|
+
}, _callee, null, [[8, 22]]);
|
|
9980
10055
|
}));
|
|
9981
10056
|
return function handleSubmit() {
|
|
9982
10057
|
return _ref.apply(this, arguments);
|
|
@@ -9985,29 +10060,45 @@ function SendSmsModal() {
|
|
|
9985
10060
|
var closeModal = function closeModal() {
|
|
9986
10061
|
setCurrentAction(undefined);
|
|
9987
10062
|
};
|
|
9988
|
-
var isFormValid = (formData == null || (_formData$to$trim = formData.to.trim()) == null ? void 0 : _formData$to$trim.length)
|
|
10063
|
+
var isFormValid = (formData == null || (_formData$to$trim = formData.to.trim()) == null ? void 0 : _formData$to$trim.length) > 0 && !toError && (formData == null ? void 0 : formData.body.trim().length) > 0;
|
|
9989
10064
|
return React.createElement(OrderActionModal, {
|
|
9990
10065
|
headerTitle: "Send SMS",
|
|
9991
10066
|
onCloseHeader: closeModal,
|
|
9992
10067
|
onSubmit: handleSubmit,
|
|
9993
10068
|
submitBtnTitle: loading ? 'Sending...' : 'Send SMS',
|
|
9994
10069
|
isSubmitDisabled: !isFormValid || loading
|
|
9995
|
-
}, React.createElement(ContentContainer$
|
|
10070
|
+
}, React.createElement(ContentContainer$5, null, React.createElement(Label$c, null, "To"), React.createElement(StyledInput, {
|
|
9996
10071
|
type: "text",
|
|
9997
10072
|
name: "to",
|
|
9998
10073
|
value: formData.to,
|
|
9999
10074
|
onChange: handleInputChange,
|
|
10000
10075
|
required: true,
|
|
10001
|
-
placeholder: "Enter the number"
|
|
10002
|
-
|
|
10003
|
-
|
|
10076
|
+
placeholder: "Enter the number"
|
|
10077
|
+
}), toError && React.createElement(ErrorText$9, null, toError), React.createElement(Label$c, null, "Body"), React.createElement(TextArea$1, {
|
|
10078
|
+
style: {
|
|
10079
|
+
width: '700px',
|
|
10080
|
+
height: '140px',
|
|
10081
|
+
resize: 'none'
|
|
10082
|
+
},
|
|
10004
10083
|
name: "body",
|
|
10005
10084
|
value: formData.body,
|
|
10006
10085
|
onChange: handleInputChange,
|
|
10007
10086
|
required: true,
|
|
10008
|
-
placeholder: "Write here..."
|
|
10087
|
+
placeholder: "Write here...",
|
|
10088
|
+
maxLength: 500,
|
|
10089
|
+
count: {
|
|
10090
|
+
show: true,
|
|
10091
|
+
max: 500
|
|
10092
|
+
}
|
|
10009
10093
|
})));
|
|
10010
10094
|
}
|
|
10095
|
+
var ContentContainer$5 = /*#__PURE__*/styled.div(_templateObject$1F || (_templateObject$1F = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 20px;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 15px;\n flex: 1 0 0;\n border-radius: 15px;\n"])));
|
|
10096
|
+
// const CustomTextArea = styled(TextArea)`
|
|
10097
|
+
// width: 700px;
|
|
10098
|
+
// height: 140px;
|
|
10099
|
+
// resize: none;
|
|
10100
|
+
// `;
|
|
10101
|
+
var ErrorText$9 = /*#__PURE__*/styled.div(_templateObject2$1h || (_templateObject2$1h = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: red;\n font-size: 12px;\n margin-top: 4px;\n"])));
|
|
10011
10102
|
|
|
10012
10103
|
function SendEmailModal() {
|
|
10013
10104
|
var _orderDetails$order_r;
|
|
@@ -12146,7 +12237,7 @@ function UncancelOrder(props) {
|
|
|
12146
12237
|
display: 'flex',
|
|
12147
12238
|
flexDirection: 'row'
|
|
12148
12239
|
}
|
|
12149
|
-
}, React.createElement(Label$c, null, "Un-cancel Note"), ' ', React.createElement(RequiredAsterisk$3, null, "*")), React.createElement(CustomTextArea$
|
|
12240
|
+
}, React.createElement(Label$c, null, "Un-cancel Note"), ' ', React.createElement(RequiredAsterisk$3, null, "*")), React.createElement(CustomTextArea$3, {
|
|
12150
12241
|
rows: 5,
|
|
12151
12242
|
onChange: onChange
|
|
12152
12243
|
}))), React.createElement(UnCancelOrderTable, null)));
|
|
@@ -12154,7 +12245,7 @@ function UncancelOrder(props) {
|
|
|
12154
12245
|
var RequiredAsterisk$3 = /*#__PURE__*/styled.span(_templateObject$1U || (_templateObject$1U = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: red;\n margin-left: 2px;\n font-size: x-small;\n"])));
|
|
12155
12246
|
var Container$14 = /*#__PURE__*/styled.div(_templateObject2$1t || (_templateObject2$1t = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n padding: 15px;\n gap: 30px;\n border-radius: 16px;\n border: 1px solid#edebe8;\n background: #f8fafc;\n\n .uncancelReasonDropdown {\n flex: 1;\n }\n"])));
|
|
12156
12247
|
var MainContainer$8 = /*#__PURE__*/styled.div(_templateObject3$Q || (_templateObject3$Q = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n padding: 20px;\n gap: 10px;\n"])));
|
|
12157
|
-
var CustomTextArea$
|
|
12248
|
+
var CustomTextArea$3 = /*#__PURE__*/styled(TextArea)(_templateObject4$t || (_templateObject4$t = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 346px;\n"])));
|
|
12158
12249
|
|
|
12159
12250
|
var _templateObject$1V;
|
|
12160
12251
|
function RemoveFromRoute(props) {
|
|
@@ -12244,7 +12335,7 @@ var Wrapper$i = /*#__PURE__*/styled.div(_templateObject$1W || (_templateObject$1
|
|
|
12244
12335
|
var SplitContainer = /*#__PURE__*/styled.div(_templateObject3$R || (_templateObject3$R = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* width: 95%; */\n min-width: 25vw;\n display: flex;\n flex-direction: column;\n gap: 10px;\n"])));
|
|
12245
12336
|
var StyledAntSelect$7 = /*#__PURE__*/styled(Select)(_templateObject4$u || (_templateObject4$u = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n .ant-select-selector {\n /* width: 22vw; */\n border-radius: 22px;\n }\n"])));
|
|
12246
12337
|
var Label$d = /*#__PURE__*/styled.label(_templateObject5$k || (_templateObject5$k = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #6a7378;\n font-family: 'Lato', sans-serif;\n font-size: 14px;\n font-weight: 500;\n"])));
|
|
12247
|
-
var ContentContainer$
|
|
12338
|
+
var ContentContainer$6 = /*#__PURE__*/styled.div(_templateObject7$a || (_templateObject7$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 12px 12px;\n margin: 5px 14px;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 15px;\n background: #f8fafc;\n border-radius: 15px;\n"])));
|
|
12248
12339
|
var Row$6 = /*#__PURE__*/styled.div(_templateObject8$8 || (_templateObject8$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 10px;\n"])));
|
|
12249
12340
|
var DoubleDropdownContainer = /*#__PURE__*/styled.div(_templateObject9$7 || (_templateObject9$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 10px;\n width: 100%;\n"])));
|
|
12250
12341
|
var FormRow = function FormRow(_ref) {
|
|
@@ -12878,7 +12969,7 @@ function ReminderModal(props) {
|
|
|
12878
12969
|
submitBtnTitle: 'Save Reminder',
|
|
12879
12970
|
isSubmitDisabled: isSubmitDisabled(),
|
|
12880
12971
|
footerActions: ''
|
|
12881
|
-
}, React.createElement(ContentContainer$
|
|
12972
|
+
}, React.createElement(ContentContainer$6, null, React.createElement(CreateReminderModal, null))));
|
|
12882
12973
|
}
|
|
12883
12974
|
var OrderModal = /*#__PURE__*/styled(OrderActionModal)(_templateObject$1_ || (_templateObject$1_ = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 70%;\n"])));
|
|
12884
12975
|
|
|
@@ -15165,7 +15256,7 @@ function ForceDebriefModal(props) {
|
|
|
15165
15256
|
headerActions: React.createElement(ForceDebriefSelector, {
|
|
15166
15257
|
onSwitchChange: handleSwitchChange
|
|
15167
15258
|
})
|
|
15168
|
-
}, React.createElement(MainContainer$b, null, React.createElement(FDNotification, null), React.createElement(ContentContainer$
|
|
15259
|
+
}, React.createElement(MainContainer$b, null, React.createElement(FDNotification, null), React.createElement(ContentContainer$7, null, React.createElement(OrderInfo$1, null)), React.createElement(ContentContainer$7, null, React.createElement(Container$1h, null, React.createElement(Label$j, {
|
|
15169
15260
|
label: "Delivery Instructions",
|
|
15170
15261
|
htmlFor: "deliveryInstruction"
|
|
15171
15262
|
}), React.createElement(Text$c, null, (orderDetails == null ? void 0 : orderDetails.delivery_instructions) || 'N/A')), React.createElement(Container$1h, null, React.createElement(Label$j, {
|
|
@@ -15176,7 +15267,7 @@ function ForceDebriefModal(props) {
|
|
|
15176
15267
|
return React.createElement(ProductContainer, {
|
|
15177
15268
|
key: index
|
|
15178
15269
|
}, React.createElement(Status$1, null, '*'), React.createElement(Status$1, null, (item == null ? void 0 : item.status_value) || 'N/A'), React.createElement(Status$1, null, (item == null || (_item$order_product_t = item.order_product_type) == null ? void 0 : _item$order_product_t.type) || 'N/A'), React.createElement(Status$1, null, (item == null ? void 0 : item.sku) || 'N/A'), React.createElement(Status$1, null, "Part 1 of 1"), React.createElement(Status$1, null, 'Weight' + ':' + (item == null ? void 0 : item.weight) || 'N/A'), React.createElement(Status$1, null, 'Cube' + ':' + (item == null ? void 0 : item.cube) || 'N/A'));
|
|
15179
|
-
}))), React.createElement(ContentContainer$
|
|
15270
|
+
}))), React.createElement(ContentContainer$7, null, React.createElement(ContainerInner, null, React.createElement(BaseCharges, {
|
|
15180
15271
|
inputValue: inputValue,
|
|
15181
15272
|
setInputValue: setInputValue,
|
|
15182
15273
|
staticData: staticData
|
|
@@ -15192,7 +15283,7 @@ function ForceDebriefModal(props) {
|
|
|
15192
15283
|
})), React.createElement(OrderCharges, {
|
|
15193
15284
|
inputValue: inputValue,
|
|
15194
15285
|
setInputValue: setInputValue
|
|
15195
|
-
}), React.createElement(AdhocSection, null)), activeTab === 'failure' && React.createElement(ContentContainer$
|
|
15286
|
+
}), React.createElement(AdhocSection, null)), activeTab === 'failure' && React.createElement(ContentContainer$7, {
|
|
15196
15287
|
style: {
|
|
15197
15288
|
flexDirection: 'column',
|
|
15198
15289
|
gap: '10px'
|
|
@@ -15218,7 +15309,7 @@ var MainContainer$b = /*#__PURE__*/styled.div(_templateObject3$12 || (_templateO
|
|
|
15218
15309
|
var ContainerInner = /*#__PURE__*/styled.div(_templateObject4$C || (_templateObject4$C = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 16px;\n"])));
|
|
15219
15310
|
var Container$1h = /*#__PURE__*/styled.div(_templateObject5$s || (_templateObject5$s = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
|
|
15220
15311
|
var Text$c = /*#__PURE__*/styled.div(_templateObject6$e || (_templateObject6$e = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #363a30;\n font-size: 14px;\n white-space: break-spaces;\n"])));
|
|
15221
|
-
var ContentContainer$
|
|
15312
|
+
var ContentContainer$7 = /*#__PURE__*/styled.div(_templateObject7$f || (_templateObject7$f = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 12px;\n flex-direction: row;\n align-items: flex-start;\n gap: 40px;\n flex: 1 0 0;\n border-radius: 15px;\n background: #f8fafc;\n width: 100%;\n white-space: nowrap;\n"])));
|
|
15222
15313
|
var ProductDiv = /*#__PURE__*/styled.div(_templateObject8$b || (_templateObject8$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n padding: 12px;\n flex-direction: row;\n align-items: flex-start;\n gap: 40px;\n flex: 1 0 0;\n border-radius: 15px;\n background: #f8fafc;\n width: 100%;\n white-space: nowrap;\n min-height: 60px;\n overflow: scroll;\n max-height: 150px;\n"])));
|
|
15223
15314
|
var ForceDebriefModal$1 = /*#__PURE__*/React.memo(ForceDebriefModal);
|
|
15224
15315
|
|
|
@@ -15835,29 +15926,65 @@ var StyledSpace$2 = /*#__PURE__*/styled(Space)(_templateObject$2q || (_templateO
|
|
|
15835
15926
|
var _templateObject$2r, _templateObject2$1N;
|
|
15836
15927
|
// components
|
|
15837
15928
|
function DropDowns$1() {
|
|
15838
|
-
var _orderDetails$order_r, _orderDetails$order_r2;
|
|
15929
|
+
var _orderDetails$order_r, _orderDetails$order_r2, _orderDetails$order_r3, _orderDetails$order_r4;
|
|
15839
15930
|
var _useOrderDetails = useOrderDetails(),
|
|
15840
15931
|
orderDetails = _useOrderDetails[0];
|
|
15841
15932
|
var _useCurrentAction = useCurrentAction(),
|
|
15842
15933
|
setCurrentAction = _useCurrentAction[1];
|
|
15934
|
+
var _useAtom = useAtom(errorAtom),
|
|
15935
|
+
errors = _useAtom[0];
|
|
15936
|
+
var _useState = useState(false),
|
|
15937
|
+
hasNotifiedMobile = _useState[0],
|
|
15938
|
+
setHasNotifiedMobile = _useState[1];
|
|
15939
|
+
var _useState2 = useState(false),
|
|
15940
|
+
hasNotifiedEmail = _useState2[0],
|
|
15941
|
+
setHasNotifiedEmail = _useState2[1];
|
|
15843
15942
|
var isEmailId = orderDetails == null || (_orderDetails$order_r = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r.contact_email;
|
|
15844
|
-
|
|
15943
|
+
// const isContactNum = orderDetails?.order_recipient?.contact_home;
|
|
15944
|
+
var VALID_UK_MOBILE_REGEX = /^(07\d{8,12}|447\d{7,11})$/;
|
|
15945
|
+
var VALID_IRISH_MOBILE_REGEX = /^(08[35679]\d{7}|3538[35679]\d{7}|\+3538[35679]\d{7})$/;
|
|
15946
|
+
var isValidUKMobile = function isValidUKMobile(number) {
|
|
15947
|
+
return typeof number === 'string' && VALID_UK_MOBILE_REGEX.test(number);
|
|
15948
|
+
};
|
|
15949
|
+
var isValidIrishMobile = function isValidIrishMobile(number) {
|
|
15950
|
+
return typeof number === 'string' && VALID_IRISH_MOBILE_REGEX.test(number);
|
|
15951
|
+
};
|
|
15952
|
+
var isValidMobile = function isValidMobile(number) {
|
|
15953
|
+
return isValidUKMobile(number) || isValidIrishMobile(number);
|
|
15954
|
+
};
|
|
15955
|
+
var contactMobile = orderDetails == null || (_orderDetails$order_r2 = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r2.contact_mobile;
|
|
15956
|
+
var contactHome = orderDetails == null || (_orderDetails$order_r3 = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r3.contact_home;
|
|
15957
|
+
var contactWork = orderDetails == null || (_orderDetails$order_r4 = orderDetails.order_recipient) == null ? void 0 : _orderDetails$order_r4.contact_work;
|
|
15958
|
+
var allContacts = [contactMobile, contactHome, contactWork];
|
|
15959
|
+
var hasValidMobile = allContacts.some(isValidMobile);
|
|
15845
15960
|
var actions = [];
|
|
15846
|
-
if (
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
return setCurrentAction('send-sms');
|
|
15961
|
+
if (hasValidMobile) {
|
|
15962
|
+
if (errors != null && errors.mobileError) {
|
|
15963
|
+
if (!hasNotifiedMobile) {
|
|
15964
|
+
setHasNotifiedMobile(true);
|
|
15851
15965
|
}
|
|
15852
|
-
}
|
|
15966
|
+
} else {
|
|
15967
|
+
actions.push({
|
|
15968
|
+
label: 'Send SMS',
|
|
15969
|
+
onClick: function onClick() {
|
|
15970
|
+
return setCurrentAction('send-sms');
|
|
15971
|
+
}
|
|
15972
|
+
});
|
|
15973
|
+
}
|
|
15853
15974
|
}
|
|
15854
15975
|
if (isEmailId) {
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
return setCurrentAction('send-email');
|
|
15976
|
+
if (errors != null && errors.emailError) {
|
|
15977
|
+
if (!hasNotifiedEmail) {
|
|
15978
|
+
setHasNotifiedEmail(true);
|
|
15859
15979
|
}
|
|
15860
|
-
}
|
|
15980
|
+
} else {
|
|
15981
|
+
actions.push({
|
|
15982
|
+
label: 'Send Email',
|
|
15983
|
+
onClick: function onClick() {
|
|
15984
|
+
return setCurrentAction('send-email');
|
|
15985
|
+
}
|
|
15986
|
+
});
|
|
15987
|
+
}
|
|
15861
15988
|
}
|
|
15862
15989
|
return React.createElement(React.Fragment, null, React.createElement(DashBoardWrapper$2, null, React.createElement(BjsMenuDropDown, null), React.createElement(Options$1, null), React.createElement(Print, null), actions == null ? void 0 : actions.map(function (action, index) {
|
|
15863
15990
|
return React.createElement(FontContainer, {
|
|
@@ -17709,6 +17836,8 @@ function ReturnMainTable() {
|
|
|
17709
17836
|
var queryParams = new URLSearchParams(location.search);
|
|
17710
17837
|
var _useClientPortal = useClientPortal(),
|
|
17711
17838
|
clientPortal = _useClientPortal[0];
|
|
17839
|
+
var _useClientLoading = useClientLoading(),
|
|
17840
|
+
clientLoading = _useClientLoading[0];
|
|
17712
17841
|
var customerId = queryParams.get('customerId');
|
|
17713
17842
|
var handlePageChange = function handlePageChange(page) {
|
|
17714
17843
|
setCurrentPage(page);
|
|
@@ -17730,10 +17859,10 @@ function ReturnMainTable() {
|
|
|
17730
17859
|
loading = _useAxios.loading,
|
|
17731
17860
|
fetchData = _useAxios.fetchData;
|
|
17732
17861
|
useEffect(function () {
|
|
17733
|
-
if (!clientPortal) {
|
|
17862
|
+
if (!clientPortal && !clientLoading) {
|
|
17734
17863
|
fetchData();
|
|
17735
17864
|
}
|
|
17736
|
-
}, []);
|
|
17865
|
+
}, [clientLoading]);
|
|
17737
17866
|
useEffect(function () {
|
|
17738
17867
|
if (fetchedCustomerData && fetchedCustomerData != null && fetchedCustomerData.data) {
|
|
17739
17868
|
setCustomers(fetchedCustomerData == null ? void 0 : fetchedCustomerData.data);
|
|
@@ -17752,10 +17881,10 @@ function ReturnMainTable() {
|
|
|
17752
17881
|
paginationData = _useAxios2.paginationData,
|
|
17753
17882
|
fetchProductStats = _useAxios2.fetchData;
|
|
17754
17883
|
useEffect(function () {
|
|
17755
|
-
if (!clientPortal) {
|
|
17884
|
+
if (!clientPortal && !clientLoading) {
|
|
17756
17885
|
fetchProductStats();
|
|
17757
17886
|
}
|
|
17758
|
-
}, []);
|
|
17887
|
+
}, [clientLoading]);
|
|
17759
17888
|
useEffect(function () {
|
|
17760
17889
|
setLoading(statsDataLoading);
|
|
17761
17890
|
if (fetchedClientData && fetchedClientData.data) {
|
|
@@ -18762,7 +18891,19 @@ var ClientRouterHeader = function ClientRouterHeader(_ref) {
|
|
|
18762
18891
|
}
|
|
18763
18892
|
}, [startDate, endDate]);
|
|
18764
18893
|
var handleStartDateChange = function handleStartDateChange(date) {
|
|
18765
|
-
|
|
18894
|
+
if (!date) {
|
|
18895
|
+
setStartDate(null);
|
|
18896
|
+
setEndDate(null);
|
|
18897
|
+
dispatch({
|
|
18898
|
+
type: 'SET_CP_DATE_FILTER',
|
|
18899
|
+
payload: {
|
|
18900
|
+
startDate: null,
|
|
18901
|
+
endDate: null
|
|
18902
|
+
}
|
|
18903
|
+
});
|
|
18904
|
+
} else {
|
|
18905
|
+
setStartDate(date);
|
|
18906
|
+
}
|
|
18766
18907
|
};
|
|
18767
18908
|
var handleEndDateChange = function handleEndDateChange(date) {
|
|
18768
18909
|
setEndDate(date);
|
|
@@ -18780,7 +18921,7 @@ var ClientRouterHeader = function ClientRouterHeader(_ref) {
|
|
|
18780
18921
|
value: startDate ? dayjs(startDate) : null,
|
|
18781
18922
|
onChange: handleStartDateChange,
|
|
18782
18923
|
format: 'MMMM D, YYYY',
|
|
18783
|
-
allowClear:
|
|
18924
|
+
allowClear: true,
|
|
18784
18925
|
disabledDate: function disabledDate(current) {
|
|
18785
18926
|
return !!endDate && current.isAfter(dayjs(endDate), 'day');
|
|
18786
18927
|
}
|
|
@@ -18850,6 +18991,7 @@ var RouterHeader = function RouterHeader(_ref) {
|
|
|
18850
18991
|
};
|
|
18851
18992
|
|
|
18852
18993
|
function ReturnClient() {
|
|
18994
|
+
var _localStorage$getItem;
|
|
18853
18995
|
notification.config({
|
|
18854
18996
|
top: 80
|
|
18855
18997
|
});
|
|
@@ -18884,9 +19026,12 @@ function ReturnClient() {
|
|
|
18884
19026
|
clientPortal = _useClientPortal[0],
|
|
18885
19027
|
setClientPortal = _useClientPortal[1];
|
|
18886
19028
|
var location = useLocation();
|
|
18887
|
-
var userType = JSON.parse(localStorage.getItem('user_type'));
|
|
19029
|
+
var userType = JSON.parse((_localStorage$getItem = localStorage.getItem('user_type')) != null ? _localStorage$getItem : 'null');
|
|
19030
|
+
var _useClientLoading = useClientLoading(),
|
|
19031
|
+
setLoading = _useClientLoading[1];
|
|
18888
19032
|
useEffect(function () {
|
|
18889
|
-
setClientPortal(
|
|
19033
|
+
setClientPortal(userType != null && userType.is_customer ? true : false); // change it to false bydefault
|
|
19034
|
+
setLoading(false);
|
|
18890
19035
|
}, []);
|
|
18891
19036
|
var splitPath = function splitPath(str) {
|
|
18892
19037
|
var _str$split;
|