Merge pull request #1042 from frappe/mergify/bp/main-hotfix/pr-1041
fix: Reset to default dashboard (backport #1041)
This commit is contained in:
commit
fa5d17a121
@ -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=""):
|
||||
|
||||
@ -242,19 +242,18 @@ def get_call_log_status(call_payload, direction="inbound"):
|
||||
elif status == "failed":
|
||||
return "Failed"
|
||||
|
||||
status = call_payload.get("DialCallStatus")
|
||||
call_type = call_payload.get("CallType")
|
||||
dial_call_status = call_payload.get("DialCallStatus")
|
||||
status = call_payload.get("DialCallStatus") or call_payload.get("Status")
|
||||
|
||||
if call_type == "incomplete" and dial_call_status == "no-answer":
|
||||
if call_type == "incomplete" and status == "no-answer":
|
||||
status = "No Answer"
|
||||
elif call_type == "client-hangup" and dial_call_status == "canceled":
|
||||
elif call_type == "client-hangup" and status == "canceled":
|
||||
status = "Canceled"
|
||||
elif call_type == "incomplete" and dial_call_status == "failed":
|
||||
elif call_type == "incomplete" and status == "failed":
|
||||
status = "Failed"
|
||||
elif call_type == "completed":
|
||||
status = "Completed"
|
||||
elif dial_call_status == "busy":
|
||||
elif status == "busy":
|
||||
status = "Ringing"
|
||||
|
||||
return status
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
</template>
|
||||
</Button>
|
||||
<Button
|
||||
v-if="!editing && (isManager() || isAdmin())"
|
||||
v-if="!editing && isAdmin()"
|
||||
:label="__('Edit')"
|
||||
@click="enableEditing"
|
||||
>
|
||||
@ -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