Skip to content

Commit

Permalink
Merge branch 'main' into bed-type
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel090 authored Jan 19, 2024
2 parents 6489ecd + 621be54 commit 608c0cd
Show file tree
Hide file tree
Showing 24 changed files with 1,135 additions and 225 deletions.
26 changes: 13 additions & 13 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"root": true,
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"ts-react-important-stuff"
],
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"rules": {
"curly": ["error", "all"],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash",
"message": "Import specific methods from `lodash`. e.g. `import map from 'lodash/map'`"
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
},
{
"name": "lodash-es",
"importNames": ["default"],
"message": "Import specific methods from `lodash-es`. e.g. `import { map } from 'lodash-es'`"
},
"message": "Import specific methods from `lodash-es`. e.g. `import map from 'lodash-es/map'`"
}
],
"patterns": [
{
"name": "carbon-components-react",
"group": ["carbon-components-react"],
"message": "Import from `@carbon/react` directly. e.g. `import { Toggle } from '@carbon/react'`"
},
{
"name": "@carbon/icons-react",
"group": ["@carbon/icons-react"],
"message": "Import from `@carbon/react/icons`. e.g. `import { ChevronUp } from '@carbon/react/icons'`"
},
{
"group": ["@import '~carbon-components/src/globals/scss/vars'"],
"message": "Import from `@carbon/styles/scss`. e.g. `@use '@carbon/styles/scss/type'`"
}
]
}
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: UgandaEMR CI
name: Kenyaemr CI

on:
workflow_dispatch: # enables the workflow to be triggered manually
Expand All @@ -11,8 +11,8 @@ on:
- created

env:
ESM_NAME: "@ugandaemr/esm-bed-management-app"
JS_NAME: "esm-ugandaemr-bed-management-app.js"
ESM_NAME: "@kenyaemr/esm-bed-management-app"
JS_NAME: "esm-kenyaemr-bed-management-app.js"

jobs:
build:
Expand All @@ -36,11 +36,11 @@ jobs:
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v2
with:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable

- name: Setup local cache server for Turborepo
uses: felixmosh/turborepo-gh-artifacts@v2
with:
Expand Down Expand Up @@ -113,6 +113,21 @@ jobs:
path: |
dist
Trigger_server_build:
runs-on: ubuntu-latest
needs: pre_release
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Invoke workflow without inputs. Don't wait for result
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: KenyaEMR CI
repo: palladiumkenya/openmrs-config-kenyaemr
token: ${{ secrets.PERSONAL_TOKENS }}
wait-for-completion: false

release:
runs-on: ubuntu-latest

