import { inputText } from "@lib/_common/util/surveyUtil"; import { addStyles } from "@lib/setupRoot"; import { createSignal, onMount } from "solid-js"; import AppStylesheet from "./App.css?inline"; import { getDiopterClassname, getIcuFrontPanelUpcs, getIcuLeftPanelUpcs, getIcuRightPanelUpcs, getWinkPanelUpcs, } from "./util"; const ICU_OOS_TEXT = "Scan each out of stock item using your Store specific Scan Guide for the ICU ENDCAP Fixture."; // const WINK_OOS_TEXT = // "SCAN each out of stock item using your Store specific Scan Guide for the ICU Wink SIDECAP Display."; export function AppIcuPicker() { const [isAppVisible, setIsAppVisible] = createSignal(true); onMount(() => { addStyles(AppStylesheet); }); const selectedIcuUpcs: string[] = []; const selectedWinkUpcs: string[] = []; const icuLeftPanelUpcs = getIcuLeftPanelUpcs(); const icuFrontPanelUpcs = getIcuFrontPanelUpcs(); const icuRightPanelUpcs = getIcuRightPanelUpcs(); const winkPanelUpcs = getWinkPanelUpcs(); function handleClick(event: MouseEvent) { const targetElement = event.target as HTMLLIElement; const upc = targetElement.dataset.upc; if (upc === undefined) { return; } targetElement.classList.toggle("selected"); if (targetElement.closest(".icu-container")) { selectedIcuUpcs.push(upc); } else if (targetElement.closest(".wink-container")) { selectedWinkUpcs.push(upc); } } function handleSubmit() { selectedIcuUpcs.forEach((upc) => inputText(ICU_OOS_TEXT, upc, { clickSubmit: true })); setIsAppVisible(() => false); alert(`${selectedIcuUpcs.length} total ICU items OOS`); } return (
); }