fix: create organization and set from new lead/deal dialog
This commit is contained in:
parent
10a37c6a54
commit
1caaa89278
@ -19,14 +19,14 @@
|
|||||||
type="email"
|
type="email"
|
||||||
v-model="newDeal[field.name]"
|
v-model="newDeal[field.name]"
|
||||||
/>
|
/>
|
||||||
<FormControl
|
<Link
|
||||||
v-else-if="field.type === 'link'"
|
v-else-if="field.type === 'link'"
|
||||||
type="autocomplete"
|
class="form-control"
|
||||||
:value="newDeal[field.name]"
|
:value="newDeal[field.name]"
|
||||||
:options="field.options"
|
:doctype="field.doctype"
|
||||||
@change="(e) => field.change(e)"
|
@change="(e) => field.change(e)"
|
||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
class="form-control"
|
:onCreate="field.create"
|
||||||
/>
|
/>
|
||||||
<FormControl
|
<FormControl
|
||||||
v-else-if="field.type === 'user'"
|
v-else-if="field.type === 'user'"
|
||||||
@ -73,18 +73,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<OrganizationModal
|
||||||
|
v-model="showOrganizationModal"
|
||||||
|
:organization="_organization"
|
||||||
|
:options="{
|
||||||
|
redirect: false,
|
||||||
|
afterInsert: (doc) => (newLead.organization = doc.name),
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
|
||||||
import { dealStatuses, statusDropdownOptions, activeAgents } from '@/utils'
|
import { dealStatuses, statusDropdownOptions, activeAgents } from '@/utils'
|
||||||
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getOrganizationOptions } = organizationsStore()
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
newDeal: {
|
newDeal: {
|
||||||
@ -93,6 +102,9 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const showOrganizationModal = ref(false)
|
||||||
|
const _organization = ref({})
|
||||||
|
|
||||||
const allFields = [
|
const allFields = [
|
||||||
{
|
{
|
||||||
section: 'Deal Details',
|
section: 'Deal Details',
|
||||||
@ -146,9 +158,12 @@ const allFields = [
|
|||||||
name: 'organization',
|
name: 'organization',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
placeholder: 'Organization',
|
placeholder: 'Organization',
|
||||||
options: getOrganizationOptions(),
|
doctype: 'CRM Organization',
|
||||||
change: (option) => {
|
change: (data) => (newDeal.organization = data),
|
||||||
newDeal.organization = option.name
|
create: (value, close) => {
|
||||||
|
_organization.value.organization_name = value
|
||||||
|
showOrganizationModal.value = true
|
||||||
|
close()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,14 +19,14 @@
|
|||||||
type="email"
|
type="email"
|
||||||
v-model="newLead[field.name]"
|
v-model="newLead[field.name]"
|
||||||
/>
|
/>
|
||||||
<FormControl
|
<Link
|
||||||
v-else-if="field.type === 'link'"
|
v-else-if="field.type === 'link'"
|
||||||
type="autocomplete"
|
class="form-control"
|
||||||
:value="newLead[field.name]"
|
:value="newLead[field.name]"
|
||||||
:options="field.options"
|
:doctype="field.doctype"
|
||||||
@change="(e) => field.change(e)"
|
@change="(e) => field.change(e)"
|
||||||
:placeholder="field.placeholder"
|
:placeholder="field.placeholder"
|
||||||
class="form-control"
|
:onCreate="field.create"
|
||||||
/>
|
/>
|
||||||
<FormControl
|
<FormControl
|
||||||
v-else-if="field.type === 'user'"
|
v-else-if="field.type === 'user'"
|
||||||
@ -73,18 +73,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<OrganizationModal
|
||||||
|
v-model="showOrganizationModal"
|
||||||
|
:organization="_organization"
|
||||||
|
:options="{
|
||||||
|
redirect: false,
|
||||||
|
afterInsert: (doc) => (newLead.organization = doc.name),
|
||||||
|
}"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
import UserAvatar from '@/components/UserAvatar.vue'
|
import UserAvatar from '@/components/UserAvatar.vue'
|
||||||
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
|
import Link from '@/components/Controls/Link.vue'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { organizationsStore } from '@/stores/organizations'
|
|
||||||
import { leadStatuses, statusDropdownOptions, activeAgents } from '@/utils'
|
import { leadStatuses, statusDropdownOptions, activeAgents } from '@/utils'
|
||||||
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
import { FormControl, Button, Dropdown, FeatherIcon } from 'frappe-ui'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { getOrganizationOptions } = organizationsStore()
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
newLead: {
|
newLead: {
|
||||||
@ -93,6 +102,9 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const showOrganizationModal = ref(false)
|
||||||
|
const _organization = ref({})
|
||||||
|
|
||||||
const allFields = [
|
const allFields = [
|
||||||
{
|
{
|
||||||
section: 'Lead Details',
|
section: 'Lead Details',
|
||||||
@ -146,9 +158,12 @@ const allFields = [
|
|||||||
name: 'organization',
|
name: 'organization',
|
||||||
type: 'link',
|
type: 'link',
|
||||||
placeholder: 'Organization',
|
placeholder: 'Organization',
|
||||||
options: getOrganizationOptions(),
|
doctype: 'CRM Organization',
|
||||||
change: (option) => {
|
change: (data) => (props.newLead.organization = data),
|
||||||
props.newLead.organization = option.value
|
create: (value, close) => {
|
||||||
|
_organization.value.organization_name = value
|
||||||
|
showOrganizationModal.value = true
|
||||||
|
close()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user