@bjsdistribution/dms-client-return 0.0.18 → 0.0.19
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/assets/icons/DustbinIcon.d.ts +3 -0
- package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
- package/dist/components/order-daily-overview/header-filters/overViewFilter.d.ts +16 -0
- package/dist/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.d.ts +1 -1
- package/dist/components/order-daily-overview/store/store.d.ts +2 -0
- package/dist/components/order-daily-overview/table-view/ReturnPagination.d.ts +3 -0
- package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
- package/dist/components/order-view/fakedata.d.ts +1 -1
- package/dist/components/order-view/order-actions/Dropdown.d.ts +6 -2
- package/dist/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWith.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/tables/ReminderStyles.d.ts +9 -0
- package/dist/components/order-view/order-actions/store.d.ts +34 -1
- package/dist/components/order-view/order-actions/types.d.ts +5 -0
- package/dist/components/order-view/store.d.ts +1 -0
- package/dist/components/order-view/types.d.ts +5 -2
- package/dist/dms-client-return.cjs.development.js +2370 -1678
- 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 +2373 -1681
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/icons/DustbinIcon.tsx +20 -0
- package/src/common/modals/order-action-modal/OrderActionModal.tsx +4 -2
- package/src/components/order-daily-overview/header-filters/filterStore.ts +19 -18
- package/src/components/order-daily-overview/header-filters/overViewFilter.ts +80 -0
- package/src/components/order-daily-overview/index.tsx +27 -33
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +47 -5
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +9 -5
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +1 -1
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +2 -2
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +25 -1
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +29 -11
- package/src/components/order-daily-overview/store/store.ts +11 -1
- package/src/components/order-daily-overview/table-view/Pagination.tsx +2 -1
- package/src/components/order-daily-overview/table-view/ReturnPagination.tsx +136 -0
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +26 -12
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +8 -1
- package/src/components/order-view/fakedata.ts +5 -9
- package/src/components/order-view/general-information/dropdowns/BjsMenu.tsx +15 -4
- package/src/components/order-view/general-information/dropdowns/Print.tsx +79 -39
- package/src/components/order-view/general-information/dropdowns/index.tsx +0 -13
- package/src/components/order-view/general-information/index.tsx +3 -19
- package/src/components/order-view/generic-table/AuditLogs.tsx +7 -5
- package/src/components/order-view/index.tsx +1 -2
- package/src/components/order-view/modalsPopup/ModalManager.tsx +44 -203
- package/src/components/order-view/notes/AddNote.tsx +4 -14
- package/src/components/order-view/notes/index.tsx +8 -13
- package/src/components/order-view/order-actions/Dropdown.tsx +8 -3
- package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +146 -12
- package/src/components/order-view/order-actions/actions/charge-log/index.tsx +126 -79
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ActionDropdown.tsx +21 -9
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactMobile.tsx +64 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactPhone.tsx +67 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactTypeDropdown.tsx +19 -7
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWith.tsx +28 -0
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWork.tsx +65 -1
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx +40 -3
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/EmailAddress.tsx +47 -2
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/TimedServiceDropdown.tsx +38 -9
- package/src/components/order-view/order-actions/actions/confirm-order/customer-info/index.tsx +4 -1
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +196 -6
- package/src/components/order-view/order-actions/actions/confirm-order/slot-and-instructions/index.tsx +5 -1
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +121 -20
- package/src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx +54 -32
- package/src/components/order-view/order-actions/actions/confirm-order/tables/ReminderStyles.tsx +289 -0
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +41 -8
- package/src/components/order-view/order-actions/actions/create-task-reminder/index.tsx +11 -83
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +61 -14
- package/src/components/order-view/order-actions/actions/release-order/ReleaseOrder.tsx +93 -25
- package/src/components/order-view/order-actions/actions/split-order/SplitOrderTable.tsx +102 -247
- package/src/components/order-view/order-actions/actions/split-order/index.tsx +57 -9
- package/src/components/order-view/order-actions/index.tsx +7 -2
- package/src/components/order-view/order-actions/store.ts +45 -0
- package/src/components/order-view/order-actions/types.ts +5 -0
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +15 -12
- package/src/components/order-view/store.ts +7 -0
- package/src/components/order-view/types.ts +5 -2
|
@@ -1,103 +1,150 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
AmountContainer,
|
|
4
|
-
AmountSymbol,
|
|
3
|
+
// AmountContainer,
|
|
4
|
+
// AmountSymbol,
|
|
5
5
|
ContentContainer,
|
|
6
|
-
DeleteCircleIcon,
|
|
6
|
+
// DeleteCircleIcon,
|
|
7
7
|
Heading,
|
|
8
|
-
StatusWrapper,
|
|
9
|
-
StyledAmountInput,
|
|
10
|
-
SuccessText,
|
|
8
|
+
// StatusWrapper,
|
|
9
|
+
// StyledAmountInput,
|
|
10
|
+
// SuccessText,
|
|
11
11
|
} from '../modalstyle';
|
|
12
|
-
import { AntTable
|
|
12
|
+
import { AntTable } from '@bjsdistribution/dms-component-library';
|
|
13
13
|
|
|
14
|
-
import { useCurrentAction } from '../../../store';
|
|
15
|
-
import { ChargeLogData
|
|
16
|
-
import { initialData } from '../../../fakedata';
|
|
14
|
+
import { useCurrentAction, useCustomerInfo } from '../../../store';
|
|
15
|
+
import { ChargeLogData } from '../../../types';
|
|
16
|
+
// import { initialData } from '../../../fakedata';
|
|
17
17
|
import OrderActionModal from '../../../../../common/modals/order-action-modal/OrderActionModal';
|
|
18
|
+
import DustbinIcon from '../../../../../assets/icons/DustbinIcon';
|
|
18
19
|
|
|
19
20
|
function ChargeLog() {
|
|
20
21
|
const [, setCurrentAction] = useCurrentAction();
|
|
21
|
-
const [
|
|
22
|
+
const [customerInfo] = useCustomerInfo();
|
|
23
|
+
const infoText = `${customerInfo?.recipient_name}, ${customerInfo?.postcode}`;
|
|
24
|
+
|
|
25
|
+
// const [data, setData] = useState<ChargeLogData[]>(initialData);
|
|
22
26
|
|
|
23
27
|
const closeModal = () => {
|
|
24
28
|
setCurrentAction(undefined);
|
|
25
29
|
};
|
|
26
30
|
|
|
27
|
-
const handleDelete = (record: ChargeLogData) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
+
// const handleDelete = (record: ChargeLogData) => {
|
|
32
|
+
// const newData = data.filter(item => item.id !== record.id);
|
|
33
|
+
// setData(newData);
|
|
34
|
+
// };
|
|
35
|
+
// const handleAmountChange = (value: string, id: number) => {
|
|
36
|
+
// const amountValue = value.replace(/[^0-9.]/g, '');
|
|
37
|
+
// const parts = amountValue.split('.');
|
|
38
|
+
// if (parts.length > 2) {
|
|
39
|
+
// return;
|
|
40
|
+
// }
|
|
41
|
+
// if (parts.length === 2 && parts[1].length > 2) {
|
|
42
|
+
// return;
|
|
43
|
+
// }
|
|
31
44
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
45
|
+
// const newData = data.map(item => {
|
|
46
|
+
// if (item.id === id) {
|
|
47
|
+
// return { ...item, amount: amountValue };
|
|
48
|
+
// }
|
|
49
|
+
// return item;
|
|
50
|
+
// });
|
|
51
|
+
// setData(newData);
|
|
52
|
+
// };
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
// const columns: Column[] = [
|
|
55
|
+
// { key: 'date', title: 'Date', dataIndex: 'date' },
|
|
56
|
+
// { key: 'description', title: 'Description', dataIndex: 'description' },
|
|
57
|
+
// {
|
|
58
|
+
// key: 'amount',
|
|
59
|
+
// title: 'Amount',
|
|
60
|
+
// dataIndex: 'amount',
|
|
61
|
+
// render: (record: any) => (
|
|
62
|
+
// <AmountContainer>
|
|
63
|
+
// <AmountSymbol>£</AmountSymbol>
|
|
64
|
+
// {record.status ? (
|
|
65
|
+
// <StyledAmountInput
|
|
66
|
+
// type="text"
|
|
67
|
+
// value={record.amount}
|
|
68
|
+
// onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
69
|
+
// handleAmountChange(e.target.value, record.id)
|
|
70
|
+
// }
|
|
71
|
+
// />
|
|
72
|
+
// ) : (
|
|
73
|
+
// <div>{record.amount}</div>
|
|
74
|
+
// )}
|
|
75
|
+
// </AmountContainer>
|
|
76
|
+
// ),
|
|
77
|
+
// },
|
|
78
|
+
// {
|
|
79
|
+
// key: 'status',
|
|
80
|
+
// title: 'Status',
|
|
81
|
+
// render: (record: any) => (
|
|
82
|
+
// <StatusWrapper>
|
|
83
|
+
// {record.status ? (
|
|
84
|
+
// <>
|
|
85
|
+
// Invoice : <SuccessText>{record.status}</SuccessText>
|
|
86
|
+
// </>
|
|
87
|
+
// ) : (
|
|
88
|
+
// 'Awaiting Invoice'
|
|
89
|
+
// )}
|
|
90
|
+
// </StatusWrapper>
|
|
91
|
+
// ),
|
|
92
|
+
// },
|
|
93
|
+
// {
|
|
94
|
+
// key: 'action',
|
|
95
|
+
// title: 'Action',
|
|
96
|
+
// render: (record: any) => (
|
|
97
|
+
// <DeleteCircleIcon onClick={() => handleDelete(record)}>
|
|
98
|
+
// <DeleteIcon />
|
|
99
|
+
// </DeleteCircleIcon>
|
|
100
|
+
// ),
|
|
101
|
+
// },
|
|
102
|
+
// ];
|
|
50
103
|
|
|
51
|
-
const
|
|
52
|
-
{ key: 'date', title: 'Date'
|
|
53
|
-
{ key: 'description', title: 'Description'
|
|
104
|
+
const column = [
|
|
105
|
+
{ key: 'date', title: 'Date' },
|
|
106
|
+
{ key: 'description', title: 'Description' },
|
|
107
|
+
{ key: 'amount', title: 'Amount' },
|
|
108
|
+
{ key: 'status', title: 'Status' },
|
|
109
|
+
{ key: 'action', title: 'Action' },
|
|
110
|
+
];
|
|
111
|
+
const Data = [
|
|
54
112
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<AmountSymbol>£</AmountSymbol>
|
|
61
|
-
{record.status ? (
|
|
62
|
-
<StyledAmountInput
|
|
63
|
-
type="text"
|
|
64
|
-
value={record.amount}
|
|
65
|
-
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
66
|
-
handleAmountChange(e.target.value, record.id)
|
|
67
|
-
}
|
|
68
|
-
/>
|
|
69
|
-
) : (
|
|
70
|
-
<div>{record.amount}</div>
|
|
71
|
-
)}
|
|
72
|
-
</AmountContainer>
|
|
73
|
-
),
|
|
113
|
+
date: '17/05/2024',
|
|
114
|
+
description: 'Delivery Success - 17/05/2024',
|
|
115
|
+
amount: '£0.00',
|
|
116
|
+
status: '2024-06-02 - Moreham Wood Direct - 34113',
|
|
117
|
+
action: <DustbinIcon />,
|
|
74
118
|
},
|
|
75
119
|
{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<>
|
|
82
|
-
Invoice : <SuccessText>{record.status}</SuccessText>
|
|
83
|
-
</>
|
|
84
|
-
) : (
|
|
85
|
-
'Awaiting Invoice'
|
|
86
|
-
)}
|
|
87
|
-
</StatusWrapper>
|
|
88
|
-
),
|
|
120
|
+
date: '17/05/2024',
|
|
121
|
+
description: 'Delivery Success - 17/05/2024',
|
|
122
|
+
amount: '£0.45',
|
|
123
|
+
status: '2024-06-02 - Moreham Wood Direct - 34113',
|
|
124
|
+
action: <DustbinIcon />,
|
|
89
125
|
},
|
|
90
126
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
127
|
+
date: '17/05/2024',
|
|
128
|
+
description: 'Delivery Success - 17/05/2024',
|
|
129
|
+
amount: '£0.00',
|
|
130
|
+
status: '',
|
|
131
|
+
action: <DustbinIcon />,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
date: '17/05/2024',
|
|
135
|
+
description: 'Delivery Success - 17/05/2024',
|
|
136
|
+
amount: '£0.78',
|
|
137
|
+
status: 'Awaiting Invoice',
|
|
138
|
+
action: <DustbinIcon />,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
date: '17/05/2024',
|
|
142
|
+
description: 'Delivery Success - 17/05/2024',
|
|
143
|
+
amount: '£0.108',
|
|
144
|
+
status: 'Awaiting',
|
|
145
|
+
action: <DustbinIcon />,
|
|
98
146
|
},
|
|
99
147
|
];
|
|
100
|
-
|
|
101
148
|
return (
|
|
102
149
|
<OrderActionModal
|
|
103
150
|
headerTitle="Charges For"
|
|
@@ -105,13 +152,13 @@ function ChargeLog() {
|
|
|
105
152
|
onSubmit={() => {}}
|
|
106
153
|
submitBtnTitle="Save Details"
|
|
107
154
|
showAdditionalInfo
|
|
108
|
-
infoText=
|
|
155
|
+
infoText={infoText}
|
|
109
156
|
>
|
|
110
157
|
<ContentContainer>
|
|
111
158
|
<Heading> PRODUCTS </Heading>
|
|
112
159
|
<AntTable
|
|
113
|
-
columns={
|
|
114
|
-
data={
|
|
160
|
+
columns={column}
|
|
161
|
+
data={Data}
|
|
115
162
|
onSelectChange={(value: any, record: ChargeLogData) =>
|
|
116
163
|
console.log('Selected value:', value, 'for record:', record)
|
|
117
164
|
}
|
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import OrderActionsDropdown from '../../../Dropdown';
|
|
3
|
+
import { useOrderStaticData } from '../../../../store';
|
|
4
|
+
import { capitalize } from '../../../../utils';
|
|
3
5
|
|
|
4
6
|
function ActionDropdown() {
|
|
7
|
+
const [orderStaticData] = useOrderStaticData();
|
|
8
|
+
const [actionTypeOptions, setActionTypeOptions] = useState<any[]>([]);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (orderStaticData) {
|
|
12
|
+
const options = orderStaticData?.order_contact_action_type?.map(
|
|
13
|
+
(option: any) => ({
|
|
14
|
+
label: capitalize(option.type.replaceAll('_', ' ')),
|
|
15
|
+
value: option.id,
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
setActionTypeOptions(options);
|
|
19
|
+
}
|
|
20
|
+
}, [orderStaticData]);
|
|
21
|
+
|
|
5
22
|
const onSelect = () => {};
|
|
6
23
|
const onSearch = () => {};
|
|
7
24
|
|
|
8
|
-
const options = [
|
|
9
|
-
{ label: 'small', value: 'small' },
|
|
10
|
-
{ label: 'medium', value: 'medium' },
|
|
11
|
-
{ label: 'large', value: 'large' },
|
|
12
|
-
];
|
|
13
|
-
|
|
14
25
|
return (
|
|
15
26
|
<OrderActionsDropdown
|
|
16
27
|
label="Action"
|
|
17
28
|
placeholder="Select Action"
|
|
18
|
-
options={
|
|
29
|
+
options={actionTypeOptions}
|
|
30
|
+
value={actionTypeOptions?.find(option => option.value === 7)}
|
|
19
31
|
onSelect={onSelect}
|
|
20
32
|
onSearch={onSearch}
|
|
21
|
-
className=
|
|
33
|
+
className="action-dropdown"
|
|
22
34
|
/>
|
|
23
35
|
);
|
|
24
36
|
}
|
|
@@ -2,11 +2,68 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Input } from 'antd';
|
|
4
4
|
|
|
5
|
+
import { handleKeyDown } from '../../../../utils';
|
|
6
|
+
import {
|
|
7
|
+
useErrorConfirmOrder,
|
|
8
|
+
useOrderDetailsConfirmOrder,
|
|
9
|
+
} from '../../../store';
|
|
10
|
+
|
|
5
11
|
function ContactMobile() {
|
|
12
|
+
const [orderDetails, setOrderDetails] = useOrderDetailsConfirmOrder();
|
|
13
|
+
const orderRecipient = orderDetails?.order_recipient;
|
|
14
|
+
const [errors, setErrors] = useErrorConfirmOrder();
|
|
15
|
+
|
|
16
|
+
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
const val = e.target.value;
|
|
18
|
+
const updatedOrderRecipient = {
|
|
19
|
+
...(orderRecipient === null
|
|
20
|
+
? { contact_mobile: val }
|
|
21
|
+
: { ...orderRecipient, contact_mobile: val }),
|
|
22
|
+
};
|
|
23
|
+
setOrderDetails(prev => {
|
|
24
|
+
return {
|
|
25
|
+
...prev,
|
|
26
|
+
order_recipient: updatedOrderRecipient,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (e.target.value) {
|
|
31
|
+
if (e.target.value.length < 10) {
|
|
32
|
+
setErrors(prevErrors => ({
|
|
33
|
+
...prevErrors,
|
|
34
|
+
mobileError: 'Phone number must be at least 10 digits.',
|
|
35
|
+
}));
|
|
36
|
+
} else if (e.target.value.length > 11) {
|
|
37
|
+
setErrors(prevErrors => ({
|
|
38
|
+
...prevErrors,
|
|
39
|
+
mobileError: 'Phone number must not exceed 10 digits.',
|
|
40
|
+
}));
|
|
41
|
+
} else {
|
|
42
|
+
setErrors(prevErrors => ({
|
|
43
|
+
...prevErrors,
|
|
44
|
+
mobileError: '',
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
setErrors(prevErrors => ({
|
|
49
|
+
...prevErrors,
|
|
50
|
+
mobileError: '',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
6
54
|
return (
|
|
7
55
|
<Container>
|
|
8
56
|
<Label>Contact Mobile</Label>
|
|
9
|
-
<Input
|
|
57
|
+
<Input
|
|
58
|
+
name="contact-work"
|
|
59
|
+
type="text"
|
|
60
|
+
placeholder="Mobile Number"
|
|
61
|
+
style={{ borderRadius: '15px' }}
|
|
62
|
+
value={orderRecipient?.contact_mobile || ''}
|
|
63
|
+
onKeyDown={handleKeyDown}
|
|
64
|
+
onChange={onChange}
|
|
65
|
+
/>
|
|
66
|
+
{errors.mobileError && <ErrorText>{errors.mobileError}</ErrorText>}
|
|
10
67
|
</Container>
|
|
11
68
|
);
|
|
12
69
|
}
|
|
@@ -25,4 +82,10 @@ const Container = styled.div`
|
|
|
25
82
|
gap: 6px;
|
|
26
83
|
`;
|
|
27
84
|
|
|
85
|
+
const ErrorText = styled.span`
|
|
86
|
+
color: red;
|
|
87
|
+
font-size: 0.85rem;
|
|
88
|
+
margin-top: 4px;
|
|
89
|
+
`;
|
|
90
|
+
|
|
28
91
|
export default ContactMobile;
|
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactPhone.tsx
CHANGED
|
@@ -2,11 +2,71 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Input } from 'antd';
|
|
4
4
|
|
|
5
|
+
import { handleKeyDown } from '../../../../utils';
|
|
6
|
+
import {
|
|
7
|
+
useErrorConfirmOrder,
|
|
8
|
+
useOrderDetailsConfirmOrder,
|
|
9
|
+
} from '../../../store';
|
|
10
|
+
|
|
5
11
|
function ContactPhone() {
|
|
12
|
+
const [orderDetails, setOrderDetails] = useOrderDetailsConfirmOrder();
|
|
13
|
+
const orderRecipient = orderDetails?.order_recipient;
|
|
14
|
+
const [errors, setErrors] = useErrorConfirmOrder();
|
|
15
|
+
|
|
16
|
+
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
const val = e.target.value;
|
|
18
|
+
const updatedOrderRecipient = {
|
|
19
|
+
...(orderRecipient === null
|
|
20
|
+
? { contact_home: val }
|
|
21
|
+
: { ...orderRecipient, contact_home: val }),
|
|
22
|
+
};
|
|
23
|
+
setOrderDetails(prev => {
|
|
24
|
+
return {
|
|
25
|
+
...prev,
|
|
26
|
+
order_recipient: updatedOrderRecipient,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (e.target.value) {
|
|
31
|
+
if (e.target.value.length < 10) {
|
|
32
|
+
setErrors(prevErrors => ({
|
|
33
|
+
...prevErrors,
|
|
34
|
+
homeContactError: 'Phone number must be at least 10 digits.',
|
|
35
|
+
}));
|
|
36
|
+
} else if (e.target.value.length > 11) {
|
|
37
|
+
setErrors(prevErrors => ({
|
|
38
|
+
...prevErrors,
|
|
39
|
+
homeContactError: 'Phone number must not exceed 10 digits.',
|
|
40
|
+
}));
|
|
41
|
+
} else {
|
|
42
|
+
setErrors(prevErrors => ({
|
|
43
|
+
...prevErrors,
|
|
44
|
+
homeContactError: '',
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
setErrors(prevErrors => ({
|
|
49
|
+
...prevErrors,
|
|
50
|
+
homeContactError: '',
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
6
55
|
return (
|
|
7
56
|
<Container>
|
|
8
57
|
<Label>Contact Phone</Label>
|
|
9
|
-
<Input
|
|
58
|
+
<Input
|
|
59
|
+
name="contact-home"
|
|
60
|
+
type="text"
|
|
61
|
+
placeholder="Home Number"
|
|
62
|
+
onKeyDown={handleKeyDown}
|
|
63
|
+
style={{ borderRadius: '15px' }}
|
|
64
|
+
value={orderRecipient?.contact_home || ''}
|
|
65
|
+
onChange={onChange}
|
|
66
|
+
/>
|
|
67
|
+
{errors.homeContactError && (
|
|
68
|
+
<ErrorText>{errors.homeContactError}</ErrorText>
|
|
69
|
+
)}
|
|
10
70
|
</Container>
|
|
11
71
|
);
|
|
12
72
|
}
|
|
@@ -25,4 +85,10 @@ const Container = styled.div`
|
|
|
25
85
|
gap: 6px;
|
|
26
86
|
`;
|
|
27
87
|
|
|
88
|
+
const ErrorText = styled.span`
|
|
89
|
+
color: red;
|
|
90
|
+
font-size: 0.85rem;
|
|
91
|
+
margin-top: 4px;
|
|
92
|
+
`;
|
|
93
|
+
|
|
28
94
|
export default ContactPhone;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import OrderActionsDropdown from '../../../Dropdown';
|
|
3
|
+
import { useOrderStaticData } from '../../../../store';
|
|
4
|
+
import { capitalize } from '../../../../utils';
|
|
3
5
|
|
|
4
6
|
function ContactTypeDropdown() {
|
|
7
|
+
const [orderStaticData] = useOrderStaticData();
|
|
8
|
+
const [contactTypeOptions, setContactTypeOptions] = useState<any[]>([]);
|
|
9
|
+
|
|
5
10
|
const onSelect = () => {};
|
|
6
11
|
const onSearch = () => {};
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (orderStaticData) {
|
|
15
|
+
const options = orderStaticData?.order_contact_type?.map(
|
|
16
|
+
(option: any) => ({
|
|
17
|
+
label: capitalize(option.type.replaceAll('_', ' ')),
|
|
18
|
+
value: option.id,
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
setContactTypeOptions(options);
|
|
22
|
+
}
|
|
23
|
+
}, [orderStaticData]);
|
|
13
24
|
|
|
14
25
|
return (
|
|
15
26
|
<OrderActionsDropdown
|
|
16
27
|
label="Contact Type"
|
|
17
28
|
placeholder="Select Contact Type"
|
|
18
|
-
options={
|
|
29
|
+
options={contactTypeOptions}
|
|
19
30
|
onSelect={onSelect}
|
|
20
31
|
onSearch={onSearch}
|
|
32
|
+
disabled={false}
|
|
21
33
|
className="contact-type-dropdown"
|
|
22
34
|
/>
|
|
23
35
|
);
|
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWith.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Input } from 'antd';
|
|
4
|
+
|
|
5
|
+
function ContactWith() {
|
|
6
|
+
return (
|
|
7
|
+
<Container>
|
|
8
|
+
<Label>Contact With</Label>
|
|
9
|
+
<Input style={{ borderRadius: '15px' }} />
|
|
10
|
+
</Container>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Label = styled.label`
|
|
15
|
+
color: #6a7378;
|
|
16
|
+
font-family: 'Lato', sans-serif;
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const Container = styled.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
gap: 6px;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export default ContactWith;
|
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWork.tsx
CHANGED
|
@@ -2,11 +2,69 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { Input } from 'antd';
|
|
4
4
|
|
|
5
|
+
import { handleKeyDown } from '../../../../utils';
|
|
6
|
+
import {
|
|
7
|
+
useErrorConfirmOrder,
|
|
8
|
+
useOrderDetailsConfirmOrder,
|
|
9
|
+
} from '../../../store';
|
|
10
|
+
|
|
5
11
|
function ContactWork() {
|
|
12
|
+
const [orderDetails, setOrderDetails] = useOrderDetailsConfirmOrder();
|
|
13
|
+
const orderRecipient = orderDetails?.order_recipient;
|
|
14
|
+
const [errors, setErrors] = useErrorConfirmOrder();
|
|
15
|
+
|
|
16
|
+
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
17
|
+
const val = e.target.value;
|
|
18
|
+
const updatedOrderRecipient = {
|
|
19
|
+
...(orderRecipient === null
|
|
20
|
+
? { contact_work: val }
|
|
21
|
+
: { ...orderRecipient, contact_work: val }),
|
|
22
|
+
};
|
|
23
|
+
setOrderDetails(prev => {
|
|
24
|
+
return {
|
|
25
|
+
...prev,
|
|
26
|
+
order_recipient: updatedOrderRecipient,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
if (e.target.value) {
|
|
30
|
+
if (e.target.value.length < 10) {
|
|
31
|
+
setErrors(prevErrors => ({
|
|
32
|
+
...prevErrors,
|
|
33
|
+
workContactError: 'Phone number must be at least 10 digits.',
|
|
34
|
+
}));
|
|
35
|
+
} else if (e.target.value.length > 11) {
|
|
36
|
+
setErrors(prevErrors => ({
|
|
37
|
+
...prevErrors,
|
|
38
|
+
workContactError: 'Phone number must not exceed 10 digits.',
|
|
39
|
+
}));
|
|
40
|
+
} else {
|
|
41
|
+
setErrors(prevErrors => ({
|
|
42
|
+
...prevErrors,
|
|
43
|
+
workContactError: '',
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
setErrors(prevErrors => ({
|
|
48
|
+
...prevErrors,
|
|
49
|
+
workContactError: '',
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
};
|
|
6
53
|
return (
|
|
7
54
|
<Container>
|
|
8
55
|
<Label>Contact Work</Label>
|
|
9
|
-
<Input
|
|
56
|
+
<Input
|
|
57
|
+
name="contact-work"
|
|
58
|
+
type="text"
|
|
59
|
+
placeholder="Work Number"
|
|
60
|
+
onKeyDown={handleKeyDown}
|
|
61
|
+
style={{ borderRadius: '15px' }}
|
|
62
|
+
value={orderRecipient?.contact_work || ''}
|
|
63
|
+
onChange={onChange}
|
|
64
|
+
/>
|
|
65
|
+
{errors.workContactError && (
|
|
66
|
+
<ErrorText>{errors.workContactError}</ErrorText>
|
|
67
|
+
)}
|
|
10
68
|
</Container>
|
|
11
69
|
);
|
|
12
70
|
}
|
|
@@ -25,4 +83,10 @@ const Container = styled.div`
|
|
|
25
83
|
gap: 6px;
|
|
26
84
|
`;
|
|
27
85
|
|
|
86
|
+
const ErrorText = styled.span`
|
|
87
|
+
color: red;
|
|
88
|
+
font-size: 0.85rem;
|
|
89
|
+
margin-top: 4px;
|
|
90
|
+
`;
|
|
91
|
+
|
|
28
92
|
export default ContactWork;
|
package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
import { DatePicker } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import {
|
|
6
|
+
useConfirmOrderDate,
|
|
7
|
+
useOrderDetailsConfirmOrder,
|
|
8
|
+
} from '../../../store';
|
|
9
|
+
import { format, isValid } from 'date-fns';
|
|
4
10
|
|
|
5
11
|
function DeliveryDate() {
|
|
6
|
-
const
|
|
12
|
+
const [orderDetails] = useOrderDetailsConfirmOrder();
|
|
13
|
+
const [deliveryDate, setDeliveryDate] = useConfirmOrderDate();
|
|
14
|
+
|
|
15
|
+
const actionDate = orderDetails?.action_date
|
|
16
|
+
? dayjs(orderDetails?.action_date)
|
|
17
|
+
: null;
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (actionDate) {
|
|
21
|
+
setDeliveryDate(actionDate);
|
|
22
|
+
} else {
|
|
23
|
+
setDeliveryDate(null);
|
|
24
|
+
}
|
|
25
|
+
}, [orderDetails]);
|
|
26
|
+
|
|
27
|
+
const handleDateChange = (date: any | null) => {
|
|
28
|
+
if (date && isValid(date.$d)) {
|
|
29
|
+
const formattedDate = format(new Date(date.$d), 'yyyy-MM-dd');
|
|
30
|
+
setDeliveryDate(formattedDate);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const today = new Date();
|
|
34
|
+
const tomorrow = new Date(today);
|
|
35
|
+
tomorrow.setDate(today.getDate() + 1);
|
|
36
|
+
|
|
7
37
|
return (
|
|
8
38
|
<Container>
|
|
9
39
|
<Label>Delivery Date</Label>
|
|
10
|
-
<DatePicker
|
|
40
|
+
<DatePicker
|
|
41
|
+
onChange={handleDateChange}
|
|
42
|
+
format="DD/MM/YYYY"
|
|
43
|
+
value={deliveryDate ? dayjs(deliveryDate) : null}
|
|
44
|
+
style={{ borderRadius: '15px' }}
|
|
45
|
+
minDate={dayjs(tomorrow)}
|
|
46
|
+
/>
|
|
11
47
|
</Container>
|
|
12
48
|
);
|
|
13
49
|
}
|
|
@@ -25,6 +61,7 @@ const Container = styled.div`
|
|
|
25
61
|
flex-direction: column;
|
|
26
62
|
gap: 6px;
|
|
27
63
|
flex: 1;
|
|
64
|
+
white-space: nowrap;
|
|
28
65
|
`;
|
|
29
66
|
|
|
30
67
|
export default DeliveryDate;
|