hplx-feature-library 1.0.170 → 1.0.172

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 (168) hide show
  1. package/dist/AllInvestigations/index.js +1 -1
  2. package/dist/AllInvestigationsTable-C3aTtdGN.cjs +79 -0
  3. package/dist/{AllInvestigationsTable-Dj3AKVVv.js → AllInvestigationsTable-C7jrmW8z.js} +6145 -5857
  4. package/dist/Attachments/components/document-canvas/document-pen-tool.d.ts +1 -1
  5. package/dist/Attachments/components/drag-drop-overlay.d.ts +1 -1
  6. package/dist/Attachments/components/edit-document-modal.d.ts +1 -1
  7. package/dist/Attachments/components/uploading-toast.d.ts +1 -1
  8. package/dist/Attachments/context/index.d.ts +2 -2
  9. package/dist/Attachments/hooks/useDropdownPosition.d.ts +1 -1
  10. package/dist/Attachments/index.js +12015 -10605
  11. package/dist/CameraCapture/index.d.ts +1 -1
  12. package/dist/PediatricsCalculator/components/PediatricsCalculatorTableContext.d.ts +1 -1
  13. package/dist/PediatricsCalculator/index.js +1 -1
  14. package/dist/PediatricsCalculatorTable-Be2H_OXh.js +2156 -0
  15. package/dist/PediatricsCalculatorTable-fk_QinWG.cjs +40 -0
  16. package/dist/ReusableTable/context/TableContextBase.d.ts +1 -1
  17. package/dist/TrendGraphs/context/index.d.ts +1 -1
  18. package/dist/components/{customDropdown/CustomDropdown.d.ts → CustomDropdown.d.ts} +2 -2
  19. package/dist/components/{toggleButtons/ToggleButtons.d.ts → ToggleButtons.d.ts} +1 -1
  20. package/dist/hplx-feature-library.css +1 -1
  21. package/dist/index-4whwJbrk.js +6867 -0
  22. package/dist/index-C6KQLMQs.cjs +92 -0
  23. package/dist/index.d.ts +0 -4
  24. package/dist/index.js +4 -12
  25. package/dist/types/AllInvestigationTypes.d.ts +0 -2
  26. package/package.json +6 -51
  27. package/dist/APIAction--DyoXs57.js +0 -3752
  28. package/dist/APIAction-B5XQnkiF.cjs +0 -9
  29. package/dist/AlertPopup/index.js +0 -79
  30. package/dist/AllInvestigationsTable-aw_zEJj_.cjs +0 -79
  31. package/dist/CustomDropdown/index.js +0 -256
  32. package/dist/DateTimePicker/DateAndTimePicker/index.js +0 -5930
  33. package/dist/PatientAddEdit/index.js +0 -1662
  34. package/dist/PatientPopup/action/APIAction.d.ts +0 -65
  35. package/dist/PatientPopup/app/PatientPopupContainer.d.ts +0 -6
  36. package/dist/PatientPopup/app/PatientPopupContext.d.ts +0 -30
  37. package/dist/PatientPopup/common/common.d.ts +0 -14
  38. package/dist/PatientPopup/components/Lab/HPLXLab.d.ts +0 -8
  39. package/dist/PatientPopup/components/Lab/LISLab.d.ts +0 -8
  40. package/dist/PatientPopup/components/Lab/LabTable.d.ts +0 -5
  41. package/dist/PatientPopup/components/Lab/index.d.ts +0 -5
  42. package/dist/PatientPopup/components/Loader/Loader.d.ts +0 -2
  43. package/dist/PatientPopup/components/Pagination.d.ts +0 -9
  44. package/dist/PatientPopup/components/Profile/Abha.d.ts +0 -11
  45. package/dist/PatientPopup/components/Profile/PatientDetailsModal.d.ts +0 -1
  46. package/dist/PatientPopup/components/Profile/Profile.d.ts +0 -11
  47. package/dist/PatientPopup/components/Profile/Sms.d.ts +0 -2
  48. package/dist/PatientPopup/components/Visits/Table.d.ts +0 -11
  49. package/dist/PatientPopup/components/Visits/index.d.ts +0 -15
  50. package/dist/PatientPopup/components/addBills/AddBillFooter.d.ts +0 -2
  51. package/dist/PatientPopup/components/addBills/AddBills.d.ts +0 -5
  52. package/dist/PatientPopup/components/addBills/AddBillsTable.d.ts +0 -17
  53. package/dist/PatientPopup/components/addBills/DropDown.d.ts +0 -15
  54. package/dist/PatientPopup/components/appointment/AllAppts.d.ts +0 -8
  55. package/dist/PatientPopup/components/appointment/Appointment.d.ts +0 -2
  56. package/dist/PatientPopup/components/appointment/AppointmentsTable.d.ts +0 -10
  57. package/dist/PatientPopup/components/bills/Bills.d.ts +0 -6
  58. package/dist/PatientPopup/components/bills/BillsTable.d.ts +0 -11
  59. package/dist/PatientPopup/components/deposit/DepositSection.d.ts +0 -9
  60. package/dist/PatientPopup/components/mainNavItem/MainNavItem.d.ts +0 -13
  61. package/dist/PatientPopup/components/patientPopupBody/PatientPopupBody.d.ts +0 -8
  62. package/dist/PatientPopup/components/patientPopupHeader/PatientPopupHeader.d.ts +0 -10
  63. package/dist/PatientPopup/components/patientPopupSummary/BillSummary.d.ts +0 -19
  64. package/dist/PatientPopup/components/patientPopupSummary/ConsultationDetails.d.ts +0 -14
  65. package/dist/PatientPopup/components/patientPopupSummary/DeleteItem.d.ts +0 -11
  66. package/dist/PatientPopup/components/patientPopupSummary/DepositRefundSummary.d.ts +0 -8
  67. package/dist/PatientPopup/components/patientPopupSummary/LabServiceDetails.d.ts +0 -13
  68. package/dist/PatientPopup/components/patientPopupSummary/OtherServiceDetails.d.ts +0 -13
  69. package/dist/PatientPopup/components/patientPopupSummary/PatientPopupSummary.d.ts +0 -8
  70. package/dist/PatientPopup/components/patientPopupSummary/PaymentCard.d.ts +0 -25
  71. package/dist/PatientPopup/components/patientPopupSummary/ServiceLevelBillSummary.d.ts +0 -18
  72. package/dist/PatientPopup/components/payments/DepositRefundTable.d.ts +0 -14
  73. package/dist/PatientPopup/components/payments/OtherServicesTable.d.ts +0 -16
  74. package/dist/PatientPopup/components/payments/PaymentEditModal.d.ts +0 -15
  75. package/dist/PatientPopup/components/payments/PaymentHeader.d.ts +0 -7
  76. package/dist/PatientPopup/components/payments/Payments.d.ts +0 -5
  77. package/dist/PatientPopup/components/payments/PaymentsTable.d.ts +0 -14
  78. package/dist/PatientPopup/constants/AppConstants.d.ts +0 -123
  79. package/dist/PatientPopup/index.d.ts +0 -1
  80. package/dist/PatientPopup/index.js +0 -135376
  81. package/dist/PatientPopup/types/hplxAPITypes.d.ts +0 -37
  82. package/dist/PatientPopup/utils/PrintFontLoader.d.ts +0 -4
  83. package/dist/PatientPopup/utils/helperFunctions.d.ts +0 -3
  84. package/dist/PediatricsCalculatorTable-CTA61g3h.cjs +0 -1
  85. package/dist/PediatricsCalculatorTable-QgonqxbR.js +0 -833
  86. package/dist/ReusableModal-CIgDYOWZ.cjs +0 -1
  87. package/dist/ReusableModal-pSi21hnc.js +0 -29
  88. package/dist/Subscription/components/SubscriptionBadge.d.ts +0 -2
  89. package/dist/ToggleButtons/index.js +0 -17
  90. package/dist/changePasswordModal/APIAction/APIActions.d.ts +0 -8
  91. package/dist/changePasswordModal/component/ChangePasswordModal.d.ts +0 -14
  92. package/dist/clsx-C11secjj.cjs +0 -1
  93. package/dist/clsx-OuTLNxxd.js +0 -16
  94. package/dist/common/APIAction/APIAction.d.ts +0 -28
  95. package/dist/common/components/BorderFullWidth.d.ts +0 -2
  96. package/dist/common/components/table/ExistingPatients.d.ts +0 -17
  97. package/dist/common/editRibbon/EditRibbon.d.ts +0 -9
  98. package/dist/common/utils/NetworkInstance.d.ts +0 -4
  99. package/dist/common/utils/common-utils.d.ts +0 -36
  100. package/dist/components/PatientAddEdit.d.ts +0 -3
  101. package/dist/components/alertPopup/index.d.ts +0 -1
  102. package/dist/components/customDropdown/index.d.ts +0 -1
  103. package/dist/components/dateTimePicker/DateAndTimePicker.d.ts +0 -21
  104. package/dist/components/dateTimePicker/index.d.ts +0 -1
  105. package/dist/components/toggleButtons/index.d.ts +0 -1
  106. package/dist/constants/CommonConstant.d.ts +0 -70
  107. package/dist/dayjs.min-BbV4duaj.js +0 -284
  108. package/dist/dayjs.min-DXp74Ozx.cjs +0 -1
  109. package/dist/fonts/AnekMalayalam-Bold.ttf +0 -0
  110. package/dist/fonts/AnekMalayalam-Regular.ttf +0 -0
  111. package/dist/fonts/Arial-Bold-Italic.ttf +0 -0
  112. package/dist/fonts/Arial-Bold.ttf +0 -0
  113. package/dist/fonts/Arial-Italic.ttf +0 -0
  114. package/dist/fonts/Arial.ttf +0 -0
  115. package/dist/fonts/IndianRupee.ttf +0 -0
  116. package/dist/fonts/MuktaMaheePunjabi-Bold.ttf +0 -0
  117. package/dist/fonts/MuktaMaheePunjabi-Regular.ttf +0 -0
  118. package/dist/fonts/Noto-Sans-Telugu-Bold.ttf +0 -0
  119. package/dist/fonts/Noto-Sans-Telugu-Regular.ttf +0 -0
  120. package/dist/fonts/NotoNastaliqUrdu-Bold.ttf +0 -0
  121. package/dist/fonts/NotoNastaliqUrdu-Regular.ttf +0 -0
  122. package/dist/fonts/NotoSansArabic-Bold.ttf +0 -0
  123. package/dist/fonts/NotoSansArabic.ttf +0 -0
  124. package/dist/fonts/NotoSansHindi-Bold.ttf +0 -0
  125. package/dist/fonts/NotoSansHindi.ttf +0 -0
  126. package/dist/fonts/NotoSansKannada-Bold.ttf +0 -0
  127. package/dist/fonts/NotoSansKannada.ttf +0 -0
  128. package/dist/fonts/NotoSansOriya-Bold.ttf +0 -0
  129. package/dist/fonts/NotoSansOriya.ttf +0 -0
  130. package/dist/fonts/NotoSansTamil-Bold.ttf +0 -0
  131. package/dist/fonts/NotoSansTamil.ttf +0 -0
  132. package/dist/fonts/NotoSerifGujarati-Bold.ttf +0 -0
  133. package/dist/fonts/NotoSerifGujarati-Regular.ttf +0 -0
  134. package/dist/fonts/Roboto-Regular.ttf +0 -0
  135. package/dist/fonts/Times-Bold-Italic.ttf +0 -0
  136. package/dist/fonts/Times-Bold.ttf +0 -0
  137. package/dist/fonts/Times-Italic.ttf +0 -0
  138. package/dist/fonts/Times.ttf +0 -0
  139. package/dist/fonts/TiroBangla-Bold.ttf +0 -0
  140. package/dist/fonts/TiroBangla-Regular.ttf +0 -0
  141. package/dist/fonts/Verdana-Bold-Italic.ttf +0 -0
  142. package/dist/fonts/Verdana-Bold.ttf +0 -0
  143. package/dist/fonts/Verdana-Italic.ttf +0 -0
  144. package/dist/fonts/Verdana.ttf +0 -0
  145. package/dist/hooks/useMediaQuery.d.ts +0 -1
  146. package/dist/index-DQlbIHh3.cjs +0 -102
  147. package/dist/index-DkA8S5IK.cjs +0 -32
  148. package/dist/index-sG1tIMJ6.js +0 -7242
  149. package/dist/index-vVtPa2-N.js +0 -961
  150. package/dist/nineDots/NineDotsTypes.d.ts +0 -22
  151. package/dist/nineDots/NineDotsUtils.d.ts +0 -3
  152. package/dist/nineDots/nineDots.d.ts +0 -3
  153. package/dist/parseISO-AwyR5Nhg.cjs +0 -1
  154. package/dist/parseISO-Cso9HWPX.js +0 -1414
  155. package/dist/searchPatients/SearchPatients.d.ts +0 -11
  156. package/dist/types/APIEndPoints.d.ts +0 -11
  157. package/dist/types/ApiResponseTypes.d.ts +0 -290
  158. package/dist/types/CommonTypes.d.ts +0 -255
  159. package/dist/types/PatientAddEditTypes/index.js +0 -1
  160. package/dist/types/PatientAddEditTypes.d.ts +0 -7
  161. package/dist/types/PatientPopupTypes/index.js +0 -1
  162. package/dist/types/PatientPopupTypes.d.ts +0 -836
  163. package/dist/userProfile/APIAction/APIActions.d.ts +0 -18
  164. package/dist/userProfile/UserProfile.d.ts +0 -18
  165. package/dist/userProfile/UserProfileItem.d.ts +0 -7
  166. package/dist/warning-BozzKWdr.js +0 -38
  167. package/dist/warning-W0tkkrLJ.cjs +0 -1
  168. /package/dist/components/{alertPopup/AlertPopup.d.ts → AlertPopup.d.ts} +0 -0
