🚀 הדר מערכת ניהול שיווק

🚀 מערכת ניהול שיווק

ניהול מקיף ומקצועי של כל הפעילות השיווקית

15:38:42
יום ראשון, 24 באוגוסט 2025
בוקר טוב! ☀️
זמן מצוין להתחיל את היום
לא בעבודה
⏰ שעות היום
0.0
שעות עבודה
💰 שכר צבור
₪0
היום
📊 השבוע
0/40
שעות
🎯 יעד היום
0%
השלמה
.
באנר מידע - ניהול בלוגריות ומשפיענים
טבלה גנרית מקובץ JSON

תבנית טקסט פניה למשפיענית – היי, שמי ענבר, מנהלת שיווק של מותג מוצרי התינוקות הייחודי האגס, אהבתי את התכנים והאנרגיה בעמוד שלך. אנו מציעים שיתוף פעולה לקידום מוצרים ייחודיים (חלק עם פטנט) לקהל של אמהות ואבות צעירים. אשמח לתאם שיחה קצרה  לבחינת הדרך הנכונה.

דשבורד מעקב בלוגריות

דשבורד מעקב בלוגריות

מעקב פעילות ותוכן בזמן אמת

טוען נתונים מקבצי JSON...

הקוד החדש –

<!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>
<style>
.blogger-dashboard-widget {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #d2b48c 0%, #8b7355 100%);
padding: 20px;
border-radius: 15px;
direction: rtl;
min-height: 400px;
}

.blogger-dashboard-widget .header {
background: rgba(139, 69, 19, 0.95);
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
margin-bottom: 20px;
}

.blogger-dashboard-widget .header h1 {
margin: 0 0 10px 0;
font-size: 2em;
}

.blogger-dashboard-widget .status {
background: rgba(245, 245, 220, 0.9);
border: 1px solid #8b4513;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
color: #654321;
}

.blogger-dashboard-widget .error {
background: rgba(160, 82, 45, 0.9);
border: 1px solid #8b4513;
padding: 15px;
border-radius: 5px;
margin-bottom: 20px;
color: white;
}

.blogger-dashboard-widget .blogger-item {
background: rgba(250, 240, 230, 0.95);
padding: 15px;
margin-bottom: 15px;
border-radius: 10px;
border-right: 4px solid #8b4513;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .blogger-item.collaboration-package {
border-right-color: #28a745;
background: rgba(240, 255, 240, 0.95);
}

.blogger-dashboard-widget .blogger-item.collaboration-single {
border-right-color: #17a2b8;
background: rgba(240, 248, 255, 0.95);
}

.blogger-dashboard-widget .collaboration-badge {
display: inline-block;
padding: 4px 12px;
border-radius: 12px;
font-size: 0.85em;
font-weight: bold;
margin-right: 8px;
}

.blogger-dashboard-widget .collaboration-badge.package {
background: #28a745;
color: white;
}

.blogger-dashboard-widget .collaboration-badge.single {
background: #17a2b8;
color: white;
}

.blogger-dashboard-widget .collaboration-badge.other {
background: #6c757d;
color: white;
}

.blogger-dashboard-widget .blogger-name {
font-size: 1.2em;
font-weight: bold;
color: #654321;
margin-bottom: 5px;
}

.blogger-dashboard-widget .blogger-details {
color: #8b7355;
font-size: 0.9em;
line-height: 1.8;
}

.blogger-dashboard-widget .detail-row {
margin-bottom: 4px;
}

.blogger-dashboard-widget .loading {
text-align: center;
padding: 40px;
color: white;
font-size: 1.1em;
}

.blogger-dashboard-widget .refresh-btn {
background: #d2691e;
color: white;
border: none;
border-radius: 5px;
padding: 10px 20px;
cursor: pointer;
margin-top: 10px;
}

.blogger-dashboard-widget .refresh-btn:hover {
background: #cd853f;
}

.blogger-dashboard-widget .rotation-map {
background: rgba(245, 245, 220, 0.95);
border: 2px solid #8b4513;
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
}

.blogger-dashboard-widget .rotation-map h3 {
text-align: center;
color: #654321;
margin-bottom: 20px;
font-size: 1.5em;
border-bottom: 2px solid #deb887;
padding-bottom: 10px;
}

.blogger-dashboard-widget .rotation-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 15px;
}

