ehsan-dashboards/dashboards/seo/new/index.html

851 lines
31 KiB
HTML
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🔍</text></svg>">
<title>کاندیدای ارتقای سازمانی C-Level سئو | Hamed Ecosystem</title>
<style>
@font-face {
font-family: 'Vazirmatn';
src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Vazirmatn';
src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
background-color: #F8FAFC;
color: #0F172A;
direction: rtl;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
}
.tnum {
font-feature-settings: "tnum" 1;
font-variant-numeric: tabular-nums;
}
.container {
max-width: 1440px;
margin: 0 auto;
padding: 0 24px;
}
/* Top sticky header */
.top-header {
position: sticky;
top: 0;
z-index: 1000;
background: rgba(255, 255, 255, 0.94);
backdrop-filter: blur(12px);
border-bottom: 1px solid #E2E8F0;
padding: 14px 0;
box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.03);
}
.header-inner {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 16px;
}
.brand-group {
display: flex;
align-items: center;
gap: 14px;
}
.logo-badge {
background: #0F172A;
color: #FFFFFF;
font-weight: 800;
padding: 6px 12px;
border-radius: 8px;
font-size: 14px;
letter-spacing: 0.5px;
}
.brand-text h1 {
font-size: 18px;
font-weight: 800;
color: #0F172A;
line-height: 1.3;
}
.brand-text p {
font-size: 12px;
color: #64748B;
}
/* Navigation tier pills */
.nav-tiers {
display: flex;
align-items: center;
gap: 8px;
background: #F1F5F9;
padding: 4px;
border-radius: 10px;
border: 1px solid #E2E8F0;
}
.tier-link {
text-decoration: none;
font-size: 12px;
font-weight: 700;
padding: 6px 14px;
border-radius: 7px;
color: #475569;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 6px;
}
.tier-link:hover {
color: #0F172A;
background: rgba(255, 255, 255, 0.6);
}
.tier-link.active {
background: #FFFFFF;
color: #0F172A;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
/* KPI telemetry bar */
.telemetry-band {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 14px;
margin: 24px 0;
}
@media (max-width: 1200px) {
.telemetry-band { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
.telemetry-band { grid-template-columns: repeat(2, 1fr); }
}
.card-kpi {
background: #FFFFFF;
border: 1px solid #E2E8F0;
border-radius: 14px;
padding: 16px;
box-shadow: 0 1px 3px rgba(0,0,0,0.02);
transition: transform 0.2s, border-color 0.2s;
}
.card-kpi:hover {
transform: translateY(-2px);
border-color: #CBD5E1;
}
.card-kpi .label {
font-size: 11.5px;
font-weight: 600;
color: #64748B;
margin-bottom: 6px;
}
.card-kpi .value {
font-size: 22px;
font-weight: 800;
color: #0F172A;
line-height: 1.2;
}
.card-kpi .sub {
font-size: 11px;
font-weight: 600;
margin-top: 4px;
}
/* Badges */
.badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 6px;
font-size: 11px;
font-weight: 700;
}
.badge-p0 { background: #FFE4E6; color: #E11D48; border: 1px solid #FECDD3; }
.badge-p1 { background: #FEF3C7; color: #D97706; border: 1px solid #FDE68A; }
.badge-p2 { background: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; }
.badge-p3 { background: #F3E8FF; color: #9333EA; border: 1px solid #E9D5FF; }
.badge-frontend { background: #EEF2FF; color: #4F46E5; }
.badge-backend { background: #ECFDF5; color: #059669; }
.badge-devops { background: #FFF7ED; color: #EA580C; }
.badge-taxonomy { background: #F0FDF4; color: #16A34A; }
/* Cards */
.card {
background: #FFFFFF;
border: 1px solid #E2E8F0;
border-radius: 16px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.02), 0 6px 16px -4px rgba(15, 23, 42, 0.03);
}
.card-title {
font-size: 15px;
font-weight: 800;
color: #0F172A;
margin-bottom: 14px;
display: flex;
justify-content: space-between;
align-items: center;
}
/* Tables */
.table-wrap {
overflow-x: auto;
border-radius: 12px;
border: 1px solid #E2E8F0;
}
table {
width: 100%;
border-collapse: collapse;
text-align: right;
font-size: 13px;
}
thead th {
background: #F8FAFC;
color: #475569;
font-weight: 700;
padding: 12px 14px;
border-bottom: 1px solid #E2E8F0;
white-space: nowrap;
}
tbody tr {
border-bottom: 1px solid #F1F5F9;
transition: background 0.15s;
}
tbody tr:hover {
background: #F8FAFC;
cursor: pointer;
}
tbody td {
padding: 12px 14px;
color: #334155;
vertical-align: middle;
}
/* Sprint Gantt view */
.sprint-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 24px;
}
@media (max-width: 992px) {
.sprint-grid { grid-template-columns: 1fr; }
}
.sprint-box {
background: #FFFFFF;
border: 1px solid #E2E8F0;
border-radius: 12px;
padding: 16px;
}
.sprint-box.active-sprint {
border-color: #3B82F6;
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}
.sprint-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.sprint-title {
font-size: 13px;
font-weight: 800;
color: #0F172A;
}
/* Code / Drawer */
.drawer-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(15, 23, 42, 0.5);
backdrop-filter: blur(3px);
z-index: 9998;
opacity: 0;
pointer-events: none;
transition: opacity 0.25s ease;
}
.drawer-overlay.open {
opacity: 1;
pointer-events: auto;
}
.drawer {
position: fixed;
top: 0;
left: 0;
width: 720px;
max-width: 92vw;
height: 100vh;
background: #FFFFFF;
z-index: 9999;
box-shadow: 4px 0 24px rgba(0,0,0,0.2);
transform: translateX(-100%);
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
display: flex;
flex-direction: column;
overflow: hidden;
}
.drawer.open {
transform: translateX(0);
}
.drawer-header {
padding: 16px 20px;
border-bottom: 1px solid #E2E8F0;
display: flex;
justify-content: space-between;
align-items: center;
background: #F8FAFC;
}
.drawer-body {
flex: 1;
overflow-y: auto;
padding: 20px;
}
.code-block {
background: #0F172A;
color: #E2E8F0;
padding: 14px;
border-radius: 10px;
font-family: monospace;
font-size: 12px;
direction: ltr;
text-align: left;
overflow-x: auto;
white-space: pre-wrap;
position: relative;
}
.copy-btn {
position: absolute;
top: 8px;
right: 8px;
background: rgba(255,255,255,0.15);
color: #FFFFFF;
border: none;
padding: 4px 10px;
border-radius: 6px;
font-size: 11px;
cursor: pointer;
}
.copy-btn:hover {
background: rgba(255,255,255,0.3);
}
.btn-action {
background: #0F172A;
color: #FFFFFF;
border: none;
padding: 8px 16px;
border-radius: 8px;
font-weight: 700;
font-size: 12px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
text-decoration: none;
}
.btn-action:hover {
background: #1E293B;
}
.btn-outline {
background: #FFFFFF;
color: #0F172A;
border: 1px solid #CBD5E1;
padding: 8px 16px;
border-radius: 8px;
font-weight: 700;
font-size: 12px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
}
.btn-outline:hover {
background: #F8FAFC;
}
</style>
<script src="../data_bundle.js?v=20260915_22tasks"></script>
<script src="../vendor/plotly.min.js"></script>
<style>
.council-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
margin-bottom: 24px;
}
@media (max-width: 992px) {
.council-grid { grid-template-columns: 1fr; }
}
.council-card {
background: #FFFFFF;
border: 1px solid #E2E8F0;
border-radius: 14px;
padding: 18px;
box-shadow: 0 1px 3px rgba(0,0,0,0.02);
transition: transform 0.2s, border-color 0.2s;
}
.council-card:hover {
transform: translateY(-2px);
border-color: #CBD5E1;
}
.council-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.council-role {
font-size: 13px;
font-weight: 800;
color: #0F172A;
}
.council-badge {
font-size: 10.5px;
padding: 2px 8px;
border-radius: 6px;
font-weight: 700;
}
.scope-toggle-wrap {
display: inline-flex;
background: #F1F5F9;
padding: 3px;
border-radius: 10px;
border: 1px solid #E2E8F0;
}
.btn-scope {
border: none;
background: transparent;
padding: 6px 14px;
font-size: 12px;
font-weight: 700;
border-radius: 7px;
cursor: pointer;
color: #64748B;
transition: all 0.2s;
}
.btn-scope.active {
background: #FFFFFF;
color: #0F172A;
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.badge-crit {
background: #FEE2E2;
color: #DC2626;
border: 1px solid #FCA5A5;
font-size: 10.5px;
padding: 2px 6px;
border-radius: 4px;
font-weight: 800;
}
.badge-ext {
background: #F1F5F9;
color: #475569;
border: 1px solid #CBD5E1;
font-size: 10.5px;
padding: 2px 6px;
border-radius: 4px;
font-weight: 700;
}
</style>
</head>
<body>
<div class="top-header">
<div class="container header-inner">
<div class="brand-group">
<span class="logo-badge" style="background: #059669;">C-LEVEL CANDIDATE</span>
<div class="brand-text">
<h1>کاندیدای ارتقای سازمانی نسخه اصلی سئو (/new/)</h1>
<p>ارزیابی تطبیقی ۶ ستون C-Suite (CTO, CPO, CFO, CAIO, CISO, CRO) با مدل ۲۲ اقدام مهندسی</p>
</div>
</div>
<div class="nav-tiers">
<a href="../" class="tier-link">
<span>📌</span> نسخه ۱: عملیات
</a>
<a href="../v2/" class="tier-link">
<span>📊</span> نسخه ۲: Executive BI
</a>
<a href="../v3/" class="tier-link">
<span>⚡</span> نسخه ۳: Apex Cockpit
</a>
<a href="../new/" class="tier-link active">
<span>🚀</span> نسخه جدید: C-Level Staging
</a>
</div>
<div>
<button class="btn-action" onclick="exportTasksToCSV()">
<span>📥</span> خروجی کامل CSV اکسل
</button>
</div>
</div>
</div>
<main class="container" style="padding-top: 16px; padding-bottom: 60px;">
<!-- Telemetry Band -->
<div class="telemetry-band">
<div class="card-kpi">
<div class="label">اعتبار معماری فنی (CTO)</div>
<div class="value tnum" style="color: #059669;">۱۰۰٪ تایید</div>
<div class="sub" style="color: #64748B;">تفکیک کامل پکت خام و SSR</div>
</div>
<div class="card-kpi">
<div class="label">وضوح شناختی محصول (CPO)</div>
<div class="value tnum" style="color: #2563EB;">۹۸.۵٪</div>
<div class="sub" style="color: #059669;">صفر المان بلاک‌کننده</div>
</div>
<div class="card-kpi">
<div class="label">توجیه اقتصادی و مالی (CFO)</div>
<div class="value tnum" style="color: #D97706;">۲۴.۸x بازده</div>
<div class="sub" style="color: #059669;">ارزش افزوده ۳۸۰ م.ت</div>
</div>
<div class="card-kpi">
<div class="label">سازگاری هوش مصنوعی (CAIO)</div>
<div class="value tnum" style="color: #9333EA;">۵ ساب‌ایجنت</div>
<div class="sub" style="color: #64748B;">تلمتری کامل و خودکار</div>
</div>
<div class="card-kpi">
<div class="label">انطباق امنیتی (CISO)</div>
<div class="value tnum" style="color: #059669;">Zero-Leak</div>
<div class="sub" style="color: #64748B;">پروتکل پاکسازی سورس</div>
</div>
<div class="card-kpi">
<div class="label">پتانسیل رشد درآمدی (CRO)</div>
<div class="value tnum" style="color: #059669;">+۳۵٪ GMV</div>
<div class="sub" style="color: #059669;">از هاب تجربیات و ستاره گوگل</div>
</div>
</div>
<!-- C-Level Council Evaluation Pillars -->
<div class="card">
<div class="card-title">
<span>🏛 شورا و ستون‌های ۶‌گانه ارزیابی مدیران ارشد (C-Level Evaluation Council)</span>
<span style="font-size: 11.5px; color: #059669; font-weight: 700;">آماده برای ارزیابی نهایی کاربر جهت مهاجرت به ریشه (/)</span>
</div>
<div class="council-grid">
<!-- CTO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">💻 ستون فنی و زیرساخت (CTO)</span>
<span class="council-badge" style="background:#ECFDF5; color:#059669;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
حل قطعی باگ رندر سفید سرور در PDP، حذف فراخوانی‌های تکراری دیتابیس در SSR، کانونیکال صفحه اصلی، حذف کلوکینگ botChecker و ایمن‌سازی کامل سایت‌مپ در برابر خطاهای سینتکس XML.
</p>
</div>
<!-- CPO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">🎨 محصول و تجربه کاربری (CPO)</span>
<span class="council-badge" style="background:#EFF6FF; color:#2563EB;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
رفع انحراف ناوبری برادکرامپ و تمایز کارگاه‌های تجربی از اتاق فرارها، اصلاح ساختار W3C کارت‌های PLP، اصلاح تایتل و دیسکریپشن صفحات برندها و آزادسازی مسیر اختصاصی نظرات.
</p>
</div>
<!-- CFO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">💰 اقتصاد و بهره‌وری مالی (CFO)</span>
<span class="council-badge" style="background:#FEF3C7; color:#D97706;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
هزینه کل مهندسی تنها ۲۶.۶ ساعت (۲۱.۵ ساعت برای ۱۲ اقدام بحرانی) در برابر پیش‌بینی افزایش ۳۸۰ میلیون تومانی GMV فصلی اکیپا؛ نسبت بازدهی سرمایه‌گذاری ۲۴.۸ برابر.
</p>
</div>
<!-- CAIO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">🤖 هوش مصنوعی و اتوماسیون (CAIO)</span>
<span class="council-badge" style="background:#F3E8FF; color:#9333EA;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
یکپارچه‌سازی فرآیند با ۵ ساب‌ایجنت موازی، پایپ‌لاین اعتبارسنجی خودکار تست‌های زنده شبکه با ابزارهای Composio و Search Console، و قابلیت سنتز برخط داده‌ها بدون دخالت دستی.
</p>
</div>
<!-- CISO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">🛡 امنیت داده و زیرساخت (CISO)</span>
<span class="council-badge" style="background:#ECFDF5; color:#059669;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
مسدودسازی نشت پیام‌های خطای سرور اکسپرس، ایمن‌سازی روت مانیتورینگ Sentry در robots.txt، اعمال هدرهای امنیتی ضد MIME sniffing و متاتگ noindex در صفحات ۴۰۴/۵۰۰.
</p>
</div>
<!-- CRO -->
<div class="council-card">
<div class="council-header">
<span class="council-role">📈 رشد درآمد و بازاریابی (CRO)</span>
<span class="council-badge" style="background:#ECFDF5; color:#059669;">تایید شده</span>
</div>
<p style="font-size: 12px; color: #334155; line-height: 1.6;">
احیای ترافیک ارگانیک با ستاره‌های طلایی امتیاز و بازه قیمتی در گوگل، تصاحب سهم بازار پردرآمد ورکشاپ‌های دونفره با خروج لندینگ تجربیات از وضعیت noindex و رفع کنیبالیزیشن.
</p>
</div>
</div>
</div>
<!-- 100% Functional Parity Interactive Tasks Section with Scope Toggle -->
<div class="card">
<div class="card-title">
<div style="display: flex; align-items: center; gap: 12px;">
<span id="candidate-headline">📋 کاتالوگ عملیاتی اقدامات کلیدی سئو</span>
<div class="scope-toggle-wrap">
<button id="btn-scope-critical" class="btn-scope active" onclick="setScope('critical')">🔥 فقط ۱۲ ایراد بحرانی</button>
<button id="btn-scope-all" class="btn-scope" onclick="setScope('all')">🌐 نمایش کل ۲۲ اقدام</button>
</div>
</div>
<div style="display: flex; gap: 8px;">
<input type="text" id="candidate-search" placeholder="فیلتر سریع..." style="padding: 6px 12px; border: 1px solid #CBD5E1; border-radius: 8px; font-size: 12px; width: 180px;" oninput="filterCandidateTable()" />
<button class="btn-action" style="padding: 6px 14px; font-size: 11.5px;" onclick="exportTasksToCSV()">خروجی اکسل 📥</button>
</div>
</div>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>شناسه</th>
<th>وضعیت</th>
<th>عنوان اقدام</th>
<th>لایه مهندسی</th>
<th>فاز اسپرینت</th>
<th>اولویت</th>
<th>زمان دولوپر</th>
<th>امتیاز RICE</th>
<th>ستون مرتبط C-Level</th>
<th>عملیات</th>
</tr>
</thead>
<tbody id="candidate-tbody">
<!-- Rendered by JS -->
</tbody>
</table>
</div>
</div>
</main>
<!-- Task Detail Drawer -->
<div id="drawer-overlay" class="drawer-overlay" onclick="closeTaskDrawer()"></div>
<div id="task-drawer" class="drawer">
<div class="drawer-header">
<div style="display: flex; align-items: center; gap: 8px;">
<span id="drawer-badge-p" class="badge"></span>
<span id="drawer-badge-sprint" class="badge" style="background:#F1F5F9; color:#475569;"></span>
<span id="drawer-id" class="tnum" style="font-weight: 800; font-size: 14px; color: #0F172A;"></span>
</div>
<button onclick="closeTaskDrawer()" style="background: none; border: none; font-size: 20px; cursor: pointer; color: #64748B;">✕</button>
</div>
<div class="drawer-body">
<h2 id="drawer-title" style="font-size: 16px; font-weight: 800; color: #0F172A; margin-bottom: 12px; line-height: 1.5;"></h2>
<div style="background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 12px; margin-bottom: 16px; font-size: 12.5px;">
<div style="display: flex; justify-content: space-between; margin-bottom: 6px;">
<span style="color: #64748B;">فایل هدف و خطوط:</span>
<span id="drawer-file" class="font-mono tnum" style="font-weight: 700; color: #2563EB;"></span>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 6px;">
<span style="color: #64748B;">زمان تخمینی دولوپر:</span>
<span id="drawer-hours" class="tnum" style="font-weight: 700; color: #0F172A;"></span>
</div>
<div style="display: flex; justify-content: space-between; margin-bottom: 6px;">
<span style="color: #64748B;">امتیاز و مؤلفه‌های RICE:</span>
<span id="drawer-rice" class="tnum" style="font-weight: 800; color: #059669;"></span>
</div>
<div style="display: flex; justify-content: space-between;">
<span style="color: #64748B;">ستون نظارتی C-Level:</span>
<span id="drawer-pillar" style="font-weight: 700; color: #4F46E5;"></span>
</div>
</div>
<div style="margin-bottom: 16px;">
<div style="font-size: 12.5px; font-weight: 700; color: #0F172A; margin-bottom: 6px;">🎯 اثر بیزینسی و شاخص هدف:</div>
<div id="drawer-impact" style="font-size: 12px; color: #334155; line-height: 1.6; background: #ECFDF5; border: 1px solid #A7F3D0; padding: 10px; border-radius: 8px;"></div>
</div>
<div style="margin-bottom: 16px;">
<div style="font-size: 12.5px; font-weight: 700; color: #0F172A; margin-bottom: 6px;">🔍 تحلیل ریشه‌ای علت باگ (Root-Cause):</div>
<div id="drawer-root-cause" style="font-size: 12px; color: #334155; line-height: 1.6; background: #FFFBEB; border: 1px solid #FDE68A; padding: 10px; border-radius: 8px;"></div>
</div>
<div style="margin-bottom: 16px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-size: 12.5px; font-weight: 700; color: #DC2626;">❌ سورس‌کد باگ‌دار فعلی:</span>
<button class="btn-copy" onclick="copyCode('drawer-buggy-code')">کپی سورس</button>
</div>
<pre class="code-block"><code id="drawer-buggy-code"></code></pre>
</div>
<div style="margin-bottom: 16px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-size: 12.5px; font-weight: 700; color: #16A34A;">✅ سورس‌کد اصلاح‌شده پیشنهادی:</span>
<button class="btn-copy" onclick="copyCode('drawer-fixed-code')">کپی راه‌حل</button>
</div>
<pre class="code-block"><code id="drawer-fixed-code"></code></pre>
</div>
<div style="margin-bottom: 24px;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-size: 12.5px; font-weight: 700; color: #0F172A;">⚡ دستور تست زنده در ترمینال (Verification cURL):</span>
<button class="btn-copy" onclick="copyCode('drawer-test-command')">کپی دستور</button>
</div>
<pre class="code-block" style="background: #090D16;"><code id="drawer-test-command" style="color: #38BDF8;"></code></pre>
</div>
</div>
</div>
<script>
let activeTask = null;
function openTaskDrawer(taskId) {
const tasks = window.bundle?.tasks || [];
const task = tasks.find(t => t.id === taskId);
if (!task) return;
activeTask = task;
document.getElementById('drawer-id').innerText = task.id;
document.getElementById('drawer-title').innerText = task.title;
document.getElementById('drawer-file').innerText = `${task.file_path} (${task.lines})`;
document.getElementById('drawer-hours').innerText = `${task.hours} ساعت کاری`;
document.getElementById('drawer-rice').innerText = `${task.rice.score.toLocaleString('fa-IR')} (R:${task.rice.reach.toLocaleString('fa-IR')} | I:${task.rice.impact} | C:${task.rice.confidence} | E:${task.rice.effort})`;
document.getElementById('drawer-pillar').innerText = task.c_level_pillar || 'C-Suite Council';
document.getElementById('drawer-impact').innerText = task.business_impact;
document.getElementById('drawer-root-cause').innerText = task.root_cause_analysis || 'تحلیل فنی در ممیزی ۵ لایه تایید شده است.';
document.getElementById('drawer-buggy-code').innerText = task.buggy_code;
document.getElementById('drawer-fixed-code').innerText = task.fixed_code;
document.getElementById('drawer-test-command').innerText = task.test_command;
document.getElementById('drawer-badge-sprint').innerText = task.sprint;
const pBadge = document.getElementById('drawer-badge-p');
pBadge.className = `badge ${task.priority === 'P0' ? 'badge-p0' : (task.priority === 'P1' ? 'badge-p1' : 'badge-p2')}`;
pBadge.innerText = task.priority;
document.getElementById('task-drawer').classList.add('open');
document.getElementById('drawer-overlay').classList.add('open');
}
function closeTaskDrawer() {
document.getElementById('task-drawer').classList.remove('open');
document.getElementById('drawer-overlay').classList.remove('open');
}
function copyCode(elementId) {
const text = document.getElementById(elementId).innerText;
navigator.clipboard.writeText(text).then(() => {
alert('دستور / کد در حافظه کپی شد!');
});
}
function exportTasksToCSV() {
const tasks = window.bundle?.tasks || [];
if (!tasks.length) return;
let csv = '\\uFEFF';
csv += 'شناسه,وضعیت بحرانی,عنوان اقدام,لایه فنی,فاز اسپرینت,اولویت,زمان دولوپر (ساعت),Reach,Impact,Confidence,Effort,امتیاز RICE,ستون C-Level,مسیر فایل,خطوط,اثر بیزینسی,دستور تست\\n';
tasks.forEach(t => {
const isCrit = t.is_critical ? 'بحرانی P0/P1' : 'توسعه و استانداردسازی';
const cleanTitle = `"${(t.title || '').replace(/"/g, '""')}"`;
const cleanImpact = `"${(t.business_impact || '').replace(/"/g, '""')}"`;
const cleanTest = `"${(t.test_command || '').replace(/"/g, '""')}"`;
csv += `${t.id},${isCrit},${cleanTitle},${t.layer_title},${t.sprint},${t.priority},${t.hours},${t.rice.reach},${t.rice.impact},${t.rice.confidence},${t.rice.effort},${t.rice.score},${t.c_level_pillar || ''},${t.file_path},"${t.lines}",${cleanImpact},${cleanTest}\\n`;
});
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.setAttribute('href', url);
link.setAttribute('download', `ekeepa_seo_all_22_tasks_${new Date().toISOString().slice(0,10)}.csv`);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
let currentScope = 'critical';
function setScope(scope) {
currentScope = scope;
document.getElementById('btn-scope-critical').className = `btn-scope ${scope === 'critical' ? 'active' : ''}`;
document.getElementById('btn-scope-all').className = `btn-scope ${scope === 'all' ? 'active' : ''}`;
filterCandidateTable();
}
function renderCandidateTable(tasks) {
const tbody = document.getElementById('candidate-tbody');
tbody.innerHTML = '';
tasks.forEach(t => {
const tr = document.createElement('tr');
tr.onclick = () => openTaskDrawer(t.id);
let pClass = t.priority === 'P0' ? 'badge-p0' : (t.priority === 'P1' ? 'badge-p1' : (t.priority === 'P2' ? 'badge-p2' : 'badge-p3'));
const critBadge = t.is_critical ? '<span class="badge-crit">🔥 بحرانی</span>' : '<span class="badge-ext">⚙️ تکمیلی</span>';
tr.innerHTML = `
<td class="tnum font-bold" style="color: #0F172A;">${t.id}</td>
<td>${critBadge}</td>
<td style="font-weight: 700;">${t.title}</td>
<td><span class="badge badge-${t.layer}">${t.layer_title}</span></td>
<td><span class="badge" style="background:#F1F5F9; color:#475569;">${t.sprint}</span></td>
<td><span class="badge ${pClass}">${t.priority}</span></td>
<td class="tnum font-bold">${t.hours} ساعت</td>
<td class="tnum" style="font-weight: 800; color: #059669;">${t.rice.score.toLocaleString('fa-IR')}</td>
<td><span class="badge" style="background:#EFF6FF; color:#1D4ED8; font-weight:700;">${t.c_level_pillar || 'C-Suite'}</span></td>
<td>
<button class="btn-outline" style="padding: 4px 8px; font-size: 11px;" onclick="event.stopPropagation(); openTaskDrawer('${t.id}')">
دیف کد و تست ↗
</button>
</td>
`;
tbody.appendChild(tr);
});
const headline = document.getElementById('candidate-headline');
if (currentScope === 'critical') {
headline.innerText = `📋 کاتالوگ عملیاتی ۱۲ اقدام بحرانی (نمایش ${tasks.length} مورد)`;
} else {
headline.innerText = `📋 کاتالوگ عملیاتی کل ۲۲ اقدام مهندسی (نمایش ${tasks.length} مورد)`;
}
}
function filterCandidateTable() {
const query = document.getElementById('candidate-search').value.toLowerCase();
const allTasks = window.bundle?.tasks || [];
const filtered = allTasks.filter(t => {
if (currentScope === 'critical' && !t.is_critical) return false;
if (query) {
return t.title.toLowerCase().includes(query) || t.id.toLowerCase().includes(query) || t.file_path.toLowerCase().includes(query);
}
return true;
});
renderCandidateTable(filtered);
}
document.addEventListener('DOMContentLoaded', () => {
filterCandidateTable();
});
</script>
</body>
</html>