fix: reset to default
This commit is contained in:
parent
713571469b
commit
7826565ce7
@ -7,6 +7,12 @@ from crm.fcrm.doctype.crm_dashboard.crm_dashboard import create_default_manager_
|
||||
from crm.utils import sales_user_only
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def reset_to_default():
|
||||
frappe.only_for("System Manager")
|
||||
create_default_manager_dashboard(force=True)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@sales_user_only
|
||||
def get_dashboard(from_date="", to_date="", user=""):
|
||||
|
||||
@ -29,6 +29,15 @@
|
||||
icon-left="plus"
|
||||
@click="showAddChartModal = true"
|
||||
/>
|
||||
<Button
|
||||
v-if="editing && isAdmin()"
|
||||
:label="__('Reset to default')"
|
||||
@click="resetToDefault"
|
||||
>
|
||||
<template #prefix>
|
||||
<LucideUndo2 class="size-4" />
|
||||
</template>
|
||||
</Button>
|
||||
<Button v-if="editing" :label="__('Cancel')" @click="cancel" />
|
||||
<Button
|
||||
v-if="editing"
|
||||
@ -137,6 +146,7 @@
|
||||
<script setup lang="ts">
|
||||
import AddChartModal from '@/components/Dashboard/AddChartModal.vue'
|
||||
import LucideRefreshCcw from '~icons/lucide/refresh-ccw'
|
||||
import LucideUndo2 from '~icons/lucide/undo-2'
|
||||
import LucidePenLine from '~icons/lucide/pen-line'
|
||||
import DashboardGrid from '@/components/Dashboard/DashboardGrid.vue'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
@ -293,6 +303,17 @@ function save() {
|
||||
})
|
||||
}
|
||||
|
||||
function resetToDefault() {
|
||||
createResource({
|
||||
url: 'crm.api.dashboard.reset_to_default',
|
||||
auto: true,
|
||||
onSuccess: () => {
|
||||
dashboardItems.reload()
|
||||
editing.value = false
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
usePageMeta(() => {
|
||||
return { title: __('CRM Dashboard') }
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user