@bjsdistribution/dms-client-return 0.0.85 → 0.0.87

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 (33) hide show
  1. package/dist/components/order-view/notification/OrderTemplate.d.ts +3 -0
  2. package/dist/components/order-view/order-actions/hooks/useFetchSingleReminder.d.ts +2 -0
  3. package/dist/components/order-view/order-actions/hooks/useUpdateReminder.d.ts +3 -0
  4. package/dist/components/order-view/order-actions/store.d.ts +1 -0
  5. package/dist/components/order-view/utils.d.ts +1 -0
  6. package/dist/components/order-view/view-reminder/AssigneeDropdown.d.ts +3 -0
  7. package/dist/components/order-view/view-reminder/ViewReminder.d.ts +3 -0
  8. package/dist/components/order-view/view-reminder/reminder-styles.d.ts +25 -0
  9. package/dist/dms-client-return.cjs.development.js +613 -114
  10. package/dist/dms-client-return.cjs.development.js.map +1 -1
  11. package/dist/dms-client-return.cjs.production.min.js +1 -1
  12. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  13. package/dist/dms-client-return.esm.js +613 -114
  14. package/dist/dms-client-return.esm.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/order-view/index.tsx +6 -1
  17. package/src/components/order-view/notification/OrderTemplate.tsx +349 -0
  18. package/src/components/order-view/notification/Tabs.tsx +10 -6
  19. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +0 -32
  20. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +7 -0
  21. package/src/components/order-view/order-actions/actions/uncancel-order/UncancelOrder.tsx +4 -3
  22. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +1 -1
  23. package/src/components/order-view/order-actions/hooks/useFetchSingleReminder.ts +56 -0
  24. package/src/components/order-view/order-actions/hooks/useUpdateReminder.ts +52 -0
  25. package/src/components/order-view/order-actions/index.tsx +3 -0
  26. package/src/components/order-view/order-actions/store.ts +6 -0
  27. package/src/components/order-view/order-actions/utils.ts +1 -1
  28. package/src/components/order-view/order-details/expanded-content/orders-section/Carrier.tsx +1 -1
  29. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -1
  30. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +1 -1
  31. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +33 -0
  32. package/src/components/order-view/view-reminder/ViewReminder.tsx +314 -0
  33. package/src/components/order-view/view-reminder/reminder-styles.tsx +173 -0
