Skip to content

Commit

Permalink
fix: redirect to notes/tasks tab if created from activity tab
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Sep 30, 2024
1 parent cd4b87a commit 5c3196f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
16 changes: 16 additions & 0 deletions frontend/src/components/Activities/AllModals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
:task="task"
:doctype="doctype"
:doc="doc.data?.name"
@after="redirect('tasks')"
/>
<NoteModal
v-model="showNoteModal"
v-model:reloadNotes="activities"
:note="note"
:doctype="doctype"
:doc="doc.data?.name"
@after="redirect('notes')"
/>
</template>
<script setup>
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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/Modals/TaskModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -202,6 +202,7 @@ async function updateTask() {
if (d.name) {
capture('task_created')
tasks.value.reload()
emit('after')
}
}
show.value = false
Expand Down

0 comments on commit 5c3196f

Please sign in to comment.