@bjsdistribution/dms-client-return 0.1.9-prod → 0.1.10-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 (135) hide show
  1. package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
  2. package/dist/components/client-portal/ReturnAfterSearchBar.d.ts +4 -0
  3. package/dist/components/client-portal/ReturnOverview.d.ts +3 -0
  4. package/dist/components/client-portal/ReturnRTFilters.d.ts +5 -0
  5. package/dist/components/client-portal/ReturnSearchBar.d.ts +4 -0
  6. package/dist/components/client-portal/ReturnStatus.d.ts +8 -0
  7. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  8. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  9. package/dist/components/order-daily-overview/common/fakedata.d.ts +1 -0
  10. package/dist/components/order-daily-overview/header/route-header/RouterHeader.d.ts +1 -0
  11. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  12. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  13. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  14. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  15. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  41. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  42. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  43. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  44. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  45. package/dist/components/order-view/products-info/expanded-content/index.d.ts +4 -1
  46. package/dist/components/order-view/return-client-products/ProductTable.d.ts +4 -1
  47. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +4 -1
  48. package/dist/components/order-view/store.d.ts +14 -2
  49. package/dist/components/order-view/types.d.ts +49 -1
  50. package/dist/components/order-view/utils.d.ts +3 -0
  51. package/dist/components/store.d.ts +12 -1
  52. package/dist/components/utils.d.ts +1 -0
  53. package/dist/dms-client-return.cjs.development.js +7053 -2711
  54. package/dist/dms-client-return.cjs.development.js.map +1 -1
  55. package/dist/dms-client-return.cjs.production.min.js +1 -1
  56. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  57. package/dist/dms-client-return.esm.js +7111 -2769
  58. package/dist/dms-client-return.esm.js.map +1 -1
  59. package/package.json +6 -4
  60. package/src/assets/icons/ActionIcon.tsx +1 -1
  61. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  62. package/src/components/client-portal/OutstandingTable.tsx +412 -0
  63. package/src/components/client-portal/ReturnAfterSearchBar.tsx +242 -0
  64. package/src/components/client-portal/ReturnOverview.tsx +185 -0
  65. package/src/components/client-portal/ReturnRTFilters.tsx +228 -0
  66. package/src/components/client-portal/ReturnSearchBar.tsx +294 -0
  67. package/src/components/client-portal/ReturnStatus.tsx +252 -0
  68. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +235 -0
  69. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +404 -0
  70. package/src/components/order-daily-overview/common/fakedata.tsx +18 -0
  71. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +130 -1
  72. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +15 -3
  73. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +100 -70
  74. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -0
  75. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +86 -0
  76. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  77. package/src/components/order-daily-overview/return-after-table/table-filters/TableFilters.tsx +22 -1
  78. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +34 -6
  79. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +24 -11
  80. package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +26 -6
  81. package/src/components/order-daily-overview/shared/elements/PrintDropDown.tsx +5 -3
  82. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +5 -0
  83. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  84. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  85. package/src/components/order-view/index.tsx +45 -0
  86. package/src/components/order-view/notes/AddNote.tsx +94 -65
  87. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  88. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  89. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  90. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  91. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  92. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
  93. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +2 -2
  94. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  95. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  96. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  97. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  98. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  99. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  100. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  101. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  102. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  103. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  104. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  105. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  106. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  107. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  108. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  109. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  110. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  111. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  112. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  113. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  114. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  115. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  116. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  121. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  122. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  123. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  124. package/src/components/order-view/order-actions/index.tsx +15 -3
  125. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  126. package/src/components/order-view/products-info/expanded-content/index.tsx +27 -11
  127. package/src/components/order-view/products-info/index.tsx +4 -4
  128. package/src/components/order-view/return-client-products/ProductTable.tsx +6 -2
  129. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +54 -15
  130. package/src/components/order-view/store.ts +106 -0
  131. package/src/components/order-view/types.ts +54 -1
  132. package/src/components/order-view/utils.ts +37 -0
  133. package/src/components/store.ts +62 -1
  134. package/src/components/utils.ts +13 -3
  135. package/src/index.tsx +26 -16