Expand All @@ -133,4 +148,3 @@ jobs:
- run: yarn config set npmAuthToken "${NODE_AUTH_TOKEN}" && yarn npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@ugandaemr/esm-bed-management-app",
"name": "@kenyaemr/esm-bed-management-app",
"version": "1.0.0",
"license": "MPL-2.0",
"description": "A frontend module for managing beds in UgandaEMR+",
"browser": "dist/esm-ugandaemr-bed-management-app.js",
"browser": "dist/esm-kenyaemr-bed-management-app.js",
"main": "src/index.ts",
"source": true,
"scripts": {
Expand Down
113 changes: 22 additions & 91 deletions src/bed-admission/active-patients/active-patients-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {

import {
isDesktop,
useConfig,
useLayoutType,
usePagination,
useSession,
Expand All @@ -37,6 +38,7 @@ import {
} from "../helpers/functions";
import styles from "./styles.scss";
import { usePatientQueuesList } from "./patient-queues.resource";
import { useActiveVisits } from "./active-visits.resource";
import EmptyState from "../../empty-state/empty-state.component";
import AssignBedWorkSpace from "../../workspace/allocate-bed-workspace.component";
import AdmissionActionButton from "./admission-action-button.component";
Expand All @@ -63,10 +65,8 @@ const ActivePatientsTable: React.FC<ActiveVisitsTableProps> = ({
useState<patientDetailsProps>();

const layout = useLayoutType();
const { patientQueueEntries, isLoading } = usePatientQueuesList(
session?.sessionLocation?.uuid,
status
);
const { patientQueueEntries, isLoading } = useActiveVisits();
const { restrictWardAdministrationToLoginLocation } = useConfig();
const handleBedAssigmentModal = useCallback(
(entry) => {
setSelectedPatientDetails({
Expand Down Expand Up @@ -112,37 +112,37 @@ const ActivePatientsTable: React.FC<ActiveVisitsTableProps> = ({
() => [
{
id: 0,
header: t("visitNumber", "Visit Number"),
key: "visitNumber",
header: t("name", "Name"),
key: "name",
},
{
id: 1,
header: t("name", "Name"),
key: "name",
header: t("idNumber", "ID Number"),
key: "idNumber",
},
{
id: 2,
header: t("locationFrom", "Location From"),
key: "locationFrom",
header: t("gender", "Gender"),
key: "gender",
},
{
id: 3,
header: t("priority", "Priority"),
key: "priority",
header: t("age", "Age"),
key: "age",
},
{
id: 4,
header: t("priorityLevel", "Priority Level"),
key: "priorityLevel",
header: t("visitType", "Visit type"),
key: "visitType",
},
{
id: 5,
header: t("waitTime", "Wait time"),
key: "waitTime",
header: t("visitStartTime", "Visit start date/time"),
key: "visitStartTime",
},
{
id: 6,
header: t("actions", "Actions"),
header: t("action", "Action"),
key: "actions",
},
],
Expand All @@ -152,82 +152,11 @@ const ActivePatientsTable: React.FC<ActiveVisitsTableProps> = ({
const tableRows = useMemo(() => {
return paginatedQueueEntries?.map((entry) => ({
...entry,
visitNumber: {
content: <span>{trimVisitNumber(entry.visitNumber)}</span>,
},
name: {
content: entry.name,
},
locationFrom: {
content: entry.locationFromName,
},
priority: {
content: (
<>
{entry?.priorityComment ? (
<DefinitionTooltip
className={styles.tooltip}
align="bottom-left"
definition={entry.priorityComment}
>
<Tag
role="tooltip"
className={
entry.priority === "Priority"
? styles.priorityTag
: styles.tag
}
type={getTagType(entry.priority as string)}
>
{entry.priority}
</Tag>
</DefinitionTooltip>
) : (
<Tag
className={
entry.priority === "Priority"
? styles.priorityTag
: styles.tag
}
type={getTagType(entry.priority as string)}
>
{entry.priority}
</Tag>
)}
</>
),
},
priorityLevel: {
content: <span>{entry.priorityLevel}</span>,
},
waitTime: {
content: (
<Tag>
<span
className={styles.statusContainer}
style={{ color: `${getTagColor(entry.waitTime)}` }}
>
{formatWaitTime(entry.waitTime, t)}
</span>
</Tag>
),
},
actions: {
content: (
<div className={styles.displayFlex}>
{renderActionButton(entry)}
{status === "completed" && (
<ViewActionsMenu
to={`\${openmrsSpaBase}/patient/${entry?.patientUuid}/chart`}
from={fromPage}
/>
)}
</div>
<div className={styles.displayFlex}>{renderActionButton(entry)}</div>
),
},
notes: {
content: entry.comment,
},
}));
}, [paginatedQueueEntries, status, t, renderActionButton, fromPage]);

Check warning on line 161 in src/bed-admission/active-patients/active-patients-table.component.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook useMemo has unnecessary dependencies: 'fromPage', 'status', and 't'. Either exclude them or remove the dependency array

Expand Down Expand Up @@ -307,7 +236,7 @@ const ActivePatientsTable: React.FC<ActiveVisitsTableProps> = ({
colSpan={headers.length + 2}
>
<>
<span>{tableRows[index]?.comment ?? ""}</span>
{/* <span>{tableRows[index]?.comment ?? ""}</span> */}
</>
</TableExpandedRow>
) : (
Expand Down Expand Up @@ -348,7 +277,9 @@ const ActivePatientsTable: React.FC<ActiveVisitsTableProps> = ({
queueStatus={status}
headerTitle={t(
"assignBedToPatient",
`Assign Bed to Patient ${selectedPatientDetails.name} in the ${session?.sessionLocation?.display} Ward`
restrictWardAdministrationToLoginLocation === true
? `Assign Bed to Patient ${selectedPatientDetails.name} in the ${session?.sessionLocation?.display} Ward`
: `Assign Bed to Patient ${selectedPatientDetails.name}`
)}
/>
)}
Expand Down
Loading

0 comments on commit 608c0cd

Please sign in to comment.