diff --git a/src/labs/ViewLab.tsx b/src/labs/ViewLab.tsx
index b8328de69d..0cc3bb6c91 100644
--- a/src/labs/ViewLab.tsx
+++ b/src/labs/ViewLab.tsx
@@ -1,4 +1,4 @@
-import { Row, Column, Badge, Button, Alert } from '@hospitalrun/components'
+import { Row, Column, Badge, Button, Alert, Toast } from '@hospitalrun/components'
import format from 'date-fns/format'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -64,17 +64,26 @@ const ViewLab = () => {
}
const onUpdate = async () => {
- const onSuccess = () => {
- history.push('/labs')
+ const onSuccess = (update: Lab) => {
+ history.push(`/labs/${update.id}`)
+ Toast(
+ 'success',
+ t('states.success'),
+ `${t('labs.successfullyUpdated')} ${update.type} ${patient?.fullName}`,
+ )
}
if (labToView) {
dispatch(updateLab(labToView, onSuccess))
}
}
-
const onComplete = async () => {
- const onSuccess = () => {
- history.push('/labs')
+ const onSuccess = (complete: Lab) => {
+ history.push(`/labs/${complete.id}`)
+ Toast(
+ 'success',
+ t('states.success'),
+ `${t('labs.successfullyCompleted')} ${complete.type} ${patient?.fullName} `,
+ )
}
if (labToView) {
diff --git a/src/labs/requests/NewLabRequest.tsx b/src/labs/requests/NewLabRequest.tsx
index 08fe49b664..5036e94a89 100644
--- a/src/labs/requests/NewLabRequest.tsx
+++ b/src/labs/requests/NewLabRequest.tsx
@@ -1,4 +1,4 @@
-import { Typeahead, Label, Button, Alert } from '@hospitalrun/components'
+import { Typeahead, Label, Button, Alert, Toast } from '@hospitalrun/components'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useDispatch, useSelector } from 'react-redux'
@@ -40,6 +40,7 @@ const NewLabRequest = () => {
setNewLabRequest((previousNewLabRequest) => ({
...previousNewLabRequest,
patient: patient.id,
+ fullName: patient.fullName,
}))
}
@@ -60,12 +61,16 @@ const NewLabRequest = () => {
}
const onSave = async () => {
- const newLab = newLabRequest as Lab
- const onSuccess = (createdLab: Lab) => {
- history.push(`/labs/${createdLab.id}`)
+ const onSuccessRequest = (newLab: Lab) => {
+ history.push(`/labs/${newLab.id}`)
+ Toast(
+ 'success',
+ t('states.success'),
+ `${t('lab.successfullyCreated')} ${newLab.type} ${newLab.patient}`,
+ )
}
- dispatch(requestLab(newLab, onSuccess))
+ dispatch(requestLab(newLabRequest as Lab, onSuccessRequest))
}
const onCancel = () => {
@@ -114,6 +119,7 @@ const NewLabRequest = () => {
+