@@ -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,14 +1,34 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { countReducerAtom, useAtom } from '../../../order-view/store';
3
+ import {
4
+ countReducerAtom,
5
+ useAtom,
6
+ useReturnData,
7
+ } from '../../../order-view/store';
4
8
  import { useSelectedOrders } from '../../../store';
5
9
  // import { StyledBulkItem } from '../../filters/BulkFilterStyle';
6
10
  // import SearchType from '../../header/route-header/search/SearchType';
7
11
  // import DownloadIcon from '../../../../assets/icons/DownloadIcon';
12
+ import { ExportButton } from '@bjsdistribution/dms-component-library';
13
+ import { filtersReducerAtom } from '../../header-filters/filterStore';
14
+ // import { FilterIconConatiner } from '../../filters/FilterStyle';
8
15
 
9
16
  const RightFilters = () => {
10
17
  const [, dispatch] = useAtom(countReducerAtom);
11
18
  const [selectedReturnOrder] = useSelectedOrders();
19
+ const [returnData] = useReturnData();
20
+ const [state] = useAtom(filtersReducerAtom);
21
+
22
+ const { 'x-filters': filters } = state;
23
+ const moduleInfo = {
24
+ isExportedData: returnData?.length <= 0 ? false : true,
25
+ moduleName: 'return',
26
+ filter: filters,
27
+ file_type: 'csv',
28
+ apiUrlEndPoint: `v1/return/product/pending/`,
29
+ reference: 'return_export',
30
+ feature_name: 'return',
31
+ };
12
32
 
13
33
  return (
14
34
  <Container>
@@ -22,11 +42,11 @@ const RightFilters = () => {
22
42
  <SearchType />
23
43
  </StyledBulkItem> */}
24
44
  {/* <IconConatiner>
25
- <Mid>
26
- <IconText>Export</IconText>
27
- <DownloadIcon />
28
- </Mid>
29
- </IconConatiner> */}
45
+ <Mid> */}
46
+ <ExportButton moduleInfoModule={moduleInfo} />
47
+ {/* <DownloadIcon />
48
+ </Mid> */}
49
+ {/* </IconConatiner> */}
30
50
  </Container>
31
51
  );
32
52
  };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
- import { optionsPrint } from '../../common/fakedata';
3
+ import { optionsClientPortPrint, optionsPrint } from '../../common/fakedata';
4
4
  import { PrintIconMap } from '../utlis';
5
+ import { useClientPortal } from '../../../store';
5
6
 
