@bjsdistribution/dms-client-return 0.0.23 → 0.0.25

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 (25) hide show
  1. package/dist/common/services-slider/ServiceSlider.d.ts +1 -0
  2. package/dist/dms-client-return.cjs.development.js +445 -390
  3. package/dist/dms-client-return.cjs.development.js.map +1 -1
  4. package/dist/dms-client-return.cjs.production.min.js +1 -1
  5. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  6. package/dist/dms-client-return.esm.js +446 -391
  7. package/dist/dms-client-return.esm.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/common/services-slider/ServiceSlider.tsx +9 -8
  10. package/src/components/order-daily-overview/header-filters/filterStore.ts +7 -7
  11. package/src/components/order-daily-overview/index.tsx +2 -1
  12. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +25 -11
  13. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +5 -1
  14. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +7 -1
  15. package/src/components/order-view/modalsPopup/CreateReturnModal.tsx +0 -4
  16. package/src/components/order-view/modalsPopup/ModalManager.tsx +30 -30
  17. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +1 -1
  18. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -0
  19. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +1 -0
  20. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +1 -0
  21. package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +1 -0
  22. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +1 -0
  23. package/src/components/order-view/products-info/expanded-content/index.tsx +16 -13
  24. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +7 -1
  25. package/src/index.tsx +0 -10
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.23",
2
+ "version": "0.0.25",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -8,25 +8,26 @@ interface SliderProps {
8
8
  serviceId: number;
9
9
  isSelected: boolean;
10
10
  toggle: (id: number) => void;
11
+ disabled: boolean;
11
12
  }
12
13
 
