@bjsdistribution/dms-client-return 0.1.20-dev → 0.1.21-dev
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/client-portal/DateFilterStore.d.ts +15 -0
- package/dist/components/order-view/DynamicTable.d.ts +2 -1
- package/dist/components/order-view/general-information/Status.d.ts +1 -1
- package/dist/components/order-view/general-information/index.d.ts +1 -1
- package/dist/components/order-view/index.d.ts +1 -1
- package/dist/components/order-view/notes/AddNote.d.ts +1 -0
- package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
- package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
- package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
- package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
- package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
- package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
- package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
- package/dist/components/order-view/order-actions/types.d.ts +3 -3
- package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/order-details/index.d.ts +1 -1
- package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
- package/dist/components/order-view/products-info/index.d.ts +1 -1
- package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
- package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
- package/dist/components/order-view/store.d.ts +15 -3
- package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
- package/dist/components/order-view/types.d.ts +49 -1
- package/dist/components/order-view/utils.d.ts +3 -0
- package/dist/components/order-view/view-reminder/ViewReminder.d.ts +2 -0
- package/dist/dms-client-return.cjs.development.js +4364 -1614
- 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 +4429 -1679
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +6 -4
- package/src/assets/icons/ActionIcon.tsx +1 -1
- package/src/assets/icons/ArrowDownIcon.tsx +2 -2
- package/src/components/client-portal/DateFilterStore.ts +94 -0
- package/src/components/client-portal/OutstandingTable.tsx +15 -72
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +41 -87
- package/src/components/client-portal/ReturnRTFilters.tsx +0 -2
- package/src/components/client-portal/ReturnSearchBar.tsx +41 -152
- package/src/components/client-portal/ReturnStatus.tsx +33 -84
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +12 -23
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +8 -85
- package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +11 -18
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +43 -15
- package/src/components/order-daily-overview/index.tsx +23 -4
- package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +6 -1
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +3 -0
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
- package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
- package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +25 -11
- package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
- package/src/components/order-view/DynamicTable.tsx +21 -8
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
- package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
- package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
- package/src/components/order-view/general-information/Status.tsx +92 -18
- package/src/components/order-view/general-information/index.tsx +2 -2
- package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
- package/src/components/order-view/index.tsx +50 -8
- package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
- package/src/components/order-view/notes/AddNote.tsx +95 -65
- package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
- package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
- package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
- package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
- package/src/components/order-view/notification/index.tsx +100 -55
- package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
- package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
- package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
- package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
- package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
- package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
- package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
- package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
- package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
- package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
- package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
- package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
- package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
- package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
- package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
- package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
- package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
- package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
- package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
- package/src/components/order-view/order-actions/index.tsx +18 -5
- package/src/components/order-view/order-actions/store.ts +1 -1
- package/src/components/order-view/order-actions/types.ts +3 -3
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +7 -1
- package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
- package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
- package/src/components/order-view/order-details/index.tsx +5 -2
- package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
- package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
- package/src/components/order-view/products-info/index.tsx +10 -6
- package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
- package/src/components/order-view/store.ts +107 -1
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
- package/src/components/order-view/types.ts +54 -1
- package/src/components/order-view/utils.ts +37 -0
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
- package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
- package/src/components/store.ts +1 -1
- package/src/index.tsx +6 -3
|
@@ -1,51 +1,75 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { Button } from '@bjsdistribution/dms-component-library';
|
|
3
|
+
import { Button, CrossIcon } from '@bjsdistribution/dms-component-library';
|
|
4
4
|
import UploadIcon from '../../../../../assets/icons/UploadIcon';
|
|
5
5
|
import { atom, useAtom } from 'jotai';
|
|
6
6
|
import { notification } from 'antd';
|
|
7
|
-
|
|
7
|
+
// Store uploaded files
|
|
8
8
|
export const uploadedFilesAtom = atom<File[]>([]);
|
|
9
9
|
|
|
10
|
-
// Allowed photo
|
|
11
|
-
const
|
|
10
|
+
// Allowed photo MIME types
|
|
11
|
+
const allowedFileTypes = ['image/jpeg', 'image/png'];
|
|
12
12
|
|
|
13
13
|
function DocFileUpload() {
|
|
14
14
|
const [uploadedFiles, setUploadedFiles] = useAtom(uploadedFilesAtom);
|
|
15
15
|
const [dragging, setDragging] = useState(false);
|
|
16
16
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
17
17
|
|
|
18
|
+
const isDuplicate = (file: File) =>
|
|
19
|
+
uploadedFiles?.some(
|
|
20
|
+
existing =>
|
|
21
|
+
existing?.name === file?.name &&
|
|
22
|
+
existing?.size === file?.size &&
|
|
23
|
+
existing?.lastModified === file?.lastModified
|
|
24
|
+
);
|
|
25
|
+
|
|
18
26
|
const handleFileUpload = (files: FileList | null) => {
|
|
19
|
-
if (files)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
27
|
+
if (!files) return;
|
|
28
|
+
|
|
29
|
+
const validFiles: File[] = [];
|
|
30
|
+
const rejectedFiles: File[] = [];
|
|
31
|
+
|
|
32
|
+
Array.from(files).forEach(file => {
|
|
33
|
+
const isValidType = allowedFileTypes?.includes(file.type);
|
|
34
|
+
const isNew = !isDuplicate(file);
|
|
23
35
|
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
validFiles.forEach(file => {
|
|
27
|
-
notification.success({
|
|
28
|
-
message: 'Success',
|
|
29
|
-
description: `${file.name} added successfully.`,
|
|
30
|
-
});
|
|
31
|
-
});
|
|
36
|
+
if (isValidType && isNew) {
|
|
37
|
+
validFiles?.push(file);
|
|
32
38
|
} else {
|
|
33
|
-
|
|
34
|
-
message: 'Error',
|
|
35
|
-
description: 'Only photos (JPEG, PNG) and videos (MP4) are allowed.',
|
|
36
|
-
});
|
|
39
|
+
rejectedFiles?.push(file);
|
|
37
40
|
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (validFiles?.length > 0) {
|
|
44
|
+
setUploadedFiles(prev => [...prev, ...validFiles]);
|
|
45
|
+
validFiles?.forEach(file =>
|
|
46
|
+
notification.success({
|
|
47
|
+
message: 'Success',
|
|
48
|
+
description: `${file.name} added successfully.`,
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (rejectedFiles?.length > 0) {
|
|
54
|
+
notification.error({
|
|
55
|
+
message: 'Some files were not added',
|
|
56
|
+
description: 'Either they were duplicates or not JPEG/PNG format.',
|
|
57
|
+
});
|
|
38
58
|
}
|
|
39
59
|
};
|
|
40
60
|
|
|
61
|
+
const handleRemoveFile = (indexToRemove: number) => {
|
|
62
|
+
const updated = uploadedFiles?.filter((_, i) => i !== indexToRemove);
|
|
63
|
+
setUploadedFiles(updated);
|
|
64
|
+
notification.info({ message: 'File Removed' });
|
|
65
|
+
};
|
|
66
|
+
|
|
41
67
|
const handleDragOver = (e: React.DragEvent) => {
|
|
42
68
|
e.preventDefault();
|
|
43
69
|
setDragging(true);
|
|
44
70
|
};
|
|
45
71
|
|
|
46
|
-
const handleDragLeave = () =>
|
|
47
|
-
setDragging(false);
|
|
48
|
-
};
|
|
72
|
+
const handleDragLeave = () => setDragging(false);
|
|
49
73
|
|
|
50
74
|
const handleDrop = (e: React.DragEvent) => {
|
|
51
75
|
e.preventDefault();
|
|
@@ -55,13 +79,10 @@ function DocFileUpload() {
|
|
|
55
79
|
|
|
56
80
|
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
57
81
|
handleFileUpload(e.target.files);
|
|
82
|
+
e.target.value = ''; // Allow re-upload of same file
|
|
58
83
|
};
|
|
59
84
|
|
|
60
|
-
const handleButtonClick = () =>
|
|
61
|
-
if (fileInputRef.current) {
|
|
62
|
-
fileInputRef.current.click();
|
|
63
|
-
}
|
|
64
|
-
};
|
|
85
|
+
const handleButtonClick = () => fileInputRef.current?.click();
|
|
65
86
|
|
|
66
87
|
return (
|
|
67
88
|
<MainContainer>
|
|
@@ -73,7 +94,7 @@ function DocFileUpload() {
|
|
|
73
94
|
>
|
|
74
95
|
<Container>
|
|
75
96
|
<UploadButton
|
|
76
|
-
|
|
97
|
+
type="button"
|
|
77
98
|
shape="rounded"
|
|
78
99
|
onClick={handleButtonClick}
|
|
79
100
|
>
|
|
@@ -81,30 +102,32 @@ function DocFileUpload() {
|
|
|
81
102
|
</UploadButton>
|
|
82
103
|
<FileInput
|
|
83
104
|
type="file"
|
|
84
|
-
|
|
105
|
+
accept={allowedFileTypes.join(',')}
|
|
85
106
|
multiple
|
|
86
107
|
onChange={handleInputChange}
|
|
87
|
-
accept="image/jpeg, image/png, video/mp4"
|
|
88
108
|
ref={fileInputRef}
|
|
89
109
|
/>
|
|
90
110
|
<IconContainer>
|
|
91
111
|
<UploadIcon />
|
|
92
112
|
</IconContainer>
|
|
93
113
|
<TextContainer>
|
|
94
|
-
<Text1>or drag and drop your
|
|
95
|
-
<Text2>Photos (JPEG, PNG)
|
|
114
|
+
<Text1>or drag and drop your files</Text1>
|
|
115
|
+
<Text2>Photos (JPEG, PNG) Only</Text2>
|
|
96
116
|
</TextContainer>
|
|
97
117
|
</Container>
|
|
98
118
|
</DraggerContainer>
|
|
99
119
|
|
|
100
|
-
{/* Uploaded Files List */}
|
|
101
120
|
{uploadedFiles.length > 0 && (
|
|
102
121
|
<UploadedFilesContainer>
|
|
103
122
|
<FilesTitle>Uploaded Files:</FilesTitle>
|
|
104
123
|
<FilesList>
|
|
105
|
-
{uploadedFiles
|
|
106
|
-
<FileItem key={index}>
|
|
124
|
+
{uploadedFiles?.map((file, index) => (
|
|
125
|
+
<FileItem key={`${file.name}-${index}`}>
|
|
107
126
|
{file.name} - {(file.size / 1024).toFixed(2)} KB
|
|
127
|
+
<CrossIcon
|
|
128
|
+
style={{ cursor: 'pointer', marginLeft: 8 }}
|
|
129
|
+
onClick={() => handleRemoveFile(index)}
|
|
130
|
+
/>
|
|
108
131
|
</FileItem>
|
|
109
132
|
))}
|
|
110
133
|
</FilesList>
|
|
@@ -129,30 +152,24 @@ const DraggerContainer = styled.div<{ dragging: boolean }>`
|
|
|
129
152
|
cursor: pointer;
|
|
130
153
|
`;
|
|
131
154
|
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
text-transform: lowercase;
|
|
140
|
-
padding: 0;
|
|
141
|
-
margin: 0;
|
|
155
|
+
const Container = styled.div`
|
|
156
|
+
display: flex;
|
|
157
|
+
gap: 8px;
|
|
158
|
+
padding: 6px;
|
|
159
|
+
align-items: center;
|
|
160
|
+
border-radius: 30px;
|
|
161
|
+
background: #fff;
|
|
142
162
|
`;
|
|
143
163
|
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
const Text1 = styled.p`
|
|
147
|
-
color: #aea9a1;
|
|
148
|
-
text-align: left;
|
|
149
|
-
font-family: 'Roboto', sans-serif;
|
|
164
|
+
const UploadButton = styled(Button)`
|
|
150
165
|
font-size: 14px;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
166
|
+
padding: 7px 20px;
|
|
167
|
+
height: auto;
|
|
168
|
+
border-radius: 20px;
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
const FileInput = styled.input`
|
|
172
|
+
display: none;
|
|
156
173
|
`;
|
|
157
174
|
|
|
158
175
|
const IconContainer = styled.div`
|
|
@@ -162,24 +179,22 @@ const IconContainer = styled.div`
|
|
|
162
179
|
align-items: center;
|
|
163
180
|
`;
|
|
164
181
|
|
|
165
|
-
const
|
|
166
|
-
height: 16px;
|
|
167
|
-
font-size: 14px;
|
|
168
|
-
padding: 7px 20px;
|
|
169
|
-
`;
|
|
182
|
+
const TextContainer = styled.div``;
|
|
170
183
|
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
border-radius: 30px;
|
|
178
|
-
background: #fff;
|
|
184
|
+
const Text1 = styled.p`
|
|
185
|
+
color: #aea9a1;
|
|
186
|
+
font-family: 'Roboto', sans-serif;
|
|
187
|
+
font-size: 14px;
|
|
188
|
+
font-weight: 500;
|
|
189
|
+
margin: 0;
|
|
179
190
|
`;
|
|
180
191
|
|
|
181
|
-
const
|
|
182
|
-
|
|
192
|
+
const Text2 = styled.p`
|
|
193
|
+
color: #bcbab7;
|
|
194
|
+
font-family: 'Roboto', sans-serif;
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
font-weight: 400;
|
|
197
|
+
margin: 0;
|
|
183
198
|
`;
|
|
184
199
|
|
|
185
200
|
const UploadedFilesContainer = styled.div`
|
|
@@ -195,6 +210,8 @@ const FilesTitle = styled.h4`
|
|
|
195
210
|
`;
|
|
196
211
|
|
|
197
212
|
const FilesList = styled.ul`
|
|
213
|
+
overflow: auto;
|
|
214
|
+
max-height: 200px;
|
|
198
215
|
list-style-type: none;
|
|
199
216
|
padding: 0;
|
|
200
217
|
`;
|
|
@@ -204,6 +221,9 @@ const FileItem = styled.li`
|
|
|
204
221
|
font-size: 14px;
|
|
205
222
|
color: #333;
|
|
206
223
|
margin: 5px 0;
|
|
224
|
+
display: flex;
|
|
225
|
+
justify-content: space-between;
|
|
226
|
+
align-items: center;
|
|
207
227
|
`;
|
|
208
228
|
|
|
209
229
|
export default DocFileUpload;
|
|
@@ -66,38 +66,55 @@ function AddResources() {
|
|
|
66
66
|
setSelectedType(selectedOption.value);
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
const handleSubmit = async () => {
|
|
71
|
-
if (!uploadedFiles) {
|
|
71
|
+
if (!uploadedFiles || uploadedFiles.length === 0) {
|
|
72
72
|
notification.error({ message: 'No files selected' });
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const formData = new FormData();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
}
|
|
77
|
+
uploadedFiles.forEach(file => {
|
|
78
|
+
formData.append('files', file); // Adjust key as per API
|
|
79
|
+
});
|
|
82
80
|
|
|
83
81
|
try {
|
|
84
|
-
|
|
82
|
+
const response = (await callResourcesAPI({
|
|
85
83
|
payload: formData,
|
|
86
84
|
})) as {
|
|
87
85
|
code: number | null;
|
|
88
86
|
error?: string | null | undefined;
|
|
89
87
|
[key: string]: any;
|
|
90
88
|
};
|
|
89
|
+
|
|
91
90
|
console.log('Upload successful:', response);
|
|
92
91
|
notification.success({ message: 'Files uploaded successfully' });
|
|
93
|
-
|
|
92
|
+
|
|
93
|
+
onClose(); // Close modal
|
|
94
94
|
setResources(false);
|
|
95
95
|
|
|
96
96
|
setTimeout(() => {
|
|
97
97
|
setResources(true);
|
|
98
98
|
}, 1000);
|
|
99
99
|
} catch (error) {
|
|
100
|
-
|
|
100
|
+
const err = error as any;
|
|
101
|
+
const status = err?.response?.status;
|
|
102
|
+
const rawError = err?.response?.data?.error || '';
|
|
103
|
+
|
|
104
|
+
let errMsg = 'An unexpected error occurred.';
|
|
105
|
+
|
|
106
|
+
if (status === 413) {
|
|
107
|
+
errMsg = 'File is too large. Please upload a smaller file.';
|
|
108
|
+
} else if (rawError.includes('413')) {
|
|
109
|
+
errMsg = 'File size exceeds the allowed limit.';
|
|
110
|
+
} else if (err?.message) {
|
|
111
|
+
errMsg = err.message;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
notification.error({
|
|
115
|
+
message: 'Upload Failed',
|
|
116
|
+
description: errMsg,
|
|
117
|
+
});
|
|
101
118
|
}
|
|
102
119
|
};
|
|
103
120
|
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
import { useCancelOrderProducts, useOrderStaticData } from '../../../store';
|
|
2
|
+
import { CancelOrderProductsType } from '../../../types';
|
|
1
3
|
import OrderActionsDropdown from '../../Dropdown';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
function ReturnAction() {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
+
const [orderStaticData] = useOrderStaticData();
|
|
7
|
+
const [, setCancelOrderProducts] = useCancelOrderProducts();
|
|
8
|
+
// const onSearch = () => {};
|
|
9
|
+
|
|
10
|
+
const returnActionOptions = orderStaticData?.order_product_return_action?.map(
|
|
11
|
+
(option: any) => ({
|
|
12
|
+
label: option?.value,
|
|
13
|
+
value: option?.value,
|
|
14
|
+
})
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const onSelect = (selectedValue: any) => {
|
|
18
|
+
setCancelOrderProducts((prev: CancelOrderProductsType[]) =>
|
|
19
|
+
prev?.map((item: any) => ({
|
|
20
|
+
...item,
|
|
21
|
+
action: 'return',
|
|
22
|
+
return_action: selectedValue,
|
|
23
|
+
}))
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
6
27
|
return (
|
|
7
28
|
<OrderActionsDropdown
|
|
8
29
|
label="Return Action"
|
|
9
30
|
placeholder="Select Return Action"
|
|
10
|
-
options={
|
|
31
|
+
options={returnActionOptions}
|
|
11
32
|
onSelect={onSelect}
|
|
12
|
-
onSearch={onSearch}
|
|
33
|
+
// onSearch={onSearch}
|
|
13
34
|
/>
|
|
14
35
|
);
|
|
15
36
|
}
|
|
@@ -1,15 +1,35 @@
|
|
|
1
|
+
import { useCancelOrderProducts, useOrderStaticData } from '../../../store';
|
|
2
|
+
import { CancelOrderProductsType } from '../../../types';
|
|
1
3
|
import OrderActionsDropdown from '../../Dropdown';
|
|
2
4
|
import React from 'react';
|
|
3
5
|
function ReturnReason() {
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
+
const [orderStaticData] = useOrderStaticData();
|
|
7
|
+
const [, setCancelOrderProducts] = useCancelOrderProducts();
|
|
8
|
+
|
|
9
|
+
const returnReasonsOptions = orderStaticData?.return_reasons?.map(
|
|
10
|
+
(option: any) => ({
|
|
11
|
+
label: option?.reason,
|
|
12
|
+
value: option?.reason,
|
|
13
|
+
})
|
|
14
|
+
);
|
|
15
|
+
const onSelect = (selectedValue: any) => {
|
|
16
|
+
setCancelOrderProducts((prev: CancelOrderProductsType[]) =>
|
|
17
|
+
prev?.map((item: any) => ({
|
|
18
|
+
...item,
|
|
19
|
+
action: 'return',
|
|
20
|
+
return_reason: selectedValue,
|
|
21
|
+
}))
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
// const onSearch = () => {};
|
|
25
|
+
|
|
6
26
|
return (
|
|
7
27
|
<OrderActionsDropdown
|
|
8
28
|
label="Return Reason"
|
|
9
29
|
placeholder="Select Return Reason"
|
|
10
|
-
options={
|
|
30
|
+
options={returnReasonsOptions}
|
|
11
31
|
onSelect={onSelect}
|
|
12
|
-
onSearch={onSearch}
|
|
32
|
+
// onSearch={onSearch}
|
|
13
33
|
/>
|
|
14
34
|
);
|
|
15
35
|
}
|
package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx
CHANGED
|
@@ -16,7 +16,11 @@ import { ApiResponse, OrdersType } from '../../../types';
|
|
|
16
16
|
import { useLoading } from '../../../../order-daily-overview/store/store';
|
|
17
17
|
import { notification } from 'antd';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
interface IProps {
|
|
20
|
+
callOrderAlertsApi: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const ClearBookingStatus = (props: IProps) => {
|
|
20
24
|
const [orderId] = useOrderId();
|
|
21
25
|
const [, setOrderDetails] = useOrderDetails();
|
|
22
26
|
const [, setPrevOrderDetails] = usePrevOrderDetails();
|
|
@@ -41,13 +45,16 @@ const ClearBookingStatus = () => {
|
|
|
41
45
|
method: 'GET',
|
|
42
46
|
performAction: false,
|
|
43
47
|
});
|
|
44
|
-
|
|
48
|
+
const callOrdersApi = async () => {
|
|
49
|
+
await props?.callOrderAlertsApi();
|
|
50
|
+
};
|
|
45
51
|
useEffect(() => {
|
|
46
52
|
setLoading(loading);
|
|
47
53
|
if (fetchedData && fetchedData?.data) {
|
|
48
54
|
const requiredData = fetchedData?.data;
|
|
49
55
|
setOrderDetails(requiredData[0]);
|
|
50
56
|
setPrevOrderDetails(requiredData[0]);
|
|
57
|
+
callOrdersApi();
|
|
51
58
|
setCurrentAction(undefined);
|
|
52
59
|
}
|
|
53
60
|
if (
|
|
@@ -26,7 +26,11 @@ import { compareOrderDetailsStates, filterObject } from '../../../utils';
|
|
|
26
26
|
import { format } from 'date-fns';
|
|
27
27
|
import { useConfirmOrderDate } from '../../store';
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
interface IProps {
|
|
30
|
+
callOrderAlertsApi: any;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function ConfirmOrder(props: IProps) {
|
|
30
34
|
const [, setCurrentAction] = useCurrentAction();
|
|
31
35
|
const [orderDetails, setOrderDetails] = useOrderDetails();
|
|
32
36
|
const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();
|
|
@@ -201,6 +205,7 @@ function ConfirmOrder() {
|
|
|
201
205
|
case 'no_contact':
|
|
202
206
|
// await confirmDeliveryDate();
|
|
203
207
|
notificationCall();
|
|
208
|
+
await fetchStatusData();
|
|
204
209
|
break;
|
|
205
210
|
|
|
206
211
|
case 'precall':
|
|
@@ -209,6 +214,7 @@ function ConfirmOrder() {
|
|
|
209
214
|
}
|
|
210
215
|
// await confirmDeliveryDate();
|
|
211
216
|
sendComs();
|
|
217
|
+
await fetchStatusData();
|
|
212
218
|
break;
|
|
213
219
|
default:
|
|
214
220
|
break;
|
|
@@ -247,9 +253,6 @@ function ConfirmOrder() {
|
|
|
247
253
|
}
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
// Execute actions first
|
|
251
|
-
await executeActions();
|
|
252
|
-
|
|
253
256
|
const keysToRemovefromOrders = [
|
|
254
257
|
'order_locked',
|
|
255
258
|
'order_communications',
|
|
@@ -288,8 +291,6 @@ function ConfirmOrder() {
|
|
|
288
291
|
[key: string]: any;
|
|
289
292
|
};
|
|
290
293
|
|
|
291
|
-
await executeSendComs();
|
|
292
|
-
|
|
293
294
|
if (response?.data?.length > 0) {
|
|
294
295
|
const updatedOrder = response?.data[0];
|
|
295
296
|
setOrderDetails(updatedOrder);
|
|
@@ -300,10 +301,15 @@ function ConfirmOrder() {
|
|
|
300
301
|
}
|
|
301
302
|
}
|
|
302
303
|
|
|
304
|
+
// Execute actions first
|
|
305
|
+
await executeActions();
|
|
306
|
+
await executeSendComs();
|
|
307
|
+
|
|
303
308
|
if (orderId && deliveryDate) {
|
|
304
309
|
const formattedDate = format(new Date(deliveryDate), 'yyyy-MM-dd');
|
|
305
310
|
setDeliveryDate(formattedDate);
|
|
306
311
|
}
|
|
312
|
+
await props?.callOrderAlertsApi();
|
|
307
313
|
|
|
308
314
|
setCurrentAction(undefined);
|
|
309
315
|
};
|