@bjsdistribution/dms-client-return 0.1.49-prod → 0.1.50-prod

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 (26) hide show
  1. package/dist/components/order-view/northern-southern-info/CustomInput.d.ts +17 -0
  2. package/dist/components/order-view/northern-southern-info/index.d.ts +3 -0
  3. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +1 -0
  4. package/dist/components/order-view/types.d.ts +37 -0
  5. package/dist/components/order-view/utils.d.ts +24 -0
  6. package/dist/components/store.d.ts +1 -0
  7. package/dist/dms-client-return.cjs.development.js +1089 -616
  8. package/dist/dms-client-return.cjs.development.js.map +1 -1
  9. package/dist/dms-client-return.cjs.production.min.js +1 -1
  10. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  11. package/dist/dms-client-return.esm.js +1090 -617
  12. package/dist/dms-client-return.esm.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +30 -0
  15. package/src/components/order-view/index.tsx +67 -3
  16. package/src/components/order-view/northern-southern-info/CustomInput.tsx +80 -0
  17. package/src/components/order-view/northern-southern-info/index.tsx +94 -0
  18. package/src/components/order-view/order-details/expanded-content/customer-section/location-info/Postcode.tsx +170 -8
  19. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +53 -2
  20. package/src/components/order-view/order-details/expanded-content/index.tsx +13 -1
  21. package/src/components/order-view/products-info/collapsed-content/index.tsx +29 -0
  22. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +166 -43
  23. package/src/components/order-view/store.ts +20 -0
  24. package/src/components/order-view/types.ts +39 -0
  25. package/src/components/order-view/utils.ts +29 -0
  26. package/src/components/store.ts +4 -1
@@ -1,12 +1,31 @@
1
1
  import { SectionHeader } from '@bjsdistribution/dms-component-library';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
+ import { useProductDetails } from '../../store';
4
5
 
5
6
  function CollapsedContent() {
7
+ const [productsData] = useProductDetails();
8
+
9
+ const calculateTotal = (items: any[], field: 'cube' | 'weight') => {
10
+ return items
11
+ .reduce((total, item) => {
12
+ const val = parseFloat(item[field]);
13
+ return total + (isNaN(val) ? 0 : val);
14
+ }, 0)
15
+ .toFixed(2);
16
+ };
17
+
6
18
  return (
7
19
  <Container>
8
20
  <SectionHeader label="Products" />
9
21
  <Dimensions>Products to be Returned</Dimensions>
22
+
23
+ {productsData?.length > 0 && (
24
+ <Items style={{ display: 'flex' }}>
25
+ Total: {calculateTotal(productsData, 'weight')}KG /{' '}
26
+ {calculateTotal(productsData, 'cube')}m³
27
+ </Items>
28
+ )}
10
29
  </Container>
11
30
  );
12
31
  }
@@ -27,4 +46,14 @@ const Container = styled.div`
27
46
  gap: 30px;
28
47
  `;
29
48
 
49
+ const Items = styled.span`
50
+ font-family: 'Roboto', sans-serif;
51
+ font-size: 14px;
52
+ font-weight: 500;
53
+ line-height: 24px;
54
+ color: #8e8a85;
55
+ text-transform: capitalize;
56
+ color: #6a7378;
57
+ `;
58
+
30
59
  export default CollapsedContent;
@@ -12,10 +12,15 @@ import ActionIcon from '../../../../assets/icons/ActionIcon';
12
12
  import { useOrderId, useProductDetails } from '../../store';
13
13
  import { ApiResponse } from '../../types';
14
14
  import { Empty, notification, Skeleton } from 'antd';
15
- import { useNewReturnOrderData, useSelectedProducts } from '../../../store';
15
+ import {
16
+ useIsShowNorthSouth,
17
+ useNewReturnOrderData,
18
+ useSelectedProducts,
19
+ } from '../../../store';
16
20
  import styled from 'styled-components';
17
21
  import { NavLink } from 'react-router-dom';
18
22
  import { EmptyDataContainer } from '../../order-actions/actions/charge-log';
23
+ import CustomInput from '../../northern-southern-info/CustomInput';
19
24
 
