fix: update onboarding status when first task is created

This commit is contained in:
Shariq Ansari 2025-03-12 17:28:29 +05:30
parent 4d74943ebc
commit c07aa03c47
3 changed files with 33 additions and 6 deletions

View File

@ -29,3 +29,14 @@ def get_first_non_converted_lead():
limit=1,
)
return lead[0].name if lead else None
@frappe.whitelist()
def get_first_deal():
deal = frappe.get_all(
"CRM Deal",
fields=["name"],
order_by="creation",
limit=1,
)
return deal[0].name if deal else None

View File

@ -117,6 +117,7 @@ import UserAvatar from '@/components/UserAvatar.vue'
import Link from '@/components/Controls/Link.vue'
import { taskStatusOptions, taskPriorityOptions, getFormat } from '@/utils'
import { usersStore } from '@/stores/users'
import { useOnboarding } from '@/composables/onboarding'
import { capture } from '@/telemetry'
import { TextEditor, Dropdown, Tooltip, call, DateTimePicker } from 'frappe-ui'
import { ref, watch, nextTick, onMounted } from 'vue'
@ -144,6 +145,7 @@ const emit = defineEmits(['updateTask', 'after'])
const router = useRouter()
const { getUser } = usersStore()
const { updateOnboardingStep } = useOnboarding()
const title = ref(null)
const editMode = ref(false)
@ -200,6 +202,7 @@ async function updateTask() {
},
})
if (d.name) {
updateOnboardingStep('create_first_task')
capture('task_created')
tasks.value?.reload()
emit('after', d, true)

View File

@ -62,17 +62,30 @@ const steps = reactive([
}
},
},
{
name: 'create_first_note',
title: 'Create your first note',
icon: markRaw(NoteIcon),
completed: false,
},
{
name: 'create_first_task',
title: 'Create your first task',
icon: markRaw(TaskIcon),
completed: false,
onClick: async () => {
minimize.value = true
let dealName = await call('crm.api.onboarding.get_first_deal')
if (dealName) {
router.push({
name: 'Deal',
params: { dealId: dealName },
hash: '#tasks',
})
} else {
router.push({ name: 'Tasks' })
}
},
},
{
name: 'create_first_note',
title: 'Create your first note',
icon: markRaw(NoteIcon),
completed: false,
},
{
name: 'add_first_comment',