@bjsdistribution/dms-client-return 0.0.16 → 0.0.17

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 (37) hide show
  1. package/dist/components/order-daily-overview/shared/elements/PrintDropDown.d.ts +6 -2
  2. package/dist/components/order-daily-overview/table/table-data/styles.d.ts +3 -0
  3. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.d.ts +3 -1
  4. package/dist/components/order-view/types.d.ts +2 -0
  5. package/dist/components/order-view/utils.d.ts +2 -0
  6. package/dist/dms-client-return.cjs.development.js +798 -574
  7. package/dist/dms-client-return.cjs.development.js.map +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js +1 -1
  9. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  10. package/dist/dms-client-return.esm.js +799 -575
  11. package/dist/dms-client-return.esm.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +25 -11
  14. package/src/components/order-daily-overview/index.tsx +1 -0
  15. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +40 -43
  16. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +5 -13
  17. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +45 -24
  18. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +15 -8
  19. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +3 -2
  20. package/src/components/order-daily-overview/shared/elements/PrintDropDown.tsx +47 -10
  21. package/src/components/order-daily-overview/table/table-data/styles.ts +47 -0
  22. package/src/components/order-view/details-filters/DetailsFilters.tsx +3 -3
  23. package/src/components/order-view/details-filters/left-side-filters/ActionsMenu.tsx +2 -2
  24. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +2 -0
  25. package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +13 -6
  26. package/src/components/order-view/fakedata.ts +6 -6
  27. package/src/components/order-view/general-information/Status.tsx +1 -0
  28. package/src/components/order-view/index.tsx +11 -8
  29. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +0 -1
  30. package/src/components/order-view/order-actions/actions/modalstyle.tsx +1 -1
  31. package/src/components/order-view/order-details/expanded-content/footer/AllowTracking.tsx +5 -33
  32. package/src/components/order-view/store.ts +2 -0
  33. package/src/components/order-view/types.ts +3 -1
  34. package/dist/components/order-view/tomtomlogs/collapsed-content/index.d.ts +0 -3
  35. package/dist/components/order-view/tomtomlogs/expanded-content/index.d.ts +0 -3
  36. package/src/components/order-view/tomtomlogs/collapsed-content/index.tsx +0 -16
  37. package/src/components/order-view/tomtomlogs/expanded-content/index.tsx +0 -21
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.16",
2
+ "version": "0.0.17",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -37,14 +37,14 @@ function SelectionFilter() {
37
37
  const [actionType] = useActionType();
38
38
  const [locationData] = useLocationData();
39
39
  const [filteredLocationOptions, setFilteredLocationOptions] = useState([]);
40
- const [getUuid, setUuid] = useState<any>();
40
+ const [, setUuid] = useState<any>();
41
41
  const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
42
42
  const [, dispatch] = useAtom(filtersReducerAtom);
43
43
  const [
44
44
  selectedLocationValue,
45
45
  setSelectedLocationValue,
46
46
  ] = useSelectedLocation();
47
- const [selectedClientId, setSelectedClient] = useSelectedClient();
47
+ const [, setSelectedClient] = useSelectedClient();
48
48
  const [, setClientLabel] = useTableName();
49
49
  const [, setName] = useState<any>();
50
50
  const [isButtonEnabled, setIsButtonEnabled] = useState(false);
@@ -92,19 +92,22 @@ function SelectionFilter() {
92
92
  localStorage.setItem('clientName', selectedLabel);
93
93
  localStorage.setItem('clientId', selectedValue.toString());
94
94
  localStorage.setItem('account_number', selectAccountNumber);
95
+ localStorage.setItem('uuid', selectedUuids);
95
96
  localStorage.setItem('customer_id', selectedCustomerId.toString());
96
97
  const storedAccNo = localStorage.getItem('account_number');
97
98
  const storedCustomerId = localStorage.getItem('customer_id');
99
+ const storedUuid = localStorage.getItem('uuid');
100
+ setUuid(storedUuid);
98
101
  setReturnPayload((prevState: any) => ({
99
102
  ...prevState,
100
103
  account_number: storedAccNo,
101
104
  customer_id: storedCustomerId,
102
105
  }));
103
106
  const filteredSubLocations = locationData
104
- ?.filter((subCat: any) => subCat?.customer_id === selectedUuids)
107
+ ?.filter((subCat: any) => subCat?.customer_id === storedUuid)
105
108
  .map((subCat: any) => ({
106
109
  label: subCat?.location_name,
107
- value: subCat?.customer_id,
110
+ value: subCat?.token,
108
111
  }));
109
112
 
110
113
  setFilteredLocationOptions(filteredSubLocations);
@@ -133,7 +136,20 @@ function SelectionFilter() {
133
136
  }
134
137
  }, [storedAccNumber, storedCustomerId]);
