1import { o as __toESM } from "./chunk-6z4oVpB-.js"; 2import "./react-CCT1erMQ.js"; 3import "./prop-types-BP3O0vhg.js"; 4import { t as require_jsx_runtime } from "./jsx-runtime-6ToSbptA.js"; 5import "./clsx-BbsgvS4T.js"; 6import "./typeof-CtObx4yR.js"; 7import "./Amplify-ydFdTLPK.js"; 8import { n as _objectSpread2, r as init_objectSpread2, t as _objectWithoutProperties } from "./objectWithoutProperties-Cgp7QKOy.js"; 9import "./types-CQ-ki0qK.js"; 10import "./amplifyUrl-DhBXUoj8.js"; 11import "./tslib.es6-CGMJRn24.js"; 12import "./api-BN7R4l5b.js"; 13import "./createCognitoUserPoolEndpointResolver-DIsnsOMn.js"; 14import "./auth-D-8td4-a.js"; 15import { a as formatCurrency } from "./helpers-BQW8LNh3.js"; 16import "./getCurrentUser-CO2hH9tr.js"; 17import "./_baseGetTag-CcQT-b-8.js"; 18import "./errors-CJ9PkTii.js"; 19import "./isObjectLike-C0C335kY.js"; 20import "./shim-BLxGA08a.js"; 21import "./use-isomorphic-layout-effect.browser.esm-BDjLKVP-.js"; 22import "./isSymbol-BD-EcKMA.js"; 23import "./debounce-CIlO4Yzq.js"; 24import "./dist-Cz4mcmaa.js"; 25import "./dist-DaeMORX8.js"; 26import "./react-dom-Dddidh9b.js"; 27import "./dist-DetJSI7l.js"; 28import "./dist-Dsgwk-jH.js"; 29import "./classPrivateFieldGet2-D2HqlEEJ.js"; 30import "./dist-javwCbI7.js"; 31import "./dist-DjKy_3Dj.js"; 32import "./Combination-CE9BhVA8.js"; 33import "./dist-BHtPb5hX.js"; 34import "./dist-C5RjQM0F.js"; 35import "./dist-SbNcsVrs.js"; 36import "./dist-BnVQncHy.js"; 37import { i as DropdownMenuItem } from "./dropdown-menu-NIFzDEaK.js"; 38import { F as useSearchParams, T as useLoaderData } from "./chunk-62JRHF6Z-z8JX8DDB.js"; 39import "./exports-PpHA8CsK.js"; 40import "./notifyManager-Bch6NZ-h.js"; 41import "./useBaseQuery-1WImwwVq.js"; 42import "./useInfiniteQuery-CX5ozztk.js"; 43import "./useMutation-k2qXTuOE.js"; 44import "./QueryClientProvider-DBT_lM_H.js"; 45import "./useQuery-DLS21iiV.js"; 46import "./constants-TZTPDohO.js"; 47import "./session-BF1M_iJk.js"; 48import "./iconPropTypes-C5chbmyn-CpVo52O4.js"; 49import "./bucket-0-Uq1JG5fZ.js"; 50import "./bucket-1-COAg-Eqq.js"; 51import "./bucket-3-DKA1ROBB.js"; 52import "./bucket-6-B3kg9Htr.js"; 53import "./bucket-10-Ca5cox4R.js"; 54import "./bucket-13-DojbEaO8.js"; 55import "./bucket-15-CpBPyEaO.js"; 56import "./bucket-18-BV3V-3UN.js"; 57import "./dist-W5s9RbHT.js"; 58import "./dist-DCv7IJcI.js"; 59import "./createLucideIcon-DENnxagg.js"; 60import "./check-BFnH1yl0.js"; 61import "./chevron-right-CEcbN75N.js"; 62import "./utils-DL_RvPHk.js"; 63import "./mixpanel.module-D03As0KW.js"; 64import "./subDays-vez96V8M.js"; 65import "./addMonths-C0iKCEqw.js"; 66import "./endOfMonth-h_W7cRKV.js"; 67import "./roundingMethods-DuMrTbDg.js"; 68import "./differenceInWeeks-B00-N4lk.js"; 69import { t as Button } from "./button-BgUr9YaP.js"; 70import "./tooltip-BQPMLsOF.js"; 71import { n as LongText_default } from "./LongText-Chh0tzMc.js"; 72import "./badge-BfOudBXs.js"; 73import "./useSessionQuery-CydkiRrr.js"; 74import "./bootstrap-BQ86EXdW.js"; 75import "./track-BOLPaScP.js"; 76import "./utils-BFgzP0mr.js"; 77import "./comments-Z3QCdchs.js"; 78import "./base-path-CtfbOIOI.js"; 79import "./zod-McvqnZjg.js"; 80import "./input-wPGsBI9X.js"; 81import "./skeleton-DlrxaJwT.js"; 82import { t as invariant } from "./tiny-invariant-DGRZ75gT.js"; 83import "./useDebounceCallback-CpDQu6xV.js"; 84import { a as getExpandedRowModel, 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 "./api-DBmJIxr0.js"; 90import "./useMatchesData-DA2pgjYw.js"; 91import "./api-r4p_4VL4.js"; 92import "./queries-IBfwHsl2.js"; 93import "./dist-C2D8DSus.js"; 94import "./popover-SmfnFw8c.js"; 95import { a as TableLayoutHeader, n as TableLayoutBody, o as TableLayoutHeaderRow, s as TableLayoutRoot } from "./table-layout-BMU5VJgu.js"; 96import { r as DefaultTableCell, t as DefaultTableHead } from "./table-header-kEso2dsp.js"; 97import { t as Table } from "./table-rkatVwLH.js"; 98import "./textarea-HOzOod_m.js"; 99import "./DetailPopover-BgYp7AYL.js"; 100import { t as AsyncTableProvider } from "./async-table-provider-CdQTSu03.js"; 101import { i as ItemSearchForm, r as ItemDetailCell, t as EllipsisMenu } from "./ellipsis-menu-Dfnnbdad.js"; 102import { n as ValueBadge, t as RecommendationBadge } from "./recommendation-badge-C0lxeKPl.js"; 103import { t as SortableHeader } from "./sortable-header-C-AMl5_M.js"; 104var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
105init_objectSpread2(); 106var _excluded = [ 107 "DefaultTableRow", 108 "row", 109 "rowIndex" 110]; 111function createCategoryRow(categoryName, sequence, items) { 112 return { 113 id: "", 114 category: { 115 name: categoryName, 116 sequence 117 }, 118 cost: 0, 119 client_item_id: "", 120 subRows: items 121 }; 122} 123function groupByCategory(data) { 124 const categoryMap = /* @__PURE__ */ new Map(); 125 for (const item of data) { 126 var _item$category$name, _item$category; 127 const categoryName = (_item$category$name = (_item$category = item.category) === null || _item$category === void 0 ? void 0 : _item$category.name) !== null && _item$category$name !== void 0 ? _item$category$name : "Uncategorized"; 128 const existing = categoryMap.get(categoryName); 129 if (existing) existing.push(item); 130 else categoryMap.set(categoryName, [item]); 131 } 132 return Array.from(categoryMap.entries()).map(([categoryName, items]) => { 133 var _items$0$category$seq, _items$; 134 return createCategoryRow(categoryName, (_items$0$category$seq = (_items$ = items[0]) === null || _items$ === void 0 || (_items$ = _items$.category) === null || _items$ === void 0 ? void 0 : _items$.sequence) !== null && _items$0$category$seq !== void 0 ? _items$0$category$seq : 0, items); 135 }); 136} 137var mock_data = [{ 138 id: "1", 139 category: { 140 name: "Category 1", 141 sequence: 1 142 }, 143 cost: 100, 144 client_item_id: "1" 145}, { 146 id: "2", 147 category: { 148 name: "Category 2", 149 sequence: 2 150 }, 151 cost: 200, 152 client_item_id: "2" 153}]; 154async function loader(args) { 155 invariant(args.params.cardId, "cardId is required"); 156 return { items: new Promise((resolve) => { 157 resolve(groupByCategory(mock_data)); 158 }) }; 159} 160function Component() { 161 var _searchParams$get, _searchParams$get2; 162 const loaderData = useLoaderData(); 163 const [searchParams] = useSearchParams(); 164 const searchTerm = (_searchParams$get = searchParams.get("search")) !== null && _searchParams$get !== void 0 ? _searchParams$get : ""; 165 const selectedRow = (_searchParams$get2 = searchParams.get("selected_item")) !== null && _searchParams$get2 !== void 0 ? _searchParams$get2 : ""; 166 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutRoot, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AsyncTableProvider, { 167 data: loaderData.items, 168 columns, 169 options: { 170 getRowId: (row) => row.id, 171 getExpandedRowModel: getExpandedRowModel(), 172 getSubRows: (row) => row.subRows, 173 getFilteredRowModel: getFilteredRowModel(), 174 filterFromLeafRows: true, 175 maxLeafRowFilterDepth: 1, 176 state: { 177 expanded: true, 178 rowSelection: { [selectedRow]: true }, 179 columnFilters: [{ 180 id: "id", 181 value: searchTerm 182 }] 183 } 184 }, 185 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableLayoutHeader, { 186 className: "gap-0", 187 children: [
188 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutHeaderRow, { 189 className: "gap-6 px-6", 190 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 191 className: "grow", 192 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemSearchForm, { placeholder: "Search picklist items" }) 193 }) 194 }), 195 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("hr", { className: "my-5 border-border" }), 196 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableLayoutHeaderRow, { 197 className: "items-center gap-2 px-6", 198 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 199 className: "grow", 200 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 201 className: "type-body-xl font-medium", 202 children: "Preference Card Conflicts" 203 }) 204 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 205 className: "flex items-center gap-2", 206 children: [ 207 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 208 variant: "outline", 209 children: "TODO Select All Recommendations" 210 }), 211 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 212 variant: "outline", 213 children: "TODO Reset Selections" 214 }), 215 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { children: "TODO Submit Change Request" }) 216 ] 217 })] 218 }) 219 ] 220 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableLayoutBody, { 221 className: "px-6", 222 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, { renderRow: (props) => { 223 const { DefaultTableRow, row, rowIndex } = props, tableRowProps = _objectWithoutProperties(props, _excluded); 224 if (row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableRow, _objectSpread2(_objectSpread2({}, tableRowProps), {}, { className: "z-10 bg-indigo-50 hover:bg-indigo-50" }), rowIndex); 225 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableRow, _objectSpread2(_objectSpread2({}, tableRowProps), {}, { 226 "data-state": row.getIsSelected() ? "selected" : null, 227 className: "data-[state=selected]:bg-zinc-100" 228 }), rowIndex); 229 } }) 230 })] 231 }) }); 232} 233var columnHelper = createColumnHelper(); 234var columns = [ 235 columnHelper.display({ 236 id: "item_details", 237 meta: { label: "Item Details" }, 238 size: 400, 239 header(props) { 240 var _props$column$columnD; 241 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 242 header: props.header, 243 className: "h-10", 244 children: (_props$column$columnD = props.column.columnDef.meta) === null || _props$column$columnD === void 0 ? void 0 : _props$column$columnD.label 245 }); 246 }, 247 cell(props) { 248 const [, setSearchParams] = useSearchParams(); 249 if (props.row.getCanExpand()) { 250 var _props$row$original$c, _props$row$original$c2; 251 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 252 cell: props.cell, 253 className: "h-10", 254 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LongText_default, { text: (_props$row$original$c = (_props$row$original$c2 = props.row.original.category) === null || _props$row$original$c2 === void 0 ? void 0 : _props$row$original$c2.name) !== null && _props$row$original$c !== void 0 ? _props$row$original$c : "" }) 255 }); 256 } 257 function handleClick() { 258 setSearchParams((prev) => { 259 var _props$row$original$c3; 260 prev.set("selected_item", (_props$row$original$c3 = props.row.original.client_item_id) !== null && _props$row$original$c3 !== void 0 ? _props$row$original$c3 : ""); 261 return prev; 262 }); 263 props.table.setRowSelection({ [props.row.id]: true }); 264 } 265 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 266 cell: props.cell, 267 className: "h-auto px-2 py-1.5", 268 role: "button", 269 tabIndex: 0, 270 "aria-label": "Select item", 271 onClick: handleClick, 272 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemDetailCell, { item: props.cell.row.original }) 273 }); 274 } 275 }), 276 columnHelper.display({ 277 id: "recommendation", 278 meta: { 279 label: "Recommendation", 280 info: "Clarium identified recommendation based off of last 12 months of historical utilization" 281 }, 282 header(props) { 283 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 284 header: props.header, 285 className: "h-10", 286 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { c
286olumn: props.column }) 287 }); 288 }, 289 cell(props) { 290 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 291 cell: props.cell, 292 className: "h-10" 293 }); 294 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 295 cell: props.cell, 296 className: "h-auto", 297 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecommendationBadge, { actionType: "" }) 298 }); 299 } 300 }), 301 columnHelper.display({ 302 id: "open", 303 meta: { 304 label: "Open", 305 info: "Current preference card open quantity (and recommended change where applicable)" 306 }, 307 header(props) { 308 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 309 header: props.header, 310 className: "h-10", 311 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 312 }); 313 }, 314 cell(props) { 315 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 316 cell: props.cell, 317 className: "h-10" 318 }); 319 const from = 0; 320 const to = 0; 321 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 322 cell: props.cell, 323 className: "h-auto", 324 children: typeof to !== "number" ? "â" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ValueBadge, { 325 from, 326 to 327 }) 328 }); 329 } 330 }), 331 columnHelper.display({ 332 id: "PRN", 333 meta: { 334 label: "PRN", 335 info: "Current preference card hold quantity (and recommended change where applicable)" 336 }, 337 header(props) { 338 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 339 header: props.header, 340 className: "h-10", 341 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 342 }); 343 }, 344 cell(props) { 345 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 346 cell: props.cell, 347 className: "h-10" 348 }); 349 const from = 0; 350 const to = 0; 351 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 352 cell: props.cell, 353 className: "h-auto", 354 children: typeof to !== "number" ? "â" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ValueBadge, { 355 from, 356 to 357 }) 358 }); 359 } 360 }), 361 columnHelper.accessor("cost", { 362 id: "item_cost", 363 meta: { label: "Item Cost" }, 364 header(props) { 365 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 366 header: props.header, 367 className: "h-10", 368 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 369 }); 370 }, 371 cell(props) { 372 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 373 cell: props.cell, 374 className: "h-10" 375 }); 376 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 377 cell: props.cell, 378 className: "h-auto", 379 children: typeof props.row.original.cost === "number" ? formatCurrency(props.row.original.cost, 2) : "â" 380 }); 381 } 382 }), 383 columnHelper.display({ 384 id: "action", 385 meta: { label: "Action" }, 386 header(props) { 387 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 388 header: props.header, 389 className: "h-10", 390 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 391 }); 392 }, 393 cell(props) { 394 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 395 cell: props.cell, 396 className: "h-10" 397 }); 398 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 399 cell: props.cell, 400 className: "h-auto", 401 children: "TODO: Action cell" 402 }); 403 } 404 }), 405 columnHelper.display({ 406 id: "menu", 407 meta: {}, 408 header(props) { 409 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableHead, { 410 header: props.header, 411 className: "h-10", 412 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SortableHeader, { column: props.column }) 413 }); 414 }, 415 cell(props) { 416 if (props.row.getCanExpand()) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 417 cell: props.cell, 418 className: "h-10" 419 }); 420 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultTableCell, { 421 cell: props.cell, 422 className: "h-auto", 423 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EllipsisMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuItem, { 424 onSelect: (e) => e.preventDefault(), 425 children: "TODO: Standard item toggle" 426 }) }) 427 }); 428 } 429 }) 430]; 431export { Component, loader }; 432 433//# sourceMappingURL=preference-card-detail-standardization.route-CU96PlWy.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.