Card Component implemented
This commit is contained in:
@@ -27,7 +27,7 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
// Handle selection button click
|
||||
const handleTypeSelect = (type: "employee" | "occupant") => {
|
||||
setSelectedType(type);
|
||||
|
||||
|
||||
// Include type in search query
|
||||
handleSearch(searchQuery, selectedUrl, type);
|
||||
};
|
||||
@@ -35,13 +35,15 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
// Handle search with all parameters
|
||||
const handleSearch = (query: string, url: string, type: "employee" | "occupant") => {
|
||||
const searchParams: Record<string, string> = {};
|
||||
|
||||
|
||||
if (url) {
|
||||
searchParams.site_url = url;
|
||||
}
|
||||
searchParams.name = query
|
||||
if (query) {
|
||||
searchParams.name = query
|
||||
}
|
||||
searchParams.application_for = type === "employee" ? "EMP" : "OCC";
|
||||
|
||||
|
||||
// Call onSearch with the search parameters
|
||||
// The parent component will handle resetting pagination
|
||||
onSearch(searchParams);
|
||||
@@ -102,12 +104,12 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
className="pl-8 w-full h-10"
|
||||
/>
|
||||
<Search className="absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground" />
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
<Button
|
||||
variant="default"
|
||||
size="sm"
|
||||
className="ml-2"
|
||||
onClick={() => {
|
||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||
}}
|
||||
>
|
||||
<Search className="h-4 w-4" />
|
||||
@@ -121,8 +123,8 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
{translations.siteUrl && translations.siteUrl[lang as keyof LanguageTranslation]}
|
||||
</label>
|
||||
<div className="w-full">
|
||||
<Select
|
||||
value={selectedUrl}
|
||||
<Select
|
||||
value={selectedUrl}
|
||||
onValueChange={(value) => {
|
||||
setSelectedUrl(value);
|
||||
handleSearch(searchQuery, value, selectedType);
|
||||
|
||||
Reference in New Issue
Block a user