diff --git a/frontend/src/components/ListViews/CallLogsListView.vue b/frontend/src/components/ListViews/CallLogsListView.vue index 5d2cbe80..45c34b74 100644 --- a/frontend/src/components/ListViews/CallLogsListView.vue +++ b/frontend/src/components/ListViews/CallLogsListView.vue @@ -103,7 +103,7 @@ import { Dropdown, call, } from 'frappe-ui' -import { setupBulkActions, createToast } from '@/utils' +import { setupListActions, createToast } from '@/utils' import { globalStore } from '@/stores/global' import { onMounted, ref, watch } from 'vue' import { useRouter } from 'vue-router' @@ -181,6 +181,7 @@ function deleteValues(selections, unselectAll) { } const customBulkActions = ref([]) +const customListActions = ref([]) function bulkActions(selections, unselectAll) { let actions = [ @@ -209,7 +210,18 @@ function bulkActions(selections, unselectAll) { onMounted(() => { if (!list.value?.data) return - setupBulkActions(list.value.data) + setupListActions(list.value.data, { + list: list.value, + call, + createToast, + $dialog, + router, + }) customBulkActions.value = list.value?.data?.bulkActions || [] + customListActions.value = list.value?.data?.listActions || [] +}) + +defineExpose({ + customListActions, }) diff --git a/frontend/src/components/ListViews/ContactsListView.vue b/frontend/src/components/ListViews/ContactsListView.vue index 5a9781d7..64fc550b 100644 --- a/frontend/src/components/ListViews/ContactsListView.vue +++ b/frontend/src/components/ListViews/ContactsListView.vue @@ -103,7 +103,7 @@ import PhoneIcon from '@/components/Icons/PhoneIcon.vue' import EditValueModal from '@/components/Modals/EditValueModal.vue' import { globalStore } from '@/stores/global' -import { createToast } from '@/utils' +import { setupListActions, createToast } from '@/utils' import { Avatar, ListView, @@ -117,7 +117,8 @@ import { Dropdown, call, } from 'frappe-ui' -import { ref, watch } from 'vue' +import { ref, watch, onMounted } from 'vue' +import { useRouter } from 'vue-router' const props = defineProps({ rows: { @@ -150,6 +151,8 @@ const emit = defineEmits([ const pageLengthCount = defineModel() const list = defineModel('list') +const router = useRouter() + const { $dialog } = globalStore() watch(pageLengthCount, (val, old_value) => { @@ -199,6 +202,8 @@ function deleteValues(selections, unselectAll) { }) } +const customListActions = ref([]) + function bulkActions(selections, unselectAll) { let actions = [ { @@ -212,4 +217,21 @@ function bulkActions(selections, unselectAll) { ] return actions } + +onMounted(() => { + if (!list.value?.data) return + setupListActions(list.value.data, { + list: list.value, + call, + createToast, + $dialog, + router, + }) + // customBulkActions.value = list.value?.data?.bulkActions || [] + customListActions.value = list.value?.data?.listActions || [] +}) + +defineExpose({ + customListActions, +}) diff --git a/frontend/src/components/ListViews/DealsListView.vue b/frontend/src/components/ListViews/DealsListView.vue index e4988649..57a93e57 100644 --- a/frontend/src/components/ListViews/DealsListView.vue +++ b/frontend/src/components/ListViews/DealsListView.vue @@ -146,7 +146,7 @@ import { call, Tooltip, } from 'frappe-ui' -import { setupBulkActions, createToast } from '@/utils' +import { setupListActions, createToast } from '@/utils' import { globalStore } from '@/stores/global' import { onMounted, ref, watch } from 'vue' import { useRouter } from 'vue-router' @@ -234,6 +234,7 @@ function deleteValues(selections, unselectAll) { } const customBulkActions = ref([]) +const customListActions = ref([]) function bulkActions(selections, unselectAll) { let actions = [ @@ -266,7 +267,18 @@ function bulkActions(selections, unselectAll) { onMounted(() => { if (!list.value?.data) return - setupBulkActions(list.value.data) + setupListActions(list.value.data, { + list: list.value, + call, + createToast, + $dialog, + router, + }) customBulkActions.value = list.value?.data?.bulkActions || [] + customListActions.value = list.value?.data?.listActions || [] +}) + +defineExpose({ + customListActions, }) diff --git a/frontend/src/components/ListViews/EmailTemplatesListView.vue b/frontend/src/components/ListViews/EmailTemplatesListView.vue index 34afca15..b260d0e3 100644 --- a/frontend/src/components/ListViews/EmailTemplatesListView.vue +++ b/frontend/src/components/ListViews/EmailTemplatesListView.vue @@ -85,7 +85,7 @@ diff --git a/frontend/src/components/ListViews/OrganizationsListView.vue b/frontend/src/components/ListViews/OrganizationsListView.vue index cd8d677d..059f661b 100644 --- a/frontend/src/components/ListViews/OrganizationsListView.vue +++ b/frontend/src/components/ListViews/OrganizationsListView.vue @@ -88,7 +88,7 @@ diff --git a/frontend/src/components/ListViews/TasksListView.vue b/frontend/src/components/ListViews/TasksListView.vue index ab6b21a1..33898cf3 100644 --- a/frontend/src/components/ListViews/TasksListView.vue +++ b/frontend/src/components/ListViews/TasksListView.vue @@ -106,7 +106,7 @@ import CalendarIcon from '@/components/Icons/CalendarIcon.vue' import EditValueModal from '@/components/Modals/EditValueModal.vue' import { dateFormat } from '@/utils' import { globalStore } from '@/stores/global' -import { createToast } from '@/utils' +import { setupListActions, createToast } from '@/utils' import { Avatar, ListView, @@ -120,7 +120,8 @@ import { call, Tooltip, } from 'frappe-ui' -import { ref, watch } from 'vue' +import { ref, watch, onMounted } from 'vue' +import { useRouter } from 'vue-router' const props = defineProps({ rows: { @@ -154,6 +155,8 @@ const emit = defineEmits([ const pageLengthCount = defineModel() const list = defineModel('list') +const router = useRouter() + const { $dialog } = globalStore() watch(pageLengthCount, (val, old_value) => { @@ -203,6 +206,8 @@ function deleteValues(selections, unselectAll) { }) } +const customListActions = ref([]) + function bulkActions(selections, unselectAll) { let actions = [ { @@ -216,4 +221,21 @@ function bulkActions(selections, unselectAll) { ] return actions } + +onMounted(() => { + if (!list.value?.data) return + setupListActions(list.value.data, { + list: list.value, + call, + createToast, + $dialog, + router, + }) + // customBulkActions.value = list.value?.data?.bulkActions || [] + customListActions.value = list.value?.data?.listActions || [] +}) + +defineExpose({ + customListActions, +}) diff --git a/frontend/src/pages/CallLogs.vue b/frontend/src/pages/CallLogs.vue index 1c6b4ace..7d200827 100644 --- a/frontend/src/pages/CallLogs.vue +++ b/frontend/src/pages/CallLogs.vue @@ -3,6 +3,12 @@ +