fix: check persona_captured after details get saved
This commit is contained in:
Submodule frappe-ui updated: 29307e4fff...8cd9b06a5e
@@ -162,8 +162,21 @@ const setCategories = (data) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const identifyUserPersona = () => {
|
const isPersonaCaptured = async () => {
|
||||||
if (user.data?.is_system_manager) {
|
let persona = await call('frappe.client.get_single_value', {
|
||||||
|
doctype: 'LMS Settings',
|
||||||
|
field: 'persona_captured',
|
||||||
|
})
|
||||||
|
return persona
|
||||||
|
}
|
||||||
|
|
||||||
|
const identifyUserPersona = async () => {
|
||||||
|
let personaCaptured = await isPersonaCaptured()
|
||||||
|
if (
|
||||||
|
user.data?.is_system_manager &&
|
||||||
|
!user.data?.developer_mode &&
|
||||||
|
!personaCaptured
|
||||||
|
) {
|
||||||
call('frappe.client.get_count', {
|
call('frappe.client.get_count', {
|
||||||
doctype: 'LMS Course',
|
doctype: 'LMS Course',
|
||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex h-screen overflow-hidden sm:bg-gray-50">
|
<div class="flex h-screen overflow-hidden sm:bg-gray-50">
|
||||||
<div class="relative z-10 mx-auto py-8 sm:w-max sm:py-32">
|
<div class="relative h-full z-10 mx-auto pt-8 sm:w-max sm:pt-32">
|
||||||
<div class="mx-auto flex items-center justify-center space-x-2">
|
<div class="mx-auto flex items-center justify-center space-x-2">
|
||||||
<LMSLogo class="size-7" />
|
<LMSLogo class="size-7" />
|
||||||
<span
|
<span
|
||||||
@@ -68,6 +68,12 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-center absolute bottom-0 right-0 left-0 mx-auto cursor-pointer text-sm pb-4"
|
||||||
|
@click="skipPersonaForm()"
|
||||||
|
>
|
||||||
|
{{ __('Skip') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -81,6 +87,7 @@ import { sessionStore } from '@/stores/session'
|
|||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { brand } = sessionStore()
|
const { brand } = sessionStore()
|
||||||
|
console.log(user.data?.sitename)
|
||||||
|
|
||||||
const persona = reactive({
|
const persona = reactive({
|
||||||
role: null,
|
role: null,
|
||||||
@@ -90,12 +97,28 @@ const persona = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const submitPersona = () => {
|
const submitPersona = () => {
|
||||||
call('lms.lms.api.capture_user_persona', {
|
let responses = {
|
||||||
site: user.data?.sitename,
|
site: user.data?.sitename,
|
||||||
role: persona.role,
|
role: persona.role,
|
||||||
no_of_students: persona.noOfStudents,
|
no_of_students: persona.noOfStudents,
|
||||||
use_case: persona.useCase,
|
use_case: persona.useCase,
|
||||||
frappe_products: persona.frappeProducts,
|
frappe_products: persona.frappeProducts,
|
||||||
|
}
|
||||||
|
call('lms.lms.api.capture_user_persona', {
|
||||||
|
responses: JSON.stringify(responses),
|
||||||
|
}).then(() => {
|
||||||
|
router.push({
|
||||||
|
name: 'Courses',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const skipPersonaForm = () => {
|
||||||
|
call('frappe.client.set_value', {
|
||||||
|
doctype: 'LMS Settings',
|
||||||
|
name: null,
|
||||||
|
fieldname: 'persona_captured',
|
||||||
|
value: 1,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'Courses',
|
name: 'Courses',
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import requests
|
|
||||||
import frappe
|
import frappe
|
||||||
import zipfile
|
import zipfile
|
||||||
import os
|
import os
|
||||||
@@ -185,9 +184,10 @@ def get_user_info():
|
|||||||
)
|
)
|
||||||
user.is_fc_site = is_fc_site()
|
user.is_fc_site = is_fc_site()
|
||||||
user.is_system_manager = "System Manager" in user.roles
|
user.is_system_manager = "System Manager" in user.roles
|
||||||
|
user.sitename = frappe.local.site
|
||||||
|
user.developer_mode = frappe.conf.developer_mode
|
||||||
if user.is_fc_site and user.is_system_manager:
|
if user.is_fc_site and user.is_system_manager:
|
||||||
user.site_info = current_site_info()
|
user.site_info = current_site_info()
|
||||||
user.sitename = frappe.local.site
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
|
||||||
@@ -1393,18 +1393,14 @@ def add_an_evaluator(email):
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def capture_user_persona(site, role, number_of_students, use_case, frappe_products):
|
def capture_user_persona(responses):
|
||||||
requests.post(
|
frappe.only_for("System Manager")
|
||||||
"https://school.frappe.io/api/method/capture_persona",
|
data = frappe.parse_json(responses)
|
||||||
json={
|
data = json.dumps(data)
|
||||||
"site": site,
|
response = frappe.integrations.utils.make_post_request(
|
||||||
"role": role,
|
"https://school.frappe.io/api/method/capture-persona",
|
||||||
"number_of_students": number_of_students,
|
data={"response": data},
|
||||||
"use_case": use_case,
|
|
||||||
"frappe_products": frappe_products,
|
|
||||||
},
|
|
||||||
headers={
|
|
||||||
"Authorization": f"token {frappe.local.conf.frappe_token}",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
if response.get("message").get("name"):
|
||||||
|
frappe.db.set_single_value("LMS Settings", "persona_captured", True)
|
||||||
|
return response
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"general_tab",
|
"general_tab",
|
||||||
"default_home",
|
"default_home",
|
||||||
"send_calendar_invite_for_evaluations",
|
"send_calendar_invite_for_evaluations",
|
||||||
|
"persona_captured",
|
||||||
"column_break_zdel",
|
"column_break_zdel",
|
||||||
"allow_guest_access",
|
"allow_guest_access",
|
||||||
"enable_learning_paths",
|
"enable_learning_paths",
|
||||||
@@ -60,10 +61,7 @@
|
|||||||
"column_break_uwsp",
|
"column_break_uwsp",
|
||||||
"payment_reminder_template",
|
"payment_reminder_template",
|
||||||
"seo_tab",
|
"seo_tab",
|
||||||
"meta_description",
|
"meta_description"
|
||||||
"meta_image",
|
|
||||||
"column_break_xijv",
|
|
||||||
"meta_keywords"
|
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -375,28 +373,19 @@
|
|||||||
"label": "Meta Description"
|
"label": "Meta Description"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This image will be shown on lists and pages that don't have an image by default",
|
"default": "0",
|
||||||
"fieldname": "meta_image",
|
"fieldname": "persona_captured",
|
||||||
"fieldtype": "Attach Image",
|
"fieldtype": "Check",
|
||||||
"label": "Meta Image"
|
"label": "Persona Captured",
|
||||||
},
|
"read_only": 1
|
||||||
{
|
|
||||||
"description": "Common keywords that will be used for all pages",
|
|
||||||
"fieldname": "meta_keywords",
|
|
||||||
"fieldtype": "Small Text",
|
|
||||||
"label": "Meta Keywords"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_xijv",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grid_page_length": 50,
|
"grid_page_length": 50,
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-04-19 12:19:24.037931",
|
"modified": "2025-04-22 14:34:19.656896",
|
||||||
"modified_by": "sayali@frappe.io",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
|
|||||||
Reference in New Issue
Block a user