@bjsdistribution/dms-client-return 0.1.9-prod → 0.1.10-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 (135) hide show
  1. package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
  2. package/dist/components/client-portal/ReturnAfterSearchBar.d.ts +4 -0
  3. package/dist/components/client-portal/ReturnOverview.d.ts +3 -0
  4. package/dist/components/client-portal/ReturnRTFilters.d.ts +5 -0
  5. package/dist/components/client-portal/ReturnSearchBar.d.ts +4 -0
  6. package/dist/components/client-portal/ReturnStatus.d.ts +8 -0
  7. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  8. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  9. package/dist/components/order-daily-overview/common/fakedata.d.ts +1 -0
  10. package/dist/components/order-daily-overview/header/route-header/RouterHeader.d.ts +1 -0
  11. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  12. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  13. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  14. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  15. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  16. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  17. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  18. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  41. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  42. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  43. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  44. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  45. package/dist/components/order-view/products-info/expanded-content/index.d.ts +4 -1
  46. package/dist/components/order-view/return-client-products/ProductTable.d.ts +4 -1
  47. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +4 -1
  48. package/dist/components/order-view/store.d.ts +14 -2
  49. package/dist/components/order-view/types.d.ts +49 -1
  50. package/dist/components/order-view/utils.d.ts +3 -0
  51. package/dist/components/store.d.ts +12 -1
  52. package/dist/components/utils.d.ts +1 -0
  53. package/dist/dms-client-return.cjs.development.js +7053 -2711
  54. package/dist/dms-client-return.cjs.development.js.map +1 -1
  55. package/dist/dms-client-return.cjs.production.min.js +1 -1
  56. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  57. package/dist/dms-client-return.esm.js +7111 -2769
  58. package/dist/dms-client-return.esm.js.map +1 -1
  59. package/package.json +6 -4
  60. package/src/assets/icons/ActionIcon.tsx +1 -1
  61. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  62. package/src/components/client-portal/OutstandingTable.tsx +412 -0
  63. package/src/components/client-portal/ReturnAfterSearchBar.tsx +242 -0
  64. package/src/components/client-portal/ReturnOverview.tsx +185 -0
  65. package/src/components/client-portal/ReturnRTFilters.tsx +228 -0
  66. package/src/components/client-portal/ReturnSearchBar.tsx +294 -0
  67. package/src/components/client-portal/ReturnStatus.tsx +252 -0
  68. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +235 -0
  69. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +404 -0
  70. package/src/components/order-daily-overview/common/fakedata.tsx +18 -0
  71. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +130 -1
  72. package/src/components/order-daily-overview/header-filters/HeaderFilter.tsx +15 -3
  73. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +100 -70
  74. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +4 -0
  75. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +86 -0
  76. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  77. package/src/components/order-daily-overview/return-after-table/table-filters/TableFilters.tsx +22 -1
  78. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnFilter.tsx +34 -6
  79. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +24 -11
  80. package/src/components/order-daily-overview/return-order-table/return-orders-filters/RightFilters.tsx +26 -6
  81. package/src/components/order-daily-overview/shared/elements/PrintDropDown.tsx +5 -3
  82. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +5 -0
  83. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  84. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  85. package/src/components/order-view/index.tsx +45 -0
  86. package/src/components/order-view/notes/AddNote.tsx +94 -65
  87. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  88. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  89. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  90. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  91. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  92. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -6
  93. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +2 -2
  94. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  95. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +620 -0
  96. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  97. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  98. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  99. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  100. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  101. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  102. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  103. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  104. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  105. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  106. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  107. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  108. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  109. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  110. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  111. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +201 -0
  112. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  113. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  114. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  115. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  116. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  121. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  122. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  123. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  124. package/src/components/order-view/order-actions/index.tsx +15 -3
  125. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  126. package/src/components/order-view/products-info/expanded-content/index.tsx +27 -11
  127. package/src/components/order-view/products-info/index.tsx +4 -4
  128. package/src/components/order-view/return-client-products/ProductTable.tsx +6 -2
  129. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +54 -15
  130. package/src/components/order-view/store.ts +106 -0
  131. package/src/components/order-view/types.ts +54 -1
  132. package/src/components/order-view/utils.ts +37 -0
  133. package/src/components/store.ts +62 -1
  134. package/src/components/utils.ts +13 -3
  135. package/src/index.tsx +26 -16
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import SwitchSelector from 'react-switch-selector';
4
+ import { notification } from 'antd';
5
+
6
+ interface ForceDebriefSelectorProps {
7
+ onSwitchChange: (newValue: string) => void;
8
+ }
9
+
10
+ export const Options = [
11
+ {
12
+ label: 'Success',
13
+ value: 'success',
14
+ selectedBackgroundColor: '#57DB7A',
15
+ },
16
+ {
17
+ label: 'Failure',
18
+ value: 'failure',
19
+ selectedBackgroundColor: '#E95252',
20
+ },
21
+ ];
22
+
23
+ const ForceDebriefSelector: React.FC<ForceDebriefSelectorProps> = ({
24
+ onSwitchChange,
25
+ }) => {
26
+ const initialSelectedIndex = Options?.findIndex(
27
+ ({ value }) => value === 'success'
28
+ );
29
+
30
+ const handleSwitchChange = (selectedOptionValue: unknown) => {
31
+ if (typeof selectedOptionValue === 'string') {
32
+ onSwitchChange(selectedOptionValue);
33
+ } else {
34
+ notification.error({
35
+ message: 'Error',
36
+ description:
37
+ typeof selectedOptionValue ||
38
+ 'Unexpected type for selectedOptionValue:',
39
+ });
40
+ }
41
+ };
42
+
43
+ return (
44
+ <StyledSwitch>
45
+ <SwitchSelector
46
+ onChange={handleSwitchChange}
47
+ options={Options}
48
+ initialSelectedIndex={initialSelectedIndex}
49
+ backgroundColor={'#cbc8c2'}
50
+ fontColor={'#f5f6fa'}
51
+ optionBorderRadius={30}
52
+ />
53
+ </StyledSwitch>
54
+ );
55
+ };
56
+
57
+ const StyledSwitch = styled.div`
58
+ width: 25%;
59
+ height: 40px;
60
+ .react-switch-selector-wrapper {
61
+ background: #777777;
62
+ }
63
+ `;
64
+
65
+ export default ForceDebriefSelector;
@@ -0,0 +1,94 @@
1
+ import React, { useState } from 'react';
2
+ import {
3
+ Container,
4
+ CurrencySymbol,
5
+ FieldRow,
6
+ Input,
7
+ MainContainer,
8
+ Title,
9
+ } from '../../styles';
10
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
11
+ import { useChargesState } from '../../../../../store';
12
+
13
+ function AdhocSection() {
14
+ const [charges, setCharges] = useChargesState();
15
+ const [inputValues, setInputValues] = useState<any>(charges?.adhoc_charges);
16
+ const baseUrlSymbol = getBaseUrlSymbol();
17
+
18
+ const handleLabelChange = (id: string, newLabel: string) => {
19
+ setCharges(prev => ({
20
+ ...prev,
21
+ adhoc_charges: prev.adhoc_charges.map(charge =>
22
+ charge.id === id
23
+ ? { ...charge, adhoc_charges_description: newLabel }
24
+ : charge
25
+ ),
26
+ }));
27
+ };
28
+
29
+ const handleValueChange = (id: string, value: string) => {
30
+ setInputValues((prev: any) => ({
31
+ ...prev,
32
+ [id]: value,
33
+ }));
34
+ let val = parseFloat(value);
35
+ if (value === '') {
36
+ setCharges(prev => ({
37
+ ...prev,
38
+ adhoc_charges: prev.adhoc_charges.map(charge =>
39
+ charge.id === id ? { ...charge, adhoc_charges: 0 } : charge
40
+ ),
41
+ }));
42
+ } else if (!isNaN(val)) {
43
+ val = val >= 0 ? val : 0;
44
+ setCharges(prev => ({
45
+ ...prev,
46
+ adhoc_charges: prev.adhoc_charges.map(charge =>
47
+ charge.id === id ? { ...charge, adhoc_charges: val } : charge
48
+ ),
49
+ }));
50
+ }
51
+ };
52
+
53
+ return (
54
+ <MainContainer>
55
+ <Title>Adhoc</Title>
56
+ <Container>
57
+ {charges?.adhoc_charges?.map(item => {
58
+ return (
59
+ <FieldRow key={item.id}>
60
+ <Input
61
+ placeholder=""
62
+ value={item.adhoc_charges_description}
63
+ onChange={(e: any) =>
64
+ handleLabelChange(item.id, e.target.value)
65
+ }
66
+ style={{ marginRight: '8px', flex: 1 }}
67
+ />
68
+ <div
69
+ style={{ display: 'flex', gap: '3px', alignItems: 'center' }}
70
+ >
71
+ <CurrencySymbol>{baseUrlSymbol}</CurrencySymbol>
72
+ <Input
73
+ type="number"
74
+ min={0}
75
+ max={10000}
76
+ placeholder="0.00"
77
+ onWheel={(e: any) => e.target.blur()}
78
+ value={inputValues[item.id] ?? ''}
79
+ onChange={(e: any) =>
80
+ handleValueChange(item.id, e.target.value)
81
+ }
82
+ style={{ flex: 1 }}
83
+ onKeyDown={handleKeyDownDebrief}
84
+ />
85
+ </div>
86
+ </FieldRow>
87
+ );
88
+ })}
89
+ </Container>
90
+ </MainContainer>
91
+ );
92
+ }
93
+
94
+ export default AdhocSection;
@@ -0,0 +1,106 @@
1
+ import React from 'react';
2
+ import {
3
+ // Container,
4
+ FieldRow,
5
+ Input,
6
+ Label,
7
+ MainContainer,
8
+ Title,
9
+ } from '../../styles';
10
+ import { AntSelect } from '@bjsdistribution/dms-component-library';
11
+ import styled from 'styled-components';
12
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
13
+ import { useChargesState } from '../../../../../store';
14
+ import { ChargesType } from '../../../../../types';
15
+
16
+ interface IProps {
17
+ inputValue: Record<string, string>;
18
+ setInputValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
19
+ staticData: any;
20
+ }
21
+
22
+ function BaseCharges(props: IProps) {
23
+ const [chargesState, setCharges] = useChargesState();
24
+ const baseUrlSymbol = getBaseUrlSymbol();
25
+
26
+ // const [inputValue, setInputValue] = useState<Record<string, string>>({});
27
+ const handleChange = (field: string, value: string) => {
28
+ props?.setInputValue((prev: any) => ({
29
+ ...prev,
30
+ [field]: value,
31
+ }));
32
+ let val = parseFloat(value);
33
+ if (value === '') {
34
+ setCharges(prev => ({
35
+ ...prev,
36
+ [field]: 0,
37
+ }));
38
+ } else if (!isNaN(val)) {
39
+ val = val >= 0 ? val : 0;
40
+ setCharges(prev => ({
41
+ ...prev,
42
+ [field]: val,
43
+ }));
44
+ }
45
+ };
46
+
47
+ const onChange = (val: string) => {
48
+ setCharges((charge: ChargesType) => ({
49
+ ...charge,
50
+ base_charge_type: +val,
51
+ }));
52
+ };
53
+
54
+ const baseChargeOptions = props?.staticData?.base_charges?.map((x: any) => {
55
+ return {
56
+ label: x?.type,
57
+ value: x?.id,
58
+ };
59
+ });
60
+
61
+ return (
62
+ <MainContainer>
63
+ <Title>Base Charge</Title>
64
+ <Wrapper>
65
+ <FieldRow>
66
+ <Label style={{ width: '90px' }}>Base Charge</Label>
67
+ <div style={{ display: 'flex', gap: '3px', alignItems: 'center' }}>
68
+ <AntSelect
69
+ onChange={onChange}
70
+ options={baseChargeOptions || []}
71
+ placeholder="Base charge type"
72
+ defaultValue={baseChargeOptions?.filter(
73
+ (x: any) => x?.value === chargesState?.base_charge_type
74
+ )}
75
+ style={{ width: 100 }}
76
+ />
77
+ <CurrencyWrapper>{baseUrlSymbol}</CurrencyWrapper>
78
+ <Input
79
+ min={0}
80
+ max={10000}
81
+ type="number"
82
+ placeholder="0.00"
83
+ onWheel={(e: any) => e.target.blur()}
84
+ value={props?.inputValue['base_charge'] ?? ''}
85
+ onChange={(e: any) => handleChange('base_charge', e.target.value)}
86
+ onKeyDown={handleKeyDownDebrief}
87
+ />
88
+ </div>
89
+ </FieldRow>
90
+ </Wrapper>
91
+ </MainContainer>
92
+ );
93
+ }
94
+
95
+ const Wrapper = styled.div`
96
+ display: flex;
97
+ justify-content: space-between;
98
+ `;
99
+
100
+ const CurrencyWrapper = styled.div`
101
+ display: flex;
102
+ align-items: center;
103
+ color: #999;
104
+ `;
105
+
106
+ export default BaseCharges;
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import {
3
+ Container,
4
+ CurrencySymbol,
5
+ FieldRow,
6
+ Input,
7
+ Label,
8
+ MainContainer,
9
+ Title,
10
+ } from '../../styles';
11
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
12
+ import { useChargesState } from '../../../../../store';
13
+
14
+ const fields = [
15
+ { label: 'Repackage', value: 're_package' },
16
+ { label: 'Disassemble', value: 'disassemble' },
17
+ { label: 'QC', value: 'collection_qc' },
18
+ { label: 'Return to Client', value: 'return_to_client' },
19
+ ];
20
+
21
+ interface IProps {
22
+ inputValue: Record<string, string>;
23
+ setInputValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
24
+ }
25
+
26
+ function CollectionAddOns(props: IProps) {
27
+ const [, setCharges] = useChargesState();
28
+ const baseUrlSymbol = getBaseUrlSymbol();
29
+
30
+ const handleChange = (field: string, value: string) => {
31
+ props?.setInputValue((prev: any) => ({
32
+ ...prev,
33
+ [field]: value,
34
+ }));
35
+ let val = parseFloat(value);
36
+ if (isNaN(val)) {
37
+ setCharges(prev => ({
38
+ ...prev,
39
+ [field]: 0,
40
+ }));
41
+ } else {
42
+ val = val >= 0 ? val : 0;
43
+ setCharges(prev => ({
44
+ ...prev,
45
+ [field]: val,
46
+ }));
47
+ }
48
+ };
49
+
50
+ return (
51
+ <MainContainer>
52
+ <Title>Collection Add-Ons</Title>
53
+ <Container>
54
+ {fields.map((item: any) => (
55
+ <FieldRow key={item.value}>
56
+ <Label>{item.label}</Label>
57
+ <div style={{ display: 'flex', gap: '3px', alignItems: 'center' }}>
58
+ <CurrencySymbol>{baseUrlSymbol}</CurrencySymbol>
59
+ <Input
60
+ min={0}
61
+ max={10000}
62
+ type="number"
63
+ placeholder="0.00"
64
+ onWheel={(e: any) => e.target.blur()}
65
+ value={props?.inputValue[item.value] ?? ''}
66
+ onChange={(e: any) => handleChange(item.value, e.target.value)}
67
+ onKeyDown={handleKeyDownDebrief}
68
+ />
69
+ </div>
70
+ </FieldRow>
71
+ ))}
72
+ </Container>
73
+ </MainContainer>
74
+ );
75
+ }
76
+
77
+ export default CollectionAddOns;
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+ import {
3
+ Container,
4
+ CurrencySymbol,
5
+ FieldRow,
6
+ Input,
7
+ Label,
8
+ MainContainer,
9
+ Title,
10
+ } from '../../styles';
11
+
12
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
13
+ import { useChargesState } from '../../../../../store';
14
+
15
+ const fields = ['ROC', 'Unpack', 'Packaging Disposal', 'Assembly', 'QC'];
16
+
17
+ interface IProps {
18
+ inputValue: Record<string, string>;
19
+ setInputValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
20
+ }
21
+
22
+ function DeliveryAddOns(props: IProps) {
23
+ const [, setCharges] = useChargesState();
24
+ const baseUrlSymbol = getBaseUrlSymbol();
25
+
26
+ const fieldsInLabelValueFormat = fields.map(field => ({
27
+ label: field,
28
+ value: field.toLowerCase().replace(/ /g, '_'), // You can adjust this to your preference
29
+ }));
30
+
31
+ const handleChange = (field: string, value: string) => {
32
+ props?.setInputValue((prev: any) => ({
33
+ ...prev,
34
+ [field]: value,
35
+ }));
36
+ let val = parseFloat(value);
37
+ if (isNaN(val)) {
38
+ setCharges(prev => ({
39
+ ...prev,
40
+ [field]: 0,
41
+ }));
42
+ } else {
43
+ val = val >= 0 ? val : 0;
44
+ setCharges(prev => ({
45
+ ...prev,
46
+ [field]: val,
47
+ }));
48
+ }
49
+ };
50
+
51
+ return (
52
+ <MainContainer>
53
+ <Title>Delivery Add-Ons</Title>
54
+ <Container>
55
+ {fieldsInLabelValueFormat.map((item: any) => (
56
+ <FieldRow key={item.value}>
57
+ <Label>{item.label}</Label>
58
+ <div style={{ display: 'flex', gap: '3px', alignItems: 'center' }}>
59
+ <CurrencySymbol>{baseUrlSymbol}</CurrencySymbol>
60
+ <Input
61
+ min={0}
62
+ max={10000}
63
+ type="number"
64
+ placeholder="0.00"
65
+ onWheel={(e: any) => e.target.blur()}
66
+ value={props?.inputValue[item.value] ?? ''}
67
+ onKeyDown={handleKeyDownDebrief}
68
+ onChange={(e: any) => handleChange(item.value, e.target.value)}
69
+ />
70
+ </div>
71
+ </FieldRow>
72
+ ))}
73
+ </Container>
74
+ </MainContainer>
75
+ );
76
+ }
77
+
78
+ export default DeliveryAddOns;
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ import {
3
+ Container,
4
+ CurrencySymbol,
5
+ FieldRow,
6
+ Input,
7
+ Label,
8
+ MainContainer,
9
+ Title,
10
+ } from '../../styles';
11
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
12
+ import { useChargesState } from '../../../../../store';
13
+
14
+ const fields = [
15
+ { label: 'Disposal & Recycling', value: 'disposal_recycling' },
16
+ { label: 'Disposal Only', value: 'disposal' },
17
+ { label: 'Recycle Only', value: 'recycle' },
18
+ { label: 'Admin', value: 'admin' },
19
+ ];
20
+
21
+ interface IProps {
22
+ inputValue: Record<string, string>;
23
+ setInputValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
24
+ }
25
+
26
+ function DisposalCharge(props: IProps) {
27
+ const [, setCharges] = useChargesState();
28
+ const baseUrlSymbol = getBaseUrlSymbol();
29
+
30
+ const handleChange = (field: string, value: string) => {
31
+ props?.setInputValue((prev: any) => ({
32
+ ...prev,
33
+ [field]: value,
34
+ }));
35
+ let val = parseFloat(value);
36
+ if (isNaN(val)) {
37
+ setCharges(prev => ({
38
+ ...prev,
39
+ [field]: 0,
40
+ }));
41
+ } else {
42
+ val = val >= 0 ? val : 0;
43
+ setCharges(prev => ({
44
+ ...prev,
45
+ [field]: val,
46
+ }));
47
+ }
48
+ };
49
+
50
+ return (
51
+ <MainContainer>
52
+ <Title>Disposal Charges</Title>
53
+ <Container>
54
+ {fields.map((item: any) => (
55
+ <FieldRow key={item.value}>
56
+ <Label>{item.label}</Label>
57
+ <div style={{ display: 'flex', gap: '3px', alignItems: 'center' }}>
58
+ <CurrencySymbol>{baseUrlSymbol}</CurrencySymbol>
59
+ <Input
60
+ min={0}
61
+ max={10000}
62
+ type="number"
63
+ placeholder="0.00"
64
+ onWheel={(e: any) => e.target.blur()}
65
+ value={props?.inputValue[item.value] ?? ''}
66
+ onChange={(e: any) => handleChange(item.value, e.target.value)}
67
+ onKeyDown={handleKeyDownDebrief}
68
+ />
69
+ </div>
70
+ </FieldRow>
71
+ ))}
72
+ </Container>
73
+ </MainContainer>
74
+ );
75
+ }
76
+
77
+ export default DisposalCharge;
@@ -0,0 +1,124 @@
1
+ import React from 'react';
2
+ import {
3
+ Container,
4
+ FieldRow,
5
+ Input,
6
+ Label,
7
+ MainContainer,
8
+ Title,
9
+ } from '../../styles';
10
+ // import { ChargesType } from '../../../../types';
11
+
12
+ import { getBaseUrlSymbol, handleKeyDownDebrief } from '../../../../../utils';
13
+ import {
14
+ useChargesState,
15
+ useOrderDetails,
16
+ useOrderStaticData,
17
+ } from '../../../../../store';
18
+ import { CurrencySymbol } from '../../styles';
19
+ import styled from 'styled-components';
20
+
21
+ const fields = [
22
+ { label: 'Weight', value: 'weight' },
23
+ { label: 'Drop Time', value: 'drop_time' },
24
+ { label: 'Timed Services', value: 'timed_service' },
25
+ { label: 'Wait Time', value: 'wait_time' },
26
+ { label: 'Extra Floor', value: 'extra_floor' },
27
+ { label: 'Bulk Items', value: 'bulky_items' },
28
+ { label: 'Relabel (Pre-del)', value: 're_label' },
29
+ { label: 'Extra CBM', value: 'extra_cube' },
30
+ { label: 'Additional Box', value: 'additional_box' },
31
+ { label: 'Additional Item', value: 'additional_item' },
32
+ ];
33
+
34
+ interface IProps {
35
+ inputValue: Record<string, string>;
36
+ setInputValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
37
+ }
38
+
39
+ function OrderCharges(props: IProps) {
40
+ const [, setCharges] = useChargesState();
41
+ const [orderDetails] = useOrderDetails();
42
+ const [orderStaticData] = useOrderStaticData();
43
+ const weightVal = orderDetails?.weight;
44
+ const dropTime = orderDetails?.drop_time;
45
+ const cbm = orderDetails?.cube;
46
+ const timesServiceId = orderDetails?.order_services_detail?.timed_service_id;
47
+ const selectedTimedService = orderStaticData?.order_timed_services?.find(
48
+ (x: any) => x?.id === timesServiceId
49
+ );
50
+ const showSelectedTimedService =
51
+ selectedTimedService !== null && selectedTimedService !== undefined;
52
+ const showCbm = cbm !== undefined && cbm !== null && cbm > 0;
53
+ const showDropTime = dropTime !== undefined && dropTime !== null;
54
+ const showWeight = weightVal !== null && weightVal > 0;
55
+ const baseUrlSymbol = getBaseUrlSymbol();
56
+
57
+ const handleChange = (field: string, value: string) => {
58
+ props?.setInputValue((prev: any) => ({
59
+ ...prev,
60
+ [field]: value,
61
+ }));
62
+ let val = parseFloat(value);
63
+ if (value === '') {
64
+ setCharges(prev => ({
65
+ ...prev,
66
+ [field]: 0,
67
+ }));
68
+ } else if (!isNaN(val)) {
69
+ val = val >= 0 ? val : 0;
70
+ setCharges(prev => ({
71
+ ...prev,
72
+ [field]: val,
73
+ }));
74
+ }
75
+ };
76
+
77
+ return (
78
+ <MainContainer>
79
+ <Title>Order Charges</Title>
80
+ <Container>
81
+ {fields?.map(item => (
82
+ <FieldRow key={item.value}>
83
+ <Label style={{ minWidth: '100px' }}>{item.label}</Label>
84
+ {showWeight && item?.value === 'weight' && (
85
+ <OrderValue>{weightVal} Kg</OrderValue>
86
+ )}
87
+ {showDropTime && item?.value === 'drop_time' && (
88
+ <OrderValue>{dropTime} mins</OrderValue>
89
+ )}
90
+ {showCbm && item?.value === 'extra_cube' && (
91
+ <OrderValue>
92
+ {cbm} (m<sup>3</sup>)
93
+ </OrderValue>
94
+ )}
95
+ {showSelectedTimedService && item?.value === 'timed_service' && (
96
+ <OrderValue>
97
+ {selectedTimedService?.type?.replaceAll('_', '')}
98
+ </OrderValue>
99
+ )}
100
+ <div style={{ display: 'flex', gap: '3px', alignItems: 'center' }}>
101
+ <CurrencySymbol>{baseUrlSymbol}</CurrencySymbol>
102
+ <Input
103
+ min={0}
104
+ max={10000}
105
+ type="number"
106
+ placeholder="0.00"
107
+ onWheel={(e: any) => e.target.blur()}
108
+ value={props?.inputValue[item.value] ?? ''}
109
+ onChange={(e: any) => handleChange(item.value, e.target.value)}
110
+ onKeyDown={handleKeyDownDebrief}
111
+ />
112
+ </div>
113
+ </FieldRow>
114
+ ))}
115
+ </Container>
116
+ </MainContainer>
117
+ );
118
+ }
119
+
120
+ const OrderValue = styled.span`
121
+ color: #6396e5;
122
+ `;
123
+
124
+ export default OrderCharges;