@bjsdistribution/dms-client-return 0.1.7-prod → 0.1.8-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.
Files changed (83) hide show
  1. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  2. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  3. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  4. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  5. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  6. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  7. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  8. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  9. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  10. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  11. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  12. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  13. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  14. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  15. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  29. package/dist/components/order-view/products-info/expanded-content/index.d.ts +4 -1
  30. package/dist/components/order-view/return-client-products/ProductTable.d.ts +4 -1
  31. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +4 -1
  32. package/dist/components/order-view/store.d.ts +14 -2
  33. package/dist/components/order-view/types.d.ts +49 -1
  34. package/dist/components/order-view/utils.d.ts +3 -0
  35. package/dist/dms-client-return.cjs.development.js +2636 -335
  36. package/dist/dms-client-return.cjs.development.js.map +1 -1
  37. package/dist/dms-client-return.cjs.production.min.js +1 -1
  38. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  39. package/dist/dms-client-return.esm.js +2700 -399
  40. package/dist/dms-client-return.esm.js.map +1 -1
  41. package/package.json +5 -3
  42. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +43 -15
  43. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +24 -11
  44. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  45. package/src/components/order-view/index.tsx +29 -0
  46. package/src/components/order-view/notes/AddNote.tsx +14 -34
  47. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  48. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  49. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  50. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  51. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  52. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  53. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  54. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  55. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  56. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  57. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  58. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  59. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  60. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  61. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  62. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  63. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  64. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  65. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  66. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  67. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  68. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  69. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  70. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  71. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  72. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  73. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  74. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  75. package/src/components/order-view/order-actions/index.tsx +10 -0
  76. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  77. package/src/components/order-view/products-info/expanded-content/index.tsx +27 -11
  78. package/src/components/order-view/products-info/index.tsx +4 -4
  79. package/src/components/order-view/return-client-products/ProductTable.tsx +6 -2
  80. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +54 -15
  81. package/src/components/order-view/store.ts +106 -0
  82. package/src/components/order-view/types.ts +54 -1
  83. package/src/components/order-view/utils.ts +37 -0
