formanitor 0.0.17 → 0.0.18

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.
package/dist/index.mjs CHANGED
@@ -389,6 +389,26 @@ var FormStore = class {
389
389
  result[field.id] = raw?.text ?? null;
390
390
  return;
391
391
  }
392
+ if (field.type === "ophthal_diagnosis") {
393
+ const raw = values[field.id];
394
+ const formatEye = (eyeData, eyeLabel) => {
395
+ if (!eyeData || typeof eyeData !== "object") return "";
396
+ const entries = Object.entries(eyeData).filter(([, value]) => typeof value === "string" && value.trim()).map(([key, value]) => `${key}: ${value.trim()}`);
397
+ if (entries.length === 0) return "";
398
+ return [eyeLabel, ...entries].join("\n");
399
+ };
400
+ const rightEyeText = formatEye(
401
+ raw?.right_eye ?? raw?.rightEye,
402
+ "Right Eye"
403
+ );
404
+ const leftEyeText = formatEye(
405
+ raw?.left_eye ?? raw?.leftEye,
406
+ "Left Eye"
407
+ );
408
+ const parts = [rightEyeText, leftEyeText].filter(Boolean);
409
+ result[field.id] = parts.length > 0 ? parts.join("\n\n") : null;
410
+ return;
411
+ }
392
412
  if (field.type === "image_upload" || field.type === "signature") {
393
413
  const raw = values[field.id];
394
414
  if (raw !== void 0 && raw !== null && raw !== "") {
@@ -4980,6 +5000,1343 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
4980
5000
  ] })
4981
5001
  ] });
4982
5002
  };
