fix: removed setuAssignees code
This commit is contained in:
parent
e214ce8bfb
commit
44df09fac2
@ -13,7 +13,6 @@ def get_deal(name):
|
|||||||
|
|
||||||
deal["fields_meta"] = get_fields_meta("CRM Deal")
|
deal["fields_meta"] = get_fields_meta("CRM Deal")
|
||||||
deal["_form_script"] = get_form_script("CRM Deal")
|
deal["_form_script"] = get_form_script("CRM Deal")
|
||||||
deal["_assign"] = get_assigned_users("CRM Deal", deal.name)
|
|
||||||
return deal
|
return deal
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -13,5 +13,4 @@ def get_lead(name):
|
|||||||
|
|
||||||
lead["fields_meta"] = get_fields_meta("CRM Lead")
|
lead["fields_meta"] = get_fields_meta("CRM Lead")
|
||||||
lead["_form_script"] = get_form_script("CRM Lead")
|
lead["_form_script"] = get_form_script("CRM Lead")
|
||||||
lead["_assign"] = get_assigned_users("CRM Lead", lead.name)
|
|
||||||
return lead
|
return lead
|
||||||
|
|||||||
@ -334,12 +334,7 @@ import Section from '@/components/Section.vue'
|
|||||||
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
||||||
import SLASection from '@/components/SLASection.vue'
|
import SLASection from '@/components/SLASection.vue'
|
||||||
import CustomActions from '@/components/CustomActions.vue'
|
import CustomActions from '@/components/CustomActions.vue'
|
||||||
import {
|
import { openWebsite, setupCustomizations, copyToClipboard } from '@/utils'
|
||||||
openWebsite,
|
|
||||||
setupAssignees,
|
|
||||||
setupCustomizations,
|
|
||||||
copyToClipboard,
|
|
||||||
} from '@/utils'
|
|
||||||
import { getView } from '@/utils/view'
|
import { getView } from '@/utils/view'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
@ -399,7 +394,6 @@ const deal = createResource({
|
|||||||
organization.fetch()
|
organization.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAssignees(deal)
|
|
||||||
setupCustomizations(deal, {
|
setupCustomizations(deal, {
|
||||||
doc: data,
|
doc: data,
|
||||||
$dialog,
|
$dialog,
|
||||||
@ -727,8 +721,8 @@ function openEmailBox() {
|
|||||||
|
|
||||||
const { assignees, document } = useDocument('CRM Deal', props.dealId)
|
const { assignees, document } = useDocument('CRM Deal', props.dealId)
|
||||||
|
|
||||||
function reloadAssignees(changes) {
|
function reloadAssignees(data) {
|
||||||
if (changes?.hasOwnProperty('lead_owner')) {
|
if (data?.hasOwnProperty('deal_owner')) {
|
||||||
assignees.reload()
|
assignees.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -337,12 +337,7 @@ import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
|||||||
import FieldLayout from '@/components/FieldLayout/FieldLayout.vue'
|
import FieldLayout from '@/components/FieldLayout/FieldLayout.vue'
|
||||||
import SLASection from '@/components/SLASection.vue'
|
import SLASection from '@/components/SLASection.vue'
|
||||||
import CustomActions from '@/components/CustomActions.vue'
|
import CustomActions from '@/components/CustomActions.vue'
|
||||||
import {
|
import { openWebsite, setupCustomizations, copyToClipboard } from '@/utils'
|
||||||
openWebsite,
|
|
||||||
setupAssignees,
|
|
||||||
setupCustomizations,
|
|
||||||
copyToClipboard,
|
|
||||||
} from '@/utils'
|
|
||||||
import { showQuickEntryModal, quickEntryProps } from '@/composables/modals'
|
import { showQuickEntryModal, quickEntryProps } from '@/composables/modals'
|
||||||
import { getView } from '@/utils/view'
|
import { getView } from '@/utils/view'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
@ -405,7 +400,6 @@ const lead = createResource({
|
|||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
errorTitle.value = ''
|
errorTitle.value = ''
|
||||||
errorMessage.value = ''
|
errorMessage.value = ''
|
||||||
setupAssignees(lead)
|
|
||||||
setupCustomizations(lead, {
|
setupCustomizations(lead, {
|
||||||
doc: data,
|
doc: data,
|
||||||
$dialog,
|
$dialog,
|
||||||
@ -717,8 +711,8 @@ function openQuickEntryModal() {
|
|||||||
showConvertToDealModal.value = false
|
showConvertToDealModal.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadAssignees(changes) {
|
function reloadAssignees(data) {
|
||||||
if (changes?.hasOwnProperty('lead_owner')) {
|
if (data?.hasOwnProperty('lead_owner')) {
|
||||||
assignees.reload()
|
assignees.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
||||||
>
|
>
|
||||||
<AssignTo
|
<AssignTo
|
||||||
v-model="deal.data._assignedTo"
|
v-model="assignees.data"
|
||||||
:data="deal.data"
|
:data="document.doc"
|
||||||
doctype="CRM Deal"
|
doctype="CRM Deal"
|
||||||
/>
|
/>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@ -66,6 +66,7 @@
|
|||||||
doctype="CRM Deal"
|
doctype="CRM Deal"
|
||||||
:docname="deal.data.name"
|
:docname="deal.data.name"
|
||||||
@reload="sections.reload"
|
@reload="sections.reload"
|
||||||
|
@afterFieldChange="reloadAssignees"
|
||||||
>
|
>
|
||||||
<template #actions="{ section }">
|
<template #actions="{ section }">
|
||||||
<div v-if="section.name == 'contacts_section'" class="pr-2">
|
<div v-if="section.name == 'contacts_section'" class="pr-2">
|
||||||
@ -258,12 +259,13 @@ import Link from '@/components/Controls/Link.vue'
|
|||||||
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
||||||
import SLASection from '@/components/SLASection.vue'
|
import SLASection from '@/components/SLASection.vue'
|
||||||
import CustomActions from '@/components/CustomActions.vue'
|
import CustomActions from '@/components/CustomActions.vue'
|
||||||
import { setupAssignees, setupCustomizations } from '@/utils'
|
import { setupCustomizations } from '@/utils'
|
||||||
import { getView } from '@/utils/view'
|
import { getView } from '@/utils/view'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
|
import { useDocument } from '@/data/document'
|
||||||
import {
|
import {
|
||||||
whatsappEnabled,
|
whatsappEnabled,
|
||||||
callEnabled,
|
callEnabled,
|
||||||
@ -311,7 +313,6 @@ const deal = createResource({
|
|||||||
organization.fetch()
|
organization.fetch()
|
||||||
}
|
}
|
||||||
|
|
||||||
setupAssignees(deal)
|
|
||||||
setupCustomizations(deal, {
|
setupCustomizations(deal, {
|
||||||
doc: data,
|
doc: data,
|
||||||
$dialog,
|
$dialog,
|
||||||
@ -605,4 +606,12 @@ async function deleteDeal(name) {
|
|||||||
})
|
})
|
||||||
router.push({ name: 'Deals' })
|
router.push({ name: 'Deals' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { assignees, document } = useDocument('CRM Deal', props.dealId)
|
||||||
|
|
||||||
|
function reloadAssignees(data) {
|
||||||
|
if (data?.hasOwnProperty('deal_owner')) {
|
||||||
|
assignees.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
||||||
>
|
>
|
||||||
<AssignTo
|
<AssignTo
|
||||||
v-model="lead.data._assignedTo"
|
v-model="assignees.data"
|
||||||
:data="lead.data"
|
:data="document.doc"
|
||||||
doctype="CRM Lead"
|
doctype="CRM Lead"
|
||||||
/>
|
/>
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@ -71,6 +71,7 @@
|
|||||||
doctype="CRM Lead"
|
doctype="CRM Lead"
|
||||||
:docname="lead.data.name"
|
:docname="lead.data.name"
|
||||||
@reload="sections.reload"
|
@reload="sections.reload"
|
||||||
|
@afterFieldChange="reloadAssignees"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -173,12 +174,13 @@ import Link from '@/components/Controls/Link.vue'
|
|||||||
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
||||||
import SLASection from '@/components/SLASection.vue'
|
import SLASection from '@/components/SLASection.vue'
|
||||||
import CustomActions from '@/components/CustomActions.vue'
|
import CustomActions from '@/components/CustomActions.vue'
|
||||||
import { setupAssignees, setupCustomizations } from '@/utils'
|
import { setupCustomizations } from '@/utils'
|
||||||
import { getView } from '@/utils/view'
|
import { getView } from '@/utils/view'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
|
import { useDocument } from '@/data/document'
|
||||||
import {
|
import {
|
||||||
whatsappEnabled,
|
whatsappEnabled,
|
||||||
callEnabled,
|
callEnabled,
|
||||||
@ -220,7 +222,6 @@ const lead = createResource({
|
|||||||
params: { name: props.leadId },
|
params: { name: props.leadId },
|
||||||
cache: ['lead', props.leadId],
|
cache: ['lead', props.leadId],
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
setupAssignees(lead)
|
|
||||||
setupCustomizations(lead, {
|
setupCustomizations(lead, {
|
||||||
doc: data,
|
doc: data,
|
||||||
$dialog,
|
$dialog,
|
||||||
@ -454,4 +455,12 @@ async function convertToDeal() {
|
|||||||
router.push({ name: 'Deal', params: { dealId: deal } })
|
router.push({ name: 'Deal', params: { dealId: deal } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { assignees, document } = useDocument('CRM Lead', props.leadId)
|
||||||
|
|
||||||
|
function reloadAssignees(data) {
|
||||||
|
if (data?.hasOwnProperty('lead_owner')) {
|
||||||
|
assignees.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -211,16 +211,6 @@ export function validateEmail(email) {
|
|||||||
return regExp.test(email)
|
return regExp.test(email)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setupAssignees(doc) {
|
|
||||||
let { getUser } = usersStore()
|
|
||||||
let assignees = doc.data?._assign || []
|
|
||||||
doc.data._assignedTo = assignees.map((user) => ({
|
|
||||||
name: user,
|
|
||||||
image: getUser(user).user_image,
|
|
||||||
label: getUser(user).full_name,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function parseAssignees(assignees) {
|
export function parseAssignees(assignees) {
|
||||||
let { getUser } = usersStore()
|
let { getUser } = usersStore()
|
||||||
return assignees.map((user) => ({
|
return assignees.map((user) => ({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user