Merge pull request #509 from shariquerik/assignto
This commit is contained in:
commit
70c5e9cefb
@ -10,7 +10,7 @@ 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, deal.owner)
|
deal["_assign"] = get_assigned_users("CRM Deal", deal.name)
|
||||||
return deal
|
return deal
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,5 +10,5 @@ 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, lead.owner)
|
lead["_assign"] = get_assigned_users("CRM Lead", lead.name)
|
||||||
return lead
|
return lead
|
||||||
|
|||||||
31
frontend/src/components/AssignTo.vue
Normal file
31
frontend/src/components/AssignTo.vue
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<template>
|
||||||
|
<component
|
||||||
|
v-if="assignees?.length"
|
||||||
|
:is="assignees?.length == 1 ? 'Button' : 'div'"
|
||||||
|
>
|
||||||
|
<MultipleAvatar :avatars="assignees" @click="showAssignmentModal = true" />
|
||||||
|
</component>
|
||||||
|
<Button v-else @click="showAssignmentModal = true">
|
||||||
|
{{ __('Assign to') }}
|
||||||
|
</Button>
|
||||||
|
<AssignmentModal
|
||||||
|
v-if="showAssignmentModal"
|
||||||
|
v-model="showAssignmentModal"
|
||||||
|
v-model:assignees="assignees"
|
||||||
|
:doctype="doctype"
|
||||||
|
:doc="data"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||||
|
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
data: Object,
|
||||||
|
doctype: String,
|
||||||
|
})
|
||||||
|
|
||||||
|
const showAssignmentModal = ref(false)
|
||||||
|
const assignees = defineModel()
|
||||||
|
</script>
|
||||||
@ -151,7 +151,10 @@
|
|||||||
<Link
|
<Link
|
||||||
v-else-if="field.fieldtype === 'User'"
|
v-else-if="field.fieldtype === 'User'"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
:value="getUser(data[field.fieldname]).full_name"
|
:value="
|
||||||
|
data[field.fieldname] &&
|
||||||
|
getUser(data[field.fieldname]).full_name
|
||||||
|
"
|
||||||
:doctype="field.options"
|
:doctype="field.options"
|
||||||
:filters="field.filters"
|
:filters="field.filters"
|
||||||
@change="(v) => (data[field.fieldname] = v)"
|
@change="(v) => (data[field.fieldname] = v)"
|
||||||
@ -160,6 +163,7 @@
|
|||||||
>
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<UserAvatar
|
<UserAvatar
|
||||||
|
v-if="data[field.fieldname]"
|
||||||
class="mr-2"
|
class="mr-2"
|
||||||
:user="data[field.fieldname]"
|
:user="data[field.fieldname]"
|
||||||
size="sm"
|
size="sm"
|
||||||
|
|||||||
@ -133,10 +133,6 @@ const addValue = (value) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateAssignees() {
|
function updateAssignees() {
|
||||||
if (assignees.value.length === 0) {
|
|
||||||
error.value = 'Please select at least one assignee'
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const removedAssignees = oldAssignees.value
|
const removedAssignees = oldAssignees.value
|
||||||
.filter(
|
.filter(
|
||||||
(assignee) => !assignees.value.find((a) => a.name === assignee.name),
|
(assignee) => !assignees.value.find((a) => a.name === assignee.name),
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
field.mandatory_via_depends_on)
|
field.mandatory_via_depends_on)
|
||||||
"
|
"
|
||||||
class="text-ink-red-3"
|
class="text-ink-red-3"
|
||||||
>*</span
|
> *</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@ -9,12 +9,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<CustomActions v-if="customActions" :actions="customActions" />
|
<CustomActions v-if="customActions" :actions="customActions" />
|
||||||
<component :is="deal.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
<AssignTo
|
||||||
<MultipleAvatar
|
v-model="deal.data._assignedTo"
|
||||||
:avatars="deal.data._assignedTo"
|
:data="deal.data"
|
||||||
@click="showAssignmentModal = true"
|
doctype="CRM Deal"
|
||||||
/>
|
/>
|
||||||
</component>
|
|
||||||
<Dropdown :options="statusOptions('deal', updateField, customStatuses)">
|
<Dropdown :options="statusOptions('deal', updateField, customStatuses)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button
|
<Button
|
||||||
@ -237,13 +236,6 @@
|
|||||||
afterInsert: (doc) => addContact(doc.name),
|
afterInsert: (doc) => addContact(doc.name),
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<AssignmentModal
|
|
||||||
v-if="showAssignmentModal"
|
|
||||||
v-model="showAssignmentModal"
|
|
||||||
v-model:assignees="deal.data._assignedTo"
|
|
||||||
:doc="deal.data"
|
|
||||||
doctype="CRM Deal"
|
|
||||||
/>
|
|
||||||
<FilesUploader
|
<FilesUploader
|
||||||
v-if="deal.data?.name"
|
v-if="deal.data?.name"
|
||||||
v-model="showFilesUploader"
|
v-model="showFilesUploader"
|
||||||
@ -278,9 +270,8 @@ import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
|
|||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import Activities from '@/components/Activities/Activities.vue'
|
import Activities from '@/components/Activities/Activities.vue'
|
||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
import AssignTo from '@/components/AssignTo.vue'
|
||||||
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
|
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
|
||||||
import ContactModal from '@/components/Modals/ContactModal.vue'
|
import ContactModal from '@/components/Modals/ContactModal.vue'
|
||||||
import Section from '@/components/Section.vue'
|
import Section from '@/components/Section.vue'
|
||||||
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
import SidePanelLayout from '@/components/SidePanelLayout.vue'
|
||||||
@ -390,7 +381,6 @@ onBeforeUnmount(() => {
|
|||||||
|
|
||||||
const reload = ref(false)
|
const reload = ref(false)
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const showAssignmentModal = ref(false)
|
|
||||||
const showFilesUploader = ref(false)
|
const showFilesUploader = ref(false)
|
||||||
const _organization = ref({})
|
const _organization = ref({})
|
||||||
|
|
||||||
|
|||||||
@ -9,12 +9,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<template #right-header>
|
<template #right-header>
|
||||||
<CustomActions v-if="customActions" :actions="customActions" />
|
<CustomActions v-if="customActions" :actions="customActions" />
|
||||||
<component :is="lead.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
<AssignTo
|
||||||
<MultipleAvatar
|
v-model="lead.data._assignedTo"
|
||||||
:avatars="lead.data._assignedTo"
|
:data="lead.data"
|
||||||
@click="showAssignmentModal = true"
|
doctype="CRM Lead"
|
||||||
/>
|
/>
|
||||||
</component>
|
|
||||||
<Dropdown :options="statusOptions('lead', updateField, customStatuses)">
|
<Dropdown :options="statusOptions('lead', updateField, customStatuses)">
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button
|
<Button
|
||||||
@ -180,13 +179,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</Resizer>
|
</Resizer>
|
||||||
</div>
|
</div>
|
||||||
<AssignmentModal
|
|
||||||
v-if="showAssignmentModal"
|
|
||||||
v-model="showAssignmentModal"
|
|
||||||
v-model:assignees="lead.data._assignedTo"
|
|
||||||
:doc="lead.data"
|
|
||||||
doctype="CRM Lead"
|
|
||||||
/>
|
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model="showConvertToDealModal"
|
v-model="showConvertToDealModal"
|
||||||
:options="{
|
:options="{
|
||||||
@ -286,9 +278,8 @@ import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
|||||||
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
|
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
|
||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import Activities from '@/components/Activities/Activities.vue'
|
import Activities from '@/components/Activities/Activities.vue'
|
||||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
import AssignTo from '@/components/AssignTo.vue'
|
||||||
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
|
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
|
||||||
import Link from '@/components/Controls/Link.vue'
|
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'
|
||||||
@ -373,7 +364,6 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const reload = ref(false)
|
const reload = ref(false)
|
||||||
const showAssignmentModal = ref(false)
|
|
||||||
const showFilesUploader = ref(false)
|
const showFilesUploader = ref(false)
|
||||||
|
|
||||||
function updateLead(fieldname, value, callback) {
|
function updateLead(fieldname, value, callback) {
|
||||||
|
|||||||
@ -34,12 +34,11 @@
|
|||||||
v-if="deal.data"
|
v-if="deal.data"
|
||||||
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"
|
||||||
>
|
>
|
||||||
<component :is="deal.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
<AssignTo
|
||||||
<MultipleAvatar
|
v-model="deal.data._assignedTo"
|
||||||
:avatars="deal.data._assignedTo"
|
:data="deal.data"
|
||||||
@click="showAssignmentModal = true"
|
doctype="CRM Deal"
|
||||||
/>
|
/>
|
||||||
</component>
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<CustomActions v-if="customActions" :actions="customActions" />
|
<CustomActions v-if="customActions" :actions="customActions" />
|
||||||
</div>
|
</div>
|
||||||
@ -59,155 +58,115 @@
|
|||||||
@updateField="updateField"
|
@updateField="updateField"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="fieldsLayout.data"
|
v-if="sections.data"
|
||||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col overflow-y-auto">
|
<SidePanelLayout
|
||||||
|
v-model="deal.data"
|
||||||
|
:sections="sections.data"
|
||||||
|
doctype="CRM Deal"
|
||||||
|
v-slot="{ section }"
|
||||||
|
@update="updateField"
|
||||||
|
@reload="sections.reload"
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
v-for="(section, i) in fieldsLayout.data"
|
v-if="section.name == 'contacts_section'"
|
||||||
:key="section.name"
|
class="contacts-area"
|
||||||
class="flex flex-col px-2 py-3 sm:p-3"
|
|
||||||
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
|
|
||||||
>
|
>
|
||||||
<Section :label="section.label" :opened="section.opened">
|
<div
|
||||||
<template #actions>
|
v-if="dealContacts?.loading && dealContacts?.data?.length == 0"
|
||||||
<div v-if="section.contacts" class="pr-2">
|
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4"
|
||||||
<Link
|
>
|
||||||
value=""
|
<LoadingIndicator class="h-4 w-4" />
|
||||||
doctype="Contact"
|
<span>{{ __('Loading...') }}</span>
|
||||||
@change="(e) => addContact(e)"
|
</div>
|
||||||
:onCreate="
|
<div
|
||||||
(value, close) => {
|
v-else-if="section.contacts.length"
|
||||||
_contact = {
|
v-for="(contact, i) in section.contacts"
|
||||||
first_name: value,
|
:key="contact.name"
|
||||||
company_name: deal.data.organization,
|
>
|
||||||
}
|
<div class="px-2 pb-2.5" :class="[i == 0 ? 'pt-5' : 'pt-2.5']">
|
||||||
showContactModal = true
|
<Section :opened="contact.opened">
|
||||||
close()
|
<template #header="{ opened, toggle }">
|
||||||
}
|
<div
|
||||||
"
|
class="flex cursor-pointer items-center justify-between gap-2 pr-1 text-base leading-5 text-ink-gray-7"
|
||||||
>
|
>
|
||||||
<template #target="{ togglePopover }">
|
|
||||||
<Button
|
|
||||||
class="h-7 px-3"
|
|
||||||
variant="ghost"
|
|
||||||
icon="plus"
|
|
||||||
@click="togglePopover()"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<SidePanelLayout
|
|
||||||
v-if="section.columns?.[0].fields"
|
|
||||||
:fields="section.columns[0].fields"
|
|
||||||
:isLastSection="i == fieldsLayout.data.length - 1"
|
|
||||||
doctype="CRM Deal"
|
|
||||||
v-model="deal.data"
|
|
||||||
@update="updateField"
|
|
||||||
/>
|
|
||||||
<div v-else>
|
|
||||||
<div
|
|
||||||
v-if="
|
|
||||||
dealContacts?.loading && dealContacts?.data?.length == 0
|
|
||||||
"
|
|
||||||
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-ink-gray-4"
|
|
||||||
>
|
|
||||||
<LoadingIndicator class="h-4 w-4" />
|
|
||||||
<span>{{ __('Loading...') }}</span>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-else-if="section.contacts.length"
|
|
||||||
v-for="(contact, i) in section.contacts"
|
|
||||||
:key="contact.name"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="px-2 pb-2.5"
|
|
||||||
:class="[i == 0 ? 'pt-5' : 'pt-2.5']"
|
|
||||||
>
|
|
||||||
<Section :opened="contact.opened">
|
|
||||||
<template #header="{ opened, toggle }">
|
|
||||||
<div
|
|
||||||
class="flex cursor-pointer items-center justify-between gap-2 pr-1 text-base leading-5 text-ink-gray-7"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="flex h-7 items-center gap-2 truncate"
|
|
||||||
@click="toggle()"
|
|
||||||
>
|
|
||||||
<Avatar
|
|
||||||
:label="contact.full_name"
|
|
||||||
:image="contact.image"
|
|
||||||
size="md"
|
|
||||||
/>
|
|
||||||
<div class="truncate">
|
|
||||||
{{ contact.full_name }}
|
|
||||||
</div>
|
|
||||||
<Badge
|
|
||||||
v-if="contact.is_primary"
|
|
||||||
class="ml-2"
|
|
||||||
variant="outline"
|
|
||||||
:label="__('Primary')"
|
|
||||||
theme="green"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center">
|
|
||||||
<Dropdown :options="contactOptions(contact.name)">
|
|
||||||
<Button
|
|
||||||
icon="more-horizontal"
|
|
||||||
class="text-ink-gray-5"
|
|
||||||
variant="ghost"
|
|
||||||
/>
|
|
||||||
</Dropdown>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
@click="
|
|
||||||
router.push({
|
|
||||||
name: 'Contact',
|
|
||||||
params: { contactId: contact.name },
|
|
||||||
})
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<ArrowUpRightIcon class="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
<Button variant="ghost" @click="toggle()">
|
|
||||||
<FeatherIcon
|
|
||||||
name="chevron-right"
|
|
||||||
class="h-4 w-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
|
|
||||||
:class="{ 'rotate-90': opened }"
|
|
||||||
/>
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div
|
<div
|
||||||
class="flex flex-col gap-1.5 text-base text-ink-gray-8"
|
class="flex h-7 items-center gap-2 truncate"
|
||||||
|
@click="toggle()"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-3 pb-1.5 pl-1 pt-4">
|
<Avatar
|
||||||
<Email2Icon class="h-4 w-4" />
|
:label="contact.full_name"
|
||||||
{{ contact.email }}
|
:image="contact.image"
|
||||||
</div>
|
size="md"
|
||||||
<div class="flex items-center gap-3 p-1 py-1.5">
|
/>
|
||||||
<PhoneIcon class="h-4 w-4" />
|
<div class="truncate">
|
||||||
{{ contact.mobile_no }}
|
{{ contact.full_name }}
|
||||||
</div>
|
</div>
|
||||||
|
<Badge
|
||||||
|
v-if="contact.is_primary"
|
||||||
|
class="ml-2"
|
||||||
|
variant="outline"
|
||||||
|
:label="__('Primary')"
|
||||||
|
theme="green"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
<div class="flex items-center">
|
||||||
</div>
|
<Dropdown :options="contactOptions(contact.name)">
|
||||||
|
<Button
|
||||||
|
icon="more-horizontal"
|
||||||
|
class="text-ink-gray-5"
|
||||||
|
variant="ghost"
|
||||||
|
/>
|
||||||
|
</Dropdown>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
@click="
|
||||||
|
router.push({
|
||||||
|
name: 'Contact',
|
||||||
|
params: { contactId: contact.name },
|
||||||
|
})
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<ArrowUpRightIcon class="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
<Button variant="ghost" @click="toggle()">
|
||||||
|
<FeatherIcon
|
||||||
|
name="chevron-right"
|
||||||
|
class="h-4 w-4 text-ink-gray-9 transition-all duration-300 ease-in-out"
|
||||||
|
:class="{ 'rotate-90': opened }"
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<div
|
<div
|
||||||
v-if="i != section.contacts.length - 1"
|
class="flex flex-col gap-1.5 text-base text-ink-gray-8"
|
||||||
class="mx-2 h-px border-t border-outline-gray-modals"
|
>
|
||||||
/>
|
<div class="flex items-center gap-3 pb-1.5 pl-1 pt-4">
|
||||||
</div>
|
<Email2Icon class="h-4 w-4" />
|
||||||
<div
|
{{ contact.email }}
|
||||||
v-else
|
</div>
|
||||||
class="flex h-20 items-center justify-center text-base text-ink-gray-5"
|
<div class="flex items-center gap-3 p-1 py-1.5">
|
||||||
>
|
<PhoneIcon class="h-4 w-4" />
|
||||||
{{ __('No contacts added') }}
|
{{ contact.mobile_no }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
<div
|
||||||
|
v-if="i != section.contacts.length - 1"
|
||||||
|
class="mx-2 h-px border-t border-outline-gray-modals"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-else
|
||||||
|
class="flex h-20 items-center justify-center text-base text-ink-gray-5"
|
||||||
|
>
|
||||||
|
{{ __('No contacts added') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</SidePanelLayout>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Activities
|
<Activities
|
||||||
@ -236,13 +195,6 @@
|
|||||||
afterInsert: (doc) => addContact(doc.name),
|
afterInsert: (doc) => addContact(doc.name),
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<AssignmentModal
|
|
||||||
v-if="showAssignmentModal"
|
|
||||||
v-model="showAssignmentModal"
|
|
||||||
v-model:assignees="deal.data._assignedTo"
|
|
||||||
:doc="deal.data"
|
|
||||||
doctype="CRM Deal"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import Icon from '@/components/Icon.vue'
|
import Icon from '@/components/Icon.vue'
|
||||||
@ -263,10 +215,8 @@ import SuccessIcon from '@/components/Icons/SuccessIcon.vue'
|
|||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import Activities from '@/components/Activities/Activities.vue'
|
import Activities from '@/components/Activities/Activities.vue'
|
||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
import AssignTo from '@/components/AssignTo.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
|
||||||
import ContactModal from '@/components/Modals/ContactModal.vue'
|
import ContactModal from '@/components/Modals/ContactModal.vue'
|
||||||
import Link from '@/components/Controls/Link.vue'
|
|
||||||
import Section from '@/components/Section.vue'
|
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'
|
||||||
@ -333,7 +283,7 @@ const deal = createResource({
|
|||||||
resource: {
|
resource: {
|
||||||
deal,
|
deal,
|
||||||
dealContacts,
|
dealContacts,
|
||||||
fieldsLayout,
|
sections,
|
||||||
},
|
},
|
||||||
call,
|
call,
|
||||||
}
|
}
|
||||||
@ -356,7 +306,6 @@ onMounted(() => {
|
|||||||
|
|
||||||
const reload = ref(false)
|
const reload = ref(false)
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const showAssignmentModal = ref(false)
|
|
||||||
const _organization = ref({})
|
const _organization = ref({})
|
||||||
|
|
||||||
function updateDeal(fieldname, value, callback) {
|
function updateDeal(fieldname, value, callback) {
|
||||||
@ -500,7 +449,7 @@ const tabs = computed(() => {
|
|||||||
})
|
})
|
||||||
const { tabIndex } = useActiveTabManager(tabs, 'lastDealTab')
|
const { tabIndex } = useActiveTabManager(tabs, 'lastDealTab')
|
||||||
|
|
||||||
const fieldsLayout = createResource({
|
const sections = createResource({
|
||||||
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
||||||
cache: ['sidePanelSections', 'CRM Deal'],
|
cache: ['sidePanelSections', 'CRM Deal'],
|
||||||
params: { doctype: 'CRM Deal' },
|
params: { doctype: 'CRM Deal' },
|
||||||
@ -603,7 +552,7 @@ const dealContacts = createResource({
|
|||||||
cache: ['deal_contacts', props.dealId],
|
cache: ['deal_contacts', props.dealId],
|
||||||
auto: true,
|
auto: true,
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
let contactSection = fieldsLayout.data?.find(
|
let contactSection = sections.data?.find(
|
||||||
(section) => section.name == 'contacts_section',
|
(section) => section.name == 'contacts_section',
|
||||||
)
|
)
|
||||||
if (!contactSection) return
|
if (!contactSection) return
|
||||||
|
|||||||
@ -34,12 +34,11 @@
|
|||||||
v-if="lead.data"
|
v-if="lead.data"
|
||||||
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"
|
||||||
>
|
>
|
||||||
<component :is="lead.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
<AssignTo
|
||||||
<MultipleAvatar
|
v-model="lead.data._assignedTo"
|
||||||
:avatars="lead.data._assignedTo"
|
:data="lead.data"
|
||||||
@click="showAssignmentModal = true"
|
doctype="CRM Lead"
|
||||||
/>
|
/>
|
||||||
</component>
|
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<CustomActions v-if="customActions" :actions="customActions" />
|
<CustomActions v-if="customActions" :actions="customActions" />
|
||||||
<Button
|
<Button
|
||||||
@ -64,26 +63,16 @@
|
|||||||
@updateField="updateField"
|
@updateField="updateField"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="fieldsLayout.data"
|
v-if="sections.data"
|
||||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||||
>
|
>
|
||||||
<div class="flex flex-col overflow-y-auto">
|
<SidePanelLayout
|
||||||
<div
|
v-model="lead.data"
|
||||||
v-for="(section, i) in fieldsLayout.data"
|
:sections="sections.data"
|
||||||
:key="section.name"
|
doctype="CRM Lead"
|
||||||
class="flex flex-col px-2 py-3 sm:p-3"
|
@update="updateField"
|
||||||
:class="{ 'border-b': i !== fieldsLayout.data.length - 1 }"
|
@reload="sections.reload"
|
||||||
>
|
/>
|
||||||
<Section :label="section.label" :opened="section.opened">
|
|
||||||
<SidePanelLayout
|
|
||||||
:fields="section.columns[0].fields"
|
|
||||||
:isLastSection="i == fieldsLayout.data.length - 1"
|
|
||||||
v-model="lead.data"
|
|
||||||
@update="updateField"
|
|
||||||
/>
|
|
||||||
</Section>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Activities
|
<Activities
|
||||||
@ -96,13 +85,6 @@
|
|||||||
/>
|
/>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
<AssignmentModal
|
|
||||||
v-if="showAssignmentModal"
|
|
||||||
v-model="showAssignmentModal"
|
|
||||||
v-model:assignees="lead.data._assignedTo"
|
|
||||||
:doc="lead.data"
|
|
||||||
doctype="CRM Lead"
|
|
||||||
/>
|
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model="showConvertToDealModal"
|
v-model="showConvertToDealModal"
|
||||||
:options="{
|
:options="{
|
||||||
@ -186,10 +168,8 @@ import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
|
|||||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import Activities from '@/components/Activities/Activities.vue'
|
import Activities from '@/components/Activities/Activities.vue'
|
||||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
import AssignTo from '@/components/AssignTo.vue'
|
||||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
|
||||||
import Link from '@/components/Controls/Link.vue'
|
import Link from '@/components/Controls/Link.vue'
|
||||||
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'
|
||||||
@ -249,7 +229,7 @@ const lead = createResource({
|
|||||||
deleteDoc: deleteLead,
|
deleteDoc: deleteLead,
|
||||||
resource: {
|
resource: {
|
||||||
lead,
|
lead,
|
||||||
fieldsLayout,
|
sections,
|
||||||
},
|
},
|
||||||
call,
|
call,
|
||||||
}
|
}
|
||||||
@ -266,7 +246,6 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const reload = ref(false)
|
const reload = ref(false)
|
||||||
const showAssignmentModal = ref(false)
|
|
||||||
|
|
||||||
function updateLead(fieldname, value, callback) {
|
function updateLead(fieldname, value, callback) {
|
||||||
value = Array.isArray(fieldname) ? '' : value
|
value = Array.isArray(fieldname) ? '' : value
|
||||||
@ -420,7 +399,7 @@ watch(tabs, (value) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const fieldsLayout = createResource({
|
const sections = createResource({
|
||||||
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
||||||
cache: ['sidePanelSections', 'CRM Lead'],
|
cache: ['sidePanelSections', 'CRM Lead'],
|
||||||
params: { doctype: 'CRM Lead' },
|
params: { doctype: 'CRM Lead' },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user