This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(viewpatients): add paging feature in ViewPatients component
feat #1969
- Loading branch information
Showing
10 changed files
with
297 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import AbstractDBModel from '../model/AbstractDBModel' | ||
import PageRequest from './db/PageRequest' | ||
|
||
export default interface Page<T extends AbstractDBModel> { | ||
content: T[] | ||
hasNext?: boolean | ||
hasPrevious?: boolean | ||
pageRequest?: PageRequest | ||
} |
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,5 @@ | ||
export default interface PageRequest { | ||
limit: number | undefined | ||
skip: number | ||
} | ||
export const UnpagedRequest: PageRequest = { limit: undefined, skip: 0 } |
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,42 @@ | ||
import React from 'react' | ||
import { Button } from '@hospitalrun/components' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
const PageComponent = ({ | ||
hasNext, | ||
hasPrevious, | ||
pageNumber, | ||
setPreviousPageRequest, | ||
setNextPageRequest, | ||
}: any) => { | ||
const { t } = useTranslation() | ||
|
||
return ( | ||
<div style={{ textAlign: 'center' }}> | ||
<Button | ||
key="actions.previous" | ||
outlined | ||
disabled={!hasPrevious} | ||
style={{ float: 'left' }} | ||
color="success" | ||
onClick={setPreviousPageRequest} | ||
> | ||
{t('actions.previous')} | ||
</Button> | ||
<div style={{ display: 'inline-block' }}> | ||
{t('actions.page')} {pageNumber} | ||
</div> | ||
<Button | ||
key="actions.next" | ||
outlined | ||
style={{ float: 'right' }} | ||
disabled={!hasNext} | ||
color="success" | ||
onClick={setNextPageRequest} | ||
> | ||
{t('actions.next')} | ||
</Button> | ||
</div> | ||
) | ||
} | ||
export default PageComponent |
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.