fix: render custom actions on lead/deal header
This commit is contained in:
parent
1e780ff1ac
commit
95886bfde0
@ -4,6 +4,10 @@
|
||||
<Breadcrumbs :items="breadcrumbs" />
|
||||
</template>
|
||||
<template #right-header>
|
||||
<CustomActions
|
||||
v-if="deal.data._customActions"
|
||||
:actions="deal.data._customActions"
|
||||
/>
|
||||
<Dropdown
|
||||
:options="[
|
||||
{
|
||||
@ -310,8 +314,13 @@ import Link from '@/components/Controls/Link.vue'
|
||||
import Section from '@/components/Section.vue'
|
||||
import SectionFields from '@/components/SectionFields.vue'
|
||||
import SLASection from '@/components/SLASection.vue'
|
||||
import { openWebsite, createToast } from '@/utils'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import {
|
||||
openWebsite,
|
||||
createToast,
|
||||
setupAssignees,
|
||||
setupCustomActions,
|
||||
} from '@/utils'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
@ -329,7 +338,6 @@ import {
|
||||
import { ref, computed, h } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const { getUser } = usersStore()
|
||||
const { getContactByName, contacts } = contactsStore()
|
||||
const { organizations, getOrganization } = organizationsStore()
|
||||
const { statusOptions, getDealStatus } = statusesStore()
|
||||
@ -348,12 +356,8 @@ const deal = createResource({
|
||||
cache: ['deal', props.dealId],
|
||||
auto: true,
|
||||
onSuccess: (data) => {
|
||||
let assignees = JSON.parse(data._assign) || []
|
||||
data._assignedTo = assignees.map((user) => ({
|
||||
name: user,
|
||||
image: getUser(user).user_image,
|
||||
label: getUser(user).full_name,
|
||||
}))
|
||||
setupAssignees(data)
|
||||
setupCustomActions(data, { doc: data, updateField })
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -4,6 +4,10 @@
|
||||
<Breadcrumbs :items="breadcrumbs" />
|
||||
</template>
|
||||
<template #right-header>
|
||||
<CustomActions
|
||||
v-if="lead.data._customActions"
|
||||
:actions="lead.data._customActions"
|
||||
/>
|
||||
<Dropdown
|
||||
:options="[
|
||||
{
|
||||
@ -216,8 +220,13 @@ import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||
import Section from '@/components/Section.vue'
|
||||
import SectionFields from '@/components/SectionFields.vue'
|
||||
import SLASection from '@/components/SLASection.vue'
|
||||
import { openWebsite, createToast } from '@/utils'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import {
|
||||
openWebsite,
|
||||
createToast,
|
||||
setupAssignees,
|
||||
setupCustomActions,
|
||||
} from '@/utils'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
@ -236,7 +245,6 @@ import {
|
||||
import { ref, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const { getUser } = usersStore()
|
||||
const { contacts } = contactsStore()
|
||||
const { organizations, getOrganization } = organizationsStore()
|
||||
const { statusOptions, getLeadStatus } = statusesStore()
|
||||
@ -255,12 +263,8 @@ const lead = createResource({
|
||||
cache: ['lead', props.leadId],
|
||||
auto: true,
|
||||
onSuccess: (data) => {
|
||||
let assignees = JSON.parse(data._assign) || []
|
||||
data._assignedTo = assignees.map((user) => ({
|
||||
name: user,
|
||||
image: getUser(user).user_image,
|
||||
label: getUser(user).full_name,
|
||||
}))
|
||||
setupAssignees(data)
|
||||
setupCustomActions(data, { doc: data, updateField })
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
import TaskStatusIcon from '@/components/Icons/TaskStatusIcon.vue'
|
||||
import TaskPriorityIcon from '@/components/Icons/TaskPriorityIcon.vue'
|
||||
import { useDateFormat, useTimeAgo } from '@vueuse/core'
|
||||
import { usersStore } from '@/stores/users'
|
||||
import { toast } from 'frappe-ui'
|
||||
import { h, computed } from 'vue'
|
||||
import { h } from 'vue'
|
||||
|
||||
export function createToast(options) {
|
||||
toast({
|
||||
@ -112,3 +113,19 @@ export function validateEmail(email) {
|
||||
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return regExp.test(email)
|
||||
}
|
||||
|
||||
export function setupAssignees(data) {
|
||||
let { getUser } = usersStore()
|
||||
let assignees = JSON.parse(data._assign) || []
|
||||
data._assignedTo = assignees.map((user) => ({
|
||||
name: user,
|
||||
image: getUser(user).user_image,
|
||||
label: getUser(user).full_name,
|
||||
}))
|
||||
}
|
||||
|
||||
export function setupCustomActions(data, obj) {
|
||||
let script = new Function(data._form_script + '\nreturn setupForm')()
|
||||
let formScript = script(obj)
|
||||
data._customActions = formScript?.actions || []
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user