fix: show linked lead & deal button
This commit is contained in:
parent
531e5710b8
commit
6c41e85518
@ -13,7 +13,7 @@ class CRMTask(Document):
|
||||
'label': 'Title',
|
||||
'type': 'Data',
|
||||
'key': 'title',
|
||||
'width': '12rem',
|
||||
'width': '16rem',
|
||||
},
|
||||
{
|
||||
'label': 'Status',
|
||||
@ -55,6 +55,8 @@ class CRMTask(Document):
|
||||
"due_date",
|
||||
"status",
|
||||
"priority",
|
||||
"reference_doctype",
|
||||
"reference_docname",
|
||||
"modified",
|
||||
]
|
||||
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>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div>
|
||||
@ -86,12 +104,14 @@
|
||||
<script setup>
|
||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||
import ArrowUpRightIcon from '@/components/Icons/ArrowUpRightIcon.vue'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
import Link from '@/components/Controls/Link.vue'
|
||||
import { taskStatusOptions, taskPriorityOptions } from '@/utils'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { TextEditor, Dropdown, Tooltip, DatePicker, call } from 'frappe-ui'
|
||||
import { ref, defineModel, watch, nextTick } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const props = defineProps({
|
||||
task: {
|
||||
@ -113,6 +133,7 @@ const tasks = defineModel('reloadTasks')
|
||||
|
||||
const emit = defineEmits(['updateTask'])
|
||||
|
||||
const router = useRouter()
|
||||
const { getUser } = usersStore()
|
||||
|
||||
const title = ref(null)
|
||||
@ -124,6 +145,8 @@ const _task = ref({
|
||||
due_date: '',
|
||||
status: 'Backlog',
|
||||
priority: 'Low',
|
||||
reference_doctype: props.doctype,
|
||||
reference_docname: null,
|
||||
})
|
||||
|
||||
function updateTaskStatus(status) {
|
||||
@ -134,6 +157,16 @@ function updateTaskPriority(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() {
|
||||
if (!_task.value.assigned_to) {
|
||||
_task.value.assigned_to = getUser().email
|
||||
|
||||
@ -74,7 +74,7 @@ const rows = computed(() => {
|
||||
label: task.assigned_to && getUser(task.assigned_to).full_name,
|
||||
...(task.assigned_to && getUser(task.assigned_to)),
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
return _rows
|
||||
})
|
||||
@ -89,6 +89,8 @@ const task = ref({
|
||||
due_date: '',
|
||||
status: 'Backlog',
|
||||
priority: 'Low',
|
||||
reference_doctype: 'CRM Lead',
|
||||
reference_docname: '',
|
||||
})
|
||||
|
||||
function showTask(name) {
|
||||
@ -100,6 +102,8 @@ function showTask(name) {
|
||||
due_date: t.due_date,
|
||||
status: t.status,
|
||||
priority: t.priority,
|
||||
reference_doctype: t.reference_doctype,
|
||||
reference_docname: t.reference_docname,
|
||||
}
|
||||
showTaskModal.value = true
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user