fix: open linked lead or deal from note modal
This commit is contained in:
parent
9234b813e0
commit
b37ea28da9
@ -2,7 +2,6 @@
|
|||||||
<Dialog
|
<Dialog
|
||||||
v-model="show"
|
v-model="show"
|
||||||
:options="{
|
:options="{
|
||||||
title: editMode ? 'Edit Note' : 'Create Note',
|
|
||||||
size: 'xl',
|
size: 'xl',
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
@ -13,6 +12,26 @@
|
|||||||
],
|
],
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
<template #body-title>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<h3 class="text-2xl font-semibold leading-6 text-gray-900">
|
||||||
|
{{ editMode ? 'Edit Note' : 'Create Note' }}
|
||||||
|
</h3>
|
||||||
|
<Button
|
||||||
|
v-if="_note?.reference_docname"
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
:label="
|
||||||
|
_note.reference_doctype == 'CRM Deal' ? 'Open Deal' : 'Open Lead'
|
||||||
|
"
|
||||||
|
@click="redirect()"
|
||||||
|
>
|
||||||
|
<template #suffix>
|
||||||
|
<ArrowUpRightIcon class="h-4 w-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<template #body-content>
|
<template #body-content>
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div>
|
<div>
|
||||||
@ -42,8 +61,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import ArrowUpRightIcon from '@/components/Icons/ArrowUpRightIcon.vue'
|
||||||
import { TextEditor, call } from 'frappe-ui'
|
import { TextEditor, call } from 'frappe-ui'
|
||||||
import { ref, defineModel, nextTick, watch } from 'vue'
|
import { ref, defineModel, nextTick, watch } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
note: {
|
note: {
|
||||||
@ -65,6 +86,8 @@ const notes = defineModel('reloadNotes')
|
|||||||
|
|
||||||
const emit = defineEmits(['after'])
|
const emit = defineEmits(['after'])
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const title = ref(null)
|
const title = ref(null)
|
||||||
const editMode = ref(false)
|
const editMode = ref(false)
|
||||||
let _note = ref({})
|
let _note = ref({})
|
||||||
@ -104,6 +127,16 @@ async function updateNote() {
|
|||||||
show.value = false
|
show.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirect() {
|
||||||
|
if (!props.note?.reference_docname) return
|
||||||
|
let name = props.note.reference_doctype == 'CRM Deal' ? 'Deal' : 'Lead'
|
||||||
|
let params = { leadId: props.note.reference_docname }
|
||||||
|
if (name == 'Deal') {
|
||||||
|
params = { dealId: props.note.reference_docname }
|
||||||
|
}
|
||||||
|
router.push({ name: name, params: params })
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => show.value,
|
() => show.value,
|
||||||
(value) => {
|
(value) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user