fix: get filtered steps based on condition

This commit is contained in:
Shariq Ansari 2025-05-19 13:06:38 +05:30
parent f125737d30
commit a7784c2985

View File

@ -168,6 +168,7 @@ import {
unreadNotificationsCount, unreadNotificationsCount,
notificationsStore, notificationsStore,
} from '@/stores/notifications' } from '@/stores/notifications'
import { usersStore } from '@/stores/users'
import { showSettings, activeSettingsPage } from '@/composables/settings' import { showSettings, activeSettingsPage } from '@/composables/settings'
import { FeatherIcon, call } from 'frappe-ui' import { FeatherIcon, call } from 'frappe-ui'
import { import {
@ -299,6 +300,7 @@ function getIcon(routeName, icon) {
} }
// onboarding // onboarding
const { users, isManager } = usersStore()
const { isOnboardingStepsCompleted, setUp } = useOnboarding('frappecrm') const { isOnboardingStepsCompleted, setUp } = useOnboarding('frappecrm')
async function getFirstLead() { async function getFirstLead() {
@ -337,6 +339,7 @@ const steps = reactive([
showSettings.value = true showSettings.value = true
activeSettingsPage.value = 'Invite Members' activeSettingsPage.value = 'Invite Members'
}, },
condition: () => isManager(),
}, },
{ {
name: 'convert_lead_to_deal', name: 'convert_lead_to_deal',
@ -478,7 +481,18 @@ const steps = reactive([
}, },
]) ])
onMounted(() => setUp(steps)) onMounted(async () => {
await users.promise
const filteredSteps = steps.filter((step) => {
if (step.condition) {
return step.condition()
}
return true
})
setUp(filteredSteps)
})
// help center // help center
const articles = ref([ const articles = ref([
@ -517,9 +531,7 @@ const articles = ref([
{ {
title: __('Capturing leads'), title: __('Capturing leads'),
opened: false, opened: false,
subArticles: [ subArticles: [{ name: 'web-form', title: __('Web form') }],
{ name: 'web-form', title: __('Web form') },
],
}, },
{ {
title: __('Views'), title: __('Views'),