@bjsdistribution/dms-client-return 0.0.24 → 0.0.26

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 +400 -437
  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 +401 -438
  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 +4 -0
  9. package/src/components/order-daily-overview/shared/utlis.ts +3 -1
  10. package/src/components/order-view/hooks/useGetSystemLogs.tsx +1 -2
  11. package/src/components/order-view/index.tsx +6 -6
  12. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +0 -4
  13. package/src/components/order-view/modalsPopup/ModalManager.tsx +30 -30
  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.24",
2
+ "version": "0.0.26",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -7,6 +7,7 @@ import {
7
7
  useGroupedPayload,
8
8
  useLocationData,
9
9
  useNewReturnPayload,
10
+ usePostLoading,
10
11
  useReturnPayload,
11
12
  useSelectAll,
12
13
  useSelectedOrders,
@@ -26,6 +27,7 @@ import { filtersReducerAtom } from '../../header-filters/filterStore';
26
27
  import { displayValueOrNA } from '../../shared/utlis';
27
28
  import PrintDropDownReturn from '../../../order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn';
28
29
  import { format } from 'date-fns';
30
+ import Loader from '../../header/loader/Loader';
29
31
  const ReturnOrderTable = () => {
30
32
  const [state] = useAtom(filtersReducerAtom);
31
33
 
@@ -34,6 +36,7 @@ const ReturnOrderTable = () => {
34
36
  const { 'x-filters': filters, 'x-pagination': pagination } = state;
35
37
  const [returnData, setReturnData] = useReturnData();
36
38
  const [load, setLoading] = useLoading();
39
+ const [postLoading] = usePostLoading();
37
40
  const dropdownRefParent = useRef<HTMLDivElement>(null);
38
41
  const dropdownRef = useRef<HTMLDivElement>(null);
39
42
  const [printToogle, setPrintToggle] = usePrintOptionTOggle();
@@ -256,6 +259,7 @@ const ReturnOrderTable = () => {
256
259
 
257
260
  return (
258
261
  <>
262
+ {postLoading && <Loader />}
259
263
  <StyledTableWrapper className="fortables">
260
264
  <StyledTable>
261
265
  <thead>
@@ -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) => {
@@ -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
  {
@@ -136,13 +136,13 @@ function OrderView() {
136
136
  }, [apiCalling]);
137
137
 
138
138
  useEffect(() => {
139
- // if (paths.length > 1) {
140
- // setOrderId(paths[2]);
141
- // }
142
- // for local
143
- if (paths.length >= 0) {
144
- setOrderId(paths[1]);
139
+ if (paths.length > 1) {
140
+ setOrderId(paths[2]);
145
141
  }
142
+ // for local
143
+ // if (paths.length >= 0) {
144
+ // setOrderId(paths[1]);
145
+ // }
146
146
  }, [paths]);
147
147
 
148
148
  useEffect(() => {
@@ -4,17 +4,14 @@ import styled from 'styled-components';
4
4
  import {
5
5
  useFinalPayload,
6
6
  useGroupedPayload,
7
- usePostLoading,
8
7
  useSelectedConfirmLoc,
9
8
  useSelectedOrders,
10
9
  } from '../../store';
11
10
  import { displayValueOrNA } from '../../order-daily-overview/shared/utlis';
12
- import Loader from '../../order-daily-overview/header/loader/Loader';
13
11
 
14
12
  const CreateReturnModal = () => {
15
13
  const [selectedlocation, setSelectedLocations] = useSelectedConfirmLoc();
16
14
  const [selectedReturnOrder] = useSelectedOrders();
17
- const [load] = usePostLoading();
18
15
  const [groupedPayload] = useGroupedPayload();
19
16
  const [, setNew] = useFinalPayload();
20
17
 
@@ -55,7 +52,6 @@ const CreateReturnModal = () => {
55
52
 
56
53
  return (
57
54
  <>
58
- {load && <Loader />}
59
55
  <Wrapper>
60
56
  <Alert
61
57
  onClose={() => {}}
@@ -47,7 +47,7 @@ const ModalManager = () => {
47
47
  const [selectedTab] = useAtom(selectedTabKeyAtom);
48
48
  const [, setIsFormValid] = useState(false);
49
49
  const [newGrouped] = useFinalPayload();
50
- const [, SetPostLoading] = usePostLoading();
50
+ const [postLoading, SetPostLoading] = usePostLoading();
51
51
  const [, setSelectedReturnOrder] = useSelectedOrders();
52
52
  const [forDisabledCheck, setCheck] = useSelectedConfirmLoc();
53
53
  const [, setNewPayload] = useNewReturnPayload();
@@ -155,6 +155,7 @@ const ModalManager = () => {
155
155
  if (newGrouped?.length > 0) {
156
156
  setShouldPerformAction(true);
157
157
  setCallForFetch(true);
158
+ SetPostLoading(confirmLoading);
158
159
  }
159
160
  dispatch({ type: 'close' });
160
161
  };
@@ -218,40 +219,39 @@ const ModalManager = () => {
218
219
  setShouldPerformAction(false);
219
220
  setSelectAll(false);
220
221
  setError(null);
221
- navigate('/order-return');
222
+ navigate('returnclient/order-return');
222
223
  }
223
- }, [response, apiError]);
224
-
225
- console.log(apiError, 'apiError apiError');
226
- console.log(response, 'response response ');
224
+ }, [response, apiError, postLoading]);
227
225
 
228
226
  return (
229
227
  <>
230
- {popupName?.state == 'create-return' && (
231
- <AntModal
232
- openStatus={popupName?.state == 'create-return' ? true : false}
233
- closeModal={() => closeModal()}
234
- PopupHeader={{
235
- heading: 'CONFIRM RETURN',
236
- subHeading: '',
237
- }}
238
- PopupFooter={{
239
- btns: [
240
- {
241
- name: 'Submit',
242
- btnStyle: 'rounded',
243
- onClick: handleConfirmReturn,
244
- type: 'button',
245
- disabled: forDisabledCheck.length === 0,
246
- },
247
- ],
228
+ {popupName?.state === 'create-return' && (
229
+ <>
230
+ <AntModal
231
+ openStatus={popupName?.state == 'create-return' ? true : false}
232
+ closeModal={() => closeModal()}
233
+ PopupHeader={{
234
+ heading: 'CONFIRM RETURN',
235
+ subHeading: '',
236
+ }}
237
+ PopupFooter={{
238
+ btns: [
239
+ {
240
+ name: 'Submit',
241
+ btnStyle: 'rounded',
242
+ onClick: handleConfirmReturn,
243
+ type: 'button',
244
+ disabled: forDisabledCheck.length === 0,
245
+ },
246
+ ],
248
247
 
249
- btnAlign: 'justifyEnd',
250
- }}
251
- BodyComponent={CreateReturnModal}
252
- width={800}
253
- classNameAdd={'globalPopup'}
254
- />
248
+ btnAlign: 'justifyEnd',
249
+ }}
250
+ BodyComponent={CreateReturnModal}
251
+ width={800}
252
+ classNameAdd={'globalPopup'}
253
+ />
254
+ </>
255
255
  )}
256
256
  {popupName?.state === 'qclog' && (
257
257
  <AntModal
@@ -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>