-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Refactor) Expounding community referrals to facility wide referrals …
…(Facility to Facility Referral) (#270) * (chore) removing community to facility wide referrals * (chore) restructuring the header and tabs added refer patient button * (refactor) named refer patient button * (feat) added enhancement initial referral form workspace * (refactor) limit of query from 10 to 15 * (feat) added search for facility location * (chore) removed the spacing in between buttons and tabs * (refactor) renamed the save button to refer patient * (refactor) translations
- Loading branch information
1 parent
a470c68
commit 8b742d1
Showing
26 changed files
with
679 additions
and
126 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
...pp/src/community-referrals/community-referral-tabs/community-referrals-tabs.component.tsx
This file was deleted.
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
1 change: 1 addition & 0 deletions
1
...rc/header/community-referrals-header.scss → ...-shr-app/src/header/referrals-header.scss
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
6 changes: 3 additions & 3 deletions
6
...nity-referrals-illustration.component.tsx → ...ader/referrals-illustration.component.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,13 +1,13 @@ | ||
import React from 'react'; | ||
import { ConnectReference } from '@carbon/react/icons'; | ||
import styles from './community-referrals-header.scss'; | ||
import styles from './referrals-header.scss'; | ||
|
||
const CommunityReferralsIllustration: React.FC = () => { | ||
const ReferralsIllustration: React.FC = () => { | ||
return ( | ||
<div className={styles.svgContainer}> | ||
<ConnectReference className={styles.iconOverrides} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CommunityReferralsIllustration; | ||
export default ReferralsIllustration; |
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,32 @@ | ||
import React, { useState } from 'react'; | ||
import { ReferralsHeader } from './header/referrals-header.component'; | ||
import ReferralTabs from './referrals/referral-tabs/referrals-tabs.component'; | ||
import { mutate } from 'swr'; | ||
import { pullFacilityReferrals } from './referrals/refferals.resource'; | ||
|
||
const ReferralWrap: React.FC = () => { | ||
const [isLoadingFacilityReferrals, setIsLoadingFacilityReferrals] = useState(false); | ||
|
||
const pullReferrals = () => { | ||
setIsLoadingFacilityReferrals(true); | ||
pullFacilityReferrals() | ||
.then((r) => { | ||
mutate( | ||
(key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/kenyaemril/communityReferrals?status=active'), | ||
); | ||
setIsLoadingFacilityReferrals(false); | ||
}) | ||
.catch((err) => { | ||
setIsLoadingFacilityReferrals(false); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className={`omrs-main-content`}> | ||
<ReferralsHeader /> | ||
<ReferralTabs isLoadingFacilityReferrals /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ReferralWrap; |
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
...atient-chart/referral-chart-view.test.tsx → ...atient-chart/referral-chart-view.test.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
File renamed without changes.
File renamed without changes.
89 changes: 89 additions & 0 deletions
89
packages/esm-shr-app/src/referrals/referral-tabs/referrals-tabs.component.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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Tab, TabList, Tabs, Button, TabPanel, TabPanels, InlineLoading } from '@carbon/react'; | ||
import styles from './referrals-tabs.scss'; | ||
import ReferralTable from '../referrals.component'; | ||
import { AirlineManageGates, UpdateNow } from '@carbon/react/icons'; | ||
import { launchWorkspace } from '@openmrs/esm-framework'; | ||
import { pullFacilityReferrals } from '../refferals.resource'; | ||
import { mutate } from 'swr'; | ||
|
||
interface ReferralTabsProps { | ||
isLoadingFacilityReferrals: boolean; | ||
} | ||
|
||
const ReferralTabs: React.FC<ReferralTabsProps> = () => { | ||
const { t } = useTranslation(); | ||
const [activeTabIndex, setActiveTabIndex] = React.useState<number>(0); | ||
const [isLoadingFacilityReferrals, setIsLoadingFacilityReferrals] = useState(false); | ||
|
||
const handleReferral = () => { | ||
launchWorkspace('facility-referral-form', { | ||
workspaceTitle: 'Referral Form', | ||
}); | ||
}; | ||
|
||
const pullReferrals = () => { | ||
setIsLoadingFacilityReferrals(true); | ||
pullFacilityReferrals() | ||
.then((r) => { | ||
mutate( | ||
(key) => typeof key === 'string' && key.startsWith('/ws/rest/v1/kenyaemril/communityReferrals?status=active'), | ||
); | ||
setIsLoadingFacilityReferrals(false); | ||
}) | ||
.catch((err) => { | ||
setIsLoadingFacilityReferrals(false); | ||
}); | ||
}; | ||
|
||
const handleTabChange = ({ selectedIndex }: { selectedIndex: number }) => { | ||
setActiveTabIndex(selectedIndex); | ||
}; | ||
|
||
return ( | ||
<div className={styles.referralsList} data-testid="referralsList-list"> | ||
<div className={styles.tabsContainer}> | ||
<Tabs selectedIndex={activeTabIndex} onChange={handleTabChange} className={styles.tabs}> | ||
<TabList aria-label="Referrals tabs" contained> | ||
<Tab className={styles.tab}>{t('fromCommunity', 'From Community')}</Tab> | ||
<Tab className={styles.tab}>{t('fromFacility', 'From Facility')}</Tab> | ||
<Tab className={styles.tab}>{t('completed', 'Completed')}</Tab> | ||
</TabList> | ||
</Tabs> | ||
<div className={styles.actionBtn}> | ||
<Button | ||
kind="primary" | ||
renderIcon={(props) => <UpdateNow size={20} {...props} />} | ||
iconDescription={t('pullReferrals', 'Pull Referrals')} | ||
onClick={pullReferrals} | ||
className={styles.actionBtn} | ||
disabled={isLoadingFacilityReferrals}> | ||
{t('pullReferrals', 'Pull Referrals')} | ||
</Button> | ||
<Button | ||
kind="tertiary" | ||
renderIcon={(props) => <AirlineManageGates size={20} {...props} />} | ||
onClick={handleReferral} | ||
iconDescription={t('referralPatient', 'Refer Patient')}> | ||
{t('referralPatient', 'Refer Patient')} | ||
</Button> | ||
</div> | ||
</div> | ||
<div>{isLoadingFacilityReferrals && <InlineLoading description="Pulling referrals..." />}</div> | ||
<TabPanels> | ||
<TabPanel className={styles.tabPanel}> | ||
<ReferralTable status="active" /> | ||
</TabPanel> | ||
<TabPanel className={styles.tabPanel}> | ||
<ReferralTable status="active" /> | ||
</TabPanel> | ||
<TabPanel className={styles.tabPanel}> | ||
<ReferralTable status="completed" /> | ||
</TabPanel> | ||
</TabPanels> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ReferralTabs; |
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
File renamed without changes.
Oops, something went wrong.