Skip to content

Commit

Permalink
Alert when editing vitals of old visits.
Browse files Browse the repository at this point in the history
  • Loading branch information
pohanson committed Dec 12, 2024
1 parent 23fefc2 commit 2aa99f5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pages/records/patient-vitals/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import axiosInstance from '@/pages/api/_axiosInstance';
import CustomModal from '@/components/CustomModal';
import useWithLoading from '@/utils/loading';
import NoVisitPlaceholder from '@/components/records/NoVisitPlaceholder';
import { checkRecency } from '@/utils/check';

const PatientVitals = () => {
const [mounted, setMounted] = useState(false);
Expand Down Expand Up @@ -118,6 +119,19 @@ const PatientVitals = () => {
});

const submitVitalsForm = useWithLoading(async () => {
const THREE_DAY_IN_MIN = 4320; // 3 * 60 * 24

const toSubmit = await checkRecency(
patient.pk,
THREE_DAY_IN_MIN,
false,
`Are you sure you want to edit this vital?
Press OK to SUBMIT.
Press CANCEL to NOT SUBMIT.`
);
if (!toSubmit) {
return;
}
const formPayload = {
...vitalsFormDetails,
visit: selectedVisitID,
Expand Down

0 comments on commit 2aa99f5

Please sign in to comment.