rejuvallife/resources/js/views/pages/home/StartOverPupup.vue
2024-10-25 01:02:11 +05:00

85 lines
2.8 KiB
Vue

<script setup>
import { defineProps } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
const store = useStore()
const router = useRouter()
const route = useRoute()
const props = defineProps({
showPopup: {
type: Boolean,
required: true,
},
})
const startOver = async () => {
const confirmation = window.confirm('Are you sure you want to leave this page?')
if (!confirmation) {
return false
} else {
store.dispatch('updateShowStartOverPupup', false)
// await store.dispatch('deletePatientRegRecord');
localStorage.removeItem('isLogin');
localStorage.removeItem('patient_id');
localStorage.removeItem('user_role');
localStorage.removeItem('access_token');
localStorage.removeItem('userAbilities');
localStorage.removeItem('agent_id');
localStorage.removeItem('appiontment-id');
localStorage.removeItem('patient_appointment_id');
localStorage.removeItem('cominguser');
localStorage.removeItem('currentPage');
localStorage.removeItem('profileCompleted');
localStorage.removeItem('category_name');
localStorage.removeItem('selectedSidebarMenu');
localStorage.removeItem('plan_id');
localStorage.removeItem('plan_image');
localStorage.removeItem('list_sub_title');
localStorage.removeItem('list_one_title');
localStorage.removeItem('list_two_title');
localStorage.removeItem('plan_name');
localStorage.removeItem('plan_price');
localStorage.removeItem('patient_appointment_details');
localStorage.removeItem('selected_time_slot');
const baseUrl = window.location.hostname;
console.log('baseUrl', window.location.origin)
let pathUrl = localStorage.getItem('go_checkout')
if (baseUrl === 'localhost') {
router.push(`${pathUrl}`);
} else {
window.location.href = window.location.origin + pathUrl;
}
}
};
const goWhereLeave = () => {
store.dispatch('updateShowStartOverPupup', false)
};
</script>
<template>
<VDialog v-model="props.showPopup" refs="startOverDialog" width="500">
<!-- <template v-slot:default="{ isActive }"> -->
<v-card>
<v-card-text>
<div class="mt-2 mb-2">
<h5>Do you want to start where you left? or You want to discard the saved data?.</h5>
</div>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<VBtn type="submit" text="Start Over" @click="startOver()"></VBtn>
<VBtn text="Continue" color="success" @click="goWhereLeave()"></VBtn>
</v-card-actions>
</v-card>
<!-- </template> -->
</VDialog>
</template>