updated initilazer
This commit is contained in:
@@ -56,14 +56,23 @@ export const PaginationToolsComponent: React.FC<
|
||||
|
||||
{/* Navigation buttons - center */}
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page - 1)}
|
||||
disabled={pagination.next}
|
||||
>
|
||||
{t.previous}
|
||||
</Button>
|
||||
|
||||
|
||||
{
|
||||
pagination.back ? (<><Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page - 1)}
|
||||
|
||||
>
|
||||
{t.previous}
|
||||
</Button></>) : (<><Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
>
|
||||
{t.previous}
|
||||
</Button></>)
|
||||
}
|
||||
|
||||
{/* Page number buttons */}
|
||||
<div className="flex items-center space-x-1">
|
||||
@@ -75,7 +84,7 @@ export const PaginationToolsComponent: React.FC<
|
||||
1,
|
||||
Math.ceil(
|
||||
(pagination.totalCount &&
|
||||
pagination.totalCount !== pagination.allCount
|
||||
pagination.totalCount !== pagination.allCount
|
||||
? pagination.totalCount
|
||||
: pagination.allCount || 0) / pagination.size
|
||||
)
|
||||
@@ -89,7 +98,7 @@ export const PaginationToolsComponent: React.FC<
|
||||
1,
|
||||
Math.ceil(
|
||||
(pagination.totalCount &&
|
||||
pagination.totalCount !== pagination.allCount
|
||||
pagination.totalCount !== pagination.allCount
|
||||
? pagination.totalCount
|
||||
: pagination.allCount || 0) / pagination.size
|
||||
)
|
||||
@@ -120,14 +129,20 @@ export const PaginationToolsComponent: React.FC<
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page + 1)}
|
||||
disabled={pagination.back}
|
||||
>
|
||||
{t.next}
|
||||
</Button>
|
||||
{
|
||||
pagination.page < pagination.totalPages ? (<><Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => handlePageChange(pagination.page + 1)}
|
||||
>
|
||||
{t.next}
|
||||
</Button></>) : (<><Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
>
|
||||
{t.next}
|
||||
</Button></>)
|
||||
}
|
||||
|
||||
{/* Page text display */}
|
||||
<span className="px-4 py-1 text-sm text-muted-foreground">
|
||||
@@ -136,7 +151,7 @@ export const PaginationToolsComponent: React.FC<
|
||||
1,
|
||||
Math.ceil(
|
||||
(pagination.totalCount &&
|
||||
pagination.totalCount !== pagination.allCount
|
||||
pagination.totalCount !== pagination.allCount
|
||||
? pagination.totalCount
|
||||
: pagination.allCount || 0) / pagination.size
|
||||
)
|
||||
|
||||
@@ -36,14 +36,10 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
const handleSearch = (query: string, url: string, type: "employee" | "occupant") => {
|
||||
const searchParams: Record<string, string> = {};
|
||||
|
||||
if (query && query.length > 3) {
|
||||
searchParams.name = query;
|
||||
}
|
||||
|
||||
if (url) {
|
||||
searchParams.site_url = url;
|
||||
}
|
||||
|
||||
searchParams.name = query
|
||||
searchParams.application_for = type === "employee" ? "EMP" : "OCC";
|
||||
|
||||
// Call onSearch with the search parameters
|
||||
@@ -99,7 +95,7 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onKeyUp={(e) => {
|
||||
if (e.key === 'Enter' && searchQuery.length >= 3) {
|
||||
if (e.key === 'Enter') {
|
||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||
}
|
||||
}}
|
||||
@@ -111,9 +107,7 @@ export const SearchComponent: React.FC<SearchComponentProps> = ({
|
||||
size="sm"
|
||||
className="ml-2"
|
||||
onClick={() => {
|
||||
if (searchQuery.length >= 3) {
|
||||
handleSearch(searchQuery, selectedUrl, selectedType);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Search className="h-4 w-4" />
|
||||
|
||||
Reference in New Issue
Block a user