diff --git a/ui/react-components/components/AddAppointment/AddAppointment.jsx b/ui/react-components/components/AddAppointment/AddAppointment.jsx index a8b64a63fa..43981d5c8c 100644 --- a/ui/react-components/components/AddAppointment/AddAppointment.jsx +++ b/ui/react-components/components/AddAppointment/AddAppointment.jsx @@ -110,6 +110,7 @@ const AddAppointment = props => { const [errors, setErrors] = useState(initialErrorsState); const [showSuccessPopup, setShowSuccessPopup] = useState(false); const [serviceErrorMessage, setServiceErrorMessage] = useState(''); + const [disableSaveButton, setDisableSaveButton] = useState(false); useEffect(() => { if (appointmentDetails.occurrences === undefined) @@ -246,6 +247,7 @@ const AddAppointment = props => { const save = async appointmentRequest => { + setDisableSaveButton(true); if (appConfig.enableAppointmentRequests) { await checkAndUpdateAppointmentStatus(appointmentRequest, false); } @@ -259,10 +261,12 @@ const AddAppointment = props => { setServiceErrorMessageFromResponse(response.data); resetServiceErrorMessage(); } + setDisableSaveButton(false); }; const checkAndSave = async () => { if (isValidAppointment()) { + setDisableSaveButton(true); const appointment = getAppointmentRequest(); const response = await getAppointmentConflicts(appointment); const status = response.status; @@ -275,6 +279,7 @@ const AddAppointment = props => { setServiceErrorMessageFromResponse(response.data); resetServiceErrorMessage(); } + setDisableSaveButton(false); } }; @@ -284,6 +289,7 @@ const AddAppointment = props => { }; const saveRecurringAppointments = async recurringAppointmentRequest => { + setDisableSaveButton(true); if (appConfig.enableAppointmentRequests) { await checkAndUpdateAppointmentStatus(recurringAppointmentRequest, true); } @@ -302,12 +308,14 @@ const AddAppointment = props => { setServiceErrorMessageFromResponse(response.data); resetServiceErrorMessage(); } + setDisableSaveButton(false); }; const checkAndSaveRecurringAppointments = async () => { if (isValidRecurringAppointment()) { + setDisableSaveButton(true); const recurringRequest = getRecurringAppointmentRequest(); const response = await getRecurringAppointmentsConflicts(recurringRequest); const status = response.status; @@ -320,6 +328,7 @@ const AddAppointment = props => { setServiceErrorMessageFromResponse(response.data); resetServiceErrorMessage(); } + setDisableSaveButton(false); } }; @@ -549,7 +558,9 @@ const AddAppointment = props => { + cancelConfirmationMessage={CANCEL_CONFIRMATION_MESSAGE_ADD} + disableSaveAndUpdateButton={disableSaveButton} + /> {conflicts && { popupContent={ setConflicts(undefined)} conflicts={conflicts} service={appointmentDetails.service} + disableSaveAnywayButton={disableSaveButton} isRecurring={appointmentDetails.isRecurring}/>}/>} {showSuccessPopup ? React.cloneElement(savePopup, { open: true, diff --git a/ui/react-components/components/AppointmentEditorFooter/AppointmentEditorFooter.jsx b/ui/react-components/components/AppointmentEditorFooter/AppointmentEditorFooter.jsx index dcdde085a2..175b6aa239 100644 --- a/ui/react-components/components/AppointmentEditorFooter/AppointmentEditorFooter.jsx +++ b/ui/react-components/components/AppointmentEditorFooter/AppointmentEditorFooter.jsx @@ -20,7 +20,7 @@ import ErrorMessage from "../ErrorMessage/ErrorMessage.jsx"; const AppointmentEditorFooter = props => { - const {checkAndSave, isEdit, isOptionsRequired, disableUpdateButton, cancelConfirmationMessage, errorMessage} = props; + const {checkAndSave, isEdit, isOptionsRequired, disableSaveAndUpdateButton, cancelConfirmationMessage, errorMessage} = props; const[showUpdateButtons, setShowUpdateButtons] = useState(false); const getUpdateButtons =() =>{ @@ -45,14 +45,14 @@ const AppointmentEditorFooter = props => { {isEdit ? - :