@@ -16,7 +16,7 @@ function Carrier() {
16
16
  const onChange = (selectedOption: any) => {
17
17
  setOrderDetails(prev => ({
18
18
  ...prev,
19
- carrier_id: selectedOption.value,
19
+ carrier_id: selectedOption?.value,
20
20
  }));
21
21
  };
22
22
 
@@ -31,7 +31,7 @@ function DeliveryPointDropdown() {
31
31
 
32
32
  return (
33
33
  <Container>
34
- <Label label="Delivery Point" htmlFor="deliveryPointDropdown" />
34
+ <Label label="Delivery Point" />
35
35
  <StyledSelectDropdown
36
36
  placeholder="Select Delivery Point"
37
37
  options={deliveryPointOptions || []}
@@ -48,7 +48,7 @@ function TimedServiceDropdown() {
48
48
 
49
49
  return (
50
50
  <Container>
51
- <Label label="Timed Service" htmlFor="timedServiceDropdown" />
51
+ <Label label="Timed Service" />
52
52
  <StyledSelectDropdown
53
53
  styles={{
54
54
  ...dropdownStyles,
@@ -0,0 +1,33 @@
1
+ import { Label, AntSelect } from '@bjsdistribution/dms-component-library';
2
+ import { notification } from 'antd';
3
+ import React from 'react';
4
+ import styled from 'styled-components';
5
+
6
+ function AssigneeDropdown() {
7
+ const handleSelectChange = () => {
8
+ notification.success({
9
+ message: 'Success',
10
+ description: 'Successfully updated',
11
+ });
12
+ };
13
+ return (
14
+ <FormContainer>
15
+ <Label label="Assigned To" required htmlFor="assigneDropdown" />
16
+ <StyledAntSelect
17
+ options={[]}
18
+ onChange={handleSelectChange}
19
+ selectWrapperClass={'rounded'}
20
+ style={{ display: 'flex' }}
21
+ />
22
+ </FormContainer>
23
+ );
24
+ }
25
+ const FormContainer = styled.div`
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: 6px;
29
+ flex: 1;
30
+ width: 325px;
31
+ `;
32
+ const StyledAntSelect = styled(AntSelect)``;
33
+ export default AssigneeDropdown;
@@ -0,0 +1,314 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import OrderActionModal from '../../../common/modals/order-action-modal/OrderActionModal';
3
+ import { useCurrentAction } from '../store';
4
+ import { DatePickerWrap, Label } from '../order-actions/actions/modalstyle';
5
+ import {
6
+ useFlagsLoading,
7
+ useReminderRefId,
8
+ useSingleReminderData,
9
+ useUpdateReminderData,
10
+ } from '../order-actions/store';
11
+ import Loader from '../../order-daily-overview/header/loader/Loader';
12
+ import StatusIndicator from '../flags-action-modal/StatusIndicator';
13
+ import styled from 'styled-components';
14
+ import { format, isValid } from 'date-fns';
15
+ import useFetchReminders from '../order-actions/hooks/useAllReminderData';
16
+ import { DatePicker } from 'antd';
17
+ import dayjs from 'dayjs';
18
+ import {
19
+ ReferenceContainer,
20
+ StyledText,
21
+ StyledTime,
22
+ InnerContainer,
23
+ ContentsContainer,
24
+ Left,
25
+ Right,
26
+ DateTimeContainer,
27
+ Row,
28
+ DetailedContainer,
29
+ MiniContainer,
30
+ TimeWrapper,
31
+ } from './reminder-styles';
32
+ import useFetchSingleReminderData from '../order-actions/hooks/useFetchSingleReminder';
33
+ import useUpdateReminder from '../order-actions/hooks/useUpdateReminder';
34
+ import AssigneeDropdown from './AssigneeDropdown';
35
+
36
+ const ViewReminderModal = () => {
37
+ const [, setCurrentAction] = useCurrentAction();
38
+ const fetchData = useFetchSingleReminderData();
39
+ const fetchRemindersData = useFetchReminders();
40
+
41
+ const updateReminder = useUpdateReminder();
42
+ const [, setDueDate] = useState<any | null>(null);
43
+ const [reminderData, setReminderData] = useSingleReminderData();
44
+ const [reminderRefId] = useReminderRefId();
45
+ const [loading, setLoading] = useFlagsLoading();
46
+ const [reminderPayload, setPayload] = useUpdateReminderData();
47
+
48
+ const closeModal = () => {
49
+ setCurrentAction(undefined);
50
+ };
51
+
52
+ const fetchReminderData = async () => {
53
+ setLoading(true);
54
+ const result = await fetchData();
55
+ setReminderData(result);
56
+ setLoading(false);
57
+ };
58
+
59
+ useEffect(() => {
60
+ fetchReminderData();
61
+ }, [reminderRefId]);
62
+
63
+ useEffect(() => {
64
+ if (reminderData) {
65
+ setPayload({
66
+ ...reminderPayload,
67
+ details: reminderData?.details,
68
+ id: reminderData?.id,
69
+ assigned_to: reminderData?.assigned_to,
70
+ due_date: reminderData?.due_date,
71
+ due_time: reminderData?.due_time,
72
+ status_id: reminderData?.status_id,
73
+ });
74
+ setDueDate(reminderData?.due_date);
75
+ }
76
+ }, [reminderData]);
77
+
78
+ const handleDateChange = (date: any | null) => {
79
+ if (date && isValid(date.$d)) {
80
+ setDueDate(date);
81
+ const formattedDate = format(new Date(date.$d), 'yyyy-MM-dd');
82
+
83
+ setPayload((prevState: any) => ({
84
+ ...prevState,
85
+ due_date: formattedDate,
86
+ }));
87
+ } else {
88
+ setDueDate(null);
89
+ setPayload((prevState: any) => ({
90
+ ...prevState,
91
+ due_date: undefined,
92
+ }));
93
+ }
94
+ };
95
+
96
+ const handleTime = (event: any) => {
97
+ setPayload({
98
+ ...reminderPayload,
99
+ due_time: event.target.value,
100
+ });
101
+ };
102
+
103
+ const onChangeDetails = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
104
+ setPayload({
105
+ ...reminderPayload,
106
+ details: event.target.value,
107
+ });
108
+ };
109
+
110
+ //set mark as complete
111
+ const handleResolved = (event: any) => {
112
+ setPayload({
113
+ ...reminderPayload,
114
+ status_id: reminderPayload.status_id === event ? 0 : event,
115
+ });
116
+ };
117
+
118
+ const handleEditReminder = async () => {
119
+ setLoading(true);
120
+ await updateReminder([reminderPayload]);
121
+ fetchRemindersData();
122
+ closeModal();
123
+ };
124
+
125
+ const isDisabled = reminderData?.reminder_status?.name_alias === 'resolved';
126
+
127
+ const additional =
128
+ reminderData?.order_data?.order_recipient?.recipient_name +
129
+ ' ' +
130
+ reminderData?.order_data?.order_recipient?.postcode;
131
+
132
+ return (
133
+ <>
134
+ {reminderData && loading && <Loader />}
135
+ <OrderActionModal
136
+ headerTitle="View Reminder"
137
+ onCloseHeader={closeModal}
138
+ onSubmit={handleEditReminder}
139
+ submitBtnTitle="Save Details"
140
+ isSubmitDisabled={isDisabled}
141
+ showAdditionalInfo
142
+ infoText={additional || 'NA'}
143
+ headerActions={
144
+ <OuterDiv>
145
+ {reminderData?.reminder_status?.name_alias === 'pending' ||
146
+ reminderData?.reminder_status?.name_alias === 'unresolved' ? (
147
+ <>
148
+ <StyledWrapper>
149
+ <StyledLabel>
150
+ <StyledCheckbox>
151
+ <input
152
+ type="checkbox"
153
+ onChange={() => handleResolved(2)}
154
+ />
155
+ <RoundCheckbox />
156
+ </StyledCheckbox>
157
+ <StyledSpan>Mark As Complete</StyledSpan>
158
+ </StyledLabel>
159
+ </StyledWrapper>
160
+ </>
161
+ ) : null}
162
+ </OuterDiv>
163
+ }
164
+ >
165
+ <ReferenceContainer style={{ marginTop: '20px' }}>
166
+ <InnerContainer>
167
+ <MiniContainer>
168
+ {' '}
169
+ <Label>Reference {} </Label>
170
+ <LabelText>{reminderData?.reference || 'N/A'}</LabelText>
171
+ </MiniContainer>
172
+ <MiniContainer>
173
+ {' '}
174
+ <Label>Status </Label>
175
+ <LabelText>
176
+ {reminderData?.reminder_status?.name_alias === 'pending' ||
177
+ reminderData?.reminder_status?.name_alias === 'unresolved' ? (
178
+ <StatusIndicator text="Incomplete" status="AD" />
179
+ ) : (
180
+ <StatusIndicator
181
+ text={`Completed on ${reminderData?.completed} by ${reminderData?.completed_by}`}
182
+ status="SD"
183
+ />
184
+ )}
185
+ </LabelText>
186
+ </MiniContainer>
187
+ </InnerContainer>
188
+ </ReferenceContainer>
189
+ <ContentsContainer>
190
+ <Left>
191
+ <AssigneeDropdown />
192
+ <DateTimeContainer>
193
+ <Label>Due </Label>
194
+ <Row>
195
+ <StyleContainer>
196
+ <DatePickerWrap>
197
+ <DatePicker
198
+ format="DD/MM/YYYY"
199
+ value={
200
+ reminderPayload?.due_date
201
+ ? dayjs(reminderPayload?.due_date)
202
+ : null
203
+ }
204
+ onChange={handleDateChange}
205
+ />
206
+ </DatePickerWrap>
207
+ </StyleContainer>
208
+
209
+ <TimeWrapper>
210
+ <StyledTime
211
+ onChange={handleTime}
212
+ value={reminderPayload?.due_time}
213
+ type="time"
214
+ />
215
+ </TimeWrapper>
216
+ </Row>
217
+ </DateTimeContainer>
218
+ </Left>
219
+ <Right>
220
+ <DetailedContainer>
221
+ <Label>Details</Label>
222
+ <StyledText
223
+ name="text"
224
+ required
225
+ value={reminderPayload?.details}
226
+ onChange={onChangeDetails}
227
+ />
228
+ </DetailedContainer>
229
+ </Right>
230
+ </ContentsContainer>
231
+ </OrderActionModal>
232
+ </>
233
+ );
234
+ };
235
+
236
+ const StyleContainer = styled.div`
237
+ border-radius: 20px;
238
+ background: #fff;
239
+ width: 235px;
240
+ `;
241
+
242
+ const StyledWrapper = styled.div`
243
+ display: flex;
244
+ padding: 6px 10px;
245
+ align-items: center;
246
+ gap: 5px;
247
+ border-radius: 30px;
248
+ background: #fff;
249
+ `;
250
+
251
+ const StyledLabel = styled.label`
252
+ cursor: pointer;
253
+ display: flex;
254
+ `;
255
+
256
+ const StyledSpan = styled.span`
257
+ color: #131313;
258
+ font-family: 'Lato', sans-serif;
259
+ font-style: normal;
260
+ font-weight: normal;
261
+ font-size: 14px;
262
+ line-height: 17px;
263
+ white-space: nowrap;
264
+ `;
265
+
266
+ const StyledCheckbox = styled.div`
267
+ input[type='checkbox'] {
268
+ display: none;
269
+ }
270
+
271
+ input[type='checkbox'] + span:before {
272
+ width: 14px;
273
+ height: 14px;
274
+ border: 1.5px solid #3a3630;
275
+ content: '';
276
+ display: inline-block;
277
+ margin: 0 8px 0 0;
278
+ padding: 0;
279
+ border-radius: 50%;
280
+ }
281
+
282
+ input[type='checkbox']:checked + span:before {
283
+ background: #feba30;
284
+ border: 1.5px solid #3a3630;
285
+ box-shadow: inset 0px 0px 0px 1px #fff;
286
+ color: #333;
287
+ content: '';
288
+ text-align: center;
289
+ border-radius: 50%;
290
+ display: flex;
291
+ width: 14px;
292
+ height: 14px;
293
+ }
294
+
295
+ input[type='checkbox']:focus + span::before {
296
+ outline: 0;
297
+ }
298
+ `;
299
+
300
+ const OuterDiv = styled.div`
301
+ padding-left: 33%;
302
+ `;
303
+
304
+ const RoundCheckbox = styled.span``;
305
+
306
+ const LabelText = styled.span`
307
+ color: var(--primary-dark-brown, #3a3630);
308
+ font-family: Lato;
309
+ font-size: 13px;
310
+ font-style: normal;
311
+ font-weight: 400;
312
+ line-height: 16px;
313
+ `;
314
+ export default ViewReminderModal;
@@ -0,0 +1,173 @@
1
+ import { TextArea, Input } from '@bjsdistribution/dms-component-library';
2
+ import styled from 'styled-components';
3
+ export const ReferenceContainer = styled.div`
4
+ display: flex;
5
+ height: 52px;
6
+ width: 770px;
7
+ padding: 10px 15px;
8
+ align-items: center;
9
+ flex: 1 0 0;
10
+ border-radius: 40px;
11
+ border: 1px solid rgba(0, 0, 0, 0.1);
12
+ background: #fff;
13
+ `;
14
+ export const InnerContainer = styled.div`
15
+ display: flex;
16
+ height: 52px;
17
+ padding: 10px 15px;
18
+ align-items: center;
19
+ gap: 20px;
20
+ flex: 1 0 0;
21
+ `;
22
+ export const MiniContainer = styled.div`
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: 3px;
26
+ flex: 1;
27
+ `;
28
+ export const StyledText = styled(TextArea)`
29
+ display: flex;
30
+ height: 105px;
31
+ padding: 8px 12px;
32
+ align-items: flex-start;
33
+ gap: 4px;
34
+ align-self: stretch;
35
+ border-radius: 15px;
36
+ resize: none;
37
+ `;
38
+ export const ReferInput = styled(Input)`
39
+ border: none;
40
+ border-radius: 15px;
41
+ width: 330px;
42
+ `;
43
+ export const InputContainer = styled(Input)`
44
+ border: none;
45
+ border-radius: 15px;
46
+ width: 330px;
47
+ `;
48
+ export const ReferInputContainer = styled(Input)`
49
+ border: none;
50
+ border-radius: 15px;
51
+ width: 330px;
52
+ `;
53
+ export const StyledDateContainer = styled.div`
54
+ position: relative;
55
+ border-radius: 66px;
56
+ border: 1px solid #e0e2e7;
57
+ box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
58
+ input[type='text'] {
59
+ border-radius: 20px;
60
+ background: #fff;
61
+ border: none;
62
+ color: #6a7378;
63
+ font-size: 14px;
64
+ font-weight: 400;
65
+ padding: 10px 0;
66
+ padding-left: 33px;
67
+ &:focus-visible {
68
+ outline: none;
69
+ }
70
+ }
71
+ svg {
72
+ position: absolute;
73
+ right: 10px;
74
+ top: 50%;
75
+ transform: translateY(-50%);
76
+ }
77
+ `;
78
+
79
+ export const StyledDate = styled(Input)`
80
+ border-radius: 66px;
81
+ width: 175px;
82
+ padding-right: 30px;
83
+ `;
84
+
85
+ export const TimeWrapper = styled.div`
86
+ display: flex;
87
+ width: 80px;
88
+ flex-direction: column;
89
+ align-items: flex-start;
90
+ gap: 6px;
91
+ `;
92
+ export const StyledTime = styled(Input)`
93
+ border-radius: 30px;
94
+ border: 1px solid #e0e2e7;
95
+ background: #fff;
96
+
97
+ box-shadow: 0px 1px 2px 0px rgba(16, 24, 40, 0.05);
98
+ display: flex;
99
+ padding: 8px 5px;
100
+ justify-content: space-between;
101
+ align-items: center;
102
+ align-self: stretch;
103
+ `;
104
+ export const IconContainer = styled.div`
105
+ position: absolute;
106
+ right: 10px;
107
+ top: 50%;
108
+ transform: translateY(-50%);
109
+ `;
110
+ const Column = styled.div`
111
+ display: flex;
112
+ justify-content: space-between;
113
+ align-items: center;
114
+ `;
115
+ export const Row = styled(Column)`
116
+ gap: 10px;
117
+ `;
118
+ export const Right = styled.div`
119
+ display: flex;
120
+ justify-content: space-between;
121
+ height: 100%;
122
+ gap: 15px;
123
+ `;
124
+ export const Left = styled.div`
125
+ display: flex;
126
+ flex-direction: column;
127
+ justify-content: space-between;
128
+ height: 100%;
129
+ gap: 15px;
130
+ padding: 15px;
131
+ `;
132
+ export const DateTimeContainer = styled.div`
133
+ display: flex;
134
+ flex-direction: column;
135
+ align-items: flex-start;
136
+ gap: 15px;
137
+ align-self: stretch;
138
+ `;
139
+ export const AssigneeContainer = styled.div`
140
+ display: flex;
141
+ padding: 15px 12px;
142
+ flex-direction: column;
143
+ justify-content: center;
144
+ align-items: flex-start;
145
+ gap: 15px;
146
+ flex: 1 0 0;
147
+ border-radius: 15px;
148
+ background: #f8fafc;
149
+ `;
150
+ export const DetailedContainer = styled.div`
151
+ display: flex;
152
+ width: 416px;
153
+ padding: 15px 12px;
154
+ flex-direction: column;
155
+ justify-content: center;
156
+ align-items: flex-start;
157
+ gap: 15px;
158
+ flex: 1 0 0;
159
+ border-radius: 66px;
160
+ background: #f8fafc;
161
+ `;
162
+ export const ContentsContainer = styled(Column)`
163
+ display: flex;
164
+ margin: 15px;
165
+ justify-content: center;
166
+ align-items: flex-start;
167
+ gap: 15px;
168
+ border-radius: 15px;
169
+ background: #f8fafc;
170
+ /* shadow/shadow-sm */
171
+ box-shadow: 0px 1px 3px 0px rgba(16, 24, 40, 0.1);
172
+ `;
173
+ ` `;