@bjsdistribution/dms-client-return 0.0.12 → 0.0.13

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 (46) hide show
  1. package/dist/components/order-daily-overview/common/css/TableStyle.d.ts +13 -30
  2. package/dist/components/order-view/store.d.ts +77 -28
  3. package/dist/components/order-view/types.d.ts +61 -11
  4. package/dist/components/order-view/utils.d.ts +4 -0
  5. package/dist/dms-client-return.cjs.development.js +1543 -1011
  6. package/dist/dms-client-return.cjs.development.js.map +1 -1
  7. package/dist/dms-client-return.cjs.production.min.js +1 -1
  8. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  9. package/dist/dms-client-return.esm.js +1545 -1013
  10. package/dist/dms-client-return.esm.js.map +1 -1
  11. package/package.json +2 -2
  12. package/src/common/expand-collapse/index.tsx +4 -4
  13. package/src/components/order-daily-overview/common/css/TableStyle.tsx +42 -342
  14. package/src/components/order-daily-overview/index.tsx +2 -2
  15. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +2 -2
  16. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +2 -2
  17. package/src/components/order-daily-overview/return-order-table/return-orders-filters/returnstyles.ts +2 -2
  18. package/src/components/order-daily-overview/table/table-data/styles.ts +1 -1
  19. package/src/components/order-view/DynamicTable.tsx +12 -3
  20. package/src/components/order-view/flags-action-modal/Actions.tsx +1 -2
  21. package/src/components/order-view/general-information/Status.tsx +13 -17
  22. package/src/components/order-view/generic-table/AuditLogs.tsx +81 -19
  23. package/src/components/order-view/index.tsx +192 -192
  24. package/src/components/order-view/modalsPopup/ModalManager.tsx +2 -2
  25. package/src/components/order-view/modalsPopup/ProductAction.tsx +1 -1
  26. package/src/components/order-view/notes/AddNote.tsx +2 -3
  27. package/src/components/order-view/notes/index.tsx +9 -22
  28. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +90 -73
  29. package/src/components/order-view/order-details/expanded-content/instruction-section/DeliveryInstructions.tsx +2 -9
  30. package/src/components/order-view/order-details/expanded-content/orders-section/Droptime.tsx +2 -10
  31. package/src/components/order-view/order-details/expanded-content/orders-section/VehicleType.tsx +16 -15
  32. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +88 -15
  33. package/src/components/order-view/order-details/expanded-content/services-section/DeliveryPoint.tsx +1 -13
  34. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +141 -16
  35. package/src/components/order-view/order-details/expanded-content/services-section/ServiceType.tsx +1 -13
  36. package/src/components/order-view/order-details/expanded-content/services-section/TimedService.tsx +19 -18
  37. package/src/components/order-view/products-info/expanded-content/products/index.tsx +2 -2
  38. package/src/components/order-view/return-client-products/ProductTable.tsx +1 -1
  39. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +79 -70
  40. package/src/components/order-view/return-client-products/product-table-footer/ProductDetailsFooter.tsx +5 -5
  41. package/src/components/order-view/store.ts +215 -53
  42. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -10
  43. package/src/components/order-view/toolbox-resources/expanded-content/index.tsx +68 -6
  44. package/src/components/order-view/types.ts +89 -33
  45. package/src/components/order-view/utils.ts +20 -17
  46. package/src/index.tsx +13 -9
@@ -3,7 +3,7 @@ import { AntModal, useApiHook } from '@bjsdistribution/dms-component-library';
3
3
  import { useAtom } from 'jotai';
