fix: useDocument in organization page
(cherry picked from commit 6760798f180e1630612080905eebbded0ec81551)
This commit is contained in:
parent
69277c5fb0
commit
a78a110914
@ -158,6 +158,7 @@ import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
|||||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||||
import { showAddressModal, addressProps } from '@/composables/modals'
|
import { showAddressModal, addressProps } from '@/composables/modals'
|
||||||
|
import { useDocument } from '@/data/document'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
import { globalStore } from '@/stores/global'
|
import { globalStore } from '@/stores/global'
|
||||||
@ -175,7 +176,6 @@ import {
|
|||||||
TabPanel,
|
TabPanel,
|
||||||
call,
|
call,
|
||||||
createListResource,
|
createListResource,
|
||||||
createDocumentResource,
|
|
||||||
usePageMeta,
|
usePageMeta,
|
||||||
createResource,
|
createResource,
|
||||||
toast,
|
toast,
|
||||||
@ -199,13 +199,10 @@ const { doctypeMeta } = getMeta('CRM Organization')
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const organization = createDocumentResource({
|
const { document: organization } = useDocument(
|
||||||
doctype: 'CRM Organization',
|
'CRM Organization',
|
||||||
name: props.organizationId,
|
props.organizationId,
|
||||||
cache: ['organization', props.organizationId],
|
)
|
||||||
fields: ['*'],
|
|
||||||
auto: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
|
let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
|
||||||
@ -288,8 +285,6 @@ function openWebsite() {
|
|||||||
else window.open(organization.doc.website, '_blank')
|
else window.open(organization.doc.website, '_blank')
|
||||||
}
|
}
|
||||||
|
|
||||||
const _organization = ref({})
|
|
||||||
|
|
||||||
const sections = createResource({
|
const sections = createResource({
|
||||||
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
||||||
cache: ['sidePanelSections', 'CRM Organization'],
|
cache: ['sidePanelSections', 'CRM Organization'],
|
||||||
@ -306,7 +301,6 @@ function getParsedSections(_sections) {
|
|||||||
return {
|
return {
|
||||||
...field,
|
...field,
|
||||||
create: (value, close) => {
|
create: (value, close) => {
|
||||||
_organization.value.address = value
|
|
||||||
openAddressModal()
|
openAddressModal()
|
||||||
close()
|
close()
|
||||||
},
|
},
|
||||||
|
|||||||
@ -186,9 +186,9 @@ import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
|||||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||||
import { showAddressModal, addressProps } from '@/composables/modals'
|
import { showAddressModal, addressProps } from '@/composables/modals'
|
||||||
|
import { useDocument } from '@/data/document'
|
||||||
import { getSettings } from '@/stores/settings'
|
import { getSettings } from '@/stores/settings'
|
||||||
import { getMeta } from '@/stores/meta'
|
import { getMeta } from '@/stores/meta'
|
||||||
import { globalStore } from '@/stores/global'
|
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { statusesStore } from '@/stores/statuses'
|
import { statusesStore } from '@/stores/statuses'
|
||||||
import { getView } from '@/utils/view'
|
import { getView } from '@/utils/view'
|
||||||
@ -202,13 +202,12 @@ import {
|
|||||||
Tabs,
|
Tabs,
|
||||||
call,
|
call,
|
||||||
createListResource,
|
createListResource,
|
||||||
createDocumentResource,
|
|
||||||
usePageMeta,
|
usePageMeta,
|
||||||
createResource,
|
createResource,
|
||||||
toast,
|
toast,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { h, computed, ref } from 'vue'
|
import { h, computed, ref } from 'vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import DeleteLinkedDocModal from '@/components/DeleteLinkedDocModal.vue'
|
import DeleteLinkedDocModal from '@/components/DeleteLinkedDocModal.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -220,37 +219,20 @@ const props = defineProps({
|
|||||||
|
|
||||||
const { brand } = getSettings()
|
const { brand } = getSettings()
|
||||||
const { getUser } = usersStore()
|
const { getUser } = usersStore()
|
||||||
const { $dialog } = globalStore()
|
|
||||||
const { getDealStatus } = statusesStore()
|
const { getDealStatus } = statusesStore()
|
||||||
const { doctypeMeta } = getMeta('CRM Organization')
|
const { doctypeMeta } = getMeta('CRM Organization')
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
const errorTitle = ref('')
|
const errorTitle = ref('')
|
||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
|
|
||||||
const showDeleteLinkedDocModal = ref(false)
|
const showDeleteLinkedDocModal = ref(false)
|
||||||
|
|
||||||
const organization = createDocumentResource({
|
const { document: organization } = useDocument(
|
||||||
doctype: 'CRM Organization',
|
'CRM Organization',
|
||||||
name: props.organizationId,
|
props.organizationId,
|
||||||
cache: ['organization', props.organizationId],
|
)
|
||||||
fields: ['*'],
|
|
||||||
auto: true,
|
|
||||||
onSuccess: () => {
|
|
||||||
errorTitle.value = ''
|
|
||||||
errorMessage.value = ''
|
|
||||||
},
|
|
||||||
onError: (err) => {
|
|
||||||
if (err.messages?.[0]) {
|
|
||||||
errorTitle.value = __('Not permitted')
|
|
||||||
errorMessage.value = __(err.messages?.[0])
|
|
||||||
} else {
|
|
||||||
router.push({ name: 'Organizations' })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
|
let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
|
||||||
@ -319,8 +301,6 @@ function openWebsite() {
|
|||||||
else window.open(organization.doc.website, '_blank')
|
else window.open(organization.doc.website, '_blank')
|
||||||
}
|
}
|
||||||
|
|
||||||
const _organization = ref({})
|
|
||||||
|
|
||||||
const sections = createResource({
|
const sections = createResource({
|
||||||
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
url: 'crm.fcrm.doctype.crm_fields_layout.crm_fields_layout.get_sidepanel_sections',
|
||||||
cache: ['sidePanelSections', 'CRM Organization'],
|
cache: ['sidePanelSections', 'CRM Organization'],
|
||||||
@ -337,7 +317,6 @@ function getParsedSections(_sections) {
|
|||||||
return {
|
return {
|
||||||
...field,
|
...field,
|
||||||
create: (value, close) => {
|
create: (value, close) => {
|
||||||
_organization.value.address = value
|
|
||||||
openAddressModal()
|
openAddressModal()
|
||||||
close()
|
close()
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user