1
0
forked from test/crm

fix: allow moving contacts section in deal page

This commit is contained in:
Shariq Ansari 2024-01-25 21:09:24 +05:30
parent 9c74b6ae42
commit 38cea32ba7
4 changed files with 35 additions and 38 deletions

View File

@ -246,6 +246,7 @@ def get_doctype_fields(doctype):
last_section = field.fieldname
sections[field.fieldname] = {
"label": field.label,
"name": field.fieldname,
"opened": True,
"fields": [],
}

View File

@ -112,8 +112,7 @@
{
"fieldname": "contacts_tab",
"fieldtype": "Tab Break",
"label": "Contacts",
"read_only": 1
"label": "Contacts"
},
{
"fieldname": "email",
@ -275,7 +274,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-01-19 21:43:58.940722",
"modified": "2024-01-25 21:00:08.216020",
"modified_by": "Administrator",
"module": "FCRM",
"name": "CRM Deal",

View File

@ -467,42 +467,40 @@ const detailSections = computed(() => {
function getParsedFields(sections, contacts) {
sections.forEach((section) => {
section.fields.forEach((field) => {
if (
!deal.data.organization &&
['website', 'territory', 'annual_revenue'].includes(field.name)
) {
field.hidden = true
}
if (field.name == 'organization') {
field.create = (value, close) => {
_organization.value.organization_name = value
showOrganizationModal.value = true
close()
if (section.name == 'contacts_tab') {
delete section.fields
section.contacts =
contacts?.map((contact) => {
return {
name: contact.contact,
is_primary: contact.is_primary,
opened: false,
}
}) || []
} else {
section.fields.forEach((field) => {
if (
!deal.data.organization &&
['website', 'territory', 'annual_revenue'].includes(field.name)
) {
field.hidden = true
}
field.link = (org) =>
router.push({
name: 'Organization',
params: { organizationId: org },
})
}
})
if (field.name == 'organization') {
field.create = (value, close) => {
_organization.value.organization_name = value
showOrganizationModal.value = true
close()
}
field.link = (org) =>
router.push({
name: 'Organization',
params: { organizationId: org },
})
}
})
}
})
let contactSection = {
label: 'Contacts',
opened: true,
contacts:
contacts?.map((contact) => {
return {
name: contact.contact,
is_primary: contact.is_primary,
opened: false,
}
}) || [],
}
return [...sections, contactSection]
return sections
}
const showContactModal = ref(false)

View File

@ -19,7 +19,6 @@ export const viewsStore = defineStore('crm-views', (doctype) => {
initialData: [],
auto: true,
transform(views) {
debugger
pinnedViews.value = []
publicViews.value = []
for (let view of views) {