diff --git a/frontend/src/components/SideBar.vue b/frontend/src/components/SideBar.vue index 69243cc..fc218c9 100644 --- a/frontend/src/components/SideBar.vue +++ b/frontend/src/components/SideBar.vue @@ -27,6 +27,16 @@ const notifications = useNotificationStore(); const isCollapsed = ref(false); const pendingOpen = ref(null); +const focusClientInput = (inputId) => { + if (typeof document === "undefined") return; + nextTick(() => { + const el = document.getElementById(inputId); + if (el && typeof el.focus === "function") { + el.focus(); + } + }); +}; + const toggleSidebar = () => { isCollapsed.value = !isCollapsed.value; }; @@ -44,13 +54,21 @@ const clientButtons = ref([ { label: "Customer Lookup", command: () => { - router.push("/clients"); + if (router.currentRoute.value.path === "/clients") { + focusClientInput("customerSearchInput"); + } else { + router.push("/clients?lookup=customer"); + } } }, { label: "Property Lookup", command: () => { - router.push("/clients"); + if (router.currentRoute.value.path === "/clients") { + focusClientInput("propertySearchInput"); + } else { + router.push("/clients?lookup=property"); + } } }, @@ -151,7 +169,7 @@ const handleCategoryClick = (category) => { 'sidebar-button', router.currentRoute.value.path === category.url ? 'active' : '', ]" - :key="category.name" + :key="`btn-${category.name}`" @click="handleCategoryClick(category)" :title="isCollapsed ? category.name : ''" > @@ -162,7 +180,7 @@ const handleCategoryClick = (category) => {