4
4
  import {
5
5
  countReducerAtom,
6
- selectedProductIdAtom,
6
+ letselectedProductIdAtom,
7
7
  selectedTabKeyAtom,
8
8
  useCreateOrderProducts,
9
9
  useDeleteProdsID,
@@ -39,7 +39,7 @@ const ModalManager = () => {
39
39
  const [selectedRows] = useDeleteProdsID();
40
40
  const [unRecieve, setUnRecieve] = useRecieveOrderProducts();
41
41
  const [updateOrderProduct, setUpdateOrderProduct] = useUpdateOrderProducts();
42
- const [selectedProductId] = useAtom(selectedProductIdAtom);
42
+ const [selectedProductId] = useAtom(letselectedProductIdAtom);
43
43
  const [selectedTab] = useAtom(selectedTabKeyAtom);
44
44
  const [, setIsFormValid] = useState(false);
45
45
  const [newGrouped, setNewGrouped] = useFinalPayload();
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { Tabs } from 'antd';
3
3
  import styled from 'styled-components';
4
4
  import { useAtom } from 'jotai';
5
- import { selectedTabKeyAtom } from '../store';
6
5
  import QCLogs from './qclogs';
7
6
  import UpdateProduct from './UpdateProducts';
8
7
  import UnReceiveProduct from './UnReceiveProduct';
8
+ import { selectedTabKeyAtom } from '../store';
9
9
 
10
10
  const ProductAction = () => {
11
11
  const [, setSelectedTabKey] = useAtom(selectedTabKeyAtom);
@@ -26,10 +26,8 @@ function AddNote() {
26
26
  const pathname = location.pathname;
27
27
  const orderIdLocaation = pathname.split('/')[1];
28
28
 
29
- // const [note, setNote] = useState('');
30
29
  const [, CallAPi] = useCallAPi();
31
30
  const ssoToken = getCookie('id_token');
32
-
33
31
  const [moduleIds] = usemoduleIds();
34
32
 
35
33
  // Save New Note
@@ -56,6 +54,7 @@ function AddNote() {
56
54
  action: 'create',
57
55
  description: noteText,
58
56
  data_dump: '{}',
57
+ manual: 1,
59
58
  },
60
59
  ],
61
60
  };
@@ -81,7 +80,7 @@ function AddNote() {
81
80
  });
82
81
  setNoteLoadingStore(true);
83
82
  setNoteText('');
84
- setNoteLoadingStore(false);
83
+ // setNoteLoadingStore(false);
85
84
  CallAPi(true);
86
85
  } else if (error) {
87
86
  // Error: Set error notification
@@ -4,6 +4,7 @@ import AddNote from './AddNote';
4
4
  import AuditLogs from './logs';
5
5
  import { useApiHook } from '@bjsdistribution/dms-component-library';
6
6
  import {
7
+ SeteauditLogToggle,
7
8
  useCallAPi,
8
9
  usegetNotes,
9
10
  usemoduleIds,
@@ -20,9 +21,7 @@ function Notes() {
20
21
  const [, setNoteLoadingStore] = UseNotesLoading();
21
22
  const [, setNotes] = usegetNotes();
22
23
  const [loderStatus] = useCallAPi();
23
-
24
- // Declare `allIds` state to store the comma-separated IDs
25
- // const [allIds, setAllIds] = useState<string | null>(null);
24
+ const [auditState] = SeteauditLogToggle();
26
25
 
27
26
  // Fetch module IDs
28
27
  const { data: fetchedData, loading: apiLoading } = useApiHook<{ data: any }>({
@@ -44,13 +43,6 @@ function Notes() {
44
43
  }))
45
44
  ) || [];
46
45
 
47
- // console.log(modules, 'modulesmodules');
48
-
49
- // const ids = modules?.map((module: any) => module.id).join(',');
50
- // setAllIds(ids);
51
-
52
- // console.log(ids, 'allIds');
53
-
54
46
  const orderNoteModule = modules?.find(
55
47
  (module: any) => module?.name === 'ORDER-NOTE'
56
48
  );
@@ -59,48 +51,43 @@ function Notes() {
59
51
  }
60
52
  }, [apiLoading, fetchedData]);
61
53
 
