fix: Add new organization button in lead organization autocomplete
This commit is contained in:
parent
720977962d
commit
1cb017ac9e
@ -132,15 +132,32 @@
|
|||||||
{{ field.label }}
|
{{ field.label }}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1 overflow-hidden">
|
<div class="flex-1 overflow-hidden">
|
||||||
<FormControl
|
<Autocomplete
|
||||||
v-if="field.type === 'link'"
|
v-if="field.type === 'link'"
|
||||||
type="autocomplete"
|
|
||||||
:value="deal.data[field.name]"
|
:value="deal.data[field.name]"
|
||||||
:options="field.options"
|
:options="field.options"
|
||||||
@change="(e) => field.change(e)"
|
@change="(e) => field.change(e)"
|
||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
/>
|
>
|
||||||
|
<template
|
||||||
|
v-if="field.create"
|
||||||
|
#footer="{ value, close }"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
class="w-full !justify-start"
|
||||||
|
label="Create one"
|
||||||
|
@click="field.create(value, close)"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<FeatherIcon name="plus" class="h-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</Autocomplete>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
v-else-if="field.type === 'dropdown'"
|
v-else-if="field.type === 'dropdown'"
|
||||||
:options="
|
:options="
|
||||||
@ -266,7 +283,9 @@
|
|||||||
v-if="cOpened"
|
v-if="cOpened"
|
||||||
class="flex flex-col gap-1.5 text-base text-gray-800"
|
class="flex flex-col gap-1.5 text-base text-gray-800"
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-3 pl-1 pb-1.5 pt-4">
|
<div
|
||||||
|
class="flex items-center gap-3 pb-1.5 pl-1 pt-4"
|
||||||
|
>
|
||||||
<EmailIcon class="h-4 w-4" />
|
<EmailIcon class="h-4 w-4" />
|
||||||
{{ getContactByName(contact.name).email_id }}
|
{{ getContactByName(contact.name).email_id }}
|
||||||
</div>
|
</div>
|
||||||
@ -292,6 +311,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<OrganizationModal
|
||||||
|
v-model="showOrganizationModal"
|
||||||
|
:organization="_organization"
|
||||||
|
:options="{
|
||||||
|
redirect: false,
|
||||||
|
afterInsert: (doc) => updateField('organization', doc.name),
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
||||||
@ -306,6 +333,8 @@ import LayoutHeader from '@/components/LayoutHeader.vue'
|
|||||||
import Toggler from '@/components/Toggler.vue'
|
import Toggler from '@/components/Toggler.vue'
|
||||||
import Activities from '@/components/Activities.vue'
|
import Activities from '@/components/Activities.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
|
import Autocomplete from '@/components/frappe-ui/Autocomplete.vue'
|
||||||
import {
|
import {
|
||||||
dealStatuses,
|
dealStatuses,
|
||||||
statusDropdownOptions,
|
statusDropdownOptions,
|
||||||
@ -349,6 +378,8 @@ const deal = createResource({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const reload = ref(false)
|
const reload = ref(false)
|
||||||
|
const showOrganizationModal = ref(false)
|
||||||
|
const _organization = ref({})
|
||||||
|
|
||||||
function updateDeal(fieldname, value, callback) {
|
function updateDeal(fieldname, value, callback) {
|
||||||
value = Array.isArray(fieldname) ? '' : value
|
value = Array.isArray(fieldname) ? '' : value
|
||||||
@ -430,6 +461,11 @@ const detailSections = computed(() => {
|
|||||||
placeholder: 'Select organization',
|
placeholder: 'Select organization',
|
||||||
options: getOrganizationOptions(),
|
options: getOrganizationOptions(),
|
||||||
change: (data) => updateField('organization', data.value),
|
change: (data) => updateField('organization', data.value),
|
||||||
|
create: (value, close) => {
|
||||||
|
_organization.value.organization_name = value
|
||||||
|
showOrganizationModal.value = true
|
||||||
|
close()
|
||||||
|
},
|
||||||
link: () => {
|
link: () => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
|
|||||||
@ -18,7 +18,9 @@
|
|||||||
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
<UserAvatar class="mr-2" :user="option.email" size="sm" />
|
||||||
</template>
|
</template>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Dropdown :options="statusDropdownOptions(lead.data, 'lead', updateField)">
|
<Dropdown
|
||||||
|
:options="statusDropdownOptions(lead.data, 'lead', updateField)"
|
||||||
|
>
|
||||||
<template #default="{ open }">
|
<template #default="{ open }">
|
||||||
<Button :label="lead.data.status">
|
<Button :label="lead.data.status">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
@ -50,7 +52,10 @@
|
|||||||
>
|
>
|
||||||
About this lead
|
About this lead
|
||||||
</div>
|
</div>
|
||||||
<FileUploader @success="(file) => updateField('image', file.file_url)" :validateFile="validateFile">
|
<FileUploader
|
||||||
|
@success="(file) => updateField('image', file.file_url)"
|
||||||
|
:validateFile="validateFile"
|
||||||
|
>
|
||||||
<template #default="{ openFileSelector, error }">
|
<template #default="{ openFileSelector, error }">
|
||||||
<div class="flex items-center justify-start gap-5 p-5">
|
<div class="flex items-center justify-start gap-5 p-5">
|
||||||
<div class="group relative h-[88px] w-[88px]">
|
<div class="group relative h-[88px] w-[88px]">
|
||||||
@ -201,7 +206,7 @@
|
|||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
>
|
>
|
||||||
<template #footer="{ value, close }">
|
<template v-if="field.create" #footer="{ value, close }">
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@ -291,7 +296,7 @@
|
|||||||
:organization="_organization"
|
:organization="_organization"
|
||||||
:options="{
|
:options="{
|
||||||
redirect: false,
|
redirect: false,
|
||||||
afterInsert: (doc) => updateField('organiation', doc.name),
|
afterInsert: (doc) => updateField('organization', doc.name),
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user