fix: pass doctype as a prop

This commit is contained in:
Shariq Ansari 2024-05-20 21:17:42 +05:30
parent fd3fc4448e
commit 657a2e76d0
3 changed files with 10 additions and 3 deletions

View File

@ -27,6 +27,7 @@
value="" value=""
doctype="User" doctype="User"
@change="(option) => addValue(option) && ($refs.input.value = '')" @change="(option) => addValue(option) && ($refs.input.value = '')"
:placeholder="__('John Doe')"
:hideMe="true" :hideMe="true"
> >
<template #item-prefix="{ option }"> <template #item-prefix="{ option }">
@ -83,6 +84,10 @@ const props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
doctype: {
type: String,
default: '',
},
}) })
const show = defineModel() const show = defineModel()
@ -101,7 +106,7 @@ const removeValue = (value) => {
const owner = computed(() => { const owner = computed(() => {
if (!props.doc) return '' if (!props.doc) return ''
if (props.doc.doctype == 'CRM Lead') return props.doc.lead_owner if (props.doctype == 'CRM Lead') return props.doc.lead_owner
return props.doc.deal_owner return props.doc.deal_owner
}) })
@ -137,7 +142,7 @@ function updateAssignees() {
if (removedAssignees.length) { if (removedAssignees.length) {
for (let a of removedAssignees) { for (let a of removedAssignees) {
call('frappe.desk.form.assign_to.remove', { call('frappe.desk.form.assign_to.remove', {
doctype: props.doc.doctype, doctype: props.doctype,
name: props.doc.name, name: props.doc.name,
assign_to: a, assign_to: a,
}) })
@ -146,7 +151,7 @@ function updateAssignees() {
if (addedAssignees.length) { if (addedAssignees.length) {
call('frappe.desk.form.assign_to.add', { call('frappe.desk.form.assign_to.add', {
doctype: props.doc.doctype, doctype: props.doctype,
name: props.doc.name, name: props.doc.name,
assign_to: addedAssignees, assign_to: addedAssignees,
}) })

View File

@ -280,6 +280,7 @@
<AssignmentModal <AssignmentModal
v-if="deal.data" v-if="deal.data"
:doc="deal.data" :doc="deal.data"
doctype="CRM Deal"
v-model="showAssignmentModal" v-model="showAssignmentModal"
v-model:assignees="deal.data._assignedTo" v-model:assignees="deal.data._assignedTo"
/> />

View File

@ -186,6 +186,7 @@
<AssignmentModal <AssignmentModal
v-if="lead.data" v-if="lead.data"
:doc="lead.data" :doc="lead.data"
doctype="CRM Lead"
v-model="showAssignmentModal" v-model="showAssignmentModal"
v-model:assignees="lead.data._assignedTo" v-model:assignees="lead.data._assignedTo"
/> />