@bjsdistribution/dms-client-return 0.0.74 → 0.0.75
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/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.d.ts +1 -1
- package/dist/dms-client-return.cjs.development.js +205 -92
- 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 +205 -92
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +5 -4
- package/src/components/order-view/fakedata.ts +2 -0
- package/src/components/order-view/index.tsx +3 -0
- package/src/components/order-view/notes/index.tsx +25 -16
- package/src/components/order-view/notes/logs/index.tsx +0 -3
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactEmail.tsx +5 -15
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +45 -16
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +42 -8
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +41 -19
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Latitude.tsx +5 -1
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Longitude.tsx +5 -1
- package/src/components/order-view/order-details/expanded-content/customer-section/location-info/What3words.tsx +12 -5
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +8 -14
- package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +9 -1
- package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +13 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.75",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"testEnvironment": "jest-environment-jsdom-sixteen"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@bjsdistribution/dms-component-library": "0.1.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.1.42",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -6,13 +6,14 @@ import { optionsForReturnPrint } from '../../../../order-daily-overview/common/f
|
|
|
6
6
|
|
|
7
7
|
const options: PrintData[] = optionsForReturnPrint;
|
|
8
8
|
|
|
9
|
-
const PrintDropDownReturn = ({
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const PrintDropDownReturn = ({}: //url has tobe added here
|
|
10
|
+
|
|
11
|
+
// legacyProductId,
|
|
12
|
+
{
|
|
12
13
|
legacyProductId: number;
|
|
13
14
|
}) => {
|
|
14
15
|
const downloadFiles = () => {
|
|
15
|
-
const url =
|
|
16
|
+
const url = ``;
|
|
16
17
|
window.open(url, '_blank'); // Opens the URL in a new tab
|
|
17
18
|
};
|
|
18
19
|
|
|
@@ -17,6 +17,8 @@ export const optionsMenu = [
|
|
|
17
17
|
{ label: 'Confirm', value: 'confirm-order' },
|
|
18
18
|
{ label: 'Hold', value: 'hold-order' },
|
|
19
19
|
{ label: 'Cancel', value: 'cancel-order' },
|
|
20
|
+
{label: 'Un Hold', value: 'unhold-order',
|
|
21
|
+
},
|
|
20
22
|
// { label: 'Charge Log', value: 'charge-log' },
|
|
21
23
|
];
|
|
22
24
|
|
|
@@ -118,6 +118,7 @@ function OrderView() {
|
|
|
118
118
|
}
|
|
119
119
|
} else {
|
|
120
120
|
const paths = location.pathname.split('/');
|
|
121
|
+
console.log(paths[paths.length - 1], 'paths');
|
|
121
122
|
setOrderId(paths[paths.length - 1]);
|
|
122
123
|
}
|
|
123
124
|
}, [location.search, loadingExternal]);
|
|
@@ -348,6 +349,8 @@ function OrderView() {
|
|
|
348
349
|
};
|
|
349
350
|
}, [gsitId]);
|
|
350
351
|
|
|
352
|
+
console.log(orderId, 'orderId');
|
|
353
|
+
|
|
351
354
|
return (
|
|
352
355
|
<MainContainer>
|
|
353
356
|
<GeneralHeader />
|
|
@@ -19,9 +19,9 @@ function Notes() {
|
|
|
19
19
|
// const pathname = location.pathname;
|
|
20
20
|
// const orderIdLocaation = pathname.split('/')[1];
|
|
21
21
|
|
|
22
|
-
const[recallAuditLog]
|
|
22
|
+
const [recallAuditLog] = useGlobalStateHitAuditLog();
|
|
23
23
|
|
|
24
|
-
const [,setAuditLogLoading] = useAuditLogLoadingState()
|
|
24
|
+
const [, setAuditLogLoading] = useAuditLogLoadingState();
|
|
25
25
|
|
|
26
26
|
const [, setNotes] = usegetNotes();
|
|
27
27
|
// const [loderStatus] = useCallAPi();
|
|
@@ -59,24 +59,32 @@ function Notes() {
|
|
|
59
59
|
loading: NotesLoading,
|
|
60
60
|
setShouldPerformAction,
|
|
61
61
|
} = useApiHook<{ data: any }>({
|
|
62
|
-
endpoint: `audit_logs/?module_id=${
|
|
63
|
-
moduleIds?.parentId
|
|
64
|
-
}&module_object_id=${orderId}`,
|
|
62
|
+
endpoint: `audit_logs/?module_id=${moduleIds?.parentId}&module_object_id=${orderId}`,
|
|
65
63
|
method: 'GET',
|
|
66
64
|
performAction: false,
|
|
67
65
|
});
|
|
68
66
|
|
|
69
67
|
useEffect(() => {
|
|
70
|
-
if (moduleIds && orderId
|
|
71
|
-
|
|
68
|
+
if (moduleIds && orderId) {
|
|
72
69
|
setShouldPerformAction(true);
|
|
73
70
|
}
|
|
74
71
|
if (!NotesLoading && NotesData?.data) {
|
|
75
|
-
const updatedData = NotesData?.data
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
// const updatedData = NotesData?.data
|
|
73
|
+
// .filter((item: any) => item['ORDER-NOTE'] || item['ORDER'])
|
|
74
|
+
// .map((item: any) => [item['ORDER-NOTE'], item['ORDER']])
|
|
75
|
+
// .flat()
|
|
76
|
+
// .filter(Boolean);
|
|
77
|
+
|
|
78
|
+
const updatedData = NotesData.data
|
|
79
|
+
.filter(
|
|
80
|
+
(item: any) =>
|
|
81
|
+
item['ORDER-NOTE'] || item['ORDER'] || item['ORDER-RETURN']
|
|
82
|
+
)
|
|
83
|
+
.map((item: any) => [
|
|
84
|
+
item['ORDER-NOTE'],
|
|
85
|
+
item['ORDER'],
|
|
86
|
+
item['ORDER-RETURN'],
|
|
87
|
+
]);
|
|
80
88
|
|
|
81
89
|
// const orderData = NotesData?.data[0]?.ORDER || [];
|
|
82
90
|
// const orderNotesData = NotesData?.data[1]?.['ORDER-NOTE'] || [];
|
|
@@ -87,11 +95,12 @@ function Notes() {
|
|
|
87
95
|
new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
|
88
96
|
);
|
|
89
97
|
setNotes(combinedArray);
|
|
90
|
-
recallAuditLog
|
|
91
|
-
|
|
98
|
+
recallAuditLog
|
|
99
|
+
? setShouldPerformAction(true)
|
|
100
|
+
: setShouldPerformAction(false);
|
|
92
101
|
}
|
|
93
|
-
setAuditLogLoading(NotesLoading)
|
|
94
|
-
}, [moduleIds,orderId,NotesLoading,recallAuditLog]);
|
|
102
|
+
setAuditLogLoading(NotesLoading);
|
|
103
|
+
}, [moduleIds, orderId, NotesLoading, recallAuditLog]);
|
|
95
104
|
|
|
96
105
|
return (
|
|
97
106
|
<Container>
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import GenericAuditLogsTable from '../../generic-table/AuditLogs';
|
|
4
|
-
// import CustomScrollBar from '../../../../common/scrollbar';
|
|
5
4
|
|
|
6
5
|
function AuditLogs() {
|
|
7
6
|
return (
|
|
8
7
|
<Container>
|
|
9
|
-
{/* <CustomScrollBar> */}
|
|
10
8
|
<GenericAuditLogsTable />
|
|
11
|
-
{/* </CustomScrollBar> */}
|
|
12
9
|
</Container>
|
|
13
10
|
);
|
|
14
11
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Input, Label } from '@bjsdistribution/dms-component-library';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import CopyText from '../../../../../../common/copy/CopyText';
|
|
5
4
|
import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
|
|
6
5
|
|
|
7
6
|
function ContactEmail() {
|
|
@@ -10,11 +9,6 @@ function ContactEmail() {
|
|
|
10
9
|
const [errors, setErrors] = useAtom(errorAtom);
|
|
11
10
|
const orderRecipient = orderDetails?.order_recipient;
|
|
12
11
|
|
|
13
|
-
const showCopyIcon =
|
|
14
|
-
orderRecipient?.contact_email !== undefined &&
|
|
15
|
-
orderRecipient?.contact_email !== null &&
|
|
16
|
-
orderRecipient?.contact_email?.length > 0;
|
|
17
|
-
|
|
18
12
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
19
13
|
const val = e.target.value;
|
|
20
14
|
validateInput(val);
|
|
@@ -23,19 +17,17 @@ function ContactEmail() {
|
|
|
23
17
|
? { contact_email: val }
|
|
24
18
|
: { ...orderRecipient, contact_email: val }),
|
|
25
19
|
};
|
|
26
|
-
setOrderDetails(prev => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
});
|
|
20
|
+
setOrderDetails(prev => ({
|
|
21
|
+
...prev,
|
|
22
|
+
order_recipient: updatedOrderRecipient,
|
|
23
|
+
}));
|
|
32
24
|
};
|
|
33
25
|
|
|
34
26
|
const validateInput = (value: string) => {
|
|
35
27
|
const isValid = emailRegex.test(value);
|
|
36
28
|
setErrors(prev => ({
|
|
37
29
|
...prev,
|
|
38
|
-
emailError: isValid ? '
|
|
30
|
+
emailError: value && !isValid ? 'Please enter a valid Email Address' : '',
|
|
39
31
|
}));
|
|
40
32
|
};
|
|
41
33
|
|
|
@@ -43,7 +35,6 @@ function ContactEmail() {
|
|
|
43
35
|
<Container>
|
|
44
36
|
<Wrapper>
|
|
45
37
|
<Label label="Email" htmlFor="email-id" />
|
|
46
|
-
{showCopyIcon && <CopyText text={orderRecipient?.contact_email!} />}
|
|
47
38
|
</Wrapper>
|
|
48
39
|
<Input
|
|
49
40
|
name="email-id"
|
|
@@ -51,7 +42,6 @@ function ContactEmail() {
|
|
|
51
42
|
placeholder="Email"
|
|
52
43
|
value={orderRecipient?.contact_email || ''}
|
|
53
44
|
onChange={onChange}
|
|
54
|
-
style={{ borderRadius: '25px' }}
|
|
55
45
|
/>
|
|
56
46
|
{errors.emailError && <ErrorText>{errors.emailError}</ErrorText>}
|
|
57
47
|
</Container>
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { Input, Label } from '@bjsdistribution/dms-component-library';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import
|
|
5
|
-
import { useOrderDetails } from '../../../../store';
|
|
4
|
+
import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
|
|
6
5
|
import { handleKeyDown } from '../../../../utils';
|
|
7
|
-
// import CallCustomer from './CallCustomer';
|
|
8
6
|
|
|
9
7
|
// const LANDLINE_REGEX = /^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/;
|
|
10
8
|
|
|
11
9
|
function ContactHome() {
|
|
10
|
+
const [errors, setErrors] = useAtom(errorAtom);
|
|
11
|
+
|
|
12
12
|
// Show call icons only if number is valid
|
|
13
13
|
// show copy icon if there is input value
|
|
14
14
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
15
15
|
const orderRecipient = orderDetails?.order_recipient;
|
|
16
16
|
|
|
17
|
-
const showCopyIcon =
|
|
18
|
-
orderRecipient?.contact_home !== undefined &&
|
|
19
|
-
orderRecipient?.contact_home !== null &&
|
|
20
|
-
orderRecipient?.contact_home?.length > 0;
|
|
21
|
-
|
|
22
17
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
23
18
|
const val = e.target.value;
|
|
24
19
|
const updatedOrderRecipient = {
|
|
@@ -26,18 +21,42 @@ function ContactHome() {
|
|
|
26
21
|
? { contact_home: val }
|
|
27
22
|
: { ...orderRecipient, contact_home: val }),
|
|
28
23
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
|
|
25
|
+
setOrderDetails(prev => ({
|
|
26
|
+
...prev,
|
|
27
|
+
order_recipient: updatedOrderRecipient,
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
if (val) {
|
|
31
|
+
if (val.length < 10) {
|
|
32
|
+
setErrors(prevErrors => ({
|
|
33
|
+
...prevErrors,
|
|
34
|
+
homeContactError: 'Phone number must be at least 10 digits.',
|
|
35
|
+
}));
|
|
36
|
+
} else if (val.length > 11) {
|
|
37
|
+
setErrors(prevErrors => ({
|
|
38
|
+
...prevErrors,
|
|
39
|
+
homeContactError: 'Phone number must not exceed 11 digits.',
|
|
40
|
+
}));
|
|
41
|
+
} else {
|
|
42
|
+
setErrors(prevErrors => ({
|
|
43
|
+
...prevErrors,
|
|
44
|
+
homeContactError: '',
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
setErrors(prevErrors => ({
|
|
49
|
+
...prevErrors,
|
|
50
|
+
homeContactError: '',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
35
53
|
};
|
|
54
|
+
|
|
36
55
|
return (
|
|
37
56
|
<MainContainer>
|
|
38
57
|
<Wrapper>
|
|
39
58
|
<Label label="Contact Home" htmlFor="contact-home" />
|
|
40
|
-
{showCopyIcon && <CopyText text={orderRecipient?.contact_home!} />}
|
|
59
|
+
{/* {showCopyIcon && <CopyText text={orderRecipient?.contact_home!} />} */}
|
|
41
60
|
</Wrapper>
|
|
42
61
|
<InputContainer>
|
|
43
62
|
<CustomInput
|
|
@@ -45,11 +64,17 @@ function ContactHome() {
|
|
|
45
64
|
type="text"
|
|
46
65
|
placeholder="Home Number"
|
|
47
66
|
onKeyDown={handleKeyDown}
|
|
67
|
+
minLength={10}
|
|
68
|
+
maxLength={10}
|
|
48
69
|
value={orderRecipient?.contact_home || ''}
|
|
49
70
|
onChange={onChange}
|
|
50
71
|
/>
|
|
72
|
+
|
|
51
73
|
{/* <CallCustomer /> */}
|
|
52
74
|
</InputContainer>
|
|
75
|
+
{errors.homeContactError && (
|
|
76
|
+
<ErrorText>{errors.homeContactError}</ErrorText>
|
|
77
|
+
)}
|
|
53
78
|
</MainContainer>
|
|
54
79
|
);
|
|
55
80
|
}
|
|
@@ -62,7 +87,6 @@ const Wrapper = styled.div`
|
|
|
62
87
|
|
|
63
88
|
const CustomInput = styled(Input)`
|
|
64
89
|
width: 80%;
|
|
65
|
-
border-radius: 25px;
|
|
66
90
|
// @media (max-width: 1024px) {
|
|
67
91
|
// width: 80%;
|
|
68
92
|
// }
|
|
@@ -90,4 +114,9 @@ const MainContainer = styled.div`
|
|
|
90
114
|
flex: 1;
|
|
91
115
|
`;
|
|
92
116
|
|
|
117
|
+
const ErrorText = styled.span`
|
|
118
|
+
color: red;
|
|
119
|
+
font-size: 0.85rem;
|
|
120
|
+
margin-top: 4px;
|
|
121
|
+
`;
|
|
93
122
|
export default ContactHome;
|
|
@@ -3,11 +3,13 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import CopyText from '../../../../../../common/copy/CopyText';
|
|
5
5
|
import CallCustomer from './CallCustomer';
|
|
6
|
-
import { useOrderDetails } from '../../../../store';
|
|
6
|
+
import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
|
|
7
7
|
import { handleKeyDown } from '../../../../utils';
|
|
8
8
|
// const MOBILE_REGEX = /^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$/;
|
|
9
9
|
|
|
10
10
|
function ContactMobile() {
|
|
11
|
+
const [errors, setErrors] = useAtom(errorAtom);
|
|
12
|
+
|
|
11
13
|
// Show call icons only if number is valid
|
|
12
14
|
// show copy icon if there is input value
|
|
13
15
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
@@ -25,12 +27,35 @@ function ContactMobile() {
|
|
|
25
27
|
? { contact_mobile: val }
|
|
26
28
|
: { ...orderRecipient, contact_mobile: val }),
|
|
27
29
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
|
|
31
|
+
setOrderDetails(prev => ({
|
|
32
|
+
...prev,
|
|
33
|
+
order_recipient: updatedOrderRecipient,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
if (val) {
|
|
37
|
+
if (val.length < 10) {
|
|
38
|
+
setErrors(prevErrors => ({
|
|
39
|
+
...prevErrors,
|
|
40
|
+
mobileError: 'Phone number must be at least 10 digits.',
|
|
41
|
+
}));
|
|
42
|
+
} else if (val.length > 11) {
|
|
43
|
+
setErrors(prevErrors => ({
|
|
44
|
+
...prevErrors,
|
|
45
|
+
mobileError: 'Phone number must not exceed 11 digits.',
|
|
46
|
+
}));
|
|
47
|
+
} else {
|
|
48
|
+
setErrors(prevErrors => ({
|
|
49
|
+
...prevErrors,
|
|
50
|
+
mobileError: '',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
setErrors(prevErrors => ({
|
|
55
|
+
...prevErrors,
|
|
56
|
+
mobileError: '',
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
34
59
|
};
|
|
35
60
|
|
|
36
61
|
return (
|
|
@@ -42,6 +67,8 @@ function ContactMobile() {
|
|
|
42
67
|
<InputContainer>
|
|
43
68
|
<CustomInput
|
|
44
69
|
name="contact-work"
|
|
70
|
+
minLength={10}
|
|
71
|
+
maxLength={10}
|
|
45
72
|
type="text"
|
|
46
73
|
placeholder="Mobile Number"
|
|
47
74
|
onKeyDown={handleKeyDown}
|
|
@@ -50,6 +77,7 @@ function ContactMobile() {
|
|
|
50
77
|
/>
|
|
51
78
|
<CallCustomer />
|
|
52
79
|
</InputContainer>
|
|
80
|
+
{errors.mobileError && <ErrorText>{errors.mobileError}</ErrorText>}
|
|
53
81
|
</Container>
|
|
54
82
|
);
|
|
55
83
|
}
|
|
@@ -68,7 +96,7 @@ const Wrapper = styled.div`
|
|
|
68
96
|
|
|
69
97
|
const CustomInput = styled(Input)`
|
|
70
98
|
width: 80%;
|
|
71
|
-
|
|
99
|
+
|
|
72
100
|
&::-webkit-outer-spin-button,
|
|
73
101
|
&::-webkit-inner-spin-button {
|
|
74
102
|
-webkit-appearance: none;
|
|
@@ -86,4 +114,10 @@ const Container = styled.div`
|
|
|
86
114
|
flex: 1;
|
|
87
115
|
`;
|
|
88
116
|
|
|
117
|
+
const ErrorText = styled.span`
|
|
118
|
+
color: red;
|
|
119
|
+
font-size: 0.85rem;
|
|
120
|
+
margin-top: 4px;
|
|
121
|
+
`;
|
|
122
|
+
|
|
89
123
|
export default ContactMobile;
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { Input, Label } from '@bjsdistribution/dms-component-library';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
-
import
|
|
5
|
-
import { useOrderDetails } from '../../../../store';
|
|
4
|
+
import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
|
|
6
5
|
import { handleKeyDown } from '../../../../utils';
|
|
7
|
-
// import CallCustomer from './CallCustomer';
|
|
8
6
|
|
|
9
7
|
function ContactWork() {
|
|
10
|
-
|
|
11
|
-
// show copy icon if there is input value
|
|
8
|
+
const [errors, setErrors] = useAtom(errorAtom);
|
|
12
9
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
13
10
|
const orderRecipient = orderDetails?.order_recipient;
|
|
14
11
|
|
|
15
|
-
const showCopyIcon =
|
|
16
|
-
orderRecipient?.contact_work !== undefined &&
|
|
17
|
-
orderRecipient?.contact_work !== null &&
|
|
18
|
-
orderRecipient?.contact_work?.length > 0;
|
|
19
|
-
|
|
20
12
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
21
13
|
const val = e.target.value;
|
|
22
14
|
const updatedOrderRecipient = {
|
|
@@ -24,19 +16,41 @@ function ContactWork() {
|
|
|
24
16
|
? { contact_work: val }
|
|
25
17
|
: { ...orderRecipient, contact_work: val }),
|
|
26
18
|
};
|
|
27
|
-
setOrderDetails(prev => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
setOrderDetails(prev => ({
|
|
20
|
+
...prev,
|
|
21
|
+
order_recipient: updatedOrderRecipient,
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
// Validate only if there is a value entered
|
|
25
|
+
if (val) {
|
|
26
|
+
if (val.length < 10) {
|
|
27
|
+
setErrors(prevErrors => ({
|
|
28
|
+
...prevErrors,
|
|
29
|
+
workCOntanctError: 'Phone number must be at least 10 digits.',
|
|
30
|
+
}));
|
|
31
|
+
} else if (val.length > 10) {
|
|
32
|
+
setErrors(prevErrors => ({
|
|
33
|
+
...prevErrors,
|
|
34
|
+
workCOntanctError: 'Phone number must not exceed 10 digits.',
|
|
35
|
+
}));
|
|
36
|
+
} else {
|
|
37
|
+
setErrors(prevErrors => ({
|
|
38
|
+
...prevErrors,
|
|
39
|
+
workCOntanctError: '',
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
setErrors(prevErrors => ({
|
|
44
|
+
...prevErrors,
|
|
45
|
+
workCOntanctError: '',
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
33
48
|
};
|
|
34
49
|
|
|
35
50
|
return (
|
|
36
51
|
<Container>
|
|
37
52
|
<Wrapper>
|
|
38
53
|
<Label label="Contact Work" htmlFor="contact-work" />
|
|
39
|
-
{showCopyIcon && <CopyText text={orderRecipient?.contact_work!} />}
|
|
40
54
|
</Wrapper>
|
|
41
55
|
<InputContainer>
|
|
42
56
|
<CustomInput
|
|
@@ -46,9 +60,13 @@ function ContactWork() {
|
|
|
46
60
|
onKeyDown={handleKeyDown}
|
|
47
61
|
value={orderRecipient?.contact_work || ''}
|
|
48
62
|
onChange={onChange}
|
|
63
|
+
minLength={10}
|
|
64
|
+
maxLength={10}
|
|
49
65
|
/>
|
|
50
|
-
{/* <CallCustomer /> */}
|
|
51
66
|
</InputContainer>
|
|
67
|
+
{errors.workCOntanctError && (
|
|
68
|
+
<ErrorText>{errors.workCOntanctError}</ErrorText>
|
|
69
|
+
)}
|
|
52
70
|
</Container>
|
|
53
71
|
);
|
|
54
72
|
}
|
|
@@ -66,7 +84,6 @@ const Wrapper = styled.div`
|
|
|
66
84
|
`;
|
|
67
85
|
|
|
68
86
|
const CustomInput = styled(Input)`
|
|
69
|
-
border-radius: 25px;
|
|
70
87
|
width: 100%;
|
|
71
88
|
|
|
72
89
|
&::-webkit-outer-spin-button,
|
|
@@ -85,5 +102,10 @@ const Container = styled.div`
|
|
|
85
102
|
gap: 6px;
|
|
86
103
|
flex: 1;
|
|
87
104
|
`;
|
|
105
|
+
const ErrorText = styled.span`
|
|
106
|
+
color: red;
|
|
107
|
+
font-size: 0.85rem;
|
|
108
|
+
margin-top: 4px;
|
|
109
|
+
`;
|
|
88
110
|
|
|
89
111
|
export default ContactWork;
|
|
@@ -33,13 +33,14 @@ function Latitude() {
|
|
|
33
33
|
onKeyDown={handleKeyDown}
|
|
34
34
|
value={orderRecipient?.latitude || ''}
|
|
35
35
|
onChange={onChange}
|
|
36
|
+
readOnly
|
|
36
37
|
/>
|
|
37
38
|
</Container>
|
|
38
39
|
);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const CustomInput = styled(Input)`
|
|
42
|
-
|
|
43
|
+
width: 100%;
|
|
43
44
|
&::-webkit-outer-spin-button,
|
|
44
45
|
&::-webkit-inner-spin-button {
|
|
45
46
|
-webkit-appearance: none;
|
|
@@ -48,6 +49,9 @@ const CustomInput = styled(Input)`
|
|
|
48
49
|
&:focus-visible {
|
|
49
50
|
outline: none;
|
|
50
51
|
}
|
|
52
|
+
opacity: 0.8;
|
|
53
|
+
background-color: #f4f4f4;
|
|
54
|
+
pointer-events: none;
|
|
51
55
|
`;
|
|
52
56
|
|
|
53
57
|
const Container = styled.div`
|
|
@@ -32,13 +32,14 @@ function Longitude() {
|
|
|
32
32
|
onKeyDown={handleKeyDown}
|
|
33
33
|
value={orderRecipient?.longitude || ''}
|
|
34
34
|
onChange={onChange}
|
|
35
|
+
readOnly
|
|
35
36
|
/>
|
|
36
37
|
</Container>
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
const CustomInput = styled(Input)`
|
|
41
|
-
|
|
42
|
+
width: 100%;
|
|
42
43
|
&::-webkit-outer-spin-button,
|
|
43
44
|
&::-webkit-inner-spin-button {
|
|
44
45
|
-webkit-appearance: none;
|
|
@@ -47,6 +48,9 @@ const CustomInput = styled(Input)`
|
|
|
47
48
|
&:focus-visible {
|
|
48
49
|
outline: none;
|
|
49
50
|
}
|
|
51
|
+
opacity: 0.8;
|
|
52
|
+
background-color: #f4f4f4;
|
|
53
|
+
pointer-events: none;
|
|
50
54
|
`;
|
|
51
55
|
|
|
52
56
|
const Container = styled.div`
|
|
@@ -27,11 +27,18 @@ function What3words() {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const validateInput = (value: string) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
if (value.trim()) {
|
|
31
|
+
const isValid = w3wRegex.test(value);
|
|
32
|
+
setErrors(prev => ({
|
|
33
|
+
...prev,
|
|
34
|
+
w3wError: isValid ? '' : 'Please enter a valid input (word.word.word)',
|
|
35
|
+
}));
|
|
36
|
+
} else {
|
|
37
|
+
setErrors(prev => ({
|
|
38
|
+
...prev,
|
|
39
|
+
w3wError: '',
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
return (
|
|
@@ -8,9 +8,7 @@ import {
|
|
|
8
8
|
usePrevOrderDetails,
|
|
9
9
|
errorAtom,
|
|
10
10
|
useCustomerInfo,
|
|
11
|
-
// useLogsCallAPi,
|
|
12
11
|
useUpdateApiCall,
|
|
13
|
-
// UseNotesLoading,
|
|
14
12
|
} from '../../../store';
|
|
15
13
|
import useUpdateOrder from '../../../hooks/useUpdateOrder';
|
|
16
14
|
import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
@@ -22,18 +20,15 @@ function OrderDetailsFooter() {
|
|
|
22
20
|
const [, setCustomerInfo] = useCustomerInfo();
|
|
23
21
|
const updateOrder = useUpdateOrder();
|
|
24
22
|
const [errorState] = useAtom(errorAtom);
|
|
25
|
-
// const [, setLogsCallAPi] = useLogsCallAPi();
|
|
26
23
|
const [, setCallApi] = useUpdateApiCall(); //single detail
|
|
27
|
-
// const [, setNoteLoadingStore] = UseNotesLoading();
|
|
28
|
-
|
|
29
24
|
const errorFound = () => {
|
|
30
25
|
const isError =
|
|
31
|
-
errorState
|
|
32
|
-
errorState
|
|
33
|
-
errorState
|
|
34
|
-
errorState
|
|
35
|
-
errorState
|
|
36
|
-
errorState
|
|
26
|
+
errorState?.w3wError.length > 0 ||
|
|
27
|
+
errorState?.emailError.length > 0 ||
|
|
28
|
+
errorState?.homeContactError.length > 0 ||
|
|
29
|
+
errorState?.workCOntanctError.length > 0 ||
|
|
30
|
+
errorState?.mobileError.length > 0 ||
|
|
31
|
+
errorState?.postCodeError.length > 0;
|
|
37
32
|
|
|
38
33
|
return isError;
|
|
39
34
|
};
|
|
@@ -116,11 +111,10 @@ const Container = styled.div`
|
|
|
116
111
|
justify-content: space-between;
|
|
117
112
|
padding: 10px 15px;
|
|
118
113
|
align-items: flex-start;
|
|
119
|
-
border: 1px solid #edebe8;
|
|
114
|
+
border-top: 1px solid #edebe8;
|
|
120
115
|
background: #f8fafc;
|
|
121
|
-
margin: 0px;
|
|
116
|
+
margin: 0px -15px -15px -15px;
|
|
122
117
|
border-radius: 0px 0px 8px 8px;
|
|
123
|
-
align-items: center;
|
|
124
118
|
`;
|
|
125
119
|
|
|
126
120
|
export default OrderDetailsFooter;
|
package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx
CHANGED
|
@@ -2,12 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Label } from '@bjsdistribution/dms-component-library';
|
|
4
4
|
import { DatePicker, DatePickerProps } from 'antd';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
useOrderDetails,
|
|
7
|
+
usePrevOrderDetails,
|
|
8
|
+
useStatusDetails,
|
|
9
|
+
} from '../../../store';
|
|
6
10
|
import dayjs from 'dayjs';
|
|
7
11
|
|
|
8
12
|
function DeliveryDate() {
|
|
9
13
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
10
14
|
const [prevOrderDetails] = usePrevOrderDetails();
|
|
15
|
+
const [orderStatus] = useStatusDetails();
|
|
16
|
+
|
|
17
|
+
const routedStatus = orderStatus?.[0]?.routed;
|
|
11
18
|
|
|
12
19
|
const actionDate = orderDetails?.action_date
|
|
13
20
|
? new Date(orderDetails?.action_date)
|
|
@@ -56,6 +63,7 @@ function DeliveryDate() {
|
|
|
56
63
|
format="DD/MM/YY"
|
|
57
64
|
style={{ borderRadius: '25px' }}
|
|
58
65
|
allowClear={false}
|
|
66
|
+
disabled={routedStatus}
|
|
59
67
|
/>
|
|
60
68
|
</MainContainer>
|
|
61
69
|
);
|