@@ -14,6 +14,7 @@ export default function MemorialSearchPage() { |
| 14 | 14 | const [dateFrom, setDateFrom] = useState(''); |
| 15 | 15 | const [dateTo, setDateTo] = useState(''); |
| 16 | 16 | const [noDate, setNoDate] = useState(false); |
| 17 | + const [hasDocument, setHasDocument] = useState(false); |
| 17 | 18 | |
| 18 | 19 | // Results state |
| 19 | 20 | const [results, setResults] = useState<PersonDetail[]>([]); |
@@ -31,7 +32,7 @@ export default function MemorialSearchPage() { |
| 31 | 32 | // Get filters |
| 32 | 33 | const filterData = await getSearchFilters(); |
| 33 | 34 | setFilters(filterData); |
| 34 | | - |
| 35 | + |
| 35 | 36 | // Load all people initially |
| 36 | 37 | const params = { |
| 37 | 38 | q: '', |
@@ -39,9 +40,10 @@ export default function MemorialSearchPage() { |
| 39 | 40 | conflict: '', |
| 40 | 41 | date_from: '', |
| 41 | 42 | date_to: '', |
| 42 | | - no_date: false |
| 43 | + no_date: false, |
| 44 | + has_document: false |
| 43 | 45 | }; |
| 44 | | - |
| 46 | + |
| 45 | 47 | const data = await searchPeople(params); |
| 46 | 48 | setResults(data.results); |
| 47 | 49 | setTotalCount(data.count); |
@@ -50,14 +52,14 @@ export default function MemorialSearchPage() { |
| 50 | 52 | console.error('Failed to initialize:', err); |
| 51 | 53 | } |
| 52 | 54 | } |
| 53 | | - |
| 55 | + |
| 54 | 56 | initialize(); |
| 55 | 57 | }, []); |
| 56 | 58 | |
| 57 | 59 | const performSearch = async () => { |
| 58 | 60 | setLoading(true); |
| 59 | 61 | setHasSearched(true); |
| 60 | | - |
| 62 | + |
| 61 | 63 | try { |
| 62 | 64 | const params = { |
| 63 | 65 | q: searchTerm, |
@@ -65,9 +67,10 @@ export default function MemorialSearchPage() { |
| 65 | 67 | conflict: selectedConflicts.join(','), |
| 66 | 68 | date_from: dateFrom, |
| 67 | 69 | date_to: dateTo, |
| 68 | | - no_date: noDate |
| 70 | + no_date: noDate, |
| 71 | + has_document: hasDocument |
| 69 | 72 | }; |
| 70 | | - |
| 73 | + |
| 71 | 74 | const data = await searchPeople(params); |
| 72 | 75 | setResults(data.results); |
| 73 | 76 | setTotalCount(data.count); |
@@ -108,6 +111,7 @@ export default function MemorialSearchPage() { |
| 108 | 111 | setDateFrom(''); |
| 109 | 112 | setDateTo(''); |
| 110 | 113 | setNoDate(false); |
| 114 | + setHasDocument(false); |
| 111 | 115 | }; |
| 112 | 116 | |
| 113 | 117 | return ( |
@@ -130,6 +134,19 @@ export default function MemorialSearchPage() { |
| 130 | 134 | <h2 className="text-2xl font-bold text-vmi-red mb-6">Search Filters</h2> |
| 131 | 135 | |
| 132 | 136 | <form onSubmit={handleSubmit} className="space-y-6"> |
| 137 | + {/* Memorial Document Filter */} |
| 138 | + <div> |
| 139 | + <label className="flex items-center cursor-pointer hover:bg-gray-50 p-2 rounded"> |
| 140 | + <input |
| 141 | + type="checkbox" |
| 142 | + checked={hasDocument} |
| 143 | + onChange={(e) => setHasDocument(e.target.checked)} |
| 144 | + className="mr-3 text-vmi-red focus:ring-vmi-gold w-4 h-4" |
| 145 | + /> |
| 146 | + <span className="text-sm font-bold text-gray-700">Memorial Document Available</span> |
| 147 | + </label> |
| 148 | + </div> |
| 149 | + |
| 133 | 150 | {/* Name Search */} |
| 134 | 151 | <div> |
| 135 | 152 | <label htmlFor="search" className="block text-sm font-bold text-gray-700 mb-2"> |