Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
feat(patients): use panels for grouping content in view patient
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmeyer committed Jan 3, 2020
1 parent 3be2de5 commit 452419c
Showing 1 changed file with 101 additions and 98 deletions.
199 changes: 101 additions & 98 deletions src/patients/view/ViewPatient.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { useParams, withRouter } from 'react-router-dom'
import { Spinner } from '@hospitalrun/components'
import { Panel, Spinner } from '@hospitalrun/components'
import { useTranslation } from 'react-i18next'
import { differenceInYears } from 'date-fns'
import useTitle from '../../util/useTitle'
Expand Down Expand Up @@ -65,108 +65,111 @@ const ViewPatient = () => {
}

return (
<div className="container">
<h3>Basic Information</h3>
<div className="row">
<div className="col">
<SelectWithLabelFormGroup
name="sex"
label={t('patient.sex')}
value={patient.sex}
isEditable={false}
options={[
{ label: t('sex.male'), value: 'male' },
{ label: t('sex.female'), value: 'female' },
{ label: t('sex.other'), value: 'other' },
{ label: t('sex.unknown'), value: 'unknown' },
]}
/>
<div>
<Panel title={t('patient.basicInformation')} color="primary" collapsible>
<div className="row">
<div className="col">
<SelectWithLabelFormGroup
name="sex"
label={t('patient.sex')}
value={patient.sex}
isEditable={false}
options={[
{ label: t('sex.male'), value: 'male' },
{ label: t('sex.female'), value: 'female' },
{ label: t('sex.other'), value: 'other' },
{ label: t('sex.unknown'), value: 'unknown' },
]}
/>
</div>
<div className="col">
<SelectWithLabelFormGroup
name="type"
label={t('patient.type')}
value={patient.type}
isEditable={false}
options={[
{ label: t('patient.types.charity'), value: 'charity' },
{ label: t('patient.types.private'), value: 'private' },
]}
/>
</div>
</div>
<div className="col">
<SelectWithLabelFormGroup
name="type"
label={t('patient.type')}
value={patient.type}
isEditable={false}
options={[
{ label: t('patient.types.charity'), value: 'charity' },
{ label: t('patient.types.private'), value: 'private' },
]}
/>
<div className="row">
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={
patient.isApproximateDateOfBirth ? t('patient.approximateAge') : t('patient.age')
}
name="age"
value={getPatientAge(patient.dateOfBirth)}
isEditable={false}
/>
</div>
<div className="col-md-6">
<DatePickerWithLabelFormGroup
label={
patient.isApproximateDateOfBirth
? t('patient.approximateDateOfBirth')
: t('patient.dateOfBirth')
}
name="dateOfBirth"
value={getPatientDateOfBirth(patient.dateOfBirth)}
isEditable={false}
/>
</div>
</div>
</div>
<div className="row">
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={
patient.isApproximateDateOfBirth ? t('patient.approximateAge') : t('patient.age')
}
name="age"
value={getPatientAge(patient.dateOfBirth)}
isEditable={false}
/>
<div className="row">
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={t('patient.occupation')}
name="occupation"
value={patient.occupation}
isEditable={false}
/>
</div>
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={t('patient.preferredLanguage')}
name="preferredLanguage"
value={patient.preferredLanguage}
isEditable={false}
/>
</div>
</div>
<div className="col-md-6">
<DatePickerWithLabelFormGroup
label={
patient.isApproximateDateOfBirth
? t('patient.approximateDateOfBirth')
: t('patient.dateOfBirth')
}
name="dateOfBirth"
value={getPatientDateOfBirth(patient.dateOfBirth)}
isEditable={false}
/>
</Panel>
<br />
<Panel title={t('patient.contactInformation')} color="primary" collapsible>
<div className="row">
<div className="col">
<TextInputWithLabelFormGroup
label={t('patient.phoneNumber')}
name="phoneNumber"
value={patient.phoneNumber}
isEditable={false}
/>
</div>
<div className="col">
<TextInputWithLabelFormGroup
label={t('patient.email')}
placeholder="[email protected]"
name="email"
value={patient.email}
isEditable={false}
/>
</div>
</div>
</div>
<div className="row">
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={t('patient.occupation')}
name="occupation"
value={patient.occupation}
isEditable={false}
/>
<div className="row">
<div className="col">
<TextFieldWithLabelFormGroup
label={t('patient.address')}
name="address"
value={patient.address}
isEditable={false}
/>
</div>
</div>
<div className="col-md-6">
<TextInputWithLabelFormGroup
label={t('patient.preferredLanguage')}
name="preferredLanguage"
value={patient.preferredLanguage}
isEditable={false}
/>
</div>
</div>
<h3>{t('patient.contactInformation')}</h3>
<div className="row">
<div className="col">
<TextInputWithLabelFormGroup
label={t('patient.phoneNumber')}
name="phoneNumber"
value={patient.phoneNumber}
isEditable={false}
/>
</div>
<div className="col">
<TextInputWithLabelFormGroup
label={t('patient.email')}
placeholder="[email protected]"
name="email"
value={patient.email}
isEditable={false}
/>
</div>
</div>
<div className="row">
<div className="col">
<TextFieldWithLabelFormGroup
label={t('patient.address')}
name="address"
value={patient.address}
isEditable={false}
/>
</div>
</div>
</Panel>
</div>
)
}
Expand Down

0 comments on commit 452419c

Please sign in to comment.