@bjsdistribution/dms-client-return 0.1.19-dev → 0.1.19-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/OutstandingTable.d.ts +3 -0
- package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
- package/dist/components/client-portal/ReturnStatus.d.ts +5 -0
- package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
- package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.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 +6 -2
- package/dist/dms-client-return.cjs.development.js +9140 -5835
- 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 +7617 -4312
- 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 +356 -0
- package/src/components/client-portal/ReturnAfterSearchBar.tsx +77 -17
- package/src/components/client-portal/ReturnOverview.tsx +15 -6
- package/src/components/client-portal/ReturnRTFilters.tsx +196 -80
- package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
- package/src/components/client-portal/ReturnStatus.tsx +50 -66
- package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
- package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
- 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 +23 -38
- package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
- 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 +58 -155
- 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 +25 -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
|
@@ -12,6 +12,7 @@ import { atom, useAtom } from 'jotai';
|
|
|
12
12
|
import {
|
|
13
13
|
useActionTypeOptions,
|
|
14
14
|
useClearState,
|
|
15
|
+
useClientPortal,
|
|
15
16
|
useCustomerData,
|
|
16
17
|
useReturnPayload,
|
|
17
18
|
} from '../../store';
|
|
@@ -26,11 +27,13 @@ import styled from 'styled-components';
|
|
|
26
27
|
import { Select } from 'antd';
|
|
27
28
|
import { useLocationOptions } from '../../order-view/store';
|
|
28
29
|
import { useNavigate, useSearchParams } from 'react-router-dom';
|
|
30
|
+
import { useAxios } from '@bjsdistribution/dms-component-library';
|
|
31
|
+
import { ApiResponse } from '../common/interface';
|
|
29
32
|
|
|
30
33
|
export const clickedState = atom<boolean>(false);
|
|
31
34
|
|
|
32
35
|
function SelectionFilter() {
|
|
33
|
-
const [customers] = useCustomerData();
|
|
36
|
+
const [customers, setCustomers] = useCustomerData();
|
|
34
37
|
const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
|
|
35
38
|
const [, dispatch] = useAtom(filtersReducerAtom);
|
|
36
39
|
const [
|
|
@@ -45,8 +48,29 @@ function SelectionFilter() {
|
|
|
45
48
|
const [actionTypeOptions, setActionTypeOptions] = useActionTypeOptions();
|
|
46
49
|
const [locationOptions, setLocationOptions] = useLocationOptions();
|
|
47
50
|
const [searchParams] = useSearchParams();
|
|
51
|
+
const [clientPortal] = useClientPortal();
|
|
48
52
|
const navigate = useNavigate();
|
|
53
|
+
//API for client data
|
|
54
|
+
const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
|
|
55
|
+
ApiResponse
|
|
56
|
+
>({
|
|
57
|
+
endpoint: `/v1/return/product/customers/`,
|
|
58
|
+
method: 'GET',
|
|
59
|
+
//@ts-ignore
|
|
60
|
+
pagination: { is_pagination: false },
|
|
61
|
+
});
|
|
49
62
|
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!clientPortal && clientPortal !== undefined) {
|
|
65
|
+
fetchData();
|
|
66
|
+
}
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (fetchedCustomerData && fetchedCustomerData?.data) {
|
|
71
|
+
setCustomers(fetchedCustomerData?.data);
|
|
72
|
+
}
|
|
73
|
+
}, [loading]);
|
|
50
74
|
//new codee
|
|
51
75
|
const urlCustomerId = searchParams.get('customerId');
|
|
52
76
|
const urlActiontype = searchParams.get('type');
|
|
@@ -54,7 +78,6 @@ function SelectionFilter() {
|
|
|
54
78
|
const selectedCustomer = customers?.find(
|
|
55
79
|
(customer: any) => customer?.customer_id?.toString() === urlCustomerId
|
|
56
80
|
);
|
|
57
|
-
|
|
58
81
|
const accountNumber = selectedCustomer?.account_number;
|
|
59
82
|
|
|
60
83
|
//customer name
|
|
@@ -91,10 +114,14 @@ function SelectionFilter() {
|
|
|
91
114
|
setActionTypeOptions(mappedActions);
|
|
92
115
|
|
|
93
116
|
const mappedLocations = Array.isArray(filteredClient?.return_locations)
|
|
94
|
-
? filteredClient
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
117
|
+
? filteredClient.return_locations
|
|
118
|
+
.filter(
|
|
119
|
+
(location: any) => location?.location_name && location?.token
|
|
120
|
+
)
|
|
121
|
+
.map((location: any) => ({
|
|
122
|
+
label: location.location_name,
|
|
123
|
+
value: location.token,
|
|
124
|
+
}))
|
|
98
125
|
: [];
|
|
99
126
|
|
|
100
127
|
setLocationOptions(mappedLocations);
|
|
@@ -135,10 +162,16 @@ function SelectionFilter() {
|
|
|
135
162
|
setActionTypeOptions(mappedActions);
|
|
136
163
|
|
|
137
164
|
const mappedLocations = Array.isArray(filteredClient?.return_locations)
|
|
138
|
-
? filteredClient
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
165
|
+
? filteredClient.return_locations
|
|
166
|
+
.filter((location: any) => {
|
|
167
|
+
const name = location?.location_name;
|
|
168
|
+
const token = location?.token;
|
|
169
|
+
return name && name !== 'null' && token && token !== 'null';
|
|
170
|
+
})
|
|
171
|
+
.map((location: any) => ({
|
|
172
|
+
label: location?.location_name,
|
|
173
|
+
value: location?.token,
|
|
174
|
+
}))
|
|
142
175
|
: [];
|
|
143
176
|
|
|
144
177
|
setLocationOptions(mappedLocations);
|
|
@@ -166,9 +199,7 @@ function SelectionFilter() {
|
|
|
166
199
|
console.log(currentSearch, 'currentSearch');
|
|
167
200
|
|
|
168
201
|
if (!currentSearch.includes('filter')) {
|
|
169
|
-
console.log('inside include');
|
|
170
202
|
// for dev
|
|
171
|
-
//navigate(`filter?${queryParams.toString()}`);
|
|
172
203
|
navigate(`/orders/view/return/filter?${queryParams.toString()}`);
|
|
173
204
|
|
|
174
205
|
// for local
|
|
@@ -328,7 +359,7 @@ function SelectionFilter() {
|
|
|
328
359
|
options={clientOptions}
|
|
329
360
|
placeholder="Select Client Name"
|
|
330
361
|
onChange={handleClientChange}
|
|
331
|
-
style={{ minWidth: '
|
|
362
|
+
style={{ minWidth: '250px' }}
|
|
332
363
|
value={selectedClient}
|
|
333
364
|
allowClear
|
|
334
365
|
onClear={handleClear}
|
|
@@ -349,7 +380,7 @@ function SelectionFilter() {
|
|
|
349
380
|
placeholder="Select Action Type"
|
|
350
381
|
value={selectedFilterValue}
|
|
351
382
|
onChange={handleActionClick}
|
|
352
|
-
style={{ minWidth: '
|
|
383
|
+
style={{ minWidth: '200px' }}
|
|
353
384
|
allowClear
|
|
354
385
|
onClear={handleClearAction}
|
|
355
386
|
/>
|
|
@@ -362,7 +393,7 @@ function SelectionFilter() {
|
|
|
362
393
|
value={selectedLocationValue}
|
|
363
394
|
placeholder="Select Location"
|
|
364
395
|
onChange={handleLocationChange}
|
|
365
|
-
style={{ minWidth: '
|
|
396
|
+
style={{ minWidth: '200px' }}
|
|
366
397
|
allowClear
|
|
367
398
|
mode="multiple"
|
|
368
399
|
/>
|
|
@@ -6,9 +6,12 @@ import {
|
|
|
6
6
|
} from './store/store';
|
|
7
7
|
import Filters from './filters/Filters';
|
|
8
8
|
import styled from 'styled-components';
|
|
9
|
-
import { useCustomerData, useStickyStatus } from '../store';
|
|
9
|
+
import { useClientPortal, useCustomerData, useStickyStatus } from '../store';
|
|
10
10
|
import HeaderFilter from './header-filters/HeaderFilter';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
DocumentTitle,
|
|
13
|
+
useAxios,
|
|
14
|
+
} from '@bjsdistribution/dms-component-library';
|
|
12
15
|
import { useAtom, useClientData } from '../order-view/store';
|
|
13
16
|
import { ClientData } from './common/interface';
|
|
14
17
|
import ReturnFilter from './return-order-table/return-orders-filters/ReturnFilter';
|
|
@@ -33,6 +36,7 @@ function ReturnMainTable() {
|
|
|
33
36
|
const [, setCustomers] = useCustomerData();
|
|
34
37
|
// const [tableName] = useTableName();
|
|
35
38
|
const queryParams = new URLSearchParams(location.search);
|
|
39
|
+
const [clientPortal] = useClientPortal();
|
|
36
40
|
|
|
37
41
|
const customerId = queryParams.get('customerId');
|
|
38
42
|
|
|
@@ -44,15 +48,22 @@ function ReturnMainTable() {
|
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
//API for client data
|
|
47
|
-
const { data: fetchedCustomerData, loading: loading } =
|
|
51
|
+
const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
|
|
48
52
|
ApiResponse
|
|
49
53
|
>({
|
|
50
54
|
endpoint: `/v1/return/product/customers/`,
|
|
51
55
|
method: 'GET',
|
|
52
56
|
//@ts-ignore
|
|
53
57
|
pagination: { is_pagination: false },
|
|
58
|
+
showLoader: false,
|
|
54
59
|
});
|
|
55
60
|
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (!clientPortal && clientPortal !== undefined) {
|
|
63
|
+
fetchData();
|
|
64
|
+
}
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
56
67
|
useEffect(() => {
|
|
57
68
|
if (fetchedCustomerData && fetchedCustomerData?.data) {
|
|
58
69
|
setCustomers(fetchedCustomerData?.data);
|
|
@@ -63,7 +74,8 @@ function ReturnMainTable() {
|
|
|
63
74
|
data: fetchedClientData,
|
|
64
75
|
loading: statsDataLoading,
|
|
65
76
|
paginationData,
|
|
66
|
-
|
|
77
|
+
fetchData: fetchProductStats,
|
|
78
|
+
} = useAxios<{
|
|
67
79
|
data: ClientData[];
|
|
68
80
|
}>({
|
|
69
81
|
endpoint: `/v1/return/product/stats/`,
|
|
@@ -71,7 +83,13 @@ function ReturnMainTable() {
|
|
|
71
83
|
//@ts-ignore
|
|
72
84
|
pagination: pagination,
|
|
73
85
|
filters: filters,
|
|
86
|
+
showLoader: false,
|
|
74
87
|
});
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!clientPortal && clientPortal !== undefined) {
|
|
90
|
+
fetchProductStats();
|
|
91
|
+
}
|
|
92
|
+
}, []);
|
|
75
93
|
|
|
76
94
|
useEffect(() => {
|
|
77
95
|
setLoading(statsDataLoading);
|
|
@@ -95,6 +113,7 @@ function ReturnMainTable() {
|
|
|
95
113
|
|
|
96
114
|
return (
|
|
97
115
|
<>
|
|
116
|
+
<DocumentTitle title="Client Return Products" />
|
|
98
117
|
<DashBoardWrapper className={` ${isScrolled ? 'stickyTableHead' : ''}`}>
|
|
99
118
|
{/* <RouterHeader /> */}
|
|
100
119
|
<div className="Tableconatiner">
|
|
@@ -10,19 +10,17 @@ import {
|
|
|
10
10
|
UsePaginationReturnData,
|
|
11
11
|
} from '../store/store';
|
|
12
12
|
import { ApiResponse } from '../common/interface';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
DocumentTitle,
|
|
15
|
+
useApiHook,
|
|
16
|
+
} from '@bjsdistribution/dms-component-library';
|
|
14
17
|
import { filtersReducerReturnAtom } from './table-filters/ReturnFilterStore';
|
|
15
18
|
import { notification } from 'antd';
|
|
16
19
|
import ReturnPagination from '../table-view/ReturnPagination';
|
|
17
|
-
import {
|
|
18
|
-
useCallApiAgain,
|
|
19
|
-
useClientPortal,
|
|
20
|
-
useSearchAfterText,
|
|
21
|
-
} from '../../store';
|
|
22
|
-
import { useParams } from 'react-router-dom';
|
|
20
|
+
import { useCallApiAgain } from '../../store';
|
|
23
21
|
|
|
24
22
|
const ReturnAfterTable = () => {
|
|
25
|
-
const [, setReturnOrderData] = useReturnAfterOrderData();
|
|
23
|
+
const [returnAfterOrder, setReturnOrderData] = useReturnAfterOrderData();
|
|
26
24
|
const [, setLoading] = useLoading();
|
|
27
25
|
const [state] = useAtom(filtersReducerReturnAtom);
|
|
28
26
|
const [callApi] = useCallApiAgain();
|
|
@@ -33,78 +31,65 @@ const ReturnAfterTable = () => {
|
|
|
33
31
|
const [itemsPerPage, setItemsPerPage] = useItemsPerReturnPage();
|
|
34
32
|
const [, setPaginationObject] = UsePaginationData();
|
|
35
33
|
const { page, total } = paginationObj;
|
|
36
|
-
|
|
37
|
-
const [debouncedSearchText] = useSearchAfterText();
|
|
34
|
+
|
|
38
35
|
const handlePageChange = (page: number) => {
|
|
39
36
|
setCurrentPage(page);
|
|
40
37
|
};
|
|
41
38
|
const handleItemsPerPageChange = (itemsPerPage: number) => {
|
|
42
39
|
setItemsPerPage(itemsPerPage);
|
|
43
40
|
};
|
|
44
|
-
const { status } = useParams();
|
|
45
41
|
|
|
46
42
|
const {
|
|
47
43
|
data: fetchedReturnOrderData,
|
|
48
44
|
loading,
|
|
45
|
+
setShouldPerformAction,
|
|
49
46
|
paginationData,
|
|
50
|
-
|
|
51
|
-
} = useAxios<ApiResponse>({
|
|
47
|
+
} = useApiHook<ApiResponse>({
|
|
52
48
|
endpoint: '/v1/return/orders/',
|
|
53
49
|
method: 'GET',
|
|
54
50
|
filters: filters && filters?.length > 0 ? filters : undefined,
|
|
55
51
|
pagination: pagination,
|
|
52
|
+
performAction: false,
|
|
53
|
+
showLoader: false,
|
|
56
54
|
});
|
|
57
55
|
|
|
58
56
|
useEffect(() => {
|
|
59
|
-
|
|
60
|
-
fetchData();
|
|
61
|
-
}
|
|
57
|
+
callApi ? setShouldPerformAction(true) : setShouldPerformAction(false);
|
|
62
58
|
}, [callApi]);
|
|
63
59
|
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
if (!clientPortal) {
|
|
66
|
-
fetchData();
|
|
67
|
-
}
|
|
68
|
-
}, []);
|
|
69
|
-
|
|
70
|
-
//CP
|
|
71
|
-
useEffect(() => {
|
|
72
|
-
if (clientPortal && debouncedSearchText.trim().length === 0) {
|
|
73
|
-
fetchData();
|
|
74
|
-
}
|
|
75
|
-
}, [debouncedSearchText, clientPortal, status]);
|
|
76
|
-
|
|
77
60
|
useEffect(() => {
|
|
78
61
|
setLoading(loading);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
fetchedReturnOrderData?.data &&
|
|
82
|
-
(!clientPortal || debouncedSearchText.trim().length === 0)
|
|
83
|
-
) {
|
|
84
|
-
setReturnOrderData(fetchedReturnOrderData.data);
|
|
85
|
-
|
|
62
|
+
if (fetchedReturnOrderData && fetchedReturnOrderData?.data) {
|
|
63
|
+
setReturnOrderData(fetchedReturnOrderData?.data);
|
|
86
64
|
if (paginationData) {
|
|
87
65
|
try {
|
|
88
66
|
const { count, ...rest } = JSON.parse(paginationData);
|
|
89
67
|
setPaginationObject(rest);
|
|
90
68
|
} catch (error) {
|
|
69
|
+
console.error('Error parsing paginationData:', error);
|
|
91
70
|
notification.error({
|
|
92
71
|
message: 'Error',
|
|
93
72
|
description: 'Failed to parse pagination data',
|
|
94
73
|
});
|
|
95
74
|
}
|
|
75
|
+
} else {
|
|
76
|
+
notification.error({
|
|
77
|
+
message: 'Error',
|
|
78
|
+
description: 'Pagination data is null or undefined',
|
|
79
|
+
});
|
|
96
80
|
}
|
|
97
81
|
}
|
|
98
|
-
}, [fetchedReturnOrderData, loading]);
|
|
82
|
+
}, [fetchedReturnOrderData, loading, returnAfterOrder]);
|
|
99
83
|
|
|
100
84
|
return (
|
|
101
85
|
<div>
|
|
86
|
+
<DocumentTitle title="Return Order List" />
|
|
102
87
|
<DashBoardWrapper>
|
|
103
88
|
{/* <RouterHeader /> */}
|
|
104
89
|
<div className="Tableconatiner">
|
|
105
90
|
{/* <HeaderFilter /> */}
|
|
106
91
|
<Container>
|
|
107
|
-
|
|
92
|
+
<ReturnOrderFilter />
|
|
108
93
|
<OrderTable />
|
|
109
94
|
{total > 0 && (
|
|
110
95
|
<ReturnPagination
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
useAssignData,
|
|
20
20
|
useAssignPayload,
|
|
21
21
|
useCallApiAgain,
|
|
22
|
-
useClientPortal,
|
|
23
22
|
} from '../../../store';
|
|
24
23
|
import styled from 'styled-components';
|
|
25
24
|
import { useApiHook } from '@bjsdistribution/dms-component-library';
|
|
@@ -40,7 +39,6 @@ const OrderTable = () => {
|
|
|
40
39
|
const [, setAssign] = useState<boolean>(false);
|
|
41
40
|
const [, setCallAPi] = useCallApiAgain();
|
|
42
41
|
const [loading] = useLoading();
|
|
43
|
-
const [clientPortal] = useClientPortal();
|
|
44
42
|
|
|
45
43
|
//sorting
|
|
46
44
|
const [sortConfig, setSortConfig] = useState<{
|
|
@@ -231,7 +229,7 @@ const OrderTable = () => {
|
|
|
231
229
|
Return Location {renderSortIcon('return_location_name')}
|
|
232
230
|
</div>
|
|
233
231
|
</th>
|
|
234
|
-
|
|
232
|
+
<th>Pick Up Location</th>
|
|
235
233
|
<th onClick={() => handleSort('recipient_name')}>
|
|
236
234
|
<div className="sortIconClass">
|
|
237
235
|
Recipient {renderSortIcon('recipient_name')}
|
|
@@ -241,6 +239,7 @@ const OrderTable = () => {
|
|
|
241
239
|
<th>Consignment</th>
|
|
242
240
|
<th>Return Order No</th>
|
|
243
241
|
<th> Total Parts</th>
|
|
242
|
+
<th> Total Orders</th>
|
|
244
243
|
<th onClick={() => handleSort('weight')}>
|
|
245
244
|
<div className="sortIconClass">
|
|
246
245
|
Total Weight {renderSortIcon('weight')}
|
|
@@ -251,7 +250,7 @@ const OrderTable = () => {
|
|
|
251
250
|
Total CBM {renderSortIcon('cube')}
|
|
252
251
|
</div>
|
|
253
252
|
</th>
|
|
254
|
-
|
|
253
|
+
<th>Assign</th>
|
|
255
254
|
<th>Status</th>
|
|
256
255
|
<th className="emailInvoiceShare">Labels</th>
|
|
257
256
|
</tr>
|
|
@@ -299,13 +298,11 @@ const OrderTable = () => {
|
|
|
299
298
|
<td>{formatDate(new Date(item?.created_at))}</td>
|
|
300
299
|
<td>{displayValueOrNA(item?.return_location_name)}</td>
|
|
301
300
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
</td>
|
|
308
|
-
)}
|
|
301
|
+
<td>
|
|
302
|
+
{item?.locations?.length
|
|
303
|
+
? item?.locations.join(', ')
|
|
304
|
+
: 'N/A'}
|
|
305
|
+
</td>
|
|
309
306
|
|
|
310
307
|
<td onClick={() => setOrderId(item.id)}>
|
|
311
308
|
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
@@ -332,6 +329,8 @@ const OrderTable = () => {
|
|
|
332
329
|
<td>{displayValueOrNA(item?.order_number)}</td>
|
|
333
330
|
|
|
334
331
|
<td>{displayValueOrNA(item?.total_products)}</td>
|
|
332
|
+
<td>{displayValueOrNA(item?.total_orders)}</td>
|
|
333
|
+
|
|
335
334
|
<td>
|
|
336
335
|
{displayValueOrNA(item?.weight)}{' '}
|
|
337
336
|
{item?.weight && item?.weight > 0 ? 'KG' : ''}
|
|
@@ -339,19 +338,17 @@ const OrderTable = () => {
|
|
|
339
338
|
|
|
340
339
|
<td>{displayValueOrNA(item?.cube)}</td>
|
|
341
340
|
|
|
342
|
-
{
|
|
343
|
-
<
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
</td>
|
|
354
|
-
)}
|
|
341
|
+
<td key={item.id}>
|
|
342
|
+
<StyledAntSelect
|
|
343
|
+
options={assignOptions}
|
|
344
|
+
placeholder="Select"
|
|
345
|
+
onChange={(value: any) =>
|
|
346
|
+
handleAssignPayload(item?.id, value)
|
|
347
|
+
}
|
|
348
|
+
style={{ width: '150px' }}
|
|
349
|
+
value={item?.bjs_delivery}
|
|
350
|
+
/>
|
|
351
|
+
</td>
|
|
355
352
|
|
|
356
353
|
<td>
|
|
357
354
|
<ul
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts
CHANGED
|
@@ -171,46 +171,46 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
//client portal
|
|
174
|
-
case 'SET_CP_DATE_FILTER': {
|
|
175
|
-
|
|
174
|
+
// case 'SET_CP_DATE_FILTER': {
|
|
175
|
+
// let { startDate, endDate } = action.payload;
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
// if (!startDate || !endDate) {
|
|
178
|
+
// const storedDates = JSON.parse(
|
|
179
|
+
// localStorage.getItem('returnDate') || '{}'
|
|
180
|
+
// );
|
|
181
|
+
// startDate = startDate ?? storedDates?.startDate;
|
|
182
|
+
// endDate = endDate ?? storedDates?.endDate ?? startDate;
|
|
183
|
+
// }
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
// const filters = state['x-filters'].filter(f => f.field !== 'created_at');
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
187
|
+
// if (startDate === endDate) {
|
|
188
|
+
// filters.push({
|
|
189
|
+
// field: 'created_at',
|
|
190
|
+
// op: '=',
|
|
191
|
+
// value: format(new Date(startDate), 'yyyy-MM-dd'),
|
|
192
|
+
// });
|
|
193
|
+
// } else if (startDate && endDate) {
|
|
194
|
+
// filters.push(
|
|
195
|
+
// {
|
|
196
|
+
// field: 'created_at',
|
|
197
|
+
// op: '>=',
|
|
198
|
+
// value: format(new Date(startDate), 'yyyy-MM-dd'),
|
|
199
|
+
// },
|
|
200
|
+
// {
|
|
201
|
+
// field: 'created_at',
|
|
202
|
+
// op: '<=',
|
|
203
|
+
// value: format(new Date(endDate), 'yyyy-MM-dd'),
|
|
204
|
+
// }
|
|
205
|
+
// );
|
|
206
|
+
// }
|
|
207
207
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
208
|
+
// return {
|
|
209
|
+
// ...state,
|
|
210
|
+
// 'x-filters': filters,
|
|
211
|
+
// 'x-pagination': { ...state['x-pagination'], page: 1 },
|
|
212
|
+
// };
|
|
213
|
+
// }
|
|
214
214
|
// case 'CLEAR_CLIENT':
|
|
215
215
|
// return {
|
|
216
216
|
// ...state,
|
package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx
CHANGED
|
@@ -209,7 +209,7 @@ const ReturnOrderFilter = () => {
|
|
|
209
209
|
className="custom-select"
|
|
210
210
|
placeholder="Status of Order"
|
|
211
211
|
onChange={handleStatusOfOrder}
|
|
212
|
-
style={{ minWidth: '
|
|
212
|
+
style={{ minWidth: '250px', maxWidth: '300px' }}
|
|
213
213
|
value={statusOrder}
|
|
214
214
|
onClear={handleClear}
|
|
215
215
|
allowClear
|
|
@@ -227,9 +227,19 @@ const ReturnOrderFilter = () => {
|
|
|
227
227
|
placeholder="Clients"
|
|
228
228
|
onChange={handleClientChange}
|
|
229
229
|
value={selectedClient}
|
|
230
|
-
style={{
|
|
230
|
+
style={{
|
|
231
|
+
minWidth: '150px',
|
|
232
|
+
width: 'auto',
|
|
233
|
+
cursor: 'pointer',
|
|
234
|
+
}}
|
|
231
235
|
allowClear
|
|
232
236
|
onClear={handleClearClient}
|
|
237
|
+
filterOption={(input: any, option: any) =>
|
|
238
|
+
(option?.label ?? '')
|
|
239
|
+
.toLowerCase()
|
|
240
|
+
.includes(input.toLowerCase())
|
|
241
|
+
}
|
|
242
|
+
showSearch
|
|
233
243
|
/>
|
|
234
244
|
</StyledAntSelect>
|
|
235
245
|
</div>
|
|
@@ -8,12 +8,15 @@ import ReturnOrderTable from './return-orders-filters/ReturnOrderTable';
|
|
|
8
8
|
import ModalManager from '../../order-view/modalsPopup/ModalManager';
|
|
9
9
|
import { useItemsPerPage, UsePaginationData } from '../store/store';
|
|
10
10
|
import Pagination from '../table-view/Pagination';
|
|
11
|
+
import { useCustomerData } from '../../store';
|
|
12
|
+
import { DocumentTitle } from '@bjsdistribution/dms-component-library';
|
|
11
13
|
// import { useLocation } from 'react-router-dom';
|
|
12
14
|
|
|
13
15
|
const ReturnTable = () => {
|
|
14
16
|
const [paginationObj] = UsePaginationData();
|
|
15
17
|
const [, setCurrentPage] = useState(1);
|
|
16
18
|
const [itemsPerPage, setItemsPerPage] = useItemsPerPage();
|
|
19
|
+
const [customers] = useCustomerData();
|
|
17
20
|
// const location = useLocation();
|
|
18
21
|
const { page, total } = paginationObj;
|
|
19
22
|
|
|
@@ -30,10 +33,23 @@ const ReturnTable = () => {
|
|
|
30
33
|
// const clientId = queryParams.get('customerId');
|
|
31
34
|
// }, [location]);
|
|
32
35
|
|
|
36
|
+
const queryParams = new URLSearchParams(location.search);
|
|
37
|
+
|
|
38
|
+
const customerId = queryParams.get('customerId');
|
|
39
|
+
|
|
40
|
+
const selectedCustomer = customers?.find(
|
|
41
|
+
(customer: any) => customer?.customer_id?.toString() === customerId
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const customerName = selectedCustomer?.customer_name;
|
|
45
|
+
|
|
46
|
+
const docTitle = `${customerName}: Return Product`;
|
|
47
|
+
|
|
33
48
|
return (
|
|
34
49
|
<div>
|
|
35
50
|
<DashBoardWrapper>
|
|
36
51
|
{/* <RouterHeader /> */}
|
|
52
|
+
<DocumentTitle title={docTitle} />
|
|
37
53
|
<div className="Tableconatiner">
|
|
38
54
|
<HeaderFilter />
|
|
39
55
|
<Container>
|