@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
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.19-
|
|
2
|
+
"version": "0.1.19-prod",
|
|
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,139 @@
|
|
|
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
|
+
//client portal
|
|
60
|
+
case 'SET_SCHEDULED_RETURN_FILTER':
|
|
61
|
+
if (action.payload) {
|
|
62
|
+
return {
|
|
63
|
+
...state,
|
|
64
|
+
'x-filters': [
|
|
65
|
+
...state['x-filters'].filter(f => f.field !== 'order_status'),
|
|
66
|
+
{
|
|
67
|
+
field: 'order_status',
|
|
68
|
+
op: '=',
|
|
69
|
+
value: action.payload,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
return {
|
|
75
|
+
...state,
|
|
76
|
+
'x-filters': state['x-filters'].filter(
|
|
77
|
+
f => f.field !== 'order_status'
|
|
78
|
+
),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
case 'SET_RETURN_COMPLETED_FILTER':
|
|
83
|
+
if (action.payload) {
|
|
84
|
+
return {
|
|
85
|
+
...state,
|
|
86
|
+
'x-filters': [
|
|
87
|
+
...state['x-filters'].filter(f => f.field !== 'order_status'),
|
|
88
|
+
{
|
|
89
|
+
field: 'order_status',
|
|
90
|
+
op: '=',
|
|
91
|
+
value: action.payload,
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
} else {
|
|
96
|
+
return {
|
|
97
|
+
...state,
|
|
98
|
+
'x-filters': state['x-filters'].filter(
|
|
99
|
+
f => f.field !== 'order_status'
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
case 'SET_PAGE':
|
|
105
|
+
return {
|
|
106
|
+
...state,
|
|
107
|
+
'x-pagination': {
|
|
108
|
+
...state['x-pagination'],
|
|
109
|
+
page: action.payload,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
case 'SET_PERPAGE':
|
|
114
|
+
return {
|
|
115
|
+
...state,
|
|
116
|
+
'x-pagination': {
|
|
117
|
+
...state['x-pagination'],
|
|
118
|
+
per_page: action.payload,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
case 'CLEAR_FILTERS':
|
|
122
|
+
return {
|
|
123
|
+
...state,
|
|
124
|
+
};
|
|
125
|
+
default:
|
|
126
|
+
return state;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const overviewfiltersStateAtom = atom(initialState);
|
|
131
|
+
|
|
132
|
+
export const dateFilterCPReducer = atom(
|
|
133
|
+
get => get(overviewfiltersStateAtom),
|
|
134
|
+
(get, set, action) =>
|
|
135
|
+
set(
|
|
136
|
+
overviewfiltersStateAtom,
|
|
137
|
+
overviewFilterReducer(get(overviewfiltersStateAtom), action)
|
|
138
|
+
)
|
|
139
|
+
);
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Checkbox,
|
|
3
|
+
displayValueOrNA,
|
|
4
|
+
useAxios,
|
|
5
|
+
} from '@bjsdistribution/dms-component-library';
|
|
6
|
+
import { Empty, notification, Skeleton } from 'antd';
|
|
7
|
+
import { format } from 'date-fns';
|
|
8
|
+
import { useAtom } from 'jotai';
|
|
9
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
+
import { NavLink } from 'react-router-dom';
|
|
11
|
+
import { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';
|
|
12
|
+
import {
|
|
13
|
+
useClientOutstandingReturnData,
|
|
14
|
+
useClientPortal,
|
|
15
|
+
useLocationData,
|
|
16
|
+
useSearchText,
|
|
17
|
+
useSelectedClientPortOrders,
|
|
18
|
+
} from '../store';
|
|
19
|
+
import { usefetchAgain } from '../order-view/store';
|
|
20
|
+
import {
|
|
21
|
+
useLoading,
|
|
22
|
+
UsePaginationData,
|
|
23
|
+
usePrintOptionTOggle,
|
|
24
|
+
} from '../order-daily-overview/store/store';
|
|
25
|
+
import SortIcon from '../../common/SortIcon';
|
|
26
|
+
import CaretDownFilledIcon from '../../common/CaretDownFilledIcon';
|
|
27
|
+
import { ApiResponse } from '../types';
|
|
28
|
+
import {
|
|
29
|
+
CustomDrop,
|
|
30
|
+
EmptyDataContainer,
|
|
31
|
+
StyledTable,
|
|
32
|
+
StyledTableWrapper,
|
|
33
|
+
} from '../order-daily-overview/return-order-table/return-orders-filters/returnstyles';
|
|
34
|
+
import PrinterIcon from '../../assets/icons/PrinterIcon';
|
|
35
|
+
import DownIcon from '../../assets/icons/DownIcon';
|
|
36
|
+
import PrintDropDownReturn from '../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
|
|
37
|
+
import { dateFilterCPReducer } from './DateFilterStore';
|
|
38
|
+
|
|
39
|
+
const OutstandingTable = () => {
|
|
40
|
+
const [statePagination] = useAtom(filtersReducerAtom);
|
|
41
|
+
const { 'x-pagination': pagination } = statePagination;
|
|
42
|
+
const [
|
|
43
|
+
outstandingReturnData,
|
|
44
|
+
setOutstandingReturnData,
|
|
45
|
+
] = useClientOutstandingReturnData();
|
|
46
|
+
const [load, setLoading] = useLoading();
|
|
47
|
+
const dropdownRefParent = useRef<HTMLDivElement>(null);
|
|
48
|
+
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
49
|
+
const [printToogle, setPrintToggle] = usePrintOptionTOggle();
|
|
50
|
+
const [locationData] = useLocationData();
|
|
51
|
+
const [, setPaginationObject] = UsePaginationData();
|
|
52
|
+
const [callForFetch] = usefetchAgain();
|
|
53
|
+
const [clientPortal] = useClientPortal();
|
|
54
|
+
const [selectedOrderIds, setSelectedOrderIds] = useSelectedClientPortOrders();
|
|
55
|
+
const [selectClientAll, setSelectClientAll] = useState(false);
|
|
56
|
+
const [debouncedSearchText] = useSearchText();
|
|
57
|
+
|
|
58
|
+
const [state] = useAtom(dateFilterCPReducer);
|
|
59
|
+
const { 'x-filters': filters } = state;
|
|
60
|
+
|
|
61
|
+
//sorting
|
|
62
|
+
const [sortConfig, setSortConfig] = useState<{
|
|
63
|
+
key: string;
|
|
64
|
+
direction: 'asc' | 'desc';
|
|
65
|
+
} | null>(null);
|
|
66
|
+
|
|
67
|
+
const handleSort = (key: string) => {
|
|
68
|
+
setSortConfig((prev: any) => {
|
|
69
|
+
if (prev?.key === key && prev.direction === 'asc') {
|
|
70
|
+
return { key, direction: 'desc' };
|
|
71
|
+
}
|
|
72
|
+
return { key, direction: 'asc' };
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const sortedData = useMemo(() => {
|
|
77
|
+
if (!outstandingReturnData || !sortConfig) return outstandingReturnData;
|
|
78
|
+
|
|
79
|
+
const { key, direction } = sortConfig;
|
|
80
|
+
return [...outstandingReturnData].sort((a, b) => {
|
|
81
|
+
const valueA = a[key];
|
|
82
|
+
const valueB = b[key];
|
|
83
|
+
|
|
84
|
+
if (typeof valueA === 'number' && typeof valueB === 'number') {
|
|
85
|
+
return direction === 'asc' ? valueA - valueB : valueB - valueA;
|
|
86
|
+
}
|
|
87
|
+
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
88
|
+
return direction === 'asc'
|
|
89
|
+
? valueA.localeCompare(valueB)
|
|
90
|
+
: valueB.localeCompare(valueA);
|
|
91
|
+
}
|
|
92
|
+
return 0;
|
|
93
|
+
});
|
|
94
|
+
}, [outstandingReturnData, sortConfig]);
|
|
95
|
+
|
|
96
|
+
const renderSortIcon = (columnKey: string) => {
|
|
97
|
+
if (!sortConfig || sortConfig.key !== columnKey) {
|
|
98
|
+
return <SortIcon />;
|
|
99
|
+
}
|
|
100
|
+
return sortConfig.direction === 'asc' ? (
|
|
101
|
+
<CaretDownFilledIcon />
|
|
102
|
+
) : (
|
|
103
|
+
<CaretDownFilledIcon />
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const OpenDropDown = (index: number) => {
|
|
108
|
+
setPrintToggle(prevIndex => (prevIndex === index ? null : index));
|
|
109
|
+
};
|
|
110
|
+
// Close dropdown outside click
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
113
|
+
return () => {
|
|
114
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
115
|
+
};
|
|
116
|
+
}, []);
|
|
117
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
118
|
+
if (
|
|
119
|
+
dropdownRef.current &&
|
|
120
|
+
!dropdownRef.current.contains(event.target as Node)
|
|
121
|
+
) {
|
|
122
|
+
setPrintToggle(null);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const cleanedFilters = filters.filter(f => f.field !== 'order_status');
|
|
127
|
+
const baseFilters = [
|
|
128
|
+
{ field: 'isdeleted', op: '=', value: 0 },
|
|
129
|
+
{ field: 'product_return_action_id', op: '=', value: 'RTS' },
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const modifiedFilters = [...baseFilters, ...cleanedFilters];
|
|
133
|
+
const {
|
|
134
|
+
data: fetchedOrderData,
|
|
135
|
+
loading: returnDataLoad,
|
|
136
|
+
paginationData,
|
|
137
|
+
fetchData,
|
|
138
|
+
} = useAxios<ApiResponse>({
|
|
139
|
+
endpoint: '/v1/return/product/pending/',
|
|
140
|
+
method: 'GET',
|
|
141
|
+
filters: modifiedFilters,
|
|
142
|
+
pagination: pagination,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
if (clientPortal && debouncedSearchText === '') {
|
|
147
|
+
fetchData();
|
|
148
|
+
}
|
|
149
|
+
}, [JSON.stringify(modifiedFilters), debouncedSearchText]);
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
setLoading(returnDataLoad);
|
|
153
|
+
if (fetchedOrderData && fetchedOrderData?.data) {
|
|
154
|
+
setOutstandingReturnData(fetchedOrderData?.data);
|
|
155
|
+
if (paginationData) {
|
|
156
|
+
try {
|
|
157
|
+
const { count, ...rest } = JSON.parse(paginationData);
|
|
158
|
+
setPaginationObject(rest);
|
|
159
|
+
} catch (error) {
|
|
160
|
+
console.error('Error parsing paginationData:', error);
|
|
161
|
+
notification.error({
|
|
162
|
+
message: 'Error',
|
|
163
|
+
description: 'Failed to parse pagination data',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
notification.error({
|
|
168
|
+
message: 'Error',
|
|
169
|
+
description: 'Pagination data is null or undefined',
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}, [fetchedOrderData, returnDataLoad]);
|
|
174
|
+
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
setLoading(returnDataLoad);
|
|
177
|
+
if (fetchedOrderData && fetchedOrderData?.data && locationData) {
|
|
178
|
+
const updatedReturnData = fetchedOrderData.data.map(returnItem => {
|
|
179
|
+
const matchingLocation = locationData.find(
|
|
180
|
+
(location: any) => location?.token === returnItem?.return_location
|
|
181
|
+
);
|
|
182
|
+
return {
|
|
183
|
+
...returnItem,
|
|
184
|
+
new_location: matchingLocation
|
|
185
|
+
? matchingLocation?.location_name
|
|
186
|
+
: null,
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
setOutstandingReturnData(updatedReturnData);
|
|
191
|
+
}
|
|
192
|
+
}, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);
|
|
193
|
+
|
|
194
|
+
//Client Portal
|
|
195
|
+
const handleSelectOrderId = (id: string | number) => {
|
|
196
|
+
setSelectedOrderIds(prev =>
|
|
197
|
+
prev.includes(id) ? prev.filter(orderId => orderId !== id) : [...prev, id]
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleClientSelectAll = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
202
|
+
const isChecked = e.target.checked;
|
|
203
|
+
setSelectClientAll(isChecked);
|
|
204
|
+
|
|
205
|
+
if (isChecked) {
|
|
206
|
+
setSelectedOrderIds(
|
|
207
|
+
outstandingReturnData?.map((item: any) => item?.order_id) || []
|
|
208
|
+
);
|
|
209
|
+
} else {
|
|
210
|
+
setSelectedOrderIds([]);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
return (
|
|
214
|
+
<>
|
|
215
|
+
<StyledTableWrapper className="fortables">
|
|
216
|
+
<StyledTable>
|
|
217
|
+
<thead>
|
|
218
|
+
<tr>
|
|
219
|
+
{/* <th className="emailInvoiceCheckbox">
|
|
220
|
+
<Checkbox checked={selectAll} onChange={handleSelectAll} />
|
|
221
|
+
</th> */}
|
|
222
|
+
<th className="emailInvoiceCheckbox">
|
|
223
|
+
<Checkbox
|
|
224
|
+
checked={selectClientAll}
|
|
225
|
+
onChange={handleClientSelectAll}
|
|
226
|
+
/>
|
|
227
|
+
</th>
|
|
228
|
+
<th onClick={() => handleSort('return_location_name')}>
|
|
229
|
+
<div className="sortIconClass">
|
|
230
|
+
Return Location {renderSortIcon('return_location_name')}
|
|
231
|
+
</div>
|
|
232
|
+
</th>
|
|
233
|
+
<th onClick={() => handleSort('recipient_name')}>
|
|
234
|
+
<div className="sortIconClass">
|
|
235
|
+
Recipient {renderSortIcon('recipient_name')}
|
|
236
|
+
</div>
|
|
237
|
+
</th>
|
|
238
|
+
<th>Return Action</th>
|
|
239
|
+
<th>Code</th>
|
|
240
|
+
<th>Description</th>
|
|
241
|
+
<th>Part</th>
|
|
242
|
+
<th onClick={() => handleSort('weight')}>
|
|
243
|
+
<div className="sortIconClass">
|
|
244
|
+
Weight {renderSortIcon('weight')}
|
|
245
|
+
</div>
|
|
246
|
+
</th>
|
|
247
|
+
<th>CBM</th>
|
|
248
|
+
<th onClick={() => handleSort('return_reason')}>
|
|
249
|
+
<div className="sortIconClass">
|
|
250
|
+
Return Reason {renderSortIcon('return_reason')}
|
|
251
|
+
</div>
|
|
252
|
+
</th>
|
|
253
|
+
<th>Collected</th>
|
|
254
|
+
<th onClick={() => handleSort('collection_reason')}>
|
|
255
|
+
<div className="sortIconClass">
|
|
256
|
+
Collection Reason {renderSortIcon('collection_reason')}
|
|
257
|
+
</div>
|
|
258
|
+
</th>
|
|
259
|
+
<th className="emailInvoiceShare">Labels</th>
|
|
260
|
+
</tr>
|
|
261
|
+
</thead>
|
|
262
|
+
<tbody>
|
|
263
|
+
{load ? (
|
|
264
|
+
<tr>
|
|
265
|
+
<td colSpan={14}>
|
|
266
|
+
<Skeleton active />
|
|
267
|
+
</td>
|
|
268
|
+
</tr>
|
|
269
|
+
) : sortedData?.length === 0 ? (
|
|
270
|
+
<tr>
|
|
271
|
+
<td colSpan={14}>
|
|
272
|
+
<EmptyDataContainer>
|
|
273
|
+
<Empty />
|
|
274
|
+
</EmptyDataContainer>
|
|
275
|
+
</td>
|
|
276
|
+
</tr>
|
|
277
|
+
) : (
|
|
278
|
+
sortedData?.map((item: any, index: any) => (
|
|
279
|
+
<tr key={item.id}>
|
|
280
|
+
<td>
|
|
281
|
+
<Checkbox
|
|
282
|
+
checked={selectedOrderIds.includes(item?.order_id)}
|
|
283
|
+
onChange={() => handleSelectOrderId(item?.order_id)}
|
|
284
|
+
/>
|
|
285
|
+
</td>
|
|
286
|
+
<td> {displayValueOrNA(item?.return_location_name)}</td>
|
|
287
|
+
<td>
|
|
288
|
+
<ul style={{ listStyleType: 'none', padding: 0 }}>
|
|
289
|
+
<li
|
|
290
|
+
style={{
|
|
291
|
+
color: '#0099ff',
|
|
292
|
+
fontWeight: 600,
|
|
293
|
+
paddingLeft: 0,
|
|
294
|
+
}}
|
|
295
|
+
>
|
|
296
|
+
<NavLink to={`/orders/view/${item?.order_id}`}>
|
|
297
|
+
{displayValueOrNA(item?.recipient_name)}
|
|
298
|
+
</NavLink>
|
|
299
|
+
</li>
|
|
300
|
+
<li style={{ color: '#888075' }}>
|
|
301
|
+
{displayValueOrNA(item?.postcode)}
|
|
302
|
+
</li>
|
|
303
|
+
</ul>
|
|
304
|
+
</td>
|
|
305
|
+
<td>{displayValueOrNA(item?.product_return_action)}</td>
|
|
306
|
+
<td>{displayValueOrNA(item?.code)}</td>
|
|
307
|
+
<td>{displayValueOrNA(item?.description)}</td>
|
|
308
|
+
<td>{displayValueOrNA(item?.part)}</td>
|
|
309
|
+
<td>
|
|
310
|
+
{displayValueOrNA(item?.weight)}{' '}
|
|
311
|
+
{item?.weight && item?.weight !== null ? 'KG' : ''}
|
|
312
|
+
</td>
|
|
313
|
+
<td>{displayValueOrNA(item?.cube)}</td>
|
|
314
|
+
<td>{displayValueOrNA(item?.return_reason)}</td>
|
|
315
|
+
<td>
|
|
316
|
+
{item?.collected_at
|
|
317
|
+
? format(new Date(item?.collected_at), 'dd/MM/yyyy')
|
|
318
|
+
: 'UNKNOWN'}
|
|
319
|
+
</td>
|
|
320
|
+
|
|
321
|
+
<td>{displayValueOrNA(item?.collection_reason)}</td>
|
|
322
|
+
<td>
|
|
323
|
+
<ul className="actionbox">
|
|
324
|
+
<CustomDrop
|
|
325
|
+
ref={dropdownRefParent}
|
|
326
|
+
className={printToogle === index ? 'active' : ''}
|
|
327
|
+
>
|
|
328
|
+
<li
|
|
329
|
+
className="shareIconContainer"
|
|
330
|
+
onClick={() => OpenDropDown(index)}
|
|
331
|
+
>
|
|
332
|
+
<PrinterIcon />
|
|
333
|
+
<DownIcon />
|
|
334
|
+
{printToogle === index && (
|
|
335
|
+
<div ref={dropdownRef}>
|
|
336
|
+
<PrintDropDownReturn
|
|
337
|
+
legacyURL={item?.return_order_product_label}
|
|
338
|
+
legacyProductID={item?.legacy_product_id}
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
)}
|
|
342
|
+
</li>
|
|
343
|
+
</CustomDrop>
|
|
344
|
+
</ul>
|
|
345
|
+
</td>
|
|
346
|
+
</tr>
|
|
347
|
+
))
|
|
348
|
+
)}
|
|
349
|
+
</tbody>
|
|
350
|
+
</StyledTable>
|
|
351
|
+
</StyledTableWrapper>
|
|
352
|
+
</>
|
|
353
|
+
);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
export default OutstandingTable;
|