@bjsdistribution/dms-client-return 0.0.25 → 0.0.27
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/dist/components/store.d.ts +2 -1
- package/dist/dms-client-return.cjs.development.js +433 -440
- package/dist/dms-client-return.cjs.development.js.map +1 -1
- package/dist/dms-client-return.cjs.production.min.js +1 -1
- package/dist/dms-client-return.cjs.production.min.js.map +1 -1
- package/dist/dms-client-return.esm.js +434 -441
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +29 -5
- package/src/components/order-daily-overview/header-filters/filterStore.ts +7 -7
- package/src/components/order-daily-overview/shared/utlis.ts +3 -1
- package/src/components/order-view/hooks/useGetSystemLogs.tsx +1 -2
- package/src/components/order-view/index.tsx +6 -6
- package/src/components/order-view/modalsPopup/ModalManager.tsx +5 -0
- package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +12 -3
- package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +13 -2
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +18 -4
- package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +10 -1
- package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +12 -2
- package/src/components/order-view/order-details/expanded-content/services-section/index.tsx +5 -0
- package/src/components/order-view/products-info/collapsed-content/index.tsx +9 -90
- package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +15 -1
- package/src/components/store.ts +7 -0
- package/src/index.tsx +2 -5
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { atom, useAtom } from 'jotai';
|
|
12
12
|
import {
|
|
13
13
|
useActionType,
|
|
14
|
+
useClearState,
|
|
14
15
|
useCustomerData,
|
|
15
16
|
useGroupedPayload,
|
|
16
17
|
useLocationData,
|
|
@@ -57,6 +58,7 @@ function SelectionFilter() {
|
|
|
57
58
|
const [, setSelectedReturnOrder] = useSelectedOrders();
|
|
58
59
|
const [, setSelectAll] = useSelectAll();
|
|
59
60
|
const [, setCheck] = useSelectedConfirmLoc();
|
|
61
|
+
const [clearState, setClear] = useClearState();
|
|
60
62
|
|
|
61
63
|
//client options
|
|
62
64
|
const clientOptions = customers?.map((option: any) => ({
|
|
@@ -81,9 +83,8 @@ function SelectionFilter() {
|
|
|
81
83
|
}));
|
|
82
84
|
|
|
83
85
|
//client change
|
|
84
|
-
const handleSelectChange = (
|
|
86
|
+
const handleSelectChange = (_value: unknown, option: DefaultOptionType) => {
|
|
85
87
|
setNewPayload([]);
|
|
86
|
-
console.log(value, 'value');
|
|
87
88
|
const selectedLabel = option?.label as string;
|
|
88
89
|
const selectedValue = option?.id as number;
|
|
89
90
|
const selectedUuids = option?.uuid as string;
|
|
@@ -91,6 +92,8 @@ function SelectionFilter() {
|
|
|
91
92
|
const selectedCustomerId = option.gsit_customer_id as number;
|
|
92
93
|
setSelectedClient(selectedValue);
|
|
93
94
|
setName(selectedLabel);
|
|
95
|
+
// storedName(selectedLabel);
|
|
96
|
+
//set items in local storage
|
|
94
97
|
localStorage.setItem('clientName', selectedLabel);
|
|
95
98
|
localStorage.setItem('clientId', selectedValue.toString());
|
|
96
99
|
localStorage.setItem('account_number', selectAccountNumber);
|
|
@@ -100,11 +103,15 @@ function SelectionFilter() {
|
|
|
100
103
|
const storedCustomerId = localStorage.getItem('customer_id');
|
|
101
104
|
const storedUuid = localStorage.getItem('uuid');
|
|
102
105
|
setUuid(storedUuid);
|
|
106
|
+
|
|
107
|
+
//set payload
|
|
103
108
|
setReturnPayload((prevState: any) => ({
|
|
104
109
|
...prevState,
|
|
105
110
|
account_number: storedAccNo,
|
|
106
111
|
customer_id: storedCustomerId,
|
|
107
112
|
}));
|
|
113
|
+
|
|
114
|
+
//filtering locations
|
|
108
115
|
const filteredSubLocations = locationData
|
|
109
116
|
?.filter((subCat: any) => subCat?.customer_id === storedUuid)
|
|
110
117
|
.map((subCat: any) => ({
|
|
@@ -113,6 +120,8 @@ function SelectionFilter() {
|
|
|
113
120
|
}));
|
|
114
121
|
|
|
115
122
|
setFilteredLocationOptions(filteredSubLocations);
|
|
123
|
+
|
|
124
|
+
//clearing states
|
|
116
125
|
setUuid('');
|
|
117
126
|
setSelectedReturnOrder([]);
|
|
118
127
|
setNewPayload([]);
|
|
@@ -163,8 +172,6 @@ function SelectionFilter() {
|
|
|
163
172
|
const handleActionClick = (value: any) => {
|
|
164
173
|
setSelectedFilterValue(value);
|
|
165
174
|
};
|
|
166
|
-
const storedName = localStorage.getItem('clientName');
|
|
167
|
-
const storedClientId = localStorage.getItem('clientId');
|
|
168
175
|
|
|
169
176
|
//Apply filters
|
|
170
177
|
const applyFilters = () => {
|
|
@@ -211,6 +218,9 @@ function SelectionFilter() {
|
|
|
211
218
|
}
|
|
212
219
|
};
|
|
213
220
|
|
|
221
|
+
const storedName = localStorage.getItem('clientName');
|
|
222
|
+
const storedClientId = localStorage.getItem('clientId');
|
|
223
|
+
|
|
214
224
|
useEffect(() => {
|
|
215
225
|
if (storedClientId) {
|
|
216
226
|
dispatch({
|
|
@@ -243,7 +253,19 @@ function SelectionFilter() {
|
|
|
243
253
|
}
|
|
244
254
|
}, [selectedFilterValue, selectedLocationValue]);
|
|
245
255
|
|
|
246
|
-
|
|
256
|
+
const handleClear = () => {
|
|
257
|
+
setClear(false);
|
|
258
|
+
localStorage.removeItem('clientName');
|
|
259
|
+
localStorage.removeItem('clientId');
|
|
260
|
+
setClear(true);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (clearState) {
|
|
265
|
+
dispatch({ type: 'CLEAR_CLIENT' });
|
|
266
|
+
window.location.href = '/returnclient';
|
|
267
|
+
}
|
|
268
|
+
}, [clearState]);
|
|
247
269
|
|
|
248
270
|
return (
|
|
249
271
|
<Wrapper>
|
|
@@ -257,6 +279,8 @@ function SelectionFilter() {
|
|
|
257
279
|
onChange={handleSelectChange}
|
|
258
280
|
style={{ minWidth: '14vw' }}
|
|
259
281
|
value={storedName}
|
|
282
|
+
allowClear
|
|
283
|
+
onClear={handleClear}
|
|
260
284
|
/>
|
|
261
285
|
</FilterColumn>
|
|
262
286
|
|
|
@@ -98,13 +98,13 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
|
|
|
98
98
|
],
|
|
99
99
|
};
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
case 'CLEAR_CLIENT':
|
|
102
|
+
return {
|
|
103
|
+
...state,
|
|
104
|
+
'x-filters': state['x-filters'].filter(
|
|
105
|
+
f => f.field !== 'order.customer_id'
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
108
|
|
|
109
109
|
case 'CLEAR_ACTION':
|
|
110
110
|
return {
|
|
@@ -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
|
|
72
|
+
return `
|
|
73
|
+
${day}/${month}/${year}
|
|
74
|
+
`;
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
export const displayValueOrNA = (value: any) => {
|
|
@@ -136,13 +136,13 @@ function OrderView() {
|
|
|
136
136
|
}, [apiCalling]);
|
|
137
137
|
|
|
138
138
|
useEffect(() => {
|
|
139
|
-
|
|
140
|
-
|
|
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(() => {
|
|
@@ -219,6 +219,11 @@ const ModalManager = () => {
|
|
|
219
219
|
setShouldPerformAction(false);
|
|
220
220
|
setSelectAll(false);
|
|
221
221
|
setError(null);
|
|
222
|
+
|
|
223
|
+
// for local
|
|
224
|
+
// navigate('/order-return');
|
|
225
|
+
|
|
226
|
+
// for dev
|
|
222
227
|
navigate('returnclient/order-return');
|
|
223
228
|
}
|
|
224
229
|
}, [response, apiError, postLoading]);
|
package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx
CHANGED
|
@@ -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
|
-
<
|
|
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;
|
package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx
CHANGED
|
@@ -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
|
|
package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx
CHANGED
|
@@ -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={
|
|
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
|
-
|
|
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 {
|
package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx
CHANGED
|
@@ -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
|
-
<
|
|
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;
|
package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx
CHANGED
|
@@ -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
|
-
<
|
|
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={
|
|
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
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
`;
|
package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx
CHANGED
|
@@ -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 {
|
|
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>
|
package/src/components/store.ts
CHANGED
|
@@ -51,6 +51,8 @@ const postLoading = atom<boolean>(false);
|
|
|
51
51
|
|
|
52
52
|
const final = atom<any[]>([]);
|
|
53
53
|
|
|
54
|
+
const clearState = atom<boolean>(false);
|
|
55
|
+
|
|
54
56
|
function useReminderData() {
|
|
55
57
|
return useAtom(reminderTableData);
|
|
56
58
|
}
|
|
@@ -135,6 +137,10 @@ function useFinalPayload() {
|
|
|
135
137
|
return useAtom(final);
|
|
136
138
|
}
|
|
137
139
|
|
|
140
|
+
function useClearState() {
|
|
141
|
+
return useAtom(clearState);
|
|
142
|
+
}
|
|
143
|
+
|
|
138
144
|
export {
|
|
139
145
|
useAtom,
|
|
140
146
|
useFilter,
|
|
@@ -157,4 +163,5 @@ export {
|
|
|
157
163
|
useSelectAll,
|
|
158
164
|
usePostLoading,
|
|
159
165
|
useFinalPayload,
|
|
166
|
+
useClearState,
|
|
160
167
|
};
|
package/src/index.tsx
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import React, { Suspense, useEffect } from 'react';
|
|
2
2
|
import { Route, Routes, useNavigate } from 'react-router-dom';
|
|
3
|
-
// import AddOrder from './components/add-order';
|
|
4
3
|
import OrderView from './components/order-view';
|
|
5
|
-
// import AllReminder from './components/order-view/all-reminder/AllReminder';
|
|
6
4
|
import ReturnTable from './components/order-daily-overview/return-order-table/ReturnTable';
|
|
7
5
|
import ReturnAfterTable from './components/order-daily-overview/return-after-table/ReturnAfterTable';
|
|
8
6
|
import { useTableName } from './components/order-daily-overview/store/store';
|
|
9
|
-
// import ReturnOrderTable from './components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable';
|
|
10
7
|
import ReturnMainTable from './components/order-daily-overview';
|
|
11
8
|
import { notification } from 'antd';
|
|
12
9
|
import RouterHeader from './components/order-daily-overview/header/route-header/RouterHeader';
|
|
13
10
|
import {
|
|
14
11
|
useActionType,
|
|
15
12
|
// useAtom,
|
|
16
|
-
// useAtom,
|
|
17
13
|
useCustomerData,
|
|
18
14
|
useLocationData,
|
|
19
15
|
useStatusOrderData,
|
|
@@ -35,18 +31,19 @@ function ReturnClient() {
|
|
|
35
31
|
const [, setActionType] = useActionType();
|
|
36
32
|
const [, setLocationData] = useLocationData();
|
|
37
33
|
const [, setStatusOfOrders] = useStatusOrderData();
|
|
34
|
+
// const [dispatchvalue] = useAtom(filtersReducerAtom);
|
|
38
35
|
|
|
39
36
|
const splitPath = (str: any) => {
|
|
40
37
|
const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
|
|
41
38
|
return parts;
|
|
42
39
|
};
|
|
43
40
|
const paths = splitPath(location.pathname);
|
|
44
|
-
|
|
45
41
|
useEffect(() => {
|
|
46
42
|
if (paths[paths.length - 1] === 'returnclient') {
|
|
47
43
|
localStorage.removeItem('clientName');
|
|
48
44
|
localStorage.removeItem('clientId');
|
|
49
45
|
localStorage.removeItem('uuid');
|
|
46
|
+
// dispatch({ type: 'CLEAR_CLIENT' });
|
|
50
47
|
}
|
|
51
48
|
}, [location.pathname]);
|
|
52
49
|
|