@bjsdistribution/dms-client-return 0.0.94-prod → 0.0.95-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 (138) hide show
  1. package/dist/assets/icons/ArrowDownIcon.d.ts +6 -0
  2. package/dist/assets/icons/DeliverProductIcon.d.ts +3 -0
  3. package/dist/assets/icons/ReturnProductIcon.d.ts +3 -0
  4. package/dist/common/checkbox/index.d.ts +2 -0
  5. package/dist/common/modals/order-action-modal/OrderActionModal.d.ts +3 -1
  6. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.d.ts +1 -0
  7. package/dist/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.d.ts +2 -2
  8. package/dist/components/order-view/flags-action-modal/Actions.d.ts +6 -2
  9. package/dist/components/order-view/flags-action-modal/Dropdowns.d.ts +1 -0
  10. package/dist/components/order-view/flags-action-modal/Header.d.ts +1 -1
  11. package/dist/components/order-view/notification/FlagTemplate.d.ts +1 -1
  12. package/dist/components/order-view/notification/OrderTemplate.d.ts +1 -1
  13. package/dist/components/order-view/notification/Tabs.d.ts +1 -1
  14. package/dist/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.d.ts +5 -0
  15. package/dist/components/order-view/order-actions/actions/cancel-order/index.d.ts +7 -1
  16. package/dist/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.d.ts +4 -1
  17. package/dist/components/order-view/order-actions/actions/charge-log/index.d.ts +11 -0
  18. package/dist/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.d.ts +1 -13
  19. package/dist/components/order-view/order-actions/actions/create-task-reminder/TaskModal.d.ts +5 -1
  20. package/dist/components/order-view/order-actions/actions/create-task-reminder/index.d.ts +6 -2
  21. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +6 -1
  22. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +5 -1
  23. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +5 -3
  24. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +5 -1
  25. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +1 -1
  26. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.d.ts +7 -1
  27. package/dist/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.d.ts +5 -0
  28. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +6 -1
  29. package/dist/components/order-view/order-actions/store.d.ts +10 -8
  30. package/dist/components/order-view/order-actions/types.d.ts +38 -60
  31. package/dist/components/order-view/order-actions/utils.d.ts +2 -1
  32. package/dist/components/order-view/store.d.ts +48 -3
  33. package/dist/components/order-view/types.d.ts +11 -0
  34. package/dist/components/order-view/utils.d.ts +1 -0
  35. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +5 -1
  36. package/dist/components/order-view/view-reminder/reminder-styles.d.ts +3 -1
  37. package/dist/components/store.d.ts +2 -1
  38. package/dist/dms-client-return.cjs.development.js +4812 -3095
  39. package/dist/dms-client-return.cjs.development.js.map +1 -1
  40. package/dist/dms-client-return.cjs.production.min.js +1 -1
  41. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  42. package/dist/dms-client-return.esm.js +4815 -3098
  43. package/dist/dms-client-return.esm.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/assets/icons/ArrowDownIcon.tsx +28 -0
  46. package/src/assets/icons/DeliverProductIcon.tsx +42 -0
  47. package/src/assets/icons/ReturnProductIcon.tsx +23 -0
  48. package/src/common/checkbox/index.tsx +60 -17
  49. package/src/common/modals/order-action-modal/OrderActionModal.tsx +13 -7
  50. package/src/common/radio-group/RadioButtonGroup.tsx +3 -4
  51. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +29 -26
  52. package/src/components/order-daily-overview/header-filters/filterStore.ts +6 -8
  53. package/src/components/order-daily-overview/index.tsx +20 -7
  54. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +2 -2
  55. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +19 -19
  56. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +11 -9
  57. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +19 -4
  58. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +41 -59
  59. package/src/components/order-daily-overview/table/ReturnTable.tsx +1 -30
  60. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +52 -2
  61. package/src/components/order-view/details-filters/left-side-filters/dropdowns/MenuDropDown.tsx +37 -43
  62. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +75 -44
  63. package/src/components/order-view/fakedata.ts +7 -6
  64. package/src/components/order-view/flags-action-modal/Actions.tsx +51 -25
  65. package/src/components/order-view/flags-action-modal/DetailSection.tsx +5 -5
  66. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +75 -89
  67. package/src/components/order-view/flags-action-modal/Header.tsx +32 -23
  68. package/src/components/order-view/flags-action-modal/TextSection.tsx +9 -6
  69. package/src/components/order-view/flags-action-modal/index.tsx +54 -67
  70. package/src/components/order-view/general-information/dropdowns/Print.tsx +136 -70
  71. package/src/components/order-view/generic-table/AuditLogs.tsx +5 -4
  72. package/src/components/order-view/index.tsx +9 -42
  73. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +20 -18
  74. package/src/components/order-view/modalsPopup/ModalManager.tsx +4 -10
  75. package/src/components/order-view/notes/logs/index.tsx +1 -1
  76. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +5 -7
  77. package/src/components/order-view/notification/FlagTemplate.tsx +8 -8
  78. package/src/components/order-view/notification/OrderTemplate.tsx +169 -175
  79. package/src/components/order-view/notification/ReminderTemplate.tsx +23 -14
  80. package/src/components/order-view/notification/Tabs.tsx +15 -14
  81. package/src/components/order-view/notification/index.tsx +164 -92
  82. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +19 -29
  83. package/src/components/order-view/order-actions/actions/cancel-order/CancelOrderTable.tsx +345 -0
  84. package/src/components/order-view/order-actions/actions/cancel-order/index.tsx +146 -71
  85. package/src/components/order-view/order-actions/actions/change-customer-account/ChangeCustomerAccModal.tsx +95 -32
  86. package/src/components/order-view/order-actions/actions/charge-log/index.tsx +395 -0
  87. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +1 -1
  88. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ActionDropdown.tsx +34 -17
  89. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactMobile.tsx +2 -3
  90. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactPhone.tsx +2 -3
  91. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/ContactWork.tsx +2 -3
  92. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/DeliveryDate.tsx +39 -25
  93. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/EmailAddress.tsx +1 -1
  94. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/TimedServiceDropdown.tsx +4 -2
  95. package/src/components/order-view/order-actions/actions/confirm-order/customer-info/index.tsx +1 -1
  96. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +254 -66
  97. package/src/components/order-view/order-actions/actions/confirm-order/slot-and-instructions/index.tsx +1 -1
  98. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +13 -9
  99. package/src/components/order-view/order-actions/actions/confirm-order/tables/ProductTable.tsx +1 -1
  100. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +213 -117
  101. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +97 -152
  102. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +30 -87
  103. package/src/components/order-view/order-actions/actions/create-task-reminder/index.tsx +77 -83
  104. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +57 -65
  105. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +10 -16
  106. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +21 -4
  107. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +39 -11
  108. package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +79 -8
  109. package/src/components/order-view/order-actions/actions/send-email/SendEmailModal.tsx +114 -17
  110. package/src/components/order-view/order-actions/actions/send-sms/SendSmsModal.tsx +115 -7
  111. package/src/components/order-view/order-actions/actions/split-order/index.tsx +14 -4
  112. package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +176 -87
  113. package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrderTable.tsx +352 -0
  114. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +35 -59
  115. package/src/components/order-view/order-actions/index.tsx +237 -22
  116. package/src/components/order-view/order-actions/store.ts +50 -48
  117. package/src/components/order-view/order-actions/types.ts +40 -65
  118. package/src/components/order-view/order-actions/utils.ts +15 -8
  119. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactEmail.tsx +2 -1
  120. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +80 -39
  121. package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +10 -14
  122. package/src/components/order-view/order-details/expanded-content/orders-section/DeliveryDate.tsx +10 -1
  123. package/src/components/order-view/order-details/expanded-content/orders-section/ScheduleAfter.tsx +2 -1
  124. package/src/components/order-view/products-info/expanded-content/index.tsx +3 -2
  125. package/src/components/order-view/products-info/index.tsx +14 -11
  126. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +26 -24
  127. package/src/components/order-view/store.ts +59 -2
  128. package/src/components/order-view/system-event-logs/columns/Date.tsx +4 -2
  129. package/src/components/order-view/system-event-logs/columns/Event.tsx +9 -9
  130. package/src/components/order-view/system-event-logs/columns/Note.tsx +1 -1
  131. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +25 -25
  132. package/src/components/order-view/types.ts +13 -0
  133. package/src/components/order-view/utils.ts +4 -0
  134. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +183 -12
  135. package/src/components/order-view/view-reminder/ViewReminder.tsx +234 -143
  136. package/src/components/order-view/view-reminder/reminder-styles.tsx +14 -8
  137. package/src/components/store.ts +6 -0
  138. package/src/index.tsx +28 -18
