@bjsdistribution/dms-client-return 0.1.20-dev → 0.1.20-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/common/date-picker/header/ClearDate.d.ts +1 -1
- package/dist/components/client-portal/DateFilterStore.d.ts +15 -0
- package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
- package/dist/components/order-daily-overview/header/route-header/ClientRouterHeader.d.ts +11 -0
- package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
- 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 +55 -1
- package/dist/components/order-view/utils.d.ts +11 -2
- package/dist/components/store.d.ts +1 -1
- package/dist/dms-client-return.cjs.development.js +7157 -4661
- 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 +7173 -4677
- 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 +139 -0
- package/src/components/client-portal/OutstandingTable.tsx +16 -72
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +42 -87
- package/src/components/client-portal/ReturnOverview.tsx +11 -2
- package/src/components/client-portal/ReturnRTFilters.tsx +140 -43
- package/src/components/client-portal/ReturnSearchBar.tsx +42 -153
- package/src/components/client-portal/ReturnStatus.tsx +33 -82
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +12 -23
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +9 -86
- package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
- package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -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 -35
- 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 +635 -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 +150 -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 +19 -10
- 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/customer-section/contact-info/ContactHome.tsx +102 -45
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +93 -34
- package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +88 -31
- package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
- 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/AssemblyType.tsx +9 -91
- package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
- 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 +113 -1
- package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
- package/src/components/order-view/types.ts +60 -1
- package/src/components/order-view/utils.ts +49 -33
- package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
- package/src/components/order-view/view-reminder/ViewReminder.tsx +31 -14
- package/src/components/store.ts +2 -2
- package/src/index.tsx +23 -5
- package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
- package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
- package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
- package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
- package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
- package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
- package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
- package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
- package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
- package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +0 -130
|
@@ -22,7 +22,15 @@ import {
|
|
|
22
22
|
useAllOrderStatus,
|
|
23
23
|
} from '../order-actions/store';
|
|
24
24
|
import { useParams, useSearchParams } from 'react-router-dom';
|
|
25
|
-
|
|
25
|
+
import { useClientPortal } from '../../store';
|
|
26
|
+
import { Skeleton } from 'antd';
|
|
27
|
+
type ReminderResponse = {
|
|
28
|
+
data: ApiResponse[];
|
|
29
|
+
stats_count: {
|
|
30
|
+
pending: number;
|
|
31
|
+
overdue: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
26
34
|
interface ApiResponse {
|
|
27
35
|
message: string;
|
|
28
36
|
code: number;
|
|
@@ -44,7 +52,7 @@ function Notification() {
|
|
|
44
52
|
const [closedReminders, setCloseReminders] = useState([]);
|
|
45
53
|
const [activeTasks, setActiveTasks] = useState([]);
|
|
46
54
|
const [closedTasks, setCloseTasks] = useState([]);
|
|
47
|
-
const [idOfRoute
|
|
55
|
+
const [idOfRoute] = useRouteId();
|
|
48
56
|
const [, setStatusVal] = useAllOrderStatus();
|
|
49
57
|
const [searchParams] = useSearchParams();
|
|
50
58
|
const [orderAlertsData, setOrderAlertsData] = useOrderAlertsData();
|
|
@@ -52,6 +60,7 @@ function Notification() {
|
|
|
52
60
|
const { id } = useParams();
|
|
53
61
|
const [orderId, setOrderId] = useOrderId();
|
|
54
62
|
const routeId = orderData?.order_routes?.route_id;
|
|
63
|
+
const [isClientPortal] = useClientPortal();
|
|
55
64
|
|
|
56
65
|
useEffect(() => {
|
|
57
66
|
if (orderIdParams) {
|
|
@@ -73,7 +82,12 @@ function Notification() {
|
|
|
73
82
|
endpoint: `/v1/task/`,
|
|
74
83
|
method: 'GET',
|
|
75
84
|
pagination: { is_pagination: false },
|
|
76
|
-
filters:
|
|
85
|
+
filters: isClientPortal
|
|
86
|
+
? [
|
|
87
|
+
{ field: 'is_private', op: '=', value: 'false' },
|
|
88
|
+
{ field: 'order_id', op: '=', value: orderId },
|
|
89
|
+
]
|
|
90
|
+
: [{ field: 'order_id', op: '=', value: orderId }],
|
|
77
91
|
});
|
|
78
92
|
|
|
79
93
|
//reminder get
|
|
@@ -81,15 +95,20 @@ function Notification() {
|
|
|
81
95
|
data: fetchedReminderData,
|
|
82
96
|
loading: reminderLoading,
|
|
83
97
|
fetchData: callReminderApi,
|
|
84
|
-
} = useAxios<{
|
|
85
|
-
data: ApiResponse[];
|
|
86
|
-
}>({
|
|
98
|
+
} = useAxios<ReminderResponse>({
|
|
87
99
|
endpoint: `/v1/task/reminder/get/`,
|
|
88
100
|
method: 'GET',
|
|
89
101
|
pagination: { is_pagination: false },
|
|
90
102
|
filters: [{ field: 'order_id', op: '=', value: orderId }],
|
|
91
103
|
});
|
|
92
104
|
|
|
105
|
+
//reminder data set
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
108
|
+
setReminderNotifyData(fetchedReminderData?.data);
|
|
109
|
+
}
|
|
110
|
+
}, [fetchedReminderData]);
|
|
111
|
+
|
|
93
112
|
useEffect(() => {
|
|
94
113
|
setStatusVal(orderData?.status_value);
|
|
95
114
|
}, [orderData?.status_value]);
|
|
@@ -107,13 +126,6 @@ function Notification() {
|
|
|
107
126
|
}
|
|
108
127
|
}, [unresolvedLoading, fetchedUnresolvedData]);
|
|
109
128
|
|
|
110
|
-
//reminder data set
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (fetchedReminderData && fetchedReminderData?.data) {
|
|
113
|
-
setReminderNotifyData(fetchedReminderData?.data);
|
|
114
|
-
}
|
|
115
|
-
}, [reminderLoading]);
|
|
116
|
-
|
|
117
129
|
// Route API calling...
|
|
118
130
|
const { data: fetchedData, fetchData: fetchRoute } = useAxios<{
|
|
119
131
|
data: ApiResponse[];
|
|
@@ -126,9 +138,6 @@ function Notification() {
|
|
|
126
138
|
if (idOfRoute !== null && idOfRoute !== undefined) {
|
|
127
139
|
fetchRoute();
|
|
128
140
|
}
|
|
129
|
-
return () => {
|
|
130
|
-
setRouteId(null);
|
|
131
|
-
};
|
|
132
141
|
}, [idOfRoute]);
|
|
133
142
|
|
|
134
143
|
const {
|
|
@@ -153,7 +162,7 @@ function Notification() {
|
|
|
153
162
|
if (orderId == null) return;
|
|
154
163
|
|
|
155
164
|
try {
|
|
156
|
-
await callReminderApi();
|
|
165
|
+
!isClientPortal && (await callReminderApi());
|
|
157
166
|
await callUnresolvedTaskApi();
|
|
158
167
|
await callOrderAlertsApi();
|
|
159
168
|
} catch (error) {
|
|
@@ -245,11 +254,80 @@ function Notification() {
|
|
|
245
254
|
</StyledTab>
|
|
246
255
|
</TabsData>
|
|
247
256
|
</Container>
|
|
248
|
-
{unresolvedLoading || reminderLoading ? (
|
|
249
|
-
|
|
250
|
-
<
|
|
251
|
-
|
|
252
|
-
|
|
257
|
+
{unresolvedLoading || reminderLoading || alertsApiLoading ? (
|
|
258
|
+
<>
|
|
259
|
+
<div
|
|
260
|
+
style={{
|
|
261
|
+
display: 'flex',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
gap: 12,
|
|
264
|
+
}}
|
|
265
|
+
>
|
|
266
|
+
<Skeleton.Avatar active size="small" shape="circle" />
|
|
267
|
+
<Skeleton.Input
|
|
268
|
+
active
|
|
269
|
+
style={{
|
|
270
|
+
width: '100%',
|
|
271
|
+
height: 12,
|
|
272
|
+
borderRadius: 4,
|
|
273
|
+
}}
|
|
274
|
+
/>
|
|
275
|
+
</div>
|
|
276
|
+
|
|
277
|
+
<div
|
|
278
|
+
style={{
|
|
279
|
+
display: 'flex',
|
|
280
|
+
alignItems: 'center',
|
|
281
|
+
gap: 12,
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
<Skeleton.Avatar active size="small" shape="circle" />
|
|
285
|
+
<Skeleton.Input
|
|
286
|
+
active
|
|
287
|
+
style={{
|
|
288
|
+
width: '100%',
|
|
289
|
+
height: 12,
|
|
290
|
+
borderRadius: 4,
|
|
291
|
+
}}
|
|
292
|
+
/>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<div
|
|
296
|
+
style={{
|
|
297
|
+
display: 'flex',
|
|
298
|
+
alignItems: 'center',
|
|
299
|
+
gap: 12,
|
|
300
|
+
}}
|
|
301
|
+
>
|
|
302
|
+
<Skeleton.Avatar active size="small" shape="circle" />
|
|
303
|
+
<Skeleton.Input
|
|
304
|
+
active
|
|
305
|
+
style={{
|
|
306
|
+
width: '100%',
|
|
307
|
+
height: 12,
|
|
308
|
+
borderRadius: 4,
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<div
|
|
314
|
+
style={{
|
|
315
|
+
display: 'flex',
|
|
316
|
+
alignItems: 'center',
|
|
317
|
+
gap: 12,
|
|
318
|
+
}}
|
|
319
|
+
>
|
|
320
|
+
<Skeleton.Avatar active size="small" shape="circle" />
|
|
321
|
+
<Skeleton.Input
|
|
322
|
+
active
|
|
323
|
+
style={{
|
|
324
|
+
width: '100%',
|
|
325
|
+
height: 12,
|
|
326
|
+
borderRadius: 4,
|
|
327
|
+
}}
|
|
328
|
+
/>
|
|
329
|
+
</div>
|
|
330
|
+
</>
|
|
253
331
|
) : taskData?.length > 0 ||
|
|
254
332
|
reminderNotifyData?.length > 0 ||
|
|
255
333
|
orderData ? (
|
|
@@ -280,32 +358,6 @@ const Container = styled.div`
|
|
|
280
358
|
border-bottom: 1px solid #ccc;
|
|
281
359
|
`;
|
|
282
360
|
|
|
283
|
-
const Loader = styled.div`
|
|
284
|
-
align-items: center;
|
|
285
|
-
justify-content: center;
|
|
286
|
-
display: flex;
|
|
287
|
-
flex-direction: column;
|
|
288
|
-
gap: 10px;
|
|
289
|
-
`;
|
|
290
|
-
|
|
291
|
-
const Spinner = styled.div`
|
|
292
|
-
border: 4px solid rgba(0, 0, 0, 0.1);
|
|
293
|
-
border-left-color: #3a3630;
|
|
294
|
-
border-radius: 50%;
|
|
295
|
-
width: 40px;
|
|
296
|
-
height: 40px;
|
|
297
|
-
animation: spin 1s linear infinite;
|
|
298
|
-
|
|
299
|
-
@keyframes spin {
|
|
300
|
-
0% {
|
|
301
|
-
transform: rotate(0deg);
|
|
302
|
-
}
|
|
303
|
-
100% {
|
|
304
|
-
transform: rotate(360deg);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
`;
|
|
308
|
-
|
|
309
361
|
const FlagContainer = styled.div`
|
|
310
362
|
padding: 8px;
|
|
311
363
|
background-color: #3a3630;
|
|
@@ -391,11 +443,4 @@ const TabsWrapper = styled.div`
|
|
|
391
443
|
}
|
|
392
444
|
`;
|
|
393
445
|
|
|
394
|
-
const Text = styled.div`
|
|
395
|
-
color: var(--tonal-brown-651, #6a7378);
|
|
396
|
-
font-family: Lato;
|
|
397
|
-
font-size: 13px;
|
|
398
|
-
font-style: normal;
|
|
399
|
-
font-weight: 600;
|
|
400
|
-
`;
|
|
401
446
|
export default Notification;
|
|
@@ -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 (
|