fix: after attaching change tab to attachments
This commit is contained in:
parent
dc1c2d36a0
commit
497ee46f33
@ -443,7 +443,12 @@
|
|||||||
v-model="showFilesUploader"
|
v-model="showFilesUploader"
|
||||||
:doctype="doctype"
|
:doctype="doctype"
|
||||||
:docname="doc.data.name"
|
:docname="doc.data.name"
|
||||||
@after="() => all_activities.reload()"
|
@after="
|
||||||
|
() => {
|
||||||
|
all_activities.reload()
|
||||||
|
changeTabTo('attachments')
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -532,6 +537,13 @@ const showFilesUploader = ref(false)
|
|||||||
|
|
||||||
const title = computed(() => props.tabs?.[tabIndex.value]?.name || 'Activity')
|
const title = computed(() => props.tabs?.[tabIndex.value]?.name || 'Activity')
|
||||||
|
|
||||||
|
const changeTabTo = (tabName) => {
|
||||||
|
const tabNames = props.tabs?.map((tab) => tab.name?.toLowerCase())
|
||||||
|
const index = tabNames?.indexOf(tabName)
|
||||||
|
if (index == -1) return
|
||||||
|
tabIndex.value = index
|
||||||
|
}
|
||||||
|
|
||||||
const all_activities = createResource({
|
const all_activities = createResource({
|
||||||
url: 'crm.api.activities.get_activities',
|
url: 'crm.api.activities.get_activities',
|
||||||
params: { name: doc.value.data.name },
|
params: { name: doc.value.data.name },
|
||||||
|
|||||||
@ -7,6 +7,12 @@ export function useActiveTabManager(tabs, storageKey) {
|
|||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const changeTabTo = (tabName) => {
|
||||||
|
let index = findTabIndex(tabName)
|
||||||
|
if (index == -1) return
|
||||||
|
tabIndex.value = index
|
||||||
|
}
|
||||||
|
|
||||||
const preserveLastVisitedTab = useDebounceFn((tabName) => {
|
const preserveLastVisitedTab = useDebounceFn((tabName) => {
|
||||||
activeTab.value = tabName.toLowerCase()
|
activeTab.value = tabName.toLowerCase()
|
||||||
}, 300)
|
}, 300)
|
||||||
@ -78,5 +84,5 @@ export function useActiveTabManager(tabs, storageKey) {
|
|||||||
tabIndex.value = getActiveTab()
|
tabIndex.value = getActiveTab()
|
||||||
})
|
})
|
||||||
|
|
||||||
return { tabIndex }
|
return { tabIndex, changeTabTo }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -309,7 +309,12 @@
|
|||||||
v-model="showFilesUploader"
|
v-model="showFilesUploader"
|
||||||
doctype="CRM Deal"
|
doctype="CRM Deal"
|
||||||
:docname="deal.data.name"
|
:docname="deal.data.name"
|
||||||
@after="() => activities?.all_activities?.reload()"
|
@after="
|
||||||
|
() => {
|
||||||
|
activities?.all_activities?.reload()
|
||||||
|
changeTabTo('attachments')
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
|||||||
@ -282,7 +282,12 @@
|
|||||||
v-model="showFilesUploader"
|
v-model="showFilesUploader"
|
||||||
doctype="CRM Lead"
|
doctype="CRM Lead"
|
||||||
:docname="lead.data.name"
|
:docname="lead.data.name"
|
||||||
@after="() => activities?.all_activities?.reload()"
|
@after="
|
||||||
|
() => {
|
||||||
|
activities?.all_activities?.reload()
|
||||||
|
changeTabTo('attachments')
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -526,7 +531,7 @@ const tabs = computed(() => {
|
|||||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||||
})
|
})
|
||||||
|
|
||||||
const { tabIndex } = useActiveTabManager(tabs, 'lastLeadTab')
|
const { tabIndex, changeTabTo } = useActiveTabManager(tabs, 'lastLeadTab')
|
||||||
|
|
||||||
watch(tabs, (value) => {
|
watch(tabs, (value) => {
|
||||||
if (value && route.params.tabName) {
|
if (value && route.params.tabName) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user