@bjsdistribution/dms-client-return 0.0.76 → 0.0.77
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/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.d.ts +6 -3
- package/dist/components/order-view/notes/NoteType.d.ts +3 -0
- package/dist/components/store.d.ts +3 -1
- package/dist/dms-client-return.cjs.development.js +294 -238
- 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 +294 -238
- package/dist/dms-client-return.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +3 -2
- package/src/components/order-view/details-filters/left-side-filters/dropdowns/PrintDropDownReturn.tsx +22 -10
- package/src/components/order-view/index.tsx +7 -6
- package/src/components/order-view/notes/AddNote.tsx +5 -1
- package/src/components/order-view/notes/NoteType.tsx +43 -25
- package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +8 -3
- package/src/components/store.ts +13 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.77",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"testEnvironment": "jest-environment-jsdom-sixteen"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@bjsdistribution/dms-component-library": "0.1.
|
|
62
|
+
"@bjsdistribution/dms-component-library": "0.1.47",
|
|
63
63
|
"@size-limit/preset-small-lib": "^11.0.1",
|
|
64
64
|
"@tippyjs/react": "^4.2.6",
|
|
65
65
|
"@types/react": "^18.2.47",
|
|
@@ -493,10 +493,11 @@ const ReturnOrderTable = () => {
|
|
|
493
493
|
>
|
|
494
494
|
<PrinterIcon />
|
|
495
495
|
<DownIcon />
|
|
496
|
-
{printToogle
|
|
496
|
+
{printToogle === index && (
|
|
497
497
|
<div ref={dropdownRef}>
|
|
498
498
|
<PrintDropDownReturn
|
|
499
|
-
|
|
499
|
+
legacyURL={item?.return_order_product_label}
|
|
500
|
+
legacyProductID={item?.legacy_product_id}
|
|
500
501
|
/>
|
|
501
502
|
</div>
|
|
502
503
|
)}
|
|
@@ -6,24 +6,32 @@ import { optionsForReturnPrint } from '../../../../order-daily-overview/common/f
|
|
|
6
6
|
|
|
7
7
|
const options: PrintData[] = optionsForReturnPrint;
|
|
8
8
|
|
|
9
|
-
const PrintDropDownReturn = ({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
{
|
|
13
|
-
|
|
9
|
+
const PrintDropDownReturn = ({
|
|
10
|
+
legacyURL,
|
|
11
|
+
legacyProductID,
|
|
12
|
+
}: {
|
|
13
|
+
legacyProductID: any;
|
|
14
|
+
legacyURL: string;
|
|
14
15
|
}) => {
|
|
15
16
|
const downloadFiles = () => {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
if (!legacyURL) return;
|
|
18
|
+
|
|
19
|
+
const url = `${legacyURL}${legacyProductID}`;
|
|
20
|
+
window.open(url, '_blank');
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
return (
|
|
21
24
|
<OptionsList>
|
|
22
25
|
{options?.map((item, index) => {
|
|
23
26
|
const IconComponent = PrintIconMap[item.icon];
|
|
27
|
+
const isDisabled = !legacyURL || !legacyProductID;
|
|
24
28
|
|
|
25
29
|
return (
|
|
26
|
-
<OptionsListLi
|
|
30
|
+
<OptionsListLi
|
|
31
|
+
key={index}
|
|
32
|
+
onClick={!isDisabled ? downloadFiles : undefined}
|
|
33
|
+
disabled={isDisabled}
|
|
34
|
+
>
|
|
27
35
|
{IconComponent && <IconComponent />} {item.label}
|
|
28
36
|
</OptionsListLi>
|
|
29
37
|
);
|
|
@@ -52,14 +60,18 @@ export const OptionsList = styled.ul`
|
|
|
52
60
|
min-width: 194px;
|
|
53
61
|
`;
|
|
54
62
|
|
|
55
|
-
export const OptionsListLi = styled.li
|
|
63
|
+
export const OptionsListLi = styled.li<{ disabled?: boolean }>`
|
|
56
64
|
border-bottom: 1px solid #f0f2f2;
|
|
57
65
|
padding: 8px 10px;
|
|
58
66
|
display: flex;
|
|
59
67
|
gap: 12px;
|
|
60
68
|
align-items: center;
|
|
61
69
|
font-size: 13px;
|
|
62
|
-
cursor: pointer;
|
|
70
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
71
|
+
color: ${({ disabled }) => (disabled ? '#ccc' : 'inherit')};
|
|
72
|
+
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
|
|
73
|
+
background-color: ${({ disabled }) => (disabled ? '#f5f5f5' : 'transparent')};
|
|
74
|
+
|
|
63
75
|
&:last-child {
|
|
64
76
|
border: none;
|
|
65
77
|
}
|
|
@@ -33,6 +33,7 @@ import useSystemLogs from './hooks/useGetSystemLogs';
|
|
|
33
33
|
import { notification } from 'antd';
|
|
34
34
|
// import { useAssignData } from '../store';
|
|
35
35
|
import DetailsFilters from './details-filters/DetailsFilters';
|
|
36
|
+
import { useVisibilityData } from '../store';
|
|
36
37
|
|
|
37
38
|
interface ApiResponse {
|
|
38
39
|
message: string;
|
|
@@ -66,7 +67,7 @@ function OrderView() {
|
|
|
66
67
|
const [, setRouteId] = useRouteId();
|
|
67
68
|
const [liveRecalling] = useLiveRecalling();
|
|
68
69
|
const systemLogsData = useSystemLogs();
|
|
69
|
-
|
|
70
|
+
const [, setVisibilityData] = useVisibilityData();
|
|
70
71
|
|
|
71
72
|
// query param
|
|
72
73
|
const location = useLocation();
|
|
@@ -174,11 +175,11 @@ function OrderView() {
|
|
|
174
175
|
if (fetchedStaticData && fetchedStaticData.data) {
|
|
175
176
|
const result = fetchedStaticData?.data;
|
|
176
177
|
setOrderStaticData(result[0]);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
setVisibilityData(
|
|
179
|
+
fetchedStaticData?.data?.flatMap(
|
|
180
|
+
(i: any) => i?.resource_visibility_type
|
|
181
|
+
)
|
|
182
|
+
);
|
|
182
183
|
}
|
|
183
184
|
}, [staticDataLoading]);
|
|
184
185
|
|
|
@@ -11,6 +11,8 @@ import { getCookie } from '../utils';
|
|
|
11
11
|
import { useLocation } from 'react-router-dom';
|
|
12
12
|
import { useGlobalStateHitAuditLog, usemoduleIds, useOrderId } from '../store';
|
|
13
13
|
import { notification } from 'antd';
|
|
14
|
+
import NoteType from './NoteType';
|
|
15
|
+
import { useSelectedData } from '../../store';
|
|
14
16
|
|
|
15
17
|
function AddNote() {
|
|
16
18
|
const [noteText, setNoteText] = useState('');
|
|
@@ -23,7 +25,7 @@ function AddNote() {
|
|
|
23
25
|
const ssoToken = getCookie('id_token');
|
|
24
26
|
const [moduleIds] = usemoduleIds();
|
|
25
27
|
const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
|
|
26
|
-
|
|
28
|
+
const [selected] = useSelectedData();
|
|
27
29
|
|
|
28
30
|
// Save New Note
|
|
29
31
|
|
|
@@ -48,6 +50,7 @@ function AddNote() {
|
|
|
48
50
|
description: noteText,
|
|
49
51
|
data_dump: '{}',
|
|
50
52
|
manual: 1,
|
|
53
|
+
is_private: selected,
|
|
51
54
|
},
|
|
52
55
|
],
|
|
53
56
|
};
|
|
@@ -115,6 +118,7 @@ function AddNote() {
|
|
|
115
118
|
<Button disabled={!noteText} onClick={saveNote}>
|
|
116
119
|
SAVE NOTE
|
|
117
120
|
</Button>
|
|
121
|
+
<NoteType />
|
|
118
122
|
</SaveNoteContainer>
|
|
119
123
|
</Container>
|
|
120
124
|
);
|
|
@@ -1,27 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RadioButtonGroup } from '@bjsdistribution/dms-component-library';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { useSelectedData, useVisibilityData } from '../../store';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// <Container>
|
|
10
|
-
// <RadioButtonGroup
|
|
11
|
-
// selectedValue={''}
|
|
12
|
-
// heading=""
|
|
13
|
-
// options={notesTypeOptions || []}
|
|
14
|
-
// onChange={radioGroupHandler}
|
|
15
|
-
// required={false}
|
|
16
|
-
// />
|
|
17
|
-
// </Container>
|
|
18
|
-
// );
|
|
19
|
-
// }
|
|
6
|
+
function NoteType() {
|
|
7
|
+
const [visibilityData] = useVisibilityData();
|
|
8
|
+
const [selected, setSelected] = useSelectedData();
|
|
20
9
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const handleRadioButtonChange = (
|
|
11
|
+
event: React.ChangeEvent<HTMLInputElement>
|
|
12
|
+
) => {
|
|
13
|
+
const selectedValue = event.target.value;
|
|
14
|
+
const selectedOption = visibilityData?.find(
|
|
15
|
+
(option: any) => option.value === selectedValue
|
|
16
|
+
);
|
|
17
|
+
if (selectedOption) {
|
|
18
|
+
setSelected(selectedOption.value);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Container>
|
|
24
|
+
<RadioButtonGroup
|
|
25
|
+
selectedValue={selected}
|
|
26
|
+
heading=""
|
|
27
|
+
options={visibilityData?.map((client: any) => ({
|
|
28
|
+
label: client.type,
|
|
29
|
+
value: client.value,
|
|
30
|
+
}))}
|
|
31
|
+
onChange={handleRadioButtonChange}
|
|
32
|
+
required={false}
|
|
33
|
+
/>
|
|
34
|
+
</Container>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Container = styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
flex: 1;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export default NoteType;
|
|
@@ -45,13 +45,18 @@ function HoldOrderModal() {
|
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
+
const dynamicUrl = selectedDate
|
|
49
|
+
? `orders/${orderId}/hold/?hold_reason=${holdReason}&hold_until=${selectedDate}`
|
|
50
|
+
: `orders/${orderId}/hold/?hold_reason=${holdReason}
|
|
51
|
+
`;
|
|
52
|
+
|
|
48
53
|
const {
|
|
49
54
|
data: response,
|
|
50
55
|
setShouldPerformAction: setPerformAction,
|
|
51
56
|
} = useApiHook<{
|
|
52
57
|
data: ApiResponse[];
|
|
53
58
|
}>({
|
|
54
|
-
endpoint:
|
|
59
|
+
endpoint: dynamicUrl,
|
|
55
60
|
method: 'POST',
|
|
56
61
|
performAction: false,
|
|
57
62
|
});
|
|
@@ -121,7 +126,7 @@ function HoldOrderModal() {
|
|
|
121
126
|
}
|
|
122
127
|
};
|
|
123
128
|
|
|
124
|
-
const showSubmitBtn = holdReason !== undefined
|
|
129
|
+
const showSubmitBtn = holdReason !== undefined;
|
|
125
130
|
|
|
126
131
|
return (
|
|
127
132
|
<OrderActionModal
|
|
@@ -136,7 +141,7 @@ function HoldOrderModal() {
|
|
|
136
141
|
<HoldContentContainer>
|
|
137
142
|
<SplitText>
|
|
138
143
|
<HoldRow>
|
|
139
|
-
<Label label="
|
|
144
|
+
<Label label="Hold Until (leave blank for indefinite)" />
|
|
140
145
|
<HoldDatePickerWrap>
|
|
141
146
|
<DatePicker
|
|
142
147
|
needConfirm
|
package/src/components/store.ts
CHANGED
|
@@ -64,6 +64,8 @@ const clearState = atom<boolean>(false);
|
|
|
64
64
|
|
|
65
65
|
const assignData = atom<any[]>([]);
|
|
66
66
|
|
|
67
|
+
const visibilityData = atom<any[]>([]);
|
|
68
|
+
|
|
67
69
|
const assignPayload = atom<AssignUpdatePayload>(AssignUpdateInitial);
|
|
68
70
|
|
|
69
71
|
const callAPIAgain = atom<boolean>(true);
|
|
@@ -166,6 +168,10 @@ function useAssignData() {
|
|
|
166
168
|
return useAtom(assignData);
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
function useVisibilityData() {
|
|
172
|
+
return useAtom(visibilityData);
|
|
173
|
+
}
|
|
174
|
+
|
|
169
175
|
function useAssignPayload() {
|
|
170
176
|
return useAtom(assignPayload);
|
|
171
177
|
}
|
|
@@ -185,6 +191,12 @@ function useSelectedProducts() {
|
|
|
185
191
|
return useAtom(selectedProductsMove);
|
|
186
192
|
}
|
|
187
193
|
|
|
194
|
+
const selectedAssignee = atom<any>('');
|
|
195
|
+
|
|
196
|
+
export function useSelectedData() {
|
|
197
|
+
return useAtom(selectedAssignee);
|
|
198
|
+
}
|
|
199
|
+
|
|
188
200
|
export {
|
|
189
201
|
useAtom,
|
|
190
202
|
useFilter,
|
|
@@ -214,4 +226,5 @@ export {
|
|
|
214
226
|
useActionTypeOptions,
|
|
215
227
|
useLocationOptions,
|
|
216
228
|
useSelectedProducts,
|
|
229
|
+
useVisibilityData
|
|
217
230
|
};
|