@@ -1,833 +0,0 @@
1
- import { j as e, b as k, O as ge, d as Y, g as xe, K as oe } from "./index-sG1tIMJ6.js";
2
- import le, { createContext as ye, useContext as _e, useState as W, useEffect as J, useMemo as Z, useCallback as G, forwardRef as be, useImperativeHandle as we } from "react";
3
- import { C_MedicineCalculatorList as ae, C_FrequencyDosageMap as ce, C_MedicineTypeList as te, C_MedicineFrequencyList as de, C_DefaultMgKgFields as je, C_DefaultMlKgFields as ve, C_Table_Column_Name as Ce } from "./constants/PediatricsCalculatorConstants/index.js";
4
- import g from "./CustomDropdown/index.js";
5
- import Ie from "./AlertPopup/index.js";
6
- import { M as Ne } from "./index-vVtPa2-N.js";
7
- const fe = ye(null), he = () => {
8
- const i = _e(fe);
9
- if (!i) throw new Error("usePediatricsCalculatorTableContext must be used inside a MedicineTableProvider");
10
- return i;
11
- }, Me = ({
12
- effectiveEditMode: i,
13
- rowData: a,
14
- isSavedToLibrary: x,
15
- onSave: _,
16
- onCancel: b,
17
- onEdit: w,
18
- onCheckboxToggle: o
19
- }) => {
20
- const { variant: j, externallyTriggeredEditMode: A, setRowToDelete: v, openPopupForRow: E } = he();
21
- return j === "standard" ? i ? /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg ", children: [
22
- /* @__PURE__ */ e.jsx(
23
- "button",
24
- {
25
- className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hfl-border-r-1 hover:hfl-bg-Primary-50",
26
- onClick: _,
27
- children: /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text xs", className: "hfl-text-Blue_gray-800", children: "Save" })
28
- }
29
- ),
30
- /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-2 hfl-text-Error-600 hover:hfl-bg-Error-50", onClick: b, children: /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text xs", className: "", children: "Cancel" }) })
31
- ] }) : /* @__PURE__ */ e.jsxs("div", { className: "hfl-grid hfl-grid-cols-[1fr_1fr_1fr] hfl-border-1 hfl-border-Gray-200 hfl-rounded-lg", children: [
32
- /* @__PURE__ */ e.jsx("button", { className: "hfl-px-3 hfl-py-1 hfl-text-Blue_gray-800 hover:hfl-bg-Primary-50", onClick: w, children: /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text xs", className: "", children: "Edit" }) }),
33
- /* @__PURE__ */ e.jsx(
34
- "button",
35
- {
36
- className: "hfl-px-3 hfl-py-2 hfl-text-Blue_gray-800 hfl-border-x-1 hover:hfl-bg-Primary-50",
37
- onClick: () => E?.(a),
38
- children: /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text xs", className: "", children: "Copy" })
39
- }
40
- ),
41
- /* @__PURE__ */ e.jsx(
42
- "button",
43
- {
44
- className: "hx_delete hfl-px-3 hfl-py-2 hfl-text-Error-500 hover:hfl-bg-Error-50",
45
- onClick: () => v?.(a.rowId)
46
- }
47
- )
48
- ] }) : /* @__PURE__ */ e.jsx(
49
- ge,
50
- {
51
- disabled: !A,
52
- text: "Save this to Pediatric Calculator Library ",
53
- id: a.rowId,
54
- size: "md",
55
- onClick: o,
56
- isMarked: x ?? !1,
57
- checkboxClasses: "hfl-mt-2",
58
- checkBoxInnerDivClasses: "hfl-text-Blue-600 hfl-bg-Blue-50"
59
- },
60
- a.rowId
61
- );
62
- };
63
- var ne, ue;
64
- function Te() {
65
- if (ue) return ne;
66
- ue = 1;
67
- var i = "Expected a function", a = NaN, x = "[object Symbol]", _ = /^\s+|\s+$/g, b = /^[-+]0x[0-9a-f]+$/i, w = /^0b[01]+$/i, o = /^0o[0-7]+$/i, j = parseInt, A = typeof Y == "object" && Y && Y.Object === Object && Y, v = typeof self == "object" && self && self.Object === Object && self, E = A || v || Function("return this")(), F = Object.prototype, $ = F.toString, O = Math.max, n = Math.min, d = function() {
68
- return E.Date.now();
69
- };
70
- function M(s, p, f) {
71
- var u, D, I, r, t, N, y = 0, q = !1, R = !1, l = !0;
72
- if (typeof s != "function")
73
- throw new TypeError(i);
74
- p = z(p) || 0, T(f) && (q = !!f.leading, R = "maxWait" in f, I = R ? O(z(f.maxWait) || 0, p) : I, l = "trailing" in f ? !!f.trailing : l);
75
- function c(m) {
76
- var K = u, X = D;
77
- return u = D = void 0, y = m, r = s.apply(X, K), r;
78
- }
79
- function h(m) {
80
- return y = m, t = setTimeout(P, p), q ? c(m) : r;
81
- }
82
- function S(m) {
83
- var K = m - N, X = m - y, re = p - K;
84
- return R ? n(re, I - X) : re;
85
- }
86
- function L(m) {
87
- var K = m - N, X = m - y;
88
- return N === void 0 || K >= p || K < 0 || R && X >= I;
89
- }
90
- function P() {
91
- var m = d();
92
- if (L(m))
93
- return se(m);
94
- t = setTimeout(P, S(m));
95
- }
96
- function se(m) {
97
- return t = void 0, l && u ? c(m) : (u = D = void 0, r);
98
- }
99
- function pe() {
100
- t !== void 0 && clearTimeout(t), y = 0, u = N = D = t = void 0;
101
- }
102
- function me() {
103
- return t === void 0 ? r : se(d());
104
- }
105
- function ee() {
106
- var m = d(), K = L(m);
107
- if (u = arguments, D = this, N = m, K) {
108
- if (t === void 0)
109
- return h(N);
110
- if (R)
111
- return t = setTimeout(P, p), c(N);
112
- }
113
- return t === void 0 && (t = setTimeout(P, p)), r;
114
- }
115
- return ee.cancel = pe, ee.flush = me, ee;
116
- }
117
- function T(s) {
118
- var p = typeof s;
119
- return !!s && (p == "object" || p == "function");
120
- }
121
- function C(s) {
122
- return !!s && typeof s == "object";
123
- }
124
- function U(s) {
125
- return typeof s == "symbol" || C(s) && $.call(s) == x;
126
- }
127
- function z(s) {
128
- if (typeof s == "number")
129
- return s;
130
- if (U(s))
131
- return a;
132
- if (T(s)) {
133
- var p = typeof s.valueOf == "function" ? s.valueOf() : s;
134
- s = T(p) ? p + "" : p;
135
- }
136
- if (typeof s != "string")
137
- return s === 0 ? s : +s;
138
- s = s.replace(_, "");
139
- var f = w.test(s);
140
- return f || o.test(s) ? j(s.slice(2), f ? 2 : 8) : b.test(s) ? a : +s;
141
- }
142
- return ne = M, ne;
143
- }
144
- var De = Te();
145
- const Se = /* @__PURE__ */ xe(De), ie = (i, a) => {
146
- const x = parseFloat(i), _ = parseFloat(a);
147
- if (!i || !a || isNaN(x) || isNaN(_) || _ === 0)
148
- return "";
149
- const b = x / _;
150
- return Number.isInteger(b) ? b.toString(10) : b.toFixed(3).replace(/\.?0+$/, "");
151
- }, V = (i) => /^(\d+)?(\.)?(\d*)?$/.test(i), B = ({ label: i, children: a }) => /* @__PURE__ */ e.jsxs(
152
- k,
153
- {
154
- variant: "Regular",
155
- type: "Text sm",
156
- className: "hfl-grid hfl-grid-cols-2 hfl-items-center hfl-text-Blue_gray-800 hfl-justify-between hfl-gap-8",
157
- children: [
158
- /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
159
- i,
160
- ":"
161
- ] }),
162
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex-1 hfl-min-w-0", children: a })
163
- ]
164
- }
165
- ), H = ({ label: i, value: a }) => /* @__PURE__ */ e.jsxs(k, { variant: "Regular", type: "Text sm", className: "hfl-flex hfl-text-Blue_gray-800 hfl-gap-1", children: [
166
- /* @__PURE__ */ e.jsxs("span", { className: "hfl-flex-shrink-0", children: [
167
- i,
168
- ":"
169
- ] }),
170
- /* @__PURE__ */ e.jsx(k, { variant: "Bold", type: "Text sm", className: "hfl-text-Blue_gray-800 hfl-break-words hfl-min-w-0", children: a || "--" })
171
- ] }), Q = ({ children: i, className: a = "" }) => /* @__PURE__ */ e.jsx(
172
- k,
173
- {
174
- variant: "Regular",
175
- type: "Text sm",
176
- className: `hfl-text-Blue_gray-800 hfl-px-2 hfl-break-words hfl-overflow-wrap-anywhere hfl-min-w-0 ${a}`,
177
- children: i
178
- }
179
- ), ke = le.memo(
180
- function({ rowData: a, isEditing: x, setIsEditing: _, onSaveRow: b, allowCustomMedicineInput: w }) {
181
- const {
182
- variant: o,
183
- externallyTriggeredEditMode: j,
184
- externallyTriggeredEditRowIds: A,
185
- getMedicineOptions: v,
186
- onRowChange: E,
187
- onRowDelete: F
188
- } = he(), [$, O] = W([]), [n, d] = W(a), [M, T] = W(a.medicine_name);
189
- J(() => {
190
- x || T(a.medicine_name);
191
- }, [a.medicine_name, x]), J(() => {
192
- x || d(a);
193
- }, [a, x]);
194
- const C = async (l) => (await v?.(l))?.map((h) => ({
195
- label: h.doctorMedicineName,
196
- value: h
197
- })) || [], z = j || A?.includes(a.rowId) || x, s = Z(() => n.out_of_range || a.out_of_range, [n.out_of_range, a.out_of_range]), p = Z(() => n?.isDosageMismatch || a?.isDosageMismatch, [n?.isDosageMismatch, a?.isDosageMismatch]), f = le.useMemo(() => n.calculation_type === ae[0] ? n.calculation_fields : null, [n.calculation_fields, n.calculation_type]), u = le.useMemo(() => n.calculation_type === ae[1] ? n.calculation_fields : null, [n.calculation_fields, n.calculation_type]), D = (l, c) => {
198
- let h;
199
- if (l === "calculation_type") {
200
- const S = c, L = {
201
- frequency: n.calculation_fields.frequency,
202
- pedia_dosage: o === "standard" ? n.calculation_fields.pedia_dosage : n.pedia_dosage
203
- };
204
- h = {
205
- ...n,
206
- calculation_type: S,
207
- calculation_fields: S === "mg/kg/dose" ? { ...je, ...L } : { ...ve, ...L }
208
- };
209
- } else
210
- h = {
211
- ...n,
212
- [l]: c
213
- };
214
- d(h), o === "prescription" && I(h, l);
215
- }, I = Z(
216
- () => Se((l, c) => {
217
- E?.(l, c || void 0);
218
- }, 500),
219
- [E]
220
- ), r = Z(() => /* @__PURE__ */ e.jsxs("div", { className: "hfl-mb-1 hfl-flex hfl-w-max hfl-items-center hfl-rounded hfl-border-1 hfl-border-Warning-400 hfl-bg-Warning-50 hfl-p-1 hfl-px-2", children: [
221
- /* @__PURE__ */ e.jsx("div", { className: "hx_warning hfl-text-Error-400" }),
222
- /* @__PURE__ */ e.jsx(k, { variant: "Regular", type: "Text sm", className: "hfl-px-2 hfl-text-1 hfl-text-Error-500", children: "Dosage exceed safety limits" })
223
- ] }), []);
224
- J(() => () => {
225
- I.cancel();
226
- }, [I]);
227
- const t = G(
228
- (l, c) => {
229
- d((h) => {
230
- let S = { ...h.calculation_fields, [l]: c };
231
- if (l === "frequency" && o === "standard") {
232
- const P = ce[c] || [];
233
- P.length > 0 && (S = {
234
- ...S,
235
- pedia_dosage: P[0]
236
- });
237
- }
238
- const L = {
239
- ...h,
240
- calculation_fields: S
241
- };
242
- return o === "prescription" && I(L, l), L;
243
- });
244
- },
245
- [I, o]
246
- ), N = async () => {
247
- const l = {
248
- ...n,
249
- calculation_fields: { ...n.calculation_fields }
250
- };
251
- await b?.(l) && I({ ...l, isNewlyAdded: !1, isEditing: !1 });
252
- }, y = async () => {
253
- if (!a.medicine_name || a.medicine_name.trim() === "") {
254
- F?.(a.rowId);
255
- return;
256
- }
257
- d(a), o === "standard" && _(!1);
258
- }, q = (l) => o === "prescription" && (l === "medicine_name" || l === "generic_name" || l === "type" || l === "calculation_type") ? !1 : z, R = () => {
259
- const l = !(n?.isSavedToLibrary ?? !1), c = { ...n, isSavedToLibrary: l };
260
- d(c), I(c, "isSavedToLibrary");
261
- };
262
- return /* @__PURE__ */ e.jsxs(
263
- "div",
264
- {
265
- className: `medicine-row hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-px-2 hfl-py-1 hfl-border-b-1 hfl-border-Gray-200 ${z ? "hfl-bg-gradient-to-b hfl-from-White_20 hfl-to-Primary-50" : ""} ${o === "prescription" && !n.pedia_data_available ? "hfl-hidden" : ""}`,
266
- children: [
267
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("medicine_name") ? /* @__PURE__ */ e.jsx(
268
- g,
269
- {
270
- wrapperClass: "hfl-w-full",
271
- btnClassName: "hfl-w-full",
272
- inputClassName: "hfl-w-full",
273
- inputValue: n.medicine_name,
274
- showInput: !0,
275
- disableInputAutoSize: !0,
276
- inputChangeHandler: async (l) => {
277
- if (D("medicine_name", l), l.trim()) {
278
- const c = await C(l);
279
- O(c);
280
- } else
281
- O([]);
282
- },
283
- onInputFocus: async () => {
284
- const l = await C(n.medicine_name);
285
- O(l);
286
- },
287
- onChangeHandler: (l) => {
288
- const c = l.value, h = te.find((S) => S.val === c.medicineType);
289
- d((S) => ({
290
- ...S,
291
- medicine_name: c.doctorMedicineName,
292
- medicine_id: c.medicineId,
293
- generic_name: c.doctorGenericName,
294
- type: h?.type ?? ""
295
- })), T(c.doctorMedicineName);
296
- },
297
- options: $,
298
- isSearchable: !0,
299
- placeholder: "Search medicine",
300
- disabled: !n?.isNewlyAdded,
301
- inputProps: {
302
- onBlur: (l) => {
303
- const c = l.relatedTarget;
304
- if (!(c && c.closest(".custom-dropdown-menu")) && !w) {
305
- const h = n.medicine_name?.trim() || "";
306
- $.some((L) => L.label === h) || d((L) => ({ ...L, medicine_name: M }));
307
- }
308
- }
309
- }
310
- }
311
- ) : /* @__PURE__ */ e.jsx(Q, { children: a.medicine_name }) }),
312
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("generic_name") ? /* @__PURE__ */ e.jsx(
313
- g,
314
- {
315
- wrapperClass: "hfl-w-full",
316
- inputClassName: "hfl-w-full",
317
- btnClassName: "hfl-w-full",
318
- inputValue: n.generic_name,
319
- showInput: !0,
320
- disableInputAutoSize: !0,
321
- inputChangeHandler: (l) => D("generic_name", l),
322
- hideDropdownIcon: !0
323
- }
324
- ) : /* @__PURE__ */ e.jsx(Q, { children: a.generic_name }) }),
325
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("type") ? /* @__PURE__ */ e.jsx(
326
- g,
327
- {
328
- wrapperClass: "hfl-w-full",
329
- btnClassName: "hfl-w-full",
330
- placeholder: "Select",
331
- showInput: !1,
332
- disableInputAutoSize: !0,
333
- selectedOption: (() => {
334
- const l = te.find((c) => c.type === n.type);
335
- return l ? { label: l.type, value: l.type } : void 0;
336
- })(),
337
- options: te.map((l) => ({
338
- label: l.type,
339
- value: l.type
340
- })),
341
- onChangeHandler: (l) => D("type", l.value)
342
- }
343
- ) : /* @__PURE__ */ e.jsx(Q, { children: a.type || "" }) }),
344
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("calculation_type") ? /* @__PURE__ */ e.jsx(
345
- g,
346
- {
347
- wrapperClass: "hfl-w-full",
348
- btnClassName: "hfl-w-full",
349
- placeholder: "Select",
350
- showInput: !1,
351
- disableInputAutoSize: !0,
352
- selectedOption: { label: n.calculation_type, value: n.calculation_type },
353
- options: ae.map((l) => ({ label: l, value: l })),
354
- onChangeHandler: (l) => D("calculation_type", l.value)
355
- }
356
- ) : /* @__PURE__ */ e.jsx(Q, { children: a.calculation_type }) }),
357
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-w-full hfl-flex-col hfl-gap-2 hfl-py-2.5 hfl-px-2", children: q("calculation_fields") ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
358
- f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
359
- /* @__PURE__ */ e.jsx(B, { label: "Drug Strength", children: /* @__PURE__ */ e.jsx(
360
- g,
361
- {
362
- wrapperClass: "hfl-w-full",
363
- placeholder: "e.g., 250",
364
- showInput: !0,
365
- hideDropdownIcon: !0,
366
- disableInputAutoSize: !0,
367
- inputType: "text",
368
- inputValue: f.drug_strength || "",
369
- inputChangeHandler: (l) => {
370
- V(l) && t("drug_strength", l);
371
- }
372
- }
373
- ) }),
374
- /* @__PURE__ */ e.jsx(B, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
375
- g,
376
- {
377
- wrapperClass: "hfl-w-full",
378
- placeholder: "e.g., 15",
379
- showInput: !0,
380
- hideDropdownIcon: !0,
381
- disableInputAutoSize: !0,
382
- inputType: "text",
383
- inputValue: f.dose_mg_kg || "",
384
- inputChangeHandler: (l) => {
385
- V(l) && t("dose_mg_kg", l);
386
- }
387
- }
388
- ) }),
389
- /* @__PURE__ */ e.jsx(B, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
390
- g,
391
- {
392
- wrapperClass: "hfl-w-full",
393
- placeholder: "Frequency",
394
- showInput: !1,
395
- selectedOption: n.calculation_fields.frequency ? {
396
- label: n.calculation_fields.frequency,
397
- value: n.calculation_fields.frequency
398
- } : void 0,
399
- options: de.map((l) => ({ label: l, value: l })),
400
- onChangeHandler: (l) => {
401
- t("frequency", l.value);
402
- }
403
- }
404
- ) }),
405
- /* @__PURE__ */ e.jsx(B, { label: "Max Dose (mg)", children: /* @__PURE__ */ e.jsx(
406
- g,
407
- {
408
- wrapperClass: "hfl-w-full",
409
- placeholder: "Max mg/dose",
410
- showInput: !0,
411
- hideDropdownIcon: !0,
412
- disableInputAutoSize: !0,
413
- inputType: "text",
414
- inputValue: f.max_mg_dose || "",
415
- inputChangeHandler: (l) => {
416
- V(l) && t("max_mg_dose", l);
417
- }
418
- }
419
- ) }),
420
- /* @__PURE__ */ e.jsx(B, { label: "Max Day (mg)", children: /* @__PURE__ */ e.jsx(
421
- g,
422
- {
423
- wrapperClass: "hfl-w-full",
424
- placeholder: "Max mg/day",
425
- showInput: !0,
426
- hideDropdownIcon: !0,
427
- disableInputAutoSize: !0,
428
- inputType: "text",
429
- inputValue: f.max_mg_day || "",
430
- inputChangeHandler: (l) => {
431
- V(l) && t("max_mg_day", l);
432
- }
433
- }
434
- ) })
435
- ] }),
436
- u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
437
- /* @__PURE__ */ e.jsx(B, { label: "Drug Strength/mL", children: /* @__PURE__ */ e.jsx(
438
- g,
439
- {
440
- wrapperClass: "hfl-w-full",
441
- placeholder: "e.g., 250",
442
- showInput: !0,
443
- hideDropdownIcon: !0,
444
- disableInputAutoSize: !0,
445
- inputType: "text",
446
- inputValue: u.drug_strength || "",
447
- inputChangeHandler: (l) => {
448
- V(l) && (t("drug_strength", l), t("dose_ml_kg", ie(u.dose_mg_kg, l)));
449
- }
450
- }
451
- ) }),
452
- /* @__PURE__ */ e.jsx(B, { label: "Dose/mg/kg", children: /* @__PURE__ */ e.jsx(
453
- g,
454
- {
455
- wrapperClass: "hfl-w-full",
456
- placeholder: "e.g., 15",
457
- showInput: !0,
458
- hideDropdownIcon: !0,
459
- disableInputAutoSize: !0,
460
- inputType: "text",
461
- inputValue: u.dose_mg_kg || "",
462
- inputChangeHandler: (l) => {
463
- V(l) && (t("dose_mg_kg", l), t("dose_ml_kg", ie(l, u.drug_strength)));
464
- }
465
- }
466
- ) }),
467
- /* @__PURE__ */ e.jsx(B, { label: "Dose/mL/kg", children: /* @__PURE__ */ e.jsx(
468
- g,
469
- {
470
- wrapperClass: "hfl-w-full",
471
- disabled: !0,
472
- placeholder: "e.g., 5",
473
- showInput: !0,
474
- hideDropdownIcon: !0,
475
- disableInputAutoSize: !0,
476
- inputType: "text",
477
- inputValue: ie(u.dose_mg_kg, u.drug_strength) || "",
478
- inputChangeHandler: (l) => {
479
- V(l) && t("dose_ml_kg", l);
480
- }
481
- }
482
- ) }),
483
- /* @__PURE__ */ e.jsx(B, { label: "Frequency", children: /* @__PURE__ */ e.jsx(
484
- g,
485
- {
486
- wrapperClass: "hfl-w-full",
487
- placeholder: "Frequency",
488
- showInput: !1,
489
- selectedOption: n.calculation_fields.frequency ? {
490
- label: n.calculation_fields.frequency,
491
- value: n.calculation_fields.frequency
492
- } : void 0,
493
- options: de.map((l) => ({ label: l, value: l })),
494
- onChangeHandler: (l) => {
495
- t("frequency", l.value);
496
- }
497
- }
498
- ) }),
499
- /* @__PURE__ */ e.jsx(B, { label: "Max Dose (mL)", children: /* @__PURE__ */ e.jsx(
500
- g,
501
- {
502
- wrapperClass: "hfl-w-full",
503
- placeholder: "Max mL/dose",
504
- showInput: !0,
505
- hideDropdownIcon: !0,
506
- disableInputAutoSize: !0,
507
- inputType: "text",
508
- inputValue: u.max_ml_dose || "",
509
- inputChangeHandler: (l) => {
510
- V(l) && t("max_ml_dose", l);
511
- }
512
- }
513
- ) }),
514
- /* @__PURE__ */ e.jsx(B, { label: "Max Day (mL)", children: /* @__PURE__ */ e.jsx(
515
- g,
516
- {
517
- wrapperClass: "hfl-w-full",
518
- placeholder: "Max mL/day",
519
- showInput: !0,
520
- hideDropdownIcon: !0,
521
- disableInputAutoSize: !0,
522
- inputType: "text",
523
- inputValue: u.max_ml_day || "",
524
- inputChangeHandler: (l) => {
525
- V(l) && t("max_ml_day", l);
526
- }
527
- }
528
- ) })
529
- ] })
530
- ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
531
- f && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
532
- /* @__PURE__ */ e.jsx(H, { label: "Drug Strength", value: f.drug_strength }),
533
- /* @__PURE__ */ e.jsx(H, { label: "Dose/mg/kg", value: f.dose_mg_kg }),
534
- /* @__PURE__ */ e.jsx(H, { label: "Frequency", value: f.frequency }),
535
- /* @__PURE__ */ e.jsx(H, { label: "Max Dose (mg)", value: f.max_mg_dose }),
536
- /* @__PURE__ */ e.jsx(H, { label: "Max Day (mg)", value: f.max_mg_day })
537
- ] }),
538
- u && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
539
- /* @__PURE__ */ e.jsx(H, { label: "Drug Strength/mL", value: u.drug_strength }),
540
- /* @__PURE__ */ e.jsx(H, { label: "Dose/mg/kg", value: u.dose_mg_kg }),
541
- /* @__PURE__ */ e.jsx(H, { label: "Dose/mL/kg", value: u.dose_ml_kg }),
542
- /* @__PURE__ */ e.jsx(H, { label: "Frequency", value: u.frequency }),
543
- /* @__PURE__ */ e.jsx(H, { label: "Max Dose (mL)", value: u.max_ml_dose }),
544
- /* @__PURE__ */ e.jsx(H, { label: "Max Day (mL)", value: u.max_ml_day })
545
- ] })
546
- ] }) }),
547
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: q("pedia_dosage") ? (() => {
548
- const l = n.calculation_fields.frequency, c = ce[l] || [];
549
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
550
- g,
551
- {
552
- wrapperClass: "hfl-w-full",
553
- btnClassName: "hfl-w-full",
554
- inputClassName: "hfl-w-full",
555
- placeholder: "Select",
556
- showInput: o !== "standard",
557
- disableInputAutoSize: !0,
558
- inputValue: o === "standard" ? n.calculation_fields.pedia_dosage : n.pedia_dosage,
559
- inputChangeHandler: (h) => o === "prescription" ? D("pedia_dosage", h) : t("pedia_dosage", h),
560
- selectedOption: o === "standard" ? {
561
- label: n.calculation_fields.pedia_dosage,
562
- value: n.calculation_fields.pedia_dosage
563
- } : void 0,
564
- options: o !== "prescription" ? c.map((h) => ({ label: h, value: h })) : void 0,
565
- onChangeHandler: o !== "prescription" ? (h) => t("pedia_dosage", h.value) : void 0,
566
- hideDropdownIcon: o === "prescription",
567
- showEmptyDropdownPopup: o !== "prescription",
568
- showErrorMsg: o === "prescription" ? s || p : !1,
569
- errorMsg: o === "prescription" && s ? "Dosage Exceeds Safety Limits" : o === "prescription" && p ? "Dosage is in mismatch with selected type of Frequency" : ""
570
- }
571
- ) });
572
- })() : /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-flex-col hfl-h-full hfl-justify-between hfl-min-w-0", children: [
573
- /* @__PURE__ */ e.jsx(Q, { children: o === "prescription" ? a.pedia_dosage : a.calculation_fields.pedia_dosage }),
574
- s && r
575
- ] }) }),
576
- /* @__PURE__ */ e.jsx("div", { className: "hfl-w-full hfl-py-2.5 hfl-min-w-0", children: /* @__PURE__ */ e.jsx(
577
- Me,
578
- {
579
- effectiveEditMode: z,
580
- rowData: a,
581
- isSavedToLibrary: n.isSavedToLibrary ?? !1,
582
- onSave: N,
583
- onCancel: y,
584
- onEdit: () => _(!0),
585
- onCheckboxToggle: R
586
- }
587
- ) })
588
- ]
589
- }
590
- );
591
- },
592
- (i, a) => i.isEditing === a.isEditing && i.rowData.rowId === a.rowData.rowId && i.rowData.isEditing === a.rowData.isEditing && i.rowData.medicine_name === a.rowData.medicine_name && i.rowData.generic_name === a.rowData.generic_name && i.rowData.type === a.rowData.type && i.rowData.pedia_dosage === a.rowData.pedia_dosage && i.rowData.calculation_type === a.rowData.calculation_type && JSON.stringify(i.rowData.calculation_fields) === JSON.stringify(a.rowData.calculation_fields) && i.rowData.out_of_range === a.rowData.out_of_range && i.rowData.isDosageMismatch === a.rowData.isDosageMismatch && i.rowData.calculation_fields.pedia_dosage === a.rowData.calculation_fields.pedia_dosage && i.rowData?.isNewlyAdded === a.rowData?.isNewlyAdded && i.rowData?.pedia_data_available === a.rowData?.pedia_data_available
593
- ), Ee = ({ open: i, onCancel: a, onCopySave: x, rowMedicineData: _, getMedicineOptions: b }) => {
594
- const [w, o] = W([]), [j, A] = W(""), [v, E] = W([]), F = G(
595
- async (d) => {
596
- const T = (await b?.(d))?.map(
597
- (C) => ({
598
- label: C.doctorMedicineName,
599
- value: C
600
- })
601
- );
602
- E(T || []);
603
- },
604
- [b]
605
- );
606
- J(() => {
607
- i && F(j);
608
- }, [j, F, i]);
609
- const $ = (d) => {
610
- const M = d.value;
611
- w.some(
612
- (C) => C.medicineId === M.medicineId && C.doctorMedicineName.trim().toLowerCase() === M.doctorMedicineName.trim().toLowerCase()
613
- ) || o((C) => [...C, M]), A(""), E([]);
614
- }, O = (d) => {
615
- o((M) => M.filter((T) => T.medicineId !== d));
616
- }, n = async () => {
617
- j.trim() || await F("");
618
- };
619
- return /* @__PURE__ */ e.jsxs(
620
- Ne,
621
- {
622
- isOpen: i,
623
- onRequestClose: a,
624
- shouldCloseOnOverlayClick: !1,
625
- style: {
626
- overlay: {
627
- backgroundColor: "rgba(52, 64, 84, 0.5)",
628
- zIndex: 1030
629
- },
630
- content: {
631
- zIndex: 1031,
632
- maxWidth: "600px",
633
- maxHeight: "50vh",
634
- height: "auto",
635
- margin: "auto",
636
- borderRadius: "12px",
637
- padding: "0px",
638
- display: "flex",
639
- flexDirection: "column"
640
- }
641
- },
642
- children: [
643
- /* @__PURE__ */ e.jsx(
644
- k,
645
- {
646
- variant: "Bold",
647
- type: "Text lg",
648
- className: "hfl-text-White hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-2",
649
- children: "Please select medicine to copy"
650
- }
651
- ),
652
- /* @__PURE__ */ e.jsxs("div", { className: "hfl-px-6 hfl-py-5 hfl-flex hfl-flex-col hfl-gap-6 hfl-overflow-y-auto hfl-flex-1", children: [
653
- /* @__PURE__ */ e.jsx(
654
- g,
655
- {
656
- inputValue: j,
657
- showInput: !0,
658
- isSearchable: !0,
659
- disableInputAutoSize: !0,
660
- inputChangeHandler: A,
661
- onChangeHandler: $,
662
- onInputFocus: n,
663
- options: v,
664
- placeholder: "Search for medicines"
665
- }
666
- ),
667
- /* @__PURE__ */ e.jsx("div", { className: "hfl-flex hfl-flex-wrap hfl-gap-2", children: w.map((d) => /* @__PURE__ */ e.jsxs(
668
- "div",
669
- {
670
- className: "hfl-flex hfl-items-center hfl-bg-Gray-100 hfl-px-2 hfl-py-0.5 hfl-rounded-md hfl-gap-1",
671
- children: [
672
- /* @__PURE__ */ e.jsx(k, { variant: "Regular", type: "Text sm", className: "hfl-text-nowrap", children: d.doctorMedicineName }),
673
- /* @__PURE__ */ e.jsx("button", { className: "hfl-text-Blue_gray-800", onClick: () => O(d.medicineId), children: /* @__PURE__ */ e.jsx("i", { className: "hx_close" }) })
674
- ]
675
- },
676
- d.doctorMedicineName + d.medicineId
677
- )) })
678
- ] }),
679
- /* @__PURE__ */ e.jsxs("div", { className: "hfl-flex hfl-justify-end hfl-gap-2.5 hfl-bg-Gray-50 hfl-px-7 hfl-py-3 hfl-border-t hfl-border-Gray-200", children: [
680
- /* @__PURE__ */ e.jsx(oe, { size: "md", textField: "Cancel", onClick: a, hierarchy: "Secondary-Grey" }),
681
- /* @__PURE__ */ e.jsx(
682
- oe,
683
- {
684
- size: "md",
685
- textField: "Save",
686
- disabled: !w || w.length == 0,
687
- onClick: async () => {
688
- await x(_, w) && a();
689
- },
690
- className: "hfl-bg-Primary-600 hfl-text-White disabled:hfl-opacity-50 disabled:hfl-cursor-not-allowed",
691
- hierarchy: "Primary"
692
- }
693
- )
694
- ] })
695
- ]
696
- }
697
- );
698
- }, He = be(
699
- ({
700
- data: i = [],
701
- variant: a,
702
- externallyTriggeredEditRowIds: x = [],
703
- externallyTriggeredEditMode: _ = !1,
704
- allowCustomMedicineInput: b = !0,
705
- getMedicineOptions: w,
706
- onRowChange: o,
707
- onRowDelete: j,
708
- onRowCopy: A,
709
- onSaveRow: v,
710
- externalSaveTrigger: E,
711
- setSearchDisabled: F
712
- }, $) => {
713
- const [O, n] = W(null), [d, M] = W(!1), [T, C] = W(), U = G(
714
- (r, t, N) => {
715
- const y = i.find((R) => R.rowId === r);
716
- if (!y) return;
717
- const q = { ...y, ...t };
718
- o?.(q, N || void 0);
719
- },
720
- [i, o]
721
- ), z = G(async () => {
722
- const r = i.filter((t) => t.isEditing && t.medicine_name);
723
- if (r.length !== 0)
724
- try {
725
- await v?.(r) && r.forEach((N) => {
726
- o?.({ ...N, isEditing: !1 });
727
- });
728
- } catch (t) {
729
- console.error("Bulk save failed", t);
730
- } finally {
731
- F?.(!1);
732
- }
733
- }, [i, v, o, F]);
734
- J(() => {
735
- E && z();
736
- }, [E, z]), J(() => {
737
- const r = i.some((t) => t.isEditing);
738
- F?.(r);
739
- }, [i, F]);
740
- const s = G((r) => {
741
- C(r), M(!0);
742
- }, []), p = G(async () => {
743
- if (O)
744
- try {
745
- await j?.(O);
746
- } catch (r) {
747
- console.error("Delete failed", r);
748
- } finally {
749
- n(null);
750
- }
751
- }, [O, j]), f = G(() => {
752
- n(null);
753
- }, []), u = G(
754
- async (r) => {
755
- try {
756
- return await v?.([r]) ? (o?.({ ...r, isEditing: !1 }), !0) : !1;
757
- } catch (t) {
758
- return console.error("Save row failed", t), !1;
759
- }
760
- },
761
- [v, o]
762
- ), D = G(async () => {
763
- const r = i.filter((t) => t.isEditing && t.medicine_name);
764
- if (r.length === 0) return !0;
765
- try {
766
- const t = await v?.(r);
767
- return t && i.map((y) => y.isEditing ? { ...y, isEditing: !1 } : y).forEach((y) => o?.(y)), !!t;
768
- } catch (t) {
769
- return console.error("External bulk save failed", t), !1;
770
- }
771
- }, [i, v, o]);
772
- we($, () => ({
773
- triggerExternalSave: D
774
- }));
775
- const I = {
776
- variant: a,
777
- externallyTriggeredEditMode: _,
778
- externallyTriggeredEditRowIds: x,
779
- getMedicineOptions: w,
780
- onRowChange: (r, t) => {
781
- U(r.rowId, r, t), o?.(r, t);
782
- },
783
- onRowDelete: j,
784
- onRowCopy: A,
785
- setRowToDelete: n,
786
- openPopupForRow: s
787
- };
788
- return /* @__PURE__ */ e.jsxs("div", { className: "hfl-border-1 hfl-border-Gray-200", children: [
789
- /* @__PURE__ */ e.jsx("div", { className: "table-header hfl-grid hfl-grid-cols-[1.36fr_1.36fr_1.02fr_1.25fr_2.27fr_1.36fr_1.36fr] hfl-gap-2 hfl-py-2 hfl-px-2 hfl-font-bold hfl-border-b-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50", children: Ce.map((r) => /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600", children: r }, r)) }),
790
- /* @__PURE__ */ e.jsxs(fe.Provider, { value: I, children: [
791
- /* @__PURE__ */ e.jsx("div", { className: "table-body", children: i.length === 0 ? /* @__PURE__ */ e.jsx(k, { variant: "Medium", type: "Text sm", className: "hfl-text-Blue_gray-600 hfl-px-2 hfl-py-3", children: "No medicines added" }) : i.map((r) => /* @__PURE__ */ e.jsx(
792
- ke,
793
- {
794
- rowData: r,
795
- isEditing: r.isEditing || !1,
796
- setIsEditing: (t) => U(r.rowId, { isEditing: t }),
797
- onSaveRow: u,
798
- allowCustomMedicineInput: b
799
- },
800
- r.rowId
801
- )) }),
802
- /* @__PURE__ */ e.jsx(
803
- Ie,
804
- {
805
- headingText: "Delete Medicine",
806
- subHeadingText: "Are you sure you want to delete this medicine?",
807
- openState: !!O,
808
- positiveButtonText: "Delete",
809
- negativeButtonText: "Cancel",
810
- positiveActionCallback: p,
811
- negativeActionCallback: f,
812
- classNameNegativeBtn: "hfl-bg-Blue-600",
813
- classNamePositiveBtn: "hfl-bg-Error-500 hover:hfl-bg-Error-700 hfl-text-White",
814
- closePopupCallback: f
815
- }
816
- ),
817
- /* @__PURE__ */ e.jsx(
818
- Ee,
819
- {
820
- open: d,
821
- onCancel: () => M(!1),
822
- onCopySave: A,
823
- rowMedicineData: T,
824
- getMedicineOptions: w
825
- }
826
- )
827
- ] })
828
- ] });
829
- }
830
- );
831
- export {
832
- He as P
833
- };