@bjsdistribution/dms-client-return 0.1.18-dev → 0.1.18-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 (179) 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/order-view/view-reminder/ViewReminder.d.ts +2 -0
  61. package/dist/components/store.d.ts +5 -1
  62. package/dist/dms-client-return.cjs.development.js +8897 -5744
  63. package/dist/dms-client-return.cjs.development.js.map +1 -1
  64. package/dist/dms-client-return.cjs.production.min.js +1 -1
  65. package/dist/dms-client-return.cjs.production.min.js.map +1 -1
  66. package/dist/dms-client-return.esm.js +8917 -5764
  67. package/dist/dms-client-return.esm.js.map +1 -1
  68. package/package.json +6 -4
  69. package/src/assets/icons/ActionIcon.tsx +1 -1
  70. package/src/assets/icons/ArrowDownIcon.tsx +2 -2
  71. package/src/components/client-portal/DateFilterStore.ts +139 -0
  72. package/src/components/client-portal/OutstandingTable.tsx +356 -0
  73. package/src/components/client-portal/ReturnAfterSearchBar.tsx +77 -17
  74. package/src/components/client-portal/ReturnOverview.tsx +15 -6
  75. package/src/components/client-portal/ReturnRTFilters.tsx +196 -80
  76. package/src/components/client-portal/ReturnSearchBar.tsx +64 -94
  77. package/src/components/client-portal/ReturnStatus.tsx +50 -66
  78. package/src/components/client-portal/return-confirm/ConfirmedMain.tsx +224 -0
  79. package/src/components/client-portal/return-confirm/ReturnConfirmedTable.tsx +327 -0
  80. package/src/components/order-daily-overview/header/route-header/ClientRouterHeader.tsx +166 -0
  81. package/src/components/order-daily-overview/header/route-header/RouterHeader.tsx +2 -86
  82. package/src/components/order-daily-overview/header-filters/SelectionFilter.tsx +46 -15
  83. package/src/components/order-daily-overview/index.tsx +22 -4
  84. package/src/components/order-daily-overview/return-after-table/ReturnAfterTable.tsx +23 -38
  85. package/src/components/order-daily-overview/return-after-table/table/OrderTable.tsx +21 -24
  86. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnFilterStore.ts +36 -36
  87. package/src/components/order-daily-overview/return-after-table/table-filters/ReturnOrderFilter.tsx +12 -2
  88. package/src/components/order-daily-overview/return-order-table/ReturnTable.tsx +16 -0
  89. package/src/components/order-daily-overview/return-order-table/return-orders-filters/ReturnOrderTable.tsx +58 -155
  90. package/src/components/order-daily-overview/table/ReturnTable.tsx +8 -4
  91. package/src/components/order-view/DynamicTable.tsx +21 -8
  92. package/src/components/order-view/details-filters/left-side-filters/dropdowns/DropDowns.tsx +1 -1
  93. package/src/components/order-view/details-filters/left-side-filters/dropdowns/OptionsDropDown.tsx +9 -0
  94. package/src/components/order-view/details-filters/right-side-filters/Details.tsx +28 -3
  95. package/src/components/order-view/flags-action-modal/Dropdowns.tsx +2 -0
  96. package/src/components/order-view/general-information/Status.tsx +92 -18
  97. package/src/components/order-view/general-information/index.tsx +2 -2
  98. package/src/components/order-view/generic-table/AuditLogs.tsx +39 -12
  99. package/src/components/order-view/index.tsx +50 -8
  100. package/src/components/order-view/modalsPopup/ModalManager.tsx +1 -1
  101. package/src/components/order-view/notes/AddNote.tsx +95 -65
  102. package/src/components/order-view/notes/order-dropdown/NewReturnDropdown.tsx +8 -10
  103. package/src/components/order-view/notification/FlagTemplate.tsx +21 -10
  104. package/src/components/order-view/notification/OrderTemplate.tsx +192 -41
  105. package/src/components/order-view/notification/ReminderTemplate.tsx +28 -13
  106. package/src/components/order-view/notification/index.tsx +100 -55
  107. package/src/components/order-view/order-actions/actions/add-resources/DocFileUpload.tsx +92 -72
  108. package/src/components/order-view/order-actions/actions/add-resources/index.tsx +27 -10
  109. package/src/components/order-view/order-actions/actions/cancel-order/ReturnAction.tsx +25 -4
  110. package/src/components/order-view/order-actions/actions/cancel-order/ReturnReason.tsx +24 -4
  111. package/src/components/order-view/order-actions/actions/clear-booking-status/ClearBookingStatus.tsx +9 -2
  112. package/src/components/order-view/order-actions/actions/confirm-order/index.tsx +12 -35
  113. package/src/components/order-view/order-actions/actions/confirm-order/tables/NotesTable.tsx +1 -0
  114. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateReminderModal.tsx +88 -30
  115. package/src/components/order-view/order-actions/actions/create-task-reminder/CreateTaskModal.tsx +5 -3
  116. package/src/components/order-view/order-actions/actions/create-task-reminder/TaskModal.tsx +2 -2
  117. package/src/components/order-view/order-actions/actions/force-debrief/BaseChargeConfirmationModal.tsx +94 -0
  118. package/src/components/order-view/order-actions/actions/force-debrief/ForceDebriefModal.tsx +635 -0
  119. package/src/components/order-view/order-actions/actions/force-debrief/Selector.tsx +65 -0
  120. package/src/components/order-view/order-actions/actions/force-debrief/charges/adhoc/index.tsx +94 -0
  121. package/src/components/order-view/order-actions/actions/force-debrief/charges/base-charge/index.tsx +106 -0
  122. package/src/components/order-view/order-actions/actions/force-debrief/charges/collection-add-ons/index.tsx +77 -0
  123. package/src/components/order-view/order-actions/actions/force-debrief/charges/delivery-add-ons/index.tsx +78 -0
  124. package/src/components/order-view/order-actions/actions/force-debrief/charges/disposal-charges/index.tsx +77 -0
  125. package/src/components/order-view/order-actions/actions/force-debrief/charges/order-charges/index.tsx +124 -0
  126. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationCategory.tsx +92 -0
  127. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationLevel.tsx +90 -0
  128. package/src/components/order-view/order-actions/actions/force-debrief/escalation/EscalationReason.tsx +122 -0
  129. package/src/components/order-view/order-actions/actions/force-debrief/escalation/index.tsx +16 -0
  130. package/src/components/order-view/order-actions/actions/force-debrief/notifications/FlagsTemplate.tsx +46 -0
  131. package/src/components/order-view/order-actions/actions/force-debrief/notifications/OrderTemplate.tsx +117 -0
  132. package/src/components/order-view/order-actions/actions/force-debrief/notifications/Tabs.tsx +32 -0
  133. package/src/components/order-view/order-actions/actions/force-debrief/notifications/index.tsx +180 -0
  134. package/src/components/order-view/order-actions/actions/force-debrief/order-info/RadioButtons.tsx +150 -0
  135. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/CancellationReasonDropdown.tsx +40 -0
  136. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/FailureReasonDropdown.tsx +108 -0
  137. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/OrderHoldReasonDropdown.tsx +37 -0
  138. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/StatusDropdown.tsx +48 -0
  139. package/src/components/order-view/order-actions/actions/force-debrief/order-info/dropdowns/ZoneDropdown.tsx +27 -0
  140. package/src/components/order-view/order-actions/actions/force-debrief/order-info/failure-content/index.tsx +187 -0
  141. package/src/components/order-view/order-actions/actions/force-debrief/order-info/index.tsx +55 -0
  142. package/src/components/order-view/order-actions/actions/force-debrief/order-info/success-content/index.tsx +221 -0
  143. package/src/components/order-view/order-actions/actions/force-debrief/styles.tsx +51 -0
  144. package/src/components/order-view/order-actions/actions/hold-order/HoldOrderModal.tsx +2 -0
  145. package/src/components/order-view/order-actions/actions/remove-from-route/RemoveFromRoute.tsx +7 -2
  146. package/src/components/order-view/order-actions/actions/unhold-order/UnholdOrder.tsx +2 -0
  147. package/src/components/order-view/order-actions/index.tsx +19 -10
  148. package/src/components/order-view/order-actions/store.ts +1 -1
  149. package/src/components/order-view/order-actions/types.ts +3 -3
  150. package/src/components/order-view/order-details/expanded-content/footer/index.tsx +55 -80
  151. package/src/components/order-view/order-details/expanded-content/index.tsx +37 -16
  152. package/src/components/order-view/order-details/expanded-content/instruction-section/index.tsx +1 -1
  153. package/src/components/order-view/order-details/expanded-content/services-section/AssemblyType.tsx +9 -91
  154. package/src/components/order-view/order-details/expanded-content/services-section/OrderServices.tsx +10 -182
  155. package/src/components/order-view/order-details/expanded-content/services-section/ServiceLevel.tsx +3 -4
  156. package/src/components/order-view/order-details/index.tsx +5 -2
  157. package/src/components/order-view/order-resources/expanded-content/index.tsx +2 -2
  158. package/src/components/order-view/products-info/expanded-content/index.tsx +33 -11
  159. package/src/components/order-view/products-info/index.tsx +10 -6
  160. package/src/components/order-view/return-client-products/ProductTable.tsx +12 -2
  161. package/src/components/order-view/return-client-products/product-table/ReturnProductTable.tsx +73 -23
  162. package/src/components/order-view/store.ts +113 -1
  163. package/src/components/order-view/system-event-logs/expanded-content/index.tsx +6 -2
  164. package/src/components/order-view/types.ts +60 -1
  165. package/src/components/order-view/utils.ts +37 -33
  166. package/src/components/order-view/view-reminder/AssigneeDropdown.tsx +85 -26
  167. package/src/components/order-view/view-reminder/ViewReminder.tsx +33 -14
  168. package/src/components/store.ts +24 -1
  169. package/src/index.tsx +23 -5
  170. package/dist/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.d.ts +0 -7
  171. package/dist/components/order-view/order-actions/actions/log-service-refusal/Notes.d.ts +0 -7
  172. package/dist/components/order-view/order-actions/actions/log-service-refusal/OrderServices.d.ts +0 -7
  173. package/dist/components/order-view/order-actions/actions/log-service-refusal/helper.d.ts +0 -3
  174. package/dist/components/order-view/order-actions/actions/log-service-refusal/index.d.ts +0 -3
  175. package/src/components/order-view/order-actions/actions/log-service-refusal/DeliveryPoint.tsx +0 -50
  176. package/src/components/order-view/order-actions/actions/log-service-refusal/Notes.tsx +0 -50
  177. package/src/components/order-view/order-actions/actions/log-service-refusal/OrderServices.tsx +0 -57
  178. package/src/components/order-view/order-actions/actions/log-service-refusal/helper.ts +0 -26
  179. 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;
