generated from openmrs/openmrs-esm-template-app
-
Notifications
You must be signed in to change notification settings - Fork 49
(feat) O3-5005 add search tab to dispensing home page #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd4e569
(feat) O3-5005 add search tab to dispensing home page (need to change…
chibongho 1aab769
non-instant search
chibongho 26e694d
apply t() to strings, remove tabs array
chibongho 379c19f
e2e tests
chibongho 1e23ca3
Merge remote-tracking branch 'origin/main' into search-tab
chibongho eed35cb
fix e2e tests
chibongho ebaba46
update esm-core dependency and use the right search icon
chibongho de388d1
Merge remote-tracking branch 'origin/main' into search-tab
chibongho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,58 @@ | ||
import React, { useState } from 'react'; | ||
import { Button, Search, TabPanel } from '@carbon/react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { AppointmentsPictogram } from '@openmrs/esm-framework'; | ||
import PrescriptionsTable from './prescriptions-table.component'; | ||
import styles from './patient-search-tab-panel.scss'; | ||
|
||
const PatientSearchTabPanel: React.FC = () => { | ||
const { t } = useTranslation(); | ||
const [searchTerm, setSearchTerm] = useState(''); | ||
const [submittedSearchTerm, setSubmittedSearchTerm] = useState(''); | ||
|
||
return ( | ||
<TabPanel> | ||
<div className={styles.searchTabPanel}> | ||
<form | ||
className={styles.searchBar} | ||
onSubmit={(e) => { | ||
e.preventDefault(); | ||
setSubmittedSearchTerm(searchTerm); | ||
}}> | ||
<Search | ||
closeButtonLabelText={t('clearSearchInput', 'Clear search input')} | ||
defaultValue={searchTerm} | ||
placeholder={t('searchForPatient', 'Search for a patient by name or identifier number')} | ||
labelText={t('searchForPatient', 'Search for a patient by name or identifier number')} | ||
onChange={(e) => { | ||
setSearchTerm(e.target.value); | ||
}} | ||
onClear={() => setSubmittedSearchTerm('')} | ||
size="lg" | ||
/> | ||
<Button kind="secondary" type="submit"> | ||
{t('search', 'Search')} | ||
</Button> | ||
</form> | ||
{submittedSearchTerm ? ( | ||
<PrescriptionsTable | ||
loadData={true} | ||
status={'ACTIVE'} | ||
debouncedSearchTerm={submittedSearchTerm} | ||
location={''} | ||
/> | ||
) : ( | ||
<div className={styles.searchForPatientPlaceholder}> | ||
<div> | ||
<AppointmentsPictogram /> | ||
<h5>Search for a patient</h5> | ||
<div>Search for a patient by name or identifier number</div> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
</TabPanel> | ||
); | ||
}; | ||
|
||
export default PatientSearchTabPanel; |
This file contains hidden or 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,26 @@ | ||
@use '@carbon/layout'; | ||
@use '~@openmrs/esm-styleguide/src/vars' as *; | ||
|
||
.searchTabPanel { | ||
display: flex; | ||
flex-direction: column; | ||
margin: layout.$spacing-05 layout.$spacing-04; | ||
gap: layout.$spacing-05; | ||
} | ||
|
||
.searchForPatientPlaceholder { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
text-align: center; | ||
min-height: 400px; | ||
flex: 1; | ||
border: solid 1px $grey-2; | ||
} | ||
|
||
.searchBar { | ||
input { | ||
background-color: $ui-02; | ||
} | ||
display: flex; | ||
} |
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to include the translation strings for these