lookup focus functionality in client table view
This commit is contained in:
parent
a01f72bbc1
commit
c5c5ffb0fb
4 changed files with 82 additions and 49 deletions
|
|
@ -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) => {
|
|||
<template v-else>
|
||||
<SidebarSpeedDial
|
||||
v-if="!isCollapsed"
|
||||
:key="category.name"
|
||||
:key="`dial-${category.name}`"
|
||||
:icon="category.icon"
|
||||
:label="category.name"
|
||||
:items="category.buttons"
|
||||
|
|
@ -172,7 +190,7 @@ const handleCategoryClick = (category) => {
|
|||
<button
|
||||
v-else
|
||||
class="sidebar-button"
|
||||
:key="category.name"
|
||||
:key="`collapsed-${category.name}`"
|
||||
:title="category.name"
|
||||
@click="openSidebarAndDial(category)"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue