@bjsdistribution/dms-client-return 0.1.19-dev → 0.1.19-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 (181) hide show
  1. package/dist/common/date-picker/header/ClearDate.d.ts +1 -1
  2. package/dist/components/client-portal/DateFilterStore.d.ts +15 -0
  3. package/dist/components/client-portal/OutstandingTable.d.ts +3 -0
  4. package/dist/components/client-portal/ReturnRTFilters.d.ts +3 -0
  5. package/dist/components/client-portal/ReturnStatus.d.ts +5 -0
  6. package/dist/components/client-portal/return-confirm/ConfirmedMain.d.ts +3 -0
  7. package/dist/components/client-portal/return-confirm/ReturnConfirmedTable.d.ts +3 -0
  8. package/dist/components/order-daily-overview/header/route-header/ClientRouterHeader.d.ts +11 -0
  9. package/dist/components/order-daily-overview/table-view/TableStyle.d.ts +4 -4
  10. package/dist/components/order-view/DynamicTable.d.ts +2 -1
  11. package/dist/components/order-view/general-information/Status.d.ts +1 -1
  12. package/dist/components/order-view/general-information/index.d.ts +1 -1
  13. package/dist/components/order-view/index.d.ts +1 -1
  14. package/dist/components/order-view/notes/AddNote.d.ts +1 -0
  15. package/dist/components/order-view/notes/order-dropdown/NewReturnDropdown.d.ts +3 -0
  16. package/dist/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.d.ts +4 -1
  17. package/dist/components/order-view/order-actions/actions/confirm-order/index.d.ts +4 -1
  18. package/dist/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.d.ts +7 -0
  19. package/dist/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.d.ts +11 -0
  20. package/dist/components/order-view/order-actions/actions/force-debrief/Selector.d.ts +11 -0
  21. package/dist/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.d.ts +3 -0
  22. package/dist/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.d.ts +8 -0
  23. package/dist/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.d.ts +7 -0
  24. package/dist/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.d.ts +7 -0
  25. package/dist/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.d.ts +7 -0
  26. package/dist/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.d.ts +7 -0
  27. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.d.ts +3 -0
  28. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.d.ts +3 -0
  29. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.d.ts +3 -0
  30. package/dist/components/order-view/order-actions/actions/force-debrief/escalation/index.d.ts +3 -0
  31. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.d.ts +3 -0
  32. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.d.ts +3 -0
  33. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.d.ts +3 -0
  34. package/dist/components/order-view/order-actions/actions/force-debrief/notifications/index.d.ts +3 -0
  35. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.d.ts +7 -0
  36. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.d.ts +3 -0
  37. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.d.ts +3 -0
  38. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.d.ts +3 -0
  39. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.d.ts +3 -0
  40. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.d.ts +3 -0
  41. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.d.ts +3 -0
  42. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/index.d.ts +4 -0
  43. package/dist/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.d.ts +3 -0
  44. package/dist/components/order-view/order-actions/actions/force-debrief/styles.d.ts +8 -0
  45. package/dist/components/order-view/order-actions/actions/hold-order/HoldOrderModal.d.ts +1 -0
  46. package/dist/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.d.ts +1 -1
  47. package/dist/components/order-view/order-actions/actions/unhold-order/UnholdOrder.d.ts +1 -0
  48. package/dist/components/order-view/order-actions/types.d.ts +3 -3
  49. package/dist/components/order-view/order-details/expanded-content/index.d.ts +1 -1
  50. package/dist/components/order-view/order-details/index.d.ts +1 -1
  51. package/dist/components/order-view/order-resources/expanded-content/index.d.ts +1 -1
  52. package/dist/components/order-view/products-info/expanded-content/index.d.ts +6 -1
  53. package/dist/components/order-view/products-info/index.d.ts +1 -1
  54. package/dist/components/order-view/return-client-products/ProductTable.d.ts +6 -1
  55. package/dist/components/order-view/return-client-products/product-table/ReturnProductTable.d.ts +6 -1
  56. package/dist/components/order-view/store.d.ts +15 -3
  57. package/dist/components/order-view/system-event-logs/expanded-content/index.d.ts +1 -1
  58. package/dist/components/order-view/types.d.ts +55 -1
  59. package/dist/components/order-view/utils.d.ts +11 -2
  60. package/dist/components/store.d.ts +6 -2
  61. package/dist/dms-client-return.cjs.development.js +9140 -5835
  62. package/dist/dms-client-return.cjs.development.js.map +1 -1
  63. package/dist/dms-client-return.cjs.production.min.js +1 -1
  64. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  65. package/dist/dms-client-return.esm.js +7617 -4312
  66. package/dist/dms-client-return.esm.js.map +1 -1
  67. package/package.json +6 -4
  68. package/src/assets/icons/ActionIcon.tsx +1 -1
  69. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  70. package/src/components/client-portal/DateFilterStore.ts +139 -0
  71. package/src/components/client-portal/OutstandingTable.tsx +356 -0
  72. package/src/components/client-portal/ReturnAfterSearchBar.tsx +77 -17
  73. package/src/components/client-portal/ReturnOverview.tsx +15 -6
  74. package/src/components/client-portal/ReturnRTFilters.tsx +196 -80
  75. package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
  76. package/src/components/client-portal/ReturnStatus.tsx +50 -66
  77. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
  78. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
  79. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  80. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
  81. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -15
  82. package/src/components/order-daily-overview/index.tsx +23 -4
  83. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +23 -38
  84. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
  85. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  86. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  87. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
  88. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +58 -155
  89. package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
  90. package/src/components/order-view/DynamicTable.tsx +21 -8
  91. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  92. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
  93. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  94. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
  95. package/src/components/order-view/general-information/Status.tsx +92 -18
  96. package/src/components/order-view/general-information/index.tsx +2 -2
  97. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  98. package/src/components/order-view/index.tsx +50 -8
  99. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  100. package/src/components/order-view/notes/AddNote.tsx +95 -65
  101. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  102. package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
  103. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  104. package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
  105. package/src/components/order-view/notification/index.tsx +100 -55
  106. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
  107. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
  108. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  109. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  110. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  111. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -35
  112. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
  113. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
  114. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
  115. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
  116. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  117. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +635 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  121. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  122. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  123. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  124. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  125. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  126. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  127. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  128. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  129. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  130. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  131. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  132. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  133. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +150 -0
  134. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  135. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  136. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  137. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  138. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  139. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  140. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  141. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  142. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  143. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  144. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  145. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  146. package/src/components/order-view/order-actions/index.tsx +19 -10
  147. package/src/components/order-view/order-actions/store.ts +1 -1
  148. package/src/components/order-view/order-actions/types.ts +3 -3
  149. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactHome.tsx +102 -45
  150. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactMobile.tsx +93 -34
  151. package/src/components/order-view/order-details/expanded-content/customer-section/contact-info/ContactWork.tsx +88 -31
  152. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
  153. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  154. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  155. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  156. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  157. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  158. package/src/components/order-view/order-details/index.tsx +5 -2
  159. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  160. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  161. package/src/components/order-view/products-info/index.tsx +10 -6
  162. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  163. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  164. package/src/components/order-view/store.ts +113 -1
  165. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  166. package/src/components/order-view/types.ts +60 -1
  167. package/src/components/order-view/utils.ts +49 -33
  168. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  169. package/src/components/order-view/view-reminder/ViewReminder.tsx +31 -14
  170. package/src/components/store.ts +25 -2
  171. package/src/index.tsx +23 -5
  172. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  173. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  174. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  175. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  176. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  177. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  178. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  179. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  180. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  181. package/src/components/order-view/order-actions/actions/log-service-refusal/index.tsx +0 -130
