@bjsdistribution/dms-client-return 0.0.25 → 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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.25",
2
+ "version": "0.0.26",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -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(() => {
@@ -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>