fix: store first lead & deal in local storage

This commit is contained in:
Shariq Ansari 2025-03-22 18:21:29 +05:30
parent 698cf1a8cb
commit c13ec48824
3 changed files with 10 additions and 7 deletions

View File

@ -296,16 +296,15 @@ function getIcon(routeName, icon) {
// onboarding
const { isOnboardingStepsCompleted, setUp } = useOnboarding('frappecrm')
const firstLead = ref('')
const firstDeal = ref('')
async function getFirstLead() {
if (firstLead.value) return firstLead.value
let firstLead = localStorage.getItem('firstLead')
if (firstLead) return firstLead
return await call('crm.api.onboarding.get_first_lead')
}
async function getFirstDeal() {
if (firstDeal.value) return firstDeal.value
let firstDeal = localStorage.getItem('firstDeal')
if (firstDeal) return firstDeal
return await call('crm.api.onboarding.get_first_deal')
}

View File

@ -168,7 +168,9 @@ function createNewLead() {
isLeadCreating.value = false
show.value = false
router.push({ name: 'Lead', params: { leadId: data.name } })
updateOnboardingStep('create_first_lead')
updateOnboardingStep('create_first_lead', true, false, () => {
localStorage.setItem('firstLead', data.name)
})
},
onError(err) {
isLeadCreating.value = false

View File

@ -657,7 +657,9 @@ async function convertToDeal() {
existingOrganizationChecked.value = false
existingContact.value = ''
existingOrganization.value = ''
updateOnboardingStep('convert_lead_to_deal')
updateOnboardingStep('convert_lead_to_deal', true, false, () => {
localStorage.setItem('firstDeal', _deal)
})
capture('convert_lead_to_deal')
router.push({ name: 'Deal', params: { dealId: _deal } })
}