fix: show linked lead & deal button
This commit is contained in:
parent
531e5710b8
commit
6c41e85518
@ -13,7 +13,7 @@ class CRMTask(Document):
|
|||||||
'label': 'Title',
|
'label': 'Title',
|
||||||
'type': 'Data',
|
'type': 'Data',
|
||||||
'key': 'title',
|
'key': 'title',
|
||||||
'width': '12rem',
|
'width': '16rem',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': 'Status',
|
'label': 'Status',
|
||||||
@ -55,6 +55,8 @@ class CRMTask(Document):
|
|||||||
"due_date",
|
"due_date",
|
||||||
"status",
|
"status",
|
||||||
"priority",
|
"priority",
|
||||||
|
"reference_doctype",
|
||||||
|
"reference_docname",
|
||||||
"modified",
|
"modified",
|
||||||
]
|
]
|
||||||
return {'columns': columns, 'rows': rows}
|
return {'columns': columns, 'rows': rows}
|
||||||
|
|||||||
@ -13,6 +13,24 @@
|
|||||||
],
|
],
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
<template #body-title>
|
||||||
|
<div class="flex items-center gap-3">
|
||||||
|
<h3 class="text-2xl font-semibold leading-6 text-gray-900">
|
||||||
|
{{ editMode ? 'Edit Task' : 'Create Task' }}
|
||||||
|
</h3>
|
||||||
|
<Button
|
||||||
|
v-if="task?.reference_docname"
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
:label="task.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>
|
||||||
@ -86,12 +104,14 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||||
|
import ArrowUpRightIcon from '@/components/Icons/ArrowUpRightIcon.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
import Link from '@/components/Controls/Link.vue'
|
import Link from '@/components/Controls/Link.vue'
|
||||||
import { taskStatusOptions, taskPriorityOptions } from '@/utils'
|
import { taskStatusOptions, taskPriorityOptions } from '@/utils'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { TextEditor, Dropdown, Tooltip, DatePicker, call } from 'frappe-ui'
|
import { TextEditor, Dropdown, Tooltip, DatePicker, call } from 'frappe-ui'
|
||||||
import { ref, defineModel, watch, nextTick } from 'vue'
|
import { ref, defineModel, watch, nextTick } from 'vue'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
task: {
|
task: {
|
||||||
@ -113,6 +133,7 @@ const tasks = defineModel('reloadTasks')
|
|||||||
|
|
||||||
const emit = defineEmits(['updateTask'])
|
const emit = defineEmits(['updateTask'])
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
|
|
||||||
const title = ref(null)
|
const title = ref(null)
|
||||||
@ -124,6 +145,8 @@ const _task = ref({
|
|||||||
due_date: '',
|
due_date: '',
|
||||||
status: 'Backlog',
|
status: 'Backlog',
|
||||||
priority: 'Low',
|
priority: 'Low',
|
||||||
|
reference_doctype: props.doctype,
|
||||||
|
reference_docname: null,
|
||||||
})
|
})
|
||||||
|
|
||||||
function updateTaskStatus(status) {
|
function updateTaskStatus(status) {
|
||||||
@ -134,6 +157,16 @@ function updateTaskPriority(priority) {
|
|||||||
_task.value.priority = priority
|
_task.value.priority = priority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function redirect() {
|
||||||
|
if (!props.task?.reference_docname) return
|
||||||
|
let name = props.task.reference_doctype == 'CRM Deal' ? 'Deal' : 'Lead'
|
||||||
|
let params = { leadId: props.task.reference_docname }
|
||||||
|
if (name == 'Deal') {
|
||||||
|
params = { dealId: props.task.reference_docname }
|
||||||
|
}
|
||||||
|
router.push({ name: name, params: params })
|
||||||
|
}
|
||||||
|
|
||||||
async function updateTask() {
|
async function updateTask() {
|
||||||
if (!_task.value.assigned_to) {
|
if (!_task.value.assigned_to) {
|
||||||
_task.value.assigned_to = getUser().email
|
_task.value.assigned_to = getUser().email
|
||||||
|
|||||||
@ -89,6 +89,8 @@ const task = ref({
|
|||||||
due_date: '',
|
due_date: '',
|
||||||
status: 'Backlog',
|
status: 'Backlog',
|
||||||
priority: 'Low',
|
priority: 'Low',
|
||||||
|
reference_doctype: 'CRM Lead',
|
||||||
|
reference_docname: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
function showTask(name) {
|
function showTask(name) {
|
||||||
@ -100,6 +102,8 @@ function showTask(name) {
|
|||||||
due_date: t.due_date,
|
due_date: t.due_date,
|
||||||
status: t.status,
|
status: t.status,
|
||||||
priority: t.priority,
|
priority: t.priority,
|
||||||
|
reference_doctype: t.reference_doctype,
|
||||||
|
reference_docname: t.reference_docname,
|
||||||
}
|
}
|
||||||
showTaskModal.value = true
|
showTaskModal.value = true
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user