@@ -17,6 +17,7 @@ import {
1717} from ' @/keys' ;
1818
1919import AppointmentCreatedModal from ' @/components/AppointmentCreatedModal.vue' ;
20+ import ConfirmationModal from ' @/components/ConfirmationModal.vue' ;
2021import PrimaryButton from ' @/tbpro/elements/PrimaryButton.vue' ;
2122import AlertBox from ' @/elements/AlertBox.vue' ;
2223import ToolTip from ' @/elements/ToolTip.vue' ;
@@ -242,9 +243,6 @@ const savedConfirmation = reactive({
242243 show: false ,
243244 title: ' ' ,
244245});
245- const closeCreatedModal = () => {
246- savedConfirmation .show = false ;
247- };
248246
249247// Revert the Schedule creation form to its initial values
250248const revertForm = (resetData = true ) => {
@@ -333,8 +331,19 @@ const saveSchedule = async (withConfirmation = true) => {
333331};
334332
335333// Update slug with a random 8 character string
334+ const refreshSlugModalOpen = ref (false );
335+ const showRefreshSlugConfirmation = async () => {
336+ refreshSlugModalOpen .value = true ;
337+ };
338+
339+ const closeModals = () => {
340+ savedConfirmation .show = false ;
341+ refreshSlugModalOpen .value = false ;
342+ };
343+
336344const refreshSlug = () => {
337345 scheduleInput .value .slug = window .crypto .randomUUID ().substring (0 , 8 );
346+ closeModals ();
338347};
339348
340349// handle schedule activation / deactivation
@@ -719,7 +728,7 @@ watch(
719728 </text-input >
720729 <link-button
721730 class =" p-0.5"
722- @click =" scheduleInput.active ? refreshSlug () : null"
731+ @click =" scheduleInput.active ? showRefreshSlugConfirmation () : null"
723732 :disabled =" !scheduleInput.active"
724733 data-testid =" dashboard-booking-settings-link-refresh-btn"
725734 >
@@ -831,8 +840,18 @@ watch(
831840 :is-schedule =" true"
832841 :title =" savedConfirmation.title"
833842 :public-link =" user.data.signedUrl"
834- @close =" closeCreatedModal "
843+ @close =" closeModals "
835844 />
845+ <!-- Refresh link confirmation modal -->
846+ <confirmation-modal
847+ :open =" refreshSlugModalOpen"
848+ :title =" t('label.refreshLink')"
849+ :message =" t('text.refreshLinkNotice')"
850+ :confirm-label =" t('label.refresh')"
851+ :cancel-label =" t('label.cancel')"
852+ @confirm =" () => refreshSlug()"
853+ @close =" closeModals"
854+ ></confirmation-modal >
836855</template >
837856
838857<style scoped>
0 commit comments