From d4478bdacce8afa2d961f88e5aae73ad56400053 Mon Sep 17 00:00:00 2001 From: Duradundi Hadimani Date: Fri, 21 Nov 2025 19:51:49 +0530 Subject: [PATCH] Added filters and buttons for print QR --- src/components/LinkField.tsx | 50 +++---- src/pages/AssetDetail.tsx | 141 +++++++++++++++++++ src/pages/AssetList.tsx | 256 ++++++++++++++++++----------------- 3 files changed, 302 insertions(+), 145 deletions(-) diff --git a/src/components/LinkField.tsx b/src/components/LinkField.tsx index 5f40da2..deffe75 100644 --- a/src/components/LinkField.tsx +++ b/src/components/LinkField.tsx @@ -9,6 +9,7 @@ interface LinkFieldProps { placeholder?: string; disabled?: boolean; filters?: Record; + compact?: boolean; // ✅ Add this prop } const LinkField: React.FC = ({ @@ -19,6 +20,7 @@ const LinkField: React.FC = ({ placeholder, disabled = false, filters = {}, + compact = false, // ✅ Default to false }) => { const [searchResults, setSearchResults] = useState<{ value: string; description?: string }[]>([]); const [searchText, setSearchText] = useState(''); @@ -35,7 +37,6 @@ const LinkField: React.FC = ({ // Add filters if provided if (filters && Object.keys(filters).length > 0) { - // Convert filters to JSON string for Frappe API params.append('filters', JSON.stringify(filters)); } @@ -54,15 +55,13 @@ const LinkField: React.FC = ({ if (isDropdownOpen) { searchLink(searchText || ''); } - }, [isDropdownOpen, filters]); // Re-fetch when filters change + }, [isDropdownOpen, filters]); // Close dropdown when clicking outside useEffect(() => { const handleClickOutside = (event: MouseEvent) => { if (containerRef.current && !containerRef.current.contains(event.target as Node)) { setDropdownOpen(false); - - // Reset search text to current value when closing setSearchText(''); } }; @@ -85,20 +84,25 @@ const LinkField: React.FC = ({ }; return ( -
-