<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>סדנת נחשון | כרטיס מעקב אישי</title>
<!-- טעינת Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- טעינת גופן Heebo המודרני והקריא לעברית -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<!-- טעינת Chart.js לגרף התקדמות אוטומטי -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<!-- טעינת אייקונים מ-Lucide -->
<script src="https://unpkg.com/lucide@latest"></script>
<style>
body {
font-family: 'Heebo', sans-serif;
background-color: #f8fafc;
color: #0f172a;
}
/* עיצוב מותאם לסליידר של הציונים */
input[type=range] {
-webkit-appearance: none;
width: 100%;
background: transparent;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
height: 22px;
width: 22px;
border-radius: 50%;
background: #ea580c;
cursor: pointer;
margin-top: -8px;
box-shadow: 0 2px 6px rgba(234, 88, 12, 0.4);
transition: transform 0.15s ease;
}
input[type=range]::-webkit-slider-thumb:hover {
transform: scale(1.15);
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 6px;
cursor: pointer;
background: #fed7aa;
border-radius: 999px;
}
</style>
</head>
<body class="min-h-screen flex flex-col">
<!-- סרגל עליון -->
<header class="bg-white border-b border-slate-200 sticky top-0 z-20 shadow-sm">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-4 flex flex-col sm:flex-row justify-between items-center gap-4">
<div>
<p class="text-xs font-semibold text-slate-500 tracking-wide">סדנת נחשון | מעקב אישי</p>
<h1 class="text-2xl sm:text-3xl font-extrabold text-slate-900">כרטיס המעקב שלי</h1>
</div>
<div class="flex items-center gap-3 w-full sm:w-auto justify-end">
<span id="logsCountBadge" class="bg-slate-100 text-slate-700 font-bold text-xs sm:text-sm px-3.5 py-2 rounded-xl border border-slate-200">
0 תיעודים נשמרו
</span>
<button id="resetAllBtn" class="text-xs text-slate-400 hover:text-rose-600 px-2 py-1.5 rounded-lg transition" title="איפוס נתונים">
איפוס הכל
</button>
</div>
</div>
</header>
<!-- הודעת מערכת (במקום alert) -->
<div id="toastNotification" class="fixed bottom-5 left-5 z-50 transform translate-y-20 opacity-0 transition-all duration-300 pointer-events-none">
<div class="bg-slate-900 text-white px-5 py-3 rounded-2xl shadow-xl flex items-center gap-3 border border-slate-700">
<div class="bg-emerald-500/20 text-emerald-400 p-1.5 rounded-full">
<i data-lucide="check-circle-2" class="w-5 h-5"></i>
</div>
<span id="toastMessage" class="text-sm font-medium">התיעוד נשמר והגרף התעדכן!</span>
</div>
</div>
<!-- תוכן ראשי -->
<main class="flex-grow max-w-6xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8 space-y-8">
<!-- כרטיסי סיכום עליונים: יעדים פעילים + יעדים כלליים -->
<section class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div class="bg-white rounded-2xl p-5 border border-slate-200 border-t-4 border-t-orange-600 shadow-sm flex items-center justify-between">
<div class="flex items-center gap-4">
<div class="w-12 h-12 rounded-2xl bg-orange-50 text-orange-600 flex items-center justify-center shrink-0">
<i data-lucide="folder-kanban" class="w-6 h-6"></i>
</div>
<div>
<h3 class="font-bold text-slate-900 text-base">יעדים פעילים</h3>
<p class="text-xs sm:text-sm text-slate-500">תיקיות מעקב אישיות פתוחות</p>
</div>
</div>
<span id="activeGoalsCount" class="text-3xl font-extrabold text-orange-600 bg-orange-50 px-4 py-1.5 rounded-xl border border-orange-100">0</span>
</div>
<div id="generalGoalsCard" onclick="selectGeneralFolder()" class="bg-white rounded-2xl p-5 border border-slate-200 border-t-4 border-t-purple-600 shadow-sm flex items-center justify-between cursor-pointer hover:border-purple-300 hover:shadow-md transition">
<div class="flex items-center gap-4">
<div class="w-12 h-12 rounded-2xl bg-purple-50 text-purple-600 flex items-center justify-center shrink-0">
<i data-lucide="layers" class="w-6 h-6"></i>
</div>
<div>
<h3 class="font-bold text-slate-900 text-base">יעדים כלליים</h3>
<p class="text-xs sm:text-sm text-slate-500">מבט-על וממוצע כללי של כל התיקיות</p>
</div>
</div>
<div class="text-left">
<span id="generalGoalsAvgStat" class="text-2xl font-extrabold text-purple-600 block">-</span>
<span class="text-[11px] text-purple-500 font-semibold">לחץ לצפייה</span>
</div>
</div>
</section>
<!-- אזור עבודה מרכזי: 2 עמודות -->
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
<!-- עמודה ימנית (5 טורים): הוספת יעד + רשימת התיקיות עם תאריך -->
<div class="lg:col-span-5 space-y-6">
<!-- יצירת תיקיית יעד חדשה -->
<div class="bg-white rounded-3xl p-6 border border-slate-200 border-t-4 border-t-blue-600 shadow-sm">
<div class="flex items-center gap-3 mb-4">
<div class="w-9 h-9 rounded-full bg-blue-50 text-blue-600 flex items-center justify-center">
<i data-lucide="folder-plus" class="w-5 h-5"></i>
</div>
<div>
<h2 class="text-lg font-bold text-slate-900">פתיחת תיקיית יעד חדשה</h2>
<p class="text-xs text-slate-500">כל יעד שתוסיף יהפוך לתיקייה אישית עם תאריך</p>
</div>
</div>
<form id="addGoalForm" class="flex gap-2 mb-4">
<input type="text" id="newGoalInput" placeholder="שם היעד החדש (למשל: התמדה באימונים)..."
class="flex-grow bg-slate-50 border border-slate-200 rounded-xl px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition" required>
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white font-semibold px-4 py-2.5 rounded-xl text-sm flex items-center gap-1.5 transition shrink-0">
<i data-lucide="folder-plus" class="w-4 h-4"></i>
<span>הוסף תיקייה</span>
</button>
</form>
<!-- הצעות מהירות -->
<div class="flex flex-wrap items-center gap-1.5 text-xs">
<span class="text-slate-400 ml-1">מהיר:</span>
<button type="button" onclick="quickAddGoal('עמידה ביעדי למידה')" class="bg-slate-100 hover:bg-blue-50 hover:text-blue-700 text-slate-600 px-2.5 py-1 rounded-lg transition">+ למידה</button>
<button type="button" onclick="quickAddGoal('פעילות גופנית')" class="bg-slate-100 hover:bg-blue-50 hover:text-blue-700 text-slate-600 px-2.5 py-1 rounded-lg transition">+ כושר</button>
<button type="button" onclick="quickAddGoal('יוזמה אישית')" class="bg-slate-100 hover:bg-blue-50 hover:text-blue-700 text-slate-600 px-2.5 py-1 rounded-lg transition">+ יוזמה</button>
<button type="button" onclick="quickAddGoal('ניהול זמן')" class="bg-slate-100 hover:bg-blue-50 hover:text-blue-700 text-slate-600 px-2.5 py-1 rounded-lg transition">+ ניהול זמן</button>
</div>
</div>
<!-- רשימת תיקיות היעדים -->
<div class="bg-white rounded-3xl p-6 border border-slate-200 shadow-sm space-y-4">
<div class="flex items-center justify-between">
<h2 class="text-lg font-bold text-slate-900 flex items-center gap-2">
<i data-lucide="folders" class="w-5 h-5 text-amber-500"></i>
<span>תיקיות היעדים שלי</span>
</h2>
<span class="text-xs text-slate-400">בחר תיקייה לפתיחה</span>
</div>
<div id="foldersListContainer" class="space-y-3">
<!-- ירונדר דינמית -->
</div>
</div>
</div>
<!-- עמודה שמאלית (7 טורים): תוכן התיקייה הפתוחה (סליידר + גרף התקדמות + רפלקציה) או יעדים כלליים -->
<div class="lg:col-span-7">
<div id="folderWorkspaceContainer" class="bg-white rounded-3xl p-6 sm:p-7 border border-slate-200 border-t-4 border-t-amber-500 shadow-sm min-h-[460px] flex flex-col justify-between">
<!-- ירונדר דינמית לפי התיקייה הנבחרת -->
</div>
</div>
</div>
</main>
<script>
lucide.createIcons();
const GOAL_COLORS = [
'#ea580c', // כתום
'#2563eb', // כחול
'#10b981', // ירוק אמרלד
'#ec4899', // ורוד
'#f59e0b', // ענבר
'#06b6d4' // ציאן
];
// --- מצב האפליקציה ---
// כל יעד הוא אובייקט תיקייה עם תאריך יצירה ורשימת תיעודים משלו
let goals = JSON.parse(localStorage.getItem('nahshon_folder_goals')) || [];
// מזהה התיקייה הפתוחה כרגע (null = מצב סגור/ממתין לבחירה, 'GENERAL' או id של תיקיית יעד)
let selectedFolderId = goals.length > 0 ? goals[0].id : null;
let draftScores = {};
let activeChart = null;
function saveToStorage() {
localStorage.setItem('nahshon_folder_goals', JSON.stringify(goals));
}
function formatHebrewDate(dateObj = new Date()) {
return dateObj.toLocaleDateString('he-IL', {
day: '2-digit',
month: '2-digit',
year: 'numeric'
});
}
function formatHebrewDateTime(dateObj = new Date()) {
return dateObj.toLocaleDateString('he-IL', {
day: '2-digit',
month: '2-digit'
}) + ' ' + dateObj.toLocaleTimeString('he-IL', {
hour: '2-digit',
minute: '2-digit'
});
}
// --- יצירה, כניסה ומחיקה של תיקיות יעד ---
function addGoalFolder(title) {
const cleanTitle = title.trim();
if (!cleanTitle) return;
if (goals.some(g => g.title === cleanTitle)) {
showToast('כבר קיימת תיקייה בשם הזה');
return;
}
const newId = 'folder_' + Date.now() + '_' + Math.floor(Math.random() * 1000);
const color = GOAL_COLORS[goals.length % GOAL_COLORS.length];
const createdDate = formatHebrewDate(new Date());
const newFolder = {
id: newId,
title: cleanTitle,
color: color,
createdDate: createdDate,
records: [] // כל תיעוד: { date, score, reflection }
};
goals.push(newFolder);
draftScores[newId] = 7;
selectedFolderId = newId; // כניסה אוטומטית לתיקייה החדשה
saveToStorage();
renderAll();
showToast(`נפתחה תיקייה חדשה: "${cleanTitle}"`);
}
window.quickAddGoal = function(title) {
addGoalFolder(title);
};
window.openFolder = function(folderId) {
selectedFolderId = folderId;
renderAll();
};
window.closeCurrentFolder = function() {
selectedFolderId = null;
renderAll();
};
window.selectGeneralFolder = function() {
selectedFolderId = 'GENERAL';
renderAll();
};
window.deleteGoalFolder = function(event, folderId) {
event.stopPropagation();
goals = goals.filter(g => g.id !== folderId);
delete draftScores[folderId];
if (selectedFolderId === folderId) {
selectedFolderId = goals.length > 0 ? goals[0].id : null;
}
saveToStorage();
renderAll();
showToast('התיקייה נמחקה');
};
document.getElementById('addGoalForm').addEventListener('submit', function(e) {
e.preventDefault();
const input = document.getElementById('newGoalInput');
addGoalFolder(input.value);
input.value = '';
});
// --- עדכון סליידר בתוך תיקייה ---
window.handleFolderSliderChange = function(folderId, val) {
draftScores[folderId] = Number(val);
const badge = document.getElementById('folderDraftScoreBadge');
if (badge) {
badge.textContent = `${val} / 10`;
badge.className = 'px-3 py-1.5 rounded-xl text-sm font-extrabold ' +
(val >= 8 ? 'bg-emerald-100 text-emerald-800' :
val <= 4 ? 'bg-rose-100 text-rose-800' : 'bg-orange-100 text-orange-800');
}
};
// --- שמירת תיעוד בתוך התיקייה הפתוחה ---
window.submitFolderRecord = function(folderId) {
const folder = goals.find(g => g.id === folderId);
if (!folder) return;
const score = Number(draftScores[folderId] !== undefined ? draftScores[folderId] : 7);
const reflectionEl = document.getElementById('folderReflectionInput');
const reflection = reflectionEl ? reflectionEl.value.trim() : '';
folder.records.push({
id: 'rec_' + Date.now(),
date: formatHebrewDateTime(new Date()),
shortDate: formatHebrewDate(new Date()),
score: score,
reflection: reflection
});
saveToStorage();
renderAll();
showToast(`התיעוד נשמר בתיקיית "${folder.title}" והגרף התעדכן!`);
};
window.appendFolderPrompt = function(text) {
const el = document.getElementById('folderReflectionInput');
if (!el) return;
const prefix = el.value.length > 0 && !el.value.endsWith('\n') ? '\n' : '';
el.value = el.value + prefix + text;
el.focus();
};
document.getElementById('resetAllBtn').addEventListener('click', function() {
goals = [];
draftScores = {};
selectedFolderId = null;
saveToStorage();
renderAll();
showToast('כל התיקיות אופסו');
});
// --- חישוב נתונים כלליים ---
function getAllRecordsCount() {
return goals.reduce((acc, g) => acc + g.records.length, 0);
}
function getOverallAverage() {
let sum = 0;
let count = 0;
goals.forEach(g => {
g.records.forEach(r => {
sum += r.score;
count++;
});
});
return count === 0 ? null : (sum / count).toFixed(1);
}
// --- רינדור מלא ---
function renderAll() {
const totalRecords = getAllRecordsCount();
const overallAvg = getOverallAverage();
document.getElementById('activeGoalsCount').textContent = goals.length;
document.getElementById('logsCountBadge').textContent = `${totalRecords} תיעודים נשמרו`;
document.getElementById('generalGoalsAvgStat').textContent = overallAvg !== null ? overallAvg : '-';
// סימון כרטיס יעדים כלליים אם נבחר
const generalCard = document.getElementById('generalGoalsCard');
if (selectedFolderId === 'GENERAL') {
generalCard.classList.add('ring-2', 'ring-purple-500', 'bg-purple-50/30');
} else {
generalCard.classList.remove('ring-2', 'ring-purple-500', 'bg-purple-50/30');
}
renderFoldersSidebar();
renderWorkspace();
lucide.createIcons();
}
// רינדור רשימת התיקיות עם תאריך ליד כל תיקייה
function renderFoldersSidebar() {
const container = document.getElementById('foldersListContainer');
container.innerHTML = '';
if (goals.length === 0) {
container.innerHTML = `
<div class="text-center py-8 bg-slate-50 rounded-2xl border border-dashed border-slate-300">
<i data-lucide="folder-open" class="w-8 h-8 text-slate-300 mx-auto mb-2"></i>
<p class="text-sm font-bold text-slate-600">אין עדיין תיקיות יעד</p>
<p class="text-xs text-slate-400 mt-1">הוסף יעד למעלה כדי ליצור תיקייה ראשונה</p>
</div>
`;
return;
}
goals.forEach(folder => {
const isSelected = selectedFolderId === folder.id;
const lastRecord = folder.records.length > 0 ? folder.records[folder.records.length - 1] : null;
const displayDate = lastRecord ? lastRecord.shortDate : folder.createdDate;
const folderBtn = document.createElement('div');
folderBtn.onclick = () => openFolder(folder.id);
folderBtn.className = `p-4 rounded-2xl border transition cursor-pointer flex items-center justify-between gap-3 ${
isSelected
? 'bg-amber-50/70 border-amber-400 shadow-sm ring-1 ring-amber-400'
: 'bg-slate-50 hover:bg-white border-slate-200 hover:border-amber-300'
}`;
folderBtn.innerHTML = `
<div class="flex items-center gap-3 min-w-0">
<div class="w-11 h-11 rounded-2xl flex items-center justify-center shrink-0 transition"
style="background-color: ${folder.color}15; color: ${folder.color}">
<i data-lucide="${isSelected ? 'folder-open' : 'folder'}" class="w-6 h-6"></i>
</div>
<div class="min-w-0">
<h3 class="font-bold text-slate-900 text-sm sm:text-base truncate">${escapeHtml(folder.title)}</h3>
<div class="flex items-center gap-2 text-xs text-slate-500 mt-0.5">
<span class="inline-flex items-center gap-1 bg-white px-2 py-0.5 rounded-md border border-slate-200 text-slate-600 font-medium">
<i data-lucide="calendar" class="w-3 h-3 text-slate-400"></i>
${displayDate}
</span>
<span>• ${folder.records.length} תיעודים</span>
</div>
</div>
</div>
<div class="flex items-center gap-1.5 shrink-0">
${lastRecord ? `<span class="text-xs font-extrabold px-2.5 py-1 rounded-lg bg-white border border-slate-200 text-slate-700">${lastRecord.score}/10</span>` : ''}
<span class="text-[11px] font-bold px-2.5 py-1 rounded-lg ${isSelected ? 'bg-amber-500 text-white' : 'bg-white border border-slate-200 text-slate-600 hover:border-amber-400'}">
+ רישום
</span>
<button type="button" onclick="deleteGoalFolder(event, '${folder.id}')" class="p-1.5 text-slate-400 hover:text-rose-600 rounded-lg transition" title="מחק תיקייה">
<i data-lucide="trash-2" class="w-4 h-4"></i>
</button>
</div>
`;
container.appendChild(folderBtn);
});
}
// רינדור האזור המרכזי: תוכן התיקייה הנבחרת או יעדים כלליים
function renderWorkspace() {
const workspace = document.getElementById('folderWorkspaceContainer');
if (activeChart) {
activeChart.destroy();
activeChart = null;
}
// מצב 0: אף תיקייה לא פתוחה כרגע
if (!selectedFolderId) {
workspace.className = 'bg-white rounded-3xl p-6 sm:p-7 border border-slate-200 border-t-4 border-t-amber-500 shadow-sm min-h-[460px] flex flex-col items-center justify-center text-center';
workspace.style.borderTopColor = '';
workspace.innerHTML = `
<div class="max-w-sm space-y-3 py-12">
<div class="w-16 h-16 rounded-3xl bg-amber-50 text-amber-500 flex items-center justify-center mx-auto">
<i data-lucide="folder" class="w-8 h-8"></i>
</div>
<h2 class="text-xl font-extrabold text-slate-900">בחר תיקיית יעד או צור חדשה</h2>
<p class="text-sm text-slate-500 leading-relaxed">
כל תיקייה מכילה בתוכה את סליידר הדירוג, תיבת הרפלקציה וגרף ההתקדמות האישי של אותו יעד.
</p>
</div>
`;
return;
}
// מצב 1: תצוגת "יעדים כלליים"
if (selectedFolderId === 'GENERAL') {
workspace.className = 'bg-white rounded-3xl p-6 sm:p-7 border border-slate-200 border-t-4 border-t-purple-600 shadow-sm space-y-6';
workspace.style.borderTopColor = '';
if (goals.length === 0) {
workspace.innerHTML = `
<div class="text-center py-16">
<div class="w-14 h-14 rounded-2xl bg-purple-50 text-purple-600 flex items-center justify-center mx-auto mb-3">
<i data-lucide="layers" class="w-7 h-7"></i>
</div>
<h2 class="text-xl font-bold text-slate-900 mb-1">יעדים כלליים</h2>
<p class="text-sm text-slate-500 max-w-md mx-auto">כאן ירוכזו כל התיקיות והממוצע הכללי שלך. התחל בהוספת תיקיית יעד ראשונה מצד ימין.</p>
</div>
`;
return;
}
workspace.innerHTML = `
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-slate-100">
<div class="flex items-center gap-3">
<div class="w-11 h-11 rounded-2xl bg-purple-50 text-purple-600 flex items-center justify-center">
<i data-lucide="layers" class="w-6 h-6"></i>
</div>
<div>
<h2 class="text-xl font-extrabold text-slate-900">יעדים כלליים - מבט מרוכז</h2>
<p class="text-xs text-slate-500">השוואת התקדמות בין כל תיקיות היעדים הפעילות</p>
</div>
</div>
<button type="button" onclick="closeCurrentFolder()" class="text-xs font-semibold text-slate-500 hover:text-slate-800 bg-slate-100 hover:bg-slate-200 px-3 py-1.5 rounded-xl transition self-start sm:self-auto flex items-center gap-1">
<i data-lucide="x" class="w-3.5 h-3.5"></i>
<span>סגור תצוגה</span>
</button>
</div>
<div class="relative h-64 w-full">
<canvas id="workspaceChart"></canvas>
</div>
<div class="space-y-3 pt-2">
<h3 class="text-sm font-bold text-slate-700">סיכום לפי תיקיות:</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
${goals.map(g => {
const avg = g.records.length > 0
? (g.records.reduce((s, r) => s + r.score, 0) / g.records.length).toFixed(1)
: '-';
return `
<div onclick="openFolder('${g.id}')" class="p-3.5 rounded-2xl bg-slate-50 hover:bg-amber-50/50 border border-slate-200 cursor-pointer transition flex items-center justify-between">
<div class="flex items-center gap-2.5 min-w-0">
<i data-lucide="folder" class="w-5 h-5 shrink-0" style="color: ${g.color}"></i>
<div class="truncate">
<p class="font-bold text-sm text-slate-800 truncate">${escapeHtml(g.title)}</p>
<p class="text-[11px] text-slate-400">נפתח ב-${g.createdDate}</p>
</div>
</div>
<span class="font-extrabold text-sm px-2.5 py-1 rounded-lg bg-white border border-slate-200 text-slate-800 shrink-0">ממוצע: ${avg}</span>
</div>
`;
}).join('')}
</div>
</div>
`;
renderGeneralChart();
return;
}
// מצב 2: תצוגה בתוך תיקיית יעד ספציפית (סליידר + גרף התקדמות + רפלקציה)
const folder = goals.find(g => g.id === selectedFolderId);
if (!folder) return;
if (draftScores[folder.id] === undefined) draftScores[folder.id] = 7;
const currentScore = draftScores[folder.id];
const folderAvg = folder.records.length > 0
? (folder.records.reduce((s, r) => s + r.score, 0) / folder.records.length).toFixed(1)
: '-';
workspace.className = 'bg-white rounded-3xl p-6 sm:p-7 border border-slate-200 border-t-4 shadow-sm space-y-6';
workspace.style.borderTopColor = folder.color;
workspace.innerHTML = `
<!-- כותרת התיקייה ותאריך -->
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-3 pb-4 border-b border-slate-100">
<div class="flex items-center gap-3">
<div class="w-12 h-12 rounded-2xl flex items-center justify-center shrink-0" style="background-color: ${folder.color}15; color: ${folder.color}">
<i data-lucide="folder-open" class="w-6 h-6"></i>
</div>
<div>
<div class="flex items-center gap-2 flex-wrap">
<h2 class="text-xl font-extrabold text-slate-900">${escapeHtml(folder.title)}</h2>
<span class="inline-flex items-center gap-1 text-xs bg-slate-100 text-slate-600 px-2.5 py-0.5 rounded-lg font-medium">
<i data-lucide="calendar" class="w-3.5 h-3.5"></i>
${folder.createdDate}
</span>
</div>
<p class="text-xs text-slate-500 mt-0.5">תוכן תיקייה: דירוג ביצוע, רפלקציה וגרף התקדמות אישי</p>
</div>
</div>
<div class="flex items-center gap-2 self-start sm:self-auto">
<div class="bg-slate-50 px-3.5 py-1.5 rounded-xl border border-slate-200 text-center">
<span class="text-[11px] text-slate-500 block">ממוצע בתיקייה</span>
<span class="text-lg font-extrabold text-slate-900">${folderAvg}</span>
</div>
<button type="button" onclick="closeCurrentFolder()" class="p-2 text-slate-400 hover:text-slate-700 bg-slate-100 hover:bg-slate-200 rounded-xl transition" title="סגור תיקייה">
<i data-lucide="x" class="w-4 h-4"></i>
</button>
</div>
</div>
<!-- 1. הסליידר בתוך התיקייה -->
<div class="p-5 rounded-2xl bg-slate-50 border border-slate-200/90 space-y-4">
<div class="flex justify-between items-center border-b border-slate-200/70 pb-3">
<div class="flex items-center gap-2">
<span class="w-6 h-6 rounded-lg bg-emerald-100 text-emerald-700 flex items-center justify-center font-extrabold text-xs">+</span>
<span class="font-extrabold text-slate-900 text-sm sm:text-base">הוספת רישום #${folder.records.length + 1} לתיקייה</span>
</div>
<span class="text-xs text-slate-500 bg-white px-2.5 py-1 rounded-lg border border-slate-200">${formatHebrewDate(new Date())}</span>
</div>
<div class="flex justify-between items-center">
<span class="font-bold text-slate-700 text-sm">דרג את הביצוע שלך ברישום זה (1 עד 10):</span>
<span id="folderDraftScoreBadge" class="px-3 py-1.5 rounded-xl text-sm font-extrabold ${
currentScore >= 8 ? 'bg-emerald-100 text-emerald-800' :
currentScore <= 4 ? 'bg-rose-100 text-rose-800' : 'bg-orange-100 text-orange-800'
}">${currentScore} / 10</span>
</div>
<div class="flex items-center gap-3">
<span class="text-xs text-slate-400 font-bold">1</span>
<input type="range" min="1" max="10" value="${currentScore}"
oninput="handleFolderSliderChange('${folder.id}', this.value)"
class="flex-grow">
<span class="text-xs text-slate-400 font-bold">10</span>
</div>
<!-- תיבת רפלקציה לאחר השלמת הדירוג -->
<div class="pt-3 border-t border-slate-200/80 space-y-2.5">
<div class="flex items-center justify-between flex-wrap gap-2">
<label class="text-xs font-bold text-slate-700 flex items-center gap-1.5">
<i data-lucide="file-edit" class="w-4 h-4 text-emerald-600"></i>
<span>רפלקציה לאחר השלמת התיעוד:</span>
</label>
<div class="flex gap-1.5">
<button type="button" onclick="appendFolderPrompt('מה עבד לי טוב? ')" class="text-[11px] bg-white hover:bg-emerald-50 text-emerald-700 px-2 py-1 rounded-md border border-slate-200 transition">+ מה עבד טוב</button>
<button type="button" onclick="appendFolderPrompt('מה אקח להמשך? ')" class="text-[11px] bg-white hover:bg-emerald-50 text-emerald-700 px-2 py-1 rounded-md border border-slate-200 transition">+ להמשך</button>
</div>
</div>
<textarea id="folderReflectionInput" rows="2"
placeholder="כתוב כאן תובנה קצרה על ההישג בתיקייה זו..."
class="w-full bg-white border border-slate-200 rounded-xl p-3 text-sm text-slate-800 focus:outline-none focus:ring-2 focus:ring-emerald-500 transition resize-none"></textarea>
</div>
<button type="button" onclick="submitFolderRecord('${folder.id}')"
class="w-full bg-emerald-600 hover:bg-emerald-700 text-white font-bold py-3 px-5 rounded-xl shadow-sm transition flex items-center justify-center gap-2 text-sm">
<i data-lucide="plus-circle" class="w-4 h-4"></i>
<span>הכנס רישום #${folder.records.length + 1} לתיקייה ועדכן גרף</span>
</button>
</div>
<!-- 2. גרף ההתקדמות של התיקייה -->
<div class="space-y-3">
<div class="flex items-center justify-between">
<h3 class="font-bold text-slate-900 text-base flex items-center gap-2">
<i data-lucide="trending-up" class="w-5 h-5 text-purple-600"></i>
<span>גרף התקדמות - ${escapeHtml(folder.title)}</span>
</h3>
<span class="text-xs text-slate-400">${folder.records.length} תיעודים</span>
</div>
<div class="relative h-56 w-full">
<canvas id="workspaceChart"></canvas>
${folder.records.length === 0 ? `
<div class="absolute inset-0 bg-slate-50/90 rounded-2xl border border-dashed border-slate-300 flex flex-col items-center justify-center text-center p-4">
<p class="font-bold text-slate-700 text-sm">הגרף של תיקייה זו מוכן לתיעוד הראשון</p>
<p class="text-xs text-slate-500 mt-1">הזז את הסליידר למעלה ולחץ על "שמור תיעוד בתיקייה"</p>
</div>
` : ''}
</div>
</div>
<!-- היסטוריית תיעודים ורפלקציות בתוך התיקייה -->
${folder.records.length > 0 ? `
<div class="space-y-2 pt-2 border-t border-slate-100">
<h4 class="text-xs font-bold text-slate-500">תיעודים קודמים בתיקייה זו:</h4>
<div class="space-y-2 max-h-44 overflow-y-auto pr-1">
${[...folder.records].reverse().map((r, i) => `
<div class="p-3 rounded-xl bg-slate-50 border border-slate-200/70 text-xs space-y-1">
<div class="flex justify-between items-center">
<span class="font-bold text-slate-700">תיעוד #${folder.records.length - i} • <span class="text-slate-400 font-normal">${r.date}</span></span>
<span class="font-extrabold px-2 py-0.5 rounded bg-white border border-slate-200">${r.score}/10</span>
</div>
${r.reflection ? `<p class="text-slate-600 leading-relaxed">"${escapeHtml(r.reflection)}"</p>` : ''}
</div>
`).join('')}
</div>
</div>
` : ''}
`;
if (folder.records.length > 0) {
renderSingleFolderChart(folder);
}
}
function renderSingleFolderChart(folder) {
const ctx = document.getElementById('workspaceChart');
if (!ctx) return;
const labels = folder.records.map((r, idx) => `תיעוד ${idx + 1} (${r.shortDate})`);
const dataPoints = folder.records.map(r => r.score);
activeChart = new Chart(ctx.getContext('2d'), {
type: 'line',
data: {
labels: labels,
datasets: [{
label: folder.title,
data: dataPoints,
borderColor: folder.color,
backgroundColor: folder.color + '20',
borderWidth: 3,
pointBackgroundColor: '#ffffff',
pointBorderColor: folder.color,
pointBorderWidth: 2.5,
pointRadius: 5,
fill: true,
tension: 0.3
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: { display: false },
tooltip: {
rtl: true,
backgroundColor: '#0f172a',
titleFont: { family: 'Heebo', size: 12 },
bodyFont: { family: 'Heebo', size: 12 },
padding: 10,
cornerRadius: 10
}
},
scales: {
y: {
min: 0,
max: 10,
ticks: { stepSize: 2, font: { family: 'Heebo', size: 11 }, color: '#64748b' },
grid: { color: '#f1f5f9' }
},
x: {
ticks: { font: { family: 'Heebo', size: 11 }, color: '#475569' },
grid: { display: false }
}
}
}
});
}
function renderGeneralChart() {
const ctx = document.getElementById('workspaceChart');
if (!ctx) return;
const maxLen = Math.max(0, ...goals.map(g => g.records.length));
if (maxLen === 0) return;
const labels = Array.from({ length: maxLen }, (_, i) => `תיעוד ${i + 1}`);
const datasets = goals.map(g => ({
label: g.title,
data: g.records.map(r => r.score),
borderColor: g.color,
backgroundColor: 'transparent',
borderWidth: 2.5,
pointBackgroundColor: g.color,
pointRadius: 4,
tension: 0.3
}));
activeChart = new Chart(ctx.getContext('2d'), {
type: 'line',
data: { labels, datasets },
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'bottom',
labels: { font: { family: 'Heebo', size: 11 }, usePointStyle: true }
}
},
scales: {
y: { min: 0, max: 10, ticks: { stepSize: 2 } },
x: { grid: { display: false } }
}
}
});
}
let toastTimeout;
function showToast(msg) {
const toast = document.getElementById('toastNotification');
document.getElementById('toastMessage').textContent = msg;
toast.classList.remove('translate-y-20', 'opacity-0');
clearTimeout(toastTimeout);
toastTimeout = setTimeout(() => {
toast.classList.add('translate-y-20', 'opacity-0');
}, 3000);
}
function escapeHtml(text) {
const div = document.createElement('div');
div.textContent = text;
return div.innerHTML;
}
window.addEventListener('DOMContentLoaded', () => {
renderAll();
});
</script>
</body>
</html>