@@ -0,0 +1,221 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import {
4
+ CalendarIcon,
5
+ Label,
6
+ TextArea,
7
+ } from '@bjsdistribution/dms-component-library';
8
+ import { Input } from '../../styles';
9
+ import {
10
+ useChargesState,
11
+ useOrderDetails,
12
+ useProductDetails,
13
+ } from '../../../../../store';
14
+ import { getBaseUrlSymbol } from '../../../../../utils';
15
+
16
+ const formatDate = (date: any) => {
17
+ const padZero = (num: any) => num.toString().padStart(2, '0');
18
+ const year = new Date(date).getFullYear();
19
+ const month = padZero(new Date(date).getMonth() + 1);
20
+ const day = padZero(new Date(date).getDate());
21
+ return `${day}/${month}/${year}`;
22
+ };
23
+
24
+ function SuccessContent() {
25
+ const [orderDetails] = useOrderDetails();
26
+ const [chargesState] = useChargesState();
27
+ const baseUrlSymbol = getBaseUrlSymbol();
28
+
29
+ const [productdata] = useProductDetails();
30
+ const sortedProductData = productdata?.sort((a: any, b: any) => {
31
+ return a?.status === b?.status ? 0 : a?.status ? -1 : 1;
32
+ });
33
+
34
+ const products = Array.isArray(sortedProductData)
35
+ ? sortedProductData?.filter(item => item?.status === true)
36
+ : [];
37
+
38
+ const excludedFields = [
39
+ 'debrief_notes',
40
+ 'new_order_status',
41
+ 'base_charge_type',
42
+ 'adhoc_charges',
43
+ 'debrief_status',
44
+ ]; // Fields to exclude
45
+ let totalChargesAmount = 0;
46
+
47
+ for (const [key, value] of Object.entries(chargesState)) {
48
+ if (!excludedFields.includes(key) && typeof value === 'number') {
49
+ totalChargesAmount += value;
50
+ }
51
+ }
52
+
53
+ const formattedDate =
54
+ orderDetails?.action_date === null
55
+ ? ' '
56
+ : formatDate(orderDetails?.action_date);
57
+
58
+ const adhocTotalCharges =
59
+ chargesState?.adhoc_charges?.length > 0
60
+ ? chargesState?.adhoc_charges?.reduce(
61
+ (acc, item) => acc + item.adhoc_charges,
62
+ 0
63
+ )
64
+ : 0;
65
+
66
+ return (
67
+ <Wrapper>
68
+ <FieldGroup>
69
+ <Label label="Signed By" htmlFor="signedby" />
70
+ <StyledInput
71
+ id="signedby"
72
+ placeholder=""
73
+ value={orderDetails?.order_recipient?.recipient_name || ''}
74
+ onChange={() => {}}
75
+ disabled
76
+ />
77
+
78
+ <Label label="Date" htmlFor="datefield" />
79
+ <DateInput>
80
+ <Text>{formattedDate}</Text>
81
+ <CalendarIcon />
82
+ </DateInput>
83
+
84
+ <GroupedFields>
85
+ <PairGroup>
86
+ <SmallGroup>
87
+ <Label label="Items" htmlFor="items" />
88
+ <Text>{products?.length}</Text>
89
+ </SmallGroup>
90
+ <SmallGroup>
91
+ <Label label="Zone" htmlFor="zone" />
92
+ <Text>{orderDetails?.zone_code}</Text>
93
+ </SmallGroup>
94
+ </PairGroup>
95
+
96
+ <PairGroup>
97
+ <SmallGroup>
98
+ <Label label="Weight" htmlFor="weight" />
99
+ <Text>{orderDetails?.weight}Kg</Text>
100
+ </SmallGroup>
101
+
102
+ <SmallGroup>
103
+ <Label label="Total Charge" htmlFor="totalCharge" />
104
+ <div
105
+ style={{ display: 'flex', gap: '4px', alignItems: 'center' }}
106
+ >
107
+ <CurrencyWrapper>{baseUrlSymbol}</CurrencyWrapper>
108
+ <Text>{totalChargesAmount + adhocTotalCharges}</Text>
109
+ </div>
110
+ </SmallGroup>
111
+ </PairGroup>
112
+ </GroupedFields>
113
+ </FieldGroup>
114
+
115
+ <DropdownGrid>
116
+ <FieldGroup wide>
117
+ <Label label="Order Status Notes" htmlFor="notes" />
118
+ <TextInput
119
+ id="notes"
120
+ placeholder="Type notes here..."
121
+ value={orderDetails?.order_status_note || ''}
122
+ readOnly
123
+ />
124
+ </FieldGroup>
125
+
126
+ <FieldGroup wide>
127
+ <Label label="Charge Description" htmlFor="chargedescription" />
128
+ <TextInput
129
+ id="chargedescription"
130
+ placeholder="Type charge description here..."
131
+ onChange={() => {}}
132
+ />
133
+ </FieldGroup>
134
+ </DropdownGrid>
135
+ </Wrapper>
136
+ );
137
+ }
138
+
139
+ const CurrencyWrapper = styled.span`
140
+ display: flex;
141
+ align-items: center;
142
+ color: #999;
143
+ `;
144
+
145
+ const DropdownGrid = styled.div`
146
+ display: flex;
147
+ flex-wrap: wrap;
148
+ gap: 20px;
149
+ width: 48%;
150
+ `;
151
+
152
+ const GroupedFields = styled.div`
153
+ display: flex;
154
+ flex-direction: column;
155
+ gap: 7px;
156
+ `;
157
+
158
+ const PairGroup = styled.div`
159
+ display: flex;
160
+ flex-direction: row;
161
+ gap: 20px;
162
+
163
+ @media (max-width: 768px) {
164
+ flex-direction: column;
165
+ }
166
+ `;
167
+
168
+ const SmallGroup = styled.div`
169
+ display: flex;
170
+ flex-direction: column;
171
+ gap: 6px;
172
+ flex: 1;
173
+ width: 48%;
174
+ `;
175
+
176
+ const Wrapper = styled.div`
177
+ display: flex;
178
+ flex-wrap: wrap;
179
+ gap: 20px;
180
+ width: 100%;
181
+ padding: 10px 0;
182
+ `;
183
+
184
+ const FieldGroup = styled.div<{ wide?: boolean }>`
185
+ display: flex;
186
+ flex-direction: column;
187
+ gap: 6px;
188
+ flex: ${props => (props.wide ? 2 : 1)};
189
+ `;
190
+
191
+ const TextInput = styled(TextArea)`
192
+ resize: none;
193
+ width: 100%;
194
+ min-height: 180px;
195
+ `;
196
+
197
+ const StyledInput = styled(Input)`
198
+ width: 100%;
199
+ height: 38px;
200
+ `;
201
+
202
+ const DateInput = styled.div`
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: space-between;
206
+ padding: 0 12px;
207
+ border-radius: 6px;
208
+ border: 1px solid #e0e2e7;
209
+ background-color: #fff;
210
+ color: #363a30;
211
+ height: 38px;
212
+ font-size: 14px;
213
+ box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
214
+ `;
215
+
216
+ const Text = styled.div`
217
+ color: #363a30;
218
+ font-size: 14px;
219
+ `;
220
+
221
+ export default SuccessContent;
@@ -0,0 +1,51 @@
1
+ import styled from 'styled-components';
2
+
3
+ export const Title = styled.span`
4
+ font-family: 'Lato', sans-serif;
5
+ font-size: 16px;
6
+ font-weight: 600;
7
+ color: #6a7378;
8
+ `;
9
+
10
+ export const Container = styled.div`
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: 4px;
14
+ `;
15
+
16
+ export const FieldRow = styled.div`
17
+ display: flex;
18
+ align-items: center;
19
+ gap: 8px;
20
+ width: 300px;
21
+ justify-content: space-between;
22
+ `;
23
+
24
+ export const Label = styled.label`
25
+ font-size: 14px;
26
+ color: #7b7874;
27
+ `;
28
+
29
+ export const Input = styled.input`
30
+ width: 70px;
31
+ padding: 6px;
32
+ font-size: 14px;
33
+ border: 1px solid #ccc;
34
+ border-radius: 4px;
35
+ &::-webkit-inner-spin-button,
36
+ &::-webkit-outer-spin-button {
37
+ -webkit-appearance: none;
38
+ -moz-appearance: none;
39
+ appearance: none;
40
+ margin: 0;
41
+ }
42
+ `;
43
+
44
+ export const MainContainer = styled.div`
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: 4px;
48
+ `;
49
+ export const CurrencySymbol = styled.span`
50
+ color: #858d9d;
51
+ `;
@@ -25,6 +25,7 @@ import { useClientPortal } from '../../../../store';
25
25
  interface IProps {
26
26
  callOrderAlertsApi: any;
27
27
  callOrdersApi?: any;
28
+ callOrderStatusApi: any;
28
29
  callUnresolvedTaskApi?: any;
29
30
  }
