fix: redirect to notes/tasks tab if created from activity tab
This commit is contained in:
parent
cd4b87a067
commit
5c3196fb3d
@ -5,6 +5,7 @@
|
||||
:task="task"
|
||||
:doctype="doctype"
|
||||
:doc="doc.data?.name"
|
||||
@after="redirect('tasks')"
|
||||
/>
|
||||
<NoteModal
|
||||
v-model="showNoteModal"
|
||||
@ -12,6 +13,7 @@
|
||||
:note="note"
|
||||
:doctype="doctype"
|
||||
:doc="doc.data?.name"
|
||||
@after="redirect('notes')"
|
||||
/>
|
||||
</template>
|
||||
<script setup>
|
||||
@ -19,6 +21,7 @@ import TaskModal from '@/components/Modals/TaskModal.vue'
|
||||
import NoteModal from '@/components/Modals/NoteModal.vue'
|
||||
import { call } from 'frappe-ui'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
const props = defineProps({
|
||||
doctype: String,
|
||||
@ -74,6 +77,19 @@ function showNote(n) {
|
||||
showNoteModal.value = true
|
||||
}
|
||||
|
||||
// common
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
function redirect(tabName) {
|
||||
if (route.name == 'Lead' || route.name == 'Deal') {
|
||||
let hash = '#' + tabName
|
||||
if (route.hash != hash) {
|
||||
router.push({ ...route, hash })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
showTask,
|
||||
deleteTask,
|
||||
|
||||
@ -141,7 +141,7 @@ const props = defineProps({
|
||||
const show = defineModel()
|
||||
const tasks = defineModel('reloadTasks')
|
||||
|
||||
const emit = defineEmits(['updateTask'])
|
||||
const emit = defineEmits(['updateTask', 'after'])
|
||||
|
||||
const router = useRouter()
|
||||
const { getUser } = usersStore()
|
||||
@ -202,6 +202,7 @@ async function updateTask() {
|
||||
if (d.name) {
|
||||
capture('task_created')
|
||||
tasks.value.reload()
|
||||
emit('after')
|
||||
}
|
||||
}
|
||||
show.value = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user