@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
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.7-prod",
2
+ "version": "0.1.8-prod",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -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
  }
@@ -26,11 +26,13 @@ import styled from 'styled-components';
26
26
  import { Select } from 'antd';
27
27
  import { useLocationOptions } from '../../order-view/store';
28
28
  import { useNavigate, useSearchParams } from 'react-router-dom';
29
+ import { useAxios } from '@bjsdistribution/dms-component-library';
30
+ import { ApiResponse } from '../common/interface';
29
31
 
30
32
  export const clickedState = atom<boolean>(false);
31
33
 
32
34
  function SelectionFilter() {
33
- const [customers] = useCustomerData();
35
+ const [customers, setCustomers] = useCustomerData();
34
36
  const [selectedFilterValue, setSelectedFilterValue] = useSelectedAction();
35
37
  const [, dispatch] = useAtom(filtersReducerAtom);
36
38
  const [
@@ -47,6 +49,25 @@ function SelectionFilter() {
47
49
  const [searchParams] = useSearchParams();
48
50
  const navigate = useNavigate();
49
51
 
52
+ //API for client data
53
+ const { data: fetchedCustomerData, loading: loading, fetchData } = useAxios<
54
+ ApiResponse
55
+ >({
56
+ endpoint: `/v1/return/product/customers/`,
57
+ method: 'GET',
58
+ //@ts-ignore
59
+ pagination: { is_pagination: false },
60
+ });
61
+
62
+ useEffect(() => {
63
+ fetchData();
64
+ }, []);
65
+
66
+ useEffect(() => {
67
+ if (fetchedCustomerData && fetchedCustomerData?.data) {
68
+ setCustomers(fetchedCustomerData?.data);
69
+ }
70
+ }, [loading]);
50
71
  //new codee
51
72
  const urlCustomerId = searchParams.get('customerId');
52
73
  const urlActiontype = searchParams.get('type');
@@ -54,7 +75,6 @@ function SelectionFilter() {
54
75
  const selectedCustomer = customers?.find(
55
76
  (customer: any) => customer?.customer_id?.toString() === urlCustomerId
56
77
  );
57
-
58
78
  const accountNumber = selectedCustomer?.account_number;
59
79
 
60
80
  //customer name
@@ -91,10 +111,14 @@ function SelectionFilter() {
91
111
  setActionTypeOptions(mappedActions);
92
112
 
93
113
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
94
- ? filteredClient?.return_locations?.map((location: any) => ({
95
- label: location?.location_name,
96
- value: location?.token,
97
- }))
114
+ ? filteredClient.return_locations
115
+ .filter(
116
+ (location: any) => location?.location_name && location?.token
117
+ )
118
+ .map((location: any) => ({
119
+ label: location.location_name,
120
+ value: location.token,
121
+ }))
98
122
  : [];
99
123
 
100
124
  setLocationOptions(mappedLocations);
@@ -135,10 +159,16 @@ function SelectionFilter() {
135
159
  setActionTypeOptions(mappedActions);
136
160
 
137
161
  const mappedLocations = Array.isArray(filteredClient?.return_locations)
138
- ? filteredClient?.return_locations?.map((location: any) => ({
139
- label: location?.location_name,
140
- value: location?.token,
141
- }))
162
+ ? filteredClient.return_locations
163
+ .filter((location: any) => {
164
+ const name = location?.location_name;
165
+ const token = location?.token;
166
+ return name && name !== 'null' && token && token !== 'null';
167
+ })
168
+ .map((location: any) => ({
169
+ label: location?.location_name,
170
+ value: location?.token,
171
+ }))
142
172
  : [];
143
173
 
144
174
  setLocationOptions(mappedLocations);
@@ -166,9 +196,7 @@ function SelectionFilter() {
166
196
  console.log(currentSearch, 'currentSearch');
167
197
 
168
198
  if (!currentSearch.includes('filter')) {
169
- console.log('inside include');
170
199
  // for dev
171
- //navigate(`filter?${queryParams.toString()}`);
172
200
  navigate(`/orders/view/return/filter?${queryParams.toString()}`);
173
201
 
174
202
  // for local
@@ -328,7 +356,7 @@ function SelectionFilter() {
328
356
  options={clientOptions}
329
357
  placeholder="Select Client Name"
330
358
  onChange={handleClientChange}
331
- style={{ minWidth: '150px' }}
359
+ style={{ minWidth: '250px' }}
332
360
  value={selectedClient}
333
361
  allowClear
334
362
  onClear={handleClear}
@@ -349,7 +377,7 @@ function SelectionFilter() {
349
377
  placeholder="Select Action Type"
350
378
  value={selectedFilterValue}
351
379
  onChange={handleActionClick}
352
- style={{ minWidth: '150px' }}
380
+ style={{ minWidth: '200px' }}
353
381
  allowClear
354
382
  onClear={handleClearAction}
355
383
  />
@@ -362,7 +390,7 @@ function SelectionFilter() {
362
390
  value={selectedLocationValue}
363
391
  placeholder="Select Location"
364
392
  onChange={handleLocationChange}
365
- style={{ minWidth: '150px' }}
393
+ style={{ minWidth: '200px' }}
366
394
  allowClear
367
395
  mode="multiple"
368
396
  />
@@ -10,6 +10,7 @@ import SortIcon from '../../../../common/SortIcon';
10
10
  import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
11
11
  import { usefetchAgain, useReturnData } from '../../../order-view/store';
12
12
  import {
13
+ useCustomerData,
13
14
  useGroupedPayload,
14
15
  useLocationData,
15
16
  useNewReturnPayload,
@@ -27,7 +28,7 @@ import {
27
28
  } from '../../store/store';
28
29
  import { EmptyDataContainer } from '../../table/table-data/styles';
29
30
  import { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';
30
- import { NavLink } from 'react-router-dom';
31
+ import { NavLink, useSearchParams } from 'react-router-dom';
31
32
 
32
33
  const ReturnOrderTable = () => {
33
34
  const [state] = useAtom(filtersReducerAtom);
@@ -39,13 +40,14 @@ const ReturnOrderTable = () => {
39
40
  const dropdownRefParent = useRef<HTMLDivElement>(null);
40
41
  const dropdownRef = useRef<HTMLDivElement>(null);
41
42
  const [printToogle, setPrintToggle] = usePrintOptionTOggle();
42
- const [createReturn, setReturnPayload] = useReturnPayload();
43
+ const [, setReturnPayload] = useReturnPayload();
43
44
  const [newpayload, setNewPayload] = useNewReturnPayload();
44
45
  const [, setGrouped] = useGroupedPayload();
45
46
  const [locationData] = useLocationData();
46
47
  const [, setPaginationObject] = UsePaginationData();
47
48
  const [callForFetch] = usefetchAgain();
48
-
49
+ const [searchParams] = useSearchParams();
50
+ const urlCustomerId = searchParams.get('customerId');
49
51
  //sorting
50
52
  const [sortConfig, setSortConfig] = useState<{
51
53
  key: string;
@@ -168,7 +170,15 @@ const ReturnOrderTable = () => {
168
170
  }
169
171
  // setShouldPerformAction(false);
170
172
  }, [fetchedOrderData, returnDataLoad, locationData, state, callForFetch]);
173
+ const [customers] = useCustomerData();
174
+
175
+ const selectedCustomer = customers?.find((customer: any) => {
176
+ const customerId = customer?.customer_id?.toString();
177
+ return customerId && customerId === urlCustomerId;
178
+ });
171
179
 
180
+ const accountNumber = selectedCustomer?.account_number;
181
+ console.log(selectedCustomer, 'selectedCustomer');
172
182
  const handleSelectAll = (e: any) => {
173
183
  const isChecked = e.target.checked;
174
184
  setSelectAll(isChecked);
@@ -187,8 +197,8 @@ const ReturnOrderTable = () => {
187
197
  }));
188
198
  const newPayload = filteredData.map((loc: any) => ({
189
199
  id: loc.id,
190
- account_number: createReturn?.account_number,
191
- customer_id: +createReturn?.customer_id,
200
+ account_number: accountNumber,
201
+ customer_id: Number(urlCustomerId),
192
202
  products: [loc?.legacy_product_id],
193
203
  return_action: loc?.product_return_action,
194
204
  return_location_token: loc?.return_location || null,
@@ -214,7 +224,6 @@ const ReturnOrderTable = () => {
214
224
  const isSelected = prevSelectedLocations?.some(
215
225
  (loc: any) => loc.id === id
216
226
  );
217
-
218
227
  if (isSelected) {
219
228
  const updatedSelectedLocations = prevSelectedLocations.filter(
220
229
  (loc: any) => loc.id !== id
@@ -237,8 +246,8 @@ const ReturnOrderTable = () => {
237
246
  } else {
238
247
  const newReturnPayload = {
239
248
  id,
240
- account_number: createReturn?.account_number,
241
- customer_id: +createReturn?.customer_id,
249
+ account_number: accountNumber,
250
+ customer_id: Number(urlCustomerId),
242
251
  products: [legacy_product_id],
243
252
  return_action: product_return_action || null,
244
253
  return_location_token: return_location || null,
@@ -299,7 +308,6 @@ const ReturnOrderTable = () => {
299
308
  const mergedPayload = Object.values(groupedPayload);
300
309
  setGrouped(mergedPayload);
301
310
  }, [newpayload]);
302
-
303
311
  return (
304
312
  <>
305
313
  <StyledTableWrapper className="fortables">
@@ -310,7 +318,10 @@ const ReturnOrderTable = () => {
310
318
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
311
319
  </th> */}
312
320
  {returnData?.some(
313
- (item: any) => item?.product_return_action === 'RTS'
321
+ (item: any) =>
322
+ item?.product_return_action === 'RTS' &&
323
+ item?.return_location !== 'null' &&
324
+ item?.return_location !== null
314
325
  ) ? (
315
326
  <th className="emailInvoiceCheckbox">
316
327
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
@@ -376,7 +387,9 @@ const ReturnOrderTable = () => {
376
387
  sortedData?.map((item: any, index: any) => (
377
388
  <tr key={item.id}>
378
389
  <td>
379
- {item?.product_return_action === 'RTS' ? (
390
+ {item?.product_return_action === 'RTS' &&
391
+ item?.return_location !== 'null' &&
392
+ item?.return_location !== null ? (
380
393
  <Checkbox
381
394
  className="custom-check"
382
395
  checked={selectedReturnOrder.some(
@@ -1,17 +1,23 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { useCustomerInfo } from '../../store';
3
+ import { useCustomerInfo, useGlobalEscData } from '../../store';
4
4
 
5
5
  const Details = () => {
6
6
  // const [orderDetails] = useOrderDetails();
7
7
  const [customerInfo] = useCustomerInfo();
8
8
  const recipient = customerInfo?.recipient_name || '';
9
9
  const postcodeShow = customerInfo?.postcode || '';
10
+ const [globalEscData] = useGlobalEscData();
10
11
 
11
12
  return (
12
13
  <DetailsContainer>
13
14
  <Typo>
14
- CUSTOMER RETURN - {recipient} , {postcodeShow}
15
+ CUSTOMER RETURN - {recipient} , {postcodeShow} {}
16
+ {globalEscData?.length > 0 && (
17
+ <EscInfo>
18
+ {`${globalEscData[0]?.escalation_type?.level} (${globalEscData[0]?.escalation_type?.name})`}
19
+ </EscInfo>
20
+ )}
15
21
  </Typo>
16
22
  </DetailsContainer>
17
23
  );
@@ -27,10 +33,14 @@ const DetailsContainer = styled.div`
27
33
  `;
28
34
 
29
35
  const Typo = styled.div`
36
+ display: flex;
37
+ flex-direction: row;
38
+ gap: 15px;
39
+ align-items: center;
30
40
  font-size: 20px;
31
41
  font-style: normal;
32
42
  font-weight: 600;
33
- line-height: 32px; /* 160% */
43
+ line-height: 32px;
34
44
  text-transform: uppercase;
35
45
  margin: 0;
36
46
  padding: 0;
@@ -40,4 +50,19 @@ const Typo = styled.div`
40
50
  }
41
51
  `;
42
52
 
53
+ const Name = styled.div`
54
+ /* heading/h3-subHeader */
55
+ font-family: 'Roboto', sans-serif;
56
+ font-size: 20px;
57
+ font-style: normal;
58
+ font-weight: 900;
59
+ line-height: 32px; /* 160% */
60
+ text-transform: uppercase;
61
+ `;
62
+
63
+ const EscInfo = styled(Name)`
64
+ color: #6396e5;
65
+ font-size: 16px;
66
+ `;
67
+
43
68
  export default Details;
@@ -27,6 +27,7 @@ import {
27
27
  useGlobalStateHitOrder,
28
28
  useAtom,
29
29
  usegetClientData,
30
+ useGlobalEscData,
30
31
  } from './store';
31
32
  import { OrdersType } from './types';
32
33
  import { useLocation } from 'react-router-dom';
@@ -73,6 +74,7 @@ function OrderView() {
73
74
  const order_id = orderDetails?.id;
74
75
  const [getResources] = useAtom(setResourcesCall);
75
76
  const [, setClientData] = usegetClientData();
77
+ const [, setGlobalEscData] = useGlobalEscData();
76
78
 
77
79
  useEffect(() => {
78
80
  setStatusVal(orderDetails?.status_value);
@@ -256,6 +258,7 @@ function OrderView() {
256
258
  useEffect(() => {
257
259
  if (orderId) {
258
260
  callCLientApi();
261
+ callEscalationApi();
259
262
  }
260
263
  }, [orderId]);
261
264
 
@@ -418,6 +421,32 @@ function OrderView() {
418
421
  setSubContracterData(formattedData);
419
422
  }
420
423
  }, [fetchedSubcontractotData, fetchedSubcontractotData, apiLoading]);
424
+
425
+ // ESCALATIONS API
426
+
427
+ const {
428
+ data: fetchedEscalationData,
429
+ fetchData: callEscalationApi,
430
+ loading: escalationDataLoading,
431
+ } = useAxios<{
432
+ data: any;
433
+ }>({
434
+ endpoint: `/orders/escalations/${orderId}`,
435
+ method: 'GET',
436
+ });
437
+
438
+ useEffect(() => {
439
+ if (fetchedEscalationData?.data) {
440
+ const escalationData = fetchedEscalationData?.data;
441
+ const sortedEscData = escalationData?.sort(
442
+ (a: any, b: any) =>
443
+ new Date(b?.created_at).getTime() - new Date(a?.created_at).getTime()
444
+ );
445
+ const showEsc = sortedEscData != null && sortedEscData.length > 0;
446
+ showEsc ? setGlobalEscData(sortedEscData) : setGlobalEscData([]);
447
+ }
448
+ }, [escalationDataLoading]);
449
+
421
450
  return (
422
451
  <MainContainer>
423
452
  <GeneralHeader />
@@ -34,7 +34,7 @@ function AddNote() {
34
34
  endpoint: `audit_logs/order/type`,
35
35
  method: 'GET',
36
36
  });
37
- console.log(selectedNoteType, 'selectedNoteType');
37
+
38
38
  useEffect(() => {
39
39
  getNoteType();
40
40
  }, []);
@@ -63,16 +63,18 @@ function AddNote() {
63
63
  method: 'POST',
64
64
  });
65
65
 
66
- const isValidFormat = () => {
67
- const lines = noteText.split('\n');
68
- if (lines.length < 3) return false;
69
- return (
70
- lines[0].startsWith('REASON-') &&
71
- lines[1].startsWith('STC-') &&
72
- lines[2].startsWith('ACTION-')
73
- );
74
- };
75
- const isDisabled = !noteText.trim() || !isValidFormat() || !selectedAssignee;
66
+ // `const isValidFormat = () => {
67
+ // const lines = noteText.split('\n');
68
+ // if (lines.length < 3) return false;
69
+ // return (
70
+ // lines[0].startsWith('REASON-') &&
71
+ // lines[1].startsWith('STC-') &&
72
+ // lines[2].startsWith('ACTION-')
73
+ // );
74
+ // };
75
+
76
+ const isDisabled = !noteText.trim() || !selectedAssignee;
77
+
76
78
  const saveNote = async () => {
77
79
  setRecallAuditLog(false);
78
80
  if (!noteText) return;
@@ -124,29 +126,7 @@ function AddNote() {
124
126
  }
125
127
  };
126
128
  const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
127
- const val = e.target.value;
128
- const lines = val.split('\n');
129
-
130
- while (lines.length < 3) {
131
- if (lines.length === 0) lines.push('REASON- ');
132
- else if (lines.length === 1) lines.push('STC- ');
133
- else if (lines.length === 2) lines.push('ACTION- ');
134
- }
135
-
136
- const enforcedLines = lines.map((line, idx) => {
137
- if (idx === 0) {
138
- if (!line.startsWith('REASON-')) return 'REASON- ';
139
- }
140
- if (idx === 1) {
141
- if (!line.startsWith('STC-')) return 'STC- ';
142
- }
143
- if (idx === 2) {
144
- if (!line.startsWith('ACTION-')) return 'ACTION- ';
145
- }
146
- return line;
147
- });
148
-
149
- setNoteText(enforcedLines.join('\n'));
129
+ setNoteText(e.target.value);
150
130
  };
151
131
 
152
132
  return (
@@ -8,12 +8,13 @@ import { useNewReturnOrderData, useSelectedProducts } from '../../../store';
8
8
  import { atom, useAtom } from 'jotai';
9
9
 
10
10
  export const payloadAtom = atom<any>(null);
11
+ export const selectedOrderId = atom<any>(null);
11
12
 
12
13
  const NewReturnDropdown = () => {
13
14
  const defaultSelectStyle = { width: '100%' };
14
15
  const defaultPopupClassName = 'dropDownStyle';
15
16
  const [returnOrderData, setReturnOrderData] = useNewReturnOrderData();
16
- const [selectedOrderId, setSelectedOrderId] = useState<string | null>(null);
17
+ const [selectedId, setSelectedOrderId] = useAtom(selectedOrderId);
17
18
  const [selectedProducts] = useSelectedProducts();
18
19
  const [orderData] = useOrderDetails();
19
20
  const [, setPayload] = useAtom(payloadAtom);
@@ -67,14 +68,14 @@ const NewReturnDropdown = () => {
67
68
  }, [fetchedReturnOrderData, id]);
68
69
 
69
70
  useEffect(() => {
70
- if (selectedOrderId && selectedProducts?.length > 0) {
71
+ if (selectedId && selectedProducts?.length > 0) {
71
72
  const newPayload = {
72
- new_return_order: selectedOrderId,
73
+ new_return_order: selectedId,
73
74
  products: selectedProducts,
74
75
  };
75
76
  setPayload(newPayload);
76
77
  }
77
- }, [selectedOrderId, selectedProducts, setPayload]);
78
+ }, [selectedId, selectedProducts, setPayload]);
78
79
 
79
80
  const handleDropdownChange = (value: string) => {
80
81
  setSelectedOrderId(value);
@@ -83,23 +84,20 @@ const NewReturnDropdown = () => {
83
84
  label: `${order?.recipient_name} - ${order?.postcode}`,
84
85
  value: order?.id,
85
86
  }));
86
-
87
87
  return (
88
88
  <Container>
89
89
  <Text>New Return Order:</Text>
90
90
  <StyledAntSelect
91
91
  options={dropdownOptions}
92
- value={selectedOrderId}
92
+ value={selectedId}
93
93
  placeholder="Select"
94
94
  // @ts-ignore
95
95
  onChange={handleDropdownChange}
96
96
  style={defaultSelectStyle}
97
97
  showSearch
98
- dropdownStyle={{ minWidth: '150px', width: 'auto' }}
98
+ dropdownStyle={{ width: '250px' }}
99
99
  popupClassName={defaultPopupClassName}
100
- status={
101
- dropdownOptions.length === 0 ? '' : selectedOrderId ? '' : 'error'
102
- }
100
+ status={dropdownOptions.length === 0 ? '' : selectedId ? '' : 'error'}
103
101
  notFoundContent="No orders found with a similar postcode"
104
102
  />
105
103
  </Container>
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import {
3
+ BackgroundModal,
4
+ CancelAndCompleteAction,
5
+ WarningIcon,
6
+ } from '@bjsdistribution/dms-component-library';
7
+ import styled from 'styled-components';
8
+ import { getBaseUrlSymbol } from '../../../utils';
9
+
10
+ interface IProps {
11
+ setConfirmationModal: React.Dispatch<React.SetStateAction<boolean>>;
12
+ onProceed: any;
13
+ }
14
+
15
+ const BaseChargeConfirmationModal = (props: IProps) => {
16
+ const baseUrlSymbol = getBaseUrlSymbol();
17
+
18
+ const onCancel = () => {
19
+ // window.scrollTo({ top: 0, behavior: 'smooth' });
20
+ props?.setConfirmationModal(false);
21
+ };
22
+
23
+ const onComplete = () => {
24
+ props?.setConfirmationModal(false);
25
+ props?.onProceed();
26
+ };
27
+
28
+ return (
29
+ <BackgroundModal {...props}>
30
+ <MainContainer>
31
+ <Container>
32
+ <IconContainer>
33
+ <WarningIcon />
34
+ </IconContainer>
35
+ <Title>{`Base Charge Exceeds ${baseUrlSymbol}200`}</Title>
36
+ </Container>
37
+ <CustomCancelAndCompleteAction
38
+ cancelLabel="Amend"
39
+ completeLabel="Proceed"
40
+ onCancel={onCancel}
41
+ onComplete={onComplete}
42
+ />
43
+ </MainContainer>
44
+ </BackgroundModal>
45
+ );
46
+ };
47
+
48
+ const CustomCancelAndCompleteAction = styled(CancelAndCompleteAction)`
49
+ justify-content: center;
50
+ `;
51
+
52
+ const Container = styled.div`
53
+ display: flex;
54
+ flex-direction: column;
55
+ align-items: center;
56
+ gap: 20px;
57
+ `;
58
+
59
+ const Title = styled.span`
60
+ font-family: 'Roboto', sans-serif;
61
+ font-size: 20px;
62
+ font-weight: 900;
63
+ line-height: 32px;
64
+ margin: 0;
65
+ padding: 0;
66
+ text-transform: uppercase;
67
+ `;
68
+
69
+ const IconContainer = styled.div`
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ width: 54px;
74
+ height: 54px;
75
+ padding: 14px;
76
+ border-radius: 50%;
77
+ background: #feba301a;
78
+ border: 10px solid #feba305e;
79
+ `;
80
+
81
+ const MainContainer = styled.div`
82
+ width: 400px;
83
+ min-height: 248px;
84
+ padding: 24px;
85
+ border-radius: 12px;
86
+ background: #ffffff;
87
+ box-shadow: 0px 20px 24px -4px #10182814;
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: 30px;
91
+ align-items: center;
92
+ `;
93
+
94
+ export default BaseChargeConfirmationModal;