20
25
  interface IPROS {
21
26
  callReturnProducts: any;
@@ -30,6 +35,7 @@ const ReturnProductTable = (props: IPROS) => {
30
35
  const [selectedRowId, setSelectedRowId] = useState<number | null>(null);
31
36
  const [orderId] = useOrderId();
32
37
  const [returnOrderData] = useNewReturnOrderData();
38
+ const [isNorthSouth] = useIsShowNorthSouth();
33
39
 
34
40
  // const handleActionClick = (id: number) => {
35
41
  // setSelectedRowId(id);
@@ -123,7 +129,6 @@ const ReturnProductTable = (props: IPROS) => {
123
129
 
124
130
  const disableCheckbox =
125
131
  productData?.length == 0 || returnOrderData?.length == 0;
126
-
127
132
  return (
128
133
  <div>
129
134
  <StyledTableWrapper id="tableScrolling" className="orderProductTable">
@@ -163,48 +168,108 @@ const ReturnProductTable = (props: IPROS) => {
163
168
  </tr>
164
169
  ) : (
165
170
  productData?.map((product: any) => (
166
- <tr key={product.id}>
167
- <td>
168
- <StyleCheckbox
169
- checked={selectedProducts?.includes(product?.id)}
170
- onChange={() => handleSelectProduct(product?.id)}
171
- disabled={disableCheckbox}
172
- />
173
- </td>
174
- <td>{product?.location || 'N/A'}</td>
175
- <td>
176
- <ul style={{ listStyleType: 'none', padding: 0 }}>
177
- <li
178
- style={{
179
- color: '#0099ff',
180
- fontWeight: 600,
181
- paddingLeft: 0,
182
- }}
171
+ <React.Fragment key={product.id}>
172
+ {/* MAIN ROW */}
173
+ <tr className="product-row">
174
+ <td>
175
+ <StyleCheckbox
176
+ checked={selectedProducts?.includes(product?.id)}
177
+ onChange={() => handleSelectProduct(product?.id)}
178
+ disabled={disableCheckbox}
179
+ />
180
+ </td>
181
+ <td>{product?.location || 'N/A'}</td>
182
+ <td>
183
+ <ul style={{ listStyleType: 'none', padding: 0 }}>
184
+ <li
185
+ style={{
186
+ color: '#0099ff',
187
+ fontWeight: 600,
188
+ }}
189
+ >
190
+ <NavLink to={`/orders/view/${product?.order_id}`}>
191
+ {displayValueOrNA(product?.recipient_name)}
192
+ </NavLink>
193
+ </li>
194
+ <li style={{ color: '#888075' }}>
195
+ {displayValueOrNA(product?.postcode)}
196
+ </li>
197
+ </ul>
198
+ </td>
199
+ <td>{product?.code}</td>
200
+ <td>{product?.description}</td>
201
+ <td>{product?.return_reason}</td>
202
+ <td>{product?.part}</td>
203
+ <td>
204
+ <div
205
+ onClick={() => deleteProduct(product?.id)}
206
+ style={{ cursor: 'pointer' }}
183
207
  >
184
- <NavLink to={`/orders/view/${product?.order_id}`}>
185
- {displayValueOrNA(product?.recipient_name)}
186
- </NavLink>
187
- </li>
188
- <li style={{ color: '#888075' }}>
189
- {displayValueOrNA(product?.postcode)}
190
- </li>
191
- </ul>
192
- </td>
193
- <td>{product?.code}</td>
194
- <td>{product?.description}</td>
195
- <td>{product?.return_reason}</td>
196
- <td>{product?.part}</td>
197
- <td>
198
- <div
199
- onClick={() => {
200
- deleteProduct(product?.id);
201
- }}
202
- style={{ cursor: 'pointer' }}
203
- >
204
- <ActionIcon />
205
- </div>
206
- </td>
207
- </tr>
208
+ <ActionIcon />
209
+ </div>
210
+ </td>
211
+ </tr>
212
+
213
+ {/* EXPANDED ROW */}
214
+ {isNorthSouth === true && (
215
+ <td colSpan={8}>
216
+ <NSWrapper>
217
+ <div className="left">Northern/Southern Ireland</div>
218
+ <div className="left-end"></div>
219
+
220
+ <div className="section">
221
+ <CustomInput
222
+ label="Commodity Code"
223
+ type="text"
224
+ direction="row"
225
+ placeholder="Enter Commodity Code"
226
+ value={
227
+ product?.product_customs_details
228
+ ?.commodity_code || 'NA'
229
+ }
230
+ disabled
231
+ />
232
+
233
+ <CustomInput
234
+ label="Country of Origin"
235
+ type="text"
236
+ direction="row"
237
+ placeholder="Enter Country of Origin"
238
+ value={
239
+ product?.product_customs_details
240
+ ?.country_of_origin || 'NA'
241
+ }
242
+ disabled
243
+ />
244
+
245
+ <CustomInput
246
+ label="Item Invoice Amount"
247
+ type="number"
248
+ direction="row"
249
+ placeholder="Enter Item Invoice Amount"
250
+ value={
251
+ product?.product_customs_details
252
+ ?.item_invoice_amount || 0
253
+ }
254
+ disabled
255
+ />
256
+
257
+ <CustomInput
258
+ label="NI Additional Info Codes"
259
+ type="text"
260
+ direction="row"
261
+ placeholder="Enter NI Add Info Codes"
262
+ value={
263
+ product?.product_customs_details
264
+ ?.ni_additional_information_codes || 'NA'
265
+ }
266
+ disabled
267
+ />
268
+ </div>
269
+ </NSWrapper>
270
+ </td>
271
+ )}
272
+ </React.Fragment>
208
273
  ))
209
274
  )}
210
275
  </tbody>
@@ -214,6 +279,64 @@ const ReturnProductTable = (props: IPROS) => {
214
279
  );
215
280
  };
216
281
 
282
+ export const NSWrapper = styled.div`
283
+ display: flex;
284
+ width: 100%;
285
+ padding: 5px 10px;
286
+ align-items: center;
287
+ gap: 10px;
288
+ // position: absolute;
289
+ // right: 84px;
290
+ // top: 181px;
291
+ border-radius: 6px;
292
+ border: 1px solid rgb(237, 235, 232);
293
+ background: rgb(248, 250, 252);
294
+ margin-bottom: 14px;
295
+
296
+ .left {
297
+ display: flex;
298
+ padding-right: 10px;
299
+ align-items: center;
300
+ gap: 5px;
301
+ align-self: stretch;
302
+ color: #3a3630;
303
+ font-feature-settings: 'liga' off, 'clig' off;
304
+ font-family: Roboto;
305
+ font-size: 13px;
306
+ font-style: normal;
307
+ font-weight: 500;
308
+ line-height: normal;
309
+ text-transform: uppercase;
310
+ }
311
+
312
+ .left-end {
313
+ display: flex;
314
+ padding-right: 10px;
315
+ align-items: center;
316
+ gap: 5px;
317
+ align-self: stretch;
318
+ border-right: 1px solid #e2e0db;
319
+ }
320
+
321
+ .section {
322
+ display: flex;
323
+ align-items: center;
324
+ gap: 30px;
325
+ flex: 1 0 0;
326
+
327
+ input {
328
+ display: flex;
329
+ height: 28px;
330
+ padding: 3px 10px;
331
+ align-items: center;
332
+ gap: 8px;
333
+ flex: 1 0 0;
334
+ border-radius: 30px;
335
+ border: 1px solid #ccc;
336
+ background: #fff;
337
+ }
338
+ }
339
+ `;
217
340
  const StyleCheckbox = styled(Checkbox)`
218
341
  &:disabled {
219
342
  background-color: gray;
@@ -34,6 +34,7 @@ const customerInfoAtom = atom<OrderRecipient>({
34
34
  });
35
35
 
36
36
  export const ordersInitialValue: OrdersType = {
37
+ order_locked_time: null,
37
38
  depot_id: null,
38
39
  gsit_order_id: null,
39
40
  customer_id: null,
@@ -119,6 +120,25 @@ export const ordersInitialValue: OrdersType = {
119
120
  take_packaging_away: false,
120
121
  collect_disposal: false,
121
122
  assembly_type: null,
123
+ route_id: null,
124
+ hold_untill: null,
125
+ hold_reason: null,
126
+
127
+ order_on_hold: {
128
+ order_id: null,
129
+ hold_indefinitely: null,
130
+ hold_until: null,
131
+ reason_id: null,
132
+ un_hold: null,
133
+ },
134
+
135
+ refused_service: [],
136
+ refused_service_reason: '',
137
+ invalid_order: null,
138
+ owner_name: null,
139
+ force_debrief_enabled: null,
140
+ import_reference: null,
141
+ labels: null,
122
142
  };
123
143
 
124
144
  export const orderProductInitialvalue: CreateProduct = {
@@ -133,6 +133,21 @@ export interface OrderRouteType {
133
133
  export interface orderType {
134
134
  type: string | null;
135
135
  }
136
+
137
+ export interface OrderCustomsDetails {
138
+ consignor_eori?: string | undefined;
139
+ consignee_country?: string | undefined;
140
+ commodity_code?: string | undefined;
141
+ country_of_origin?: string | undefined;
142
+ item_invoice_amount?: string | undefined;
143
+ procedure_code?: string | undefined;
144
+ ni_additional_information_codes?: string | undefined;
145
+ additional_procedure_code?: string | undefined;
146
+ additional_procedures?: string | undefined;
147
+ id?: number | null;
148
+ order_id?: number | null;
149
+ packaging_type?: string | undefined;
150
+ }
136
151
  export interface OrdersType {
137
152
  depot_id: number | null;
138
153
  gsit_order_id: number | null;
@@ -182,6 +197,30 @@ export interface OrdersType {
182
197
  collect_disposal: boolean;
183
198
  assembly_type: string | null;
184
199
  labels?: any;
200
+
201
+ route_id: any;
202
+ order_locked_time: string | null;
203
+ refused_service: any[];
204
+ refused_service_reason: string;
205
+ tomtom_status?: [];
206
+ carrier_name?: string;
207
+ sub_contracted_date?: string;
208
+ sub_contractor_transfer_id?: number;
209
+ hold_untill?: Date | null;
210
+ hold_reason?: null;
211
+ order_on_hold?: {
212
+ order_id: null;
213
+ hold_indefinitely: null;
214
+ hold_until: Date | null;
215
+ reason_id: null;
216
+ un_hold: Date | null;
217
+ };
218
+ invalid_order: boolean | null;
219
+ owner_name: string | null;
220
+ force_debrief_enabled: boolean | null;
221
+ order_customs_details?: OrderCustomsDetails;
222
+ show_customs_details?: false;
223
+ import_reference: string | null;
185
224
  }
186
225
 
187
226
  export type DeleteProds = {
@@ -335,3 +335,32 @@ export const compareOrderDetailsStates = (
335
335
  export const sanitizeInput = (value: string): string => {
336
336
  return value.trim() === '' ? '' : value;
337
337
  };
338
+ export const getEnvironment = ():
339
+ | 'development'
340
+ | 'release_us'
341
+ | 'release_uk'
342
+ | 'staging' => {
343
+ const projectEnv = process.env.REACT_APP_PROJECT_ENV;
344
+ const apiPath = process.env.REACT_APP_API_PATH;
345
+ console.log(projectEnv, 'projectEnv', apiPath, 'apiPath');
346
+ if (apiPath === 'https://us.dms.api.bjshomedelivery.com') {
347
+ return 'release_us';
348
+ }
349
+ if (apiPath === 'https://development.dms.api.bjshomedelivery.com') {
350
+ return 'development';
351
+ }
352
+ if (apiPath === 'https://staging.dms.api.bjshomedelivery.com') {
353
+ return 'staging';
354
+ }
355
+
356
+ if (projectEnv === 'release_uk') {
357
+ return 'release_uk';
358
+ }
359
+ if (projectEnv === 'release_us') {
360
+ return 'release_us';
361
+ }
362
+ if (projectEnv === 'staging') {
363
+ return 'staging';
364
+ }
365
+ return 'development';
366
+ };
@@ -161,7 +161,10 @@ const searchAfter = atom<any>('');
161
161
  export const useSearchAfterText = () => {
162
162
  return useAtom(searchAfter);
163
163
  };
164
-
164
+ const isShow = atom<any>(null);
165
+ export function useIsShowNorthSouth() {
166
+ return useAtom(isShow);
167
+ }
165
168
  const rclientReturnDataAtom = atom<any[]>([]);
166
169
  export function useClientOutstandingReturnData() {
167
170
  return useAtom(rclientReturnDataAtom);