@@ -0,0 +1,90 @@
1
+ import {
2
+ dropdownStyles,
3
+ Label,
4
+ SelectDropdown,
5
+ } from '@bjsdistribution/dms-component-library';
6
+ import React, { useEffect } from 'react';
7
+ import styled from 'styled-components';
8
+ import {
9
+ useEscalationCategory,
10
+ useEscalationLevel,
11
+ useOrderStaticData,
12
+ } from '../../../../store';
13
+
14
+ function EscalationLevel() {
15
+ const [orderStaticData] = useOrderStaticData();
16
+ const [escalationCategory] = useEscalationCategory();
17
+ const [escalationLevel, setEscalationLevel] = useEscalationLevel();
18
+ const escalationLevelOptions = orderStaticData?.escalation_levels?.map(
19
+ (escalation: any) => {
20
+ return {
21
+ label: escalation?.type,
22
+ value: escalation?.id,
23
+ };
24
+ }
25
+ );
26
+ const escalationTypes = orderStaticData?.escalation_types;
27
+ useEffect(() => {
28
+ const selectedEscalationLevelId = escalationTypes?.find(
29
+ (item: any) => item?.escalation_category_id === escalationCategory?.value
30
+ )?.escalation_level_id;
31
+
32
+ const defaultLevel = escalationLevelOptions?.find(
33
+ (item: any) => item.value === selectedEscalationLevelId
34
+ );
35
+
36
+ setEscalationLevel(defaultLevel);
37
+ }, [escalationCategory]);
38
+
39
+ return (
40
+ <Container>
41
+ <Label label="Escalation Level" />
42
+ <SelectDropdown
43
+ options={escalationLevelOptions || []}
44
+ styles={{
45
+ ...dropdownStyles,
46
+ control: (styles, state) => ({
47
+ ...styles,
48
+ border: '1px solid #D0D5DD',
49
+ cursor: 'pointer',
50
+ borderRadius: `${
51
+ state.selectProps.menuIsOpen ? '0px 0px 6px 6px' : '6px'
52
+ }`,
53
+ boxShadow: '0px 3px 22px #00000014',
54
+ minHeight: '40px',
55
+ '&:hover': {
56
+ borderColor: '#D0D5DD',
57
+ boxShadow: '0px 3px 22px #00000014',
58
+ },
59
+ }),
60
+ menu: styles => ({
61
+ ...styles,
62
+ marginBottom: '0px',
63
+ borderRadius: '6px 6px 0px 0px',
64
+ boxShadow: '0px 3px 22px #00000014',
65
+ border: '1px solid #D0D5DD',
66
+ borderBottom: '0px',
67
+ }),
68
+ dropdownIndicator: (styles, state) => ({
69
+ ...styles,
70
+ transition: 'all 0.3s ease-in-out',
71
+ transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'null',
72
+ }),
73
+ }}
74
+ placeholder="Select Level"
75
+ menuPlacement="top"
76
+ value={escalationLevel}
77
+ onChange={selectedOption => setEscalationLevel(selectedOption)}
78
+ />
79
+ </Container>
80
+ );
81
+ }
82
+
83
+ const Container = styled.div`
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 8px;
87
+ flex: 1;
88
+ `;
89
+
90
+ export default EscalationLevel;
@@ -0,0 +1,122 @@
1
+ import {
2
+ Label,
3
+ SelectDropdown,
4
+ dropdownStyles,
5
+ } from '@bjsdistribution/dms-component-library';
6
+ import React, { useEffect } from 'react';
7
+ import styled from 'styled-components';
8
+
9
+ import {
10
+ useEscalationCategory,
11
+ useEscalationReason,
12
+ useFailureReason,
13
+ useIsFailureReasonChanged,
14
+ useOrderStaticData,
15
+ } from '../../../../store';
16
+
17
+ function EscalationReason() {
18
+ const [
19
+ escalationReasonState,
20
+ setEscalationReasonState,
21
+ ] = useEscalationReason();
22
+ const [orderStaticData] = useOrderStaticData();
23
+ const [escalationCategory] = useEscalationCategory();
24
+ const [failureReason] = useFailureReason();
25
+ const [
26
+ isFailureReasonChanged,
27
+ setIsFailureReasonChanged,
28
+ ] = useIsFailureReasonChanged();
29
+
30
+ const escalationTypes = orderStaticData?.escalation_types;
31
+
32
+ const escalationTypeId = escalationTypes?.find(
33
+ (item: any) => item?.escalation_category_id === escalationCategory?.value
34
+ )?.id;
35
+
36
+ const escalationReasons = orderStaticData?.escalation_reasons?.filter(
37
+ (x: any) => x?.escalation_type_id === escalationTypeId
38
+ );
39
+
40
+ const escalationReasonsOptions = escalationReasons?.map((item: any) => {
41
+ const matchedItem = orderStaticData?.order_escalation_reasons?.find(
42
+ (x: any) => x?.id === item?.order_reason_id
43
+ );
44
+ if (matchedItem !== undefined) {
45
+ return {
46
+ label: matchedItem?.reason,
47
+ value: matchedItem?.id,
48
+ };
49
+ } else {
50
+ return;
51
+ }
52
+ });
53
+ const filteredEscReasonOptions = escalationReasonsOptions?.filter(
54
+ (option: any) => option !== undefined
55
+ );
56
+
57
+ useEffect(() => {
58
+ if (isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {
59
+ // ids of both esc reason options and failure reason not matched but their labels matched
60
+ const reason = filteredEscReasonOptions?.find(
61
+ (option: any) => option?.label === failureReason?.label
62
+ );
63
+ setEscalationReasonState(reason);
64
+ setIsFailureReasonChanged(false);
65
+ }
66
+ if (!isFailureReasonChanged && filteredEscReasonOptions?.length > 0) {
67
+ setEscalationReasonState(filteredEscReasonOptions[0]);
68
+ }
69
+ }, [escalationCategory]);
70
+
71
+ return (
72
+ <Container>
73
+ <Label label="Escalation Reason" />
74
+ <SelectDropdown
75
+ options={filteredEscReasonOptions || []}
76
+ styles={{
77
+ ...dropdownStyles,
78
+ control: (styles, state) => ({
79
+ ...styles,
80
+ border: '1px solid #D0D5DD',
81
+ cursor: 'pointer',
82
+ borderRadius: `${
83
+ state.selectProps.menuIsOpen ? '0px 0px 6px 6px' : '6px'
84
+ }`,
85
+ boxShadow: '0px 3px 22px #00000014',
86
+ minHeight: '40px',
87
+ '&:hover': {
88
+ borderColor: '#D0D5DD',
89
+ boxShadow: '0px 3px 22px #00000014',
90
+ },
91
+ }),
92
+ menu: styles => ({
93
+ ...styles,
94
+ marginBottom: '0px',
95
+ borderRadius: '6px 6px 0px 0px',
96
+ boxShadow: '0px 3px 22px #00000014',
97
+ border: '1px solid #D0D5DD',
98
+ borderBottom: '0px',
99
+ }),
100
+ dropdownIndicator: (styles, state) => ({
101
+ ...styles,
102
+ transition: 'all 0.3s ease-in-out',
103
+ transform: state.selectProps.menuIsOpen ? 'rotate(180deg)' : 'null',
104
+ }),
105
+ }}
106
+ placeholder="Select Reason"
107
+ menuPlacement="top"
108
+ value={escalationReasonState}
109
+ onChange={selectedOption => setEscalationReasonState(selectedOption)}
110
+ />
111
+ </Container>
112
+ );
113
+ }
114
+
115
+ const Container = styled.div`
116
+ display: flex;
117
+ flex-direction: column;
118
+ gap: 8px;
119
+ flex: 1;
120
+ `;
121
+
122
+ export default EscalationReason;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import EscalationCategory from './EscalationCategory';
3
+ import EscalationLevel from './EscalationLevel';
4
+ import EscalationReason from './EscalationReason';
5
+
6
+ function Escalation() {
7
+ return (
8
+ <div style={{ display: 'flex', gap: '15px', width: '100%' }}>
9
+ <EscalationCategory />
10
+ <EscalationLevel />
11
+ <EscalationReason />
12
+ </div>
13
+ );
14
+ }
15
+
16
+ export default Escalation;
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { FlagAlert } from '@bjsdistribution/dms-component-library';
4
+
5
+ function FDFlagTemplate({ dismissFlags }: any) {
6
+ const titleColor = '#36A053';
7
+ return (
8
+ <FlagAlert
9
+ type={'info'}
10
+ title={
11
+ <>
12
+ <StyledTitle color={titleColor}>
13
+ Flag : {'Private'}{' '}
14
+ <StyledLink>
15
+ {'Helo'} - {''}{' '}
16
+ </StyledLink>{' '}
17
+ {'new'}{' '}
18
+ </StyledTitle>
19
+ </>
20
+ }
21
+ subtitle=""
22
+ description={'description'}
23
+ showOkButton={false}
24
+ onClose={() => dismissFlags()}
25
+ />
26
+ );
27
+ }
28
+
29
+ const StyledLink = styled.span`
30
+ color: #6396e5;
31
+ font-family: Roboto;
32
+ font-size: 14px;
33
+ font-style: normal;
34
+ font-weight: 600;
35
+ cursor: pointer;
36
+ `;
37
+
38
+ const StyledTitle = styled.span<{ color: string }>`
39
+ color: ${({ color }) => color};
40
+ font-family: Roboto;
41
+ font-size: 14px;
42
+ font-style: normal;
43
+ font-weight: 600;
44
+ `;
45
+
46
+ export default FDFlagTemplate;
@@ -0,0 +1,117 @@
1
+ import { FlagAlert } from '@bjsdistribution/dms-component-library';
2
+ import React, { useState } from 'react';
3
+ import styled from 'styled-components';
4
+ import { format, parseISO } from 'date-fns';
5
+ import { useOrderDetails } from '../../../../store';
6
+ import { useRouteDetails } from '../../../store';
7
+
8
+ function OrderTemplate() {
9
+ const [orderDetails] = useOrderDetails();
10
+ const [routesDetails] = useRouteDetails();
11
+ const [alertVisibility, setAlertVisibility] = useState({
12
+ isAllocated: true,
13
+ isOrderStatusNote: true,
14
+ });
15
+
16
+ const isRouteId = orderDetails?.order_routes?.route_id != null;
17
+ //on close alert functionality
18
+ const onCloseAlert = (alertType: string) => {
19
+ setAlertVisibility(prev => ({
20
+ ...prev,
21
+ [alertType]: false,
22
+ }));
23
+ };
24
+
25
+ return (
26
+ <StyledAlert>
27
+ <>
28
+ {alertVisibility.isAllocated && (
29
+ <>
30
+ {isRouteId ? (
31
+ <FlagAlert
32
+ type="info"
33
+ title=""
34
+ description={
35
+ <>
36
+ <Title>Allocated To Route :</Title>
37
+ {routesDetails?.route_name || ''}
38
+ {routesDetails?.route_lock
39
+ ? `*Locked* on ${routesDetails?.route_detail?.vehicle_number} `
40
+ : ''}{' '}
41
+ | Crew:
42
+ {routesDetails?.crew1 || 'N/A'} &{' '}
43
+ {routesDetails?.crew2 || 'N/A'} |{' '}
44
+ {routesDetails?.route_date
45
+ ? format(
46
+ parseISO(routesDetails?.route_date),
47
+ 'dd/MM/yyyy'
48
+ )
49
+ : ''}
50
+ </>
51
+ }
52
+ showOkButton={false}
53
+ onClose={() => onCloseAlert('isAllocated')}
54
+ />
55
+ ) : (
56
+ <FlagAlert
57
+ type="info"
58
+ title=""
59
+ description={
60
+ <>
61
+ <Title>Allocated To Route :</Title>{' '}
62
+ <Info>Route not allocated</Info>
63
+ </>
64
+ }
65
+ showOkButton={false}
66
+ onClose={() => onCloseAlert('isAllocated')}
67
+ />
68
+ )}
69
+ </>
70
+ )}
71
+ </>
72
+
73
+ {alertVisibility.isOrderStatusNote && (
74
+ <>
75
+ {orderDetails?.order_status_note && (
76
+ <>
77
+ <FlagAlert
78
+ type="info"
79
+ title=""
80
+ description={
81
+ <>
82
+ <Title>Order Status Note : </Title>
83
+ {orderDetails?.order_status_note}
84
+ </>
85
+ }
86
+ showOkButton={false}
87
+ onClose={() => onCloseAlert('isOrderStatusNote')}
88
+ />
89
+ </>
90
+ )}
91
+ </>
92
+ )}
93
+ </StyledAlert>
94
+ );
95
+ }
96
+ const StyledAlert = styled.div`
97
+ display: contents;
98
+ gap: 15px;
99
+ `;
100
+
101
+ const Title = styled.span`
102
+ color: #6396e5;
103
+ font-family: Roboto;
104
+ font-size: 14px;
105
+ font-style: normal;
106
+ font-weight: 600;
107
+ `;
108
+
109
+ const Info = styled.span`
110
+ color: #6a7378;
111
+ font-family: Lato;
112
+ font-size: 13px;
113
+ font-style: normal;
114
+ font-weight: 600;
115
+ `;
116
+
117
+ export default OrderTemplate;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import OrderTemplate from './OrderTemplate';
4
+ import FlagTemplate from '../../../../notification/FlagTemplate';
5
+ import { useTasksData } from '../../../store';
6
+
7
+ function Tabs({ dismissFlags }: any) {
8
+ const [taskData] = useTasksData();
9
+
10
+ return (
11
+ <>
12
+ <Content>
13
+ <Container className="tab-content">
14
+ <OrderTemplate />
15
+ {taskData?.map((item: any, index: any) => (
16
+ <FlagTemplate key={index} data={item} dismissFlags={dismissFlags} />
17
+ ))}
18
+ </Container>
19
+ </Content>
20
+ </>
21
+ );
22
+ }
23
+ const Container = styled.div`
24
+ gap: 15px;
25
+ display: grid;
26
+ `;
27
+
28
+ const Content = styled.div`
29
+ display: flex;
30
+ flex-direction: column;
31
+ `;
32
+ export default Tabs;
@@ -0,0 +1,180 @@
1
+ import { useAxios } from '@bjsdistribution/dms-component-library';
2
+ import React, { useEffect } from 'react';
3
+ import Tabs from './Tabs';
4
+ import styled from 'styled-components';
5
+ import { useRouteDetails, useTasksData } from '../../../store';
6
+ import { useOrderDetails } from '../../../../store';
7
+
8
+ interface ApiResponse {
9
+ message: string;
10
+ code: number;
11
+ error: string | null;
12
+ error_traceback: string | null;
13
+ data: [];
14
+ setShouldPerformAction: boolean;
15
+ }
16
+
17
+ function FDNotification() {
18
+ const [taskData, setTasksData] = useTasksData();
19
+ const [orderData] = useOrderDetails();
20
+ const routeId = orderData?.order_routes?.route_id;
21
+ const [, setRouteDetails] = useRouteDetails();
22
+
23
+ //Unresolved API
24
+ const {
25
+ data: fetchedUnresolvedData,
26
+ loading: unresolvedLoading,
27
+ fetchData: callUnresolvedTaskApi,
28
+ } = useAxios<{
29
+ data: ApiResponse[];
30
+ }>({
31
+ endpoint: `/v1/task/`,
32
+ method: 'GET',
33
+ pagination: { is_pagination: false },
34
+ filters: [
35
+ { field: 'department', op: '=', value: 'debrief' },
36
+ {
37
+ field: 'order_id',
38
+ op: '=',
39
+ value: `${orderData?.id}`,
40
+ },
41
+ ],
42
+ });
43
+
44
+ //flags data set
45
+ useEffect(() => {
46
+ if (fetchedUnresolvedData && fetchedUnresolvedData?.data) {
47
+ setTasksData(fetchedUnresolvedData?.data);
48
+ }
49
+ }, [unresolvedLoading, fetchedUnresolvedData]);
50
+
51
+ useEffect(() => {
52
+ const fetchData = async () => {
53
+ if (orderData?.id == null) return;
54
+
55
+ try {
56
+ await callUnresolvedTaskApi();
57
+ } catch (error) {
58
+ console.error('Error while fetching order-related data:', error);
59
+ }
60
+ };
61
+
62
+ fetchData();
63
+ }, [orderData?.id]);
64
+
65
+ const {
66
+ fetchData: fetchRouteDetails,
67
+ data: routesData,
68
+ loading: routesDataLoading,
69
+ } = useAxios<{
70
+ data: any;
71
+ }>({
72
+ endpoint: `/route/debrief/`,
73
+ method: 'GET',
74
+ });
75
+ useEffect(() => {
76
+ if (routeId !== undefined && routeId !== null) {
77
+ fetchRouteDetails({
78
+ endPointQuery: routeId,
79
+ });
80
+ } else {
81
+ setRouteDetails([]);
82
+ }
83
+ }, [routeId]);
84
+
85
+ useEffect(() => {
86
+ if (routesData?.data?.length > 0) {
87
+ const routeData: any = routesData?.data[0];
88
+ setRouteDetails(routeData);
89
+ }
90
+ }, [routesDataLoading]);
91
+
92
+ return (
93
+ <>
94
+ <Section>
95
+ {unresolvedLoading ? (
96
+ <Loader>
97
+ <Spinner />
98
+ <Text>Fetching Notifications...</Text>
99
+ </Loader>
100
+ ) : taskData?.length > 0 || orderData ? (
101
+ <TabsWrapper>
102
+ <Tabs />
103
+ </TabsWrapper>
104
+ ) : (
105
+ 'No Notifications Found'
106
+ )}
107
+ </Section>
108
+ </>
109
+ );
110
+ }
111
+
112
+ const Loader = styled.div`
113
+ align-items: center;
114
+ justify-content: center;
115
+ display: flex;
116
+ flex-direction: column;
117
+ gap: 10px;
118
+ `;
119
+
120
+ const Spinner = styled.div`
121
+ border: 4px solid rgba(0, 0, 0, 0.1);
122
+ border-left-color: #3a3630;
123
+ border-radius: 50%;
124
+ width: 40px;
125
+ height: 40px;
126
+ animation: spin 1s linear infinite;
127
+
128
+ @keyframes spin {
129
+ 0% {
130
+ transform: rotate(0deg);
131
+ }
132
+ 100% {
133
+ transform: rotate(360deg);
134
+ }
135
+ }
136
+ `;
137
+
138
+ const Section = styled.div`
139
+ display: flex;
140
+ flex-direction: column;
141
+ gap: 14px;
142
+ background: #ffffff;
143
+ border-radius: 12px;
144
+ padding: 10px;
145
+ box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);
146
+ border: 1px solid #e0e0e0;
147
+ `;
148
+
149
+ const TabsWrapper = styled.div`
150
+ /* min-height: 200px; */
151
+ max-height: 350px;
152
+ overflow-y: auto;
153
+ scrollbar-width: none;
154
+ -ms-overflow-style: none;
155
+
156
+ &:hover {
157
+ scrollbar-width: thin;
158
+ }
159
+
160
+ &::-webkit-scrollbar {
161
+ width: 0;
162
+ }
163
+
164
+ &:hover::-webkit-scrollbar {
165
+ width: 8px;
166
+ }
167
+
168
+ &::-webkit-scrollbar-thumb {
169
+ background-color: rgba(0, 0, 0, 0.5);
170
+ }
171
+ `;
172
+
173
+ const Text = styled.div`
174
+ color: var(--tonal-brown-651, #6a7378);
175
+ font-family: Lato;
176
+ font-size: 13px;
177
+ font-style: normal;
178
+ font-weight: 600;
179
+ `;
180
+ export default FDNotification;