135
138
 
136
- useEffect(() => {}, [getUuid, filteredLocationOptions]);
139
+ const storedUuid = localStorage.getItem('uuid');
140
+
141
+ useEffect(() => {
142
+ if (storedUuid && locationData) {
143
+ const filteredSubLocations = locationData
144
+ .filter((subCat: any) => subCat?.customer_id === storedUuid)
145
+ .map((subCat: any) => ({
146
+ label: subCat?.location_name,
147
+ value: subCat?.token,
148
+ }));
149
+
150
+ setFilteredLocationOptions(filteredSubLocations);
151
+ }
152
+ }, [storedUuid, locationData]);
137
153
 
138
154
  //location change
139
155
  const handleLocationChange = (value: any, option: DefaultOptionType) => {
@@ -164,10 +180,10 @@ function SelectionFilter() {
164
180
  if (storedName) {
165
181
  setClientLabel(storedName);
166
182
  }
167
- if (selectedClientId) {
183
+ if (storedClientId) {
168
184
  dispatch({
169
185
  type: 'SET_CLIENT_FILTER',
170
- payload: selectedClientId,
186
+ payload: storedClientId,
171
187
  });
172
188
  }
173
189
  if (selectedFilterValue) {
@@ -195,7 +211,8 @@ function SelectionFilter() {
195
211
  payload: storedClientId,
196
212
  });
197
213
  }
198
- }, [storedClientId]);
214
+ }, []);
215
+
199
216
  useEffect(() => {
200
217
  if (storedName || selectedFilterValue || selectedLocationValue) {
201
218
  setIsButtonEnabled(true);
@@ -204,9 +221,6 @@ function SelectionFilter() {
204
221
  }
205
222
  }, [storedName, selectedFilterValue, selectedLocationValue]);
206
223
 
207
- // console.log(filteredLocationOptions, 'filteredLocationOptions');
208
-
209
- // console.log('check', storedName, selectedFilterValue, selectedLocationValue);
210
224
  return (
211
225
  <Wrapper>
212
226
  <FilterRow>
@@ -61,6 +61,7 @@ function ReturnMainTable() {
61
61
  }>({
62
62
  endpoint: `/return_orders/get/client-returns/`,
63
63
  method: 'GET',
64
+ pagination: { page: 1, per_page: 50 },
64
65
  });
65
66
  // console.log('fetchedClientData', fetchedClientData?.data);
66
67
 
@@ -1,8 +1,8 @@
1
1
  import { AntSelect, Checkbox } from '@bjsdistribution/dms-component-library';
2
2
  import { Empty } from 'antd';
3
- import React, { useEffect, useRef, useState } from 'react';
3
+ import React, { useEffect, useRef } from 'react';
4
4
  import { Skeleton } from 'antd';
5
- import { useSelectedOrders } from '../../../store';
5
+ // import { useSelectedOrders } from '../../../store';
6
6
  import { useOrderId, useReturnAfterOrderData } from '../../../order-view/store';
7
7
  import { EmptyDataContainer } from '../../table/table-data/styles';
8
8
  import PrinterIcon from '../../../../assets/icons/PrinterIcon';
@@ -14,14 +14,14 @@ import {
14
14
  } from '../../return-order-table/return-orders-filters/returnstyles';
15
15
  import LoadIcon from '../../../../assets/icons/LoadIcon';
16
16
  import { usePrintOptionTOggle } from '../../store/store';
17
- import PrintDropDown from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
18
17
  import { NavLink } from 'react-router-dom';
19
18
  import { displayValueOrNA, formatDate } from '../../shared/utlis';
19
+ import PrintDropDown from '../../shared/elements/PrintDropDown';
20
20
 
21
21
  const OrderTable = ({ loadingskeleton }: any) => {
22
- const [selectedOrders, setSelectedReturnOrder] = useSelectedOrders();
23
- const [selectAll, setSelectAll] = useState(false);
24
- const defaultSelectStyle = { width: '100%' };
22
+ // const [, setSelectedReturnOrder] = useSelectedOrders();
23
+ // const [selectAll, setSelectAll] = useState(false);
24
+ // const defaultSelectStyle = { width: '100%' };
25
25
  const defaultPopupClassName = 'dropDownStyle';
26
26
  const defaultSelectWrapperClass = 'rounded';
27
27
  const dropdownRefParent = useRef<HTMLDivElement>(null);
@@ -50,33 +50,33 @@ const OrderTable = ({ loadingskeleton }: any) => {
50
50
  }
51
51
  };
52
52
 
53
- const handleSelectAll = (e: any) => {
54
- setSelectAll(e.target.checked);
55
- if (e.target.checked) {
56
- setSelectedReturnOrder(
57
- returnAfterOrder.map((e: any) => ({
58
- id: e.id,
59
- status_id: 3,
60
- }))
61
- );
62
- } else {
63
- setSelectedReturnOrder([]);
64
- }
65
- };
53
+ // const handleSelectAll = (e: any) => {
54
+ // setSelectAll(e.target.checked);
55
+ // if (e.target.checked) {
56
+ // setSelectedReturnOrder(
57
+ // returnAfterOrder.map((e: any) => ({
58
+ // id: e.id,
59
+ // status_id: 3,
60
+ // }))
61
+ // );
62
+ // } else {
63
+ // setSelectedReturnOrder([]);
64
+ // }
65
+ // };
66
66
 
67
- const handleSelectInvoice = (id: any) => {
68
- setSelectedReturnOrder((prevSelectedInvoices: any) => {
69
- const isSelected = prevSelectedInvoices?.some(
70
- (item: any) => item.id === id
71
- );
67
+ // const handleSelectInvoice = (id: any) => {
68
+ // setSelectedReturnOrder((prevSelectedInvoices: any) => {
69
+ // const isSelected = prevSelectedInvoices?.some(
70
+ // (item: any) => item.id === id
71
+ // );
72
72
 
73
- if (isSelected) {
74
- return prevSelectedInvoices.filter((items: any) => items.id !== id);
75
- } else {
76
- return [...prevSelectedInvoices, { id, status_id: 3 }];
77
- }
78
- });
79
- };
73
+ // if (isSelected) {
74
+ // return prevSelectedInvoices.filter((items: any) => items.id !== id);
75
+ // } else {
76
+ // return [...prevSelectedInvoices, { id, status_id: 3 }];
77
+ // }
78
+ // });
79
+ // };
80
80
  console.log('', returnAfterOrder);
81
81
 
82
82
  const assigneOptions = [
@@ -105,16 +105,16 @@ const OrderTable = ({ loadingskeleton }: any) => {
105
105
  }
106
106
  };
107
107
 
108
- const [id, setOrderId] = useOrderId();
109
- console.log(id, 'idid');
108
+ const [, setOrderId] = useOrderId();
109
+ // console.log(id, 'idid');
110
110
  return (
111
111
  <>
112
- <StyledTableWrapper id="tableScrolling">
112
+ <StyledTableWrapper>
113
113
  <StyledTable>
114
114
  <thead>
115
115
  <tr>
116
116
  <th className="emailInvoiceCheckbox">
117
- <Checkbox checked={selectAll} onChange={handleSelectAll} />
117
+ <Checkbox checked={false} />
118
118
  </th>
119
119
  <th className="emailInvoiceNo">Created</th>
120
120
  <th>Return Location</th>
@@ -163,11 +163,8 @@ const OrderTable = ({ loadingskeleton }: any) => {
163
163
  <tr key={item.id}>
164
164
  <td>
165
165
  <Checkbox
166
- checked={selectedOrders?.some(
167
- (selectedInvoice: any) =>
168
- selectedInvoice?.id === item.id
169
- )}
170
- onChange={() => handleSelectInvoice(item.id)}
166
+ checked={false}
167
+ // onChange={() => handleSelectInvoice(item.id)}
171
168
  />
172
169
  </td>
173
170
  <td>{formatDate(new Date(item?.created_at))}</td>
@@ -211,8 +208,8 @@ const OrderTable = ({ loadingskeleton }: any) => {
211
208
  placeholder="Select"
212
209
  onChange={() => {}}
213
210
  // defaultValue={item?.assign || ''}
214
- style={defaultSelectStyle}
215
- disabled={false}
211
+ // style={defaultSelectStyle}
212
+ // disabled={false}
216
213
  // onSearch={handleSearch}
217
214
  showSearch
218
215
  popupClassName={defaultPopupClassName}
@@ -244,7 +241,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
244
241
 
245
242
  {printToogle == index && (
246
243
  <div ref={dropdownRef}>
247
- <PrintDropDown />
244
+ <PrintDropDown legacyProductId={item.id} />
248
245
  </div>
249
246
  )}
250
247
  </li>
@@ -80,19 +80,6 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
80
80
  ],
81
81
  };
82
82
 
83
- // case 'SET_LOCATION_FILTER':
84
- // return {
85
- // ...state,
86
- // 'x-filters': [
87
- // ...state['x-filters'].filter(f => f.field !== 'return_location'),
88
- // {
89
- // field: 'return_location',
90
- // op: 'in',
91
- // value: action.payload,
92
- // },
93
- // ],
94
- // };
95
-
96
83
  case 'SET_PAGE':
97
84
  return {
98
85
  ...state,
@@ -114,6 +101,11 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
114
101
  return {
115
102
  ...state,
116
103
  };
104
+ case 'CLEAR_ALL_FILTER':
105
+ return {
106
+ ...state,
107
+ 'x-filters': [],
108
+ };
117
109
  default:
118
110
  return state;
119
111
  }
@@ -18,19 +18,27 @@ import dayjs from 'dayjs';
18
18
  import { useCustomerData, useStatusOrderData } from '../../../store';
19
19
  import StatusIcon from '../../../../assets/icons/StatusIcon';
20
20
  import AssigneIcon from '../../../../assets/icons/AssigneIcon';
21
+ import {
22
+ ClearAll,
23
+ StyledFilterBtnIcon,
24
+ StyledFilterBtnLabel,
25
+ } from '../../table/table-data/styles';
21
26
 
22
27
  const ReturnOrderFilter = () => {
23
28
  const [, dispatch] = useAtom(filtersReducerAtom);
24
29
  const [customers] = useCustomerData();
25
- const [selectedDate, setSelectedDate] = useState();
30
+ const [selectedDate, setSelectedDate] = useState<any | null>();
26
31
  const [statusOfOrder] = useStatusOrderData();
27
- // const zoneOptions = [
28
- // { label: 'Zone 1', value: 'zone1' },
29
- // { label: 'Zone 2', value: 'zone2' },
30
- // { label: 'Zone 3', value: 'zone3' },
31
- // { label: 'Zone 4', value: 'zone4' },
32
- // { label: 'Zone 5', value: 'zone5' },
33
- // ];
32
+ const [selectedClient, setSelectedClient] = useState<any | null>();
33
+ const [statusOrder, setStatusOfOrder] = useState<any | null>();
34
+
35
+ const zoneOptions = [
36
+ { label: 'Zone 1', value: 'zone1' },
37
+ { label: 'Zone 2', value: 'zone2' },
38
+ { label: 'Zone 3', value: 'zone3' },
39
+ { label: 'Zone 4', value: 'zone4' },
40
+ { label: 'Zone 5', value: 'zone5' },
41
+ ];
34
42
 
35
43
  // date change here
36
44
  const handleDateChange = (date: any | null) => {
@@ -65,20 +73,29 @@ const ReturnOrderFilter = () => {
65
73
 
66
74
  const handleClientChange = (value: any) => {
67
75
  console.log(value, 'value');
76
+ setSelectedClient(value);
68
77
  dispatch({
69
78
  type: 'SET_CLIENT_FILTER',
70
- payload: value,
79
+ payload: selectedClient,
71
80
  });
72
81
  };
73
82
 
74
83
  const handleStatusOfOrder = (value: any) => {
75
84
  console.log(value, 'value');
85
+ setStatusOfOrder(value);
76
86
  dispatch({
77
87
  type: 'SET_STATUS_ORDER_FILTER',
78
88
  payload: value,
79
89
  });
80
90
  };
81
91
 
92
+ const handleClearAll = () => {
93
+ setSelectedDate(null);
94
+ setSelectedClient(null);
95
+ setStatusOfOrder(null);
96
+ dispatch({ type: 'CLEAR_ALL_FILTER' });
97
+ };
98
+
82
99
  return (
83
100
  <>
84
101
  <StyledFiter>
@@ -106,7 +123,6 @@ const ReturnOrderFilter = () => {
106
123
  />
107
124
  </StyledDatePicker>
108
125
  </div>
109
-
110
126
  <div className="datefilter">
111
127
  <div className="dateiconcontainer">
112
128
  <StatusIcon />
@@ -118,6 +134,7 @@ const ReturnOrderFilter = () => {
118
134
  placeholder="Status of Order"
119
135
  onChange={handleStatusOfOrder}
120
136
  style={{ minWidth: '130px' }}
137
+ value={statusOrder}
121
138
  allowClear
122
139
  />
123
140
  </StyledAntSelect>
@@ -132,36 +149,40 @@ const ReturnOrderFilter = () => {
132
149
  className="custom-select"
133
150
  placeholder="Client"
134
151
  onChange={handleClientChange}
152
+ value={selectedClient}
135
153
  style={{ width: '125px', border: 'none' }}
136
154
  allowClear
137
155
  />
138
156
  </StyledAntSelect>
139
157
  </div>
140
- <div className="datefilter">
158
+ <div
159
+ className="datefilter"
160
+ style={{ pointerEvents: 'none', opacity: 0.5 }}
161
+ >
141
162
  <div className="dateiconcontainer">
142
163
  <AssigneIcon />
143
164
  </div>
144
- {/* <StyledAntSelect>
165
+ <StyledAntSelect>
145
166
  <Select
146
167
  options={zoneOptions}
147
168
  className="custom-select"
148
169
  placeholder="Asignee"
149
170
  onChange={() => {}}
150
171
  style={{ minWidth: '100px' }}
151
- maxTagCount={0}
152
- maxTagPlaceholder={(omittedValues: any) => (
153
- <Tooltip
154
- overlayStyle={{ pointerEvents: 'none' }}
155
- title={omittedValues
156
- .map(({ label }: any) => label)
157
- .join(', ')}
158
- >
159
- <span>{`${omittedValues.length} selected`}</span>
160
- </Tooltip>
161
- )}
172
+ disabled
162
173
  />
163
- </StyledAntSelect> */}
174
+ </StyledAntSelect>
164
175
  </div>
176
+ {selectedDate ? (
177
+ <>
178
+ <ClearAll onClick={handleClearAll}>
179
+ <StyledFilterBtnIcon>
180
+ <i className="cross"></i>
181
+ </StyledFilterBtnIcon>
182
+ <StyledFilterBtnLabel>Clear all</StyledFilterBtnLabel>
183
+ </ClearAll>
184
+ </>
185
+ ) : null}
165
186
  </LeftSideConatiner>
166
187
  </StyledFIlterELements>
167
188
  <TableFilters />
@@ -21,6 +21,7 @@ import { ApiResponse } from '../../../types';
21
21
  import { filtersReducerAtom } from '../../header-filters/filterStore';
22
22
  import { displayValueOrNA } from '../../shared/utlis';
23
23
  import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
24
+ import { format } from 'date-fns';
24
25
  const ReturnOrderTable = () => {
25
26
  const [state] = useAtom(filtersReducerAtom);
26
27
 
@@ -288,7 +289,6 @@ const ReturnOrderTable = () => {
288
289
  }
289
290
  />
290
291
  </td>
291
-
292
292
  <td>
293
293
  {item?.orders_products_stock?.location !== null &&
294
294
  item?.orders_products_stock?.location !== undefined ? (
@@ -297,9 +297,7 @@ const ReturnOrderTable = () => {
297
297
  <div className="awaiting">Awaiting</div>
298
298
  )}
299
299
  </td>
300
-
301
300
  <td> {displayValueOrNA(item?.new_location)}</td>
302
-
303
301
  <td>
304
302
  <ul style={{ listStyleType: 'none', padding: 0 }}>
305
303
  <li
@@ -323,13 +321,20 @@ const ReturnOrderTable = () => {
323
321
  <td>{displayValueOrNA(item?.code)}</td>
324
322
  <td>{displayValueOrNA(item?.description)}</td>
325
323
  <td>{displayValueOrNA(item?.parts_count)}</td>
326
- <td>{displayValueOrNA(item?.weight)}KG</td>
324
+ <td>
325
+ {displayValueOrNA(item?.weight)}{' '}
326
+ {item?.weight && item?.weight !== null ? 'KG' : ''}
327
+ </td>
327
328
  <td>{displayValueOrNA(item?.cube)}</td>
328
329
  <td>{displayValueOrNA(item?.return_reasons?.reason)}</td>
329
330
  <td>
330
- {displayValueOrNA(
331
- item?.order_product_returns?.collected_at
332
- )}
331
+ {item?.order_product_returns?.length > 0
332
+ ? item.order_product_returns.map((ret: any) =>
333
+ ret?.collected_at
334
+ ? format(new Date(ret.collected_at), 'dd/MM/yyyy')
335
+ : 'UNKNOWN'
336
+ )
337
+ : 'UNKNOWN'}
333
338
  </td>
334
339
  <td>{displayValueOrNA(item?.collection_reasons?.reason)}</td>
335
340
  <td>
@@ -346,7 +351,9 @@ const ReturnOrderTable = () => {
346
351
  <DownIcon />
347
352
  {printToogle == index && (
348
353
  <div ref={dropdownRef}>
349
- <PrintDropDownReturn />
354
+ <PrintDropDownReturn
355
+ legacyProductId={item.legacy_product_id}
356
+ />
350
357
  </div>
351
358
  )}
352
359
  </li>
@@ -238,6 +238,7 @@ export const StyledTable = styled.table`
238
238
  tr {
239
239
  border-radius: 40px;
240
240
  border-spacing: 0 10px;
241
+ position: relative;
241
242
  .emailInvoiceCheckbox {
242
243
  padding-right: 0px;
243
244
  width: 0;
@@ -246,7 +247,7 @@ export const StyledTable = styled.table`
246
247
  }
247
248
  }
248
249
  .custom-check {
249
- position: relative;
250
+ position: absloute;
250
251
  }
251
252
  .emailInvoiceNo {
252
253
  padding-left: 0px;
@@ -513,7 +514,7 @@ export const StyledTable = styled.table`
513
514
  // Styled components
514
515
  export const StyledTableWrapper = styled.div`
515
516
  overflow-x: auto;
516
- max-height: 300px;
517
+ max-height: 60vh;
517
518
  scrollbar-width: none;
518
519
  /* height: 600px; */
519
520
  /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */
@@ -1,22 +1,54 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { PrintData } from '../interface';
4
3
  import { optionsPrint } from '../../common/fakedata';
5
4
  import { PrintIconMap } from '../utlis';
6
5
 
7
- const options: PrintData[] = optionsPrint;
6
+ const PrintDropDown = ({
7
+ legacyProductId,
8
+ }: {
9
+ legacyProductId: Record<string, any>;
10
+ }) => {
11
+ const downloadFiles = (label: string) => {
12
+ const url =
13
+ legacyProductId?.[
14
+ `${label
15
+ .replace('Print ', '')
16
+ .toLowerCase()
17
+ .replace(' ', '_')}_url`
18
+ ];
19
+
20
+ if (url) {
21
+ window.open(url, '_blank');
22
+ } else {
23
+ console.log('URL not available for', label);
24
+ }
25
+ };
26
+
27
+ const isOptionDisabled = (label: string) => {
28
+ const url =
29
+ legacyProductId?.[
30
+ `${label
31
+ .replace('Print ', '')
32
+ .toLowerCase()
33
+ .replace(' ', '_')}_url`
34
+ ];
35
+ return !url;
36
+ };
8
37
 
9
- const PrintDropDown = () => {
10
- const downloadFiles = () => {};
11
38
  return (
12
39
  <OptionsList>
13
- {options.map((item, index) => {
40
+ {optionsPrint.map((item, index) => {
14
41
  const IconComponent = PrintIconMap[item.icon];
15
- console.log(IconComponent);
42
+ const isDisabled = isOptionDisabled(item.label);
16
43
 
17
44
  return (
18
- <OptionsListLi key={index} onClick={downloadFiles}>
19
- {/* {IconComponent && <IconComponent />} {item.label} */}
45
+ <OptionsListLi
46
+ key={index}
47
+ onClick={() => !isDisabled && downloadFiles(item.label)}
48
+ disabled={isDisabled}
49
+ >
50
+ {IconComponent && <IconComponent />}
51
+ {item.label}
20
52
  </OptionsListLi>
21
53
  );
22
54
  })}
@@ -44,15 +76,20 @@ export const OptionsList = styled.ul`
44
76
  min-width: 194px;
45
77
  `;
46
78
 
47
- export const OptionsListLi = styled.li`
79
+ export const OptionsListLi = styled.li<{ disabled?: boolean }>`
48
80
  border-bottom: 1px solid #f0f2f2;
49
81
  padding: 8px 10px;
50
82
  display: flex;
51
83
  gap: 12px;
52
84
  align-items: center;
53
85
  font-size: 13px;
54
- cursor: pointer;
86
+ cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
87
+ color: ${({ disabled }) => (disabled ? '#d3d3d3' : 'inherit')};
55
88
  &:last-child {
56
89
  border: none;
57
90
  }
91
+ &:hover {
92
+ background-color: ${({ disabled }) =>
93
+ disabled ? 'transparent' : '#f0f0f0'};
94
+ }
58
95
  `;
@@ -576,3 +576,50 @@ export const EmptyDataContainer = styled.div`
576
576
  display: flex;
577
577
  justify-content: center;
578
578
  `;
579
+
580
+ export const ClearAll = styled.div`
581
+ border-radius: 20px;
582
+ border: 1px solid #edebe8;
583
+ background: #fff;
584
+ display: flex;
585
+ padding: 6px 6px;
586
+ justify-content: center;
587
+ align-items: center;
588
+ gap: 8px;
589
+ cursor: pointer;
590
+
591
+ &.active {
592
+ background: #313130;
593
+ & > div {
594
+ color: #fff;
595
+ }
596
+ }
597
+ `;
598
+ export const StyledFilterBtnIcon = styled.div`
599
+ display: flex;
600
+ width: 24px;
601
+ height: 24px;
602
+ justify-content: center;
603
+ align-items: center;
604
+ border-radius: 20px;
605
+ border: 1px solid #e2e0db;
606
+ background: #f1f5f6;
607
+ .cross {
608
+ position: relative;
609
+ &:after {
610
+ display: inline-block;
611
+ content: 'X';
612
+ font-style: normal;
613
+ font-size: 14px;
614
+ color: #000;
615
+ }
616
+ }
617
+ `;
618
+ export const StyledFilterBtnLabel = styled.div`
619
+ color: #6a7378;
620
+ font-size: 13px;
621
+ font-style: normal;
622
+ font-weight: 400;
623
+ line-height: 16px;
624
+ white-space: nowrap;
625
+ `;
@@ -1,13 +1,13 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import Details from './right-side-filters/Details';
4
- // import ActionsMenu from './left-side-filters/ActionsMenu';
4
+ import ActionsMenu from './left-side-filters/ActionsMenu';
5
5
 
6
6
  const DetailsFilters = () => {
7
7
  return (
8
8
  <Flex>
9
9
  <Details />
10
- {/* <ActionsMenu /> */}
10
+ <ActionsMenu />
11
11
  </Flex>
12
12
  );
13
13
  };
@@ -28,7 +28,7 @@ const Flex = styled.div`
28
28
  margin-bottom: -71px;
29
29
  width: 97%;
30
30
  margin-left: 21px;
31
- top: -40px;
31
+ top: -132px;
32
32
  justify-content: space-between;
33
33
  `;
34
34
  export default DetailsFilters;