5003
+ var UCVA_OPTIONS = ["", "6/6", "6/9", "6/12", "6/18", "6/24", "6/36", "6/60", "CF", "PL"];
5004
+ var NEAR_VA_OPTIONS = ["", "N4", "N5", "N6", "N8", "N10", "N12", "N14", "N18", "N24", "N36", "<N36"];
5005
+ var PINHOLE_OPTIONS = [
5006
+ "",
5007
+ "PL\u2212",
5008
+ "PL+",
5009
+ "FL",
5010
+ "HM",
5011
+ "CCFCF",
5012
+ "FC",
5013
+ "1/60",
5014
+ "2/60",
5015
+ "3/60",
5016
+ "4/60",
5017
+ "5/60",
5018
+ "6/60",
5019
+ "6/36",
5020
+ "6/24",
5021
+ "6/18",
5022
+ "6/12",
5023
+ "6/9",
5024
+ "6/7.5",
5025
+ "6/6"
5026
+ ];
5027
+ var VA_OPTIONS = UCVA_OPTIONS;
5028
+ var IOP_METHOD_OPTIONS = ["", "NCT", "Goldmann", "Tonopen", "iCare"];
5029
+ function parseFloatOrNull(value) {
5030
+ const trimmed = value.trim();
5031
+ if (!trimmed) return null;
5032
+ const parsed = Number.parseFloat(trimmed);
5033
+ return Number.isFinite(parsed) ? parsed : null;
5034
+ }
5035
+ function parseIntOrNull(value) {
5036
+ const trimmed = value.trim();
5037
+ if (!trimmed) return null;
5038
+ const parsed = Number.parseInt(trimmed, 10);
5039
+ return Number.isFinite(parsed) ? parsed : null;
5040
+ }
5041
+ function ensureRefractionEye(raw) {
5042
+ return {
5043
+ sph: raw?.sph ?? null,
5044
+ cyl: raw?.cyl ?? null,
5045
+ axis: raw?.axis ?? null,
5046
+ va: raw?.va ?? "",
5047
+ pd: raw?.pd ?? null,
5048
+ prism: raw?.prism ?? null
5049
+ };
5050
+ }
5051
+ function ensureAddPowers(raw) {
5052
+ return {
5053
+ right: raw?.right ?? null,
5054
+ left: raw?.left ?? null
5055
+ };
5056
+ }
5057
+ function ensureRefraction(raw) {
5058
+ return {
5059
+ right_eye: ensureRefractionEye(raw?.right_eye),
5060
+ left_eye: ensureRefractionEye(raw?.left_eye),
5061
+ add: ensureAddPowers(raw?.add)
5062
+ };
5063
+ }
5064
+ function ensureUnaidedEyeVa(raw) {
5065
+ return {
5066
+ ucva: raw?.ucva ?? "",
5067
+ pinhole_va: raw?.pinhole_va ?? "",
5068
+ nv: raw?.nv ?? ""
5069
+ };
5070
+ }
5071
+ function ensureIopEye(raw) {
5072
+ return {
5073
+ iop: raw?.iop ?? null,
5074
+ cct: raw?.cct ?? null
5075
+ };
5076
+ }
5077
+ function ensureValue(raw) {
5078
+ const v = raw || {};
5079
+ return {
5080
+ patient_information: {
5081
+ systemic_history: v.patient_information?.systemic_history ?? "",
5082
+ ocular_history: v.patient_information?.ocular_history ?? "",
5083
+ chief_complaints: v.patient_information?.chief_complaints ?? ""
5084
+ },
5085
+ unaided_visual_acuity: {
5086
+ right_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.right_eye),
5087
+ left_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.left_eye)
5088
+ },
5089
+ current_glass_prescription: ensureRefraction(v.current_glass_prescription),
5090
+ iop_pachy_cct: {
5091
+ method: v.iop_pachy_cct?.method ?? "",
5092
+ time: v.iop_pachy_cct?.time ?? "",
5093
+ right_eye: ensureIopEye(v.iop_pachy_cct?.right_eye),
5094
+ left_eye: ensureIopEye(v.iop_pachy_cct?.left_eye)
5095
+ },
5096
+ refraction: ensureRefraction(v.refraction),
5097
+ dilated_refraction: ensureRefraction(v.dilated_refraction),
5098
+ glass_power_prescription: ensureRefraction(v.glass_power_prescription),
5099
+ notes: v.notes ?? ""
5100
+ };
5101
+ }
5102
+ var sectionWrapperClass = "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0] bg-white";
5103
+ var sectionHeaderClass = "rounded-t-md bg-[#FEE8EC] px-3 py-1 text-sm shrink-0 z-[1] text-slate-600 font-medium";
5104
+ var sectionBodyClass = "rounded-b-md border-t border-[#D0D0D0] bg-white p-3 space-y-3";
5105
+ var tableBaseClass = "w-full border-collapse text-xs";
5106
+ var tableHeaderCellClass = "border border-[#E0E0E0] bg-[#F7F7F7] px-2 py-1 text-center font-semibold";
5107
+ var tableCellClass = "border border-[#E0E0E0] px-1.5 py-1 text-center align-middle";
5108
+ var selectClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
5109
+ var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs text-right focus-visible:outline-none focus-visible:ring-0";
5110
+ var textInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
5111
+ var OphthalmologyWidget = ({ fieldId }) => {
5112
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
5113
+ const safe = useMemo(() => ensureValue(value), [value]);
5114
+ const label = fieldDef?.label || "";
5115
+ const update = (updater) => {
5116
+ if (disabled) return;
5117
+ setValue(updater(ensureValue(value)));
5118
+ };
5119
+ const setPatientInfo = (key, next) => {
5120
+ update((current) => ({
5121
+ ...current,
5122
+ patient_information: { ...current.patient_information, [key]: next }
5123
+ }));
5124
+ };
5125
+ const setUnaided = (side, key, next) => {
5126
+ update((current) => ({
5127
+ ...current,
5128
+ unaided_visual_acuity: {
5129
+ ...current.unaided_visual_acuity,
5130
+ [side]: { ...current.unaided_visual_acuity[side], [key]: next }
5131
+ }
5132
+ }));
5133
+ };
5134
+ const setRefractionField = (section, side, key, next, mode) => {
5135
+ update((current) => {
5136
+ const base = current[section];
5137
+ const eye = base[side];
5138
+ let val;
5139
+ if (mode === "select") {
5140
+ val = next;
5141
+ } else if (mode === "float") {
5142
+ val = parseFloatOrNull(next);
5143
+ } else {
5144
+ val = parseIntOrNull(next);
5145
+ }
5146
+ return {
5147
+ ...current,
5148
+ [section]: {
5149
+ ...base,
5150
+ [side]: {
5151
+ ...eye,
5152
+ [key]: val
5153
+ }
5154
+ }
5155
+ };
5156
+ });
5157
+ };
5158
+ const setRefractionAdd = (section, side, next) => {
5159
+ update((current) => {
5160
+ const base = current[section];
5161
+ const add = base.add;
5162
+ const val = parseFloatOrNull(next);
5163
+ return {
5164
+ ...current,
5165
+ [section]: {
5166
+ ...base,
5167
+ add: {
5168
+ ...add,
5169
+ [side]: val
5170
+ }
5171
+ }
5172
+ };
5173
+ });
5174
+ };
5175
+ const setIopField = (side, key, next) => {
5176
+ update((current) => {
5177
+ const base = current.iop_pachy_cct;
5178
+ const eye = base[side];
5179
+ const val = parseIntOrNull(next);
5180
+ return {
5181
+ ...current,
5182
+ iop_pachy_cct: {
5183
+ ...base,
5184
+ [side]: {
5185
+ ...eye,
5186
+ [key]: val
5187
+ }
5188
+ }
5189
+ };
5190
+ });
5191
+ };
5192
+ const setIopMeta = (key, next) => {
5193
+ update((current) => ({
5194
+ ...current,
5195
+ iop_pachy_cct: {
5196
+ ...current.iop_pachy_cct,
5197
+ [key]: next
5198
+ }
5199
+ }));
5200
+ };
5201
+ const setNotes = (next) => {
5202
+ update((current) => ({
5203
+ ...current,
5204
+ notes: next
5205
+ }));
5206
+ };
5207
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", disabled && "opacity-70 pointer-events-none"), children: [
5208
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
5209
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5210
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Patient Information" }) }),
5211
+ /* @__PURE__ */ jsxs("div", { className: cn(sectionBodyClass, "grid gap-3 md:grid-cols-3"), children: [
5212
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5213
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Systemic History" }),
5214
+ /* @__PURE__ */ jsx(
5215
+ Textarea,
5216
+ {
5217
+ disabled,
5218
+ rows: 4,
5219
+ className: "min-h-[100px] text-xs",
5220
+ value: safe.patient_information.systemic_history,
5221
+ onChange: (e) => setPatientInfo("systemic_history", e.target.value),
5222
+ placeholder: "Enter systemic history..."
5223
+ }
5224
+ )
5225
+ ] }),
5226
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5227
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Ocular History" }),
5228
+ /* @__PURE__ */ jsx(
5229
+ Textarea,
5230
+ {
5231
+ disabled,
5232
+ rows: 4,
5233
+ className: "min-h-[100px] text-xs",
5234
+ value: safe.patient_information.ocular_history,
5235
+ onChange: (e) => setPatientInfo("ocular_history", e.target.value),
5236
+ placeholder: "Enter ocular history..."
5237
+ }
5238
+ )
5239
+ ] }),
5240
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5241
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Chief Complaints" }),
5242
+ /* @__PURE__ */ jsx(
5243
+ Textarea,
5244
+ {
5245
+ disabled,
5246
+ rows: 4,
5247
+ className: "min-h-[100px] text-xs",
5248
+ value: safe.patient_information.chief_complaints,
5249
+ onChange: (e) => setPatientInfo("chief_complaints", e.target.value),
5250
+ placeholder: "Enter chief complaints..."
5251
+ }
5252
+ )
5253
+ ] })
5254
+ ] })
5255
+ ] }),
5256
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5257
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Unaided Visual Acuity" }) }),
5258
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5259
+ /* @__PURE__ */ jsxs("thead", { children: [
5260
+ /* @__PURE__ */ jsxs("tr", { children: [
5261
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5262
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Right Eye" }),
5263
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Left Eye" })
5264
+ ] }),
5265
+ /* @__PURE__ */ jsxs("tr", { children: [
5266
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5267
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5268
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5269
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "N/V" }),
5270
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5271
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5272
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "N/V" })
5273
+ ] })
5274
+ ] }),
5275
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5276
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Unaided" }),
5277
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5278
+ "select",
5279
+ {
5280
+ disabled,
5281
+ className: selectClass,
5282
+ value: safe.unaided_visual_acuity.right_eye.ucva,
5283
+ onChange: (e) => setUnaided("right_eye", "ucva", e.target.value),
5284
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5285
+ }
5286
+ ) }),
5287
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5288
+ "select",
5289
+ {
5290
+ disabled,
5291
+ className: selectClass,
5292
+ value: safe.unaided_visual_acuity.right_eye.pinhole_va,
5293
+ onChange: (e) => setUnaided("right_eye", "pinhole_va", e.target.value),
5294
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5295
+ }
5296
+ ) }),
5297
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5298
+ "select",
5299
+ {
5300
+ disabled,
5301
+ className: selectClass,
5302
+ value: safe.unaided_visual_acuity.right_eye.nv,
5303
+ onChange: (e) => setUnaided("right_eye", "nv", e.target.value),
5304
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5305
+ }
5306
+ ) }),
5307
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5308
+ "select",
5309
+ {
5310
+ disabled,
5311
+ className: selectClass,
5312
+ value: safe.unaided_visual_acuity.left_eye.ucva,
5313
+ onChange: (e) => setUnaided("left_eye", "ucva", e.target.value),
5314
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5315
+ }
5316
+ ) }),
5317
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5318
+ "select",
5319
+ {
5320
+ disabled,
5321
+ className: selectClass,
5322
+ value: safe.unaided_visual_acuity.left_eye.pinhole_va,
5323
+ onChange: (e) => setUnaided("left_eye", "pinhole_va", e.target.value),
5324
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5325
+ }
5326
+ ) }),
5327
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5328
+ "select",
5329
+ {
5330
+ disabled,
5331
+ className: selectClass,
5332
+ value: safe.unaided_visual_acuity.left_eye.nv,
5333
+ onChange: (e) => setUnaided("left_eye", "nv", e.target.value),
5334
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5335
+ }
5336
+ ) })
5337
+ ] }) })
5338
+ ] }) })
5339
+ ] }),
5340
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5341
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Current Glass Prescription" }) }),
5342
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5343
+ /* @__PURE__ */ jsxs("thead", { children: [
5344
+ /* @__PURE__ */ jsxs("tr", { children: [
5345
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5346
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Right Eye" }),
5347
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Left Eye" })
5348
+ ] }),
5349
+ /* @__PURE__ */ jsxs("tr", { children: [
5350
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5351
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5352
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5353
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5354
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5355
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5356
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5357
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5358
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5359
+ ] })
5360
+ ] }),
5361
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5362
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Current Glass" }),
5363
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5364
+ Input,
5365
+ {
5366
+ disabled,
5367
+ type: "number",
5368
+ step: "0.25",
5369
+ className: numberInputClass,
5370
+ value: safe.current_glass_prescription.right_eye.sph ?? "",
5371
+ onChange: (e) => setRefractionField(
5372
+ "current_glass_prescription",
5373
+ "right_eye",
5374
+ "sph",
5375
+ e.target.value,
5376
+ "float"
5377
+ )
5378
+ }
5379
+ ) }),
5380
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5381
+ Input,
5382
+ {
5383
+ disabled,
5384
+ type: "number",
5385
+ step: "0.25",
5386
+ className: numberInputClass,
5387
+ value: safe.current_glass_prescription.right_eye.cyl ?? "",
5388
+ onChange: (e) => setRefractionField(
5389
+ "current_glass_prescription",
5390
+ "right_eye",
5391
+ "cyl",
5392
+ e.target.value,
5393
+ "float"
5394
+ )
5395
+ }
5396
+ ) }),
5397
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5398
+ Input,
5399
+ {
5400
+ disabled,
5401
+ type: "number",
5402
+ className: numberInputClass,
5403
+ value: safe.current_glass_prescription.right_eye.axis ?? "",
5404
+ onChange: (e) => setRefractionField(
5405
+ "current_glass_prescription",
5406
+ "right_eye",
5407
+ "axis",
5408
+ e.target.value,
5409
+ "int"
5410
+ )
5411
+ }
5412
+ ) }),
5413
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5414
+ "select",
5415
+ {
5416
+ disabled,
5417
+ className: selectClass,
5418
+ value: safe.current_glass_prescription.right_eye.va,
5419
+ onChange: (e) => setRefractionField(
5420
+ "current_glass_prescription",
5421
+ "right_eye",
5422
+ "va",
5423
+ e.target.value,
5424
+ "select"
5425
+ ),
5426
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5427
+ }
5428
+ ) }),
5429
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5430
+ Input,
5431
+ {
5432
+ disabled,
5433
+ type: "number",
5434
+ step: "0.25",
5435
+ className: numberInputClass,
5436
+ value: safe.current_glass_prescription.left_eye.sph ?? "",
5437
+ onChange: (e) => setRefractionField(
5438
+ "current_glass_prescription",
5439
+ "left_eye",
5440
+ "sph",
5441
+ e.target.value,
5442
+ "float"
5443
+ )
5444
+ }
5445
+ ) }),
5446
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5447
+ Input,
5448
+ {
5449
+ disabled,
5450
+ type: "number",
5451
+ step: "0.25",
5452
+ className: numberInputClass,
5453
+ value: safe.current_glass_prescription.left_eye.cyl ?? "",
5454
+ onChange: (e) => setRefractionField(
5455
+ "current_glass_prescription",
5456
+ "left_eye",
5457
+ "cyl",
5458
+ e.target.value,
5459
+ "float"
5460
+ )
5461
+ }
5462
+ ) }),
5463
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5464
+ Input,
5465
+ {
5466
+ disabled,
5467
+ type: "number",
5468
+ className: numberInputClass,
5469
+ value: safe.current_glass_prescription.left_eye.axis ?? "",
5470
+ onChange: (e) => setRefractionField(
5471
+ "current_glass_prescription",
5472
+ "left_eye",
5473
+ "axis",
5474
+ e.target.value,
5475
+ "int"
5476
+ )
5477
+ }
5478
+ ) }),
5479
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5480
+ "select",
5481
+ {
5482
+ disabled,
5483
+ className: selectClass,
5484
+ value: safe.current_glass_prescription.left_eye.va,
5485
+ onChange: (e) => setRefractionField(
5486
+ "current_glass_prescription",
5487
+ "left_eye",
5488
+ "va",
5489
+ e.target.value,
5490
+ "select"
5491
+ ),
5492
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5493
+ }
5494
+ ) })
5495
+ ] }) })
5496
+ ] }) })
5497
+ ] }),
5498
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5499
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "IOP / Pachy / CCT Detail" }) }),
5500
+ /* @__PURE__ */ jsxs("div", { className: sectionBodyClass, children: [
5501
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-[2fr,1fr] mb-3", children: [
5502
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5503
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Method" }),
5504
+ /* @__PURE__ */ jsx(
5505
+ "select",
5506
+ {
5507
+ disabled,
5508
+ className: selectClass,
5509
+ value: safe.iop_pachy_cct.method,
5510
+ onChange: (e) => setIopMeta("method", e.target.value),
5511
+ children: IOP_METHOD_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt || "Select Method" }, opt || "blank"))
5512
+ }
5513
+ )
5514
+ ] }),
5515
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5516
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Time" }),
5517
+ /* @__PURE__ */ jsx(
5518
+ Input,
5519
+ {
5520
+ disabled,
5521
+ placeholder: "HH:MM",
5522
+ className: textInputClass,
5523
+ value: safe.iop_pachy_cct.time,
5524
+ onChange: (e) => setIopMeta("time", e.target.value)
5525
+ }
5526
+ )
5527
+ ] })
5528
+ ] }),
5529
+ /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5530
+ /* @__PURE__ */ jsxs("thead", { children: [
5531
+ /* @__PURE__ */ jsxs("tr", { children: [
5532
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5533
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Right Eye" }),
5534
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Left Eye" })
5535
+ ] }),
5536
+ /* @__PURE__ */ jsxs("tr", { children: [
5537
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5538
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5539
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "CCT" }),
5540
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5541
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "CCT" })
5542
+ ] })
5543
+ ] }),
5544
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5545
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Values" }),
5546
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5547
+ Input,
5548
+ {
5549
+ disabled,
5550
+ type: "number",
5551
+ className: numberInputClass,
5552
+ value: safe.iop_pachy_cct.right_eye.iop ?? "",
5553
+ onChange: (e) => setIopField("right_eye", "iop", e.target.value)
5554
+ }
5555
+ ) }),
5556
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5557
+ Input,
5558
+ {
5559
+ disabled,
5560
+ type: "number",
5561
+ className: numberInputClass,
5562
+ value: safe.iop_pachy_cct.right_eye.cct ?? "",
5563
+ onChange: (e) => setIopField("right_eye", "cct", e.target.value)
5564
+ }
5565
+ ) }),
5566
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5567
+ Input,
5568
+ {
5569
+ disabled,
5570
+ type: "number",
5571
+ className: numberInputClass,
5572
+ value: safe.iop_pachy_cct.left_eye.iop ?? "",
5573
+ onChange: (e) => setIopField("left_eye", "iop", e.target.value)
5574
+ }
5575
+ ) }),
5576
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5577
+ Input,
5578
+ {
5579
+ disabled,
5580
+ type: "number",
5581
+ className: numberInputClass,
5582
+ value: safe.iop_pachy_cct.left_eye.cct ?? "",
5583
+ onChange: (e) => setIopField("left_eye", "cct", e.target.value)
5584
+ }
5585
+ ) })
5586
+ ] }) })
5587
+ ] })
5588
+ ] })
5589
+ ] }),
5590
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5591
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Refraction (Distance)" }) }),
5592
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5593
+ /* @__PURE__ */ jsxs("thead", { children: [
5594
+ /* @__PURE__ */ jsxs("tr", { children: [
5595
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5596
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5597
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5598
+ ] }),
5599
+ /* @__PURE__ */ jsxs("tr", { children: [
5600
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5601
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5602
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5603
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5604
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5605
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "P/D" }),
5606
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5607
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5608
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5609
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5610
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "P/D" })
5611
+ ] })
5612
+ ] }),
5613
+ /* @__PURE__ */ jsxs("tbody", { children: [
5614
+ /* @__PURE__ */ jsxs("tr", { children: [
5615
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Distance" }),
5616
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5617
+ Input,
5618
+ {
5619
+ disabled,
5620
+ type: "number",
5621
+ step: "0.25",
5622
+ className: numberInputClass,
5623
+ value: safe.refraction.right_eye.sph ?? "",
5624
+ onChange: (e) => setRefractionField(
5625
+ "refraction",
5626
+ "right_eye",
5627
+ "sph",
5628
+ e.target.value,
5629
+ "float"
5630
+ )
5631
+ }
5632
+ ) }),
5633
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5634
+ Input,
5635
+ {
5636
+ disabled,
5637
+ type: "number",
5638
+ step: "0.25",
5639
+ className: numberInputClass,
5640
+ value: safe.refraction.right_eye.cyl ?? "",
5641
+ onChange: (e) => setRefractionField(
5642
+ "refraction",
5643
+ "right_eye",
5644
+ "cyl",
5645
+ e.target.value,
5646
+ "float"
5647
+ )
5648
+ }
5649
+ ) }),
5650
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5651
+ Input,
5652
+ {
5653
+ disabled,
5654
+ type: "number",
5655
+ className: numberInputClass,
5656
+ value: safe.refraction.right_eye.axis ?? "",
5657
+ onChange: (e) => setRefractionField(
5658
+ "refraction",
5659
+ "right_eye",
5660
+ "axis",
5661
+ e.target.value,
5662
+ "int"
5663
+ )
5664
+ }
5665
+ ) }),
5666
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5667
+ "select",
5668
+ {
5669
+ disabled,
5670
+ className: selectClass,
5671
+ value: safe.refraction.right_eye.va,
5672
+ onChange: (e) => setRefractionField(
5673
+ "refraction",
5674
+ "right_eye",
5675
+ "va",
5676
+ e.target.value,
5677
+ "select"
5678
+ ),
5679
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5680
+ }
5681
+ ) }),
5682
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5683
+ Input,
5684
+ {
5685
+ disabled,
5686
+ type: "number",
5687
+ min: 10,
5688
+ max: 45,
5689
+ step: "1",
5690
+ className: numberInputClass,
5691
+ value: safe.refraction.right_eye.pd ?? "",
5692
+ onChange: (e) => setRefractionField("refraction", "right_eye", "pd", e.target.value, "int")
5693
+ }
5694
+ ) }),
5695
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5696
+ Input,
5697
+ {
5698
+ disabled,
5699
+ type: "number",
5700
+ step: "0.25",
5701
+ className: numberInputClass,
5702
+ value: safe.refraction.left_eye.sph ?? "",
5703
+ onChange: (e) => setRefractionField(
5704
+ "refraction",
5705
+ "left_eye",
5706
+ "sph",
5707
+ e.target.value,
5708
+ "float"
5709
+ )
5710
+ }
5711
+ ) }),
5712
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5713
+ Input,
5714
+ {
5715
+ disabled,
5716
+ type: "number",
5717
+ step: "0.25",
5718
+ className: numberInputClass,
5719
+ value: safe.refraction.left_eye.cyl ?? "",
5720
+ onChange: (e) => setRefractionField(
5721
+ "refraction",
5722
+ "left_eye",
5723
+ "cyl",
5724
+ e.target.value,
5725
+ "float"
5726
+ )
5727
+ }
5728
+ ) }),
5729
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5730
+ Input,
5731
+ {
5732
+ disabled,
5733
+ type: "number",
5734
+ className: numberInputClass,
5735
+ value: safe.refraction.left_eye.axis ?? "",
5736
+ onChange: (e) => setRefractionField(
5737
+ "refraction",
5738
+ "left_eye",
5739
+ "axis",
5740
+ e.target.value,
5741
+ "int"
5742
+ )
5743
+ }
5744
+ ) }),
5745
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5746
+ "select",
5747
+ {
5748
+ disabled,
5749
+ className: selectClass,
5750
+ value: safe.refraction.left_eye.va,
5751
+ onChange: (e) => setRefractionField(
5752
+ "refraction",
5753
+ "left_eye",
5754
+ "va",
5755
+ e.target.value,
5756
+ "select"
5757
+ ),
5758
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5759
+ }
5760
+ ) }),
5761
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5762
+ Input,
5763
+ {
5764
+ disabled,
5765
+ type: "number",
5766
+ min: 10,
5767
+ max: 45,
5768
+ step: "1",
5769
+ className: numberInputClass,
5770
+ value: safe.refraction.left_eye.pd ?? "",
5771
+ onChange: (e) => setRefractionField("refraction", "left_eye", "pd", e.target.value, "int")
5772
+ }
5773
+ ) })
5774
+ ] }),
5775
+ /* @__PURE__ */ jsxs("tr", { children: [
5776
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
5777
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
5778
+ Input,
5779
+ {
5780
+ disabled,
5781
+ type: "number",
5782
+ step: "0.25",
5783
+ className: numberInputClass,
5784
+ value: safe.refraction.add.right ?? "",
5785
+ onChange: (e) => setRefractionAdd("refraction", "right", e.target.value)
5786
+ }
5787
+ ) }),
5788
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
5789
+ Input,
5790
+ {
5791
+ disabled,
5792
+ type: "number",
5793
+ step: "0.25",
5794
+ className: numberInputClass,
5795
+ value: safe.refraction.add.left ?? "",
5796
+ onChange: (e) => setRefractionAdd("refraction", "left", e.target.value)
5797
+ }
5798
+ ) })
5799
+ ] })
5800
+ ] })
5801
+ ] }) })
5802
+ ] }),
5803
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5804
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Dilated Refraction" }) }),
5805
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5806
+ /* @__PURE__ */ jsxs("thead", { children: [
5807
+ /* @__PURE__ */ jsxs("tr", { children: [
5808
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5809
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5810
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5811
+ ] }),
5812
+ /* @__PURE__ */ jsxs("tr", { children: [
5813
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5814
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5815
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5816
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5817
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5818
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5819
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5820
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5821
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5822
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5823
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5824
+ ] })
5825
+ ] }),
5826
+ /* @__PURE__ */ jsxs("tbody", { children: [
5827
+ /* @__PURE__ */ jsxs("tr", { children: [
5828
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Dilated" }),
5829
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5830
+ Input,
5831
+ {
5832
+ disabled,
5833
+ type: "number",
5834
+ step: "0.25",
5835
+ className: numberInputClass,
5836
+ value: safe.dilated_refraction.right_eye.sph ?? "",
5837
+ onChange: (e) => setRefractionField(
5838
+ "dilated_refraction",
5839
+ "right_eye",
5840
+ "sph",
5841
+ e.target.value,
5842
+ "float"
5843
+ )
5844
+ }
5845
+ ) }),
5846
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5847
+ Input,
5848
+ {
5849
+ disabled,
5850
+ type: "number",
5851
+ step: "0.25",
5852
+ className: numberInputClass,
5853
+ value: safe.dilated_refraction.right_eye.cyl ?? "",
5854
+ onChange: (e) => setRefractionField(
5855
+ "dilated_refraction",
5856
+ "right_eye",
5857
+ "cyl",
5858
+ e.target.value,
5859
+ "float"
5860
+ )
5861
+ }
5862
+ ) }),
5863
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5864
+ Input,
5865
+ {
5866
+ disabled,
5867
+ type: "number",
5868
+ className: numberInputClass,
5869
+ value: safe.dilated_refraction.right_eye.axis ?? "",
5870
+ onChange: (e) => setRefractionField(
5871
+ "dilated_refraction",
5872
+ "right_eye",
5873
+ "axis",
5874
+ e.target.value,
5875
+ "int"
5876
+ )
5877
+ }
5878
+ ) }),
5879
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5880
+ Input,
5881
+ {
5882
+ disabled,
5883
+ type: "number",
5884
+ step: "0.25",
5885
+ className: numberInputClass,
5886
+ value: safe.dilated_refraction.right_eye.prism ?? "",
5887
+ onChange: (e) => setRefractionField(
5888
+ "dilated_refraction",
5889
+ "right_eye",
5890
+ "prism",
5891
+ e.target.value,
5892
+ "float"
5893
+ )
5894
+ }
5895
+ ) }),
5896
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5897
+ "select",
5898
+ {
5899
+ disabled,
5900
+ className: selectClass,
5901
+ value: safe.dilated_refraction.right_eye.va,
5902
+ onChange: (e) => setRefractionField(
5903
+ "dilated_refraction",
5904
+ "right_eye",
5905
+ "va",
5906
+ e.target.value,
5907
+ "select"
5908
+ ),
5909
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5910
+ }
5911
+ ) }),
5912
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5913
+ Input,
5914
+ {
5915
+ disabled,
5916
+ type: "number",
5917
+ step: "0.25",
5918
+ className: numberInputClass,
5919
+ value: safe.dilated_refraction.left_eye.sph ?? "",
5920
+ onChange: (e) => setRefractionField(
5921
+ "dilated_refraction",
5922
+ "left_eye",
5923
+ "sph",
5924
+ e.target.value,
5925
+ "float"
5926
+ )
5927
+ }
5928
+ ) }),
5929
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5930
+ Input,
5931
+ {
5932
+ disabled,
5933
+ type: "number",
5934
+ step: "0.25",
5935
+ className: numberInputClass,
5936
+ value: safe.dilated_refraction.left_eye.cyl ?? "",
5937
+ onChange: (e) => setRefractionField(
5938
+ "dilated_refraction",
5939
+ "left_eye",
5940
+ "cyl",
5941
+ e.target.value,
5942
+ "float"
5943
+ )
5944
+ }
5945
+ ) }),
5946
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5947
+ Input,
5948
+ {
5949
+ disabled,
5950
+ type: "number",
5951
+ className: numberInputClass,
5952
+ value: safe.dilated_refraction.left_eye.axis ?? "",
5953
+ onChange: (e) => setRefractionField(
5954
+ "dilated_refraction",
5955
+ "left_eye",
5956
+ "axis",
5957
+ e.target.value,
5958
+ "int"
5959
+ )
5960
+ }
5961
+ ) }),
5962
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5963
+ Input,
5964
+ {
5965
+ disabled,
5966
+ type: "number",
5967
+ step: "0.25",
5968
+ className: numberInputClass,
5969
+ value: safe.dilated_refraction.left_eye.prism ?? "",
5970
+ onChange: (e) => setRefractionField(
5971
+ "dilated_refraction",
5972
+ "left_eye",
5973
+ "prism",
5974
+ e.target.value,
5975
+ "float"
5976
+ )
5977
+ }
5978
+ ) }),
5979
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5980
+ "select",
5981
+ {
5982
+ disabled,
5983
+ className: selectClass,
5984
+ value: safe.dilated_refraction.left_eye.va,
5985
+ onChange: (e) => setRefractionField(
5986
+ "dilated_refraction",
5987
+ "left_eye",
5988
+ "va",
5989
+ e.target.value,
5990
+ "select"
5991
+ ),
5992
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5993
+ }
5994
+ ) })
5995
+ ] }),
5996
+ /* @__PURE__ */ jsxs("tr", { children: [
5997
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
5998
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
5999
+ Input,
6000
+ {
6001
+ disabled,
6002
+ type: "number",
6003
+ step: "0.25",
6004
+ className: numberInputClass,
6005
+ value: safe.dilated_refraction.add.right ?? "",
6006
+ onChange: (e) => setRefractionAdd("dilated_refraction", "right", e.target.value)
6007
+ }
6008
+ ) }),
6009
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6010
+ Input,
6011
+ {
6012
+ disabled,
6013
+ type: "number",
6014
+ step: "0.25",
6015
+ className: numberInputClass,
6016
+ value: safe.dilated_refraction.add.left ?? "",
6017
+ onChange: (e) => setRefractionAdd("dilated_refraction", "left", e.target.value)
6018
+ }
6019
+ ) })
6020
+ ] })
6021
+ ] })
6022
+ ] }) })
6023
+ ] }),
6024
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
6025
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Glass Power Prescription" }) }),
6026
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
6027
+ /* @__PURE__ */ jsxs("thead", { children: [
6028
+ /* @__PURE__ */ jsxs("tr", { children: [
6029
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
6030
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6031
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
6032
+ ] }),
6033
+ /* @__PURE__ */ jsxs("tr", { children: [
6034
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
6035
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6036
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6037
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6038
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6039
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6040
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6041
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6042
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6043
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6044
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
6045
+ ] })
6046
+ ] }),
6047
+ /* @__PURE__ */ jsxs("tbody", { children: [
6048
+ /* @__PURE__ */ jsxs("tr", { children: [
6049
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Glass Power" }),
6050
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6051
+ Input,
6052
+ {
6053
+ disabled,
6054
+ type: "number",
6055
+ step: "0.25",
6056
+ className: numberInputClass,
6057
+ value: safe.glass_power_prescription.right_eye.sph ?? "",
6058
+ onChange: (e) => setRefractionField(
6059
+ "glass_power_prescription",
6060
+ "right_eye",
6061
+ "sph",
6062
+ e.target.value,
6063
+ "float"
6064
+ )
6065
+ }
6066
+ ) }),
6067
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6068
+ Input,
6069
+ {
6070
+ disabled,
6071
+ type: "number",
6072
+ step: "0.25",
6073
+ className: numberInputClass,
6074
+ value: safe.glass_power_prescription.right_eye.cyl ?? "",
6075
+ onChange: (e) => setRefractionField(
6076
+ "glass_power_prescription",
6077
+ "right_eye",
6078
+ "cyl",
6079
+ e.target.value,
6080
+ "float"
6081
+ )
6082
+ }
6083
+ ) }),
6084
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6085
+ Input,
6086
+ {
6087
+ disabled,
6088
+ type: "number",
6089
+ className: numberInputClass,
6090
+ value: safe.glass_power_prescription.right_eye.axis ?? "",
6091
+ onChange: (e) => setRefractionField(
6092
+ "glass_power_prescription",
6093
+ "right_eye",
6094
+ "axis",
6095
+ e.target.value,
6096
+ "int"
6097
+ )
6098
+ }
6099
+ ) }),
6100
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6101
+ Input,
6102
+ {
6103
+ disabled,
6104
+ type: "number",
6105
+ step: "0.25",
6106
+ className: numberInputClass,
6107
+ value: safe.glass_power_prescription.right_eye.prism ?? "",
6108
+ onChange: (e) => setRefractionField(
6109
+ "glass_power_prescription",
6110
+ "right_eye",
6111
+ "prism",
6112
+ e.target.value,
6113
+ "float"
6114
+ )
6115
+ }
6116
+ ) }),
6117
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6118
+ "select",
6119
+ {
6120
+ disabled,
6121
+ className: selectClass,
6122
+ value: safe.glass_power_prescription.right_eye.va,
6123
+ onChange: (e) => setRefractionField(
6124
+ "glass_power_prescription",
6125
+ "right_eye",
6126
+ "va",
6127
+ e.target.value,
6128
+ "select"
6129
+ ),
6130
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
6131
+ }
6132
+ ) }),
6133
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6134
+ Input,
6135
+ {
6136
+ disabled,
6137
+ type: "number",
6138
+ step: "0.25",
6139
+ className: numberInputClass,
6140
+ value: safe.glass_power_prescription.left_eye.sph ?? "",
6141
+ onChange: (e) => setRefractionField(
6142
+ "glass_power_prescription",
6143
+ "left_eye",
6144
+ "sph",
6145
+ e.target.value,
6146
+ "float"
6147
+ )
6148
+ }
6149
+ ) }),
6150
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6151
+ Input,
6152
+ {
6153
+ disabled,
6154
+ type: "number",
6155
+ step: "0.25",
6156
+ className: numberInputClass,
6157
+ value: safe.glass_power_prescription.left_eye.cyl ?? "",
6158
+ onChange: (e) => setRefractionField(
6159
+ "glass_power_prescription",
6160
+ "left_eye",
6161
+ "cyl",
6162
+ e.target.value,
6163
+ "float"
6164
+ )
6165
+ }
6166
+ ) }),
6167
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6168
+ Input,
6169
+ {
6170
+ disabled,
6171
+ type: "number",
6172
+ className: numberInputClass,
6173
+ value: safe.glass_power_prescription.left_eye.axis ?? "",
6174
+ onChange: (e) => setRefractionField(
6175
+ "glass_power_prescription",
6176
+ "left_eye",
6177
+ "axis",
6178
+ e.target.value,
6179
+ "int"
6180
+ )
6181
+ }
6182
+ ) }),
6183
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6184
+ Input,
6185
+ {
6186
+ disabled,
6187
+ type: "number",
6188
+ step: "0.25",
6189
+ className: numberInputClass,
6190
+ value: safe.glass_power_prescription.left_eye.prism ?? "",
6191
+ onChange: (e) => setRefractionField(
6192
+ "glass_power_prescription",
6193
+ "left_eye",
6194
+ "prism",
6195
+ e.target.value,
6196
+ "float"
6197
+ )
6198
+ }
6199
+ ) }),
6200
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6201
+ "select",
6202
+ {
6203
+ disabled,
6204
+ className: selectClass,
6205
+ value: safe.glass_power_prescription.left_eye.va,
6206
+ onChange: (e) => setRefractionField(
6207
+ "glass_power_prescription",
6208
+ "left_eye",
6209
+ "va",
6210
+ e.target.value,
6211
+ "select"
6212
+ ),
6213
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
6214
+ }
6215
+ ) })
6216
+ ] }),
6217
+ /* @__PURE__ */ jsxs("tr", { children: [
6218
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6219
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6220
+ Input,
6221
+ {
6222
+ disabled,
6223
+ type: "number",
6224
+ step: "0.25",
6225
+ className: numberInputClass,
6226
+ value: safe.glass_power_prescription.add.right ?? "",
6227
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "right", e.target.value)
6228
+ }
6229
+ ) }),
6230
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6231
+ Input,
6232
+ {
6233
+ disabled,
6234
+ type: "number",
6235
+ step: "0.25",
6236
+ className: numberInputClass,
6237
+ value: safe.glass_power_prescription.add.left ?? "",
6238
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "left", e.target.value)
6239
+ }
6240
+ ) })
6241
+ ] })
6242
+ ] })
6243
+ ] }) })
6244
+ ] }),
6245
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
6246
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Notes" }) }),
6247
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsx(
6248
+ Textarea,
6249
+ {
6250
+ disabled,
6251
+ rows: 4,
6252
+ className: "w-full text-xs min-h-[100px]",
6253
+ placeholder: "Enter additional notes...",
6254
+ value: safe.notes,
6255
+ onChange: (e) => setNotes(e.target.value)
6256
+ }
6257
+ ) })
6258
+ ] })
6259
+ ] });
6260
+ };
6261
+ var DIAGNOSIS_FIELDS = [
6262
+ "INJURY",
6263
+ "APPENDAGES",
6264
+ "CONJUNCTIVA",
6265
+ "SCLERA",
6266
+ "CORNEA",
6267
+ "ANTERIOR CHAMBER (AC)",
6268
+ "PUPIL",
6269
+ "IRIS",
6270
+ "LENS",
6271
+ "EXTRAOCULAR MOVEMENTS & SQUINT",
6272
+ "INTRAOCULAR PRESSURE (IOP)",
6273
+ "GONIOSCOPY",
6274
+ "FUNDUS"
6275
+ ];
6276
+ function ensureValue2(raw) {
6277
+ const v = raw || {};
6278
+ return {
6279
+ right_eye: v.right_eye ?? {},
6280
+ left_eye: v.left_eye ?? {}
6281
+ };
6282
+ }
6283
+ var containerClass = "rounded-md bg-white overflow-hidden flex flex-col";
6284
+ var headerClass = "px-3 py-2 text-sm font-medium text-slate-800 border-b border-slate-200";
6285
+ var tableClass = "w-full text-xs";
6286
+ var headerCellClass = "border border-slate-200 px-2 py-1 text-center font-semibold align-middle";
6287
+ var cellClass = "border border-slate-200 px-2 py-1 align-top";
6288
+ var OphthalDiagnosisWidget = ({ fieldId }) => {
6289
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
6290
+ const safe = useMemo(() => ensureValue2(value), [value]);
6291
+ const label = fieldDef?.label || "";
6292
+ const updateEyeField = (eye, fieldLabel, next) => {
6293
+ if (disabled) return;
6294
+ const prev = ensureValue2(value);
6295
+ setValue({
6296
+ ...prev,
6297
+ [eye]: {
6298
+ ...prev[eye],
6299
+ [fieldLabel]: next
6300
+ }
6301
+ });
6302
+ };
6303
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", disabled && "opacity-70 pointer-events-none"), children: [
6304
+ label && /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
6305
+ /* @__PURE__ */ jsxs("section", { className: containerClass, children: [
6306
+ /* @__PURE__ */ jsx("div", { className: headerClass, children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Diagnosis" }) }),
6307
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: tableClass, children: [
6308
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
6309
+ /* @__PURE__ */ jsx("th", { className: cn(headerCellClass, "text-left px-3"), children: "Field" }),
6310
+ /* @__PURE__ */ jsx("th", { className: headerCellClass, children: "Right Eye" }),
6311
+ /* @__PURE__ */ jsx("th", { className: headerCellClass, children: "Left Eye" })
6312
+ ] }) }),
6313
+ /* @__PURE__ */ jsx("tbody", { children: DIAGNOSIS_FIELDS.map((fieldLabel) => /* @__PURE__ */ jsxs("tr", { children: [
6314
+ /* @__PURE__ */ jsx("td", { className: cn(cellClass, "text-left font-semibold px-3"), children: fieldLabel }),
6315
+ /* @__PURE__ */ jsx("td", { className: cellClass, children: /* @__PURE__ */ jsx(
6316
+ Textarea,
6317
+ {
6318
+ disabled,
6319
+ rows: 2,
6320
+ className: "w-full text-xs min-h-[60px] resize-none",
6321
+ value: safe.right_eye[fieldLabel] ?? "",
6322
+ onChange: (e) => updateEyeField("right_eye", fieldLabel, e.target.value)
6323
+ }
6324
+ ) }),
6325
+ /* @__PURE__ */ jsx("td", { className: cellClass, children: /* @__PURE__ */ jsx(
6326
+ Textarea,
6327
+ {
6328
+ disabled,
6329
+ rows: 2,
6330
+ className: "w-full text-xs min-h-[60px] resize-none",
6331
+ value: safe.left_eye[fieldLabel] ?? "",
6332
+ onChange: (e) => updateEyeField("left_eye", fieldLabel, e.target.value)
6333
+ }
6334
+ ) })
6335
+ ] }, fieldLabel)) })
6336
+ ] }) })
6337
+ ] })
6338
+ ] });
6339
+ };
4983
6340
  var FieldRenderer = ({ fieldId }) => {
4984
6341
  const { fieldDef, visible } = useField(fieldId);
4985
6342
  if (!visible || !fieldDef) {
@@ -5030,6 +6387,10 @@ var FieldRenderer = ({ fieldId }) => {
5030
6387
  return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
5031
6388
  case "obstetric_history":
5032
6389
  return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
6390
+ case "eye_prescription":
6391
+ return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
6392
+ case "ophthal_diagnosis":
6393
+ return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
5033
6394
  case "static_text": {
5034
6395
  const def = fieldDef;
5035
6396
  const size = def.size ?? "regular";