fix: set default status in newlead/deal dialog
This commit is contained in:
parent
71bc3d9fb2
commit
dd93342601
@ -8,7 +8,7 @@
|
|||||||
v-if="field.type === 'select'"
|
v-if="field.type === 'select'"
|
||||||
type="select"
|
type="select"
|
||||||
:options="field.options"
|
:options="field.options"
|
||||||
v-model="field.value"
|
v-model="newDeal[field.name]"
|
||||||
>
|
>
|
||||||
<template v-if="field.prefix" #prefix>
|
<template v-if="field.prefix" #prefix>
|
||||||
<IndicatorIcon :class="field.prefix" />
|
<IndicatorIcon :class="field.prefix" />
|
||||||
@ -71,7 +71,7 @@ import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
|||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { FormControl, Tooltip } from 'frappe-ui'
|
import { FormControl, Tooltip } from 'frappe-ui'
|
||||||
import { ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getDealStatus, statusOptions } = statusesStore()
|
const { getDealStatus, statusOptions } = statusesStore()
|
||||||
@ -86,73 +86,83 @@ const props = defineProps({
|
|||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const _organization = ref({})
|
const _organization = ref({})
|
||||||
|
|
||||||
const allFields = [
|
const allFields = computed(() => {
|
||||||
{
|
return [
|
||||||
section: 'Deal Details',
|
{
|
||||||
fields: [
|
section: 'Deal Details',
|
||||||
{
|
fields: [
|
||||||
label: 'Salutation',
|
{
|
||||||
name: 'salutation',
|
label: 'Salutation',
|
||||||
type: 'link',
|
name: 'salutation',
|
||||||
doctype: 'Salutation',
|
type: 'link',
|
||||||
placeholder: 'Salutation',
|
doctype: 'Salutation',
|
||||||
change: (data) => (props.newDeal.salutation = data),
|
placeholder: 'Salutation',
|
||||||
},
|
change: (data) => (props.newDeal.salutation = data),
|
||||||
{
|
|
||||||
label: 'First Name',
|
|
||||||
name: 'first_name',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Last Name',
|
|
||||||
name: 'last_name',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Email',
|
|
||||||
name: 'email',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Mobile No',
|
|
||||||
name: 'mobile_no',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
section: 'Other Details',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Organization',
|
|
||||||
name: 'organization',
|
|
||||||
type: 'link',
|
|
||||||
placeholder: 'Organization',
|
|
||||||
doctype: 'CRM Organization',
|
|
||||||
change: (data) => (props.newDeal.organization = data),
|
|
||||||
create: (value, close) => {
|
|
||||||
_organization.value.organization_name = value
|
|
||||||
showOrganizationModal.value = true
|
|
||||||
close()
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
label: 'First Name',
|
||||||
label: 'Status',
|
name: 'first_name',
|
||||||
name: 'status',
|
type: 'data',
|
||||||
type: 'select',
|
},
|
||||||
options: statusOptions('deal'),
|
{
|
||||||
value: props.newDeal.status || getDealStatus(props.newDeal.status).name,
|
label: 'Last Name',
|
||||||
prefix: getDealStatus(props.newDeal.status).iconColorClass,
|
name: 'last_name',
|
||||||
},
|
type: 'data',
|
||||||
{
|
},
|
||||||
label: 'Deal Owner',
|
{
|
||||||
name: 'deal_owner',
|
label: 'Email',
|
||||||
type: 'user',
|
name: 'email',
|
||||||
placeholder: 'Deal Owner',
|
type: 'data',
|
||||||
doctype: 'User',
|
},
|
||||||
change: (data) => (props.newDeal.deal_owner = data),
|
{
|
||||||
},
|
label: 'Mobile No',
|
||||||
],
|
name: 'mobile_no',
|
||||||
},
|
type: 'data',
|
||||||
]
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
section: 'Other Details',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
name: 'organization',
|
||||||
|
type: 'link',
|
||||||
|
placeholder: 'Organization',
|
||||||
|
doctype: 'CRM Organization',
|
||||||
|
change: (data) => (props.newDeal.organization = data),
|
||||||
|
create: (value, close) => {
|
||||||
|
_organization.value.organization_name = value
|
||||||
|
showOrganizationModal.value = true
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Status',
|
||||||
|
name: 'status',
|
||||||
|
type: 'select',
|
||||||
|
options: statusOptions(
|
||||||
|
'deal',
|
||||||
|
(field, value) => (props.newDeal[field] = value)
|
||||||
|
),
|
||||||
|
prefix: getDealStatus(props.newDeal.status).iconColorClass,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Deal Owner',
|
||||||
|
name: 'deal_owner',
|
||||||
|
type: 'user',
|
||||||
|
placeholder: 'Deal Owner',
|
||||||
|
doctype: 'User',
|
||||||
|
change: (data) => (props.newDeal.deal_owner = data),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (!props.newDeal.status) {
|
||||||
|
props.newDeal.status = getDealStatus(props.newDeal.status).name
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
v-if="field.type === 'select'"
|
v-if="field.type === 'select'"
|
||||||
type="select"
|
type="select"
|
||||||
:options="field.options"
|
:options="field.options"
|
||||||
v-model="field.value"
|
v-model="newLead[field.name]"
|
||||||
>
|
>
|
||||||
<template v-if="field.prefix" #prefix>
|
<template v-if="field.prefix" #prefix>
|
||||||
<IndicatorIcon :class="field.prefix" />
|
<IndicatorIcon :class="field.prefix" />
|
||||||
@ -71,7 +71,7 @@ import Link from '@/components/Controls/Link.vue'
|
|||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { FormControl, Tooltip } from 'frappe-ui'
|
import { FormControl, Tooltip } from 'frappe-ui'
|
||||||
import { ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getLeadStatus, statusOptions } = statusesStore()
|
const { getLeadStatus, statusOptions } = statusesStore()
|
||||||
@ -86,73 +86,83 @@ const props = defineProps({
|
|||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
const _organization = ref({})
|
const _organization = ref({})
|
||||||
|
|
||||||
const allFields = [
|
const allFields = computed(() => {
|
||||||
{
|
return [
|
||||||
section: 'Lead Details',
|
{
|
||||||
fields: [
|
section: 'Lead Details',
|
||||||
{
|
fields: [
|
||||||
label: 'Salutation',
|
{
|
||||||
name: 'salutation',
|
label: 'Salutation',
|
||||||
type: 'link',
|
name: 'salutation',
|
||||||
placeholder: 'Salutation',
|
type: 'link',
|
||||||
doctype: 'Salutation',
|
placeholder: 'Salutation',
|
||||||
change: (data) => (props.newLead.salutation = data),
|
doctype: 'Salutation',
|
||||||
},
|
change: (data) => (props.newLead.salutation = data),
|
||||||
{
|
|
||||||
label: 'First Name',
|
|
||||||
name: 'first_name',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Last Name',
|
|
||||||
name: 'last_name',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Email',
|
|
||||||
name: 'email',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Mobile No',
|
|
||||||
name: 'mobile_no',
|
|
||||||
type: 'data',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
section: 'Other Details',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: 'Organization',
|
|
||||||
name: 'organization',
|
|
||||||
type: 'link',
|
|
||||||
placeholder: 'Organization',
|
|
||||||
doctype: 'CRM Organization',
|
|
||||||
change: (data) => (props.newLead.organization = data),
|
|
||||||
create: (value, close) => {
|
|
||||||
_organization.value.organization_name = value
|
|
||||||
showOrganizationModal.value = true
|
|
||||||
close()
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
label: 'First Name',
|
||||||
label: 'Status',
|
name: 'first_name',
|
||||||
name: 'status',
|
type: 'data',
|
||||||
type: 'select',
|
},
|
||||||
options: statusOptions('lead'),
|
{
|
||||||
value: props.newLead.status || getLeadStatus(props.newLead.status).name,
|
label: 'Last Name',
|
||||||
prefix: getLeadStatus(props.newLead.status).iconColorClass,
|
name: 'last_name',
|
||||||
},
|
type: 'data',
|
||||||
{
|
},
|
||||||
label: 'Lead Owner',
|
{
|
||||||
name: 'lead_owner',
|
label: 'Email',
|
||||||
type: 'user',
|
name: 'email',
|
||||||
placeholder: 'Lead Owner',
|
type: 'data',
|
||||||
doctype: 'User',
|
},
|
||||||
change: (data) => (props.newLead.lead_owner = data),
|
{
|
||||||
},
|
label: 'Mobile No',
|
||||||
],
|
name: 'mobile_no',
|
||||||
},
|
type: 'data',
|
||||||
]
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
section: 'Other Details',
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
name: 'organization',
|
||||||
|
type: 'link',
|
||||||
|
placeholder: 'Organization',
|
||||||
|
doctype: 'CRM Organization',
|
||||||
|
change: (data) => (props.newLead.organization = data),
|
||||||
|
create: (value, close) => {
|
||||||
|
_organization.value.organization_name = value
|
||||||
|
showOrganizationModal.value = true
|
||||||
|
close()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Status',
|
||||||
|
name: 'status',
|
||||||
|
type: 'select',
|
||||||
|
options: statusOptions(
|
||||||
|
'lead',
|
||||||
|
(field, value) => (props.newLead[field] = value)
|
||||||
|
),
|
||||||
|
prefix: getLeadStatus(props.newLead.status).iconColorClass,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Lead Owner',
|
||||||
|
name: 'lead_owner',
|
||||||
|
type: 'user',
|
||||||
|
placeholder: 'Lead Owner',
|
||||||
|
doctype: 'User',
|
||||||
|
change: (data) => (props.newLead.lead_owner = data),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
if (!props.newLead.status) {
|
||||||
|
props.newLead.status = getLeadStatus(props.newLead.status).name
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user