13
14
  function ServiceSlider(props: SliderProps) {
15
+ // const onClick = (event: React.MouseEvent<HTMLDivElement>) => {
16
+ // event.preventDefault();
17
+ // props.toggle(props.serviceId);
18
+ // };
14
19
 
15
- const onClick = (event: React.MouseEvent<HTMLDivElement>) => {
16
- event.preventDefault();
17
- props.toggle(props.serviceId);
18
- };
19
-
20
20
  return (
21
- <Container onClick={() => props.toggle(props.serviceId)}>
21
+ <Container>
22
22
  <ServiceIcon src={getIcon(props.serviceId)} />
23
23
  <ServiceName>{props.serviceName}</ServiceName>
24
24
  {/* to stop event propagation */}
25
- <div onClick={onClick}>
25
+ <div className="hidden">
26
26
  <Switch
27
27
  checked={props.isSelected}
28
28
  name={props.serviceName}
29
29
  onChange={() => {}}
30
+ disabled={props?.disabled}
30
31
  />
31
32
  </div>
32
33
  </Container>
@@ -51,7 +52,7 @@ const Container = styled.div`
51
52
  display: flex;
52
53
  gap: 10px;
53
54
  align-items: center;
54
- cursor: pointer;
55
+ cursor: not-allowed;
55
56
  flex: 1;
56
57
  `;
57
58
 
@@ -98,13 +98,13 @@ const filterReducer = (state: FilterState, action: any): FilterState => {
98
98
  ],
99
99
  };
100
100
 
101
- case 'CLEAR_CLIENT':
102
- return {
103
- ...state,
104
- 'x-filters': state['x-filters'].filter(
105
- f => f.field !== 'order.customer_id'
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 {
@@ -46,7 +46,8 @@ function ReturnMainTable() {
46
46
  }>({
47
47
  endpoint: `/return_orders/get/client-returns/`,
48
48
  method: 'GET',
49
- pagination: { page: 1, per_page: 200 },
49
+ //@ts-ignore
50
+ pagination: { page: 1, per_page: 200, is_pagination: false },
50
51
  });
51
52
 
52
53
  useEffect(() => {
@@ -90,16 +90,22 @@ const OrderTable = ({ loadingskeleton }: any) => {
90
90
  },
91
91
  ];
92
92
 
93
- const getStatusClass = (status: any) => {
93
+ const getStatusClass = (status: string) => {
94
94
  switch (status) {
95
95
  case 'Cancelled':
96
96
  return { color: '#E95252', background: 'rgba(233, 82, 82, 0.15)' };
97
- case 'Pending':
97
+ case 'On Hold':
98
98
  return { color: '#F4A503', background: '#FFF1D6' };
99
- case 'Awaiting':
99
+ case 'Sub-Contracted':
100
+ return { color: '#F4A503', background: '#FFF1D6' };
101
+ case 'Awaiting route':
100
102
  return { color: '#845ADF', background: 'rgba(132, 90, 223, 0.15)' };
101
103
  case 'Completed':
102
104
  return { color: '#1F9254', background: 'rgba(41, 204, 106, 0.15)' };
105
+ case 'Outstanding':
106
+ return { color: '#FF9900', background: 'rgba(255, 153, 0, 0.15)' };
107
+ case 'Routed':
108
+ return { color: '#6396E5', background: 'rgba(99, 150, 229, 0.15)' };
103
109
  default:
104
110
  return { color: '#000', background: '#fff' };
105
111
  }
@@ -109,7 +115,7 @@ const OrderTable = ({ loadingskeleton }: any) => {
109
115
  // console.log(id, 'idid');
110
116
  return (
111
117
  <>
112
- <StyledTableWrapper>
118
+ <StyledTableWrapper className="fortables">
113
119
  <StyledTable>
114
120
  <thead>
115
121
  <tr>
@@ -150,14 +156,16 @@ const OrderTable = ({ loadingskeleton }: any) => {
150
156
  ) : (
151
157
  returnAfterOrder?.map((item: any, index: any) => {
152
158
  const statusMapping: any = {
153
- CO: 'Cancelled',
159
+ cancelled: 'Cancelled',
154
160
  OO: 'On Hold',
155
161
  SC: 'Sub-Contracted',
156
- AR: 'Awaiting Route',
157
- SD: 'Completed',
158
- AD: 'Outstanding',
162
+ 'awaiting route': 'Awaiting route',
163
+ completed: 'completed',
164
+ outstanding: 'Outstanding',
165
+ routed: 'Routed',
159
166
  };
160
- const status = statusMapping[item?.status] || 'Unknown';
167
+
168
+ const status = statusMapping[item?.status_value] || 'Unknown';
161
169
  const statusClass = getStatusClass(status);
162
170
  return (
163
171
  <tr key={item.id}>
@@ -223,9 +231,15 @@ const OrderTable = ({ loadingskeleton }: any) => {
223
231
  <td>
224
232
  <ul
225
233
  className="statuscontainer"
226
- style={{ listStyleType: 'none' }}
234
+ style={{
235
+ listStyleType: 'none',
236
+ background: statusClass.background,
237
+ }}
227
238
  >
228
- <li className={`statustext ${statusClass}`}>
239
+ <li
240
+ className="statustext"
241
+ style={{ color: statusClass.color }}
242
+ >
229
243
  {status}
230
244
  </li>
231
245
  </ul>
@@ -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,7 +259,8 @@ const ReturnOrderTable = () => {
256
259
 
257
260
  return (
258
261
  <>
259
- <StyledTableWrapper>
262
+ {postLoading && <Loader />}
263
+ <StyledTableWrapper className="fortables">
260
264
  <StyledTable>
261
265
  <thead>
262
266
  <tr>
@@ -517,7 +517,13 @@ export const StyledTableWrapper = styled.div`
517
517
  overflow-x: auto;
518
518
  max-height: 60vh;
519
519
  scrollbar-width: none;
520
- min-height: 60vh;
520
+
521
+ .fortables {
522
+ overflow-x: auto;
523
+ max-height: 60vh;
524
+ scrollbar-width: none;
525
+ min-height: 60vh;
526
+ }
521
527
  /* height: 600px; */
522
528
  /* box-shadow: 0px 0px 30px 6px rgba(46, 45, 116, 0.05); */
523
529
  &::-webkit-scrollbar {
@@ -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
@@ -123,7 +123,7 @@ function AssemblyType() {
123
123
  onChange={radioGroupHandler}
124
124
  required={false}
125
125
  //@ts-ignore
126
- isDisabled={isServiceDisable()}
126
+ isDisabled={true}
127
127
  />
128
128
  </Container>
129
129
  );
@@ -38,6 +38,7 @@ function DeliveryPointDropdown() {
38
38
  )}
39
39
  openMenuOnFocus
40
40
  onChange={onChange}
41
+ isDisabled={true}
41
42
  />
42
43
  </Container>
43
44
  );
@@ -208,6 +208,7 @@ function OrderServices() {
208
208
  isSelected={selected}
209
209
  toggle={toggleServices}
210
210
  key={service?.id}
211
+ disabled={true}
211
212
  />
212
213
  );
213
214
  })}
@@ -34,6 +34,7 @@ function ServiceLevel() {
34
34
  options={serviceLevelOptions || []}
35
35
  onChange={radioGroupHandler}
36
36
  required={true}
37
+ isDisabled={true}
37
38
  />
38
39
  </Container>
39
40
  );
@@ -32,6 +32,7 @@ function ServiceTypeDropdown() {
32
32
  inputId="serviceTypeDropdown"
33
33
  openMenuOnFocus
34
34
  onChange={onChange}
35
+ isDisabled={true}
35
36
  />
36
37
  </Container>
37
38
  );
@@ -51,6 +51,7 @@ function TimedServiceDropdown() {
51
51
  )}
52
52
  inputId="timedServiceDropdown"
53
53
  onChange={onChange}
54
+ isDisabled={true}
54
55
  />
55
56
  </Container>
56
57
  );
@@ -1,28 +1,31 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import ProductTable from '../../return-client-products/ProductTable';
4
- // import OrderDetailsFooter from '../../order-details/expanded-content/footer';
5
- // import NewReturnDropdown from '../../notes/order-dropdown/NewReturnDropdown';
4
+ import NewReturnDropdown from '../../notes/order-dropdown/NewReturnDropdown';
6
5
  import { Button } from '@bjsdistribution/dms-component-library';
7
- import { notification } from 'antd';
6
+ // import { notification } from 'antd';
8
7
 
9
8
  function ExpandedContent() {
10
- const SaveNote = () => {
11
- // alert('saved');
12
- notification.success({
13
- message: 'Success',
14
- description: ' Saved successfully.',
15
- });
16
- };
9
+ // const SaveNote = () => {
10
+ // // alert('saved');
11
+ // notification.success({
12
+ // message: 'Success',
13
+ // description: ' Saved successfully.',
14
+ // });
15
+ // };
17
16
  return (
18
17
  <Container>
19
18
  <ProductTable />
20
19
  <MidConatiner>
21
20
  <SaveNoteContainer>
22
- <Button style={{ borderRadius: '20px' }} onClick={SaveNote}>
23
- SAVE Details
21
+ <Button
22
+ style={{ borderRadius: '20px' }}
23
+ onClick={() => {}}
24
+ disabled={true}
25
+ >
26
+ Move Products
24
27
  </Button>
25
- {/* <NewReturnDropdown /> */}
28
+ <NewReturnDropdown />
26
29
  </SaveNoteContainer>
27
30
  </MidConatiner>
28
31
  </Container>
@@ -76,7 +76,12 @@ const ReturnProductTable = () => {
76
76
  <thead>
77
77
  <tr>
78
78
  <th className="emailInvoiceCheckbox">
79
- <Checkbox checked={selectAll} onChange={handleSelectAll} />
79
+ <Checkbox
80
+ checked={selectAll}
81
+ onChange={handleSelectAll}
82
+ disabled={true}
83
+ style={{ cursor: 'not-allowed' }}
84
+ />
80
85
  </th>
81
86
  <th>Location</th>
82
87
  <th>Sender</th>
@@ -96,6 +101,7 @@ const ReturnProductTable = () => {
96
101
  checked={selectedInvoices.some(
97
102
  selectedInvoice => selectedInvoice.id === invoice.id
98
103
  )}
104
+ style={{ cursor: 'not-allowed' }}
99
105
  />
100
106
  </td>
101
107
  <td>{'N/A'}</td>
package/src/index.tsx CHANGED
@@ -35,28 +35,18 @@ function ReturnClient() {
35
35
  const [, setActionType] = useActionType();
36
36
  const [, setLocationData] = useLocationData();
37
37
  const [, setStatusOfOrders] = useStatusOrderData();
38
- // const [, dispatch] = useAtom(filtersReducerAtom);
39
-
40
- console.log(selectedClientString, 'selectedClient');
41
- console.log(`../filter/:${selectedClientString}`);
42
38
 
43
39
  const splitPath = (str: any) => {
44
40
  const parts = str?.split('/')?.filter((part: any) => part !== ''); // Filter out empty parts
45
41
  return parts;
46
42
  };
47
43
  const paths = splitPath(location.pathname);
48
- console.log(paths, 'pathssssssssssssssssssssssssssss');
49
44
 
50
45
  useEffect(() => {
51
- console.log(
52
- paths[paths.length - 1],
53
- 'paths[paths.length] paths[paths.length]'
54
- );
55
46
  if (paths[paths.length - 1] === 'returnclient') {
56
47
  localStorage.removeItem('clientName');
57
48
  localStorage.removeItem('clientId');
58
49
  localStorage.removeItem('uuid');
59
- // dispatch({ type: 'CLEAR_CLIENT', payload: [] });
60
50
  }
61
51
  }, [location.pathname]);
62
52