6
7
  const PrintDropDown = ({
7
8
  legacyProductId,
@@ -21,10 +22,11 @@ const PrintDropDown = ({
21
22
  console.log('URL not available for', type);
22
23
  }
23
24
  };
24
-
25
+ const [clientPortal] = useClientPortal();
26
+ const printOptions = clientPortal ? optionsClientPortPrint : optionsPrint;
25
27
  return (
26
28
  <OptionsList>
27
- {optionsPrint?.map((item, index) => {
29
+ {printOptions?.map((item: any, index: any) => {
28
30
  const IconComponent = PrintIconMap[item.icon];
29
31
  const isDisabled = !legacyProductId[item.type];
30
32
 
@@ -40,6 +40,7 @@ function Options() {
40
40
  };
41
41
 
42
42
  const isReleased = orderStatus[0]?.released;
43
+ // const routedValue = orderStatus[0]?.routed;
43
44
  const isRouted = orderStatus[0]?.routed && orderDetails?.order_routes?.id;
44
45
  const isOrderOnHold = orderDetails?.status === 'OO';
45
46
  const isOrderCancelled = orderDetails?.status === 'CO';
@@ -73,6 +74,10 @@ function Options() {
73
74
  shouldExclude = true;
74
75
  }
75
76
 
77
+ // if (routedValue && option.value === 'remove-from-route') {
78
+ // shouldExclude = true;
79
+ // }
80
+
76
81
  return !shouldExclude;
77
82
  });
78
83
 
@@ -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;
@@ -1,12 +1,16 @@
1
1
  import styled from 'styled-components';
2
2
  import React from 'react';
3
+
3
4
  import { Skeleton } from 'antd';
4
- import { formatUtcToLocal } from '@bjsdistribution/dms-component-library';
5
- import { useAuditLogLoadingState, usegetNotes } from '../store';
5
+ import {
6
+ PrivateIcon,
7
+ formatUtcToLocal,
8
+ } from '@bjsdistribution/dms-component-library';
6
9
  import { NotesTableData } from '../notes/logs/fakeData';
10
+ import { useAuditLogLoadingState, usegetNotes } from '../store';
7
11
 
8
12
  const GenericAuditLogsTable = () => {
9
- const tableHeadData = NotesTableData[0].tableHead; // Assuming NotesTableData contains table header information
13
+ const tableHeadData = NotesTableData[0]?.tableHead; // Assuming NotesTableData contains table header information
10
14
  const [getNotes] = usegetNotes();
11
15
  const [auditLogLoadingStatus] = useAuditLogLoadingState();
12
16
 
@@ -35,9 +39,23 @@ const GenericAuditLogsTable = () => {
35
39
  <div className="bold" title={note?.created_by}>
36
40
  {note?.created_by}
37
41
  </div>
38
- <div>{`${formatUtcToLocal(note?.created_at).date} @ ${
39
- formatUtcToLocal(note?.created_at).time
40
- }`}</div>
42
+ <div className="notesIcon">
43
+ {note?.is_private ? (
44
+ <>
45
+ <PrivateIcon />{' '}
46
+ <span className="datetime">{`${
47
+ formatUtcToLocal(note?.created_at).date
48
+ } @ ${
49
+ formatUtcToLocal(note?.created_at).time
50
+ }`}</span>
51
+ </>
52
+ ) : (
53
+ <span className="datetime">{`${
54
+ formatUtcToLocal(note?.created_at).date
55
+ } @ ${formatUtcToLocal(note?.created_at).time}`}</span>
56
+ )}
57
+ </div>
58
+ <div>{note?.note_type || 'N/A'}</div>
41
59
  </td>
42
60
  <td
43
61
  dangerouslySetInnerHTML={{ __html: note?.description }}
@@ -56,6 +74,8 @@ const GenericAuditLogsTable = () => {
56
74
  );
57
75
  };
58
76
 
77
+ const ScrollableTableWrapper = styled.div``;
78
+
59
79
  export const AuditTableWrapper = styled.div`
60
80
  height: 250px;
61
81
  min-height: 200px;
@@ -82,22 +102,29 @@ export const AuditTableWrapper = styled.div`
82
102
  color: #667085;
83
103
  font-family: Lato;
84
104
  font-size: 13px;
85
- font-style: normal;
86
105
  font-weight: 400;
87
106
  line-height: 16px;
88
107
  padding: 10px;
108
+ border-bottom: 1px solid #efe8e8;
109
+ word-break: break-word;
110
+ vertical-align: top;
111
+
89
112
  .bold {
90
113
  font-weight: 500;
91
114
  font-size: 14px;
92
115
  }
116
+ .notesIcon {
117
+ display: flex;
118
+ align-items: center;
119
+ gap: 5px;
120
+
121
+ .datetime {
122
+ min-width: 155px;
123
+ }
124
+ }
93
125
  }
94
126
  }
95
127
  }
96
128
  `;
97
129
 
98
- const ScrollableTableWrapper = styled.div`
99
- height: 550px;
100
- overflow: auto;
101
- `;
102
-
103
130
  export default GenericAuditLogsTable;
@@ -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);
@@ -211,7 +213,23 @@ function OrderView() {
211
213
  });
212
214
 
213
215
  setPrevOrderDetails(requiredData[0]);
216
+
217
+ //dbSync Api call
218
+ if (fetchedData?.data[0]?.gsit_order_id) {
219
+ localStorage.setItem(
220
+ 'dbSyncAPICall',
221
+ JSON.stringify({
222
+ status: true,
223
+ gsit_orderId: fetchedData?.data[0]?.gsit_order_id,
224
+ })
225
+ );
226
+ } else {
227
+ localStorage.setItem('dbSyncAPICall', JSON.stringify({}));
228
+ }
214
229
  }
230
+ return () => {
231
+ localStorage.removeItem('dbSyncAPICall');
232
+ };
215
233
  }, [loading]);
216
234
 
217
235
  useEffect(() => {
@@ -240,6 +258,7 @@ function OrderView() {
240
258
  useEffect(() => {
241
259
  if (orderId) {
242
260
  callCLientApi();
261
+ callEscalationApi();
243
262
  }
244
263
  }, [orderId]);
245
264
 
@@ -402,6 +421,32 @@ function OrderView() {
402
421
  setSubContracterData(formattedData);
403
422
  }
404
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
+
405
450
  return (
406
451
  <MainContainer>
407
452
  <GeneralHeader />
@@ -1,41 +1,79 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import styled from 'styled-components';
1
3
  import {
2
4
  Button,
3
5
  Label,
4
6
  useAxios,
5
- // SelectDropdown,
6
7
  } from '@bjsdistribution/dms-component-library';
7
- import React, { useEffect, useState } from 'react';
8
- import styled from 'styled-components';
9
- import { useLocation } from 'react-router-dom';
8
+ import { Select, notification } from 'antd';
10
9
  import { useGlobalStateHitAuditLog, usemoduleIds, useOrderId } from '../store';
11
- import { notification } from 'antd';
10
+ import { useLocation } from 'react-router-dom';
11
+ import { useClientPortal, useSelectedData } from '../../store';
12
12
  import NoteType from './NoteType';
13
- import { useSelectedData } from '../../store';
14
13
  import { ApiResponse } from '../types';
14
+ const template = `REASON- \nSTC- \nACTION- `;
15
15
 
16
16
  function AddNote() {
17
- const [noteText, setNoteText] = useState('');
17
+ const [noteText, setNoteText] = useState(template);
18
+ const [noteOptions, setNoteOptions] = useState<
19
+ { label: string; value: string }[]
20
+ >([]);
21
+ const [selectedNoteType, setSelectedNoteType] = useState<string | null>(
22
+ 'standard'
23
+ );
18
24
  const [orderId] = useOrderId();
19
25
  const location = useLocation();
20
26
  const pathname = location.pathname;
21
27
  const orderIdLocaation = pathname.split('/')[1];
28
+ const [isClientPortal] = useClientPortal();
22
29
  const [moduleIds] = usemoduleIds();
23
30
  const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
24
- const [selected] = useSelectedData();
31
+ const [selectedAssignee] = useSelectedData();
32
+
33
+ const { fetchData: getNoteType, data: fetchedData } = useAxios<any>({
34
+ endpoint: `audit_logs/order/type`,
35
+ method: 'GET',
36
+ });
37
+
38
+ useEffect(() => {
39
+ getNoteType();
40
+ }, []);
41
+
42
+ useEffect(() => {
43
+ if (fetchedData?.data) {
44
+ const options = fetchedData?.data?.map((item: any) => ({
45
+ label: item?.name,
46
+ value: item?.name,
47
+ }));
48
+ setNoteOptions(options);
49
+
50
+ const standardOption = options?.find(
51
+ (opt: any) => opt?.value?.toLowerCase() === 'standard'
52
+ );
53
+ if (standardOption) {
54
+ setSelectedNoteType(standardOption?.value);
55
+ } else if (options?.length > 0) {
56
+ setSelectedNoteType(options[0]?.value);
57
+ }
58
+ }
59
+ }, [fetchedData]);
25
60
 
26
- // Save New Note
27
- const { fetchData: callAuditLogs } = useAxios<{
28
- data: ApiResponse[];
29
- }>({
61
+ const { fetchData: callAuditLogs } = useAxios<{ data: ApiResponse[] }>({
30
62
  endpoint: `/audit_logs/orders/`,
31
63
  method: 'POST',
32
64
  });
33
65
 
34
- const [notificationData, setNotificationData] = useState<{
35
- type: 'success' | 'error';
36
- message: string;
37
- description: string;
38
- } | null>(null);
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;
39
77
 
40
78
  const saveNote = async () => {
41
79
  setRecallAuditLog(false);
@@ -46,34 +84,38 @@ function AddNote() {
46
84
  parent_object_id: orderId || orderIdLocaation,
47
85
  parent_module_id: moduleIds?.parentId,
48
86
  module_id: moduleIds?.id,
87
+ note_type: selectedNoteType,
49
88
  module_object_id: orderId || orderIdLocaation,
50
89
  action: 'create',
51
90
  description: noteText,
52
91
  data_dump: '{}',
53
92
  manual: 1,
54
- is_private: selected,
93
+ is_private: isClientPortal
94
+ ? false
95
+ : selectedAssignee === '0'
96
+ ? true
97
+ : false,
55
98
  },
56
99
  ],
57
100
  };
58
101
  try {
59
- let response = (await callAuditLogs({
60
- payload: payload,
61
- })) as {
62
- code: number | null;
63
- error?: string | null | undefined;
64
- [key: string]: any;
65
- };
66
- if (response.code == 200 && response?.data) {
102
+ const response = await callAuditLogs({ payload });
103
+ //@ts-ignore
104
+ if (response?.code === 200 && response?.data) {
67
105
  notification.success({
68
106
  message: 'Success',
69
- description: `${response?.message}`,
107
+ //@ts-ignore
108
+ description: response?.message || 'Note saved successfully',
70
109
  });
71
- setNoteText('');
110
+
111
+ setNoteText(template);
112
+ setSelectedNoteType('Standard');
72
113
  setRecallAuditLog(true);
73
114
  } else {
74
115
  notification.error({
75
116
  message: 'Error',
76
- description: `${response?.error}`,
117
+ //@ts-ignore
118
+ description: response?.error || 'Failed to save note',
77
119
  });
78
120
  }
79
121
  } catch (error) {
@@ -83,38 +125,25 @@ function AddNote() {
83
125
  });
84
126
  }
85
127
  };
86
-
87
- useEffect(() => {
88
- if (notificationData) {
89
- const { type, message, description } = notificationData;
90
- notification[type]({
91
- message,
92
- description,
93
- duration: 5,
94
- });
95
- setNotificationData(null); // Clear notification data after showing
96
- }
97
-
98
- // Set top position for notifications
99
- notification.config({
100
- top: 80,
101
- });
102
- }, [notificationData]);
128
+ const handleChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
129
+ setNoteText(e.target.value);
130
+ };
103
131
 
104
132
  return (
105
133
  <Container>
106
- <Label label="Add New Note" />
107
- <StyledTextArea
108
- name="description"
109
- placeholder="Enter your note here..."
110
- value={noteText}
111
- onChange={(e: any) => setNoteText(e.target.value)}
134
+ <Label label="Add New Note" required style={{ color: 'black' }} />
135
+ <StyledAntSelect
136
+ options={noteOptions}
137
+ placeholder="Select Note Type"
138
+ onChange={(value: string) => setSelectedNoteType(value)}
139
+ value={selectedNoteType}
112
140
  />
141
+ <StyledTextArea value={noteText} onChange={handleChange} rows={3} />
113
142
  <SaveNoteContainer>
114
- <Button disabled={!noteText} onClick={saveNote}>
143
+ <Button disabled={isDisabled} onClick={saveNote}>
115
144
  SAVE NOTE
116
145
  </Button>
117
- <NoteType />
146
+ {!isClientPortal && <NoteType />}
118
147
  </SaveNoteContainer>
119
148
  </Container>
120
149
  );
@@ -137,20 +166,20 @@ const SaveNoteContainer = styled.div`
137
166
  `;
138
167
 
139
168
  const StyledTextArea = styled.textarea`
140
- height: 57px;
141
- border-radius: 12px;
142
- background: #fff;
143
- resize: none;
169
+ height: 65px;
144
170
  border-radius: 8px;
145
- border: 1px solid var(--Neutral-Gray-Gray-100, #e0e2e7);
146
- background: var(--Flowkit-White, #fff);
171
+ background: #fff;
172
+ resize: vertical;
173
+ border: 1px solid #e0e2e7;
147
174
  padding: 8px 12px;
175
+ font-family: monospace;
176
+ white-space: pre-wrap;
148
177
  `;
149
178
 
150
- // const StyledSelectDropdown = styled(SelectDropdown)`
151
- // border-color: #e0e2e7 !important;
152
- // width: 8vw;
153
- // margin-bottom: 5px;
154
- // `;
179
+ export const StyledAntSelect: any = styled(Select)`
180
+ .ant-select-selector {
181
+ border-radius: 8px;
182
+ }
183
+ `;
155
184
 
156
185
  export default AddNote;