@@ -16,7 +16,7 @@ import styled from 'styled-components';
16
16
  import dayjs from 'dayjs';
17
17
  import {
18
18
  useAssignData,
19
- useCustomerData,
19
+ // useCustomerData,
20
20
  useStatusOrderData,
21
21
  } from '../../../store';
22
22
  import StatusIcon from '../../../../assets/icons/StatusIcon';
@@ -27,9 +27,12 @@ import {
27
27
  StyledFilterBtnLabel,
28
28
  } from '../../table/table-data/styles';
29
29
  import { filtersReducerReturnAtom } from './ReturnFilterStore';
30
+ import { useAxios } from '@bjsdistribution/dms-component-library';
31
+ import { ApiResponse } from '../../common/interface';
32
+
30
33
  const ReturnOrderFilter = () => {
31
34
  const [, dispatch] = useAtom(filtersReducerReturnAtom);
32
- const [customers] = useCustomerData();
35
+ // const [customers] = useCustomerData();
33
36
  const [selectedDate, setSelectedDate] = useState<any | null>();
34
37
  const [statusOfOrder] = useStatusOrderData();
35
38
  const [selectedClient, setSelectedClient] = useState<any | null>();
@@ -37,6 +40,18 @@ const ReturnOrderFilter = () => {
37
40
  const [selectedAssignee, setSelectedAssignee] = useState<any | null>();
38
41
  const [assignData] = useAssignData();
39
42
 
43
+ //API for client data
44
+ const { data: fetchedCustomerData, fetchData } = useAxios<ApiResponse>({
45
+ endpoint: `/v1/return/order/customers/`,
46
+ method: 'GET',
47
+ //@ts-ignore
48
+ pagination: { is_pagination: false },
49
+ });
50
+
51
+ useEffect(() => {
52
+ fetchData();
53
+ }, []);
54
+
40
55
  // date change here
41
56
  const handleDateChange = (date: any | null) => {
42
57
  setSelectedDate(date ? date?.$d : null);
@@ -55,7 +70,7 @@ const ReturnOrderFilter = () => {
55
70
  }
56
71
  }, [selectedDate]);
57
72
  //client options
58
- const clientOptions = customers?.map((option: any) => ({
73
+ const clientOptions = fetchedCustomerData?.data?.map((option: any) => ({
59
74
  label:
60
75
  option?.customer_name?.charAt(0)?.toUpperCase() +
61
76
  option?.customer_name?.slice(1),
@@ -66,7 +81,7 @@ const ReturnOrderFilter = () => {
66
81
  label:
67
82
  option?.status_type?.charAt(0)?.toUpperCase() +
68
83
  option?.status_type?.slice(1),
69
- value: option?.id,
84
+ value: option?.type,
70
85
  }));
71
86
  const handleClientChange = (value: any) => {
72
87
  if (value === selectedClient) return;
@@ -27,6 +27,7 @@ import {
27
27
  } from '../../store/store';
28
28
  import { EmptyDataContainer } from '../../table/table-data/styles';
29
29
  import { CustomDrop, StyledTable, StyledTableWrapper } from './returnstyles';
30
+ import { NavLink } from 'react-router-dom';
30
31
 
31
32
  const ReturnOrderTable = () => {
32
33
  const [state] = useAtom(filtersReducerAtom);
@@ -116,7 +117,7 @@ const ReturnOrderTable = () => {
116
117
  paginationData,
117
118
  setShouldPerformAction,
118
119
  } = useApiHook<ApiResponse>({
119
- endpoint: '/return_order_products/',
120
+ endpoint: '/v1/return/product/pending/',
120
121
  method: 'GET',
121
122
  filters: filters,
122
123
  pagination: pagination,
@@ -174,14 +175,14 @@ const ReturnOrderTable = () => {
174
175
 
175
176
  if (isChecked) {
176
177
  const filteredData = returnData?.filter(
177
- (loc: any) => loc?.order_product_return_action?.type === 'RTS'
178
+ (loc: any) => loc?.product_return_action === 'RTS'
178
179
  );
179
180
  const selectedOrders = filteredData.map((loc: any) => ({
180
181
  id: loc.id,
181
- return_locations: loc?.return_locations,
182
+ return_locations: loc?.return_location_name,
182
183
  return_location: loc?.return_location,
183
184
  products: loc?.legacy_product_id,
184
- order_product_return_action: loc?.order_product_return_action,
185
+ product_return_action: loc?.product_return_action,
185
186
  return_location_token: loc?.return_location,
186
187
  }));
187
188
  const newPayload = filteredData.map((loc: any) => ({
@@ -189,7 +190,7 @@ const ReturnOrderTable = () => {
189
190
  account_number: createReturn?.account_number,
190
191
  customer_id: +createReturn?.customer_id,
191
192
  products: [loc?.legacy_product_id],
192
- return_action: loc?.order_product_return_action?.type,
193
+ return_action: loc?.product_return_action,
193
194
  return_location_token: loc?.return_location || null,
194
195
  }));
195
196
 
@@ -205,8 +206,8 @@ const ReturnOrderTable = () => {
205
206
  const handleSelectOrderReturn = (
206
207
  id: any,
207
208
  return_location: any,
208
- return_locations: any,
209
- order_product_return_action: any,
209
+ return_location_name: any,
210
+ product_return_action: any,
210
211
  legacy_product_id: any
211
212
  ) => {
212
213
  setSelectedReturnOrder((prevSelectedLocations: any) => {
@@ -222,7 +223,7 @@ const ReturnOrderTable = () => {
222
223
  setReturnPayload(prevState => ({
223
224
  ...prevState,
224
225
  products: legacy_product_id,
225
- return_action: order_product_return_action?.type || null,
226
+ return_action: product_return_action || null,
226
227
  return_location_token: return_location || null,
227
228
  // new_location: new_location,
228
229
  }));
@@ -239,7 +240,7 @@ const ReturnOrderTable = () => {
239
240
  account_number: createReturn?.account_number,
240
241
  customer_id: +createReturn?.customer_id,
241
242
  products: [legacy_product_id],
242
- return_action: order_product_return_action?.type || null,
243
+ return_action: product_return_action || null,
243
244
  return_location_token: return_location || null,
244
245
  };
245
246
 
@@ -250,14 +251,14 @@ const ReturnOrderTable = () => {
250
251
  {
251
252
  id,
252
253
  return_location,
253
- return_locations,
254
- order_product_return_action,
254
+ return_location_name,
255
+ product_return_action,
255
256
  },
256
257
  ];
257
258
  setSelectAll(
258
259
  updatedSelectedLocations?.length ===
259
260
  returnData?.filter(
260
- (loc: any) => loc?.order_product_return_action?.type === 'RTS'
261
+ (loc: any) => loc?.product_return_action === 'RTS'
261
262
  )?.length
262
263
  );
263
264
  return updatedSelectedLocations;
@@ -295,7 +296,6 @@ const ReturnOrderTable = () => {
295
296
 
296
297
  return acc;
297
298
  }, []);
298
-
299
299
  const mergedPayload = Object.values(groupedPayload);
300
300
  setGrouped(mergedPayload);
301
301
  }, [newpayload]);
@@ -310,7 +310,7 @@ const ReturnOrderTable = () => {
310
310
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
311
311
  </th> */}
312
312
  {returnData?.some(
313
- (item: any) => item?.order_product_return_action?.type === 'RTS'
313
+ (item: any) => item?.product_return_action === 'RTS'
314
314
  ) ? (
315
315
  <th className="emailInvoiceCheckbox">
316
316
  <Checkbox checked={selectAll} onChange={handleSelectAll} />
@@ -318,25 +318,19 @@ const ReturnOrderTable = () => {
318
318
  ) : (
319
319
  <th></th>
320
320
  )}
321
- <th onClick={() => handleSort('orders_products_stock.location')}>
321
+ <th onClick={() => handleSort('location')}>
322
322
  <div className="sortIconClass">
323
- Product Location{' '}
324
- {renderSortIcon('orders_products_stock.location')}
323
+ Product Location {renderSortIcon('location')}
325
324
  </div>
326
325
  </th>
327
- <th onClick={() => handleSort('new_location')}>
326
+ <th onClick={() => handleSort('return_location_name')}>
328
327
  <div className="sortIconClass">
329
- Return Location {renderSortIcon('new_location')}
328
+ Return Location {renderSortIcon('return_location_name')}
330
329
  </div>
331
330
  </th>
332
- <th
333
- onClick={() =>
334
- handleSort('order_data.order_recipient.recipient_name')
335
- }
336
- >
331
+ <th onClick={() => handleSort('recipient_name')}>
337
332
  <div className="sortIconClass">
338
- Recipient{' '}
339
- {renderSortIcon('order_data.order_recipient.recipient_name')}
333
+ Recipient {renderSortIcon('recipient_name')}
340
334
  </div>
341
335
  </th>
342
336
  <th>Return Action</th>
@@ -349,16 +343,15 @@ const ReturnOrderTable = () => {
349
343
  </div>
350
344
  </th>
351
345
  <th>CBM</th>
352
- <th onClick={() => handleSort('return_reasons.reason')}>
346
+ <th onClick={() => handleSort('return_reason')}>
353
347
  <div className="sortIconClass">
354
- Return Reason {renderSortIcon('return_reasons.reason')}
348
+ Return Reason {renderSortIcon('return_reason')}
355
349
  </div>
356
350
  </th>
357
351
  <th>Collected</th>
358
- <th onClick={() => handleSort('collection_reasons.reason')}>
352
+ <th onClick={() => handleSort('collection_reason')}>
359
353
  <div className="sortIconClass">
360
- Collection Reason{' '}
361
- {renderSortIcon('collection_reasons.reason')}
354
+ Collection Reason {renderSortIcon('collection_reason')}
362
355
  </div>
363
356
  </th>
364
357
  <th className="emailInvoiceShare">Labels</th>
@@ -383,7 +376,7 @@ const ReturnOrderTable = () => {
383
376
  sortedData?.map((item: any, index: any) => (
384
377
  <tr key={item.id}>
385
378
  <td>
386
- {item?.order_product_return_action?.type === 'RTS' ? (
379
+ {item?.product_return_action === 'RTS' ? (
387
380
  <Checkbox
388
381
  className="custom-check"
389
382
  checked={selectedReturnOrder.some(
@@ -394,8 +387,8 @@ const ReturnOrderTable = () => {
394
387
  handleSelectOrderReturn(
395
388
  item?.id,
396
389
  item?.return_location,
397
- item?.return_locations,
398
- item?.order_product_return_action,
390
+ item?.return_location_name,
391
+ item?.product_return_action,
399
392
  item?.legacy_product_id
400
393
  )
401
394
  }
@@ -404,17 +397,13 @@ const ReturnOrderTable = () => {
404
397
  </td>
405
398
 
406
399
  <td>
407
- {item?.orders_products_stock?.location !== null &&
408
- item?.orders_products_stock?.location !== undefined ? (
409
- item.orders_products_stock.location
400
+ {item?.location !== null && item?.location !== undefined ? (
401
+ item?.location
410
402
  ) : (
411
403
  <div className="awaiting">Awaiting</div>
412
404
  )}
413
405
  </td>
414
- <td>
415
- {' '}
416
- {displayValueOrNA(item?.return_locations?.location_name)}
417
- </td>
406
+ <td> {displayValueOrNA(item?.return_location_name)}</td>
418
407
  <td>
419
408
  <ul style={{ listStyleType: 'none', padding: 0 }}>
420
409
  <li
@@ -424,39 +413,32 @@ const ReturnOrderTable = () => {
424
413
  paddingLeft: 0,
425
414
  }}
426
415
  >
427
- {displayValueOrNA(
428
- item?.order_data?.order_recipient?.recipient_name
429
- )}
416
+ <NavLink to={`/orders/view/${item?.order_id}`}>
417
+ {displayValueOrNA(item?.recipient_name)}
418
+ </NavLink>
430
419
  </li>
431
420
  <li style={{ color: '#888075' }}>
432
- {displayValueOrNA(
433
- item?.order_data?.order_recipient?.postcode
434
- )}
421
+ {displayValueOrNA(item?.postcode)}
435
422
  </li>
436
423
  </ul>
437
424
  </td>
438
- <td>
439
- {displayValueOrNA(item?.order_product_return_action?.type)}
440
- </td>
425
+ <td>{displayValueOrNA(item?.product_return_action)}</td>
441
426
  <td>{displayValueOrNA(item?.code)}</td>
442
427
  <td>{displayValueOrNA(item?.description)}</td>
443
- <td>{displayValueOrNA(item?.parts_count)}</td>
428
+ <td>{displayValueOrNA(item?.part)}</td>
444
429
  <td>
445
430
  {displayValueOrNA(item?.weight)}{' '}
446
431
  {item?.weight && item?.weight !== null ? 'KG' : ''}
447
432
  </td>
448
433
  <td>{displayValueOrNA(item?.cube)}</td>
449
- <td>{displayValueOrNA(item?.return_reasons?.reason)}</td>
434
+ <td>{displayValueOrNA(item?.return_reason)}</td>
450
435
  <td>
451
- {item?.order_product_returns?.length > 0
452
- ? item?.order_product_returns?.map((ret: any) =>
453
- ret?.collected_at
454
- ? format(new Date(ret?.collected_at), 'dd/MM/yyyy')
455
- : 'UNKNOWN'
456
- )
436
+ {item?.collected_at
437
+ ? format(new Date(item?.collected_at), 'dd/MM/yyyy')
457
438
  : 'UNKNOWN'}
458
439
  </td>
459
- <td>{displayValueOrNA(item?.collection_reasons?.reason)}</td>
440
+
441
+ <td>{displayValueOrNA(item?.collection_reason)}</td>
460
442
  <td>
461
443
  <ul className="actionbox">
462
444
  <CustomDrop
@@ -1,11 +1,6 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
- import {
3
- useAtom,
4
- useClientData,
5
- useOrderStaticData,
6
- } from '../../order-view/store';
2
+ import { useAtom, useClientData } from '../../order-view/store';
7
3
  import { useStatsLoading } from '../store/store';
8
- import { useApiHook } from '@bjsdistribution/dms-component-library';
9
4
  import {
10
5
  ColumStyle,
11
6
  EmptyDataContainer,
@@ -20,19 +15,10 @@ import { useCustomerData } from '../../store';
20
15
  import SortIcon from '../../../common/SortIcon';
21
16
  import CaretDownFilledIcon from '../../../common/CaretDownFilledIcon';
22
17
 
23
- interface ApiResponse {
24
- message: string;
25
- code: number;
26
- error: string | null;
27
- error_traceback: string | null;
28
- data: [];
29
- }
30
-
31
18
  const ReturnTable: React.FC = () => {
32
19
  const [clientData] = useClientData();
33
20
  const [updatedData, setUpdatedData] = useState<any>([]);
34
21
  const [statsLoading] = useStatsLoading();
35
- const [, setOrderStaticData] = useOrderStaticData();
36
22
  const [, dispatch] = useAtom(filtersReducerAtom);
37
23
  const navigate = useNavigate();
38
24
  const [customers] = useCustomerData();
@@ -84,21 +70,6 @@ const ReturnTable: React.FC = () => {
84
70
  );
85
71
  };
86
72
 
87
- //API call
88
- const { data: fetchedStaticData, loading: staticDataLoading } = useApiHook<{
89
- data: ApiResponse[];
90
- }>({
91
- endpoint: `/orders/getStaticData/all/`,
92
- method: 'GET',
93
- });
94
-
95
- useEffect(() => {
96
- if (fetchedStaticData && fetchedStaticData.data) {
97
- const result = fetchedStaticData?.data;
98
- setOrderStaticData(result[0]);
99
- }
100
- }, [staticDataLoading, fetchedStaticData]);
101
-
102
73
  //updated client data
103
74
  useEffect(() => {
104
75
  const updatedClientData = clientData?.map(client => {
@@ -1,26 +1,76 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import OptionsDropDown from './OptionsDropDown';
4
- import MenuDropDown from './MenuDropDown';
5
4
  import Print from '../../../general-information/dropdowns/Print';
5
+ import BjsMenuDropDown from './MenuDropDown';
6
+ import { useCurrentAction, useOrderDetails } from '../../../store';
6
7
  // components
7
8
 
8
9
  function DropDowns() {
10
+ const [orderDetails] = useOrderDetails();
11
+ const [, setCurrentAction] = useCurrentAction();
12
+
13
+ const isEmailId = orderDetails?.order_recipient?.contact_email;
14
+ const isContactNum = orderDetails?.order_recipient?.contact_home;
15
+
16
+ const actions = [];
17
+
18
+ if (isContactNum) {
19
+ actions?.push({
20
+ label: 'Send SMS',
21
+ onClick: () => setCurrentAction('send-sms'),
22
+ });
23
+ }
24
+
25
+ if (isEmailId) {
26
+ actions?.push({
27
+ label: 'Send Email',
28
+ onClick: () => setCurrentAction('send-email'),
29
+ });
30
+ }
31
+
9
32
  return (
10
33
  <>
11
34
  <DashBoardWrapper>
12
- <MenuDropDown />
35
+ <BjsMenuDropDown />
13
36
  <OptionsDropDown />
14
37
  <Print />
38
+ {actions?.map((action, index) => (
39
+ <FontContainer
40
+ key={index}
41
+ onClick={action.onClick}
42
+ style={{ cursor: 'pointer' }}
43
+ >
44
+ {action.label}
45
+ </FontContainer>
46
+ ))}
15
47
  </DashBoardWrapper>
16
48
  </>
17
49
  );
18
50
  }
51
+
19
52
  const DashBoardWrapper = styled.section`
20
53
  padding: 0 5px;
21
54
  display: flex;
22
55
  align-self: center;
23
56
  gap: 10px;
57
+ align-items: center;
58
+ `;
59
+
60
+ export const FontContainer: any = styled.div<{ disabled?: boolean }>`
61
+ color: #6a7378;
62
+ text-align: center;
63
+ font-family: 'lato', sans-serif;
64
+ font-size: 14px;
65
+ font-style: normal;
66
+ font-weight: 500;
67
+ line-height: 18px;
68
+ text-transform: uppercase;
69
+ cursor: ${props => (props.disabled ? 'not-allowed' : 'pointer')};
70
+ @media screen and (max-width: 1210px) {
71
+ font-size: 11px;
72
+ line-height: 12px;
73
+ }
24
74
  `;
25
75
 
26
76
  export default DropDowns;
@@ -1,15 +1,14 @@
1
- import {
2
- SelectDropdown,
3
- dropdownStyles,
4
- filterDropdownStyles,
5
- } from '@bjsdistribution/dms-component-library';
6
1
  import React from 'react';
7
2
  import { bjsMenu } from '../../../fakedata';
8
3
  import { useCurrentAction, useStatusDetails } from '../../../store';
9
- function BjsMenu() {
4
+ import ArrowDownIcon from '../../../../../assets/icons/ArrowDownIcon';
5
+ import { Dropdown, Space } from 'antd';
6
+ import styled from 'styled-components';
7
+
8
+ function BjsMenuDropDown() {
10
9
  const [, setCurrentAction] = useCurrentAction();
11
10
  const handleSelectChange = (selectedOption: any) => {
12
- setCurrentAction(selectedOption.value);
11
+ setCurrentAction(selectedOption);
13
12
  };
14
13
 
15
14
  const [orderStatus] = useStatusDetails();
@@ -24,43 +23,38 @@ function BjsMenu() {
24
23
  }
25
24
  });
26
25
 
26
+ const menuItems = {
27
+ items: filteredOptions?.map(option => ({
28
+ key: option.value,
29
+ label: (
30
+ <div onClick={() => handleSelectChange(option.value)}>
31
+ {option.label}
32
+ </div>
33
+ ),
34
+ })),
35
+ };
36
+
27
37
  return (
28
- <SelectDropdown
29
- placeholder="BJS MENU"
30
- inputId="bjsmenu"
31
- options={filteredOptions}
32
- onChange={handleSelectChange}
33
- isSearchable={false}
34
- styles={{
35
- ...dropdownStyles,
36
- ...filterDropdownStyles,
37
- container: styles => ({
38
- ...styles,
39
- cursor: 'pointer',
40
- }),
41
- menu: styles => ({
42
- ...styles,
43
- top: '113%',
44
- borderRadius: '5px',
45
- width: 'max-content',
46
- cursor: 'pointer',
47
- }),
48
- control: styles => ({
49
- ...styles,
50
- width: '105px',
51
- boxShadow: 'none',
52
- borderColor: 'transparent',
53
- cursor: 'pointer',
54
- backgroundColor: 'transparent',
55
- '&:hover': {
56
- boxShadow: 'none',
57
- borderColor: 'transparent',
58
- },
59
- }),
60
- }}
61
- value="BJS MENU"
62
- />
38
+ <Dropdown menu={menuItems} trigger={['hover']}>
39
+ <a onClick={e => e.preventDefault()} style={{ cursor: 'pointer' }}>
40
+ <StyledSpace>
41
+ BJS MENU
42
+ <ArrowDownIcon fill={'#f0f2f2'} />
43
+ </StyledSpace>
44
+ </a>
45
+ </Dropdown>
63
46
  );
64
47
  }
65
48
 
66
- export default BjsMenu;
49
+ const StyledSpace = styled(Space)`
50
+ .ant-space-item {
51
+ color: #6a7378;
52
+ text-align: center;
53
+ font-family: Lato;
54
+ font-size: 14px;
55
+ font-style: normal;
56
+ font-weight: 500;
57
+ }
58
+ `;
59
+
60
+ export default BjsMenuDropDown;