.blogger-dashboard-widget .blogger-rotation-card {
background: rgba(250, 240, 230, 0.9);
border: 2px solid #deb887;
border-radius: 10px;
padding: 15px;
box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .blogger-rotation-card.package-type {
border-color: #28a745;
}

.blogger-dashboard-widget .blogger-rotation-card.single-type {
border-color: #17a2b8;
}

.blogger-dashboard-widget .blogger-rotation-card .card-header {
background: #8b4513;
color: white;
padding: 10px;
border-radius: 5px;
text-align: center;
font-weight: bold;
margin-bottom: 15px;
font-size: 1.1em;
}

.blogger-dashboard-widget .product-package {
background: white;
border: 1px solid #daa520;
border-radius: 8px;
padding: 12px;
margin-bottom: 8px;
border-right: 4px solid #daa520;
}

.blogger-dashboard-widget .product-package.current-month {
border-right-color: #228b22;
background: #f0f8f7;
}

.blogger-dashboard-widget .product-title {
font-weight: bold;
color: #654321;
margin-bottom: 5px;
}

.blogger-dashboard-widget .product-details {
font-size: 0.9em;
color: #8b7355;
}

.blogger-dashboard-widget .month-indicator {
background: #228b22;
color: white;
padding: 3px 8px;
border-radius: 10px;
font-size: 0.8em;
font-weight: bold;
display: inline-block;
margin-bottom: 5px;
}

.blogger-dashboard-widget .month-group {
background: rgba(250, 240, 230, 0.9);
border: 2px solid #deb887;
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .month-header {
background: #8b4513;
color: white;
padding: 10px;
border-radius: 5px;
text-align: center;
font-weight: bold;
margin-bottom: 15px;
font-size: 1.2em;
}

.blogger-dashboard-widget .bloggers-in-month {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 10px;
}

.blogger-dashboard-widget .blogger-month-card {
background: white;
border: 1px solid #daa520;
border-radius: 8px;
padding: 12px;
border-right: 4px solid #daa520;
}

.blogger-dashboard-widget .blogger-month-card.package-collab {
border-right-color: #28a745;
background: rgba(240, 255, 240, 0.95);
}

.blogger-dashboard-widget .blogger-month-card.single-collab {
border-right-color: #17a2b8;
background: rgba(240, 248, 255, 0.95);
}

.blogger-dashboard-widget .blogger-month-card.overlap-warning {
border-right-color: #dc3545;
background: #fff5f5;
}

.blogger-dashboard-widget .blogger-month-name {
font-weight: bold;
color: #654321;
margin-bottom: 8px;
}

.blogger-dashboard-widget .delivery-date {
font-size: 0.9em;
color: #8b7355;
margin-bottom: 5px;
}

.blogger-dashboard-widget .overlap-info {
background: #ffe4e1;
border: 1px solid #dc3545;
border-radius: 5px;
padding: 8px;
margin-top: 8px;
font-size: 0.85em;
color: #dc3545;
}

.blogger-dashboard-widget .same-field-warning {
background: #fff3cd;
border: 1px solid #ffc107;
border-radius: 5px;
padding: 6px;
margin-top: 5px;
font-size: 0.8em;
color: #856404;
}

.blogger-dashboard-widget .weekly-tracker-card {
background: rgba(250, 240, 230, 0.9);
border: 2px solid #deb887;
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .weekly-tracker-card.urgent {
border-color: #dc3545;
background: rgba(255, 240, 240, 0.9);
}

.blogger-dashboard-widget .weekly-tracker-card.warning {
border-color: #ffc107;
background: rgba(255, 250, 230, 0.9);
}

.blogger-dashboard-widget .weekly-tracker-card.success {
border-color: #28a745;
background: rgba(240, 255, 240, 0.9);
}

.blogger-dashboard-widget .weekly-tracker-header {
background: #8b4513;
color: white;
padding: 10px;
border-radius: 5px;
text-align: center;
font-weight: bold;
margin-bottom: 15px;
font-size: 1.1em;
}

.blogger-dashboard-widget .weekly-tracker-header.urgent {
background: #dc3545;
}

.blogger-dashboard-widget .weekly-tracker-header.warning {
background: #ffc107;
color: #000;
}

.blogger-dashboard-widget .weekly-tracker-header.success {
background: #28a745;
}

.blogger-dashboard-widget .weekly-schedule {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
}

.blogger-dashboard-widget .week-slot {
background: white;
border: 2px solid #daa520;
border-radius: 8px;
padding: 10px;
text-align: center;
}

.blogger-dashboard-widget .week-slot.current-week {
border-color: #007bff;
background: #e3f2fd;
box-shadow: 0 0 10px rgba(0, 123, 255, 0.3);
}

.blogger-dashboard-widget .week-slot.completed {
border-color: #28a745;
background: #d4fdd4;
}

.blogger-dashboard-widget .week-slot.overdue {
border-color: #dc3545;
background: #ffe6e6;
}

.blogger-dashboard-widget .week-number {
font-weight: bold;
color: #654321;
margin-bottom: 5px;
}

.blogger-dashboard-widget .product-name {
font-size: 0.9em;
color: #8b7355;
margin-bottom: 5px;
}

.blogger-dashboard-widget .week-dates {
font-size: 0.8em;
color: #666;
margin-bottom: 5px;
}

.blogger-dashboard-widget .week-status {
padding: 3px 6px;
border-radius: 10px;
font-size: 0.75em;
font-weight: bold;
}

.blogger-dashboard-widget .week-status.done {
background: #d4fdd4;
color: #28a745;
}

.blogger-dashboard-widget .week-status.current {
background: #e3f2fd;
color: #007bff;
}

.blogger-dashboard-widget .week-status.pending {
background: #fff8dc;
color: #cd853f;
}

.blogger-dashboard-widget .week-status.late {
background: #ffe4e1;
color: #dc3545;
}

.blogger-dashboard-widget .current-task {
background: #e3f2fd;
border: 2px solid #007bff;
border-radius: 8px;
padding: 12px;
margin-top: 10px;
text-align: center;
}

.blogger-dashboard-widget .urgent-alert {
background: #ffe6e6;
border: 2px solid #dc3545;
border-radius: 8px;
padding: 12px;
margin-top: 10px;
text-align: center;
}

.blogger-dashboard-widget .behavior-analysis-card {
background: rgba(250, 240, 230, 0.9);
border: 2px solid #deb887;
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .behavior-analysis-card.excellent {
border-color: #28a745;
background: rgba(240, 255, 240, 0.9);
}

.blogger-dashboard-widget .behavior-analysis-card.good {
border-color: #17a2b8;
background: rgba(240, 248, 255, 0.9);
}

.blogger-dashboard-widget .behavior-analysis-card.problematic {
border-color: #ffc107;
background: rgba(255, 250, 230, 0.9);
}

.blogger-dashboard-widget .behavior-analysis-card.critical {
border-color: #dc3545;
background: rgba(255, 240, 240, 0.9);
}

.blogger-dashboard-widget .behavior-header {
display: flex;
justify-content: space-between;
align-items: center;
background: #8b4513;
color: white;
padding: 12px;
border-radius: 5px;
margin-bottom: 15px;
font-weight: bold;
}

.blogger-dashboard-widget .behavior-header.excellent {
background: #28a745;
}

.blogger-dashboard-widget .behavior-header.good {
background: #17a2b8;
}

.blogger-dashboard-widget .behavior-header.problematic {
background: #ffc107;
color: #000;
}

.blogger-dashboard-widget .behavior-header.critical {
background: #dc3545;
}

.blogger-dashboard-widget .reliability-score {
background: rgba(255, 255, 255, 0.9);
border-radius: 20px;
padding: 5px 15px;
font-size: 0.9em;
font-weight: bold;
}

.blogger-dashboard-widget .behavior-metrics {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 10px;
margin-bottom: 15px;
}

.blogger-dashboard-widget .metric-box {
background: white;
border: 1px solid #daa520;
border-radius: 8px;
padding: 12px;
text-align: center;
}

.blogger-dashboard-widget .metric-value {
font-size: 1.3em;
font-weight: bold;
color: #654321;
margin-bottom: 5px;
}

.blogger-dashboard-widget .metric-label {
font-size: 0.9em;
color: #8b7355;
}

.blogger-dashboard-widget .behavior-insights {
background: rgba(255, 255, 255, 0.9);
border-radius: 8px;
padding: 12px;
margin-top: 10px;
}

.blogger-dashboard-widget .insight-item {
display: flex;
align-items: center;
margin-bottom: 8px;
font-size: 0.9em;
}

.blogger-dashboard-widget .insight-icon {
margin-left: 8px;
font-size: 1.1em;
}

.blogger-dashboard-widget .behavior-summary {
background: rgba(245, 245, 220, 0.95);
border: 2px solid #8b4513;
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
}

.blogger-dashboard-widget .summary-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
}

.blogger-dashboard-widget .summary-item {
background: white;
border-radius: 8px;
padding: 15px;
text-align: center;
border-right: 4px solid #daa520;
}

.blogger-dashboard-widget .summary-item.top {
border-right-color: #28a745;
}

.blogger-dashboard-widget .summary-item.attention {
border-right-color: #dc3545;
}

.blogger-dashboard-widget .content-quality-card {
background: rgba(250, 240, 230, 0.9);
border: 2px solid #deb887;
border-radius: 10px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.blogger-dashboard-widget .content-quality-card.high-quality {
border-color: #28a745;
background: rgba(240, 255, 240, 0.9);
}

.blogger-dashboard-widget .content-quality-card.medium-quality {
border-color: #17a2b8;
background: rgba(240, 248, 255, 0.9);
}

.blogger-dashboard-widget .content-quality-card.low-quality {
border-color: #ffc107;
background: rgba(255, 250, 230, 0.9);
}

.blogger-dashboard-widget .content-quality-card.no-content {
border-color: #dc3545;
background: rgba(255, 240, 240, 0.9);
}

.blogger-dashboard-widget .quality-header {
display: flex;
justify-content: space-between;
align-items: center;
background: #8b4513;
color: white;
padding: 12px;
border-radius: 5px;
margin-bottom: 15px;
font-weight: bold;
}

.blogger-dashboard-widget .quality-header.high-quality {
background: #28a745;
}

.blogger-dashboard-widget .quality-header.medium-quality {
background: #17a2b8;
}

.blogger-dashboard-widget .quality-header.low-quality {
background: #ffc107;
color: #000;
}

.blogger-dashboard-widget .quality-header.no-content {
background: #dc3545;
}

.blogger-dashboard-widget .quality-score {
background: rgba(255, 255, 255, 0.9);
border-radius: 20px;
padding: 5px 15px;
font-size: 0.9em;
font-weight: bold;
}

.blogger-dashboard-widget .requirements-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 10px;
margin-bottom: 15px;
}

.blogger-dashboard-widget .requirement-item {
background: white;
border: 2px solid #daa520;
border-radius: 8px;
padding: 12px;
}

.blogger-dashboard-widget .requirement-item.completed {
border-color: #28a745;
background: #f0f8f7;
}

.blogger-dashboard-widget .requirement-item.in-progress {
border-color: #17a2b8;
background: #e8f4f8;
}

.blogger-dashboard-widget .requirement-item.delayed {
border-color: #ffc107;
background: #fffbf0;
}

.blogger-dashboard-widget .requirement-item.not-started {
border-color: #dc3545;
background: #fff5f5;
}

.blogger-dashboard-widget .requirement-item.waiting {
border-color: #6c757d;
background: #f8f9fa;
}

.blogger-dashboard-widget .requirement-title {
font-weight: bold;
color: #654321;
margin-bottom: 8px;
font-size: 0.9em;
}

.blogger-dashboard-widget .requirement-status {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}

.blogger-dashboard-widget .status-badge {
padding: 3px 8px;
border-radius: 10px;
font-size: 0.75em;
font-weight: bold;
}

.blogger-dashboard-widget .status-badge.completed {
background: #d4fdd4;
color: #28a745;
}

.blogger-dashboard-widget .status-badge.in-progress {
background: #cce7f0;
color: #17a2b8;
}

.blogger-dashboard-widget .status-badge.delayed {
background: #fff3cd;
color: #856404;
}

.blogger-dashboard-widget .status-badge.not-started {
background: #f8d7da;
color: #721c24;
}

.blogger-dashboard-widget .status-badge.waiting {
background: #e2e3e5;
color: #383d41;
}

.blogger-dashboard-widget .quality-rating {
display: flex;
align-items: center;
gap: 5px;
}

.blogger-dashboard-widget .quality-stars {
color: #ffc107;
}

.blogger-dashboard-widget .content-insights {
background: rgba(255, 255, 255, 0.9);
border-radius: 8px;
padding: 12px;
margin-top: 15px;
}

.blogger-dashboard-widget .insight-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
font-size: 0.9em;
}

.blogger-dashboard-widget .content-summary {
background: rgba(245, 245, 220, 0.95);
border: 2px solid #8b4513;
border-radius: 15px;
padding: 20px;
margin-bottom: 20px;
}

.blogger-dashboard-widget .summary-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-top: 15px;
}

.blogger-dashboard-widget .stat-item {
background: white;
border-radius: 8px;
padding: 15px;
text-align: center;
border-right: 4px solid #daa520;
}

.blogger-dashboard-widget .stat-item.excellent {
border-right-color: #28a745;
}

.blogger-dashboard-widget .stat-item.poor {
border-right-color: #dc3545;
}

.blogger-dashboard-widget .stat-value {
font-size: 1.5em;
font-weight: bold;
color: #654321;
margin-bottom: 5px;
}

.blogger-dashboard-widget .stat-label {
font-size: 0.9em;
color: #8b7355;
}

.blogger-dashboard-widget .platform-badge {
display: inline-block;
padding: 3px 10px;
border-radius: 8px;
font-size: 0.85em;
font-weight: bold;
margin: 0 3px;
}

.blogger-dashboard-widget .platform-instagram {
background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
color: white;
}

.blogger-dashboard-widget .platform-tiktok {
background: #000000;
color: white;
}

.blogger-dashboard-widget .platform-facebook {
background: #1877f2;
color: white;
}

.blogger-dashboard-widget .platform-youtube {
background: #ff0000;
color: white;
}

.blogger-dashboard-widget .platform-blog {
background: #ff6b35;
color: white;
}

.blogger-dashboard-widget .platform-other {
background: #6c757d;
color: white;
}
</style>
</head>
<body>
<div class="blogger-dashboard-widget">
<div class="header">
<h1>דשבורד מעקב בלוגריות</h1>
<p>מעקב פעילות ותוכן בזמן אמת</p>
</div>

<div id="status" class="loading">
טוען נתונים מקבצי JSON…
</div>

<div id="rotationMap" style="display: none;">
<div class="rotation-map">
<h3>מפת רוטציה חודשית – חלוקת חבילות מוצרים</h3>
<div id="rotationGrid" class="rotation-grid"></div>
</div>
</div>

<div id="rotationTracking" style="display: none;">
<div class="rotation-map">
<h3>מעקב רוטציה ותזמון – מי קיבלה מתי</h3>
<div id="rotationTrackingGrid" class="rotation-grid"></div>
</div>
</div>

<div id="weeklyTracking" style="display: none;">
<div class="rotation-map">
<h3>מעקב שבועי – מי צריכה לפרסם מה ומתי</h3>
<div id="weeklyTrackingGrid" class="rotation-grid"></div>
</div>
</div>

<div id="behaviorAnalysis" style="display: none;">
<div class="rotation-map">
<h3>ניתוח דפוסי התנהגות</h3>
<div id="behaviorAnalysisGrid" class="rotation-grid"></div>
</div>
</div>

<div id="contentQuality" style="display: none;">
<div class="rotation-map">
<h3>מעקב איכות תוכן – מה בוצע ובאיזו איכות</h3>
<div id="contentQualityGrid" class="rotation-grid"></div>
</div>
</div>

<div id="bloggersData"></div>
</div>

<script>
function getCollaborationType(type) {
if (!type) return 'other';
const t = type.trim().toLowerCase();
if (t.includes('חבילה') || t.includes('package')) return 'package';
if (t.includes('בודד') || t.includes('single') || t.includes('חד')) return 'single';
return 'other';
}

function makeCollabBadge(type) {
const cType = getCollaborationType(type);
const badges = {
'package': '<span class="collaboration-badge package">חבילה</span>',
'single': '<span class="collaboration-badge single">מוצר בודד</span>',
'other': '<span class="collaboration-badge other">אחר</span>'
};
return badges[cType] || ";
}

function makePlatformBadge(platform) {
if (!platform) return ";
const p = platform.trim().toLowerCase();
if (p.includes('אינסטגרם') || p.includes('instagram')) {
return '<span class="platform-badge platform-instagram">Instagram</span>';
}
if (p.includes('טיקטוק') || p.includes('tiktok')) {
return '<span class="platform-badge platform-tiktok">TikTok</span>';
}
if (p.includes('פייסבוק') || p.includes('facebook')) {
return '<span class="platform-badge platform-facebook">Facebook</span>';
}
if (p.includes('יוטיוב') || p.includes('youtube')) {
return '<span class="platform-badge platform-youtube">YouTube</span>';
}
if (p.includes('בלוג') || p.includes('blog')) {
return '<span class="platform-badge platform-blog">Blog</span>';
}
return '<span class="platform-badge platform-other">' + platform + '</span>';
}

async function loadAndDisplayData() {
const BASE_URL = "https://marketing.hugsshope.com/wp-content/uploads/json/";

try {
document.getElementById('status').innerHTML = 'טוען קבצי JSON…';

const timestamp = new Date().getTime();

const bloggersResponse = await fetch(BASE_URL + 'blogeryot.json?v=' + timestamp);
const contentResponse = await fetch(BASE_URL + 'tochen.json?v=' + timestamp);

if (!bloggersResponse.ok) {
throw new Error('שגיאה בטעינת קובץ בלוגריות: ' + bloggersResponse.status);
}

if (!contentResponse.ok) {
throw new Error('שגיאה בטעינת קובץ תוכן: ' + contentResponse.status);
}

const bloggersData = await bloggersResponse.json();
const contentData = await contentResponse.json();

const statusDiv = document.getElementById('status');
statusDiv.className = 'status';
statusDiv.innerHTML = 'הנתונים נטענו בהצלחה! (' + new Date().toLocaleTimeString() + ')<br>' +
'<strong>בלוגריות:</strong> ' + bloggersData.length + ' רשומות<br>' +
'<strong>תוכן:</strong> ' + contentData.length + ' רשומות<br>' +
'<button class="refresh-btn" onclick="loadAndDisplayData()">רענן נתונים</button>';

displayRotationMap(bloggersData, contentData);
document.getElementById('rotationMap').style.display = 'block';

displayRotationTracking(bloggersData);
document.getElementById('rotationTracking').style.display = 'block';

displayWeeklyTracking(bloggersData, contentData);
document.getElementById('weeklyTracking').style.display = 'block';

displayBehaviorAnalysis(bloggersData, contentData);
document.getElementById('behaviorAnalysis').style.display = 'block';

displayContentQuality(bloggersData, contentData);
document.getElementById('contentQuality').style.display = 'block';

displayBloggers(bloggersData, contentData);

} catch (error) {
const statusDiv = document.getElementById('status');
statusDiv.className = 'error';
statusDiv.innerHTML = 'שגיאה בטעינת הנתונים<br>' +
'<strong>שגיאה:</strong> ' + error.message + '<br>' +
'<button class="refresh-btn" onclick="loadAndDisplayData()">נסה שוב</button>';
}
}

function displayRotationMap(bloggersData, contentData) {
const container = document.getElementById('rotationGrid');
const currentMonth = new Date().getMonth() + 1;
const currentYear = new Date().getFullYear();

let html = ";

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם בלוגרית'] || blogger['שם הבלוגרית'] || blogger['שם'] || 'לא זמין';
const collaborationType = blogger['סוג שיתוף פעולה'] || ";
const platform = blogger['פלטפורמה'] || ";
const channel = blogger['ערוץ פרסום'] || ";
const productsDelivered = blogger['מוצרים שנמסרו'] || blogger['מוצרים'] || ";

const cardType = getCollaborationType(collaborationType);

html += '<div class="blogger-rotation-card ' + cardType + '-type">';
html += '<div class="card-header">';
html += bloggerName + ' ' + makeCollabBadge(collaborationType);
html += '</div>';

html += '<div style="margin-bottom: 10px; text-align: center;">';
html += makePlatformBadge(platform);
if (channel) {
html += '<div style="font-size: 0.85em; color: #8b7355; margin-top: 5px;">ערוץ: ' + channel + '</div>';
}
html += '</div>';

html += '<div class="month-indicator">חודש ' + currentMonth + '/' + currentYear + '</div>';
html += '<div class="product-packages">';

if (productsDelivered && productsDelivered.trim() !== ") {
const productsList = productsDelivered.split(/[,\n]/).filter(function(p) { return p.trim() !== "; });

if (productsList.length > 0) {
productsList.forEach(function(product, index) {
const productName = product.trim();
const week = index + 1;

const bloggerContent = contentData.filter(function(item) {
const itemName = (item['שם בלוגרית'] || item['שם הבלוגרית'] || item['שם'] || ").trim();
return itemName === bloggerName.trim();
});

let status = 'ממתין לפרסום';
let targetDate = 'לא הוגדר';

const productContent = bloggerContent.find(function(item) {
const itemProduct = (item['שם מוצר'] || item['מוצר'] || ").trim();
return itemProduct.toLowerCase().includes(productName.toLowerCase()) ||
productName.toLowerCase().includes(itemProduct.toLowerCase());
});

if (productContent) {
status = productContent['סטטוס ביצוע'] || 'ממתין לפרסום';
targetDate = productContent['תאריך יעד'] || productContent['תאריך'] || 'לא הוגדר';
}

html += '<div class="product-package current-month">';
html += '<div class="product-title">' + productName + '</div>';
html += '<div class="product-details">';
html += 'שבוע ' + week + ' | יעד: ' + targetDate + '<br>';
html += 'סטטוס: ' + status;
html += '</div></div>';
});
} else {
html += '<div class="product-package">';
html += '<div class="product-title">רשימת מוצרים ריקה</div>';
html += '</div>';
}
} else {
html += '<div class="product-package">';
html += '<div class="product-title">אין מוצרים רשומים</div>';
html += '</div>';
}

html += '</div></div>';
});

container.innerHTML = html;
}

function displayRotationTracking(bloggersData) {
const container = document.getElementById('rotationTrackingGrid');
const monthGroups = {};

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם הבלוגרית'] || blogger['שם בלוגרית'] || blogger['שם'] || 'לא זמין';
const monthInRotation = blogger['חודש ברוטציה'] || 'לא מוגדר';
const deliveryDate = blogger['תאריך מסירה'] || 'לא זמין';
const fieldOfWork = blogger['תחום עיסוק'] || 'כללי';
const platform = blogger['פלטפורמה'] || 'לא מוגדר';
const collaborationType = blogger['סוג שיתוף פעולה'] || ";
const othersInMonth = blogger['מי עוד קיבלה באותו חודש'] || ";

if (!monthGroups[monthInRotation]) {
monthGroups[monthInRotation] = [];
}

monthGroups[monthInRotation].push({
name: bloggerName,
deliveryDate: deliveryDate,
fieldOfWork: fieldOfWork,
platform: platform,
collaborationType: collaborationType,
othersInMonth: othersInMonth
});
});

let html = ";
const sortedMonths = Object.keys(monthGroups).sort();

sortedMonths.forEach(function(month) {
const bloggers = monthGroups[month];

const fieldCounts = {};
const platformCounts = {};
bloggers.forEach(function(blogger) {
fieldCounts[blogger.fieldOfWork] = (fieldCounts[blogger.fieldOfWork] || 0) + 1;
platformCounts[blogger.platform] = (platformCounts[blogger.platform] || 0) + 1;
});

const hasOverlap = Object.values(fieldCounts).some(function(c) { return c > 1; }) ||
Object.values(platformCounts).some(function(c) { return c > 1; });

html += '<div class="month-group">';
html += '<div class="month-header">' + month + ' (' + bloggers.length + ' בלוגריות) ';
html += hasOverlap ? ' ⚠️' : ' ✅';
html += '</div>';
html += '<div class="bloggers-in-month">';

bloggers.forEach(function(blogger) {
const hasOverlap = fieldCounts[blogger.fieldOfWork] > 1 || platformCounts[blogger.platform] > 1;
const cardType = getCollaborationType(blogger.collaborationType);

html += '<div class="blogger-month-card ' + cardType + '-collab';
if (hasOverlap) html += ' overlap-warning';
html += '">';

html += '<div class="blogger-month-name">';
html += blogger.name + ' ' + makeCollabBadge(blogger.collaborationType);
html += '</div>';

html += '<div class="delivery-date">תאריך מסירה: ' + blogger.deliveryDate + '</div>';
html += '<div class="delivery-date">' + makePlatformBadge(blogger.platform) + '</div>';
html += '<div class="delivery-date">תחום: ' + blogger.fieldOfWork + '</div>';

if (blogger.othersInMonth && blogger.othersInMonth.trim() !== ") {
html += '<div class="overlap-info">עוד באותו חודש: ' + blogger.othersInMonth + '</div>';
}

if (hasOverlap) {
html += '<div class="same-field-warning">חפיפה!</div>';
}

html += '</div>';
});

html += '</div></div>';
});

if (Object.keys(monthGroups).length === 0) {
html = '<div class="month-group"><div class="month-header">אין נתוני רוטציה</div></div>';
}

container.innerHTML = html;
}

function displayWeeklyTracking(bloggersData, contentData) {
const container = document.getElementById('weeklyTrackingGrid');
const today = new Date();

let html = ";

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם הבלוגרית'] || blogger['שם בלוגרית'] || blogger['שם'] || 'לא זמין';
const collaborationType = blogger['סוג שיתוף פעולה'] || ";
const platform = blogger['פלטפורמה'] || ";
const productsDelivered = blogger['מוצרים שנמסרו'] || ";
const deliveryDateStr = blogger['תאריך מסירה'] || ";

if (!productsDelivered.trim() || !deliveryDateStr.trim()) {
html += '<div class="weekly-tracker-card">';
html += '<div class="weekly-tracker-header">';
html += bloggerName + ' ' + makeCollabBadge(collaborationType) + ' – חסרים נתונים';
html += '</div></div>';
return;
}

const productsList = productsDelivered.split(/[,\n]/).filter(function(p) { return p.trim() !== "; });
const deliveryDate = new Date(deliveryDateStr);

if (isNaN(deliveryDate.getTime())) {
html += '<div class="weekly-tracker-card">';
html += '<div class="weekly-tracker-header">' + bloggerName + ' – תאריך לא תקין</div>';
html += '</div>';
return;
}

const bloggerContent = contentData.filter(function(item) {
const itemName = (item['שם בלוגרית'] || item['שם הבלוגרית'] || item['שם'] || ").trim();
return itemName === bloggerName.trim();
});

let overdueCount = 0;
let hasCurrentTask = false;

const weeklySchedule = productsList.map(function(product, index) {
const weekNumber = index + 1;
const weekStartDate = new Date(deliveryDate);
weekStartDate.setDate(deliveryDate.getDate() + (index * 7));

const weekEndDate = new Date(weekStartDate);
weekEndDate.setDate(weekStartDate.getDate() + 6);

const productContent = bloggerContent.find(function(item) {
const itemProduct = (item['שם מוצר'] || item['מוצר'] || ").trim();
return itemProduct.toLowerCase().includes(product.toLowerCase());
});

const status = productContent ? (productContent['סטטוס ביצוע'] || 'ממתין') : 'ממתין';

let weekStatus = 'pending';
let isCurrentWeek = false;
let isOverdue = false;

if (status === 'הושלם' || status === 'בוצע') {
weekStatus = 'done';
} else if (today >= weekStartDate && today <= weekEndDate) {
weekStatus = 'current';
isCurrentWeek = true;
hasCurrentTask = true;
} else if (today > weekEndDate) {
weekStatus = 'late';
isOverdue = true;
overdueCount++;
}

return {
weekNumber: weekNumber,
product: product,
weekStartDate: weekStartDate,
weekEndDate: weekEndDate,
weekStatus: weekStatus,
isCurrentWeek: isCurrentWeek,
isOverdue: isOverdue
};
});

let cardClass = ";
let headerClass = ";
if (overdueCount > 0) {
cardClass = 'urgent';
headerClass = 'urgent';
} else if (hasCurrentTask) {
cardClass = 'warning';
headerClass = 'warning';
} else if (weeklySchedule.every(function(w) { return w.weekStatus === 'done'; })) {
cardClass = 'success';
headerClass = 'success';
}

html += '<div class="weekly-tracker-card ' + cardClass + '">';
html += '<div class="weekly-tracker-header ' + headerClass + '">';
html += '<div>' + bloggerName + ' ' + makeCollabBadge(collaborationType);
html += '<div style="font-size: 0.9em; margin-top: 5px;">' + makePlatformBadge(platform) + '</div>';
html += '</div>';
html += '<div>';
if (overdueCount > 0) html += overdueCount + ' איחורים ';
if (hasCurrentTask) html += 'משימה השבוע ';
if (cardClass === 'success') html += 'הכל בזמן';
html += '</div>';
html += '</div>';

html += '<div class="weekly-schedule">';

weeklySchedule.forEach(function(week) {
let slotClass = ";
if (week.isCurrentWeek) slotClass = 'current-week';
else if (week.weekStatus === 'done') slotClass = 'completed';
else if (week.isOverdue) slotClass = 'overdue';

html += '<div class="week-slot ' + slotClass + '">';
html += '<div class="week-number">שבוע ' + week.weekNumber + '</div>';
html += '<div class="product-name">' + week.product + '</div>';
html += '<div class="week-dates">';
html += week.weekStartDate.toLocaleDateString('he-IL') + ' – ';
html += week.weekEndDate.toLocaleDateString('he-IL');
html += '</div>';
html += '<div class="week-status ' + week.weekStatus + '">';
if (week.weekStatus === 'done') html += 'פורסם';
else if (week.weekStatus === 'current') html += 'השבוע';
else if (week.weekStatus === 'late') html += 'איחור';
else html += 'ממתין';
html += '</div>';
html += '</div>';
});

html += '</div></div>';
});

container.innerHTML = html;
}

function displayBehaviorAnalysis(bloggersData, contentData) {
const container = document.getElementById('behaviorAnalysisGrid');

let behaviorProfiles = [];
let packageStats = { count: 0, totalScore: 0, avgScore: 0 };
let singleStats = { count: 0, totalScore: 0, avgScore: 0 };

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם הבלוגרית'] || blogger['שם בלוגרית'] || blogger['שם'] || 'לא זמין';
const collaborationType = blogger['סוג שיתוף פעולה'] || ";
const platform = blogger['פלטפורמה'] || ";

const bloggerContent = contentData.filter(function(item) {
const itemName = (item['שם בלוגרית'] || item['שם הבלוגרית'] || item['שם'] || ").trim();
return itemName === bloggerName.trim();
});

const completedCount = bloggerContent.filter(function(item) {
const status = item['סטטוס ביצוע'] || ";
return status === 'הושלם' || status === 'בוצע';
}).length;

const completionRate = bloggerContent.length > 0 ?
Math.round((completedCount / bloggerContent.length) * 100) : 0;

let reliabilityScore = 50;
if (completionRate >= 90) reliabilityScore += 30;
else if (completionRate >= 70) reliabilityScore += 15;
else if (completionRate < 50) reliabilityScore -= 20;

reliabilityScore = Math.max(0, Math.min(100, reliabilityScore));

let level = 'good';
if (reliabilityScore >= 80) level = 'excellent';
else if (reliabilityScore >= 60) level = 'good';
else if (reliabilityScore >= 40) level = 'problematic';
else level = 'critical';

const collabType = getCollaborationType(collaborationType);
if (collabType === 'package') {
packageStats.count++;
packageStats.totalScore += reliabilityScore;
} else if (collabType === 'single') {
singleStats.count++;
singleStats.totalScore += reliabilityScore;
}

behaviorProfiles.push({
name: bloggerName,
completionRate: completionRate,
reliabilityScore: reliabilityScore,
level: level,
totalTasks: bloggerContent.length,
completedTasks: completedCount,
collaborationType: collaborationType,
platform: platform
});
});

if (packageStats.count > 0) {
packageStats.avgScore = Math.round(packageStats.totalScore / packageStats.count);
}
if (singleStats.count > 0) {
singleStats.avgScore = Math.round(singleStats.totalScore / singleStats.count);
}

behaviorProfiles.sort(function(a, b) { return b.reliabilityScore – a.reliabilityScore; });

let html = '<div class="behavior-summary">';
html += '<h3 style="text-align: center; color: #654321; margin-bottom: 20px;">סיכום דפוסי התנהגות</h3>';
html += '<h4 style="text-align: center; color: #654321; margin: 20px 0 10px;">השוואה: חבילות vs מוצרים בודדים</h4>';
html += '<div class="summary-grid">';
html += '<div class="summary-item" style="border-right-color: #28a745;">';
html += '<strong>בלוגריות חבילה</strong><br>';
html += 'כמות: ' + packageStats.count + '<br>';
html += '<span style="color: #28a745; font-size: 1.3em; font-weight: bold;">';
html += packageStats.avgScore + '/100';
html += '</span><br>';
html += '<span style="font-size: 0.85em;">ציון אמינות ממוצע</span>';
html += '</div>';
html += '<div class="summary-item" style="border-right-color: #17a2b8;">';
html += '<strong>בלוגריות מוצר בודד</strong><br>';
html += 'כמות: ' + singleStats.count + '<br>';
html += '<span style="color: #17a2b8; font-size: 1.3em; font-weight: bold;">';
html += singleStats.avgScore + '/100';
html += '</span><br>';
html += '<span style="font-size: 0.85em;">ציון אמינות ממוצע</span>';
html += '</div>';
html += '</div></div>';

behaviorProfiles.forEach(function(profile) {
html += '<div class="behavior-analysis-card ' + profile.level + '">';
html += '<div class="behavior-header ' + profile.level + '">';
html += '<span>' + profile.name + ' ' + makeCollabBadge(profile.collaborationType);
html += '<div style="font-size: 0.85em; margin-top: 5px;">' + makePlatformBadge(profile.platform) + '</div>';
html += '</span>';
html += '<span class="reliability-score">' + profile.reliabilityScore + '/100</span>';
html += '</div>';

html += '<div class="behavior-metrics">';
html += '<div class="metric-box">';
html += '<div class="metric-value">' + profile.completionRate + '%</div>';
html += '<div class="metric-label">אחוז השלמה</div>';
html += '</div>';
html += '<div class="metric-box">';
html += '<div class="metric-value">' + profile.completedTasks + '/' + profile.totalTasks + '</div>';
html += '<div class="metric-label">משימות הושלמו</div>';
html += '</div>';
html += '</div>';

html += '</div>';
});

container.innerHTML = html;
}

function displayContentQuality(bloggersData, contentData) {
const container = document.getElementById('contentQualityGrid');

let contentProfiles = [];
const platformStats = {};

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם הבלוגרית'] || blogger['שם בלוגרית'] || blogger['שם'] || 'לא זמין';
const platform = blogger['פלטפורמה'] || 'לא מוגדר';
const channel = blogger['ערוץ פרסום'] || 'לא מוגדר';
const collaborationType = blogger['סוג שיתוף פעולה'] || ";

const bloggerContent = contentData.filter(function(item) {
const itemName = (item['שם בלוגרית'] || item['שם הבלוגרית'] || item['שם'] || ").trim();
return itemName === bloggerName.trim();
});

if (bloggerContent.length === 0) {
return;
}

const completedCount = bloggerContent.filter(function(item) {
const status = item['סטטוס ביצוע'] || ";
return status === 'הושלם';
}).length;

const overallScore = bloggerContent.length > 0 ?
Math.round((completedCount / bloggerContent.length) * 100) : 0;

let level = 'low-quality';
if (overallScore >= 80) level = 'high-quality';
else if (overallScore >= 60) level = 'medium-quality';

if (!platformStats[platform]) {
platformStats[platform] = { count: 0, totalScore: 0, avgScore: 0 };
}
platformStats[platform].count++;
platformStats[platform].totalScore += overallScore;

contentProfiles.push({
name: bloggerName,
overallScore: overallScore,
level: level,
totalTasks: bloggerContent.length,
completedTasks: completedCount,
platform: platform,
channel: channel,
collaborationType: collaborationType
});
});

Object.keys(platformStats).forEach(function(platform) {
platformStats[platform].avgScore = Math.round(
platformStats[platform].totalScore / platformStats[platform].count
);
});

contentProfiles.sort(function(a, b) { return b.overallScore – a.overallScore; });

let html = '<div class="content-summary">';
html += '<h3 style="text-align: center; color: #654321; margin-bottom: 20px;">סיכום איכות תוכן</h3>';
html += '<h4 style="text-align: center; color: #654321; margin: 20px 0 10px;">ביצועים לפי פלטפורמה</h4>';
html += '<div class="summary-stats">';

Object.keys(platformStats).forEach(function(platform) {
const data = platformStats[platform];
html += '<div class="stat-item">';
html += makePlatformBadge(platform) + '<br>';
html += '<div class="stat-value">' + data.avgScore + '/100</div>';
html += '<div class="stat-label">' + data.count + ' בלוגריות</div>';
html += '</div>';
});

html += '</div></div>';

contentProfiles.forEach(function(profile) {
html += '<div class="content-quality-card ' + profile.level + '">';
html += '<div class="quality-header ' + profile.level + '">';
html += '<span>' + profile.name + ' ' + makeCollabBadge(profile.collaborationType);
html += '<div style="font-size: 0.85em; margin-top: 5px;">' + makePlatformBadge(profile.platform) + '</div>';
html += '</span>';
html += '<span class="quality-score">' + profile.overallScore + '/100</span>';
html += '</div>';

html += '<div class="content-insights">';
html += '<h4 style="margin-bottom: 10px; color: #654321;">סיכום ביצועים</h4>';
html += '<div class="insight-row">';
html += '<span>משימות הושלמו:</span>';
html += '<strong>' + profile.completedTasks + '/' + profile.totalTasks + '</strong>';
html += '</div>';
html += '<div class="insight-row">';
html += '<span>ערוץ פרסום:</span>';
html += '<strong>' + profile.channel + '</strong>';
html += '</div>';
html += '</div>';

html += '</div>';
});

container.innerHTML = html;
}

function displayBloggers(bloggersData, contentData) {
const container = document.getElementById('bloggersData');

if (bloggersData.length === 0) {
container.innerHTML = '<div class="error">אין נתונים</div>';
return;
}

let html = '<h3 style="color: white; text-align: center; margin-bottom: 20px;">פרטי בלוגריות מלא</h3>';

bloggersData.forEach(function(blogger) {
const bloggerName = blogger['שם בלוגרית'] || blogger['שם הבלוגרית'] || blogger['שם'] || 'לא זמין';
const bloggerPhone = blogger['מספר נייד'] || blogger['מספר ניד'] || blogger['טלפון'] || 'לא זמין';
const followersCount = blogger['מספר עוקבים'] || blogger['עוקבים'] || '0';
const sales = blogger['מספר מכירות דרך הקופון'] || blogger['מכירות'] || '0';
const platform = blogger['פלטפורמה'] || 'לא מוגדר';
const collaborationType = blogger['סוג שיתוף פעולה'] || 'לא מוגדר';
const channel = blogger['ערוץ פרסום'] || 'לא מוגדר';

const bloggerContent = contentData.filter(function(item) {
const itemName = (item['שם בלוגרית'] || item['שם הבלוגרית'] || item['שם'] || ").trim();
return itemName === bloggerName.trim();
});

let statusInfo = ";
if (bloggerContent.length > 0) {
const completedCount = bloggerContent.filter(function(item) {
const status = item['סטטוס ביצוע'] || ";
return status === 'הושלם' || status === 'בוצע';
}).length;
statusInfo = completedCount + '/' + bloggerContent.length + ' הושלמו';
} else {
statusInfo = 'אין נתוני תוכן';
}

const collabClass = getCollaborationType(collaborationType);
let cardClass = ";
if (collabClass === 'package') cardClass = 'collaboration-package';
else if (collabClass === 'single') cardClass = 'collaboration-single';

html += '<div class="blogger-item ' + cardClass + '">';
html += '<div class="blogger-name">';
html += bloggerName + ' ' + makeCollabBadge(collaborationType);
html += '</div>';
html += '<div class="blogger-details">';

html += '<div class="detail-row">';
html += '<strong>פלטפורמה:</strong> ' + makePlatformBadge(platform);
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>ערוץ פרסום:</strong> ' + channel;
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>טלפון:</strong> ' + bloggerPhone;
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>עוקבים:</strong> ' + parseInt(followersCount).toLocaleString();
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>מכירות:</strong> ' + sales;
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>רשומות תוכן:</strong> ' + bloggerContent.length;
html += '</div>';

html += '<div class="detail-row">';
html += '<strong>סטטוס:</strong> ' + statusInfo;
html += '</div>';

html += '</div></div>';
});

container.innerHTML = html;
}

loadAndDisplayData();
</script>
</body>
</html>