Update ParentProfile.vue
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
|
||||
<div class="mx-auto max-w-6xl px-4 py-6">
|
||||
<!-- Profile Header -->
|
||||
<div v-if="!schoolProfileNotFound" class="bg-gradient-to-r from-pink-100 to-pink-600 rounded-2xl shadow-sm border border-gray-200 p-6 -mt-4 relative">
|
||||
<div v-if="!schoolProfileNotFound" class="bg-gradient-to-r from-teal-100 to-teal-600 rounded-2xl shadow-sm border border-gray-200 p-6 -mt-4 relative">
|
||||
<div class="flex flex-col md:flex-row md:items-center gap-6">
|
||||
<div class="flex-1">
|
||||
<h2 class="text-3xl font-bold text-gray-900">{{ displayName }}</h2>
|
||||
@@ -60,8 +60,8 @@
|
||||
<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-pink-100 rounded-full flex items-center justify-center mb-6">
|
||||
<svg class="w-10 h-10 text-pink-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<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="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197m13.5 6.197h-6"/>
|
||||
</svg>
|
||||
</div>
|
||||
@@ -73,8 +73,8 @@
|
||||
заполните информацию о себе и своём ребёнке.
|
||||
</p>
|
||||
|
||||
<div class="bg-pink-50 border border-pink-100 rounded-lg p-5 mb-6 text-left">
|
||||
<h4 class="font-semibold text-pink-800 mb-3 flex items-center gap-2">
|
||||
<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>
|
||||
@@ -82,19 +82,19 @@
|
||||
</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-pink-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<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-pink-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<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-pink-500 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<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>
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<Button
|
||||
@click="toggleEdit()"
|
||||
class="bg-pink-600 hover:bg-pink-700 text-white px-8 py-3 rounded-lg font-medium transition-colors duration-200 shadow-sm hover:shadow-md"
|
||||
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">
|
||||
@@ -133,7 +133,7 @@
|
||||
<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-pink-400">
|
||||
<div class="px-6 py-4 border-b border-gray-100 bg-teal-400">
|
||||
<h3 class="text-xl font-semibold text-white">Личная информация</h3>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
@@ -188,7 +188,7 @@
|
||||
|
||||
<!-- Информация о ребенке -->
|
||||
<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-pink-400">
|
||||
<div class="px-6 py-4 border-b border-gray-100 bg-teal-400">
|
||||
<h3 class="text-xl font-semibold text-white">Информация о ребёнке</h3>
|
||||
</div>
|
||||
<div class="p-6">
|
||||
@@ -212,7 +212,7 @@
|
||||
<div class="flex items-start">
|
||||
<span class="inline-block w-48 text-gray-700 font-medium">Цели для ребёнка:</span>
|
||||
<div class="flex-1">
|
||||
<div class="p-4 bg-pink-50 rounded-lg border border-pink-100">
|
||||
<div class="p-4 bg-teal-50 rounded-lg border border-teal-100">
|
||||
<p class="text-gray-700 leading-relaxed whitespace-pre-line">{{ schoolProfile.data.goals || 'Цели не указаны' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -239,7 +239,7 @@
|
||||
<!-- EDIT MODE -->
|
||||
<div v-else class="mt-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-pink-400">
|
||||
<div class="px-6 py-4 border-b border-gray-100 bg-teal-400">
|
||||
<h3 class="text-xl font-semibold text-white">Редактирование профиля родителя</h3>
|
||||
<p class="text-sm text-gray-200 mt-1">Заполните информацию о себе и своём ребёнке</p>
|
||||
</div>
|
||||
@@ -340,7 +340,7 @@
|
||||
<Button
|
||||
@click="saveProfile"
|
||||
:loading="saving"
|
||||
class="bg-pink-400 hover:bg-pink-700 text-white px-8 py-3 rounded-lg font-medium transition-colors duration-200 flex items-center gap-2"
|
||||
class="bg-teal-400 hover:bg-teal-700 text-white px-8 py-3 rounded-lg font-medium transition-colors duration-200 flex items-center gap-2"
|
||||
>
|
||||
{{ saving ? 'Сохранение...' : 'Сохранить изменения' }}
|
||||
</Button>
|
||||
@@ -378,11 +378,11 @@
|
||||
background-color: rgba(59, 130, 246, 0.05);
|
||||
}
|
||||
|
||||
.bg-pink-50 {
|
||||
.bg-teal-50 {
|
||||
background-color: rgba(249, 168, 212, 0.1);
|
||||
}
|
||||
|
||||
.border-pink-100 {
|
||||
.border-teal-100 {
|
||||
border-color: rgba(249, 168, 212, 0.3);
|
||||
}
|
||||
|
||||
@@ -466,6 +466,26 @@ const profile = createResource({
|
||||
},
|
||||
onSuccess(data) {
|
||||
console.log('[DEBUG] Профиль загружен:', data);
|
||||
},
|
||||
onError(error) {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль пользователя: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const schoolProfile = createResource({
|
||||
url: 'frappe.client.get',
|
||||
params: {
|
||||
doctype: 'Schoolchildren Profile',
|
||||
filters: { user:user },
|
||||
},
|
||||
auto: false,
|
||||
onSuccess(data) {
|
||||
console.log('[DEBUG] Профиль школьника загружен:', data);
|
||||
},
|
||||
onError(error) {
|
||||
// Проверяем, является ли ошибка "не найдено"
|
||||
@@ -483,26 +503,6 @@ const profile = createResource({
|
||||
},
|
||||
});
|
||||
|
||||
const schoolProfile = createResource({
|
||||
url: 'frappe.client.get',
|
||||
params: {
|
||||
doctype: 'Schoolchildren Profile',
|
||||
filters: { user:user },
|
||||
},
|
||||
auto: false,
|
||||
onSuccess(data) {
|
||||
console.log('[DEBUG] Профиль школьника загружен:', data);
|
||||
},
|
||||
onError(error) {
|
||||
console.error('[DEBUG] Ошибка загрузки профиля школьника:', error);
|
||||
window.frappe?.msgprint({
|
||||
title: 'Ошибка',
|
||||
message: 'Не удалось загрузить профиль школьника: ' + (error.message || 'Неизвестная ошибка'),
|
||||
indicator: 'red',
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const form = ref({
|
||||
first_name: '',
|
||||
last_name: '',
|
||||
|
||||
Reference in New Issue
Block a user