Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
toOmrsIsoString,
toDateObjectStrict,
showNotification,
showToast,
useConfig,
restBaseUrl,
showSnackbar,
} from '@openmrs/esm-framework';
import styles from './standard-regimen.scss';
import StandardRegimen from './standard-regimen.component';
Expand Down Expand Up @@ -192,10 +192,11 @@ const RegimenForm: React.FC<RegimenFormProps> = ({
saveEncounter(encounterToSave).then(
(response) => {
if (response.status === 201) {
showToast({
showSnackbar({
kind: 'success',
title: t('regimenUpdated', 'Regimen updated'),
description: t('regimenUpdatedSuccessfully', `Regimen updated successfully.`),
subtitle: t('regimenUpdatedSuccessfully', `Regimen updated successfully.`),
autoClose: true,
});
setIsSubmitting(false);
mutate(`${restBaseUrl}/currentProgramDetails?patientUuid=${patientUuid}`);
Expand All @@ -212,6 +213,7 @@ const RegimenForm: React.FC<RegimenFormProps> = ({
kind: 'error',
critical: true,
description: error?.message,
millis: 3000,
});
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import {
navigate,
restBaseUrl,
showNotification,
showToast,
useLayoutType,
useSession,
getSessionStore,
showSnackbar,
} from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { useQueueRoomLocations } from '../hooks/useQueueRooms';
Expand Down Expand Up @@ -98,6 +98,7 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
kind: 'error',
critical: true,
description: errorMessages.join(','),
millis: 3000,
});
})
.finally(() => setIsLoading(false));
Expand All @@ -115,6 +116,8 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
title: 'Queue entry not found',
kind: 'warning',
description: 'The server did not return a valid queue entry.',
critical: true,
millis: 3000,
});
}
} catch (error) {
Expand All @@ -124,6 +127,7 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
kind: 'error',
critical: true,
description: errorMessages.join(', '),
millis: 3000,
});
}
}, [patientQueueUuid]);
Expand All @@ -149,7 +153,6 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
defaultValues: {
priorityComment: priorityLabels[contentSwitcherIndex],
status: statusLabels[statusSwitcherIndex].status,

},
});

