diff --git a/src/patients/appointments/AppointmentsList.tsx b/src/patients/appointments/AppointmentsList.tsx index 898e3ef697..67f40a3f16 100644 --- a/src/patients/appointments/AppointmentsList.tsx +++ b/src/patients/appointments/AppointmentsList.tsx @@ -61,15 +61,22 @@ const AppointmentsList = ({ patient }: Props) => { label: t('scheduling.appointment.startDate'), key: 'startDateTime', formatter: (row) => - row.startDateTime - ? format(new Date(row.startDateTime), 'yyyy-MM-dd, hh:mm a') - : '', + row.start ? format(new Date(row.start), 'yyyy-MM-dd, hh:mm a') : '', }, { label: t('scheduling.appointment.endDate'), key: 'endDateTime', formatter: (row) => - row.endDateTime ? format(new Date(row.endDateTime), 'yyyy-MM-dd, hh:mm a') : '', + row.start + ? format( + new Date( + new Date(row.start).setMinutes( + new Date(row.start).getMinutes() + row.minutesDuration, + ), + ), + 'yyyy-MM-dd, hh:mm a', + ) + : '', }, { label: t('scheduling.appointment.location'), key: 'location' }, { label: t('scheduling.appointment.type'), key: 'type' }, diff --git a/src/patients/history/mappers/helpers.tsx b/src/patients/history/mappers/helpers.tsx index 1a5ee1f877..5f54de031c 100644 --- a/src/patients/history/mappers/helpers.tsx +++ b/src/patients/history/mappers/helpers.tsx @@ -35,20 +35,22 @@ export const convertLab = (lab: Lab): PatientHistoryRecord[] => { export const convertAppointment = (appt: Appointment): PatientHistoryRecord[] => { const apptEvents = [] - if (appt.startDateTime) { + if (appt.start) { apptEvents.push({ - date: new Date(appt.startDateTime), + date: new Date(appt.start), type: HistoryRecordType.APPOINTMENT, - info: `Started - ${appt.type}`, + info: `Started - ${appt.appointmentType.text}`, recordId: appt.id, id: `startedAppt${appt.id}`, }) } - if (appt.endDateTime) { + if (new Date(appt.start).setMinutes(new Date(appt.start).getMinutes() + appt.minutesDuration)) { apptEvents.push({ - date: new Date(appt.endDateTime), + date: new Date( + new Date(appt.start).setMinutes(new Date(appt.start).getMinutes() + appt.minutesDuration), + ), type: HistoryRecordType.APPOINTMENT, - info: `Ended - ${appt.type}`, + info: `Ended - ${appt.appointmentType.text}`, recordId: appt.id, id: `endedAppt${appt.id}`, }) diff --git a/src/patients/search/ViewPatients.tsx b/src/patients/search/ViewPatients.tsx index d659a0339b..d9dc221616 100644 --- a/src/patients/search/ViewPatients.tsx +++ b/src/patients/search/ViewPatients.tsx @@ -1,7 +1,7 @@ import { Button } from '@hospitalrun/components' import React, { useEffect } from 'react' import { useDispatch } from 'react-redux' -import { useHistory } from 'react-router' +import { useHistory } from 'react-router-dom' import useAddBreadcrumbs from '../../page-header/breadcrumbs/useAddBreadcrumbs' import { useButtonToolbarSetter } from '../../page-header/button-toolbar/ButtonBarProvider' diff --git a/src/patients/visits/FilterPatientModal.tsx b/src/patients/visits/FilterPatientModal.tsx index e483305b1e..44775f58dd 100644 --- a/src/patients/visits/FilterPatientModal.tsx +++ b/src/patients/visits/FilterPatientModal.tsx @@ -2,7 +2,11 @@ import React, { useState } from 'react' import { Label, Modal, Select } from '@hospitalrun/components' import useTranslator from '../../shared/hooks/useTranslator' import { Button } from 'react-bootstrap' -import { appointmentTypes } from '../../scheduling/appointments/constants/Appointment' +import { + appointmentStatus, + appointmentTypes, +} from '../../scheduling/appointments/constants/Appointment' +// import { getAllPatients } from '../../scheduling/appointments/service/Patients' interface Props { show: boolean @@ -11,13 +15,21 @@ interface Props { } const FilterPatientModal = ({ show, onCloseButtonClick, onFieldChange }: Props) => { + // const func = () => { + // console.log('ALL PATIENTS DATA', getAllPatients()) + // } + + // useEffect(() => { + // func() + // }, []) + const { t } = useTranslator() - const [patientId, setpatientId] = useState('') + const [patientStatus, setPatientStatus] = useState('') const [appointmentType, setappointmentType] = useState('') const clearValues = () => { - setpatientId('') + setPatientStatus('') setappointmentType('') } @@ -28,13 +40,23 @@ const FilterPatientModal = ({ show, onCloseButtonClick, onFieldChange }: Props)