TEST UPD
- add traslation - bug of doesntexist
This commit is contained in:
@@ -665,7 +665,7 @@ const addMyPoints = () => {
|
||||
sidebarLinks.value.push({
|
||||
label: __('My points'),
|
||||
icon: 'Award',
|
||||
to: 'mypoints',
|
||||
to: 'MyPoints',
|
||||
activeFor: [],
|
||||
})
|
||||
}
|
||||
@@ -676,7 +676,7 @@ const addLeaderBoard = () => {
|
||||
sidebarLinks.value.push({
|
||||
label: __('Leader Board'),
|
||||
icon: 'Trophy',
|
||||
to: 'leaderboard',
|
||||
to: 'LeaderBoard',
|
||||
activeFor: [],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div v-if="$user.data && isSessionUser()" class="md:ml-auto">
|
||||
<div v-if="$user.data && isSessionUser() && !schoolProfileNotFound" class="md:ml-auto">
|
||||
<Button @click="toggleEdit()" class="bg-white hover:bg-gray-100 px-5 py-2.5 rounded-lg transition-colors duration-200">
|
||||
<template #prefix>
|
||||
<Edit class="w-4 h-4 stroke-1.5" />
|
||||
@@ -54,19 +54,83 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW MODE -->
|
||||
<div v-if="!editMode" class="mt-6">
|
||||
<div v-if="schoolProfile.loading" class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- VIEW MODE -->
|
||||
<div v-if="!editMode" class="mt-6">
|
||||
<!-- Пустой профиль -->
|
||||
<div v-if="schoolProfileNotFound" class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div class="p-8 text-center">
|
||||
<div class="max-w-md mx-auto">
|
||||
<div class="mx-auto w-20 h-20 bg-teal-100 rounded-full flex items-center justify-center mb-6">
|
||||
<svg class="w-10 h-10 text-teal-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div v-else-if="schoolProfile.error" class="bg-white rounded-2xl shadow-sm border border-red-200 p-6">
|
||||
<p class="text-red-500 text-lg font-medium">Ошибка загрузки данных репетитора/эксперта: {{ schoolProfile.error.message }}</p>
|
||||
</div>
|
||||
<h3 class="text-2xl font-bold text-gray-900 mb-3">Профиль создателя курса еще не заполнен</h3>
|
||||
|
||||
<div v-else-if="schoolProfile.data" class="space-y-6">
|
||||
<p class="text-gray-600 mb-6">
|
||||
Чтобы начать создавать и проводить курсы, заполните информацию о себе.
|
||||
Это поможет студентам лучше узнать вас как преподавателя.
|
||||
</p>
|
||||
|
||||
<div class="bg-teal-50 border border-teal-100 rounded-lg p-5 mb-6 text-left">
|
||||
<h4 class="font-semibold text-teal-800 mb-3 flex items-center gap-2">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Заполнив профиль, вы сможете:
|
||||
</h4>
|
||||
<ul class="space-y-2 text-sm text-gray-700">
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Создавать и проводить собственные курсы</span>
|
||||
</li>
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Привлекать студентов с помощью подробного профиля</span>
|
||||
</li>
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Показать свою экспертизу и опыт</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@click="toggleEdit()"
|
||||
class="bg-teal-600 hover:bg-teal-700 text-white px-8 py-3 rounded-lg font-medium transition-colors duration-200 shadow-sm hover:shadow-md"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
|
||||
</svg>
|
||||
</template>
|
||||
Заполнить профиль создателя курса
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Загружающийся профиль -->
|
||||
<div v-else-if="schoolProfile.loading" class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ошибка загрузки (кроме DoesNotExistError) -->
|
||||
<div v-else-if="schoolProfile.error && !schoolProfileNotFound" class="bg-white rounded-2xl shadow-sm border border-red-200 p-6">
|
||||
<p class="text-red-500 text-lg font-medium">{{__('Error loading course creator data:')}} {{ schoolProfile.error.message }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Загруженный профиль -->
|
||||
<div v-else-if="schoolProfile.data && !schoolProfileNotFound" class="space-y-6">
|
||||
<!-- Основная информация -->
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-gray-100 bg-teal-400">
|
||||
@@ -428,6 +492,7 @@ import DOMPurify from 'dompurify'
|
||||
|
||||
const { user } = sessionStore();
|
||||
const $user = inject('$user');
|
||||
const schoolProfileNotFound = ref(false);
|
||||
|
||||
// Логирование инициализации
|
||||
console.log('[DEBUG] Инициализация компонента:', {
|
||||
@@ -486,14 +551,20 @@ const schoolProfile = createResource({
|
||||
onSuccess(data) {
|
||||
console.log('[DEBUG] Профиль школьника загружен:', data);
|
||||
},
|
||||
onError(error) {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля школьника:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль школьника: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
},
|
||||
onError(error) {
|
||||
// Проверяем, является ли ошибка "не найдено"
|
||||
if (error.exc_type === 'DoesNotExistError' || error.message?.includes('DoesNotExist')) {
|
||||
console.log('[DEBUG] Профиль школьника не найден, создаем новый');
|
||||
schoolProfileNotFound.value = true;
|
||||
} else {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля школьника:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль школьника: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const form = ref({
|
||||
@@ -697,6 +768,7 @@ async function saveProfile() {
|
||||
}
|
||||
|
||||
editMode.value = false;
|
||||
schoolProfileNotFound.value = false;
|
||||
if (window.frappe && window.frappe.msgprint) window.frappe.msgprint('Профиль сохранён');
|
||||
console.log('[DEBUG] Профиль успешно сохранён');
|
||||
} catch (e) {
|
||||
@@ -824,7 +896,7 @@ watch(
|
||||
() => schoolProfile.data,
|
||||
(newData, oldData) => {
|
||||
console.log('[DEBUG] Изменение schoolProfile.data:', { old: oldData, new: newData });
|
||||
if (newData && !editMode.value) {
|
||||
if (newData && !editMode.value && !schoolProfileNotFound.value) {
|
||||
console.log('[DEBUG] Заполнение формы из schoolProfile');
|
||||
fillFormFromProfile();
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<div class="flex-1">
|
||||
<h2 class="text-3xl font-bold text-gray-900">{{ displayName }}</h2>
|
||||
<div
|
||||
v-if="profile.data.headline"
|
||||
v-if="profile.data.bio"
|
||||
v-html="
|
||||
DOMPurify.sanitize(decodeEntities(profile.data.headline), {
|
||||
DOMPurify.sanitize(decodeEntities(profile.data.bio), {
|
||||
ALLOWED_TAGS: [
|
||||
'b',
|
||||
'i',
|
||||
@@ -43,7 +43,7 @@
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div v-if="$user.data && isSessionUser()" class="md:ml-auto">
|
||||
<div v-if="$user.data && isSessionUser() && !schoolProfileNotFound" class="md:ml-auto">
|
||||
<Button @click="toggleEdit()" class="bg-white hover:bg-gray-100 px-5 py-2.5 rounded-lg transition-colors duration-200">
|
||||
<template #prefix>
|
||||
<Edit class="w-4 h-4 stroke-1.5" />
|
||||
@@ -113,15 +113,6 @@
|
||||
</template>
|
||||
Заполнить профиль школьника
|
||||
</Button>
|
||||
|
||||
<div class="mt-4">
|
||||
<button
|
||||
@click="editMode = true"
|
||||
class="text-sm text-teal-600 hover:text-teal-800 font-medium underline transition-colors"
|
||||
>
|
||||
Или заполнить позже
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div v-if="$user.data && isSessionUser()" class="md:ml-auto">
|
||||
<div v-if="$user.data && isSessionUser() && !schoolProfileNotFound" class="md:ml-auto">
|
||||
<Button @click="toggleEdit()" class="bg-white hover:bg-gray-100 px-5 py-2.5 rounded-lg transition-colors duration-200">
|
||||
<template #prefix>
|
||||
<Edit class="w-4 h-4 stroke-1.5" />
|
||||
@@ -54,19 +54,83 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VIEW MODE -->
|
||||
<div v-if="!editMode" class="mt-6">
|
||||
<div v-if="schoolProfile.loading" class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- VIEW MODE -->
|
||||
<div v-if="!editMode" class="mt-6">
|
||||
<!-- Пустой профиль -->
|
||||
<div v-if="schoolProfileNotFound" class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div class="p-8 text-center">
|
||||
<div class="max-w-md mx-auto">
|
||||
<div class="mx-auto w-20 h-20 bg-teal-100 rounded-full flex items-center justify-center mb-6">
|
||||
<svg class="w-10 h-10 text-teal-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div v-else-if="schoolProfile.error" class="bg-white rounded-2xl shadow-sm border border-red-200 p-6">
|
||||
<p class="text-red-500 text-lg font-medium">{{__('Error loading student data:')}} {{ schoolProfile.error.message }}</p>
|
||||
</div>
|
||||
<h3 class="text-2xl font-bold text-gray-900 mb-3">Профиль студента еще не заполнен</h3>
|
||||
|
||||
<div v-else-if="schoolProfile.data" class="space-y-6">
|
||||
<p class="text-gray-600 mb-6">
|
||||
Чтобы получить доступ ко всем возможностям платформы, заполните информацию о себе.
|
||||
Это поможет наставникам лучше понять ваши интересы и цели.
|
||||
</p>
|
||||
|
||||
<div class="bg-teal-50 border border-teal-100 rounded-lg p-5 mb-6 text-left">
|
||||
<h4 class="font-semibold text-teal-800 mb-3 flex items-center gap-2">
|
||||
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
Заполнив профиль, вы получите:
|
||||
</h4>
|
||||
<ul class="space-y-2 text-sm text-gray-700">
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Персонализированные рекомендации по обучению</span>
|
||||
</li>
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Подбор наставников по вашим интересам</span>
|
||||
</li>
|
||||
<li class="flex items-start gap-2">
|
||||
<svg class="w-4 h-4 text-teal-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
<span>Доступ к закрытым мероприятиям и курсам</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
@click="toggleEdit()"
|
||||
class="bg-teal-600 hover:bg-teal-700 text-white px-8 py-3 rounded-lg font-medium transition-colors duration-200 shadow-sm hover:shadow-md"
|
||||
>
|
||||
<template #prefix>
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
|
||||
</svg>
|
||||
</template>
|
||||
Заполнить профиль студента
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Загружающийся профиль -->
|
||||
<div v-else-if="schoolProfile.loading" class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
|
||||
<div class="flex items-center justify-center py-12">
|
||||
<div class="animate-spin rounded-full h-12 w-12 border-b-2 border-primary-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ошибка загрузки (кроме DoesNotExistError) -->
|
||||
<div v-else-if="schoolProfile.error && !schoolProfileNotFound" class="bg-white rounded-2xl shadow-sm border border-red-200 p-6">
|
||||
<p class="text-red-500 text-lg font-medium">{{__('Error loading student data:')}} {{ schoolProfile.error.message }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Загруженный профиль -->
|
||||
<div v-else-if="schoolProfile.data && !schoolProfileNotFound" class="space-y-6">
|
||||
<!-- Основная информация -->
|
||||
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 overflow-hidden">
|
||||
<div class="px-6 py-4 border-b border-gray-100 bg-teal-400">
|
||||
@@ -453,6 +517,7 @@ import DOMPurify from 'dompurify'
|
||||
|
||||
const { user } = sessionStore();
|
||||
const $user = inject('$user');
|
||||
const schoolProfileNotFound = ref(false);
|
||||
|
||||
// Логирование инициализации
|
||||
console.log('[DEBUG] Инициализация компонента:', {
|
||||
@@ -511,14 +576,20 @@ const schoolProfile = createResource({
|
||||
onSuccess(data) {
|
||||
console.log('[DEBUG] Профиль школьника загружен:', data);
|
||||
},
|
||||
onError(error) {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля школьника:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль школьника: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
},
|
||||
onError(error) {
|
||||
// Проверяем, является ли ошибка "не найдено"
|
||||
if (error.exc_type === 'DoesNotExistError' || error.message?.includes('DoesNotExist')) {
|
||||
console.log('[DEBUG] Профиль школьника не найден, создаем новый');
|
||||
schoolProfileNotFound.value = true;
|
||||
} else {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля школьника:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль школьника: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const form = ref({
|
||||
@@ -725,6 +796,7 @@ async function saveProfile() {
|
||||
}
|
||||
|
||||
editMode.value = false;
|
||||
schoolProfileNotFound.value = false;
|
||||
if (window.frappe && window.frappe.msgprint) window.frappe.msgprint('Профиль сохранён');
|
||||
console.log('[DEBUG] Профиль успешно сохранён');
|
||||
} catch (e) {
|
||||
@@ -852,7 +924,7 @@ watch(
|
||||
() => schoolProfile.data,
|
||||
(newData, oldData) => {
|
||||
console.log('[DEBUG] Изменение schoolProfile.data:', { old: oldData, new: newData });
|
||||
if (newData && !editMode.value) {
|
||||
if (newData && !editMode.value && !schoolProfileNotFound.value) {
|
||||
console.log('[DEBUG] Заполнение формы из schoolProfile');
|
||||
fillFormFromProfile();
|
||||
}
|
||||
|
||||
@@ -7757,3 +7757,20 @@ msgstr ""
|
||||
#: frontend/src/pages/StudentProfile.vue:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
#: frontend/src/pages/AppSidebar.vue:730
|
||||
msgid "Student Profile"
|
||||
msgstr "Профиль студента"
|
||||
|
||||
#: frontend/src/pages/AppSidebar.vue:737
|
||||
msgid "Schoolchildren Profile"
|
||||
msgstr "Профиль школьника"
|
||||
|
||||
#: frontend/src/pages/AppSidebar.vue:744
|
||||
msgid "Course Creator"
|
||||
msgstr "Профиль преподавателя"
|
||||
|
||||
#: frontend/src/pages/AppSidebar.vue:751
|
||||
msgid "Parent Profile"
|
||||
msgstr "Профиль родителя"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user