@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
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.21-dev",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"testEnvironment": "jest-environment-jsdom-sixteen"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@bjsdistribution/dms-component-library": "0.3.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.3.50-staging",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"styled-components": "^6.1.8",
|
|
83
83
|
"tsdx": "^0.14.1",
|
|
84
84
|
"tslib": "^2.6.2",
|
|
85
|
-
"typescript": "^5.3.3"
|
|
85
|
+
"typescript": "^5.3.3",
|
|
86
|
+
"@types/uuid": "^10.0.0"
|
|
86
87
|
},
|
|
87
88
|
"dependencies": {
|
|
88
89
|
"@emotion/react": "^11.11.3",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"jotai": "^2.6.3",
|
|
96
97
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
97
98
|
"react-redux": "^9.2.0",
|
|
98
|
-
"react-switch-selector": "^2.2.1"
|
|
99
|
+
"react-switch-selector": "^2.2.1",
|
|
100
|
+
"uuid": "^10.0.0"
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -11,7 +11,7 @@ const ActionIcon = () => (
|
|
|
11
11
|
<path
|
|
12
12
|
d="M0.5 12.2432C0.5 5.61581 5.87258 0.243225 12.5 0.243225C19.1274 0.243225 24.5 5.61581 24.5 12.2432C24.5 18.8706 19.1274 24.2432 12.5 24.2432C5.87258 24.2432 0.5 18.8706 0.5 12.2432Z"
|
|
13
13
|
fill="#E95252"
|
|
14
|
-
|
|
14
|
+
fillOpacity="0.5"
|
|
15
15
|
/>
|
|
16
16
|
<path
|
|
17
17
|
d="M16.566 9.23825C16.6377 9.16909 16.6948 9.08636 16.7342 8.99488C16.7735 8.90339 16.7943 8.80499 16.7952 8.70541C16.7961 8.60582 16.7772 8.50705 16.7395 8.41486C16.7018 8.32267 16.6462 8.23891 16.5758 8.16846C16.5054 8.098 16.4217 8.04228 16.3295 8.00452C16.2374 7.96677 16.1386 7.94774 16.0391 7.94856C15.9395 7.94938 15.841 7.97002 15.7495 8.00929C15.658 8.04855 15.5752 8.10565 15.506 8.17725L12.5 11.1822L9.495 8.17725C9.42634 8.10356 9.34354 8.04446 9.25154 8.00347C9.15954 7.96247 9.06022 7.94043 8.95952 7.93865C8.85882 7.93688 8.75879 7.9554 8.6654 7.99312C8.57201 8.03084 8.48718 8.08699 8.41596 8.15821C8.34474 8.22943 8.2886 8.31426 8.25087 8.40765C8.21315 8.50104 8.19463 8.60107 8.19641 8.70177C8.19818 8.80247 8.22022 8.90178 8.26122 8.99378C8.30221 9.08578 8.36131 9.16858 8.435 9.23725L11.438 12.2432L8.433 15.2482C8.30052 15.3904 8.22839 15.5785 8.23182 15.7728C8.23525 15.9671 8.31396 16.1525 8.45138 16.2899C8.58879 16.4273 8.77417 16.506 8.96847 16.5094C9.16278 16.5128 9.35082 16.4407 9.493 16.3082L12.5 13.3032L15.505 16.3092C15.6472 16.4417 15.8352 16.5139 16.0295 16.5104C16.2238 16.507 16.4092 16.4283 16.5466 16.2909C16.684 16.1535 16.7627 15.9681 16.7662 15.7738C16.7696 15.5795 16.6975 15.3914 16.565 15.2492L13.562 12.2432L16.566 9.23825Z"
|
|
@@ -16,8 +16,8 @@ const ArrowDownIcon: React.FC<ArrowDownIconProps> = ({ fill = '#3A3630' }) => {
|
|
|
16
16
|
<rect width="24" height="24" fill={fill} />
|
|
17
17
|
<path
|
|
18
18
|
opacity="0.4"
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
fillRule="evenodd"
|
|
20
|
+
clipRule="evenodd"
|
|
21
21
|
d="M6.69104 9.8912C6.82604 9.75637 7.00903 9.68063 7.19984 9.68063C7.39064 9.68063 7.57363 9.75637 7.70864 9.8912L11.9998 14.1824L16.291 9.8912C16.4275 9.76402 16.608 9.69478 16.7946 9.69807C16.9811 9.70136 17.1591 9.77693 17.291 9.90884C17.4229 10.0408 17.4985 10.2187 17.5018 10.4053C17.5051 10.5918 17.4358 10.7723 17.3086 10.9088L12.5086 15.7088C12.3736 15.8436 12.1906 15.9194 11.9998 15.9194C11.809 15.9194 11.626 15.8436 11.491 15.7088L6.69104 10.9088C6.5562 10.7738 6.48047 10.5908 6.48047 10.4C6.48047 10.2092 6.5562 10.0262 6.69104 9.8912Z"
|
|
22
22
|
fill="#3A3630"
|
|
23
23
|
/>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
|
|
3
|
+
interface Filter {
|
|
4
|
+
field: string;
|
|
5
|
+
op: string;
|
|
6
|
+
value: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Pagination {
|
|
10
|
+
page: number;
|
|
11
|
+
per_page: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface FilterState {
|
|
15
|
+
'x-filters': Filter[];
|
|
16
|
+
'x-pagination': Pagination;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const initialState: FilterState = {
|
|
20
|
+
'x-filters': [],
|
|
21
|
+
'x-pagination': { page: 1, per_page: 50 },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const overviewFilterReducer = (
|
|
25
|
+
state: FilterState,
|
|
26
|
+
action: any
|
|
27
|
+
): FilterState => {
|
|
28
|
+
switch (action.type) {
|
|
29
|
+
case 'SET_CP_DATE_FILTER': {
|
|
30
|
+
const { startDate, endDate } = action.payload;
|
|
31
|
+
|
|
32
|
+
const filters: Filter[] = [];
|
|
33
|
+
|
|
34
|
+
if (startDate) {
|
|
35
|
+
filters.push({
|
|
36
|
+
field: 'created_at',
|
|
37
|
+
op: '>=',
|
|
38
|
+
value: `${startDate}T00:00:00+00:00`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (endDate) {
|
|
43
|
+
filters.push({
|
|
44
|
+
field: 'created_at',
|
|
45
|
+
op: '<=',
|
|
46
|
+
value: `${endDate}T23:59:59+00:00`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
...state,
|
|
52
|
+
'x-filters': [
|
|
53
|
+
...state['x-filters'].filter(f => f.field !== 'created_at'),
|
|
54
|
+
...filters,
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case 'SET_PAGE':
|
|
60
|
+
return {
|
|
61
|
+
...state,
|
|
62
|
+
'x-pagination': {
|
|
63
|
+
...state['x-pagination'],
|
|
64
|
+
page: action.payload,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
case 'SET_PERPAGE':
|
|
69
|
+
return {
|
|
70
|
+
...state,
|
|
71
|
+
'x-pagination': {
|
|
72
|
+
...state['x-pagination'],
|
|
73
|
+
per_page: action.payload,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
case 'CLEAR_FILTERS':
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
};
|
|
80
|
+
default:
|
|
81
|
+
return state;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const overviewfiltersStateAtom = atom(initialState);
|
|
86
|
+
|
|
87
|
+
export const dateFilterCPReducer = atom(
|
|
88
|
+
get => get(overviewfiltersStateAtom),
|
|
89
|
+
(get, set, action) =>
|
|
90
|
+
set(
|
|
91
|
+
overviewfiltersStateAtom,
|
|
92
|
+
overviewFilterReducer(get(overviewfiltersStateAtom), action)
|
|
93
|
+
)
|
|
94
|
+
);
|
|
@@ -7,17 +7,14 @@ import { Empty, notification, Skeleton } from 'antd';
|
|
|
7
7
|
import { format } from 'date-fns';
|
|
8
8
|
import { useAtom } from 'jotai';
|
|
9
9
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import { NavLink
|
|
11
|
-
import dayjs from 'dayjs';
|
|
10
|
+
import { NavLink } from 'react-router-dom';
|
|
12
11
|
import { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';
|
|
13
12
|
import {
|
|
14
13
|
useClientOutstandingReturnData,
|
|
15
14
|
useClientPortal,
|
|
16
|
-
useEndDate,
|
|
17
15
|
useLocationData,
|
|
18
16
|
useSearchText,
|
|
19
17
|
useSelectedClientPortOrders,
|
|
20
|
-
useStartDate,
|
|
21
18
|
} from '../store';
|
|
22
19
|
import { usefetchAgain } from '../order-view/store';
|
|
23
20
|
import {
|
|
@@ -37,10 +34,11 @@ import {
|
|
|
37
34
|
import PrinterIcon from '../../assets/icons/PrinterIcon';
|
|
38
35
|
import DownIcon from '../../assets/icons/DownIcon';
|
|
39
36
|
import PrintDropDownReturn from '../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
37
|
+
import { dateFilterCPReducer } from './DateFilterStore';
|
|
40
38
|
|
|
41
39
|
const OutstandingTable = () => {
|
|
42
|
-
const [
|
|
43
|
-
const { 'x-pagination': pagination } =
|
|
40
|
+
const [statePagination] = useAtom(filtersReducerAtom);
|
|
41
|
+
const { 'x-pagination': pagination } = statePagination;
|
|
44
42
|
const [
|
|
45
43
|
outstandingReturnData,
|
|
46
44
|
setOutstandingReturnData,
|
|
@@ -53,11 +51,13 @@ const OutstandingTable = () => {
|
|
|
53
51
|
const [, setPaginationObject] = UsePaginationData();
|
|
54
52
|
const [callForFetch] = usefetchAgain();
|
|
55
53
|
const [clientPortal] = useClientPortal();
|
|
56
|
-
const { status } = useParams();
|
|
57
54
|
const [selectedOrderIds, setSelectedOrderIds] = useSelectedClientPortOrders();
|
|
58
55
|
const [selectClientAll, setSelectClientAll] = useState(false);
|
|
59
56
|
const [debouncedSearchText] = useSearchText();
|
|
60
57
|
|
|
58
|
+
const [state] = useAtom(dateFilterCPReducer);
|
|
59
|
+
const { 'x-filters': filters } = state;
|
|
60
|
+
|
|
61
61
|
//sorting
|
|
62
62
|
const [sortConfig, setSortConfig] = useState<{
|
|
63
63
|
key: string;
|
|
@@ -123,56 +123,12 @@ const OutstandingTable = () => {
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const filters = useMemo(() => {
|
|
131
|
-
if (!clientPortal) return [];
|
|
132
|
-
|
|
133
|
-
const stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
134
|
-
|
|
135
|
-
const sDate = startDate?.isValid?.() ? startDate : dayjs(stored?.startDate);
|
|
136
|
-
const eDate = endDate?.isValid?.()
|
|
137
|
-
? endDate
|
|
138
|
-
: stored?.endDate
|
|
139
|
-
? dayjs(stored?.endDate)
|
|
140
|
-
: null;
|
|
141
|
-
|
|
142
|
-
if (!sDate?.isValid?.()) return [];
|
|
143
|
-
|
|
144
|
-
let dateFilters: any[] = [];
|
|
145
|
-
|
|
146
|
-
if (eDate && eDate.isValid()) {
|
|
147
|
-
dateFilters = [
|
|
148
|
-
{ field: 'created_at', op: '>=', value: sDate.format('YYYY-MM-DD') },
|
|
149
|
-
{
|
|
150
|
-
field: 'created_at',
|
|
151
|
-
op: '<=',
|
|
152
|
-
value: eDate.add(1, 'day').format('YYYY-MM-DD'),
|
|
153
|
-
},
|
|
154
|
-
];
|
|
155
|
-
} else {
|
|
156
|
-
dateFilters = [
|
|
157
|
-
{
|
|
158
|
-
field: 'created_at',
|
|
159
|
-
op: '=',
|
|
160
|
-
value: sDate.format('YYYY-MM-DD'),
|
|
161
|
-
},
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
const baseFilters: any[] =
|
|
166
|
-
status === 'outstanding_return'
|
|
167
|
-
? [
|
|
168
|
-
{ field: 'isdeleted', op: '=', value: 0 },
|
|
169
|
-
{ field: 'product_return_action_id', op: '=', value: 'RTS' },
|
|
170
|
-
]
|
|
171
|
-
: [];
|
|
172
|
-
|
|
173
|
-
return [...baseFilters, ...dateFilters];
|
|
174
|
-
}, [startDate, endDate, status]);
|
|
126
|
+
const baseFilters = [
|
|
127
|
+
{ field: 'isdeleted', op: '=', value: 0 },
|
|
128
|
+
{ field: 'product_return_action_id', op: '=', value: 'RTS' },
|
|
129
|
+
];
|
|
175
130
|
|
|
131
|
+
const modifiedFilters = [...baseFilters, ...filters];
|
|
176
132
|
const {
|
|
177
133
|
data: fetchedOrderData,
|
|
178
134
|
loading: returnDataLoad,
|
|
@@ -181,27 +137,15 @@ const OutstandingTable = () => {
|
|
|
181
137
|
} = useAxios<ApiResponse>({
|
|
182
138
|
endpoint: '/v1/return/product/pending/',
|
|
183
139
|
method: 'GET',
|
|
184
|
-
filters:
|
|
140
|
+
filters: modifiedFilters,
|
|
185
141
|
pagination: pagination,
|
|
186
142
|
});
|
|
187
|
-
console.log(filters, 'outstanding filters');
|
|
188
|
-
const hasFetchedRef = useRef(false);
|
|
189
143
|
|
|
190
144
|
useEffect(() => {
|
|
191
|
-
|
|
192
|
-
clientPortal &&
|
|
193
|
-
debouncedSearchText === '' &&
|
|
194
|
-
filters?.length > 0 &&
|
|
195
|
-
!hasFetchedRef.current;
|
|
196
|
-
|
|
197
|
-
if (shouldFetch) {
|
|
145
|
+
if (clientPortal && debouncedSearchText === '') {
|
|
198
146
|
fetchData();
|
|
199
|
-
hasFetchedRef.current = true;
|
|
200
147
|
}
|
|
201
|
-
}, [
|
|
202
|
-
useEffect(() => {
|
|
203
|
-
hasFetchedRef.current = false;
|
|
204
|
-
}, [debouncedSearchText, filters]);
|
|
148
|
+
}, [JSON.stringify(filters), debouncedSearchText]);
|
|
205
149
|
|
|
206
150
|
useEffect(() => {
|
|
207
151
|
setLoading(returnDataLoad);
|
|
@@ -227,7 +171,6 @@ const OutstandingTable = () => {
|
|
|
227
171
|
}
|
|
228
172
|
}, [fetchedOrderData, returnDataLoad]);
|
|
229
173
|
|
|
230
|
-
// console.log(modifiedFilters, 'modifiedFilters');
|
|
231
174
|
useEffect(() => {
|
|
232
175
|
setLoading(returnDataLoad);
|
|
233
176
|
if (fetchedOrderData && fetchedOrderData?.data && locationData) {
|
|
@@ -8,10 +8,8 @@ import styled from 'styled-components';
|
|
|
8
8
|
import {
|
|
9
9
|
useAtom,
|
|
10
10
|
useClientPortal,
|
|
11
|
-
useEndDate,
|
|
12
11
|
useReturnConfirmedOrderData,
|
|
13
12
|
useSearchAfterText,
|
|
14
|
-
useStartDate,
|
|
15
13
|
useStatsCPCount,
|
|
16
14
|
} from '../store';
|
|
17
15
|
|
|
@@ -20,38 +18,37 @@ import { javascriptStringDumpToJSON } from '../utils';
|
|
|
20
18
|
import { UsePaginationData } from '../order-daily-overview/store/store';
|
|
21
19
|
import { notification } from 'antd';
|
|
22
20
|
import { filtersReducerReturnAtom } from '../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
|
|
23
|
-
import dayjs from 'dayjs';
|
|
24
21
|
import { returnCountType } from './ReturnStatus';
|
|
25
22
|
import { useParams } from 'react-router-dom';
|
|
23
|
+
import { dateFilterCPReducer } from './DateFilterStore';
|
|
26
24
|
|
|
27
25
|
function ReturnAfterSearchBar() {
|
|
28
26
|
const [searchText, setSearchText] = useState('');
|
|
29
27
|
const [debouncedSearchText, setDebouncedSearchText] = useSearchAfterText();
|
|
30
28
|
const [, setReturnConfirmedData] = useReturnConfirmedOrderData();
|
|
31
|
-
//condition on client view
|
|
32
29
|
const [, setPaginationObject] = UsePaginationData();
|
|
30
|
+
|
|
31
|
+
const [statePagination] = useAtom(filtersReducerReturnAtom);
|
|
32
|
+
const { 'x-pagination': pagination } = statePagination;
|
|
33
|
+
const [, setCount] = useStatsCPCount();
|
|
34
|
+
const [clientPortal] = useClientPortal();
|
|
35
|
+
const [state] = useAtom(dateFilterCPReducer);
|
|
36
|
+
const { 'x-filters': filters } = state;
|
|
37
|
+
const { status } = useParams();
|
|
38
|
+
|
|
33
39
|
const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
40
|
setSearchText(event.target.value);
|
|
35
41
|
};
|
|
36
|
-
//CP
|
|
37
|
-
const [modifiedStatsFilters, setModifiedStatsFilters] = useState<any[]>([]);
|
|
38
|
-
const [startDate] = useStartDate();
|
|
39
|
-
const [endDate] = useEndDate();
|
|
40
|
-
const [state] = useAtom(filtersReducerReturnAtom);
|
|
41
|
-
const { 'x-filters': filters, 'x-pagination': pagination } = state;
|
|
42
|
-
const [count, setCount] = useStatsCPCount();
|
|
43
|
-
const [clientPortal] = useClientPortal();
|
|
44
|
-
const { status } = useParams();
|
|
45
42
|
|
|
46
43
|
const { paginationData, fetchData: returnAfterCall } = useAxios<ApiResponse>({
|
|
47
44
|
endpoint: '/v1/return/orders/',
|
|
48
45
|
method: 'GET',
|
|
49
|
-
filters: filters
|
|
46
|
+
filters: filters,
|
|
50
47
|
pagination: pagination,
|
|
51
48
|
});
|
|
52
49
|
|
|
53
50
|
useEffect(() => {
|
|
54
|
-
if (debouncedSearchText?.length >
|
|
51
|
+
if (debouncedSearchText?.length > 2) {
|
|
55
52
|
returnAfterCall({
|
|
56
53
|
endPointQuery: `?search_term=${debouncedSearchText}`,
|
|
57
54
|
}).then((response: any) => {
|
|
@@ -76,7 +73,8 @@ function ReturnAfterSearchBar() {
|
|
|
76
73
|
message: 'Search Phrase cannot be less than 3 characters',
|
|
77
74
|
});
|
|
78
75
|
}
|
|
79
|
-
}, [debouncedSearchText]);
|
|
76
|
+
}, [debouncedSearchText, JSON.stringify(filters)]);
|
|
77
|
+
|
|
80
78
|
// Debouncing effect
|
|
81
79
|
useEffect(() => {
|
|
82
80
|
const handler = setTimeout(() => {
|
|
@@ -93,69 +91,29 @@ function ReturnAfterSearchBar() {
|
|
|
93
91
|
}
|
|
94
92
|
}, [debouncedSearchText]);
|
|
95
93
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const getDateFilters = (
|
|
99
|
-
startDate: dayjs.Dayjs | null,
|
|
100
|
-
endDate: dayjs.Dayjs | null
|
|
101
|
-
) => {
|
|
102
|
-
const stored = JSON.parse(localStorage.getItem('returnDate') || '{}');
|
|
103
|
-
|
|
104
|
-
const sDate = startDate?.isValid?.() ? startDate : dayjs(stored?.startDate);
|
|
105
|
-
const eDate = endDate?.isValid?.()
|
|
106
|
-
? endDate
|
|
107
|
-
: stored?.endDate
|
|
108
|
-
? dayjs(stored?.endDate)
|
|
109
|
-
: null;
|
|
110
|
-
|
|
111
|
-
if (!sDate?.isValid?.()) return [];
|
|
112
|
-
|
|
113
|
-
let dateFilters = [];
|
|
114
|
-
|
|
115
|
-
if (eDate && eDate.isValid()) {
|
|
116
|
-
dateFilters = [
|
|
117
|
-
{ field: 'created_at', op: '>=', value: sDate.format('YYYY-MM-DD') },
|
|
118
|
-
{
|
|
119
|
-
field: 'created_at',
|
|
120
|
-
op: '<=',
|
|
121
|
-
value: eDate.add(1, 'day').format('YYYY-MM-DD'),
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
} else {
|
|
125
|
-
dateFilters = [
|
|
126
|
-
{
|
|
127
|
-
field: 'created_at',
|
|
128
|
-
op: '=',
|
|
129
|
-
value: sDate.format('YYYY-MM-DD'),
|
|
130
|
-
},
|
|
131
|
-
];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return dateFilters;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (!clientPortal) return;
|
|
139
|
-
|
|
140
|
-
const dateFilters = getDateFilters(startDate, endDate);
|
|
141
|
-
setModifiedStatsFilters(dateFilters);
|
|
142
|
-
}, [startDate, endDate]);
|
|
143
|
-
|
|
144
|
-
const { data: statsData, fetchData: fetchStatsData } = useAxios<{
|
|
94
|
+
const { fetchData: fetchStatsData } = useAxios<{
|
|
145
95
|
data: returnCountType[];
|
|
146
96
|
}>({
|
|
147
97
|
endpoint: `v1/portal/return/stats/`,
|
|
148
98
|
method: 'GET',
|
|
149
99
|
pagination: { is_pagination: false },
|
|
150
|
-
filters:
|
|
100
|
+
filters: filters,
|
|
151
101
|
});
|
|
152
102
|
|
|
153
103
|
useEffect(() => {
|
|
154
104
|
const validStatuses = ['scheduled_for_return', 'return_completed'];
|
|
155
105
|
const isClientView = clientPortal && validStatuses.includes(status || '');
|
|
156
106
|
|
|
157
|
-
if (!isClientView
|
|
158
|
-
|
|
107
|
+
if (!isClientView) return;
|
|
108
|
+
|
|
109
|
+
const trimmedText = debouncedSearchText?.trim() || '';
|
|
110
|
+
if (trimmedText.length > 0 && trimmedText.length <= 2) {
|
|
111
|
+
notification.warning({
|
|
112
|
+
message: 'Search phrase cannot be less than 2 characters',
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (trimmedText.length === 0) return;
|
|
159
117
|
const statusTypeMap: Record<string, string> = {
|
|
160
118
|
scheduled_for_return: 'scheduled',
|
|
161
119
|
return_completed: 'complete',
|
|
@@ -163,26 +121,22 @@ function ReturnAfterSearchBar() {
|
|
|
163
121
|
|
|
164
122
|
const type = statusTypeMap[status as keyof typeof statusTypeMap];
|
|
165
123
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
124
|
+
fetchStatsData({
|
|
125
|
+
endPointQuery: `?search_term=${trimmedText}&type=${type}`,
|
|
126
|
+
})
|
|
127
|
+
.then((response: any) => {
|
|
128
|
+
if (response?.data) {
|
|
129
|
+
console.log('inside response', response);
|
|
130
|
+
setCount(response.data);
|
|
131
|
+
} else {
|
|
132
|
+
setCount(null);
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
.catch((error: any) => {
|
|
136
|
+
console.error('Error fetching stats:', error);
|
|
176
137
|
setCount(null);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
fetchStats();
|
|
181
|
-
}, [debouncedSearchText, status, clientPortal]);
|
|
182
|
-
|
|
183
|
-
console.log(statsData, 'statsData');
|
|
184
|
-
|
|
185
|
-
console.log(count, 'new count');
|
|
138
|
+
});
|
|
139
|
+
}, [debouncedSearchText, status]);
|
|
186
140
|
|
|
187
141
|
const handleClear = () => {
|
|
188
142
|
setSearchText('');
|
|
@@ -13,7 +13,6 @@ import { notification } from 'antd';
|
|
|
13
13
|
import {
|
|
14
14
|
useSelectedClientAfterOrders,
|
|
15
15
|
useSelectedClientPortOrders,
|
|
16
|
-
// useSelectedClientPortOrders,
|
|
17
16
|
} from '../store';
|
|
18
17
|
|
|
19
18
|
const ReturnRTFilters = () => {
|
|
@@ -21,7 +20,6 @@ const ReturnRTFilters = () => {
|
|
|
21
20
|
const [pendingState] = useAtom(filtersReducerAtom);
|
|
22
21
|
const [state] = useAtom(filtersReducerReturnAtom);
|
|
23
22
|
const [returnAfterOrder] = useReturnAfterOrderData();
|
|
24
|
-
// const [selectedReturnOrder] = useSelectedClientPortOrders();
|
|
25
23
|
const [
|
|
26
24
|
selectedOrderIds,
|
|
27
25
|
setSelectedOrderIds,
|