-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add UI for document types filtering/sorting
- Loading branch information
Showing
11 changed files
with
158 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from enum import Enum | ||
|
||
from papermerge.core.types import PaginatedQueryParams as BaseParams | ||
|
||
|
||
class OrderBy(str, Enum): | ||
name_asc = "name" | ||
name_desc = "-name" | ||
|
||
|
||
class PaginatedQueryParams(BaseParams): | ||
order_by: OrderBy | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 36 additions & 11 deletions
47
ui2/src/features/document-types/components/ActionButtons.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,47 @@ | ||
import {useAppSelector} from "@/app/hooks" | ||
import {selectSelectedIds} from "@/features/document-types/documentTypesSlice" | ||
import {Group} from "@mantine/core" | ||
import QuickFilter from "@/components/QuickFilter" | ||
import { | ||
selectFilterText, | ||
selectSelectedIds | ||
} from "@/features/document-types/documentTypesSlice" | ||
import {Group, Loader} from "@mantine/core" | ||
import {DeleteDocumentTypesButton} from "./DeleteButton" | ||
import EditButton from "./EditButton" | ||
import NewButton from "./NewButton" | ||
|
||
export default function ActionButtons() { | ||
interface Args { | ||
isFetching?: boolean | ||
onQuickFilterChange: (value: string) => void | ||
onQuickFilterClear: () => void | ||
} | ||
|
||
export default function ActionButtons({ | ||
isFetching, | ||
onQuickFilterChange, | ||
onQuickFilterClear | ||
}: Args) { | ||
const selectedIds = useAppSelector(selectSelectedIds) | ||
const filterText = useAppSelector(selectFilterText) | ||
|
||
return ( | ||
<Group> | ||
<NewButton /> | ||
{selectedIds.length == 1 ? ( | ||
<EditButton documentTypeId={selectedIds[0]} /> | ||
) : ( | ||
"" | ||
)} | ||
{selectedIds.length >= 1 ? <DeleteDocumentTypesButton /> : ""} | ||
<Group justify="space-between"> | ||
<Group> | ||
<NewButton /> | ||
{selectedIds.length == 1 ? ( | ||
<EditButton documentTypeId={selectedIds[0]} /> | ||
) : ( | ||
"" | ||
)} | ||
{selectedIds.length >= 1 ? <DeleteDocumentTypesButton /> : ""} | ||
{isFetching && <Loader size={"sm"} />} | ||
</Group> | ||
<Group> | ||
<QuickFilter | ||
onChange={onQuickFilterChange} | ||
onClear={onQuickFilterClear} | ||
filterText={filterText} | ||
/> | ||
</Group> | ||
</Group> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.