62
- // Fetch Notes Data when `allIds` is available
63
54
  const {
64
55
  data: NotesData,
65
56
  loading: NotesLoading,
66
57
  setShouldPerformAction,
67
58
  } = useApiHook<{ data: any }>({
68
- // Use `allIds` in the endpoint if it's set
69
59
  endpoint: `audit_logs/?module_id=${
70
60
  moduleIds?.parentId
71
- }&module_object_id=${orderId || orderIdLocaation}
72
- `,
61
+ }&module_object_id=${orderId || orderIdLocaation}`,
73
62
  method: 'GET',
74
63
  performAction: false,
75
64
  });
76
65
 
77
- // &sub_module_ids=${allIds}
78
-
79
66
  useEffect(() => {
80
67
  setNoteLoadingStore(true);
68
+
81
69
  if (moduleIds) {
82
- // Ensure `allIds` is set
83
- setShouldPerformAction(true);
70
+ setShouldPerformAction(auditState);
84
71
  }
85
72
  if (!NotesLoading && NotesData?.data) {
86
73
  const updatedData = NotesData?.data
87
- // .filter((item: any) => item['ORDER-NOTE'] || item['ORDER'])
88
- // .map((item: any) => [item['ORDER-NOTE'], item['ORDER']])
74
+ .filter((item: any) => item['ORDER-NOTE'] || item['ORDER'])
75
+ .map((item: any) => [item['ORDER-NOTE'], item['ORDER']])
89
76
  .flat()
90
77
  .filter(Boolean);
91
-
92
78
  const combinedArray = updatedData.flat();
93
79
  combinedArray.sort(
94
80
  (a: any, b: any) =>
95
81
  new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
96
82
  );
97
83
  setNotes(combinedArray);
84
+ setNotes(combinedArray);
98
85
  setNoteLoadingStore(NotesLoading);
99
86
  loderStatus
100
87
  ? setShouldPerformAction(true)
101
88
  : setShouldPerformAction(false);
102
89
  }
103
- }, [moduleIds, NotesLoading, loderStatus]); // Add `allIds` to dependencies
90
+ }, [moduleIds, NotesLoading, auditState]);
104
91
 
105
92
  return (
106
93
  <Container>
@@ -2,87 +2,108 @@ import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import AllowTracking from './AllowTracking';
4
4
  import { Button } from '@bjsdistribution/dms-component-library';
5
- // import {
6
- // useAtom,
7
- // useOrderDetails,
8
- // usePrevOrderDetails,
9
- // errorAtom,
10
- // } from '../../../store';
11
- // import useUpdateOrder from '../../../hooks/useUpdateOrder';
12
- // import { compareOrderDetailsStates, filterObject } from '../../../utils';
13
- // import { OrderServiceType } from '../../../types';
5
+ import {
6
+ useAtom,
7
+ useOrderDetails,
8
+ usePrevOrderDetails,
9
+ errorAtom,
10
+ useCustomerInfo,
11
+ useLogsCallAPi,
12
+ useApiCalling,
13
+ } from '../../../store';
14
+ import useUpdateOrder from '../../../hooks/useUpdateOrder';
15
+ import { compareOrderDetailsStates, filterObject } from '../../../utils';
16
+ import { OrderServiceType } from '../../../types';
14
17
 
15
18
  function OrderDetailsFooter() {
16
- // const [orderDetails, setOrderDetails] = useOrderDetails();
17
- // const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();
18
- // const updateOrder = useUpdateOrder();
19
- // const [errorState] = useAtom(errorAtom);
19
+ const [orderDetails, setOrderDetails] = useOrderDetails();
20
+ const [prevOrderDetails, setPrevOrderDetails] = usePrevOrderDetails();
21
+ const [, setCustomerInfo] = useCustomerInfo();
22
+ const updateOrder = useUpdateOrder();
23
+ const [errorState] = useAtom(errorAtom);
24
+ const [, setLogsCallAPi] = useLogsCallAPi();
25
+ const [, setCallApi] = useApiCalling(); //single detail
20
26
 
21
- // const errorFound = () => {
22
- // const isError =
23
- // errorState.w3wError.length > 0 || errorState.emailError.length > 0;
24
- // return isError;
25
- // };
27
+ const errorFound = () => {
28
+ const isError =
29
+ errorState.w3wError.length > 0 ||
30
+ errorState.emailError.length > 0 ||
31
+ errorState.homeContactError.length > 0 ||
32
+ errorState.workCOntanctError.length > 0 ||
33
+ errorState.mobileError.length > 0 ||
34
+ errorState.postCodeError.length > 0;
26
35
 
27
- // const isDifferent = () => {
28
- // const keysToRemovefromOrders = [
29
- // 'order_locked',
30
- // 'order_communications',
31
- // 'updated_at',
32
- // 'updated_by',
33
- // 'order_services',
34
- // ];
35
- // const filteredOrderDetails = filterObject(
36
- // orderDetails,
37
- // keysToRemovefromOrders
38
- // );
39
- // const filteredPrevOrderDetails = filterObject(
40
- // prevOrderDetails,
41
- // keysToRemovefromOrders
42
- // );
36
+ return isError;
37
+ };
38
+
39
+ const isDifferent = () => {
40
+ const keysToRemovefromOrders = [
41
+ 'order_locked',
42
+ 'order_communications',
43
+ 'updated_at',
44
+ 'updated_by',
45
+ 'order_services',
46
+ ];
47
+ const filteredOrderDetails = filterObject(
48
+ orderDetails,
49
+ keysToRemovefromOrders
50
+ );
51
+ const filteredPrevOrderDetails = filterObject(
52
+ prevOrderDetails,
53
+ keysToRemovefromOrders
54
+ );
43
55
 
44
- // const newOrderServices =
45
- // orderDetails?.order_services?.length > 0 &&
46
- // orderDetails.order_services.sort(
47
- // (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
48
- // );
56
+ const newOrderServices =
57
+ orderDetails?.order_services?.length > 0 &&
58
+ orderDetails.order_services.sort(
59
+ (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
60
+ );
49
61
 
50
- // const prevOrderServices =
51
- // prevOrderDetails?.order_services?.length > 0 &&
52
- // prevOrderDetails.order_services.sort(
53
- // (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
54
- // );
62
+ const prevOrderServices =
63
+ prevOrderDetails?.order_services?.length > 0 &&
64
+ prevOrderDetails.order_services.sort(
65
+ (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
66
+ );
55
67
 
56
- // const newOrderServicesSorted = JSON.stringify(newOrderServices);
57
- // const prevOrderServicesSorted = JSON.stringify(prevOrderServices);
58
- // const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
59
- // const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
60
- // const isSame =
61
- // orderDetailsSorted === prevOrderDetailsSorted &&
62
- // newOrderServicesSorted === prevOrderServicesSorted;
63
- // return !isSame;
64
- // };
68
+ const newOrderServicesSorted = JSON.stringify(newOrderServices);
69
+ const prevOrderServicesSorted = JSON.stringify(prevOrderServices);
70
+ const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
71
+ const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
72
+ const isSame =
73
+ orderDetailsSorted === prevOrderDetailsSorted &&
74
+ newOrderServicesSorted === prevOrderServicesSorted;
75
+ return !isSame;
76
+ };
65
77
 
66
- // const onSave = async () => {
67
- // const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
68
- // const response = await updateOrder([payload]);
78
+ const onSave = async () => {
79
+ const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
80
+ const response = await updateOrder([payload]);
69
81
 
70
- // if (response && response.data) {
71
- // setOrderDetails(response.data[0]);
72
- // setPrevOrderDetails(response.data[0]);
73
- // }
74
- // };
75
- const onSave = () => {
76
- console.log('save');
82
+ setLogsCallAPi(prev => !prev);
83
+ setCallApi(false);
84
+
85
+ if (response && response?.data?.length > 0) {
86
+ setOrderDetails(response?.data[0]);
87
+ setPrevOrderDetails(response?.data[0]);
88
+ setCustomerInfo({
89
+ recipient_name: response?.data[0]?.order_recipient?.recipient_name,
90
+ postcode: response?.data[0]?.order_recipient?.postcode,
91
+ });
92
+ setTimeout(() => {
93
+ setLogsCallAPi(true);
94
+ setCallApi(true);
95
+ }, 2000);
96
+ } else {
97
+ setLogsCallAPi(false);
98
+ setCallApi(false);
99
+ setOrderDetails(prevOrderDetails);
100
+ }
77
101
  };
102
+
78
103
  return (
79
104
  <Container>
80
105
  <AllowTracking />
81
- <Button
82
- style={{ borderRadius: '20px' }}
83
- onClick={onSave}
84
- // disabled={!isDifferent() || errorFound()}
85
- >
106
+ <Button onClick={onSave} disabled={!isDifferent() || errorFound()}>
86
107
  Save Details
87
108
  </Button>
88
109
  </Container>
@@ -96,12 +117,8 @@ const Container = styled.div`
96
117
  align-items: flex-start;
97
118
  border-top: 1px solid #edebe8;
98
119
  background: #f8fafc;
99
- /* margin: 0px -15px -15px -15px; */
120
+ margin: 0px -15px -15px -15px;
100
121
  border-radius: 0px 0px 8px 8px;
101
- /* margin-bottom: 22px; */
102
- position: relative;
103
- align-items: center;
104
- /* top: 21px; */
105
122
  `;
106
123
 
107
124
  export default OrderDetailsFooter;
@@ -5,19 +5,12 @@ import { useOrderDetails } from '../../../store';
5
5
 
6
6
  function DeliveryInstructions() {
7
7
  const [orderDetails, setOrderDetails] = useOrderDetails();
8
- const orderRoutes = orderDetails?.order_routes;
9
8
 
10
9
  const onChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
11
- const val = e.target.value;
12
- const updatedOrderRoutes = {
13
- ...(orderRoutes === null
14
- ? { delivery_instructions: val }
15
- : { ...orderRoutes, delivery_instructions: val }),
16
- };
17
10
  setOrderDetails(prev => {
18
11
  return {
19
12
  ...prev,
20
- order_routes: updatedOrderRoutes,
13
+ delivery_instructions: e.target.value,
21
14
  };
22
15
  });
23
16
  };
@@ -26,7 +19,7 @@ function DeliveryInstructions() {
26
19
  <Container>
27
20
  <Label label="Delivery Instructions" />
28
21
  <CustomTextArea
29
- value={orderRoutes?.delivery_instructions || ''}
22
+ value={orderDetails?.delivery_instructions || ''}
30
23
  placeholder="add delivery instructions"
31
24
  onChange={onChange}
32
25
  />
@@ -6,19 +6,12 @@ import { handleKeyDown } from '../../../utils';
6
6
 
7
7
  function Droptime() {
8
8
  const [orderDetails, setOrderDetails] = useOrderDetails();
9
- const orderRoutes = orderDetails?.order_routes;
10
9
 
11
10
  const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
12
- const val = parseFloat(e.target.value);
13
- const updatedOrderRoutes = {
14
- ...(orderRoutes === null
15
- ? { drop_time: val }
16
- : { ...orderRoutes, drop_time: val }),
17
- };
18
11
  setOrderDetails(prev => {
19
12
  return {
20
13
  ...prev,
21
- order_routes: updatedOrderRoutes,
14
+ drop_time: e.target.value,
22
15
  };
23
16
  });
24
17
  };
@@ -31,7 +24,7 @@ function Droptime() {
31
24
  type="number"
32
25
  placeholder="0"
33
26
  onKeyDown={handleKeyDown}
34
- value={orderRoutes?.drop_time}
27
+ value={orderDetails?.drop_time || ''}
35
28
  onChange={onChange}
36
29
  />
37
30
  </Container>
@@ -39,7 +32,6 @@ function Droptime() {
39
32
  }
40
33
 
41
34
  const CustomInput = styled(Input)`
42
- border-radius: 25px;
43
35
  &::-webkit-outer-spin-button,
44
36
  &::-webkit-inner-spin-button {
45
37
  -webkit-appearance: none;
@@ -1,13 +1,20 @@
1
- import {
2
- Label,
3
- SelectDropdown,
4
- dropdownStyles,
5
- } from '@bjsdistribution/dms-component-library';
1
+ import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';
6
2
  import React from 'react';
7
3
  import styled from 'styled-components';
8
4
  import { vehicleTypeOptions } from '../../helper';
5
+ import { useOrderDetails } from '../../../store';
9
6
 
10
7
  function VehicleTypeDropdown() {
8
+ const [orderDetails, setOrderDetails] = useOrderDetails();
9
+ const onChange = (e: any) => {
10
+ setOrderDetails(prev => {
11
+ return {
12
+ ...prev,
13
+ vehicle_type: e.label,
14
+ };
15
+ });
16
+ };
17
+
11
18
  return (
12
19
  <FormContainer>
13
20
  <Label label="Vehicle Type" htmlFor="vehicleType" />
@@ -16,16 +23,10 @@ function VehicleTypeDropdown() {
16
23
  options={vehicleTypeOptions}
17
24
  inputId="vehicleType"
18
25
  openMenuOnFocus
19
- isDisabled={true}
20
- value={vehicleTypeOptions[1]}
21
- styles={{
22
- ...dropdownStyles,
23
- control: styles => ({
24
- ...styles,
25
- borderRadius: '25px',
26
- cursor: 'pointer',
27
- }),
28
- }}
26
+ value={vehicleTypeOptions?.filter(
27
+ (x: any) => x.label === orderDetails?.vehicle_type
28
+ )}
29
+ onChange={onChange}
29
30
  />
30
31
  </FormContainer>
31
32
  );
@@ -9,16 +9,21 @@ function AssemblyType() {
9
9
  const [orderStaticData] = useOrderStaticData();
10
10
  const orderServices = orderData?.order_services;
11
11
  const cloneServices = [...orderServices];
12
-
13
12
  const assembleOrderService = orderStaticData?.order_service_list?.find(
14
13
  (x: any) => x?.type?.toLowerCase() === 'assemble'
15
14
  );
16
-
15
+ const disassembleOrderService = orderStaticData?.order_service_list?.find(
16
+ (x: any) => x?.type?.toLowerCase() === 'disassemble'
17
+ );
17
18
  const assemblyTypeService = cloneServices?.find(
18
19
  (x: any) => x?.order_service_list_id === assembleOrderService?.id
19
20
  );
20
- const assemblyTypeId = assemblyTypeService?.service_category_id;
21
-
21
+ const disassemblyTypeService = cloneServices?.find(
22
+ (x: any) => x?.order_service_list_id === disassembleOrderService?.id
23
+ );
24
+ const assemblyTypeId =
25
+ assemblyTypeService?.service_category_id ||
26
+ disassemblyTypeService?.service_category_id;
22
27
  const assemblyTypeOptions = orderStaticData?.order_service_list_category?.map(
23
28
  (option: any) => ({
24
29
  label: capitalize(option.type.replaceAll('_', ' ')),
@@ -27,30 +32,98 @@ function AssemblyType() {
27
32
  );
28
33
 
29
34
  const radioGroupHandler = (event: React.ChangeEvent<HTMLInputElement>) => {
30
- const updatedAssemblyTypeService = {
31
- ...assemblyTypeService!,
32
- service_category_id: +event.target.value,
33
- };
35
+ let updatedAssemblyTypeService = {};
36
+
37
+ let updatedDisassemblyTypeService = {};
34
38
 
35
- const updatedOrderServices = cloneServices?.filter(
36
- s => s?.order_service_list_id !== assembleOrderService?.id
37
- );
39
+ let updatedOrderServices: any = [];
38
40
 
39
- updatedOrderServices.push(updatedAssemblyTypeService);
41
+ if (
42
+ (assemblyTypeService?.is_deleted === false &&
43
+ disassemblyTypeService?.is_deleted === true &&
44
+ disassemblyTypeService !== undefined &&
45
+ disassemblyTypeService !== null) ||
46
+ (disassemblyTypeService?.is_deleted === false &&
47
+ assemblyTypeService?.is_deleted === true &&
48
+ assemblyTypeService !== undefined &&
49
+ assemblyTypeService !== null) ||
50
+ (assemblyTypeService?.is_deleted === false &&
51
+ disassemblyTypeService?.is_deleted === false)
52
+ ) {
53
+ updatedAssemblyTypeService = {
54
+ ...assemblyTypeService!,
55
+ service_category_id: +event.target.value,
56
+ };
57
+ updatedDisassemblyTypeService = {
58
+ ...disassemblyTypeService!,
59
+ service_category_id: +event.target.value,
60
+ };
61
+ updatedOrderServices = cloneServices?.filter(
62
+ s =>
63
+ s?.order_service_list_id !== assembleOrderService?.id &&
64
+ s?.order_service_list_id !== disassembleOrderService?.id
65
+ );
66
+ updatedOrderServices.push(updatedAssemblyTypeService);
67
+ updatedOrderServices.push(updatedDisassemblyTypeService);
68
+ } else if (
69
+ assemblyTypeService?.is_deleted === false &&
70
+ (disassemblyTypeService?.is_deleted === true ||
71
+ disassemblyTypeService === undefined ||
72
+ disassemblyTypeService === null)
73
+ ) {
74
+ updatedAssemblyTypeService = {
75
+ ...assemblyTypeService!,
76
+ service_category_id: +event.target.value,
77
+ };
78
+ updatedOrderServices = cloneServices?.filter(
79
+ s => s?.order_service_list_id !== assembleOrderService?.id
80
+ );
81
+ updatedOrderServices.push(updatedAssemblyTypeService);
82
+ } else {
83
+ updatedDisassemblyTypeService = {
84
+ ...disassemblyTypeService!,
85
+ service_category_id: +event.target.value,
86
+ };
87
+ updatedOrderServices = cloneServices?.filter(
88
+ s => s?.order_service_list_id !== disassembleOrderService?.id
89
+ );
90
+
91
+ updatedOrderServices.push(updatedDisassemblyTypeService);
92
+ }
40
93
  const newData = { ...orderData, order_services: updatedOrderServices };
41
94
  setOrderData(newData);
42
95
  };
43
96
 
97
+ const isServiceDisable = () => {
98
+ if (
99
+ (assemblyTypeService?.is_deleted === true &&
100
+ (disassemblyTypeService?.is_deleted === true ||
101
+ disassemblyTypeService === undefined ||
102
+ disassemblyTypeService === null)) ||
103
+ (disassemblyTypeService?.is_deleted === true &&
104
+ (assemblyTypeService?.is_deleted === true ||
105
+ assemblyTypeService === undefined ||
106
+ assemblyTypeService === null)) ||
107
+ (assemblyTypeService === undefined &&
108
+ disassemblyTypeService === undefined) ||
109
+ (assemblyTypeService === null && disassemblyTypeService === null)
110
+ ) {
111
+ return true;
112
+ } else {
113
+ return false;
114
+ }
115
+ };
116
+
44
117
  return (
45
- <Container
46
- $isDisable={assemblyTypeService?.is_deleted === true ? true : false}
47
- >
118
+ <Container $isDisable={isServiceDisable()}>
48
119
  <RadioButtonGroup
49
120
  selectedValue={assemblyTypeId?.toString() || ''}
50
121
  heading="Assembly Type"
51
122
  options={assemblyTypeOptions || []}
52
123
  onChange={radioGroupHandler}
53
124
  required={false}
125
+ //@ts-ignore
126
+ isDisabled={isServiceDisable()}
54
127
  />
55
128
  </Container>
56
129
  );
@@ -1,9 +1,5 @@
1
1
  import React from 'react';
2
- import {
3
- Label,
4
- SelectDropdown,
5
- dropdownStyles,
6
- } from '@bjsdistribution/dms-component-library';
2
+ import { Label, SelectDropdown } from '@bjsdistribution/dms-component-library';
7
3
  import { useOrderDetails, useOrderStaticData } from '../../../store';
8
4
  import styled from 'styled-components';
9
5
  import { capitalize } from '../../../utils';
@@ -42,14 +38,6 @@ function DeliveryPointDropdown() {
42
38
  )}
43
39
  openMenuOnFocus
44
40
  onChange={onChange}
45
- styles={{
46
- ...dropdownStyles,
47
- control: styles => ({
48
- ...styles,
49
- borderRadius: '25px',
50
- cursor: 'pointer',
51
- }),
52
- }}
53
41
  />
54
42
  </Container>
55
43
  );