@bjsdistribution/dms-client-return 0.1.21-dev → 0.1.21-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 (53) hide show
  1. package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
  2. package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
  3. package/dist/components/order-daily-overview/header/route-header/ClientRouterHeader.d.ts +11 -0
  4. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  5. package/dist/components/order-view/types.d.ts +6 -0
  6. package/dist/components/order-view/utils.d.ts +8 -2
  7. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +0 -2
  8. package/dist/components/store.d.ts +1 -1
  9. package/dist/dms-client-return.cjs.development.js +2962 -3216
  10. package/dist/dms-client-return.cjs.development.js.map +1 -1
  11. package/dist/dms-client-return.cjs.production.min.js +1 -1
  12. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  13. package/dist/dms-client-return.esm.js +2999 -3253
  14. package/dist/dms-client-return.esm.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/client-portal/DateFilterStore.ts +45 -0
  17. package/src/components/client-portal/OutstandingTable.tsx +3 -2
  18. package/src/components/client-portal/ReturnAfterSearchBar.tsx +2 -1
  19. package/src/components/client-portal/ReturnOverview.tsx +11 -2
  20. package/src/components/client-portal/ReturnRTFilters.tsx +140 -41
  21. package/src/components/client-portal/ReturnSearchBar.tsx +3 -3
  22. package/src/components/client-portal/ReturnStatus.tsx +4 -2
  23. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +1 -1
  24. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  25. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +1 -78
  26. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +5 -2
  27. package/src/components/order-daily-overview/index.tsx +3 -3
  28. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +0 -29
  29. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +35 -20
  30. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +11 -62
  31. package/src/components/order-view/order-actions/index.tsx +1 -5
  32. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +102 -45
  33. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +93 -34
  34. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +88 -31
  35. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +52 -83
  36. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  37. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  38. package/src/components/order-view/store.ts +6 -0
  39. package/src/components/order-view/types.ts +6 -0
  40. package/src/components/order-view/utils.ts +12 -33
  41. package/src/components/order-view/view-reminder/ViewReminder.tsx +0 -2
  42. package/src/components/store.ts +1 -1
  43. package/src/index.tsx +17 -2
  44. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  45. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  46. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  47. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  48. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  49. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  50. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  51. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  52. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  53. 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.21-dev",
2
+ "version": "0.1.21-prod",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -56,6 +56,51 @@ const overviewFilterReducer = (
56
56
  };
57
57
  }
58
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
+
59
104
  case 'SET_PAGE':
60
105
  return {
61
106
  ...state,
@@ -123,12 +123,13 @@ const OutstandingTable = () => {
123
123
  }
124
124
  };
125
125
 
126
+ const cleanedFilters = filters.filter(f => f.field !== 'order_status');
126
127
  const baseFilters = [
127
128
  { field: 'isdeleted', op: '=', value: 0 },
128
129
  { field: 'product_return_action_id', op: '=', value: 'RTS' },
129
130
  ];
130
131
 
131
- const modifiedFilters = [...baseFilters, ...filters];
132
+ const modifiedFilters = [...baseFilters, ...cleanedFilters];
132
133
  const {
133
134
  data: fetchedOrderData,
134
135
  loading: returnDataLoad,
@@ -145,7 +146,7 @@ const OutstandingTable = () => {
145
146
  if (clientPortal && debouncedSearchText === '') {
146
147
  fetchData();
147
148
  }
148
- }, [JSON.stringify(filters), debouncedSearchText]);
149
+ }, [JSON.stringify(modifiedFilters), debouncedSearchText]);
149
150
 
150
151
  useEffect(() => {
151
152
  setLoading(returnDataLoad);
@@ -90,6 +90,7 @@ function ReturnAfterSearchBar() {
90
90
  setSearchText('');
91
91
  }
92
92
  }, [debouncedSearchText]);
93
+ const cleanedFilters = filters.filter(f => f.field !== 'order_status');
93
94
 
94
95
  const { fetchData: fetchStatsData } = useAxios<{
95
96
  data: returnCountType[];
@@ -97,7 +98,7 @@ function ReturnAfterSearchBar() {
97
98
  endpoint: `v1/portal/return/stats/`,
98
99
  method: 'GET',
99
100
  pagination: { is_pagination: false },
100
- filters: filters,
101
+ filters: [...cleanedFilters],
101
102
  });
102
103
 