@@ -9,12 +9,12 @@ import {
9
9
  errorAtom,
10
10
  useCustomerInfo,
11
11
  useGlobalStateHitAuditLog,
12
- useOrderStaticData,
13
12
  useGlobalStateHitOrder,
13
+ useLiveRecalling,
14
14
  } from '../../../store';
15
15
  // import useUpdateOrder from '../../../hooks/useUpdateOrder';
16
16
  import { compareOrderDetailsStates, filterObject } from '../../../utils';
17
- import { ApiResponse, OrderServiceType } from '../../../types';
17
+ import { ApiResponse, OrdersType } from '../../../types';
18
18
  import { notification } from 'antd';
19
19
  import { useClientPortal } from '../../../../store';
20
20
 
@@ -25,10 +25,9 @@ function OrderDetailsFooter() {
25
25
  // const updateOrder = useUpdateOrder();
26
26
  const [errorState] = useAtom(errorAtom);
27
27
  const [, setRecallAuditLog] = useGlobalStateHitAuditLog();
28
- const [orderStaticData] = useOrderStaticData();
29
28
  const [, setRecallOrders] = useGlobalStateHitOrder();
30
29
  const [isClientPortal] = useClientPortal();
31
-
30
+ const [, setRecalling] = useLiveRecalling();
32
31
  //update order
33
32
  const { fetchData: callUpdateOrderAPI } = useAxios<{
34
33
  data: ApiResponse[];
@@ -55,7 +54,6 @@ function OrderDetailsFooter() {
55
54
  'order_communications',
56
55
  'updated_at',
57
56
  'updated_by',
58
- 'order_services',
59
57
  ];
60
58
  const filteredOrderDetails = filterObject(
61
59
  orderDetails,
@@ -66,97 +64,74 @@ function OrderDetailsFooter() {
66
64
  keysToRemovefromOrders
67
65
  );
68
66
 
69
- const newOrderServices =
70
- orderDetails?.order_services?.length > 0 &&
71
- orderDetails?.order_services?.sort(
72
- (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
73
- );
74
-
75
- const prevOrderServices =
76
- prevOrderDetails?.order_services?.length > 0 &&
77
- prevOrderDetails?.order_services.sort(
78
- (a: OrderServiceType, b: OrderServiceType) => a.id! - b.id!
79
- );
80
-
81
- const newOrderServicesSorted = JSON.stringify(newOrderServices);
82
- const prevOrderServicesSorted = JSON.stringify(prevOrderServices);
83
67
  const orderDetailsSorted = JSON.stringify(filteredOrderDetails);
84
68
  const prevOrderDetailsSorted = JSON.stringify(filteredPrevOrderDetails);
85
- const isSame =
86
- orderDetailsSorted === prevOrderDetailsSorted &&
87
- newOrderServicesSorted === prevOrderServicesSorted;
69
+ const isSame = orderDetailsSorted === prevOrderDetailsSorted;
88
70
  return !isSame;
89
71
  };
90
72
 
91
73
  const onSave = async () => {
92
74
  setRecallAuditLog(false);
93
75
  setRecallOrders(false);
76
+ setRecalling(false);
94
77
  const payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
95
- const clone = [...orderDetails?.order_services];
96
78
 
97
- // ASSEMBLE AND DISASSEMBLE SERVICES CHECK FOR ASSEMBLE TYPE
98
- const assembleOrderService = orderStaticData?.order_service_list?.find(
99
- (x: any) => x?.type?.toLowerCase() === 'assemble'
100
- );
101
- const disassembleOrderService = orderStaticData?.order_service_list?.find(
102
- (x: any) => x?.type?.toLowerCase() === 'disassemble'
103
- );
79
+ const serviceKeys = [
80
+ 'assemble',
81
+ 'disassemble',
82
+ 'unpack_items',
83
+ 'collect_disposal',
84
+ 'take_packaging_away',
85
+ 'assembly_type',
86
+ ];
104
87
 
105
- const assemblyTypeService = clone?.find(
106
- (x: any) => x?.order_service_list_id === assembleOrderService?.id
107
- );
88
+ let orderServicesPayload: Record<string, any> = {};
89
+
90
+ const includesKey = serviceKeys.some(key => key in payload);
91
+
92
+ if (includesKey) {
93
+ for (const key of serviceKeys) {
94
+ orderServicesPayload[key as keyof typeof payload] =
95
+ key in payload
96
+ ? payload[key as keyof typeof payload]
97
+ : orderDetails[key as keyof OrdersType];
98
+ delete payload[key as keyof typeof payload];
99
+ if (
100
+ orderServicesPayload?.assemble === false &&
101
+ orderServicesPayload?.disassemble === false
102
+ ) {
103
+ orderServicesPayload.assembly_type = null;
104
+ }
105
+ }
106
+ }
108
107
 
109
- const disassemblyTypeService = clone?.find(
110
- (x: any) => x?.order_service_list_id === disassembleOrderService?.id
111
- );
108
+ if (Object.keys(orderServicesPayload).length > 0) {
109
+ payload.order_services = [orderServicesPayload];
110
+ }
112
111
 
113
- if (
114
- assemblyTypeService !== undefined &&
115
- assemblyTypeService?.is_deleted === false &&
116
- (assemblyTypeService?.service_category_id === undefined ||
117
- assemblyTypeService?.service_category_id === null)
118
- ) {
119
- notification.info({
120
- message: 'Info',
121
- description: 'Assembly Type is required',
112
+ let response = (await callUpdateOrderAPI({
113
+ payload: [payload],
114
+ })) as {
115
+ code: number | null;
116
+ error?: string | null | undefined;
117
+ [key: string]: any;
118
+ };
119
+ // const response = await updateOrder([payload]);
120
+ setRecallOrders(true);
121
+ if (response.code == 200 && response?.data?.length > 0) {
122
+ notification.success({
123
+ message: 'Success',
124
+ description: `${response?.message}`,
122
125
  });
123
- return;
124
- } else if (
125
- disassemblyTypeService !== undefined &&
126
- disassemblyTypeService?.is_deleted === false &&
127
- (disassemblyTypeService?.service_category_id === undefined ||
128
- disassemblyTypeService?.service_category_id === null)
129
- ) {
130
- notification.info({
131
- message: 'Info',
132
- description: 'Assembly Type is required',
126
+ setOrderDetails(response?.data[0]);
127
+ setPrevOrderDetails(response?.data[0]);
128
+ setCustomerInfo({
129
+ recipient_name: response?.data[0]?.order_recipient?.recipient_name,
130
+ postcode: response?.data[0]?.order_recipient?.postcode,
133
131
  });
134
- return;
132
+ setRecallAuditLog(true);
135
133
  } else {
136
- let response = (await callUpdateOrderAPI({
137
- payload: [payload],
138
- })) as {
139
- code: number | null;
140
- error?: string | null | undefined;
141
- [key: string]: any;
142
- };
143
- // const response = await updateOrder([payload]);
144
- setRecallOrders(true);
145
- if (response.code == 200 && response?.data?.length > 0) {
146
- notification.success({
147
- message: 'Success',
148
- description: `${response?.message}`,
149
- });
150
- setOrderDetails(response?.data[0]);
151
- setPrevOrderDetails(response?.data[0]);
152
- setCustomerInfo({
153
- recipient_name: response?.data[0]?.order_recipient?.recipient_name,
154
- postcode: response?.data[0]?.order_recipient?.postcode,
155
- });
156
- setRecallAuditLog(true);
157
- } else {
158
- setOrderDetails(prevOrderDetails);
159
- }
134
+ setOrderDetails(prevOrderDetails);
160
135
  }
161
136
  };
162
137