PageSourceSearch

https://app.clariumhealth.com/assets/procedure-detail.route-CzsaL1jI.js

js clariumhealth.com collected 2026-09-25 15:16:52 UTC 32,265 bytes, 728 lines download raw bytes

1import { o as __toESM } from "./chunk-6z4oVpB-.js";
2import "./capitalize-YV0fqYBS.js";
3import { t as require_react } from "./react-CCT1erMQ.js";
4import "./prop-types-BP3O0vhg.js";
5import { t as require_jsx_runtime } from "./jsx-runtime-6ToSbptA.js";
6import "./hoist-non-react-statics.cjs-aYVW55CP.js";
7import "./clsx-BbsgvS4T.js";
8import "./Stack-DHo_Jfjl.js";
9import "./setPrototypeOf-BJGl62Ep.js";
10import "./chainPropTypes-Bly6swO2.js";
11import "./SvgIcon-C1SXqgmo.js";
12import "./Amplify-ydFdTLPK.js";
13import { n as _objectSpread2, r as init_objectSpread2 } from "./objectWithoutProperties-Cgp7QKOy.js";
14import "./types-CQ-ki0qK.js";
15import "./amplifyUrl-DhBXUoj8.js";
16import "./tslib.es6-CGMJRn24.js";
17import "./api-BN7R4l5b.js";
18import "./createCognitoUserPoolEndpointResolver-DIsnsOMn.js";
19import "./errors-CJ9PkTii.js";
20import "./shim-BLxGA08a.js";
21import "./use-isomorphic-layout-effect.browser.esm-BDjLKVP-.js";
22import "./dist-Cz4mcmaa.js";
23import "./dist-DaeMORX8.js";
24import "./react-dom-Dddidh9b.js";
25import "./dist-DetJSI7l.js";
26import "./dist-Dsgwk-jH.js";
27import "./classPrivateFieldGet2-D2HqlEEJ.js";
28import "./dist-javwCbI7.js";
29import "./dist-DjKy_3Dj.js";
30import "./Combination-CE9BhVA8.js";
31import "./dist-BHtPb5hX.js";
32import "./dist-C5RjQM0F.js";
33import "./dist-SbNcsVrs.js";
34import "./dist-BnVQncHy.js";
35import "./dropdown-menu-NIFzDEaK.js";
36import "./esm-BezjtZdK.js";
37import { C as useFetcher, T as useLoaderData, i as NavLink, o as Outlet } from "./chunk-62JRHF6Z-z8JX8DDB.js";
38import "./exports-PpHA8CsK.js";
39import "./extends-7lTa5GQE.js";
40import "./notifyManager-Bch6NZ-h.js";
41import "./constants-TZTPDohO.js";
42import "./iconPropTypes-C5chbmyn-CpVo52O4.js";
43import "./bucket-0-Uq1JG5fZ.js";
44import "./bucket-3-DKA1ROBB.js";
45import "./bucket-13-DojbEaO8.js";
46import "./dist-W5s9RbHT.js";
47import "./dist-DCv7IJcI.js";
48import "./createLucideIcon-DENnxagg.js";
49import "./check-BFnH1yl0.js";
50import "./chevron-right-CEcbN75N.js";
51import "./more-horizontal-YhMMdRGy.js";
52import { t as cn } from "./utils-DL_RvPHk.js";
53import { t as toast } from "./use-toast-CIbRNZGg.js";
54import "./vanilla-CF1b6_qj.js";
55import "./client.gen-B5RyugF5.js";
56import { n as PROCEDURE_CARDS_BASE_PATH } from "./constants-BTubQFbu.js";
57import { t as Button } from "./button-BgUr9YaP.js";
58import "./breadcrumb-6xRYYWrd.js";
59import "./tooltip-BQPMLsOF.js";
60import { n as LongText_default } from "./LongText-Chh0tzMc.js";
61import { t as Badge } from "./badge-BfOudBXs.js";
62import "./module-icon-BXSrG_dD.js";
63import "./modules.api-IyEUmc8P.js";
64import "./dynamic-breadcrumbs-DqfqKIts.js";
65import "./xstate-react.esm-DX2qQh45.js";
66import "./utils-DBLTsd0N.js";
67import "./atoms-rqPguuWn.js";
68import "./dynamic-breadcrumbs.utils-ncCMCfgZ.js";
69import "./Button-BBS-SiZR.js";
70import "./Typography-l0CVJQ2v.js";
71import "./Link-BjqzfEsO.js";
72import "./ErrorPage-BcFaH7ir.js";
73import "./dist-C_Pp4NuF.js";
74import { a as DialogFooter, c as DialogTrigger, i as DialogDescription, o as DialogHeader, r as DialogContent, s as DialogTitle, t as Dialog } from "./dialog-odsl4nrF.js";
75import "./svg-icon-tPYESOnr.js";
76import { a as SidebarGroupContent, i as SidebarGroup, n as SidebarContent, o as SidebarGroupLabel } from "./sidebar-B_0XOYlD.js";
77import "./zod-McvqnZjg.js";
78import { t as Input } from "./input-wPGsBI9X.js";
79import "./separator-BIFfjU4z.js";
80import "./sheet-L1PI2RTI.js";
81import "./skeleton-DlrxaJwT.js";
82import { t as invariant } from "./tiny-invariant-DGRZ75gT.js";
83import { t as LogErrorBoundary } from "./LogErrorBoundary-CEgwOwnc.js";
84import { i as getCoreRowModel, n as useReactTable, o as getFilteredRowModel, r as createColumnHelper } from "./lib-BmE5oXwC.js";
85import "./table-BhizvUWs.js";
86import "./reset-to-first-page-Buz3wC4q.js";
87import "./filter-search-params-CGhr97jh.js";
88import "./use-table-context-DYyO1Fg2.js";
89import { O as getClinicalLocationFilterOptions, Qt as removeProcedureCardServiceLine, Zt as removeProcedureCardClinicalLocation, lt as getProcedureCardDetail, n as addProcedureCardServiceLine, t as addProcedureCardClinicalLocation, xt as getServiceLineFilterOptions } from "./sdk.gen-Ck47bYkT.js";
90import "./client-BqXsOWRb.js";
91import { n as PageLayoutRoot, r as PageLayoutSidebar, t as PageLayoutMain } from "./page-layout-BRcNmLhp.js";
92import { t as HeaderBreadcrumb } from "./breadcrumb-DbPOw08v.js";
93import { r as DefaultTableCell, t as DefaultTableHead } from "./table-header-kEso2dsp.js";
94import { t as Table } from "./table-rkatVwLH.js";
95import { t as TableProvider } from "./table-provider-Bmu6Ph9x.js";
96import { t as Plural } from "./plural-DMgepuxz.js";
97import { t as ClariumAIAuthor } from "./clarium-ai-author-DUSddgGs.js";
98import { n as SidebarAttributesListItem, t as SidebarAttributesList } from "./sidebar-attributes-CYiLefvQ.js";
99import { t as ProcedureCardStatusBadge } from "./procedure-card-status-BOjnzfNO.js";
100var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
101function isApiSuccess(result) {
102	return result.error === void 0;
103}
104function processApiResult(result) {
105	if (!isApiSuccess(result)) {
106		let formErrors = [];
107		let detail = void 0;
108		if (result.error) {
109			detail = result.error.detail;
110			if (!detail || typeof detail === "string") {
111				var _detail;
112				formErrors.push((_detail = detail) !== null && _detail !== void 0 ? _detail : "An unknown error occurred");
113			} else formErrors.push(...detail.map((e) => e.msg));
114		}
115		return {
116			success: false,
117			error: {
118				formErrors,
119				fieldErrors: {}
120			}
121		};
122	}
123	return {
124		success: true,
125		error: null
126	};
127}
128var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime(), 1);
129init_objectSpread2();
130function NavigationTabs() {
131	var _loaderData$procedure;
132	const loaderData = useLoaderData();
133	const basePath = `${PROCEDURE_CARDS_BASE_PATH}/${(_loaderData$procedure = loaderData.procedure.data) === null || _loaderData$procedure === void 0 ? void 0 : _loaderData$procedure.id}`;
134	const prefCardsCount = loaderData.procedure.data.preference_card_count;
135	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
136		className: "type-body flex gap-6 font-medium text-zinc-500",
137		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationTab, {
138			to: basePath,
139			children: "Pick List"
140		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationTab, {
141			to: `${basePath}/preference-cards`,
142			children: `Preference Cards${prefCardsCount ? ` (${prefCardsCount})` : ""}`
143		})]
144	});
145}
146function NavigationTab(props) {
147	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavLink, _objectSpread2(_objectSpread2({}, props), {}, {
148		end: true,
149		className: cn("relative pb-3 pt-2 after:absolute after:inset-x-0 after:bottom-0 after:h-[2px] hover:after:bg-indigo-600/40 aria-[current=page]:text-zinc-900 aria-[current=page]:after:bg-indigo-600", props.className)
150	}));
151}
152init_objectSpread2();
153function ListTableModal(props) {
154	const [columnVisibility, setColumnVisibility] = import_react.useState({ action: props.readOnly ? false : true });
155	const [columnFilters, setColumnFilters] = import_react.useState([{
156		id: "action",
157		value: "Remove"
158	}]);
159	const [isAdding, setIsAdding] = import_react.useState(false);
160	const [globalFilter, setGlobalFilter] = import_react.useState("");
161	const [open, setOpen] = import_react.useState(false);
162	const toggleAddMode = import_react.useCallback(() => {
163		const addMode = !isAdding;
164		setColumnFilters(addMode ? [] : (prev) => [...prev, {
165			id: "action",
166			value: "Remove"
167		}]);
168		setColumnVisibility((prev) => _objectSpread2(_objectSpread2({}, prev), {}, { action: props.readOnly ? false : true }));
169		setIsAdding(addMode);
170		if (!addMode) setOpen(false);
171	}, [isAdding, props.readOnly]);
172	const handleOpenChange = import_react.useCallback(() => {
173		if (open) {
174			setColumnFilters([{
175				id: "action",
176				value: "Remove"
177			}]);
178			setColumnVisibility((prev) => _objectSpread2(_objectSpread2({}, prev), {}, { action: props.readOnly ? false : true }));
179			setIsAdding(false);
180		}
181		setOpen((prev) => !prev);
182	}, [open, props.readOnly]);
183	const table = useReactTable({
184		data: props.items,
185		columns: props.columns,
186		getCoreRowModel: getCoreRowModel(),
187		getFilteredRowModel: getFilteredRowModel(),
188		state: {
189			globalFilter,
190			columnVisibility,
191			columnFilters
192		},
193		onGlobalFilterChange: (updater) => {
194			setGlobalFilter((prev) => typeof updater === "function" ? updater(prev) : updater);
195		},
196		onColumnVisibilityChange: (updater) => {
197			setColumnVisibility((prev) => typeof updater === "function" ? updater(prev) : updater);
198		},
199		onColumnFiltersChange: setColumnFilters
200	});
201	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Dialog, {
202		onOpenChange: handleOpenChange,
203		open,
204		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTrigger, {
205			asChild: true,
206			children: props.children
207		}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
208			className: "w-full max-w-[750px] gap-0 bg-white p-0",
209			children: [
210				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, {
211					className: "px-6 pb-4 pt-6",
212					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
213						className: "type-body-2xl font-medium leading-7",
214						children: props.resource
215					})
216				}),
217				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, {}),
218				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
219					className: "flex flex-col gap-4",
220					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
221						className: "px-6",
222						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
223							placeholder: "Search",
224							onInput: (e) => setGlobalFilter(e.currentTarget.value)
225						})
226					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
227						className: "h-[425px] px-6 pb-6",
228						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableProvider, {
229							table,
230							isLoading: false,
231							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {})
232						})
233					})]
234				}),
235				/* @__P
235URE__ */ (0, import_jsx_runtime.jsx)(DialogFooter, {
236					className: "min-h-20 border-t p-6",
237					children: props.readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
238						variant: "default",
239						onClick: toggleAddMode,
240						className: "h-10",
241						children: isAdding ? "Done" : `Add New ${props.resource}`
242					})
243				})
244			]
245		})]
246	});
247}
248function ClinicalLocationAttribute(props) {
249	const loaderData = useLoaderData();
250	const allLocations = (0, import_react.useMemo)(() => {
251		var _loaderData$locations;
252		return (_loaderData$locations = loaderData.locations.data) !== null && _loaderData$locations !== void 0 ? _loaderData$locations : [];
253	}, [loaderData.locations.data]);
254	const locationList = (0, import_react.useMemo)(() => {
255		let data = [];
256		allLocations === null || allLocations === void 0 || allLocations.forEach((loc) => {
257			const exists = props.locations.includes(loc.id);
258			data.push({
259				id: loc.id,
260				name: loc.name,
261				action: !exists ? "Add" : "Remove"
262			});
263		});
264		return data;
265	}, [props.locations, allLocations]);
266	const singleName = (0, import_react.useMemo)(() => {
267		if (props.locations.length === 0) return "";
268		const match = locationList.find((sl) => sl.id === props.locations[0]);
269		return match === null || match === void 0 ? void 0 : match.name;
270	}, [locationList, props.locations]);
271	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListTableModal, {
272		items: locationList,
273		columns: columns$1,
274		resource: `Locations`,
275		readOnly: props.readOnly,
276		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
277			variant: "text",
278			className: "h-auto p-0 text-indigo-600",
279			children: props.locations.length === 1 ? singleName : `${props.locations.length} Locations`
280		})
281	});
282}
283var columnHelper$1 = createColumnHelper();
284var columns$1 = [columnHelper$1.accessor("name", {
285	id: "name",
286	header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, {
287		header: props.header,
288		className: "h-10",
289		children: "Linked Locations"
290	}),
291	cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, {
292		cell: props.cell,
293		className: "text-left",
294		children: props.getValue()
295	})
296}), columnHelper$1.display({
297	id: "action",
298	filterFn: (row, columnId, filterValue) => {
299		return row.original.action === filterValue;
300	},
301	header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, {
302		header: props.header,
303		className: "flex justify-end",
304		children: "Action"
305	}),
306	cell(props) {
307		return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, {
308			cell: props.cell,
309			className: "flex justify-end",
310			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceLineToggleButton$1, {
311				serviceLineId: props.row.original.id,
312				action: props.row.original.action
313			})
314		});
315	}
316})];
317function ServiceLineToggleButton$1(props) {
318	var _fetcher$data4, _fetcher$data5;
319	const fetcher = useFetcher();
320	const config = props.action === "Remove" ? {
321		method: "DELETE",
322		intent: PROCEDURE_INTENT.REMOVE_CLINICAL_LOCATION,
323		label: "Remove"
324	} : {
325		method: "POST",
326		intent: PROCEDURE_INTENT.ADD_CLINICAL_LOCATION,
327		label: "Add"
328	};
329	const prevStateRef = import_react.useRef(fetcher.state);
330	(0, import_react.useEffect)(() => {
331		var _fetcher$data;
332		if (prevStateRef.current === "loading" && fetcher.state === "idle" && (fetcher === null || fetcher === void 0 || (_fetcher$data = fetcher.data) === null || _fetcher$data === void 0 ? void 0 : _fetcher$data.success) === false) {
333			var _fetcher$data2, _fetcher$data3;
334			toast({
335				title: "Error applying changes to service line",
336				description: ((_fetcher$data2 = fetcher.data) === null || _fetcher$data2 === void 0 || (_fetcher$data2 = _fetcher$data2.error) === null || _fetcher$data2 === void 0 ? void 0 : _fetcher$data2.formErrors) ? (_fetcher$data3 = fetcher.data) === null || _fetcher$data3 === void 0 || (_fetcher$data3 = _fetcher$data3.error) === null || _fetcher$data3 === void 0 ? void 0 : _fetcher$data3.formErrors : "Unknown error",
337				variant: "destructive"
338			});
339		}
340		prevStateRef.current = fetcher.state;
341	}, [
342		fetcher.state,
343		(_fetcher$data4 = fetcher.data) === null || _fetcher$data4 === void 0 ? void 0 : _fetcher$data4.success,
344		(_fetcher$data5 = fetcher.data) === null || _fetcher$data5 === void 0 || (_fetcher$data5 = _fetcher$data5.error) === null || _fetcher$data5 === void 0 ? void 0 : _fetcher$data5.formErrors
345	]);
346	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(fetcher.Form, {
347		method: config.method,
348		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
349			type: "hidden",
350			name: "location_id",
351			value: props.serviceLineId
352		}
352), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
353			name: "intent",
354			value: config.intent,
355			disabled: fetcher.state !== "idle",
356			variant: "outline",
357			size: "badge",
358			className: "h-6 rounded-[5px] px-1",
359			children: config.label
360		})]
361	});
362}
363function ClinicalProcedureList(props) {
364	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
365		className: "h-auto overflow-y-auto rounded border p-2",
366		children: props.clinicalProcedures.map((cp) => {
367			var _cp$description;
368			return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
369				className: "type-body-xs flex items-center gap-2 py-2 font-medium",
370				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, {
371					text: (_cp$description = cp.description) !== null && _cp$description !== void 0 ? _cp$description : "Description Not Available",
372					className: "w-full",
373					toolTipClassName: "max-w-80"
374				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
375					className: "min-w-max text-light",
376					children: cp.code
377				})]
378			}, cp.code);
379		})
380	});
381}
382function ServiceLinesAttribute(props) {
383	const loaderData = useLoaderData();
384	const allServiceLines = (0, import_react.useMemo)(() => {
385		var _loaderData$serviceLi;
386		return (_loaderData$serviceLi = loaderData.serviceLines.data) !== null && _loaderData$serviceLi !== void 0 ? _loaderData$serviceLi : [];
387	}, [loaderData.serviceLines.data]);
388	const serviceLinesList = (0, import_react.useMemo)(() => {
389		let data = [];
390		allServiceLines === null || allServiceLines === void 0 || allServiceLines.forEach((sl) => {
391			const exists = props.serviceLines.includes(sl.id);
392			data.push({
393				id: sl.id,
394				name: sl.name,
395				action: !exists ? "Add" : "Remove"
396			});
397		});
398		return data;
399	}, [props.serviceLines, allServiceLines]);
400	const singleName = (0, import_react.useMemo)(() => {
401		if (props.serviceLines.length === 0) return "";
402		const match = serviceLinesList.find((sl) => sl.id === props.serviceLines[0]);
403		return match === null || match === void 0 ? void 0 : match.name;
404	}, [serviceLinesList, props.serviceLines]);
405	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plural, {
406		n: props.serviceLines.length,
407		zero: "–",
408		one: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: singleName }),
409		other: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ListTableModal, {
410			items: serviceLinesList,
411			columns,
412			resource: `Service Lines`,
413			readOnly: props.readOnly,
414			children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
415				variant: "text",
416				className: "h-auto p-0 text-indigo-600",
417				children: [props.serviceLines.length, " Service Lines"]
418			})
419		})
420	});
421}
422var columnHelper = createColumnHelper();
423var columns = [columnHelper.accessor("name", {
424	id: "name",
425	header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, {
426		header: props.header,
427		className: "h-10",
428		children: "Linked Service Lines"
429	}),
430	cell: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, {
431		cell: props.cell,
432		className: "text-left",
433		children: props.getValue()
434	})
435}), columnHelper.display({
436	id: "action",
437	filterFn: (row, columnId, filterValue) => {
438		return row.original.action === filterValue;
439	},
440	header: (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, {
441		header: props.header,
442		className: "flex justify-end",
443		children: "Action"
444	}),
445	cell(props) {
446		return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, {
447			cell: props.cell,
448			className: "flex justify-end",
449			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceLineToggleButton, {
450				serviceLineId: props.row.original.id,
451				action: props.row.original.action
452			})
453		});
454	}
455})];
456function ServiceLineToggleButton(props) {
457	var _fetcher$data4, _fetcher$data5;
458	const fetcher = useFetcher();
459	const config = props.action === "Remove" ? {
460		method: "DELETE",
461		intent: PROCEDURE_INTENT.REMOVE_SERVICE_LINE,
462		label: "Remove"
463	} : {
464		method: "POST",
465		intent: PROCEDURE_INTENT.ADD_SERVICE_LINE,
466		label: "Add"
467	};
468	const prevStateRef = import_react.useRef(fetcher.state);
469	(0, import_react.useEffect)(() => {
470		var _fetcher$data;
471		if (prevStateRef.current === "loading" && fetcher.state === "i
471dle" && (fetcher === null || fetcher === void 0 || (_fetcher$data = fetcher.data) === null || _fetcher$data === void 0 ? void 0 : _fetcher$data.success) === false) {
472			var _fetcher$data2, _fetcher$data3;
473			toast({
474				title: "Error applying changes to service line",
475				description: ((_fetcher$data2 = fetcher.data) === null || _fetcher$data2 === void 0 || (_fetcher$data2 = _fetcher$data2.error) === null || _fetcher$data2 === void 0 ? void 0 : _fetcher$data2.formErrors) ? (_fetcher$data3 = fetcher.data) === null || _fetcher$data3 === void 0 || (_fetcher$data3 = _fetcher$data3.error) === null || _fetcher$data3 === void 0 ? void 0 : _fetcher$data3.formErrors : "Unknown error",
476				variant: "destructive"
477			});
478		}
479		prevStateRef.current = fetcher.state;
480	}, [
481		fetcher.state,
482		(_fetcher$data4 = fetcher.data) === null || _fetcher$data4 === void 0 ? void 0 : _fetcher$data4.success,
483		(_fetcher$data5 = fetcher.data) === null || _fetcher$data5 === void 0 || (_fetcher$data5 = _fetcher$data5.error) === null || _fetcher$data5 === void 0 ? void 0 : _fetcher$data5.formErrors
484	]);
485	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(fetcher.Form, {
486		method: config.method,
487		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
488			type: "hidden",
489			name: "service_line_id",
490			value: props.serviceLineId
491		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
492			name: "intent",
493			value: config.intent,
494			disabled: fetcher.state !== "idle",
495			variant: "outline",
496			size: "badge",
497			className: "h-6 rounded-[5px] px-1",
498			children: config.label
499		})]
500	});
501}
502function ProcedureDetailSidebarContent() {
503	var _procedure$clinical_p, _procedure$clinical_p2, _procedure$clinical_p3;
504	const procedure = useLoaderData().procedure.data;
505	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarContent, {
506		className: "pt-3",
507		children: [
508			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarGroup, {
509				className: "gap-1 px-3 py-0",
510				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesList, { children: [
511					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Status TODO FE-435" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProcedureCardStatusBadge, { status: procedure.status })] }),
512					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Assignee" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "TODO FE-435" })] }),
513					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Author" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClariumAIAuthor, {})] })
514				] }
514), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesList, { children: [
515					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Card Cost" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: procedure.card_cost })] }),
516					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Physicians" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: procedure.physician_count })] }),
517					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Cases" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: procedure.case_count })] }),
518					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
519						className: "text-nowrap",
520						children: "Service Lines"
521					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceLinesAttribute, {
522						serviceLines: procedure.service_lines.map((sl) => sl.id),
523						readOnly: false
524					})] }),
525					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarAttributesListItem, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
526						className: "text-nowrap",
527						children: "Locations"
528					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClinicalLocationAttribute, {
529						locations: procedure.preference_card_clinical_locations.map((l) => l.id),
530						readOnly: false
531					})] })
532				] })]
533			}),
534			/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarGroup, {
535				className: "px-3 py-0",
536				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarGroupLabel, {
537					className: "justify-between",
538					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
539						"Procedure Codes (",
540						(_procedure$clinical_p = (_procedure$clinical_p2 = procedure.clinical_procedures) === null || _procedure$clinical_p2 === void 0 ? void 0 : _procedure$clinical_p2.length) !== null && _procedure$clinical_p !== void 0 ? _procedure$clinical_p : 0,
541						")"
542					] }
542), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "TODO FE-435" })]
543				}), ((_procedure$clinical_p3 = procedure.clinical_procedures) === null || _procedure$clinical_p3 === void 0 ? void 0 : _procedure$clinical_p3.length) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClinicalProcedureList, { clinicalProcedures: procedure.clinical_procedures }) }) : null]
544			}),
545			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroup, {
546				className: "border-t p-0",
547				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarGroupContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
548					className: "px-3 py-4 shadow-[0_4px_10px_0_rgba(0,0,0,0.06)]",
549					children: "TODO Add comment form FE-393"
550				}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
551					className: "h-full p-3",
552					children: "TODO Activity FE-394"
553				})] })
554			})
555		]
556	});
557}
558let PROCEDURE_INTENT = /* @__PURE__ */ function(PROCEDURE_INTENT$1) {
559	PROCEDURE_INTENT$1["ADD_SERVICE_LINE"] = "add-service-line";
560	PROCEDURE_INTENT$1["REMOVE_SERVICE_LINE"] = "remove-service-line";
561	PROCEDURE_INTENT$1["ADD_CLINICAL_LOCATION"] = "add-clinical-location";
562	PROCEDURE_INTENT$1["REMOVE_CLINICAL_LOCATION"] = "remove-clinical-location";
563	return PROCEDURE_INTENT$1;
564}({});
565async function loader(args) {
566	invariant(args.params.procedureId, "procedureId is required");
567	const procedure = await getProcedureCardDetail({ path: { procedure_card_id: args.params.procedureId } });
568	if (!procedure.data) {
569		var _procedure$error$deta, _procedure$error$deta2;
570		throw new Error((_procedure$error$deta = (_procedure$error$deta2 = procedure.error.detail) === null || _procedure$error$deta2 === void 0 ? void 0 : _procedure$error$deta2.map((error) => error.msg).join(", ")) !== null && _procedure$error$deta !== void 0 ? _procedure$error$deta : "Unknown error fetching procedure details");
571	}
572	return {
573		procedure,
574		serviceLines: await getServiceLineFilterOptions(),
575		locations: await getClinicalLocationFilterOptions()
576	};
577}
578async function action(args) {
579	const formData = await args.request.formData();
580	const intent = formData.get("intent");
581	const procedureId = args.params.procedureId;
582	if (!procedureId) return {
583		success: false,
584		error: {
585			formErrors: ["Invalid procedure card details"],
586			fieldErrors: {}
587		}
588	};
589	if (intent === PROCEDURE_INTENT.ADD_SERVICE_LINE) return handleAddServiceLine(formData, procedureId);
590	else if (intent === PROCEDURE_INTENT.REMOVE_SERVICE_LINE) return handleRemoveServiceLine(formData, procedureId);
591	else if (intent === PROCEDURE_INTENT.ADD_CLINICAL_LOCATION) return handleAddLocation(formData, procedureId);
592	else if (intent === PROCEDURE_INTENT.REMOVE_CLINICAL_LOCATION) return handleRemoveLocation(formData, procedureId);
593	else return {
594		success: false,
595		error: {
596			formErrors: [`Unknown intent: ${intent}`],
597			fieldErrors: {}
598		}
599	};
600}
601async function handleAddServiceLine(formData, procedureId) {
602	var _formData$get;
603	const serviceLineId = (_formData$get = formData === null || formData === void 0 ? void 0 : formData.get("service-line-id")) !== null && _formData$get !== void 0 ? _formData$get : "";
604	if (!serviceLineId) return {
605		success: false,
606		error: {
607			formErrors: ["Invalid service line id"],
608			fieldErrors: {}
609		}
610	};
611	return processApiResult(await addProcedureCardServiceLine({
612		body: { service_line_id: serviceLineId },
613		path: { procedure_card_id: procedureId }
614	}));
615}
616async function handleRemoveServiceLine(formData, procedureId) {
617	var _formData$get2;
618	const serviceLineId = (_formData$get2 = formData === null || formData === void 0 ? void 0 : formData.get("service-line-id")) !== null && _formData$get2 !== void 0 ? _formData$get2 : "";
619	if (!serviceLineId) return {
620		success: false,
621		error: {
622			formErrors: ["Invalid service line id"],
623			fieldErrors: {}
624		}
625	};
626	return processApiResult(await removeProcedureCardServiceLine({
627		body: { service_line_id: serviceLineId },
628		path: { procedure_card_id: procedureId }
629	}));
630}
631async function handleAddLocation(formData, procedureId) {
632	var _formData$get3;
633	const locationId = (_formData$get3 = formData === null || formData === void 0 ? void 0 : formData.get("location_id")) !== null && _formData$get3 !== void 0 ? _formData$get3 : "";
634	if (!locationId) return {
635		success: false,
636		error: {
637			formErrors: ["Invalid location id"],
638			fieldErrors: {}
639		}
640	};
641	return processApiResult(await addProcedureCardClinicalLocation({
642		body: { location_id: locationId },
643		path: { procedure_card_id: procedureId }
644	}));
645}
646async function handleRemoveLocation(formData, procedureId) {
647	var _formData$get4;
648	const locationId = (_formData$get4 = formData === null || formData === void 0 ? void 0 : formData.get("location_id")) !== null && _formData$get4 !== void 0 ? _formData$get4 : "";
649	if (!locationId) return {
650		success: false,
651		error: {
652			formErrors: ["Invalid location id"],
653			fieldErrors: {}
654		}
655	};
656	return processApiResult(await removeProcedureCardClinicalLocation({
657		body: { location_id: locationId },
658		path: { procedure_card_id: procedureId }
659	}));
660}
661function Component() {
662	const procedure = useLoaderData().procedure.data;
663	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayoutRoot, {
664		style: { "--sidebar-width": "340px" },
665		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PageLayoutMain, {
666			className: "grid grid-rows-[auto_1fr] bg-background",
667			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
668				className: "sticky top-0 z-20 bg-zinc-50",
669				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
670					className: "border-b bg-white px-6 py-4",
671					children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HeaderBreadcrumb, { breadcrumbItems: [{
672						breadcrumbText: "Procedure Cards",
673						backToLink: PROCEDURE_CARDS_BASE_PATH
674					}, {
675						breadcrumbText: "Procedure Card 123",
676						backToLink: null
677					}] })
678				}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
679					className: "flex flex-col gap-3.5",
680					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
681						className: "px-6 pt-4",
682						children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
683							className: "flex flex-col space-y-1",
684							children: [
685								/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, {
686									text: "FE-434 Allow Procedure Card Admins to update Procedure name",
687									className: "type-h6"
688								}),
689								/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, {
690									text: procedure.name,
691									className: "type-h6"
692								}),
693								/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, {
694									text: procedure.description,
695									className: "type-body-sm text-zinc-900"
696								}),
697								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
698									className: "flex flex-row space-x-1",
699									children: [
700										/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProcedureCardStatusBadge, { status: procedure.status }),
701										/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
702											variant: "outline",
703											children: procedure.display_id
704										}),
705										procedure.service_lines.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, {
706											variant: "secondary",
707											children: [procedure.service_lines[0].name, procedure.service_lines.length > 1 ? ` +${procedure.service_lines.length - 1}` : ""]
708										}) : null
709									]
710								})
711							]
712						})
713					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
714						className: "border-b px-6",
715						children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavigationTabs, {})
716					})]
717				})]
718			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {})]
719		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageLayoutSidebar, {
720			className: "relative overflow-hidden",
721			children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProcedureDetailSidebarContent, {})
722		})]
723	});
724}
725const ErrorBoundary = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogErrorBoundary, { routeComponent: "CardOptimizerProcedureCardDetail" });
726export { Component, ErrorBoundary, PROCEDURE_INTENT, action, loader };
727
728//# sourceMappingURL=procedure-detail.route-CzsaL1jI.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.