103
104
  useEffect(() => {
@@ -9,9 +9,9 @@ import {
9
9
  } from '../order-daily-overview/store/store';
10
10
  import { useClientPortal } from '../store';
11
11
  import { useParams } from 'react-router-dom';
12
- import RouterHeader from '../order-daily-overview/header/route-header/RouterHeader';
13
12
  import OutstandingTable from './OutstandingTable';
14
13
  import ConfirmedMain from './return-confirm/ConfirmedMain';
14
+ import ClientRouterHeader from '../order-daily-overview/header/route-header/ClientRouterHeader';
15
15
 
16
16
  const ReturnOverview = () => {
17
17
  const [paginationObj] = UsePaginationData();
@@ -32,9 +32,18 @@ const ReturnOverview = () => {
32
32
  const shouldShowReturnAfterTable =
33
33
  (clientPortal && status === 'scheduled_for_return') ||
34
34
  (clientPortal && status === 'return_completed');
35
+
36
+ const validStatuses = [
37
+ 'outstanding_return',
38
+ 'scheduled_for_return',
39
+ 'return_completed',
40
+ ];
41
+
35
42
  return (
36
43
  <>
37
- <RouterHeader />
44
+ {clientPortal &&
45
+ typeof status === 'string' &&
46
+ validStatuses.includes(status) && <ClientRouterHeader />}
38
47
  <div>
39
48
  <DashBoardWrapper>
40
49
  <div className="Tableconatiner">
@@ -1,25 +1,21 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import styled from 'styled-components';
3
- import {
4
- useAtom,
5
- useReturnAfterOrderData,
6
- useReturnData,
7
- } from '../order-view/store';
8
- import { filtersReducerAtom } from '../order-daily-overview/header-filters/filterStore';
9
- import { ExportButton, useAxios } from '@bjsdistribution/dms-component-library';
3
+ import { useAtom } from '../order-view/store';
4
+ import { useAxios } from '@bjsdistribution/dms-component-library';
10
5
  import { useParams } from 'react-router-dom';
11
- import { filtersReducerReturnAtom } from '../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
12
- import { notification } from 'antd';
6
+ // import { filtersReducerReturnAtom } from '../order-daily-overview/return-after-table/table-filters/ReturnFilterStore';
7
+ import { notification, Spin } from 'antd';
13
8
  import {
9
+ useClientOutstandingReturnData,
10
+ useReturnConfirmedOrderData,
14
11
  useSelectedClientAfterOrders,
15
12
  useSelectedClientPortOrders,
16
13
  } from '../store';
14
+ import { dateFilterCPReducer } from './DateFilterStore';
17
15
 
18
16
  const ReturnRTFilters = () => {
19
- const [returnData] = useReturnData();
20
- const [pendingState] = useAtom(filtersReducerAtom);
21
- const [state] = useAtom(filtersReducerReturnAtom);
22
- const [returnAfterOrder] = useReturnAfterOrderData();
17
+ const [outstandingReturnData] = useClientOutstandingReturnData();
18
+ const [returnConfirmedData] = useReturnConfirmedOrderData();
23
19
  const [
24
20
  selectedOrderIds,
25
21
  setSelectedOrderIds,
@@ -29,32 +25,102 @@ const ReturnRTFilters = () => {
29
25
  setSelectedPendingOrderIds,
30
26
  ] = useSelectedClientPortOrders();
31
27
  const { status } = useParams<{ status: any }>();
32
- const { 'x-filters': pendingFilters } = pendingState;
33
-
34
- let moduleInfo: any | null = null;
35
- if (status === 'outstanding_return') {
36
- moduleInfo = {
37
- isExportedData: returnData?.length > 0,
38
- moduleName: 'return',
39
- filter: pendingFilters,
40
- file_type: 'csv',
41
- apiUrlEndPoint: `v1/return/product/pending/`,
42
- reference: 'return_export',
43
- feature_name: 'return',
44
- };
45
- } else if (['scheduled_for_return', 'return_completed'].includes(status)) {
46
- const { 'x-filters': orderFilters } = state;
47
-
48
- moduleInfo = {
49
- isExportedData: returnAfterOrder?.length > 0,
50
- moduleName: 'return',
51
- filter: orderFilters,
52
- file_type: 'csv',
53
- apiUrlEndPoint: `v1/return/orders/`,
54
- reference: 'return_overview_export',
55
- feature_name: 'return',
56
- };
57
- }
28
+ const [spinLoading, setSpinLoading] = useState<boolean>(false);
29
+ const [state] = useAtom(dateFilterCPReducer);
30
+ const { 'x-filters': filters } = state;
31
+
32
+ //export csv
33
+ const { fetchData: callExportCSV } = useAxios<{
34
+ data: any[];
35
+ message: string;
36
+ }>({
37
+ endpoint: `/v1/export/generate/`,
38
+ method: 'POST',
39
+ });
40
+ const { fetchData: downloadFile } = useAxios({
41
+ endpoint: '/v1/export/download/',
42
+ method: 'POST',
43
+ });
44
+ const download: any = (response: any) => {
45
+ downloadFile({
46
+ endPointQuery: `${response?.data?.file_reference}`,
47
+ })
48
+ .then((response: any) => {
49
+ if (response?.data?.url) {
50
+ window.open(response?.data?.url, '_blank');
51
+ }
52
+ setSpinLoading(false);
53
+ })
54
+ .catch((err: any) => {
55
+ notification.error({
56
+ message: 'Failed to download file',
57
+ description: err,
58
+ });
59
+ setSpinLoading(false);
60
+ });
61
+ };
62
+
63
+ const handleExportCSV = () => {
64
+ let moduleInfo: any | null = null;
65
+ const url =
66
+ process.env.REACT_APP_API_PATH ||
67
+ 'https://development.dmsbackend.bjshomedelivery.com';
68
+ if (status === 'outstanding_return') {
69
+ moduleInfo = {
70
+ isExportedData: outstandingReturnData?.length > 0,
71
+ file_type: 'csv',
72
+ moduleName: 'return',
73
+ filter: [
74
+ { field: 'isdeleted', op: '=', value: 0 },
75
+ { field: 'product_return_action_id', op: '=', value: 'RTS' },
76
+ ],
77
+ url: `${url}/v1/return/product/pending/`,
78
+ reference: 'return_outstanding_export',
79
+ feature_name: 'return',
80
+ };
81
+ } else if (['scheduled_for_return', 'return_completed'].includes(status)) {
82
+ moduleInfo = {
83
+ isExportedData: returnConfirmedData?.length > 0,
84
+ file_type: 'csv',
85
+ moduleName: 'return',
86
+ url: `${url}/v1/return/orders/`,
87
+
88
+ reference:
89
+ status === 'scheduled_for_return'
90
+ ? 'return_scheduled_export'
91
+ : 'return_completed_export',
92
+ feature_name: 'return',
93
+ filter: filters,
94
+ };
95
+ }
96
+
97
+ if (moduleInfo?.isExportedData) {
98
+ setSpinLoading(true);
99
+
100
+ callExportCSV({
101
+ payload: {
102
+ file_type: moduleInfo?.file_type,
103
+ url: moduleInfo?.url,
104
+ reference: moduleInfo?.reference,
105
+ feature_name: moduleInfo?.feature_name,
106
+ filter: moduleInfo?.filter,
107
+ },
108
+ })
109
+ .then((res: any) => {
110
+ setTimeout(() => download(res), 10000);
111
+ })
112
+ .catch(err => {
113
+ notification.error({
114
+ message: 'Failed to export csv',
115
+ description: err,
116
+ });
117
+ setSpinLoading(false);
118
+ });
119
+ } else {
120
+ notification.warning({ message: 'No data to Export' });
121
+ }
122
+ };
123
+
58
124
  //Export Manifest
59
125
  const isExportEnabled =
60
126
  status === 'outstanding_return'
@@ -133,7 +199,12 @@ const ReturnRTFilters = () => {
133
199
 
134
200
  return (
135
201
  <StyledBulkFilterCover className="dmsBulkFilter">
136
- <ExportButton moduleInfoModule={moduleInfo} />
202
+ {/* <ExportButton moduleInfoModule={moduleInfo} /> */}
203
+ <ExportCSVButton type="left" onClick={handleExportCSV}>
204
+ <div className="label">
205
+ Export CSV <Spin spinning={spinLoading} />
206
+ </div>
207
+ </ExportCSVButton>
137
208
  <StyledBulkItem
138
209
  onClick={handleExportManifest}
139
210
  style={{
@@ -223,4 +294,32 @@ export const StyledBulkItem = styled.div`
223
294
  padding: 0;
224
295
  }
225
296
  `;
297
+
298
+ export const ExportCSVButton = styled.div<{
299
+ type: 'left' | 'right' | 'middle';
300
+ }>`
301
+ display: flex;
302
+ background: #fff;
303
+ min-height: 40px;
304
+ padding: 8px 12px;
305
+ align-items: center;
306
+ gap: 8px;
307
+ cursor: pointer;
308
+ border-radius: ${props =>
309
+ props?.type === 'left'
310
+ ? '50px 0px 0px 50px'
311
+ : props?.type === 'right'
312
+ ? ' 0px 50px 50px 0px'
313
+ : ''};
314
+ border-right: ${props => (props.type === 'right' ? '' : '1px solid #d0d5dd')};
315
+ .label {
316
+ color: #6a7378;
317
+ text-align: center;
318
+ font-family: Lato;
319
+ font-size: 14px;
320
+ font-style: normal;
321
+ font-weight: 500;
322
+ line-height: 18px;
323
+ }
324
+ `;
226
325
  export default ReturnRTFilters;
@@ -37,8 +37,9 @@ function ReturnSearchBar() {
37
37
  { field: 'isdeleted', op: '=', value: 0 },
38
38
  { field: 'product_return_action_id', op: '=', value: 'RTS' },
39
39
  ];
40
+ const cleanedFilters = filters.filter(f => f.field !== 'order_status');
40
41
 
41
- const modifiedFilters = [...baseFilters, ...filters];
42
+ const modifiedFilters = [...baseFilters, ...cleanedFilters];
42
43
  const { paginationData, fetchData: getPendingData } = useAxios<ApiResponse>({
43
44
  endpoint: '/v1/return/product/pending/',
44
45
  method: 'GET',
@@ -89,7 +90,6 @@ function ReturnSearchBar() {
89
90
  setSearchText('');
90
91
  }
91
92
  }, [debouncedSearchText]);
92
-
93
93
  //
94
94
  const { fetchData: fetchStatsData } = useAxios<{
95
95
  data: returnCountType[];
@@ -97,7 +97,7 @@ function ReturnSearchBar() {
97
97
  endpoint: `v1/portal/return/stats/`,
98
98
  method: 'GET',
99
99
  pagination: { is_pagination: false },
100
- filters: filters,
100
+ filters: [...cleanedFilters],
101
101
  });
102
102
 
103
103
  useEffect(() => {
@@ -37,6 +37,9 @@ const ReturnStatus = () => {
37
37
  const [count, setCount] = useStatsCPCount();
38
38
  const [clientPortal] = useClientPortal();
39
39
  const [debouncedSearchText, setOutstandingSearch] = useSearchText();
40
+
41
+ const cleanedFilters = filters.filter(f => f.field !== 'order_status');
42
+
40
43
  const [
41
44
  debouncedSearchAfterText,
42
45
  setDebouncedSearchText,
@@ -48,7 +51,7 @@ const ReturnStatus = () => {
48
51
  method: 'GET',
49
52
  //@ts-ignore
50
53
  pagination: { is_pagination: false },
51
- filters: filters,
54
+ filters: cleanedFilters,
52
55
  });
53
56
 
54
57
  useEffect(() => {
@@ -68,7 +71,6 @@ const ReturnStatus = () => {
68
71
  status == 'scheduled_for_return') ||
69
72
  status == 'return_completed'
70
73
  ) {
71
- console.log('CALL');
72
74
  fetchData();
73
75
  }
74
76
  }, [debouncedSearchAfterText, debouncedSearchText, JSON.stringify(filters)]);
@@ -252,7 +252,7 @@ const ReturnConfirmedTable = () => {
252
252
  paddingLeft: 0,
253
253
  }}
254
254
  >
255
- <NavLink to={`../${item.id}`}>
255
+ <NavLink to={`/return/view/${item.id}`}>
256
256
  {displayValueOrNA(item?.recipient_name)}
257
257
  </NavLink>
258
258
  </li>
@@ -0,0 +1,166 @@
1
+ import React, { useEffect } from 'react';
2
+ import 'react-datepicker/dist/react-datepicker.css';
3
+ import { HeaderWrapper, StyledFlex } from './RouterHeaderStyle';
4
+ import HeaderTitle from './title/HeaderTitle';
5
+ import Breadcrumb from './breadCrumb/BreadCrumb';
6
+ import styled from 'styled-components';
7
+ import dayjs from 'dayjs';
8
+ import { DatePicker, DatePickerProps } from 'antd';
9
+ import {
10
+ useAtom,
11
+ useClientPortal,
12
+ useEndDate,
13
+ useStartDate,
14
+ } from '../../../store';
15
+ import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
16
+ import { useParams } from 'react-router-dom';
17
+ import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
18
+ import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
19
+
20
+ interface RouterHeaderProps {
21
+ breadcrumbTitle?: string;
22
+ breadcrumbSubtitle?: string;
23
+ breadcrumbSubPart?: string;
24
+ showDateFilter?: boolean;
25
+ }
26
+
27
+ const ClientRouterHeader: React.FC<RouterHeaderProps> = ({
28
+ breadcrumbTitle = 'Clients >', // Default value
29
+ breadcrumbSubtitle = ' Return', // Default value
30
+ breadcrumbSubPart, // Optional
31
+ }) => {
32
+ const [clientPortal] = useClientPortal();
33
+ const [, dispatch] = useAtom(dateFilterCPReducer);
34
+ //CP
35
+ const [startDate, setStartDate] = useStartDate();
36
+ const [endDate, setEndDate] = useEndDate();
37
+ const { status } = useParams();
38
+
39
+ useEffect(() => {
40
+ if (clientPortal) {
41
+ const formattedStart = startDate?.format('YYYY-MM-DD');
42
+ const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
43
+ // const payload = {
44
+ // startDate: formattedStart,
45
+ // endDate: formattedEnd,
46
+ // };
47
+
48
+ if (formattedStart || formattedEnd) {
49
+ dispatch({
50
+ type: 'SET_CP_DATE_FILTER',
51
+ payload: {
52
+ startDate: formattedStart,
53
+ endDate: formattedEnd,
54
+ },
55
+ });
56
+ }
57
+ }
58
+ }, [startDate, endDate]);
59
+
60
+ const handleStartDateChange: DatePickerProps['onChange'] = date => {
61
+ setStartDate(date ?? null);
62
+ };
63
+
64
+ const handleEndDateChange: DatePickerProps['onChange'] = date => {
65
+ setEndDate(date);
66
+ };
67
+
68
+ const validStatuses = [
69
+ 'outstanding_return',
70
+ 'scheduled_for_return',
71
+ 'return_completed',
72
+ ];
73
+
74
+ return (
75
+ <>
76
+ <HeaderWrapper className="headerWrap">
77
+ <StyledFlex>
78
+ <div>
79
+ <HeaderTitle title={'Return'} />
80
+ <Breadcrumb
81
+ title={breadcrumbTitle}
82
+ subtitle={breadcrumbSubtitle}
83
+ subPart={breadcrumbSubPart}
84
+ />
85
+ </div>
86
+ </StyledFlex>
87
+
88
+ {clientPortal && status === 'outstanding_return' && <ReturnSearchBar />}
89
+
90
+ {clientPortal &&
91
+ (status === 'scheduled_for_return' ||
92
+ status === 'return_completed') && <ReturnAfterSearchBar />}
93
+
94
+ {clientPortal &&
95
+ typeof status === 'string' &&
96
+ validStatuses.includes(status) && (
97
+ <DatePickerWrap>
98
+ <DatePicker
99
+ value={startDate ? dayjs(startDate) : null}
100
+ onChange={handleStartDateChange}
101
+ format={'MMMM D, YYYY'}
102
+ allowClear={false}
103
+ disabledDate={current =>
104
+ !!endDate && current.isAfter(dayjs(endDate), 'day')
105
+ }
106
+ />
107
+ <DatePicker
108
+ value={endDate ? dayjs(endDate) : null}
109
+ onChange={handleEndDateChange}
110
+ format={'MMMM D, YYYY'}
111
+ disabledDate={current =>
112
+ !!startDate && current.isBefore(dayjs(startDate), 'day')
113
+ }
114
+ />
115
+ </DatePickerWrap>
116
+ )}
117
+ </HeaderWrapper>
118
+ </>
119
+ );
120
+ };
121
+ export const DatePickerWrap = styled.div`
122
+ display: flex;
123
+ padding-right: 10px;
124
+ padding-left: 7px;
125
+ justify-content: space-between;
126
+ align-items: center;
127
+ align-self: stretch;
128
+ border-radius: 20px;
129
+ border: 1px solid #e0e2e7;
130
+ background: #fff;
131
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
132
+ min-width: 22vw;
133
+ height: 35px;
134
+ input[type='text'] {
135
+ border-radius: 20px;
136
+ background: var(--Flowkit-White, #fff);
137
+ border: none;
138
+ color: #6a7378;
139
+ font-size: 13px;
140
+ font-weight: 400;
141
+ line-height: 18px;
142
+ padding: 8px 0;
143
+ padding-left: 10px;
144
+ &:focus-visible {
145
+ outline: none;
146
+ }
147
+ }
148
+
149
+ .ant-picker-outlined {
150
+ border-style: none !important;
151
+ }
152
+
153
+ .ant-picker-focused {
154
+ box-shadow: none;
155
+ }
156
+
157
+ /* .ant-picker {
158
+ .ant-picker-input {
159
+ width: 150px;
160
+ }
161
+ } */
162
+ .ant-btn {
163
+ background-color: #3348ff !important;
164
+ }
165
+ `;
166
+ export default ClientRouterHeader;
@@ -1,21 +1,9 @@
1
- import React, { useEffect } from 'react';
1
+ import React from 'react';
2
2
  import 'react-datepicker/dist/react-datepicker.css';
3
3
  import { HeaderWrapper, StyledFlex } from './RouterHeaderStyle';
4
4
  import HeaderTitle from './title/HeaderTitle';
5
5
  import Breadcrumb from './breadCrumb/BreadCrumb';
6
6
  import styled from 'styled-components';
7
- import dayjs from 'dayjs';
8
- import { DatePicker, DatePickerProps } from 'antd';
9
- import {
10
- useAtom,
11
- useClientPortal,
12
- useEndDate,
13
- useStartDate,
14
- } from '../../../store';
15
- import ReturnSearchBar from '../../../client-portal/ReturnSearchBar';
16
- import { useParams } from 'react-router-dom';
17
- import ReturnAfterSearchBar from '../../../client-portal/ReturnAfterSearchBar';
18
- import { dateFilterCPReducer } from '../../../client-portal/DateFilterStore';
19
7
 
20
8
  interface RouterHeaderProps {
21
9
  breadcrumbTitle?: string;
@@ -29,43 +17,6 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
29
17
  breadcrumbSubtitle = ' Return', // Default value
30
18
  breadcrumbSubPart, // Optional
31
19
  }) => {
32
- const [clientPortal] = useClientPortal();
33
- const [, dispatch] = useAtom(dateFilterCPReducer);
34
- //CP
35
- const [startDate, setStartDate] = useStartDate();
36
- const [endDate, setEndDate] = useEndDate();
37
- const { status } = useParams();
38
-
39
- useEffect(() => {
40
- if (clientPortal) {
41
- const formattedStart = startDate?.format('YYYY-MM-DD');
42
- const formattedEnd = endDate ? endDate?.format('YYYY-MM-DD') : null;
43
- console.log(formattedStart, 'syart', formattedEnd, 'end');
44
- const payload = {
45
- startDate: formattedStart,
46
- endDate: formattedEnd,
47
- };
48
-
49
- console.log(payload, 'PAYLOAD');
50
- if (formattedStart || formattedEnd) {
51
- dispatch({
52
- type: 'SET_CP_DATE_FILTER',
53
- payload: {
54
- startDate: formattedStart,
55
- endDate: formattedEnd,
56
- },
57
- });
58
- }
59
- }
60
- }, [startDate, endDate]);
61
-
62
- const handleStartDateChange: DatePickerProps['onChange'] = date => {
63
- setStartDate(date ?? null);
64
- };
65
-
66
- const handleEndDateChange: DatePickerProps['onChange'] = date => {
67
- setEndDate(date);
68
- };
69
20
  return (
70
21
  <>
71
22
  <HeaderWrapper className="headerWrap">
@@ -79,34 +30,6 @@ const RouterHeader: React.FC<RouterHeaderProps> = ({
79
30
  />
80
31
  </div>
81
32
  </StyledFlex>
82
-
83
- {clientPortal && status === 'outstanding_return' && <ReturnSearchBar />}
84
-
85
- {clientPortal &&
86
- (status === 'scheduled_for_return' ||
87
- status === 'return_completed') && <ReturnAfterSearchBar />}
88
-
89
- {clientPortal && (
90
- <DatePickerWrap>
91
- <DatePicker
92
- value={startDate ? dayjs(startDate) : null}
93
- onChange={handleStartDateChange}
94
- format={'MMMM D, YYYY'}
95
- allowClear={false}
96
- disabledDate={current =>
97
- !!endDate && current.isAfter(dayjs(endDate), 'day')
98
- }
99
- />
100
- <DatePicker
101
- value={endDate ? dayjs(endDate) : null}
102
- onChange={handleEndDateChange}
103
- format={'MMMM D, YYYY'}
104
- disabledDate={current =>
105
- !!startDate && current.isBefore(dayjs(startDate), 'day')
106
- }
107
- />
108
- </DatePickerWrap>
109
- )}
110
33
  </HeaderWrapper>
111
34
  </>
112
35
  );