formanitor 0.0.23 → 0.0.24

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.cjs CHANGED
@@ -2813,6 +2813,22 @@ var AddEntityDialog = ({
2813
2813
  actionSlot != null && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-6 py-4 flex justify-end shrink-0 border-t border-border bg-background", children: actionSlot })
2814
2814
  ] }) });
2815
2815
  };
2816
+ var BEFORE_AFTER_OPTIONS = [
2817
+ { label: "Blank", value: "" },
2818
+ { label: "AFTER FOOD", value: "AFTER FOOD" },
2819
+ { label: "BEFORE FOOD", value: "BEFORE FOOD" },
2820
+ { label: "WITH FOOD", value: "WITH FOOD" },
2821
+ { label: "SINGLE DOSE", value: "SINGLE DOSE" },
2822
+ { label: "BED TIME", value: "BED TIME" },
2823
+ { label: "EMPTY STOMACH", value: "EMPTY STOMACH" },
2824
+ { label: "LOCAL APPLICATION", value: "LOCAL APPLICATION" },
2825
+ { label: "STAT", value: "STAT" },
2826
+ { label: "INHALATION", value: "INHALATION" }
2827
+ ];
2828
+ var BEFORE_AFTER_NORMALIZATION_MAP = {
2829
+ AF: "AFTER FOOD",
2830
+ BF: "BEFORE FOOD"
2831
+ };
2816
2832
  function mapToMedication(result) {
2817
2833
  return {
2818
2834
  id: result.id,
@@ -2876,7 +2892,7 @@ function mapFrequentItemToMedication(item) {
2876
2892
  const parsed = parseDuration(item.duration);
2877
2893
  const duration_value = item.duration_value ?? parsed.value;
2878
2894
  const duration_unit = item.duration_unit ?? parsed.unit;
2879
- const before_after = item.before_after === "BEFORE FOOD" ? "BEFORE FOOD" : "AFTER FOOD";
2895
+ const before_after = normalizeBeforeAfter(item.before_after);
2880
2896
  const routeNote = item.route ? `Route: ${item.route}` : "";
2881
2897
  const baseNotes = item.notes?.trim() || "";
2882
2898
  const combinedNotes = [baseNotes, routeNote.trim()].filter((part) => part.length > 0).join(" \u2014 ");
@@ -2895,6 +2911,13 @@ function mapFrequentItemToMedication(item) {
2895
2911
  notes: combinedNotes
2896
2912
  };
2897
2913
  }
2914
+ function normalizeBeforeAfter(value) {
2915
+ if (value == null) return "AFTER FOOD";
2916
+ const mapped = BEFORE_AFTER_NORMALIZATION_MAP[value];
2917
+ if (mapped) return mapped;
2918
+ const validValues = BEFORE_AFTER_OPTIONS.map((option) => option.value);
2919
+ return validValues.includes(value) ? value : "AFTER FOOD";
2920
+ }
2898
2921
  function Spinner({
2899
2922
  value,
2900
2923
  onChange
@@ -3002,16 +3025,13 @@ function MedicationCard({
3002
3025
  )
3003
3026
  ] }),
3004
3027
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 items-center flex-1 min-w-0 justify-end", children: ["morning", "afternoon", "night"].map((slot) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { value: med[slot], onChange: (v) => set(slot, v) }) }, slot)) }),
3005
- /* @__PURE__ */ jsxRuntime.jsxs(
3028
+ /* @__PURE__ */ jsxRuntime.jsx(
3006
3029
  "select",
3007
3030
  {
3008
3031
  className: "text-xs border border-border rounded px-2 py-1 bg-white shrink-0",
3009
- value: med.before_after === "AFTER FOOD" ? "AF" : "BF",
3010
- onChange: (e) => set("before_after", e.target.value === "AF" ? "AFTER FOOD" : "BEFORE FOOD"),
3011
- children: [
3012
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "AF", children: "AF" }),
3013
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "BF", children: "BF" })
3014
- ]
3032
+ value: normalizeBeforeAfter(med.before_after),
3033
+ onChange: (e) => set("before_after", e.target.value),
3034
+ children: BEFORE_AFTER_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.label))
3015
3035
  }
3016
3036
  )
3017
3037
  ] }),