Skip to content

Commit

Permalink
Merge pull request HospitalRun#19 from zemoso-int/PatientApi
Browse files Browse the repository at this point in the history
all api
  • Loading branch information
alchemist006 authored Oct 7, 2022
2 parents c11a06e + 3d90f94 commit 88c1d91
Show file tree
Hide file tree
Showing 37 changed files with 1,651 additions and 1,077 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"private": false,
"license": "MIT",
"dependencies": {
"@emotion/react": "~11.10.4",
"@emotion/styled": "~11.10.4",
"@hospitalrun/components": "~3.4.0",
"@mui/icons-material": "~5.10.6",
"@mui/material": "~5.10.6",
"@reduxjs/toolkit": "~1.7.0",
"@types/escape-string-regexp": "~2.0.1",
"@types/json2csv": "~5.0.1",
Expand Down Expand Up @@ -33,7 +37,6 @@
"react-bootstrap-typeahead": "~5.2.0",
"react-dom": "~16.13.0",
"react-i18next": "~11.15.0",
"react-moment": "~1.1.2",
"react-query": "~2.25.2",
"react-query-devtools": "~2.6.0",
"react-redux": "~7.2.0",
Expand Down
64 changes: 33 additions & 31 deletions src/HospitalRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,40 @@ const HospitalRun = () => {
<NetworkStatusMessage />
<Navbar />
<div className="container-fluid">
<div className="col-md-2">
<Sidebar />
<div>
<Sidebar/>
</div>
<ButtonBarProvider>
<div className="row">
<main
role="main"
className={`${
sidebarCollapsed ? 'col-md-10 col-lg-11' : 'col-md-9 col-lg-10'
} ml-sm-auto px-4`}
>
<div className="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 className="h2">{title}</h1>
<ButtonToolBar />
</div>
<Breadcrumbs />
<div>
<Switch>
<Route exact path="/" component={Dashboard} />
<Route path="/appointments" component={Appointments} />
<Route path="/patients" component={Patients} />
<Route path="/labs" component={Labs} />
<Route path="/medications" component={Medications} />
<Route path="/incidents" component={Incidents} />
<Route path="/settings" component={Settings} />
<Route path="/imaging" component={Imagings} />
</Switch>
</div>
<Toaster autoClose={5000} hideProgressBar draggable />
</main>
</div>
</ButtonBarProvider>

<ButtonBarProvider>
<div>
<main
role="main"
className={`${
sidebarCollapsed ? 'col-md-10 col-lg-11' : 'col-md-9 col-lg-10'
} ml-sm-auto px-4`}
>
<div className="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 className="h2">{title}</h1>
<ButtonToolBar />
</div>
<Breadcrumbs />
<div>
<Switch>
<Route exact path="/" component={Dashboard} />
<Route path="/appointments" component={Appointments} />
<Route path="/patients" component={Patients} />
<Route path="/labs" component={Labs} />
<Route path="/medications" component={Medications} />
<Route path="/incidents" component={Incidents} />
<Route path="/settings" component={Settings} />
<Route path="/imaging" component={Imagings} />
</Switch>
</div>
<Toaster autoClose={5000} hideProgressBar draggable />
</main>
</div>
</ButtonBarProvider>

</div>
</div>
)
Expand Down
1 change: 1 addition & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as serviceWorker from './serviceWorker'
import './shared/config/i18n'
import store from './shared/store'


ReactDOM.render(
<Provider store={store}>
<App />
Expand Down
42 changes: 26 additions & 16 deletions src/patients/ContactInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Select, Label, Spinner, Row, Column, Icon } from '@hospitalrun/components'
import React, { useEffect, ReactElement } from 'react'

import { SelectOption } from '../shared/components/input/SelectOption'
import TextFieldWithLabelFormGroup from '../shared/components/input/TextFieldWithLabelFormGroup'
import TextInputWithLabelFormGroup from '../shared/components/input/TextInputWithLabelFormGroup'
Expand Down Expand Up @@ -36,16 +35,23 @@ const ContactInfo = (props: Props): ReactElement => {
}))

const header = (
<Row className="header mb-2">
name !== "email" && name !== "address"?
<Row className="header mb-2">
<Column xs={12} sm={4}>
{/* <span className="">{t('patient.contactInfoType.label')}</span>
<span className="d-sm-none"> &amp; {t(label)}</span> */}
<Label text={`${name}Type`} />
<Label text={`${name} Type`} />
</Column>
<Column className="d-none d-sm-block" sm={8}>
{t(label)}
</Column>
</Row>
:
<Row className="header mb-2">
<Column className="d-none d-sm-block" sm={8}>
{t(label)}
</Column>
</Row>
)

const componentList = {
Expand Down Expand Up @@ -80,18 +86,22 @@ const ContactInfo = (props: Props): ReactElement => {
const error = errors ? errors[i] : undefined
return (
<Row key={entry.id}>
<Column sm={4}>
<div className="form-group" data-testid={`${name}Type${i}Select`}>
{/* <Label text={`${name}Type${i}`} /> */}
<Select
id={`${name}Type${i}Select`}
options={typeOptions}
defaultSelected={typeOptions.filter(({ value }) => value === entry.type)}
onChange={(values) => onTypeChange(values[0], i)}
disabled={!isEditable}
/>
</div>
</Column>
{ name !== "email" && name !== "address"?
<Column sm={4}>
<div className="form-group" data-testid={`${name}Type${i}Select`}>
{/* <Label text={`${name}Type${i}`} /> */}
<Select
id={`${name}Type${i}Select`}
options={typeOptions}
defaultSelected={typeOptions.filter(({ value }) => value === entry.type)}
onChange={(values) => onTypeChange(values[0], i)}
disabled={!isEditable}
/>
</div>
</Column>
:
""
}
<Column sm={8}>
<Component
name={`${name}${i}`}
Expand Down Expand Up @@ -146,7 +156,7 @@ const ContactInfo = (props: Props): ReactElement => {
<div>
{data.length > 0 ? header : null}
{entries}
{isEditable ? addButton : null}
{isEditable && name !== "email" ? addButton : null}
</div>
)
}
Expand Down
7 changes: 5 additions & 2 deletions src/patients/ContactInfoTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ enum ContactInfoTypes {
home = 'home',
mobile = 'mobile',
work = 'work',
temporary = 'temporary',
old = 'old',
// main = 'main',
// night ='night',
// fax = 'fax',
// other = 'other'

}

export default ContactInfoTypes
Loading

0 comments on commit 88c1d91

Please sign in to comment.