Merge pull request #892 from frappe/mergify/bp/main-hotfix/pr-891
fixes (backport #891)
This commit is contained in:
commit
260a9d8230
@ -320,7 +320,7 @@
|
|||||||
{{ startCase(__(activity.type)) }}
|
{{ startCase(__(activity.type)) }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="activity.data.old_value"
|
v-if="activity.data?.old_value"
|
||||||
class="max-w-xs font-medium text-ink-gray-8"
|
class="max-w-xs font-medium text-ink-gray-8"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -336,7 +336,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<span v-if="activity.to">{{ __('to') }}</span>
|
<span v-if="activity.to">{{ __('to') }}</span>
|
||||||
<span
|
<span
|
||||||
v-if="activity.data.value"
|
v-if="activity.data?.value"
|
||||||
class="max-w-xs font-medium text-ink-gray-8"
|
class="max-w-xs font-medium text-ink-gray-8"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -16,8 +16,9 @@
|
|||||||
@after="redirect('notes')"
|
@after="redirect('notes')"
|
||||||
/>
|
/>
|
||||||
<CallLogModal
|
<CallLogModal
|
||||||
|
v-if="showCallLogModal"
|
||||||
v-model="showCallLogModal"
|
v-model="showCallLogModal"
|
||||||
v-model:callLog="callLog"
|
:data="callLog"
|
||||||
:options="{ afterInsert: () => activities.reload() }"
|
:options="{ afterInsert: () => activities.reload() }"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -97,7 +97,11 @@
|
|||||||
v-model:callLogModal="showCallLogModal"
|
v-model:callLogModal="showCallLogModal"
|
||||||
v-model:callLog="callLog"
|
v-model:callLog="callLog"
|
||||||
/>
|
/>
|
||||||
<CallLogModal v-model="showCallLogModal" v-model:callLog="callLog.data" />
|
<CallLogModal
|
||||||
|
v-if="showCallLogModal"
|
||||||
|
v-model="showCallLogModal"
|
||||||
|
:data="callLog.data"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
@ -44,9 +44,13 @@ import { getRandom } from '@/utils'
|
|||||||
import { capture } from '@/telemetry'
|
import { capture } from '@/telemetry'
|
||||||
import { useDocument } from '@/data/document'
|
import { useDocument } from '@/data/document'
|
||||||
import { FeatherIcon, createResource, ErrorMessage, Badge } from 'frappe-ui'
|
import { FeatherIcon, createResource, ErrorMessage, Badge } from 'frappe-ui'
|
||||||
import { ref, nextTick, watch, computed } from 'vue'
|
import { ref, nextTick, computed, onMounted } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {
|
default: {
|
||||||
@ -58,14 +62,15 @@ const props = defineProps({
|
|||||||
const { isManager } = usersStore()
|
const { isManager } = usersStore()
|
||||||
|
|
||||||
const show = defineModel()
|
const show = defineModel()
|
||||||
const _callLog = defineModel('callLog')
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const error = ref(null)
|
const error = ref(null)
|
||||||
const title = ref(null)
|
|
||||||
const editMode = ref(false)
|
const editMode = ref(false)
|
||||||
|
|
||||||
const callLog = ref(null)
|
const { document: callLog } = useDocument(
|
||||||
|
'CRM Call Log',
|
||||||
|
props.data?.name || '',
|
||||||
|
)
|
||||||
|
|
||||||
const dialogOptions = computed(() => {
|
const dialogOptions = computed(() => {
|
||||||
let title = !editMode.value ? __('New Call Log') : __('Edit Call Log')
|
let title = !editMode.value ? __('New Call Log') : __('Edit Call Log')
|
||||||
@ -109,7 +114,7 @@ const callBacks = {
|
|||||||
|
|
||||||
async function updateCallLog() {
|
async function updateCallLog() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
await callLog.value.save.submit(null, callBacks)
|
await callLog.save.submit(null, callBacks)
|
||||||
}
|
}
|
||||||
|
|
||||||
const createCallLog = createResource({
|
const createCallLog = createResource({
|
||||||
@ -120,7 +125,7 @@ const createCallLog = createResource({
|
|||||||
doctype: 'CRM Call Log',
|
doctype: 'CRM Call Log',
|
||||||
id: getRandom(6),
|
id: getRandom(6),
|
||||||
telephony_medium: 'Manual',
|
telephony_medium: 'Manual',
|
||||||
...callLog.value.doc,
|
...callLog.doc,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -141,23 +146,13 @@ function handleCallLogUpdate(doc) {
|
|||||||
props.options.afterInsert && props.options.afterInsert(doc)
|
props.options.afterInsert && props.options.afterInsert(doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
onMounted(() => {
|
||||||
() => show.value,
|
editMode.value = props.data?.name ? true : false
|
||||||
(value) => {
|
|
||||||
if (!value) return
|
|
||||||
editMode.value = false
|
|
||||||
|
|
||||||
let docname = _callLog.value?.name
|
if (!props.data?.name) {
|
||||||
const { document } = useDocument('CRM Call Log', docname)
|
callLog.doc = { ...props.data }
|
||||||
callLog.value = document
|
}
|
||||||
|
})
|
||||||
if (docname) {
|
|
||||||
editMode.value = true
|
|
||||||
} else {
|
|
||||||
callLog.value.doc = { ..._callLog.value }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
function openQuickEntryModal() {
|
function openQuickEntryModal() {
|
||||||
showQuickEntryModal.value = true
|
showQuickEntryModal.value = true
|
||||||
|
|||||||
@ -84,10 +84,6 @@ const loading = ref(false)
|
|||||||
|
|
||||||
const { document: _contact } = useDocument('Contact')
|
const { document: _contact } = useDocument('Contact')
|
||||||
|
|
||||||
if (Object.keys(_contact.doc).length != 0) {
|
|
||||||
_contact.doc = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createContact() {
|
async function createContact() {
|
||||||
if (_contact.doc.email_id) {
|
if (_contact.doc.email_id) {
|
||||||
_contact.doc.email_ids = [{ email_id: _contact.doc.email_id }]
|
_contact.doc.email_ids = [{ email_id: _contact.doc.email_id }]
|
||||||
@ -155,7 +151,8 @@ const tabs = createResource({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
Object.assign(_contact.doc, props.contact.data || props.contact || {})
|
_contact.doc = {}
|
||||||
|
Object.assign(_contact.doc, props.contact.data || props.contact)
|
||||||
})
|
})
|
||||||
|
|
||||||
function openQuickEntryModal() {
|
function openQuickEntryModal() {
|
||||||
|
|||||||
@ -96,10 +96,6 @@ const error = ref(null)
|
|||||||
|
|
||||||
const { document: deal } = useDocument('CRM Deal')
|
const { document: deal } = useDocument('CRM Deal')
|
||||||
|
|
||||||
if (Object.keys(deal.doc).length != 0) {
|
|
||||||
deal.doc = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasOrganizationSections = ref(true)
|
const hasOrganizationSections = ref(true)
|
||||||
const hasContactSections = ref(true)
|
const hasContactSections = ref(true)
|
||||||
|
|
||||||
@ -241,7 +237,9 @@ function openQuickEntryModal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
deal.doc = { no_of_employees: '1-10' }
|
||||||
Object.assign(deal.doc, props.defaults)
|
Object.assign(deal.doc, props.defaults)
|
||||||
|
|
||||||
if (!deal.doc.deal_owner) {
|
if (!deal.doc.deal_owner) {
|
||||||
deal.doc.deal_owner = getUser().name
|
deal.doc.deal_owner = getUser().name
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,10 +72,6 @@ const isLeadCreating = ref(false)
|
|||||||
|
|
||||||
const { document: lead } = useDocument('CRM Lead')
|
const { document: lead } = useDocument('CRM Lead')
|
||||||
|
|
||||||
if (Object.keys(lead.doc).length != 0) {
|
|
||||||
lead.doc = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
const leadStatuses = computed(() => {
|
const leadStatuses = computed(() => {
|
||||||
let statuses = statusOptions('lead')
|
let statuses = statusOptions('lead')
|
||||||
if (!lead.doc.status) {
|
if (!lead.doc.status) {
|
||||||
@ -186,7 +182,9 @@ function openQuickEntryModal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
lead.doc = { no_of_employees: '1-10' }
|
||||||
Object.assign(lead.doc, props.defaults)
|
Object.assign(lead.doc, props.defaults)
|
||||||
|
|
||||||
if (!lead.doc?.lead_owner) {
|
if (!lead.doc?.lead_owner) {
|
||||||
lead.doc.lead_owner = getUser().name
|
lead.doc.lead_owner = getUser().name
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FieldLayout v-if="tabs.data?.length" :tabs="tabs.data" :data="_organization" doctype="CRM Organization" />
|
<FieldLayout
|
||||||
|
v-if="tabs.data?.length"
|
||||||
|
:tabs="tabs.data"
|
||||||
|
:data="organization.doc"
|
||||||
|
doctype="CRM Organization"
|
||||||
|
/>
|
||||||
<ErrorMessage class="mt-8" v-if="error" :message="__(error)" />
|
<ErrorMessage class="mt-8" v-if="error" :message="__(error)" />
|
||||||
</div>
|
</div>
|
||||||
<div class="px-4 pt-4 pb-7 sm:px-6">
|
<div class="px-4 pt-4 pb-7 sm:px-6">
|
||||||
@ -47,6 +52,10 @@ import { ref, nextTick, onMounted } from 'vue'
|
|||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {
|
default: {
|
||||||
@ -60,27 +69,19 @@ const { isManager } = usersStore()
|
|||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const show = defineModel()
|
const show = defineModel()
|
||||||
const organization = defineModel('organization')
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const title = ref(null)
|
|
||||||
|
|
||||||
const { document: _organization } = useDocument('CRM Organization')
|
|
||||||
|
|
||||||
if (Object.keys(_organization.doc).length != 0) {
|
|
||||||
_organization.doc = { no_of_employees: '1-10' }
|
|
||||||
}
|
|
||||||
|
|
||||||
let doc = ref({})
|
|
||||||
const error = ref(null)
|
const error = ref(null)
|
||||||
|
|
||||||
|
const { document: organization } = useDocument('CRM Organization')
|
||||||
|
|
||||||
async function createOrganization() {
|
async function createOrganization() {
|
||||||
const doc = await call(
|
const doc = await call(
|
||||||
'frappe.client.insert',
|
'frappe.client.insert',
|
||||||
{
|
{
|
||||||
doc: {
|
doc: {
|
||||||
doctype: 'CRM Organization',
|
doctype: 'CRM Organization',
|
||||||
..._organization.doc,
|
...organization.doc,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -104,8 +105,6 @@ function handleOrganizationUpdate(doc) {
|
|||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
params: { organizationId: doc.name },
|
params: { organizationId: doc.name },
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
organization.value?.reload?.()
|
|
||||||
}
|
}
|
||||||
show.value = false
|
show.value = false
|
||||||
props.options.afterInsert && props.options.afterInsert(doc)
|
props.options.afterInsert && props.options.afterInsert(doc)
|
||||||
@ -123,13 +122,13 @@ const tabs = createResource({
|
|||||||
column.fields.forEach((field) => {
|
column.fields.forEach((field) => {
|
||||||
if (field.fieldname == 'address') {
|
if (field.fieldname == 'address') {
|
||||||
field.create = (value, close) => {
|
field.create = (value, close) => {
|
||||||
_organization.doc.address = value
|
organization.doc.address = value
|
||||||
openAddressModal()
|
openAddressModal()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
field.edit = (address) => openAddressModal(address)
|
field.edit = (address) => openAddressModal(address)
|
||||||
} else if (field.fieldtype === 'Table') {
|
} else if (field.fieldtype === 'Table') {
|
||||||
_organization.doc[field.fieldname] = []
|
organization.doc[field.fieldname] = []
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -139,10 +138,8 @@ const tabs = createResource({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
Object.assign(
|
organization.doc = { no_of_employees: '1-10' }
|
||||||
_organization.doc,
|
Object.assign(organization.doc, props.data)
|
||||||
organization.value?.doc || organization.value || {},
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function openQuickEntryModal() {
|
function openQuickEntryModal() {
|
||||||
|
|||||||
@ -62,8 +62,9 @@
|
|||||||
v-model:callLog="callLog"
|
v-model:callLog="callLog"
|
||||||
/>
|
/>
|
||||||
<CallLogModal
|
<CallLogModal
|
||||||
|
v-if="showCallLogModal"
|
||||||
v-model="showCallLogModal"
|
v-model="showCallLogModal"
|
||||||
v-model:callLog="callLog.data"
|
:data="callLog.data"
|
||||||
:options="{ afterInsert: () => callLogs.reload() }"
|
:options="{ afterInsert: () => callLogs.reload() }"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -272,8 +272,9 @@
|
|||||||
:errorMessage="errorMessage"
|
:errorMessage="errorMessage"
|
||||||
/>
|
/>
|
||||||
<OrganizationModal
|
<OrganizationModal
|
||||||
|
v-if="showOrganizationModal"
|
||||||
v-model="showOrganizationModal"
|
v-model="showOrganizationModal"
|
||||||
v-model:organization="_organization"
|
:data="_organization"
|
||||||
:options="{
|
:options="{
|
||||||
redirect: false,
|
redirect: false,
|
||||||
afterInsert: (doc) => updateField('organization', doc.name),
|
afterInsert: (doc) => updateField('organization', doc.name),
|
||||||
|
|||||||
@ -214,8 +214,9 @@
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
<OrganizationModal
|
<OrganizationModal
|
||||||
|
v-if="showOrganizationModal"
|
||||||
v-model="showOrganizationModal"
|
v-model="showOrganizationModal"
|
||||||
v-model:organization="_organization"
|
:data="_organization"
|
||||||
:options="{
|
:options="{
|
||||||
redirect: false,
|
redirect: false,
|
||||||
afterInsert: (doc) => updateField('organization', doc.name),
|
afterInsert: (doc) => updateField('organization', doc.name),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user