Skip to content

Commit

Permalink
Split prescriptions and medications components
Browse files Browse the repository at this point in the history
  • Loading branch information
projkov committed Nov 30, 2023
1 parent bb9477a commit 753103b
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 295 deletions.
1 change: 1 addition & 0 deletions src/components/BaseLayout/Sidebar/SidebarTop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function SidebarTop(props: Props) {
{ label: t`Scheduling`, path: '/scheduling', icon: <EncountersIcon /> },
{ label: t`Invoices`, path: '/invoices', icon: <InvoicesIcon /> },
{ label: t`Medications`, path: '/medications', icon: <InvoicesIcon /> },
{ label: t`Prescriptions`, path: '/prescriptions', icon: <InvoicesIcon /> },
],
})
: [];
Expand Down
2 changes: 2 additions & 0 deletions src/containers/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { InvoiceList } from '../InvoiceList';
import { MedicationManagement } from '../MedicationManagement';
import { NotificationPage } from '../NotificationPage';
import { OrganizationScheduling } from '../OrganizationScheduling';
import { Prescriptions } from '../Prescriptions';

export function App() {
const [userResponse] = useService(async () => {
Expand Down Expand Up @@ -199,6 +200,7 @@ function AuthenticatedReceptionistUserApp() {
<Route path="/invoices" element={<InvoiceList />} />
<Route path="/invoices/:id" element={<InvoiceDetails />} />
<Route path="/medications" element={<MedicationManagement />} />
<Route path="/prescriptions" element={<Prescriptions />} />
<Route path="*" element={<Navigate to="/scheduling" />} />
</Routes>
</BaseLayout>
Expand Down
118 changes: 0 additions & 118 deletions src/containers/MedicationManagement/MedicationKnowledgeList.tsx

This file was deleted.

140 changes: 0 additions & 140 deletions src/containers/MedicationManagement/MedicationRequestList.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ interface ModalNewMedicationKnowledgeProps {
export const ModalNewMedicationKnowledge = (props: ModalNewMedicationKnowledgeProps) => {
return (
<ModalTrigger
title={t`Add Medication Knowledge`}
title={t`Add Medication`}
trigger={
<Button icon={<PlusOutlined />} type="primary">
<span>
<Trans>Add medication knowledge</Trans>
<Trans>Add Medication</Trans>
</span>
</Button>
}
Expand Down
28 changes: 1 addition & 27 deletions src/containers/MedicationManagement/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Medication, MedicationKnowledge, MedicationRequest, Organization, Patient, Practitioner } from 'fhir/r4b';
import { Medication, MedicationKnowledge } from 'fhir/r4b';
import { SearchParams } from 'fhir-react';

import { extractBundleResources } from 'fhir-react/lib/services/fhir';
Expand Down Expand Up @@ -45,29 +45,3 @@ export function useMedicationKnowledge() {
handleTableChange,
};
}

export function useMedicationRequest(searchParameters: SearchParams) {
const queryParameters = searchParameters ?? {};

const { resourceResponse, pagerManager, handleTableChange, pagination } = usePagerExtended<
MedicationRequest | Patient | Organization | Practitioner | Medication,
StringTypeColumnFilterValue[]
>('MedicationRequest', queryParameters);

const medicationRequestResponse = mapSuccess(resourceResponse, (bundle) => {
return {
medicationRequest: extractBundleResources(bundle).MedicationRequest,
patient: extractBundleResources(bundle).Patient,
organization: extractBundleResources(bundle).Organization,
practitioner: extractBundleResources(bundle).Practitioner,
medication: extractBundleResources(bundle).Medication,
};
});

return {
pagination,
medicationRequestResponse,
pagerManager,
handleTableChange,
};
}
Loading

0 comments on commit 753103b

Please sign in to comment.