30
31
 
@@ -93,6 +94,7 @@ function HoldOrderModal(props: IProps) {
93
94
  await props?.callUnresolvedTaskApi();
94
95
  }
95
96
  await props?.callOrderAlertsApi();
97
+ await props?.callOrderStatusApi();
96
98
  await props?.callOrdersApi();
97
99
  }
98
100
  if (response?.code !== 200) {
@@ -15,12 +15,16 @@ import {
15
15
  } from '../../../store';
16
16
  import { notification } from 'antd';
17
17
 
18
- function RemoveFromRoute() {
18
+ function RemoveFromRoute(props: any) {
19
19
  const [orderId] = useOrderId();
20
20
  const [, setCurrentAction] = useCurrentAction();
21
21
  const [, setRecalling] = useLiveRecalling();
22
22
  const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
23
23
 
24
+ const callOrdersApi = async () => {
25
+ await props?.callOrderAlertsApi();
26
+ };
27
+
24
28
  const { data: response, setShouldPerformAction: setAction } = useApiHook<{
25
29
  data: ApiResponse[];
26
30
  }>({
@@ -37,9 +41,10 @@ function RemoveFromRoute() {
37
41
  //@ts-ignore
38
42
  response?.message || 'Order has been removed successfully',
39
43
  });
40
- setCurrentAction(undefined);
44
+ callOrdersApi();
41
45
  setRecalling(true);
42
46
  setRecallAuditLog(true);
47
+ setCurrentAction(undefined);
43
48
  }
44
49
  if (response?.data === null) {
45
50
  notification.error({
@@ -13,6 +13,7 @@ interface IProps {
13
13
  callOrderAlertsApi: any;
14
14
  callOrdersApi?: any;
15
15
  callUnresolvedTaskApi?: any;
16
+ callOrderStatusApi: any;
16
17
  }
17
18
 
18
19
  const UnholdOrder = (props: IProps) => {
@@ -46,6 +47,7 @@ const UnholdOrder = (props: IProps) => {
46
47
  }
47
48
  await props?.callOrderAlertsApi();
48
49
  await props?.callOrdersApi();
50
+ await props?.callOrderStatusApi();
49
51
  }
50
52
  if (response?.code !== 200) {
51
53
  notification.error({
@@ -12,7 +12,6 @@ import {
12
12
  useStatusDetails,
13
13
  } from '../store';
14
14
  import SplitOrder from './actions/split-order';
15
- import LogServiceRefusal from './actions/log-service-refusal';
16
15
  import CancelOrder from './actions/cancel-order';
17
16
  import ConfirmOrder from './actions/confirm-order';
18
17
  import SendSmsModal from './actions/send-sms/SendSmsModal';
@@ -34,6 +33,7 @@ import { useReminderNotiData, useTasksData } from './store';
34
33
  import ChargeLog from './actions/charge-log';
35
34
  import ReminderModal from './actions/create-task-reminder';
36
35
  import TaskModal from './actions/create-task-reminder/TaskModal';
36
+ import ForceDebriefModal from './actions/force-debrief/ForceDebriefModal';
37
37
 
38
38
  function OrderActions() {
39
39
  const [currentAction, setCurrentAction] = useCurrentAction();
@@ -93,8 +93,8 @@ function OrderActions() {
93
93
  setProductDetails(productsData?.data);
94
94
  setProductDetailsCopy(productsData?.data);
95
95
  } else {
96
- setProductDetails(null);
97
- setProductDetailsCopy(null);
96
+ setProductDetails([]);
97
+ setProductDetailsCopy([]);
98
98
  }
99
99
  }, [orderProductsLoading]);
100
100
 
@@ -176,6 +176,7 @@ function OrderActions() {
176
176
  method: 'GET',
177
177
  pagination: { is_pagination: false },
178
178
  filters: [{ field: 'order_id', op: '=', value: orderId }],
179
+ showLoader: false,
179
180
  });
180
181
 
181
182
  useEffect(() => {
@@ -211,10 +212,7 @@ function OrderActions() {
211
212
  return <SplitOrder />;
212
213
  case 'release-order':
213
214
  return <ReleaseOrder />;
214
- // case 'unrelease-order':
215
- // return <UnreleaseOrder />;
216
- case 'log-service-refusal':
217
- return <LogServiceRefusal callOrdersApi={callOrdersApi} />;
215
+
218
216
  case 'cancel-order':
219
217
  return (
220
218
  <CancelOrder
@@ -234,9 +232,18 @@ function OrderActions() {
234
232
  />
235
233
  );
236
234
  case 'confirm-order':
237
- return <ConfirmOrder />;
235
+ return <ConfirmOrder callOrderAlertsApi={callOrderAlertsApi} />;
238
236
  case 'send-sms':
239
237
  return <SendSmsModal />;
238
+
239
+ case 'force-debrief':
240
+ return (
241
+ <ForceDebriefModal
242
+ callOrdersApi={callOrdersApi}
243
+ callOrderStatusApi={fetchStatusData}
244
+ callOrderAlertsApi={callOrderAlertsApi}
245
+ />
246
+ );
240
247
  case 'send-email':
241
248
  return <SendEmailModal />;
242
249
  case 'change-customer-account':
@@ -247,6 +254,7 @@ function OrderActions() {
247
254
  <HoldOrderModal
248
255
  callOrdersApi={callOrdersApi}
249
256
  callOrderAlertsApi={callOrderAlertsApi}
257
+ callOrderStatusApi={fetchStatusData}
250
258
  callUnresolvedTaskApi={callUnresolvedTaskApi}
251
259
  />
252
260
  );
@@ -272,6 +280,7 @@ function OrderActions() {
272
280
  callOrdersApi={callOrdersApi}
273
281
  callOrderAlertsApi={callOrderAlertsApi}
274
282
  callUnresolvedTaskApi={callUnresolvedTaskApi}
283
+ callOrderStatusApi={fetchStatusData}
275
284
  />
276
285
  );
277
286
  case 'view-reminder':
@@ -281,9 +290,9 @@ function OrderActions() {
281
290
  case 'view-flag':
282
291
  return <ViewFlag />;
283
292
  case 'clear-date':
284
- return <ClearBookingStatus />;
293
+ return <ClearBookingStatus callOrderAlertsApi={callOrderAlertsApi} />;
285
294
  case 'remove-from-route':
286
- return <RemoveFromRoute />;
295
+ return <RemoveFromRoute callOrderAlertsApi={callOrderAlertsApi} />;
287
296
  default:
288
297
  return null;
289
298
  }
@@ -18,7 +18,7 @@ export const initialPayload: CreateTaskPayload = {
18
18
  flag_type: '',
19
19
  priority: 3,
20
20
  status: 'AD',
21
- due_datetime: '',
21
+ // due_datetime: '',
22
22
  };
23
23
 
24
24
  export const initialValue: CreateReminderPayload = {
@@ -22,7 +22,7 @@ export interface CreateTaskPayload {
22
22
  flag_type: string | null;
23
23
  priority: number | null;
24
24
  status: string | null;
25
- due_datetime: string | null;
25
+ due_datetime?: string | null;
26
26
  }
27
27
  export interface resolveTaskPayload {
28
28
  task_ids: number[] | null;
@@ -31,7 +31,7 @@ export interface resolveTaskPayload {
31
31
  export interface CreateReminderPayload {
32
32
  due_datetime: Date | null;
33
33
  description: string | null;
34
- assigned_to: string | null;
34
+ assigned_to: any | null;
35
35
  order_id: number | null;
36
36
  priority: number | null;
37
37
  department: string | null;
@@ -49,7 +49,7 @@ export interface SingleResolvedPayload {
49
49
  export interface UpdateReminderPayload {
50
50
  due_datetime: any | null;
51
51
  description: any | null;
52
- assigned_to: string | null;
52
+ assigned_to: any | null;
53
53
  order_id: number | null;
54
54
  priority: number | null;
55
55
  department: any | null;
@@ -1,25 +1,48 @@
1
1
  import { Input, Label } from '@bjsdistribution/dms-component-library';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
- import { errorAtom, useAtom, useOrderDetails } from '../../../../store';
4
+ import {
5
+ errorAtom,
6
+ useAtom,
7
+ useOrderDetails,
8
+ usePrevOrderDetails,
9
+ } from '../../../../store';
5
10
  import { handleKeyDown } from '../../../../utils';
11
+ import { useClientPortal } from '../../../../../store';
6
12
 
7
- // const LANDLINE_REGEX = /^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\s-]?\(?)?|0)(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}|\d{3}\)?[\s-]?\d{3}[\\s-]?\d{3,4}|\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3})|\d{5}\)?[\s-]?\d{4,5}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|\#)\d+)?)$/;
13
+ //import { VALIDATE_UK_IRISH_NUMBER_REGEX } from '../../../helper';
14
+ import CallCustomer from './CallCustomer';
8
15
 
9
16
  function ContactHome() {
10
17
  const [errors, setErrors] = useAtom(errorAtom);
11
-
12
- // Show call icons only if number is valid
13
- // show copy icon if there is input value
18
+ const [isClientPortal] = useClientPortal();
14
19
  const [orderDetails, setOrderDetails] = useOrderDetails();
20
+ const [prevOrderDetails] = usePrevOrderDetails();
21
+ const apiContactHome = prevOrderDetails?.order_recipient?.contact_home;
15
22
  const orderRecipient = orderDetails?.order_recipient;
16
23
 
17
24
  const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
18
- const val = e.target.value;
25
+ let val = e.target.value.replace(/\s+/g, '');
26
+ console.log(val, 'valuee');
27
+
28
+ if (!/^\+?\d*$/.test(val)) return;
29
+
30
+ const validPrefixes = ['+44', '44', '0', '+353', '353'];
31
+
32
+ let matchedPrefix = validPrefixes.find(prefix => val.startsWith(prefix));
33
+ let prefix = matchedPrefix || '';
34
+ let numberPart = val.slice(prefix.length);
35
+
36
+ const digitLimit = prefix === '+353' || prefix === '353' ? 9 : 10;
37
+
38
+ if (numberPart.length > digitLimit) return;
39
+
40
+ const contactValue = val;
41
+
19
42
  const updatedOrderRecipient = {
20
43
  ...(orderRecipient === null
21
- ? { contact_home: val }
22
- : { ...orderRecipient, contact_home: val }),
44
+ ? { contact_home: contactValue }
45
+ : { ...orderRecipient, contact_home: contactValue }),
23
46
  };
24
47
 
25
48
  setOrderDetails(prev => ({
@@ -27,58 +50,100 @@ function ContactHome() {
27
50
  order_recipient: updatedOrderRecipient,
28
51
  }));
29
52
 
30
- if (val) {
31
- if (val.length < 10) {
32
- setErrors(prevErrors => ({
33
- ...prevErrors,
34
- homeContactError: 'Phone number must be at least 10 digits.',
35
- }));
36
- } else if (val.length > 11) {
37
- setErrors(prevErrors => ({
38
- ...prevErrors,
39
- homeContactError: 'Phone number must not exceed 11 digits.',
40
- }));
41
- } else {
42
- setErrors(prevErrors => ({
43
- ...prevErrors,
44
- homeContactError: '',
45
- }));
46
- }
47
- } else {
48
- setErrors(prevErrors => ({
49
- ...prevErrors,
50
- homeContactError: '',
53
+ if (!numberPart) {
54
+ setErrors(prev => ({ ...prev, homeContactError: '' }));
55
+ } else if (numberPart.length !== digitLimit) {
56
+ setErrors(prev => ({
57
+ ...prev,
58
+ homeContactError: `Number must have exactly ${digitLimit} digits after the prefix.`,
51
59
  }));
60
+ } else {
61
+ setErrors(prev => ({ ...prev, homeContactError: '' }));
52
62
  }
53
63
  };
54
64
 
55
65
  return (
56
- <MainContainer>
66
+ <Container>
57
67
  <Wrapper>
58
68
  <Label label="Contact Home" htmlFor="contact-home" />
59
- {/* {showCopyIcon && <CopyText text={orderRecipient?.contact_home!} />} */}
60
69
  </Wrapper>
61
70
  <InputContainer>
62
71
  <CustomInput
63
72
  name="contact-home"
73
+ // maxLength={12}
64
74
  type="text"
65
75
  placeholder="Home Number"
66
76
  onKeyDown={handleKeyDown}
67
- minLength={10}
68
- maxLength={10}
69
77
  value={orderRecipient?.contact_home || ''}
70
78
  onChange={onChange}
79
+ disabled={isClientPortal}
71
80
  />
81
+ {/*
82
+ <CallCustomer /> */}
83
+ {apiContactHome &&
84
+ (() => {
85
+ const rawNumber = apiContactHome.replace(/\s+/g, '');
86
+
87
+ let formattedNumber = rawNumber.replace(/\D/g, ''); // digits only
88
+ let prefix = '';
89
+ let numberPart = '';
90
+
91
+ if (rawNumber.startsWith('+44')) {
92
+ prefix = '+44';
93
+ numberPart = formattedNumber.slice(2);
94
+ } else if (rawNumber.startsWith('44')) {
95
+ prefix = '44';
96
+ numberPart = formattedNumber.slice(2);
97
+ } else if (rawNumber.startsWith('0')) {
98
+ prefix = '0';
99
+ numberPart = formattedNumber.slice(1);
100
+ } else if (rawNumber.startsWith('+353')) {
101
+ prefix = '+353';
102
+ numberPart = formattedNumber.slice(3);
103
+ } else if (rawNumber.startsWith('353')) {
104
+ prefix = '353';
105
+ numberPart = formattedNumber.slice(3);
106
+ } else {
107
+ numberPart = formattedNumber;
108
+ }
109
+
110
+ // Set digit limit based on prefix
111
+ const digitLimit = prefix === '+353' || prefix === '353' ? 9 : 10;
112
+
113
+ if (numberPart.length !== digitLimit) return null;
114
+
115
+ let hrefPrefix = '';
72
116
 
73
- {/* <CallCustomer /> */}
117
+ if (prefix === '0' || prefix === '44' || prefix === '+44') {
118
+ hrefPrefix = '+44';
119
+ } else if (prefix === '353' || prefix === '+353') {
120
+ hrefPrefix = '+353';
121
+ } else {
122
+ hrefPrefix = '+44';
123
+ }
124
+
125
+ const finalHref = `tel:${hrefPrefix}${numberPart}`;
126
+
127
+ return (
128
+ <a href={finalHref} style={{ cursor: 'pointer' }}>
129
+ <CallCustomer />
130
+ </a>
131
+ );
132
+ })()}
74
133
  </InputContainer>
75
134
  {errors.homeContactError && (
76
135
  <ErrorText>{errors.homeContactError}</ErrorText>
77
136
  )}
78
- </MainContainer>
137
+ </Container>
79
138
  );
80
139
  }
81
140
 
141
+ const InputContainer = styled.div`
142
+ display: flex;
143
+ gap: 7px;
144
+ align-items: center;
145
+ `;
146
+
82
147
  const Wrapper = styled.div`
83
148
  display: flex;
84
149
  align-items: center;
@@ -87,9 +152,6 @@ const Wrapper = styled.div`
87
152
 
88
153
  const CustomInput = styled(Input)`
89
154
  width: 80%;
90
- // @media (max-width: 1024px) {
91
- // width: 80%;
92
- // }
93
155
 
94
156
  &::-webkit-outer-spin-button,
95
157
  &::-webkit-inner-spin-button {
@@ -101,13 +163,7 @@ const CustomInput = styled(Input)`
101
163
  }
102
164
  `;
103
165
 
104
- const InputContainer = styled.div`
105
- display: flex;
106
- gap: 7px;
107
- align-items: center;
108
- `;
109
-
110
- const MainContainer = styled.div`
166
+ const Container = styled.div`
111
167
  display: flex;
112
168
  flex-direction: column;
113
169
  gap: 6px;
@@ -119,4 +175,5 @@ const ErrorText = styled.span`
119
175
  font-size: 0.85rem;
120
176
  margin-top: 4px;
121
177
  `;
178
+
122
179
  export default ContactHome;