Expand All @@ -176,11 +179,11 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
if (status === QueueStatus.Pending) {
if (queueEntry.length > 0) {
await updateQueueEntry(status, provider, queueEntry[0]?.uuid, 0, priorityComment, comment).then(() => {
showToast({
critical: true,
showSnackbar({
title: t('moveToNextServicePoint', 'Move back your service point'),
kind: 'success',
description: t('backToQueue', 'Successfully moved back patient to your service point'),
subtitle: t('backToQueue', 'Successfully moved back patient to your service point'),
autoClose: true,
});
closeWorkspace();
handleMutate(`${restBaseUrl}/patientqueue`);
Expand Down Expand Up @@ -240,11 +243,11 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
);

if (response.status === 200) {
showToast({
critical: true,
showSnackbar({
title: t('moveToNextServicePoint', 'Move to next service point'),
kind: 'success',
description: t('movetonextservicepoint', 'Moved to next service point successfully'),
subtitle: t('movetonextservicepoint', 'Moved to next service point successfully'),
autoClose: true,
});
handleMutate(`${restBaseUrl}/patientqueue`);
closeWorkspace();
Expand Down Expand Up @@ -277,6 +280,7 @@ const MoveToNextServicePointForm: React.FC<MoveToNextServicePointFormProps> = ({
kind: 'error',
critical: true,
description: errorMessages.join(','),
millis: 3000,
});
handleMutate(`${restBaseUrl}/patientqueue`);
closeWorkspace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
parseDate,
restBaseUrl,
showNotification,
showToast,
showSnackbar,
useSession,
} from '@openmrs/esm-framework';

Expand Down Expand Up @@ -54,6 +54,7 @@ const PickQueuePatientDialog: React.FC<PickQueuePatientDialogProps> = ({ queueEn
kind: 'error',
critical: true,
description: errorMessages.join(','),
millis: 3000,
});
},
);
Expand All @@ -70,11 +71,11 @@ const PickQueuePatientDialog: React.FC<PickQueuePatientDialogProps> = ({ queueEn
const status = 'Picked';
await updateQueueEntry(status, provider, queueEntry?.uuid, 0, priorityComment, 'comment');

showToast({
critical: true,
showSnackbar({
title: t('updateEntry', 'Update entry'),
kind: 'success',
description: t('queueEntryUpdateSuccessfully', 'Queue Entry Updated Successfully'),
subtitle: t('queueEntryUpdateSuccessfully', 'Queue Entry Updated Successfully'),
autoClose: true,
});

navigate({ to: `\${openmrsSpaBase}/patient/${queueEntry?.patient?.uuid}/chart` });
Expand All @@ -88,6 +89,7 @@ const PickQueuePatientDialog: React.FC<PickQueuePatientDialogProps> = ({ queueEn
kind: 'error',
critical: true,
description: error?.message,
millis: 3000,
});
handleMutate(`${restBaseUrl}/patientqueue`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ExtensionSlot,
restBaseUrl,
showNotification,
showToast,
showSnackbar,
useLayoutType,
usePatient,
useSession,
Expand Down Expand Up @@ -78,7 +78,7 @@ const StartVisitForm: React.FC<VisitFormProps> = ({ patientUuid, closePanel, hea
resolver: zodResolver(createQueueEntrySchema),
defaultValues: {
status: QueueStatus.Pending,
priorityComment: priorityLabels[contentSwitcherIndex]
priorityComment: priorityLabels[contentSwitcherIndex],
},
});

Expand All @@ -105,6 +105,8 @@ const StartVisitForm: React.FC<VisitFormProps> = ({ patientUuid, closePanel, hea
title: t('visitExists', 'Visit already exists'),
kind: 'info',
description: t('activeVisitExists', 'An active visit already exists for this patient.'),
millis: 3000,
critical: true,
});
return;
}
Expand All @@ -125,10 +127,11 @@ const StartVisitForm: React.FC<VisitFormProps> = ({ patientUuid, closePanel, hea
const createQueueResponse = await checkInQueue(request);

if (createQueueResponse.status === 201) {
showToast({
showSnackbar({
kind: 'success',
title: t('startVisit', 'Start a visit'),
description: t('startVisitQueueSuccessfully', 'Patient has been added to active visits list and queue.'),
subtitle: t('startVisitQueueSuccessfully', 'Patient has been added to active visits list and queue.'),
autoClose: true,
});

handleMutate(`${restBaseUrl}/patientqueue`);
Expand All @@ -141,6 +144,7 @@ const StartVisitForm: React.FC<VisitFormProps> = ({ patientUuid, closePanel, hea
kind: 'error',
critical: true,
description: error?.message || t('unexpectedError', 'An unexpected error occurred'),
millis: 3000,
});
} finally {
setIsSubmitting(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
TableCell,
Tile,
} from '@carbon/react';
import { ErrorState, UserHasAccess, showToast, showNotification, showSnackbar } from '@openmrs/esm-framework';
import { ErrorState, UserHasAccess, showNotification, showSnackbar } from '@openmrs/esm-framework';
import { updatePropertyValue, useGetSystemInformation, useRetrieveFacilityCode } from './system-info.resources';
import styles from './system-info.scss';
import coatOfArms from '../../images/coat_of_arms.png';
Expand Down Expand Up @@ -161,6 +161,7 @@ const SystemInfoPage = () => {
kind: 'success',
title: t('Updating Facility Code', 'Updating Facility Code'),
subtitle: t('UpdatingFacilityCode', `Updated Facility Code ${response?.value}`),
autoClose: true,
});
},
(error) => {
Expand All @@ -169,6 +170,7 @@ const SystemInfoPage = () => {
kind: 'error',
critical: true,
description: error?.message,
millis: 3000,
});
},
);
Expand Down