fix: added form control in details section
This commit is contained in:
parent
a0e3237de6
commit
ffb0ae7a79
@ -61,7 +61,7 @@
|
|||||||
<TabPanel class="flex-1" v-for="tab in tabs" :key="tab.label">
|
<TabPanel class="flex-1" v-for="tab in tabs" :key="tab.label">
|
||||||
<Activities :activities="tab.content" />
|
<Activities :activities="tab.content" />
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
<div class="flex flex-col gap-6.5 border-l px-6 py-3 w-[390px]">
|
<div class="flex flex-col gap-6.5 border-l p-3 w-[390px]">
|
||||||
<div
|
<div
|
||||||
v-for="section in detailSections"
|
v-for="section in detailSections"
|
||||||
:key="section.label"
|
:key="section.label"
|
||||||
@ -69,7 +69,7 @@
|
|||||||
>
|
>
|
||||||
<Toggler :is-opened="section.opened" v-slot="{ opened, toggle }">
|
<Toggler :is-opened="section.opened" v-slot="{ opened, toggle }">
|
||||||
<div
|
<div
|
||||||
class="flex items-center gap-1 text-base font-semibold leading-5 cursor-pointer"
|
class="flex items-center gap-1 text-base font-semibold leading-5 px-3 cursor-pointer"
|
||||||
@click="toggle()"
|
@click="toggle()"
|
||||||
>
|
>
|
||||||
{{ section.label }}
|
{{ section.label }}
|
||||||
@ -90,10 +90,55 @@
|
|||||||
<div
|
<div
|
||||||
v-for="field in section.fields"
|
v-for="field in section.fields"
|
||||||
:key="field.label"
|
:key="field.label"
|
||||||
class="flex items-center gap-2 text-base leading-5 first:mt-4.5"
|
class="flex items-center px-3 gap-2 text-base leading-5 first:mt-4.5"
|
||||||
>
|
>
|
||||||
<div class="text-gray-600 w-[106px]">{{ field.label }}</div>
|
<div class="text-gray-600 w-[106px]">{{ field.label }}</div>
|
||||||
<div class="text-gray-900">{{ field.value }}</div>
|
<div class="flex-1">
|
||||||
|
<FormControl
|
||||||
|
v-if="field.type === 'select'"
|
||||||
|
type="select"
|
||||||
|
:options="field.options"
|
||||||
|
v-model="lead.doc[field.name]"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<IndicatorIcon
|
||||||
|
:class="indicatorColor[lead.doc[field.name]]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</FormControl>
|
||||||
|
<FormControl
|
||||||
|
v-else-if="field.type === 'data'"
|
||||||
|
type="text"
|
||||||
|
v-model="lead.doc[field.name]"
|
||||||
|
/>
|
||||||
|
<FormControl
|
||||||
|
v-else-if="field.type === 'email'"
|
||||||
|
type="email"
|
||||||
|
v-model="lead.doc[field.name]"
|
||||||
|
/>
|
||||||
|
<Autocomplete
|
||||||
|
v-else-if="field.type === 'link'"
|
||||||
|
:options="activeAgents"
|
||||||
|
:value="getUser(lead.doc[field.name]).full_name"
|
||||||
|
@change="
|
||||||
|
(option) => (lead.doc[field.name] = option.email)
|
||||||
|
"
|
||||||
|
placeholder="Lead owner"
|
||||||
|
class="bg-white"
|
||||||
|
>
|
||||||
|
<template #prefix="{ option }">
|
||||||
|
<Avatar
|
||||||
|
class="mr-2"
|
||||||
|
:image="getUser(option.email).user_image"
|
||||||
|
:label="getUser(option.email).full_name"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</Autocomplete>
|
||||||
|
<div v-else class="text-gray-900">
|
||||||
|
{{ lead.doc[field.name] }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
@ -118,6 +163,8 @@ import {
|
|||||||
createDocumentResource,
|
createDocumentResource,
|
||||||
Avatar,
|
Avatar,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
|
Autocomplete,
|
||||||
|
FormControl,
|
||||||
Dropdown,
|
Dropdown,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { TransitionPresets, useTransition } from '@vueuse/core'
|
import { TransitionPresets, useTransition } from '@vueuse/core'
|
||||||
@ -125,7 +172,7 @@ import { usersStore } from '@/stores/users'
|
|||||||
import { ref, computed, h } from 'vue'
|
import { ref, computed, h } from 'vue'
|
||||||
import Breadcrumbs from '@/components/Breadcrumbs.vue'
|
import Breadcrumbs from '@/components/Breadcrumbs.vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser, users } = usersStore()
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
leadId: {
|
leadId: {
|
||||||
@ -271,19 +318,30 @@ const detailSections = computed(() => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: 'Status',
|
label: 'Status',
|
||||||
value: lead.doc.status,
|
type: 'select',
|
||||||
|
name: 'status',
|
||||||
|
options: [
|
||||||
|
{ label: 'New', value: 'New' },
|
||||||
|
{ label: 'Contact made', value: 'Contact made' },
|
||||||
|
{ label: 'Proposal made', value: 'Proposal made' },
|
||||||
|
{ label: 'Negotiation', value: 'Negotiation' },
|
||||||
|
{ label: 'Converted', value: 'Converted' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Lead Owner',
|
label: 'Lead Owner',
|
||||||
value: getUser(lead.doc.lead_owner).full_name,
|
type: 'link',
|
||||||
|
name: 'full_name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Organization',
|
label: 'Organization',
|
||||||
value: lead.doc.organization_name,
|
type: 'data',
|
||||||
|
name: 'organization_name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Website',
|
label: 'Website',
|
||||||
value: lead.doc.organization_website,
|
type: 'data',
|
||||||
|
name: 'organization_website',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -293,18 +351,35 @@ const detailSections = computed(() => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
value: lead.doc.lead_name,
|
type: 'data',
|
||||||
|
name: 'lead_name',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Email',
|
label: 'Email',
|
||||||
value: lead.doc.email,
|
type: 'email',
|
||||||
|
name: 'email',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Mobile No.',
|
label: 'Mobile No.',
|
||||||
value: lead.doc.mobile_no,
|
type: 'phone',
|
||||||
|
name: 'mobile_no',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const activeAgents = computed(() => {
|
||||||
|
const nonAgents = ['Administrator', 'Guest']
|
||||||
|
return users.data
|
||||||
|
.filter((user) => !nonAgents.includes(user.name))
|
||||||
|
.sort((a, b) => a.full_name - b.full_name)
|
||||||
|
.map((user) => {
|
||||||
|
return {
|
||||||
|
label: user.full_name,
|
||||||
|
value: user.email,
|
||||||
|
...user,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user