Skip to content

Commit

Permalink
Merge pull request #120 from Rugute/main
Browse files Browse the repository at this point in the history
Sorted Forms
  • Loading branch information
Rugute authored Jul 23, 2024
2 parents f310c66 + a3980de commit a3309cd
Show file tree
Hide file tree
Showing 755 changed files with 4,150 additions and 1,997 deletions.
Binary file modified .DS_Store
100644 → 100755
Binary file not shown.
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified .env
100644 → 100755
Empty file.
Empty file modified .eslintignore
100644 → 100755
Empty file.
Empty file modified .eslintrc
100644 → 100755
Empty file.
Empty file modified .github/pull_request_template.md
100644 → 100755
Empty file.
Empty file modified .github/workflows/bundle-size.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/ci.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/tx-pull.yml
100644 → 100755
Empty file.
Empty file modified .github/workflows/tx-push.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .husky/.gitignore
100644 → 100755
Empty file.
Empty file modified .prettierignore
100644 → 100755
Empty file.
Empty file modified .tx/config
100644 → 100755
Empty file.
Empty file modified .vscode/settings.json
100644 → 100755
Empty file.
Empty file modified .yarnrc.yml
100644 → 100755
Empty file.
Empty file modified LICENSE.md
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified __mocks__/active-visits.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/address.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/appointments.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/auto-generation-options.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/identifier-types.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/identifiers.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/index.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/locations.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/metrics.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/patient-registration.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/patient-visits.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/patient.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/search.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/session.mock.ts
100644 → 100755
Empty file.
Empty file modified __mocks__/visits.mock.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/cohort-operations.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/encounter-operations.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/index.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/patient-operations.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/provider-operations.ts
100644 → 100755
Empty file.
Empty file modified e2e/commands/visit-operations.ts
100644 → 100755
Empty file.
Empty file modified e2e/core/global-setup.ts
100644 → 100755
Empty file.
Empty file modified e2e/core/index.ts
100644 → 100755
Empty file.
Empty file modified e2e/core/test.ts
100644 → 100755
Empty file.
Empty file modified e2e/fixtures/api.ts
100644 → 100755
Empty file.
Empty file modified e2e/fixtures/index.ts
100644 → 100755
Empty file.
Empty file modified e2e/pages/appointments-page.ts
100644 → 100755
Empty file.
Empty file modified e2e/pages/home-page.ts
100644 → 100755
Empty file.
Empty file modified e2e/pages/index.ts
100644 → 100755
Empty file.
Empty file modified e2e/pages/patient-lists-page.ts
100644 → 100755
Empty file.
Empty file modified e2e/pages/registration-and-edit-page.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/active-visits.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/appointments.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/edit-patient.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/patient-list.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/patient-search.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/register-new-patient.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/specs/return-to-patient-list.spec.ts
100644 → 100755
Empty file.
Empty file modified e2e/support/bamboo/docker-compose.yml
100644 → 100755
Empty file.
Empty file modified e2e/support/bamboo/e2e-test-runner.sh
100644 → 100755
Empty file.
Empty file modified e2e/support/bamboo/playwright.Dockerfile
100644 → 100755
Empty file.
Empty file modified e2e/support/github/Dockerfile
100644 → 100755
Empty file.
Empty file modified e2e/support/github/docker-compose.yml
100644 → 100755
Empty file.
Empty file modified e2e/support/github/run-e2e-docker-env.sh
100644 → 100755
Empty file.
Empty file modified example.env
100644 → 100755
Empty file.
Empty file modified jest.config.js
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"start": "openmrs develop --backend http://10.50.80.110:8084 --sources packages/esm-*-app --api-url /amrs --spa-path /amrs/spa/ --port 8040",
"dev": "openmrs develop --backend http://10.50.80.110:8084 --sources packages/esm-report-app --api-url /amrs --spa-path /amrs/spa/ --port 8040",
"start:core": "openmrs develop --backend http://10.50.80.110:8084 --sources packages/esm-ampath-core-app --api-url /amrs --spa-path /amrs/spa/ --port 8030",
"dev:core": "openmrs develop --backend http://10.50.80.110:8084 --sources packages/esm-ampath-core-app --api-url /amrs --spa-path /amrs/spa/ --port 8030",
"ci:publish": "yarn workspaces foreach --all --topological --exclude @ampath/esm-3.x-app npm publish --access public --tag latest",
"ci:prepublish": "yarn workspaces foreach --all --topological --exclude @ampath/esm-3.x-app npm publish --access public --tag next",
"release": "yarn workspaces foreach --all --topological version",
Expand Down Expand Up @@ -38,7 +38,7 @@
"@babel/core": "^7.11.6",
"@carbon/react": "~1.37.0",
"@ohri/openmrs-esm-ohri-commons-lib": "next",
"@openmrs/esm-framework": "^5.6.1-pre.2075",
"@openmrs/esm-framework": "^5.7.1-pre.2076",
"@openmrs/esm-patient-common-lib": "next",
"@playwright/test": "1.40.1",
"@swc/core": "^1.2.165",
Expand Down Expand Up @@ -75,7 +75,7 @@
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.1",
"openmrs": "^5.6.1-pre.2075",
"openmrs": "^5.7.1-pre.2076",
"prettier": "^3.1.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-billing-app/README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
![Node.js CI](https://github.com/palladiumkenya/kenyaemr-esm-3.x/workflows/Node.js%20CI/badge.svg)

# ESM Billing App

Expand Down
Empty file modified packages/esm-billing-app/__mocks__/visit.mock.ts
100644 → 100755
Empty file.
Empty file modified packages/esm-billing-app/jest.config.js
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions packages/esm-billing-app/package.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@ampath/esm-billing-app",
"version": "5.1.1",
"description": "Billing app for AMRS",
"version": "5.2.0",
"description": "Billing app for AMPATH",
"browser": "dist/ampath-esm-billing-app.js",
"main": "src/index.ts",
"source": true,
"license": "MPL-2.0",
"homepage": "https://github.com/AMPATH/ampath-esm-3.x#readme",
"homepage": "https://github.com/palladiumkenya/ampath-esm-core#readme",
"scripts": {
"start": "openmrs develop",
"serve": "webpack serve --mode=development",
Expand All @@ -31,10 +31,10 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/AMPATH/ampath-esm-3.x.git"
"url": "git+https://github.com/palladiumkenya/kenyaemr-esm-core#readme"
},
"bugs": {
"url": "git+https://github.com/AMPATH/ampath-esm-3.x.git"
"url": "https://github.com/palladiumkenya/kenyaemr-esm-core/issues"
},
"dependencies": {
"@carbon/react": "^1.42.1",
Expand Down
24 changes: 16 additions & 8 deletions packages/esm-billing-app/src/bill-history/bill-history.component.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ import {
Button,
} from '@carbon/react';
import { Add } from '@carbon/react/icons';
import { isDesktop, useLayoutType, usePagination, launchWorkspace } from '@openmrs/esm-framework';
import { EmptyDataIllustration, ErrorState, usePaginationInfo, CardHeader } from '@openmrs/esm-patient-common-lib';
import { isDesktop, useLayoutType, usePagination } from '@openmrs/esm-framework';
import {
EmptyDataIllustration,
ErrorState,
usePaginationInfo,
CardHeader,
useLaunchWorkspaceRequiringVisit,
} from '@openmrs/esm-patient-common-lib';
import { useBills } from '../billing.resource';
import InvoiceTable from '../invoice/invoice-table.component';
import styles from './bill-history.scss';
Expand All @@ -32,12 +38,17 @@ interface BillHistoryProps {
const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
const { t } = useTranslation();
const { bills, isLoading, error } = useBills(patientUuid);
const launchPatientWorkspace = useLaunchWorkspaceRequiringVisit('billing-form');
const layout = useLayoutType();
const [pageSize, setPageSize] = React.useState(10);
const responsiveSize = isDesktop(layout) ? 'sm' : 'lg';
const { paginated, goTo, results, currentPage } = usePagination(bills, pageSize);
const { pageSizes } = usePaginationInfo(pageSize, bills?.length, currentPage, results?.length);

const handleLaunchBillForm = () => {
launchPatientWorkspace({ workspaceTitle: t('billingForm', 'Billing Form') });
};

const headerData = [
{
header: t('visitTime', 'Visit time'),
Expand All @@ -58,7 +69,7 @@ const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
];

const setBilledItems = (bill) =>
bill.lineItems.reduce(
bill.lineItems?.reduce(
(acc, item) => acc + (acc ? ' & ' : '') + (item.billableService?.split(':')[1] || item.item?.split(':')[1] || ''),
'',
);
Expand Down Expand Up @@ -102,7 +113,7 @@ const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
<EmptyDataIllustration />
</div>
<p className={styles.content}>There are no bills to display.</p>
<Button onClick={() => launchWorkspace('billing-form', { workspaceTitle: 'Billing Form' })} kind="ghost">
<Button onClick={handleLaunchBillForm} kind="ghost">
{t('launchBillForm', 'Launch bill form')}
</Button>
</Tile>
Expand All @@ -114,10 +125,7 @@ const BillHistory: React.FC<BillHistoryProps> = ({ patientUuid }) => {
return (
<div>
<CardHeader title={t('patientBilling', 'Patient billing')}>
<Button
renderIcon={Add}
onClick={() => launchWorkspace('billing-form', { workspaceTitle: 'Billing Form' })}
kind="ghost">
<Button renderIcon={Add} onClick={handleLaunchBillForm} kind="ghost">
{t('addBill', 'Add bill item(s)')}
</Button>
</CardHeader>
Expand Down
Empty file modified packages/esm-billing-app/src/bill-history/bill-history.scss
100644 → 100755
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { TaskAdd } from '@carbon/react/icons';
import { useTranslation } from 'react-i18next';
import styles from './bill-waiver-form.scss';
import { type LineItem, type MappedBill } from '../../types';
import { createBillWaiverPayload } from './utils';
import { createBillWaiverPayload, extractErrorMessagesFromResponse } from '../../utils';
import { convertToCurrency, extractString } from '../../helpers';
import { processBillPayment, usePaymentModes } from '../../billing.resource';
import { showSnackbar } from '@openmrs/esm-framework';
Expand Down Expand Up @@ -48,7 +48,7 @@ const BillWaiverForm: React.FC<BillWaiverFormProps> = ({ bill, lineItems, setPat
showSnackbar({
title: t('billWaiver', 'Bill waiver'),
subtitle: t('billWaiverError', 'Bill waiver failed {{error}}', {
error: error?.responseBody?.error?.message ?? error.message,
error: extractErrorMessagesFromResponse(error?.responseBody),
}),
kind: 'error',
timeoutInMs: 3500,
Expand Down
Empty file.
Empty file.
Empty file.
3 changes: 1 addition & 2 deletions packages/esm-billing-app/src/billable-services/bill-waiver/patient-bills.component.tsx
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { useBills } from '../../billing.resource';
import {
Layer,
DataTable,
Expand Down Expand Up @@ -57,7 +56,7 @@ const PatientBills: React.FC<PatientBillsProps> = ({ patientUuid, bills, setPati
<div className={styles.illo}>
<EmptyDataIllustration />
</div>
<p className={styles.content}>{t('noBilltoDisplay', 'There are no bills to display for this patient')}</p>
<p className={styles.content}>{t('noBillDisplay', 'There are no bills to display for this patient')}</p>
</Tile>
</Layer>
</div>
Expand Down

This file was deleted.

8 changes: 6 additions & 2 deletions packages/esm-billing-app/src/billable-services/billable-service.resource.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ type ResponseObject = {
results: Array<OpenmrsResource>;
};

type ServiceTypesResponse = {
setMembers: { uuid: string; display: string }[];
};

export const useBillableServices = () => {
const url = `/ws/rest/v1/cashier/billableService?v=custom:(uuid,name,shortName,serviceStatus,serviceType:(display),servicePrices:(uuid,name,price))`;
const { data, isLoading, isValidating, error, mutate } = useSWR<{ data: ResponseObject }>(url, openmrsFetch, {});
return { billableServices: data?.data.results ?? [], isLoading, isValidating, error, mutate };
};

export function useServiceTypes() {
const url = `/ws/rest/v1/concept/d7bd4cc0-90b1-4f22-90f2-ab7fde936727?v=custom:(setMembers:(uuid,display))`;
const { data, error, isLoading } = useSWR<{ data: any }>(url, openmrsFetch, {});
const url = `/ws/rest/v1/concept/d2ece9e9-3907-440d-b5c3-5d3b148594f5?v=custom:(setMembers:(uuid,display))`;
const { data, error, isLoading } = useSWR<{ data: ServiceTypesResponse }>(url, openmrsFetch, {});
return { serviceTypes: data?.data.setMembers ?? [], error, isLoading };
}

Expand Down
11 changes: 10 additions & 1 deletion packages/esm-billing-app/src/billable-services/billable-services-home.component.tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import BillingHeader from '../billing-header/billing-header.component';
import { Wallet, Money } from '@carbon/react/icons';
import { UserHasAccess, navigate } from '@openmrs/esm-framework';
import BillWaiver from './bill-waiver/bill-waiver.component';
import BillingTariffs from './billing-tariffs/billing-tariffs.component';
import AddTariffsService from './billing-tariffs/add-billings-tariffs-service.component';
const basePath = `${window.spaBase}/billable-services`;
const BillableServiceHome: React.FC = () => {
const { t } = useTranslation();
Expand All @@ -28,7 +30,12 @@ const BillableServiceHome: React.FC = () => {
</SideNavLink>
<UserHasAccess privilege="coreapps.systemAdministration">
<SideNavLink onClick={() => handleNavigation('waive-bill')} renderIcon={Money}>
{t('billWaiver', 'Bill waiver')}
{t('billWaiver', 'Bill Waiver')}
</SideNavLink>
</UserHasAccess>
<UserHasAccess privilege="coreapps.systemAdministration">
<SideNavLink onClick={() => handleNavigation('bill-tariffs')} renderIcon={Money}>
{t('billTariffs', 'Insurance Tariffs')}
</SideNavLink>
</UserHasAccess>
</SideNavItems>
Expand All @@ -40,6 +47,8 @@ const BillableServiceHome: React.FC = () => {
<Route path="/" element={<BillableServicesDashboard />} />
<Route path="/add-service" element={<AddBillableService />} />
<Route path="/waive-bill" element={<BillWaiver />} />
<Route path="/bill-tariffs" element={<BillingTariffs />} />
<Route path="/add-tariffs" element={<AddTariffsService />} />
</Routes>
</section>
</main>
Expand Down
Empty file.
Empty file.
30 changes: 19 additions & 11 deletions ...s/billiable-item/drug-order.component.tsx → ...-item/drug-order/drug-order.component.tsx
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { type Drug } from '@openmrs/esm-patient-common-lib';
import { type DosingUnit, type MedicationFrequency, type MedicationRoute, type QuantityUnit } from '../../types';
import { useBillableItem, useSockItemInventory } from './useBilliableItem';
import { type DosingUnit, type MedicationFrequency, type MedicationRoute, type QuantityUnit } from '../../../types';
import { useBillableItem, useSockItemInventory } from '../useBillableItem';
import { useTranslation } from 'react-i18next';
import styles from './drug-order.scss';
import { convertToCurrency } from '../../helpers';
import { convertToCurrency } from '../../../helpers';

type DrugOrderProps = {
order: {
Expand All @@ -25,21 +25,29 @@ const DrugOrder: React.FC<DrugOrderProps> = ({ order }) => {
const { t } = useTranslation();
const { stockItem, isLoading: isLoadingInventory } = useSockItemInventory(order?.drug?.uuid);
const { billableItem, isLoading } = useBillableItem(order?.drug.concept.uuid);

if (isLoading || isLoadingInventory) {
return null;
}

return (
<div className={styles.drugOrderContainer}>
{stockItem && (
<div className={styles.itemContainer}>
<span className={styles.bold}>
{t('inStock', '{{quantityUoM}}(s) In stock ', { quantityUoM: stockItem?.quantityUoM })}
</span>
<span>{Math.round(stockItem?.quantity)}</span>
</div>
{stockItem && stockItem.length > 0 ? (
<>
<div className={styles.bold}>{'In Stock'}</div>
{stockItem.map((item, index) => (
<div key={index} className={styles.itemContainer}>
<span>{item.partyName}</span>
<span>
{' '}
{Math.round(item.quantity)} {item.quantityUoM}(s){' '}
</span>
</div>
))}
</>
) : (
<div className={styles.red}>{'Drug Is Not Available / Out of Stock'}</div>
)}

<div>
{billableItem &&
billableItem?.servicePrices.map((item) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@
grid-template-columns: 1fr 1fr;
padding-left: spacing.$spacing-03;
}

.red {
color: red;
font-weight: normal;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import { useBillableItem } from '../useBillableItem';
import { useTranslation } from 'react-i18next';
import { InlineLoading } from '@carbon/react';
import PriceInfoOrder from './price-info-order.componet';

type ImagingOrderProps = {
order: {
testType?: {
label: string;
conceptUuid: string;
};
};
};

const ImagingOrder: React.FC<ImagingOrderProps> = ({ order }) => {
const { t } = useTranslation();
const { billableItem, isLoading, error } = useBillableItem(order?.testType?.conceptUuid);

if (isLoading) {
return (
<InlineLoading
status="active"
iconDescription={t('loading', 'Loading')}
description={t('loadingData', 'Loading data...')}
/>
);
}

return <PriceInfoOrder billableItem={billableItem} error={error} />;
};

export default ImagingOrder;
Loading

0 comments on commit a3309cd

Please sign in to comment.