@bjsdistribution/dms-client-return 0.0.30 → 0.0.31

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 (21) hide show
  1. package/dist/dms-client-return.cjs.development.js +441 -439
  2. package/dist/dms-client-return.cjs.development.js.map +1 -1
  3. package/dist/dms-client-return.cjs.production.min.js +1 -1
  4. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  5. package/dist/dms-client-return.esm.js +442 -440
  6. package/dist/dms-client-return.esm.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +1 -2
  9. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +1 -0
  10. package/src/components/order-daily-overview/shared/utlis.ts +3 -1
  11. package/src/components/order-daily-overview/table/ReturnTable.tsx +76 -19
  12. package/src/components/order-daily-overview/table/table-data/styles.ts +1 -0
  13. package/src/components/order-view/hooks/useGetSystemLogs.tsx +1 -2
  14. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +12 -3
  15. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +13 -2
  16. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +18 -4
  17. package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +10 -1
  18. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +12 -2
  19. package/src/components/order-view/order-details/expanded-content/services-section/index.tsx +5 -0
  20. package/src/components/order-view/products-info/collapsed-content/index.tsx +9 -90
  21. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +15 -1
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.30",
2
+ "version": "0.0.31",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -294,10 +294,9 @@ const ReturnOrderTable = () => {
294
294
  <tbody>
295
295
  {load ? (
296
296
  <tr>
297
- <td colSpan={6}>
297
+ <td colSpan={13}>
298
298
  <Skeleton active />
299
299
  </td>
300
- <td colSpan={6}></td>
301
300
  </tr>
302
301
  ) : returnData?.length === 0 ? (
303
302
  <tr>
@@ -239,6 +239,7 @@ export const StyledTable = styled.table`
239
239
  border-radius: 40px;
240
240
  border-spacing: 0 10px;
241
241
  position: relative;
242
+ font-family: 'lato', sans-serif;
242
243
  .emailInvoiceCheckbox {
243
244
  padding-right: 0px;
244
245
  width: 0;
@@ -69,7 +69,9 @@ export const formatDate = (date: any) => {
69
69
  // const minutes = padZero(date.getMinutes());
70
70
  // const seconds = padZero(date.getSeconds());
71
71
 
72
- return `${year}-${month}-${day}`;
72
+ return `
73
+ ${day}/${month}/${year}
74
+ `;
73
75
  };
74
76
 
75
77
  export const displayValueOrNA = (value: any) => {
@@ -1,5 +1,9 @@
1
- import React, { useEffect } from 'react';
2
- import { useClientData, useOrderStaticData } from '../../order-view/store';
1
+ import React, { useEffect, useState } from 'react';
2
+ import {
3
+ useAtom,
4
+ useClientData,
5
+ useOrderStaticData,
6
+ } from '../../order-view/store';
3
7
  import { useLoading } from '../store/store';
4
8
  import { useApiHook } from '@bjsdistribution/dms-component-library';
5
9
  import {
@@ -10,6 +14,9 @@ import {
10
14
  StyledTableWrapper,
11
15
  } from './table-data/styles';
12
16
  import { Empty, Skeleton } from 'antd';
17
+ import { useNavigate } from 'react-router-dom';
18
+ import { filtersReducerAtom } from '../header-filters/filterStore';
19
+ import { useCustomerData } from '../../store';
13
20
 
14
21
  interface ApiResponse {
15
22
  message: string;
@@ -21,8 +28,12 @@ interface ApiResponse {
21
28
 
22
29
  const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
23
30
  const [clientData] = useClientData();
31
+ const [updatedData, setUpdatedData] = useState<any>([]);
24
32
  const [, setLoading] = useLoading();
25
33
  const [, setOrderStaticData] = useOrderStaticData();
34
+ const [, dispatch] = useAtom(filtersReducerAtom);
35
+ const navigate = useNavigate();
36
+ const [customers] = useCustomerData();
26
37
 
27
38
  const { data: fetchedStaticData, loading: staticDataLoading } = useApiHook<{
28
39
  data: ApiResponse[];
@@ -39,6 +50,49 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
39
50
  }
40
51
  }, [staticDataLoading, fetchedStaticData]);
41
52
 
53
+ //updated client data
54
+ useEffect(() => {
55
+ const updatedClientData = clientData?.map(client => {
56
+ const matchingCustomer = customers?.find(
57
+ (customer: any) => customer?.id === client?.customer_id
58
+ );
59
+ return {
60
+ ...client,
61
+ uuid: matchingCustomer ? matchingCustomer?.uuid : null,
62
+ };
63
+ });
64
+ setUpdatedData(updatedClientData);
65
+ }, [customers, clientData]);
66
+
67
+ //handle Redirect
68
+ const handleRedirect = (
69
+ customerName: string,
70
+ customerId: number,
71
+ customerUuid: string
72
+ ) => {
73
+ localStorage.setItem('clientName', customerName);
74
+ localStorage.setItem('clientId', customerId?.toString());
75
+ localStorage.setItem('uuid', customerUuid);
76
+
77
+ if (customerId) {
78
+ dispatch({
79
+ type: 'SET_CLIENT_FILTER',
80
+ payload: customerId,
81
+ });
82
+ dispatch({
83
+ type: 'SET_PAGE',
84
+ payload: 1,
85
+ });
86
+ } else {
87
+ dispatch({
88
+ type: 'SET_CLIENT_FILTER',
89
+ payload: [],
90
+ });
91
+ }
92
+ const selectedClientString = customerName?.replace(/\s+/g, '-');
93
+ navigate(`/filter/${selectedClientString}`);
94
+ };
95
+
42
96
  return (
43
97
  <>
44
98
  <StyledTableWrapper id="tableScrolling">
@@ -61,38 +115,41 @@ const ReturnTable: React.FC = ({ loadingskeleton }: any) => {
61
115
  <tbody>
62
116
  {loadingskeleton ? (
63
117
  <tr>
64
- <td colSpan={9}>
118
+ <td colSpan={11}>
65
119
  <Skeleton active />
66
120
  </td>
67
121
  </tr>
68
- ) : clientData?.length === 0 ? (
122
+ ) : updatedData?.length === 0 ? (
69
123
  <tr>
70
- <td colSpan={9}>
124
+ <td colSpan={11}>
71
125
  <EmptyDataContainer>
72
126
  <Empty />
73
127
  </EmptyDataContainer>
74
128
  </td>
75
129
  </tr>
76
130
  ) : (
77
- clientData?.map((key: any, index: any) => {
131
+ updatedData?.map((key: any, index: any) => {
78
132
  return (
79
133
  <tr key={index}>
80
134
  <td>{key?.trading_as}</td>
81
135
 
82
- <td>
83
- {' '}
84
- <ul style={{ listStyleType: 'none', padding: 0 }}>
85
- <li
86
- style={{
87
- color: '#0099ff',
88
- fontWeight: 600,
89
- paddingLeft: 0,
90
- }}
91
- >
92
- {key?.customer_name}
93
- </li>
94
- </ul>{' '}
136
+ <td
137
+ onClick={() =>
138
+ handleRedirect(
139
+ key?.customer_name,
140
+ key?.customer_id,
141
+ key?.uuid
142
+ )
143
+ }
144
+ style={{
145
+ color: '#0099ff',
146
+ fontWeight: 600,
147
+ cursor: 'pointer',
148
+ }}
149
+ >
150
+ <span>{key?.customer_name}</span>
95
151
  </td>
152
+
96
153
  <td>
97
154
  <ColumStyle>
98
155
  <GreyBox>
@@ -50,6 +50,7 @@ export const StyledTable = styled.table`
50
50
  tr {
51
51
  border-radius: 40px;
52
52
  border-spacing: 0 10px;
53
+ font-family: 'lato', sans-serif;
53
54
  .emailInvoiceCheckbox {
54
55
  padding-right: 0px;
55
56
  width: 0;
@@ -18,8 +18,7 @@ function useSystemLogs() {
18
18
  'Content-Type': 'application/json',
19
19
  Authorization: `Bearer ${ssoToken}`,
20
20
  'x-pagination': JSON.stringify({
21
- page: 1,
22
- per_page: 100,
21
+ is_pagination: false,
23
22
  }),
24
23
  'x-filters': JSON.stringify([
25
24
  {
@@ -26,10 +26,13 @@ function DeliveryPointDropdown() {
26
26
  const newData = { ...orderData, order_services_detail: updatedServices };
27
27
  setOrderData(newData);
28
28
  };
29
+
30
+ const isDisabled = true;
31
+
29
32
  return (
30
33
  <Container>
31
34
  <Label label="Delivery Point" htmlFor="deliveryPointDropdown" />
32
- <SelectDropdown
35
+ <StyledSelectDropdown
33
36
  placeholder="Select Delivery Point"
34
37
  options={deliveryPointOptions || []}
35
38
  inputId="deliveryPointDropdown"
@@ -38,7 +41,8 @@ function DeliveryPointDropdown() {
38
41
  )}
39
42
  openMenuOnFocus
40
43
  onChange={onChange}
41
- isDisabled={true}
44
+ // isDisabled={true}
45
+ className={isDisabled ? 'disabled' : ''}
42
46
  />
43
47
  </Container>
44
48
  );
@@ -50,5 +54,10 @@ const Container = styled.div`
50
54
  gap: 6px;
51
55
  flex: 1;
52
56
  `;
53
-
57
+ const StyledSelectDropdown = styled(SelectDropdown)`
58
+ &.disabled {
59
+ pointer-events: none;
60
+ opacity: 0.7;
61
+ }
62
+ `;
54
63
  export default DeliveryPointDropdown;
@@ -193,9 +193,10 @@ function OrderServices() {
193
193
  setOrderDetails(newData);
194
194
  }
195
195
  };
196
+ const isDisabled = true;
196
197
 
197
198
  return (
198
- <Container>
199
+ <Container disabled={isDisabled}>
199
200
  {orderServicesOptions?.map((service: any) => {
200
201
  const selected = !!orderServices?.find(
201
202
  (s: OrderServiceType) =>
@@ -216,12 +217,22 @@ function OrderServices() {
216
217
  );
217
218
  }
218
219
 
219
- const Container = styled.div`
220
+ const Container = styled.div<{ disabled: boolean }>`
220
221
  display: flex;
221
222
  gap: 30px;
222
223
  flex: 1;
223
224
  @media screen and (max-width: 1170px) {
224
225
  flex-wrap: wrap;
226
+
227
+ ${({ disabled }) =>
228
+ disabled &&
229
+ `
230
+ pointer-events: none;
231
+
232
+ > * {
233
+ pointer-events: none;
234
+ }
235
+ `}
225
236
  }
226
237
  `;
227
238
 
@@ -26,26 +26,40 @@ function ServiceLevel() {
26
26
  const newData = { ...orderData, order_services_detail: updatedServices };
27
27
  setOrderData(newData);
28
28
  };
29
+
30
+ const isDisabled = true; // Example value
31
+
29
32
  return (
30
- <Container>
33
+ <Container disabled={isDisabled}>
31
34
  <RadioButtonGroup
32
35
  selectedValue={serviceLevelId?.toString() || ''}
33
36
  heading="Service Level"
34
37
  options={serviceLevelOptions || []}
35
38
  onChange={radioGroupHandler}
36
39
  required={true}
37
- isDisabled={true}
40
+ isDisabled={isDisabled}
38
41
  />
39
42
  </Container>
40
43
  );
41
44
  }
42
45
 
43
- const Container = styled.div`
46
+ const Container = styled.div<{ disabled: boolean }>`
44
47
  display: flex;
45
48
  flex-direction: column;
46
49
  gap: 6px;
47
50
  flex: 1;
48
- /* temporary change will add this in library */
51
+
52
+ ${({ disabled }) =>
53
+ disabled &&
54
+ `
55
+ cursor: not-allowed;
56
+ pointer-events: none;
57
+
58
+ > * {
59
+ cursor: not-allowed;
60
+ }
61
+ `}
62
+
49
63
  > fieldset {
50
64
  > div {
51
65
  > div {
@@ -21,11 +21,12 @@ function ServiceTypeDropdown() {
21
21
  const newData = { ...orderData, order_type_id: event.value };
22
22
  setOrderData(newData);
23
23
  };
24
+ const isDisabled = true;
24
25
 
25
26
  return (
26
27
  <Container>
27
28
  <Label label="Service Type" htmlFor="serviceTypeDropdown" />
28
- <SelectDropdown
29
+ <StyledSelectDropdown
29
30
  placeholder="Select Service Type"
30
31
  options={serviceTypeOptions || []}
31
32
  value={serviceTypeOptions?.filter((f: any) => f.value === orderTypeId)}
@@ -33,6 +34,7 @@ function ServiceTypeDropdown() {
33
34
  openMenuOnFocus
34
35
  onChange={onChange}
35
36
  isDisabled={true}
37
+ className={isDisabled ? 'disabled' : ''}
36
38
  />
37
39
  </Container>
38
40
  );
@@ -45,4 +47,11 @@ const Container = styled.div`
45
47
  flex: 1;
46
48
  `;
47
49
 
50
+ const StyledSelectDropdown = styled(SelectDropdown)`
51
+ &.disabled {
52
+ cursor: not-allowed !important;
53
+ opacity: 0.7;
54
+ }
55
+ `;
56
+
48
57
  export default ServiceTypeDropdown;
@@ -40,10 +40,12 @@ function TimedServiceDropdown() {
40
40
  setOrderData(newData);
41
41
  };
42
42
 
43
+ const isDisabled = true;
44
+
43
45
  return (
44
46
  <Container>
45
47
  <Label label="Timed Service" htmlFor="timedServiceDropdown" />
46
- <SelectDropdown
48
+ <StyledSelectDropdown
47
49
  placeholder="Select Timed Service"
48
50
  options={timedServicesOptions || []}
49
51
  value={timedServicesOptions?.filter(
@@ -51,7 +53,8 @@ function TimedServiceDropdown() {
51
53
  )}
52
54
  inputId="timedServiceDropdown"
53
55
  onChange={onChange}
54
- isDisabled={true}
56
+ // isDisabled={isDisabled}
57
+ className={isDisabled ? 'disabled' : ''}
55
58
  />
56
59
  </Container>
57
60
  );
@@ -64,4 +67,11 @@ const Container = styled.div`
64
67
  flex: 1;
65
68
  `;
66
69
 
70
+ const StyledSelectDropdown = styled(SelectDropdown)`
71
+ &.disabled {
72
+ pointer-events: none;
73
+ opacity: 0.7;
74
+ }
75
+ `;
76
+
67
77
  export default TimedServiceDropdown;
@@ -66,6 +66,11 @@ const CustomFormSection = styled(FormSection)`
66
66
  border-radius: 8px;
67
67
  background: #f8fafc;
68
68
  box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.1);
69
+ label,
70
+ input,
71
+ span {
72
+ cursor: default !important;
73
+ }
69
74
  `;
70
75
 
71
76
  export default ServicesSection;
@@ -1,109 +1,28 @@
1
1
  import { SectionHeader } from '@bjsdistribution/dms-component-library';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
- // import ModalManager from '../../modalsPopup/ModalManager';
5
- // import { countReducerAtom, useProductDetails } from '../../store';
6
- // import { useAtom } from 'jotai';
7
4
 
8
5
  function CollapsedContent() {
9
- // const [, dispatch] = useAtom(countReducerAtom);
10
- // const [productdata] = useProductDetails();
11
- // const totalItems = productdata?.length;
12
-
13
- // const totalCube = () => {
14
- // let cubeData = 0;
15
- // for (let i = 0; i < productdata?.length; i++) {
16
- // cubeData += parseFloat(productdata[i].cube);
17
- // }
18
- // return `${cubeData.toFixed(2)}m³`;
19
- // };
20
-
21
- // const totalWeight = () => {
22
- // let weightData = 0;
23
- // for (let i = 0; i < productdata?.length; i++) {
24
- // weightData += parseFloat(productdata[i].weight);
25
- // }
26
- // return `${weightData.toFixed(2)} KG`;
27
- // };
28
6
  return (
29
7
  <Container>
30
8
  <SectionHeader label="Products" />
31
- {/* <Left>
32
- <Items>{totalItems} Delivery Items</Items>
33
- <Dimensions>
34
- {totalWeight()}/ {totalCube()}
35
- </Dimensions>
36
- </Left>
37
- <Right>
38
- <ActionContainer onClick={() => dispatch({ type: 'bulkUpdate' })}>
39
- <Action>Bulk Update</Action>
40
- </ActionContainer>
41
- <ActionContainer onClick={() => dispatch({ type: 'addProduct' })}>
42
- <Action>ADD NEW PRODUCT(S)</Action>
43
- </ActionContainer>
44
- <ActionContainer onClick={() => dispatch({ type: 'deleteProduct' })}>
45
- <Action>DELETE PRODUCT(S)</Action>
46
- </ActionContainer>
47
- </Right>
48
- <ModalManager /> */}
9
+ <Dimensions>Products to be Returned</Dimensions>
49
10
  </Container>
50
11
  );
51
12
  }
52
13
 
53
- // const Dimensions = styled.span`
54
- // font-family: 'Lato', sans-serif;
55
- // font-size: 13px;
56
- // font-weight: 500;
57
- // line-height: 16px;
58
- // color: #8e8a85;
59
- // `;
60
-
61
- // const Right = styled.div`
62
- // margin-left: auto;
63
- // display: flex;
64
- // gap: 10px;
65
- // margin-right: 10px;
66
- // `;
67
-
68
- // const Action = styled.span`
69
- // color: #3a3630;
70
- // font-family: 'Lato', sans-serif;
71
- // font-size: 12px;
72
- // font-style: normal;
73
- // font-weight: 600;
74
- // line-height: 20px;
75
- // text-transform: uppercase;
76
- // `;
77
-
78
- // const ActionContainer = styled.div`
79
- // padding: 5px 10px;
80
- // border-radius: 4px;
81
- // border: 1px solid #edebe8;
82
- // background: #edebe8;
83
- // box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
84
- // cursor: pointer;
85
- // `;
86
-
87
- // const Items = styled.span`
88
- // font-family: 'Roboto', sans-serif;
89
- // font-size: 14px;
90
- // font-weight: 500;
91
- // line-height: 24px;
92
- // color: #8e8a85;
93
- // text-transform: capitalize;
94
- // color: #aea9a1;
95
- // `;
96
-
97
- // const Left = styled.div`
98
- // display: flex;
99
- // align-items: center;
100
- // gap: 30px;
101
- // `;
14
+ const Dimensions = styled.span`
15
+ color: #6a7378;
16
+ font-size: 14px;
17
+ font-style: normal;
18
+ font-weight: 600;
19
+ line-height: 24px; /* 171.429% */
20
+ `;
102
21
 
103
22
  const Container = styled.div`
104
23
  display: flex;
105
24
  align-items: center;
106
- justify-content: space-between;
25
+ /* justify-content: space-between; */
107
26
  width: 100%;
108
27
  gap: 30px;
109
28
  `;
@@ -8,6 +8,8 @@ import ActionIcon from '../../../../assets/icons/ActionIcon';
8
8
  import { useSelectedOrders } from '../../../store';
9
9
  import { useOrderId, useOrderStaticData, useProductDetails } from '../../store';
10
10
  import { ApiResponse } from '../../types';
11
+ import Loader from '../../../order-daily-overview/header/loader/Loader';
12
+ import { notification } from 'antd';
11
13
 
12
14
  const ReturnProductTable = () => {
13
15
  const [selectedInvoices] = useSelectedOrders();
@@ -20,7 +22,11 @@ const ReturnProductTable = () => {
20
22
  setSelectedRowId(id);
21
23
  }, []);
22
24
 
23
- const { data: isresponse, setShouldPerformAction: setaction } = useApiHook<{
25
+ const {
26
+ data: isresponse,
27
+ setShouldPerformAction: setaction,
28
+ loading,
29
+ } = useApiHook<{
24
30
  data: ApiResponse[];
25
31
  }>({
26
32
  endpoint: `order/order_products/delete/`,
@@ -31,6 +37,13 @@ const ReturnProductTable = () => {
31
37
 
32
38
  useEffect(() => {
33
39
  if (isresponse && isresponse.data) {
40
+ notification.success({
41
+ message: 'Success',
42
+ description:
43
+ //@ts-ignore
44
+ isresponse?.message ||
45
+ 'An error has occurred. Please try again later.',
46
+ });
34
47
  handleRemoveRow();
35
48
  setSelectedRowId(null);
36
49
  }
@@ -71,6 +84,7 @@ const ReturnProductTable = () => {
71
84
 
72
85
  return (
73
86
  <div>
87
+ {loading && <Loader title="Deleting" />}
74
88
  <StyledTableWrapper id="tableScrolling">
75
89
  <StyledTable>
76
90
  <thead>