1897 lines
95 KiB
HTML
1897 lines
95 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="fa" dir="rtl" class="dark">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>مرکز فرماندهی اجرایی اکیپا | حامد فلاحی & محدثه معصومی</title>
|
||
<script src="https://cdn.tailwindcss.com"></script>
|
||
<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=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet">
|
||
<script src="https://unpkg.com/lucide@latest"></script>
|
||
<script>
|
||
tailwind.config = {
|
||
darkMode: 'class',
|
||
theme: {
|
||
extend: {
|
||
fontFamily: {
|
||
sans: ['Vazirmatn', 'sans-serif'],
|
||
},
|
||
colors: {
|
||
brand: {
|
||
50: '#f0fdf4',
|
||
500: '#22c55e',
|
||
600: '#16a34a',
|
||
},
|
||
surface: {
|
||
bg: '#090a0f',
|
||
card: '#12141c',
|
||
border: '#1f2430',
|
||
input: '#1a1d28',
|
||
hover: '#252a38'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style>
|
||
* { font-feature-settings: "tnum"; }
|
||
body { background-color: #090a0f; color: #f3f4f6; font-family: 'Vazirmatn', sans-serif; }
|
||
::-webkit-scrollbar { width: 6px; height: 6px; }
|
||
::-webkit-scrollbar-track { background: #0c0d14; }
|
||
::-webkit-scrollbar-thumb { background: #262c3d; border-radius: 3px; }
|
||
::-webkit-scrollbar-thumb:hover { background: #3b4259; }
|
||
.laser-glow { box-shadow: 0 0 50px -10px rgba(59, 130, 246, 0.25); }
|
||
.pulse-danger { animation: pulseRed 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
|
||
@keyframes pulseRed { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
|
||
</style>
|
||
</head>
|
||
<body class="min-h-screen bg-[#090a0f] text-gray-100 flex flex-col antialiased selection:bg-blue-600 selection:text-white">
|
||
|
||
<!-- ================= AUTH OVERLAY ================= -->
|
||
<div id="authOverlay" class="fixed inset-0 z-50 bg-[#090a0f]/95 backdrop-blur-xl flex items-center justify-center p-4">
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-3xl p-8 max-w-md w-full shadow-2xl text-center relative overflow-hidden">
|
||
<div class="absolute -top-24 -left-24 w-48 h-48 bg-blue-600/20 rounded-full blur-3xl"></div>
|
||
<div class="absolute -bottom-24 -right-24 w-48 h-48 bg-emerald-600/20 rounded-full blur-3xl"></div>
|
||
|
||
<div class="w-16 h-16 bg-gradient-to-tr from-blue-600 to-indigo-600 rounded-2xl flex items-center justify-center mx-auto mb-6 shadow-lg shadow-indigo-600/30">
|
||
<i data-lucide="shield-check" class="w-8 h-8 text-white"></i>
|
||
</div>
|
||
|
||
<h2 class="text-2xl font-bold text-white mb-2">ورود به مرکز فرماندهی اکیپا</h2>
|
||
<p class="text-xs text-gray-400 mb-6 leading-relaxed">سامانه مدیریت اجرایی و تصمیمگیری استراتژیک (نسخه ۴ - متصل به سرور)</p>
|
||
|
||
<div class="space-y-4 mb-6">
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<button type="button" onclick="selectRole('mohadese')" id="roleBtnMohadese" class="p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-emerald-500/50 bg-emerald-500/10 text-emerald-300 shadow-sm">
|
||
<i data-lucide="user-check" class="w-5 h-5"></i>
|
||
<span>محدثه معصومی</span>
|
||
<span class="text-[10px] opacity-75 font-normal">دستیار اجرایی (EA)</span>
|
||
</button>
|
||
<button type="button" onclick="selectRole('hamed')" id="roleBtnHamed" class="p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-gray-800 bg-[#161922] text-gray-400 hover:border-gray-700">
|
||
<i data-lucide="zap" class="w-5 h-5"></i>
|
||
<span>حامد فلاحی</span>
|
||
<span class="text-[10px] opacity-75 font-normal">مدیرعامل (CEO)</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="relative">
|
||
<input type="password" id="pinInput" placeholder="رمز عبور را وارد کنید..." class="w-full bg-[#161922] border border-gray-800 rounded-xl px-4 py-3.5 text-center text-sm font-medium tracking-widest focus:outline-none focus:border-blue-500 transition-all text-white placeholder-gray-500">
|
||
</div>
|
||
</div>
|
||
|
||
<div id="authError" class="text-rose-400 text-xs mb-4 hidden">رمز عبور نادرست است.</div>
|
||
|
||
<button onclick="submitAuth()" class="w-full bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white font-semibold py-3.5 px-6 rounded-xl shadow-lg shadow-blue-600/25 transition-all text-sm flex items-center justify-center gap-2">
|
||
<i data-lucide="unlock" class="w-4 h-4"></i>
|
||
<span>احراز هویت و ورود</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- ================= TOP APP BAR ================= -->
|
||
<header class="border-b border-gray-800/80 bg-[#0d0f17]/90 backdrop-blur-md sticky top-0 z-40">
|
||
<div class="max-w-[1680px] mx-auto px-4 sm:px-6 h-16 flex items-center justify-between gap-4">
|
||
|
||
<!-- Brand & Profile -->
|
||
<div class="flex items-center gap-3">
|
||
<div class="w-10 h-10 rounded-xl bg-gradient-to-tr from-blue-600 to-indigo-600 flex items-center justify-center shadow-md">
|
||
<i data-lucide="command" class="w-5 h-5 text-white"></i>
|
||
</div>
|
||
<div>
|
||
<div class="flex items-center gap-2">
|
||
<span class="text-sm font-bold text-white tracking-tight">EKEEPA</span>
|
||
<span class="text-[10px] bg-blue-500/20 text-blue-400 border border-blue-500/30 px-2 py-0.5 rounded-full font-mono font-medium">V4 Live</span>
|
||
</div>
|
||
<div class="text-[11px] text-gray-400 flex items-center gap-1.5">
|
||
<span id="activeUserBadge" class="text-emerald-400 font-medium">محدثه معصومی (EA)</span>
|
||
<span class="text-gray-600">•</span>
|
||
<span id="liveClock" class="text-gray-400 font-mono">--:--:--</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Navigation Tabs -->
|
||
<nav id="mainNav" class="flex items-center gap-1 overflow-x-auto py-1 px-1 bg-[#12141d] rounded-2xl border border-gray-800/80 max-w-full">
|
||
<button onclick="setTab('command')" id="nav-command" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all bg-blue-600 text-white shadow-sm">
|
||
<i data-lucide="layout-dashboard" class="w-4 h-4"></i>
|
||
<span>مرکز فرماندهی</span>
|
||
</button>
|
||
<button onclick="setTab('focus')" id="nav-focus" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="crosshair" class="w-4 h-4"></i>
|
||
<span id="focusNavTitle">تونل تمرکز مدیر</span>
|
||
</button>
|
||
<button onclick="setTab('braindump')" id="nav-braindump" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="sparkles" class="w-4 h-4"></i>
|
||
<span>میز کار تخلیه ذهن</span>
|
||
</button>
|
||
<button onclick="setTab('finance')" id="nav-finance" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="wallet" class="w-4 h-4"></i>
|
||
<span>اتاق مالی و بلو</span>
|
||
</button>
|
||
<button onclick="setTab('vault')" id="nav-vault" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="folder-lock" class="w-4 h-4"></i>
|
||
<span>خزانه اسناد</span>
|
||
</button>
|
||
<button onclick="setTab('contacts')" id="nav-contacts" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="users" class="w-4 h-4"></i>
|
||
<span>مخاطبین VIP</span>
|
||
</button>
|
||
<button onclick="setTab('telegram')" id="nav-telegram" class="nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]">
|
||
<i data-lucide="send" class="w-4 h-4"></i>
|
||
<span>تلگرام</span>
|
||
</button>
|
||
</nav>
|
||
|
||
<!-- Sync Status & Logout -->
|
||
<div class="flex items-center gap-2">
|
||
<button onclick="syncCalendarNow()" title="همگامسازی تقویم زنده" class="p-2 rounded-xl border border-gray-800 bg-[#12141d] hover:bg-[#1a1d29] text-gray-400 hover:text-blue-400 transition-all text-xs flex items-center gap-1.5">
|
||
<i data-lucide="refresh-cw" id="syncSpinner" class="w-3.5 h-3.5"></i>
|
||
<span class="hidden md:inline text-[11px]" id="lastSyncLabel">سینک تقویم</span>
|
||
</button>
|
||
<a href="https://calendar.google.com/" target="_blank" class="p-2 rounded-xl border border-blue-500/30 bg-blue-500/10 hover:bg-blue-500/20 text-blue-400 transition-all text-xs flex items-center gap-1.5">
|
||
<i data-lucide="calendar" class="w-3.5 h-3.5"></i>
|
||
<span class="hidden md:inline text-[11px]">تقویم کلان</span>
|
||
</a>
|
||
<button onclick="logout()" title="خروج از حساب" class="p-2 rounded-xl border border-gray-800 bg-[#12141d] hover:bg-rose-500/10 hover:text-rose-400 hover:border-rose-500/30 text-gray-400 transition-all">
|
||
<i data-lucide="log-out" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
</header>
|
||
|
||
<!-- ================= RED ALERT CRISIS BANNER ================= -->
|
||
<div id="redAlertBanner" class="bg-gradient-to-r from-rose-950 via-rose-900 to-rose-950 border-b border-rose-700/60 text-white px-4 py-3 hidden transition-all shadow-lg shadow-rose-900/30">
|
||
<div class="max-w-[1680px] mx-auto flex items-center justify-between gap-4">
|
||
<div class="flex items-center gap-3">
|
||
<div class="w-9 h-9 rounded-xl bg-rose-600 flex items-center justify-center shrink-0 pulse-danger shadow-md shadow-rose-600/40">
|
||
<i data-lucide="alert-octagon" class="w-5 h-5 text-white"></i>
|
||
</div>
|
||
<div>
|
||
<div class="text-xs font-extrabold uppercase tracking-wider text-rose-300 flex items-center gap-2">
|
||
<span>وضعیت بحران و اولویت قرمز (RED ALERT)</span>
|
||
<span class="w-2 h-2 rounded-full bg-rose-400 animate-ping"></span>
|
||
</div>
|
||
<div class="text-sm font-semibold text-white mt-0.5" id="redAlertTitle">اقدام فوری ثبت شده نیازمند اقدام آنی مدیرعامل است.</div>
|
||
</div>
|
||
</div>
|
||
<button onclick="openFocusTaskFromAlert()" class="bg-rose-600 hover:bg-rose-500 text-white text-xs font-bold px-4 py-2 rounded-xl shadow-md transition-all flex items-center gap-2 shrink-0">
|
||
<span>انتقال به تونل تمرکز</span>
|
||
<i data-lucide="arrow-left" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- ================= MAIN CONTAINER ================= -->
|
||
<main class="flex-1 max-w-[1680px] w-full mx-auto p-4 sm:p-6">
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 1: DAILY COMMAND CENTER -->
|
||
<!-- Tasks = 70% (8 cols) | Google Calendar 21-30 Mehr = 30% -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-command" class="tab-content space-y-6">
|
||
|
||
<!-- Top Action Bar for EA -->
|
||
<div id="eaQuickBar" class="bg-[#12141d] border border-gray-800 rounded-2xl p-4 flex flex-col md:flex-row items-center justify-between gap-4 shadow-sm">
|
||
<div class="flex items-center gap-3 w-full md:w-auto">
|
||
<div class="w-9 h-9 rounded-xl bg-blue-600/20 border border-blue-500/30 flex items-center justify-center text-blue-400">
|
||
<i data-lucide="zap" class="w-4 h-4"></i>
|
||
</div>
|
||
<div>
|
||
<div class="text-xs font-bold text-white">ثبت فوری اقدام دستیار (Fast Capture)</div>
|
||
<div class="text-[11px] text-gray-400">اقدام جدید بدون رفرش صفحه مستقیماً به تسکهای امروز اضافه میشود</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="flex items-center gap-2 w-full md:w-auto flex-1 max-w-2xl">
|
||
<input type="text" id="quickTaskInput" placeholder="عنوان اقدام فوری را بنویسید (مثال: بررسی صورتحساب مالیاتی)..." class="bg-[#181b26] border border-gray-700/80 rounded-xl px-4 py-2.5 text-xs text-white placeholder-gray-500 focus:outline-none focus:border-blue-500 flex-1">
|
||
<select id="quickTaskResp" class="bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2.5 text-xs text-gray-200 focus:outline-none focus:border-blue-500">
|
||
<option value="hamed">حامد</option>
|
||
<option value="mohadese">محدثه</option>
|
||
<option value="team">تیم</option>
|
||
</select>
|
||
<select id="quickTaskPrio" class="bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2.5 text-xs text-gray-200 focus:outline-none focus:border-blue-500">
|
||
<option value="urgent">فوری</option>
|
||
<option value="crisis">بحران</option>
|
||
<option value="high">بالا</option>
|
||
<option value="normal">عادی</option>
|
||
</select>
|
||
<button onclick="submitQuickTask()" class="bg-blue-600 hover:bg-blue-500 text-white px-4 py-2.5 rounded-xl text-xs font-semibold transition-all flex items-center gap-1.5 shrink-0 shadow-md shadow-blue-600/20">
|
||
<i data-lucide="plus" class="w-3.5 h-3.5"></i>
|
||
<span>افزودن</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Grid Layout: Tasks (8 cols) & Calendar Sidebar (4 cols) -->
|
||
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 items-start">
|
||
|
||
<!-- ================= LEFT / WIDE: TASKS (67% - 8 Cols) ================= -->
|
||
<div class="lg:col-span-8 space-y-4">
|
||
|
||
<!-- Tasks Header & Filters -->
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-4 flex flex-col sm:flex-row items-center justify-between gap-4">
|
||
<div>
|
||
<div class="flex items-center gap-2">
|
||
<i data-lucide="check-square" class="w-5 h-5 text-blue-400"></i>
|
||
<h3 class="text-sm font-bold text-white">تسکهای حیاتی و اجرایی</h3>
|
||
<span id="tasksCountBadge" class="bg-blue-500/20 text-blue-400 text-[10px] font-mono px-2 py-0.5 rounded-full border border-blue-500/30 font-bold">۰</span>
|
||
</div>
|
||
<p class="text-[11px] text-gray-400 mt-0.5">تمرکز اصلی روزانه بر اجرای بدون تعلل این اقدامات است</p>
|
||
</div>
|
||
|
||
<!-- Controls & Add Modal Button -->
|
||
<div class="flex flex-wrap items-center gap-2 w-full sm:w-auto">
|
||
<!-- Time Filter -->
|
||
<div class="flex items-center bg-[#181b26] p-1 rounded-xl border border-gray-800 text-xs">
|
||
<button onclick="setTimeFilter('today')" id="filter-today" class="px-2.5 py-1 rounded-lg font-medium transition-all bg-blue-600 text-white">امروز (۱۲ شب)</button>
|
||
<button onclick="setTimeFilter('week')" id="filter-week" class="px-2.5 py-1 rounded-lg font-medium transition-all text-gray-400 hover:text-white">این هفته</button>
|
||
<button onclick="setTimeFilter('month')" id="filter-month" class="px-2.5 py-1 rounded-lg font-medium transition-all text-gray-400 hover:text-white">این ماه</button>
|
||
<button onclick="setTimeFilter('all')" id="filter-all" class="px-2.5 py-1 rounded-lg font-medium transition-all text-gray-400 hover:text-white">همه</button>
|
||
</div>
|
||
|
||
<!-- Responsible Filter -->
|
||
<select id="respFilter" onchange="applyFilters()" class="bg-[#181b26] border border-gray-800 rounded-xl px-2.5 py-1.5 text-xs text-gray-300 focus:outline-none">
|
||
<option value="all">همه مسئولها</option>
|
||
<option value="hamed">فقط حامد</option>
|
||
<option value="mohadese">فقط محدثه</option>
|
||
<option value="team">تیم</option>
|
||
</select>
|
||
|
||
<!-- Modal Trigger -->
|
||
<button onclick="openTaskModal()" id="btnOpenTaskModal" class="bg-emerald-600 hover:bg-emerald-500 text-white px-3 py-1.5 rounded-xl text-xs font-semibold transition-all flex items-center gap-1 shadow-md shadow-emerald-600/20">
|
||
<i data-lucide="plus" class="w-3.5 h-3.5"></i>
|
||
<span>تسک جدید</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Tasks List Container -->
|
||
<div id="tasksList" class="space-y-3">
|
||
<!-- Dynamic task cards render here -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ================= RIGHT / SIDE: MEETINGS 21-30 MEHR (33% - 4 Cols) ================= -->
|
||
<div class="lg:col-span-4 space-y-4">
|
||
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-4">
|
||
<div class="flex items-center justify-between mb-3 pb-3 border-b border-gray-800">
|
||
<div class="flex items-center gap-2">
|
||
<i data-lucide="calendar-clock" class="w-4 h-4 text-emerald-400"></i>
|
||
<h3 class="text-xs font-bold text-white">جلسات ۲۱ تا ۳۰ مهر ۱۴۰۵</h3>
|
||
</div>
|
||
<span id="meetingsCountBadge" class="text-[10px] bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 px-2 py-0.5 rounded-full font-mono font-medium">۰ جلسه</span>
|
||
</div>
|
||
|
||
<p class="text-[11px] text-gray-400 mb-4 leading-relaxed">
|
||
جلسات هفتگی و آنلاین تقویم گوگل همراه با بافر تایم، لینک ورود و بریف اختصاصی جهت یادآوری.
|
||
</p>
|
||
|
||
<!-- Timeline List -->
|
||
<div id="meetingsList" class="space-y-3 max-h-[750px] overflow-y-auto pr-1">
|
||
<!-- Render meetings -->
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 2: CEO FOCUS TUNNEL (Dedicated Single-Task View) -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-focus" class="tab-content hidden space-y-6">
|
||
|
||
<!-- Hamed's Laser View (Shown when role == 'hamed') -->
|
||
<div id="hamedFocusContainer" class="max-w-3xl mx-auto py-6">
|
||
<div class="bg-[#12141c] border border-blue-500/40 rounded-3xl p-8 shadow-2xl laser-glow relative overflow-hidden">
|
||
<div class="absolute -top-32 -left-32 w-64 h-64 bg-blue-600/10 rounded-full blur-3xl"></div>
|
||
|
||
<div class="flex items-center justify-between mb-6 pb-4 border-b border-gray-800">
|
||
<div class="flex items-center gap-2.5">
|
||
<span class="w-3 h-3 rounded-full bg-blue-500 animate-pulse"></span>
|
||
<span class="text-xs font-extrabold uppercase tracking-widest text-blue-400">تونل تمرکز لیزری مدیرعامل</span>
|
||
</div>
|
||
<span id="focusTaskPrioBadge" class="px-3 py-1 rounded-full text-xs font-bold bg-rose-500/20 text-rose-300 border border-rose-500/30">فوری</span>
|
||
</div>
|
||
|
||
<div class="space-y-6">
|
||
<div>
|
||
<div class="text-xs font-semibold text-gray-400 mb-1 flex items-center gap-1.5">
|
||
<i data-lucide="clock" class="w-3.5 h-3.5 text-amber-400"></i>
|
||
<span id="focusTaskDeadline">ددلاین: تا ۱۸:۰۰ امروز</span>
|
||
</div>
|
||
<h2 id="focusTaskTitle" class="text-2xl sm:text-3xl font-extrabold text-white leading-tight mt-2">
|
||
تایید نهایی قرارداد اسپانسری نیایش مال
|
||
</h2>
|
||
</div>
|
||
|
||
<!-- Description -->
|
||
<div class="bg-[#181b26] border border-gray-800 rounded-2xl p-5">
|
||
<h4 class="text-xs font-bold text-gray-300 mb-2 flex items-center gap-1.5">
|
||
<i data-lucide="file-text" class="w-3.5 h-3.5 text-blue-400"></i>
|
||
<span>شرح دقیق و ماموریت اقدام:</span>
|
||
</h4>
|
||
<p id="focusTaskDesc" class="text-sm text-gray-300 leading-relaxed">
|
||
مستندات قرارداد در خزانه موجود است. سقف تعهد ۱۵۰ میلیون تومان را بازبینی و پاراف کنید.
|
||
</p>
|
||
</div>
|
||
|
||
<!-- Note from EA (Mohadese) -->
|
||
<div id="focusTaskEABox" class="bg-amber-500/10 border border-amber-500/30 rounded-2xl p-4 text-amber-200">
|
||
<div class="text-xs font-bold flex items-center gap-1.5 mb-1 text-amber-300">
|
||
<i data-lucide="message-square" class="w-3.5 h-3.5"></i>
|
||
<span>یادداشت درِ گوشی دستیار (محدثه):</span>
|
||
</div>
|
||
<p id="focusTaskEANote" class="text-xs leading-relaxed">
|
||
حامد جان، بند ۴.۲ درباره خسارت تاخیر تصحیح شده. فقط امضای نهایی شما لازم است.
|
||
</p>
|
||
</div>
|
||
|
||
<!-- Action Button -->
|
||
<div class="pt-4 flex flex-col sm:flex-row items-center gap-3">
|
||
<button onclick="completeCurrentFocusTask()" id="btnCompleteFocus" class="w-full sm:flex-1 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white font-bold py-4 px-6 rounded-2xl shadow-lg shadow-emerald-600/25 transition-all text-sm flex items-center justify-center gap-2">
|
||
<i data-lucide="check-circle" class="w-5 h-5"></i>
|
||
<span>✓ انجام دادم (ارسال جهت بررسی و تایید محدثه)</span>
|
||
</button>
|
||
|
||
<div class="flex items-center gap-2">
|
||
<button onclick="prevFocusTask()" title="اقدام قبلی" class="p-3.5 rounded-2xl bg-[#181b26] border border-gray-800 hover:bg-gray-800 text-gray-300 transition-all">
|
||
<i data-lucide="chevron-right" class="w-4 h-4"></i>
|
||
</button>
|
||
<button onclick="nextFocusTask()" title="اقدام بعدی" class="p-3.5 rounded-2xl bg-[#181b26] border border-gray-800 hover:bg-gray-800 text-gray-300 transition-all">
|
||
<i data-lucide="chevron-left" class="w-4 h-4"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="focusCompletedMsg" class="hidden p-4 rounded-2xl bg-blue-500/10 border border-blue-500/30 text-blue-300 text-xs text-center">
|
||
این اقدام تکمیل شد و وضعیت آن به «نیازمند راستیآزمایی دستیار» تغییر یافت.
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Mohadese Focus Manager (Shown when role == 'mohadese') -->
|
||
<div id="mohadeseFocusManager" class="space-y-6">
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-5 flex items-center justify-between">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="crosshair" class="w-4 h-4 text-blue-400"></i>
|
||
<span>مدیریت تونل تمرکز حامد (کارتابل دستیار)</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">تسکهایی که حامد در صفحه تمرکز لیزری خود مشاهده میکند یا برای بررسی فرستاده است.</p>
|
||
</div>
|
||
<button onclick="openAddFocusModal()" class="bg-blue-600 hover:bg-blue-500 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-md">
|
||
<i data-lucide="plus" class="w-4 h-4"></i>
|
||
<span>افزودن تسک تمرکز</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div id="focusTasksAdminList" class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||
<!-- Admin cards for focus tasks -->
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 3: BRAIN DUMP (Private to Mohadese) -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-braindump" class="tab-content hidden space-y-6">
|
||
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-5 flex flex-col sm:flex-row items-center justify-between gap-4">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="sparkles" class="w-4 h-4 text-amber-400"></i>
|
||
<span>میز کار تخلیه ذهن و پردازش دستیار (Brain Dump)</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">ایدهها، ویسها و یادداشتهای پراکنده را قبل از تبدیل به تسک رسمی برچسبگذاری و ویرایش کنید.</p>
|
||
</div>
|
||
<button onclick="openAddBrainDumpModal()" class="bg-amber-600 hover:bg-amber-500 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-md">
|
||
<i data-lucide="plus" class="w-4 h-4"></i>
|
||
<span>یادداشت جدید</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div id="brainDumpList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||
<!-- Render Brain Dump Cards -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 4: FINANCIAL HUB (BLUBANK & ACCOUNTS) -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-finance" class="tab-content hidden space-y-6">
|
||
|
||
<div class="flex items-center justify-between">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="wallet" class="w-4 h-4 text-blue-400"></i>
|
||
<span>اتاق مالی و مدیریت حسابهای بانکی</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">گردش وجوه، سقفهای برداشت روزانه و لینک فاکتورهای رسمی در Google Drive</p>
|
||
</div>
|
||
<div id="financeAdminBtns" class="flex items-center gap-2">
|
||
<button onclick="openAddAccountModal()" class="bg-[#181b26] border border-gray-800 hover:border-gray-700 text-gray-200 px-3 py-1.5 rounded-xl text-xs font-medium flex items-center gap-1">
|
||
<i data-lucide="credit-card" class="w-3.5 h-3.5 text-blue-400"></i>
|
||
<span>حساب جدید</span>
|
||
</button>
|
||
<button onclick="openAddTxModal()" class="bg-blue-600 hover:bg-blue-500 text-white px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1 shadow-md">
|
||
<i data-lucide="plus" class="w-3.5 h-3.5"></i>
|
||
<span>ثبت تراکنش</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Account Cards -->
|
||
<div id="accountsCards" class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||
<!-- Dynamic account cards -->
|
||
</div>
|
||
|
||
<!-- Transactions Table -->
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl overflow-hidden">
|
||
<div class="p-4 border-b border-gray-800 flex items-center justify-between">
|
||
<h4 class="text-xs font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="arrow-left-right" class="w-3.5 h-3.5 text-emerald-400"></i>
|
||
<span>تراکنشهای اخیر و فاکتورهای متصل</span>
|
||
</h4>
|
||
<span class="text-[10px] text-gray-400">تمام مبالغ به تومان و ریال درج شده است</span>
|
||
</div>
|
||
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-right text-xs">
|
||
<thead class="bg-[#181b26] text-gray-400 border-b border-gray-800">
|
||
<tr>
|
||
<th class="p-3">شرح تراکنش</th>
|
||
<th class="p-3">مبلغ (تومان)</th>
|
||
<th class="p-3">مبلغ (ریال)</th>
|
||
<th class="p-3">تاریخ</th>
|
||
<th class="p-3">دستهبندی</th>
|
||
<th class="p-3">فاکتور / رسید</th>
|
||
<th class="p-3 text-center">عملیات</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody id="txTableBody" class="divide-y divide-gray-800/60 text-gray-300">
|
||
<!-- Render rows -->
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 5: THE VAULT (GOOGLE DRIVE) -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-vault" class="tab-content hidden space-y-6">
|
||
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-5 flex flex-col sm:flex-row items-center justify-between gap-4">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="folder-lock" class="w-4 h-4 text-indigo-400"></i>
|
||
<span>خزانه اسناد و قراردادهای محرمانه (The Vault)</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">متصل به Google Drive (فولدرهای مدارک هویتی، سهامداری، وکالت و فاکتورهای رسمی)</p>
|
||
</div>
|
||
<div class="flex items-center gap-2">
|
||
<a href="https://drive.google.com/drive/folders/1Q96NiKF4QWpgLlW3a9OlolCtSjTUF0RN" target="_blank" class="bg-indigo-600 hover:bg-indigo-500 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-md">
|
||
<i data-lucide="external-link" class="w-4 h-4"></i>
|
||
<span>ورود به گوگل درایو</span>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="vaultList" class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||
<!-- Render Vault items -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 6: VIP CONTACTS (FULL EDITABLE NAME/ROLE/ETC) -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-contacts" class="tab-content hidden space-y-6">
|
||
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-5 flex items-center justify-between">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="users" class="w-4 h-4 text-emerald-400"></i>
|
||
<span>دفترچه مخاطبین کلیدی و VIP</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">اطلاعات شرکا، سرمایهگذاران و اعضای کلیدی همراه با یادداشتهای رفتاری و حساسیتهای جلسه</p>
|
||
</div>
|
||
<button onclick="openAddContactModal()" class="bg-emerald-600 hover:bg-emerald-500 text-white px-4 py-2 rounded-xl text-xs font-semibold flex items-center gap-1.5 shadow-md">
|
||
<i data-lucide="user-plus" class="w-4 h-4"></i>
|
||
<span>مخاطب جدید</span>
|
||
</button>
|
||
</div>
|
||
|
||
<div id="contactsList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||
<!-- Render Contacts -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<!-- ======================================================== -->
|
||
<!-- TAB 7: TELEGRAM OBSERVATORY -->
|
||
<!-- ======================================================== -->
|
||
<div id="tab-telegram" class="tab-content hidden space-y-6">
|
||
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-5 flex items-center justify-between">
|
||
<div>
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="send" class="w-4 h-4 text-sky-400"></i>
|
||
<span>رصدخانه پیامهای تلگرام (VIP Inbox)</span>
|
||
</h3>
|
||
<p class="text-xs text-gray-400 mt-1">خلاصه پیامهای ورودی از افراد کلیدی جهت تبدیل سریع به اقدام عملیاتی</p>
|
||
</div>
|
||
<span class="text-[10px] bg-sky-500/20 text-sky-400 border border-sky-500/30 px-2.5 py-1 rounded-full font-semibold">آماده اتصال وبهوک</span>
|
||
</div>
|
||
|
||
<div id="telegramList" class="space-y-3">
|
||
<!-- Render Telegram VIP Cards -->
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</main>
|
||
|
||
<!-- ================= MODALS CONTAINER ================= -->
|
||
|
||
<!-- TASK MODAL (ADD / EDIT) -->
|
||
<div id="taskModal" class="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm hidden flex items-center justify-center p-4">
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-3xl p-6 max-w-lg w-full shadow-2xl relative">
|
||
<div class="flex items-center justify-between pb-4 mb-4 border-b border-gray-800">
|
||
<h3 id="taskModalTitle" class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="edit" class="w-4 h-4 text-blue-400"></i>
|
||
<span>ثبت / ویرایش تسک حیاتی</span>
|
||
</h3>
|
||
<button onclick="closeModal('taskModal')" class="text-gray-400 hover:text-white">
|
||
<i data-lucide="x" class="w-5 h-5"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<input type="hidden" id="taskEditId">
|
||
|
||
<div class="space-y-3 text-xs">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">عنوان اقدام:</label>
|
||
<input type="text" id="taskModalInputTitle" placeholder="مثلاً: بررسی و امضای قرارداد نیایش مال..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2.5 text-white focus:outline-none focus:border-blue-500">
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">توضیحات و بریف اجرایی:</label>
|
||
<textarea id="taskModalInputDesc" rows="3" placeholder="شرح کامل کار، فایلهای مرتبط، شرایط و..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2.5 text-white focus:outline-none focus:border-blue-500"></textarea>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">مسئول اقدام:</label>
|
||
<select id="taskModalInputResp" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
<option value="hamed">حامد فلاحی</option>
|
||
<option value="mohadese">محدثه معصومی</option>
|
||
<option value="team">تیم فنی / اجرایی</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">سطح اولویت:</label>
|
||
<select id="taskModalInputPrio" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
<option value="crisis">بحران (قرمز - توقف سایر کارها)</option>
|
||
<option value="urgent">فوری</option>
|
||
<option value="high">بالا</option>
|
||
<option value="normal">عادی</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">مهلت و ددلاین:</label>
|
||
<input type="text" id="taskModalInputDeadline" placeholder="امروز (تا ۱۸:۰۰)" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">دستهبندی:</label>
|
||
<select id="taskModalInputCategory" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
<option value="اکیپا">اکیپا</option>
|
||
<option value="مایندرو">مایندرو</option>
|
||
<option value="مالی">مالی و بانکی</option>
|
||
<option value="قرارداد">قراردادها</option>
|
||
<option value="عمومی">عمومی</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="pt-5 mt-4 border-t border-gray-800 flex items-center justify-end gap-2">
|
||
<button onclick="closeModal('taskModal')" class="px-4 py-2 rounded-xl bg-gray-800 text-gray-300 hover:bg-gray-700 text-xs">انصراف</button>
|
||
<button onclick="saveTaskModal()" class="px-5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white font-semibold text-xs shadow-md">ذخیره تسک</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- VIP CONTACT MODAL (EDIT ALL FIELDS INCLUDING NAME) -->
|
||
<div id="contactModal" class="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm hidden flex items-center justify-center p-4">
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-3xl p-6 max-w-md w-full shadow-2xl relative">
|
||
<div class="flex items-center justify-between pb-4 mb-4 border-b border-gray-800">
|
||
<h3 id="contactModalTitle" class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="user-check" class="w-4 h-4 text-emerald-400"></i>
|
||
<span>ثبت / ویرایش مخاطب VIP</span>
|
||
</h3>
|
||
<button onclick="closeModal('contactModal')" class="text-gray-400 hover:text-white">
|
||
<i data-lucide="x" class="w-5 h-5"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<input type="hidden" id="contactEditId">
|
||
|
||
<div class="space-y-3 text-xs">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">نام و نام خانوادگی:</label>
|
||
<input type="text" id="contactInputName" placeholder="مثلاً: آرمین هیربد" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2 text-white focus:outline-none focus:border-emerald-500">
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">سمت و نقش سازمانی:</label>
|
||
<input type="text" id="contactInputRole" placeholder="شریک استراتژیک، سرمایهگذار و..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2 text-white focus:outline-none focus:border-emerald-500">
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">شماره تماس مستقیم:</label>
|
||
<input type="text" id="contactInputPhone" placeholder="0912..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-emerald-500">
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">آیدی تلگرام:</label>
|
||
<input type="text" id="contactInputTg" placeholder="@username" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-emerald-500">
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">اولویت ارتباط:</label>
|
||
<select id="contactInputPrio" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-emerald-500">
|
||
<option value="فوری">فوری</option>
|
||
<option value="بالا">بالا</option>
|
||
<option value="عادی">عادی</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">یادداشت رفتاری و نکات کلیدی جلسه:</label>
|
||
<textarea id="contactInputNotes" rows="2.5" placeholder="حساسیتهای فردی، نحوه پاسخگویی و..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-emerald-500"></textarea>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="pt-5 mt-4 border-t border-gray-800 flex items-center justify-end gap-2">
|
||
<button onclick="closeModal('contactModal')" class="px-4 py-2 rounded-xl bg-gray-800 text-gray-300 hover:bg-gray-700 text-xs">انصراف</button>
|
||
<button onclick="saveContactModal()" class="px-5 py-2 rounded-xl bg-emerald-600 hover:bg-emerald-500 text-white font-semibold text-xs shadow-md">ذخیره مخاطب</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- BRAIN DUMP MODAL -->
|
||
<div id="brainDumpModal" class="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm hidden flex items-center justify-center p-4">
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-3xl p-6 max-w-md w-full shadow-2xl relative">
|
||
<div class="flex items-center justify-between pb-4 mb-4 border-b border-gray-800">
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="sparkles" class="w-4 h-4 text-amber-400"></i>
|
||
<span>یادداشت تخلیه ذهن دستیار</span>
|
||
</h3>
|
||
<button onclick="closeModal('brainDumpModal')" class="text-gray-400 hover:text-white">
|
||
<i data-lucide="x" class="w-5 h-5"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="space-y-3 text-xs">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">متن یادداشت یا ایده:</label>
|
||
<textarea id="brainDumpInputText" rows="4" placeholder="متن کامل بدون فیلتر..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2.5 text-white focus:outline-none focus:border-amber-500"></textarea>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">برچسبها (با کاما جدا کنید):</label>
|
||
<input type="text" id="brainDumpInputTags" placeholder="حامد, مالی, فوری" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-amber-500">
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">مسئول پیشنهادی:</label>
|
||
<select id="brainDumpInputResp" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-amber-500">
|
||
<option value="hamed">حامد</option>
|
||
<option value="mohadese">محدثه</option>
|
||
<option value="team">تیم</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">اولویت پیشنهادی:</label>
|
||
<select id="brainDumpInputPrio" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-amber-500">
|
||
<option value="فوری">فوری</option>
|
||
<option value="بحران">بحران</option>
|
||
<option value="بالا">بالا</option>
|
||
<option value="عادی">عادی</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="pt-5 mt-4 border-t border-gray-800 flex items-center justify-end gap-2">
|
||
<button onclick="closeModal('brainDumpModal')" class="px-4 py-2 rounded-xl bg-gray-800 text-gray-300 hover:bg-gray-700 text-xs">انصراف</button>
|
||
<button onclick="saveBrainDumpModal()" class="px-5 py-2 rounded-xl bg-amber-600 hover:bg-amber-500 text-white font-semibold text-xs shadow-md">ثبت یادداشت</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- ADD FOCUS TASK MODAL (FOR EA) -->
|
||
<div id="addFocusModal" class="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm hidden flex items-center justify-center p-4">
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-3xl p-6 max-w-md w-full shadow-2xl relative">
|
||
<div class="flex items-center justify-between pb-4 mb-4 border-b border-gray-800">
|
||
<h3 class="text-sm font-bold text-white flex items-center gap-2">
|
||
<i data-lucide="crosshair" class="w-4 h-4 text-blue-400"></i>
|
||
<span>افزودن تسک تمرکز لیزری برای حامد</span>
|
||
</h3>
|
||
<button onclick="closeModal('addFocusModal')" class="text-gray-400 hover:text-white">
|
||
<i data-lucide="x" class="w-5 h-5"></i>
|
||
</button>
|
||
</div>
|
||
|
||
<div class="space-y-3 text-xs">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">عنوان اقدام:</label>
|
||
<input type="text" id="focusInputTitle" placeholder="تایید نهایی قرارداد..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">شرح دقیق ماموریت:</label>
|
||
<textarea id="focusInputDesc" rows="3" placeholder="توضیحات و مستندات..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3.5 py-2 text-white focus:outline-none focus:border-blue-500"></textarea>
|
||
</div>
|
||
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">یادداشت درِ گوشی دستیار (نکته راهنما به حامد):</label>
|
||
<input type="text" id="focusInputNoteEA" placeholder="حامد جان بند ۴ رو چک کن..." class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
</div>
|
||
|
||
<div class="grid grid-cols-2 gap-3">
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">اولویت:</label>
|
||
<select id="focusInputPrio" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
<option value="بحران">بحران</option>
|
||
<option value="فوری">فوری</option>
|
||
<option value="بالا">بالا</option>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="block text-gray-400 mb-1">ددلاین:</label>
|
||
<input type="text" id="focusInputDeadline" placeholder="تا ۱۸:۰۰ امروز" class="w-full bg-[#181b26] border border-gray-700/80 rounded-xl px-3 py-2 text-white focus:outline-none focus:border-blue-500">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="pt-5 mt-4 border-t border-gray-800 flex items-center justify-end gap-2">
|
||
<button onclick="closeModal('addFocusModal')" class="px-4 py-2 rounded-xl bg-gray-800 text-gray-300 hover:bg-gray-700 text-xs">انصراف</button>
|
||
<button onclick="saveAddFocusModal()" class="px-5 py-2 rounded-xl bg-blue-600 hover:bg-blue-500 text-white font-semibold text-xs shadow-md">ثبت در صف تمرکز</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- JAVASCRIPT STATE ENGINE & API SYNC -->
|
||
<script>
|
||
// System State
|
||
const appState = {
|
||
currentUser: null, // 'hamed' | 'mohadese'
|
||
currentTab: 'command',
|
||
timeFilter: 'today',
|
||
respFilter: 'all',
|
||
focusIndex: 0,
|
||
tasks: [],
|
||
focusTasks: [],
|
||
meetings: [],
|
||
contacts: [],
|
||
accounts: [],
|
||
transactions: [],
|
||
vault: [],
|
||
brainDump: [],
|
||
telegramVIPs: []
|
||
};
|
||
|
||
// Live clock
|
||
function updateClock() {
|
||
const now = new Date();
|
||
const timeStr = now.toLocaleTimeString('fa-IR');
|
||
const clockEl = document.getElementById('liveClock');
|
||
if (clockEl) clockEl.innerText = timeStr;
|
||
}
|
||
setInterval(updateClock, 1000);
|
||
updateClock();
|
||
|
||
// Authentication
|
||
let selectedAuthRole = 'mohadese';
|
||
function selectRole(role) {
|
||
selectedAuthRole = role;
|
||
const btnMo = document.getElementById('roleBtnMohadese');
|
||
const btnHa = document.getElementById('roleBtnHamed');
|
||
if (role === 'mohadese') {
|
||
btnMo.className = 'p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-emerald-500/50 bg-emerald-500/10 text-emerald-300 shadow-sm';
|
||
btnHa.className = 'p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-gray-800 bg-[#161922] text-gray-400 hover:border-gray-700';
|
||
} else {
|
||
btnHa.className = 'p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-blue-500/50 bg-blue-500/10 text-blue-300 shadow-sm';
|
||
btnMo.className = 'p-3.5 rounded-2xl border text-sm font-semibold transition-all flex flex-col items-center gap-2 border-gray-800 bg-[#161922] text-gray-400 hover:border-gray-700';
|
||
}
|
||
}
|
||
|
||
async function submitAuth() {
|
||
const pin = document.getElementById('pinInput').value.trim();
|
||
const errEl = document.getElementById('authError');
|
||
errEl.classList.add('hidden');
|
||
|
||
try {
|
||
const resp = await fetch('/executive/api/auth', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ pin: pin })
|
||
});
|
||
const data = await resp.json();
|
||
if (data.success) {
|
||
appState.currentUser = data.role;
|
||
localStorage.setItem('ekeepa_user_role', data.role);
|
||
localStorage.setItem('ekeepa_user_token', data.token);
|
||
initRoleViews(data.role);
|
||
document.getElementById('authOverlay').classList.add('hidden');
|
||
await fetchServerState();
|
||
} else {
|
||
errEl.innerText = data.error || 'رمز عبور نادرست است.';
|
||
errEl.classList.remove('hidden');
|
||
}
|
||
} catch (e) {
|
||
// Fallback check if offline
|
||
if (pin === 'Mo@43117700') {
|
||
appState.currentUser = 'mohadese';
|
||
initRoleViews('mohadese');
|
||
document.getElementById('authOverlay').classList.add('hidden');
|
||
await fetchServerState();
|
||
} else if (pin === 'Hf@43117700') {
|
||
appState.currentUser = 'hamed';
|
||
initRoleViews('hamed');
|
||
document.getElementById('authOverlay').classList.add('hidden');
|
||
await fetchServerState();
|
||
} else {
|
||
errEl.innerText = 'خطا در ارتباط با سرور یا رمز نامعتبر.';
|
||
errEl.classList.remove('hidden');
|
||
}
|
||
}
|
||
}
|
||
|
||
// Role-specific View Configuration
|
||
function initRoleViews(role) {
|
||
const badge = document.getElementById('activeUserBadge');
|
||
const navBrainDump = document.getElementById('nav-braindump');
|
||
const focusNavTitle = document.getElementById('focusNavTitle');
|
||
const eaQuickBar = document.getElementById('eaQuickBar');
|
||
const btnOpenTaskModal = document.getElementById('btnOpenTaskModal');
|
||
const hamedFocusContainer = document.getElementById('hamedFocusContainer');
|
||
const mohadeseFocusManager = document.getElementById('mohadeseFocusManager');
|
||
|
||
if (role === 'hamed') {
|
||
badge.innerText = 'حامد فلاحی (مدیرعامل)';
|
||
badge.className = 'text-blue-400 font-semibold';
|
||
// Hide Brain Dump for Hamed
|
||
if (navBrainDump) navBrainDump.classList.add('hidden');
|
||
// Rename focus tab for Hamed
|
||
if (focusNavTitle) focusNavTitle.innerText = 'تونل تمرکز من';
|
||
// Hamed focus deck view
|
||
if (hamedFocusContainer) hamedFocusContainer.classList.remove('hidden');
|
||
if (mohadeseFocusManager) mohadeseFocusManager.classList.add('hidden');
|
||
// Hide EA fast capture bar
|
||
if (eaQuickBar) eaQuickBar.classList.add('hidden');
|
||
if (btnOpenTaskModal) btnOpenTaskModal.classList.add('hidden');
|
||
} else {
|
||
badge.innerText = 'محدثه معصومی (دستیار اجرایی)';
|
||
badge.className = 'text-emerald-400 font-semibold';
|
||
// Show Brain Dump
|
||
if (navBrainDump) navBrainDump.classList.remove('hidden');
|
||
// EA focus view
|
||
if (focusNavTitle) focusNavTitle.innerText = 'کارتابل تمرکز مدیر';
|
||
if (hamedFocusContainer) hamedFocusContainer.classList.add('hidden');
|
||
if (mohadeseFocusManager) mohadeseFocusManager.classList.remove('hidden');
|
||
if (eaQuickBar) eaQuickBar.classList.remove('hidden');
|
||
if (btnOpenTaskModal) btnOpenTaskModal.classList.remove('hidden');
|
||
}
|
||
}
|
||
|
||
function logout() {
|
||
localStorage.removeItem('ekeepa_user_role');
|
||
localStorage.removeItem('ekeepa_user_token');
|
||
location.reload();
|
||
}
|
||
|
||
// API Server State Fetching
|
||
async function fetchServerState() {
|
||
try {
|
||
const resp = await fetch('/executive/api/state');
|
||
if (resp.ok) {
|
||
const data = await resp.json();
|
||
appState.tasks = data.tasks || [];
|
||
appState.focusTasks = data.focusTasks || [];
|
||
appState.meetings = data.meetings || [];
|
||
appState.contacts = data.contacts || [];
|
||
appState.accounts = data.accounts || [];
|
||
appState.transactions = data.transactions || [];
|
||
appState.vault = data.vault || [];
|
||
appState.brainDump = data.brainDump || [];
|
||
appState.telegramVIPs = data.telegramVIPs || [];
|
||
|
||
renderAll();
|
||
}
|
||
} catch (e) {
|
||
console.error('Error fetching server state:', e);
|
||
}
|
||
}
|
||
|
||
// Polling every 6 seconds to keep Hamed and Mohadese in sync
|
||
setInterval(() => {
|
||
if (appState.currentUser) {
|
||
fetchServerState();
|
||
}
|
||
}, 6000);
|
||
|
||
// Sync Calendar On Demand
|
||
async function syncCalendarNow() {
|
||
const spinner = document.getElementById('syncSpinner');
|
||
const label = document.getElementById('lastSyncLabel');
|
||
if (spinner) spinner.classList.add('animate-spin');
|
||
if (label) label.innerText = 'در حال سینک...';
|
||
|
||
try {
|
||
const res = await fetch('/executive/api/sync-calendar');
|
||
const data = await res.json();
|
||
if (data.meetings) {
|
||
appState.meetings = data.meetings;
|
||
renderMeetings();
|
||
}
|
||
if (label) label.innerText = 'سینک شد';
|
||
} catch (e) {
|
||
if (label) label.innerText = 'خطا در سینک';
|
||
} finally {
|
||
if (spinner) spinner.classList.remove('animate-spin');
|
||
setTimeout(() => {
|
||
if (label) label.innerText = 'سینک تقویم';
|
||
}, 3000);
|
||
}
|
||
}
|
||
|
||
// Tabs Navigation
|
||
function setTab(tabId) {
|
||
appState.currentTab = tabId;
|
||
document.querySelectorAll('.tab-content').forEach(el => el.classList.add('hidden'));
|
||
const activeEl = document.getElementById('tab-' + tabId);
|
||
if (activeEl) activeEl.classList.remove('hidden');
|
||
|
||
document.querySelectorAll('.nav-btn').forEach(btn => {
|
||
btn.className = 'nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all text-gray-400 hover:text-gray-200 hover:bg-[#1a1d29]';
|
||
});
|
||
const activeBtn = document.getElementById('nav-' + tabId);
|
||
if (activeBtn) {
|
||
activeBtn.className = 'nav-btn px-3.5 py-1.5 rounded-xl text-xs font-semibold flex items-center gap-1.5 transition-all bg-blue-600 text-white shadow-sm';
|
||
}
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// Filters
|
||
function setTimeFilter(tf) {
|
||
appState.timeFilter = tf;
|
||
['today', 'week', 'month', 'all'].forEach(k => {
|
||
const btn = document.getElementById('filter-' + k);
|
||
if (btn) {
|
||
btn.className = (k === tf)
|
||
? 'px-2.5 py-1 rounded-lg font-medium transition-all bg-blue-600 text-white'
|
||
: 'px-2.5 py-1 rounded-lg font-medium transition-all text-gray-400 hover:text-white';
|
||
}
|
||
});
|
||
renderTasks();
|
||
}
|
||
|
||
function applyFilters() {
|
||
const sel = document.getElementById('respFilter');
|
||
if (sel) appState.respFilter = sel.value;
|
||
renderTasks();
|
||
}
|
||
|
||
// ==========================================
|
||
// RENDER FUNCTIONS
|
||
// ==========================================
|
||
|
||
function renderAll() {
|
||
checkRedAlert();
|
||
renderTasks();
|
||
renderMeetings();
|
||
renderFocusDeck();
|
||
renderBrainDump();
|
||
renderFinance();
|
||
renderVault();
|
||
renderContacts();
|
||
renderTelegram();
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 1. Red Alert Banner
|
||
function checkRedAlert() {
|
||
const banner = document.getElementById('redAlertBanner');
|
||
const title = document.getElementById('redAlertTitle');
|
||
const crisisTask = appState.tasks.find(t => (t.priority === 'crisis' || t.priority === 'urgent') && t.status !== 'completed');
|
||
if (crisisTask) {
|
||
banner.classList.remove('hidden');
|
||
title.innerText = crisisTask.title + ' (مسئول: ' + (crisisTask.responsible === 'hamed' ? 'حامد' : crisisTask.responsible === 'mohadese' ? 'محدثه' : 'تیم') + ' - ددلاین: ' + crisisTask.deadline + ')';
|
||
} else {
|
||
banner.classList.add('hidden');
|
||
}
|
||
}
|
||
|
||
function openFocusTaskFromAlert() {
|
||
setTab('focus');
|
||
}
|
||
|
||
// 2. Render Tasks
|
||
function renderTasks() {
|
||
const listEl = document.getElementById('tasksList');
|
||
const badgeEl = document.getElementById('tasksCountBadge');
|
||
if (!listEl) return;
|
||
|
||
let filtered = appState.tasks;
|
||
|
||
// Responsible filter
|
||
if (appState.respFilter !== 'all') {
|
||
filtered = filtered.filter(t => t.responsible === appState.respFilter);
|
||
}
|
||
|
||
// Time filter (approximate by deadline string or tags)
|
||
if (appState.timeFilter === 'today') {
|
||
filtered = filtered.filter(t => t.deadline.includes('امروز') || t.deadline.includes('۲۴') || t.deadline.includes('ساعت'));
|
||
} else if (appState.timeFilter === 'week') {
|
||
filtered = filtered.filter(t => t.deadline.includes('امروز') || t.deadline.includes('هفته') || t.deadline.includes('۲۴') || t.deadline.includes('۲۸'));
|
||
} else if (appState.timeFilter === 'month') {
|
||
filtered = filtered.filter(t => !t.deadline.includes('سال'));
|
||
}
|
||
|
||
if (badgeEl) badgeEl.innerText = filtered.length;
|
||
|
||
if (filtered.length === 0) {
|
||
listEl.innerHTML = `
|
||
<div class="bg-[#12141d] border border-gray-800 rounded-2xl p-8 text-center text-gray-500">
|
||
<i data-lucide="inbox" class="w-8 h-8 mx-auto mb-2 opacity-50"></i>
|
||
<p class="text-xs">هیچ تسکی با این فیلترها یافت نشد.</p>
|
||
</div>
|
||
`;
|
||
lucide.createIcons();
|
||
return;
|
||
}
|
||
|
||
listEl.innerHTML = filtered.map(t => {
|
||
const isDone = t.status === 'completed';
|
||
const isCrisis = t.priority === 'crisis';
|
||
const isUrgent = t.priority === 'urgent';
|
||
const prioBadge = isCrisis
|
||
? '<span class="bg-rose-500/20 text-rose-300 border border-rose-500/30 px-2 py-0.5 rounded-full text-[10px] font-bold">بحران</span>'
|
||
: isUrgent
|
||
? '<span class="bg-amber-500/20 text-amber-300 border border-amber-500/30 px-2 py-0.5 rounded-full text-[10px] font-bold">فوری</span>'
|
||
: '<span class="bg-blue-500/20 text-blue-300 border border-blue-500/30 px-2 py-0.5 rounded-full text-[10px] font-medium">عادی</span>';
|
||
|
||
const respName = t.responsible === 'hamed' ? 'حامد فلاحی' : t.responsible === 'mohadese' ? 'محدثه معصومی' : 'تیم اکیپا';
|
||
const respColor = t.responsible === 'hamed' ? 'text-blue-400 bg-blue-500/10 border-blue-500/20' : t.responsible === 'mohadese' ? 'text-emerald-400 bg-emerald-500/10 border-emerald-500/20' : 'text-purple-400 bg-purple-500/10 border-purple-500/20';
|
||
|
||
const isEA = appState.currentUser === 'mohadese';
|
||
|
||
return `
|
||
<div class="bg-[#12141d] border ${isCrisis ? 'border-rose-600/60 shadow-lg shadow-rose-950/20' : 'border-gray-800'} rounded-2xl p-4 transition-all hover:border-gray-700 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 ${isDone ? 'opacity-60 bg-[#0e1017]' : ''}">
|
||
|
||
<div class="flex items-start gap-3 flex-1">
|
||
<button onclick="toggleTaskStatus('${t.id}')" class="mt-0.5 w-5 h-5 rounded-lg border ${isDone ? 'bg-emerald-600 border-emerald-500' : 'border-gray-600 hover:border-emerald-400'} flex items-center justify-center shrink-0 transition-all">
|
||
${isDone ? '<i data-lucide="check" class="w-3.5 h-3.5 text-white"></i>' : ''}
|
||
</button>
|
||
|
||
<div class="space-y-1">
|
||
<div class="flex flex-wrap items-center gap-2">
|
||
<span class="text-xs font-bold ${isDone ? 'line-through text-gray-400' : 'text-white'}">${t.title}</span>
|
||
${prioBadge}
|
||
<span class="text-[10px] border px-2 py-0.5 rounded-full ${respColor}">${respName}</span>
|
||
<span class="text-[10px] text-gray-500 font-mono">${t.category || 'عمومی'}</span>
|
||
</div>
|
||
${t.desc ? `<p class="text-xs text-gray-400 leading-relaxed">${t.desc}</p>` : ''}
|
||
<div class="text-[11px] text-gray-500 flex items-center gap-1">
|
||
<i data-lucide="clock" class="w-3 h-3 text-amber-500/80"></i>
|
||
<span>مهلت: ${t.deadline}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Actions -->
|
||
<div class="flex items-center gap-1.5 shrink-0 self-end sm:self-center">
|
||
${isEA ? `
|
||
<button onclick="editTask('${t.id}')" title="ویرایش تسک" class="p-1.5 rounded-lg bg-gray-800/80 hover:bg-gray-700 text-gray-300 hover:text-white transition-all text-xs">
|
||
<i data-lucide="edit-2" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
<button onclick="deleteTask('${t.id}')" title="حذف تسک" class="p-1.5 rounded-lg bg-gray-800/80 hover:bg-rose-500/20 text-gray-300 hover:text-rose-400 transition-all text-xs">
|
||
<i data-lucide="trash-2" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
` : ''}
|
||
<button onclick="sendToFocusTunnel('${t.id}')" title="انتقال به تونل تمرکز" class="px-2.5 py-1.5 rounded-lg bg-blue-600/20 hover:bg-blue-600 border border-blue-500/30 text-blue-300 hover:text-white transition-all text-[11px] font-medium flex items-center gap-1">
|
||
<i data-lucide="crosshair" class="w-3 h-3"></i>
|
||
<span>تمرکز</span>
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 3. Render Meetings (21-30 Mehr)
|
||
function renderMeetings() {
|
||
const container = document.getElementById('meetingsList');
|
||
const badge = document.getElementById('meetingsCountBadge');
|
||
if (!container) return;
|
||
|
||
if (badge) badge.innerText = appState.meetings.length + ' جلسه';
|
||
|
||
if (appState.meetings.length === 0) {
|
||
container.innerHTML = `
|
||
<div class="text-center py-8 text-gray-500 text-xs">
|
||
رویدادی برای بازه ۲۱ تا ۳۰ مهر ثبت نشده است.
|
||
</div>
|
||
`;
|
||
return;
|
||
}
|
||
|
||
container.innerHTML = appState.meetings.map(m => {
|
||
return `
|
||
<div class="bg-[#181b26] border border-gray-800 rounded-xl p-3.5 space-y-2 hover:border-gray-700 transition-all">
|
||
<div class="flex items-center justify-between">
|
||
<span class="text-[11px] font-bold text-emerald-400 bg-emerald-500/10 px-2 py-0.5 rounded-md border border-emerald-500/20">
|
||
${m.date_solar || (m.start_time ? m.start_time.split('T')[0] : '۲۲ مهر')}
|
||
</span>
|
||
<span class="text-xs font-mono font-bold text-white bg-gray-800/80 px-2 py-0.5 rounded-md">
|
||
${m.time || (m.start_time ? m.start_time.split('T')[1].substring(0, 5) : '۱۴:۰۰')}
|
||
</span>
|
||
</div>
|
||
|
||
<div class="text-xs font-bold text-gray-200">${m.title}</div>
|
||
|
||
<div class="text-[10px] text-gray-400 flex items-center gap-1 bg-black/20 p-1.5 rounded-lg">
|
||
<i data-lucide="shield-alert" class="w-3 h-3 text-amber-400 shrink-0"></i>
|
||
<span>${m.buffer || m.attendees || 'جلسه رسمی اکیپا'}</span>
|
||
</div>
|
||
|
||
<!-- Context Note (Editable) -->
|
||
<div class="bg-amber-500/10 border border-amber-500/20 rounded-lg p-2 text-[10px] text-amber-200 flex items-start gap-1.5">
|
||
<i data-lucide="message-square" class="w-3 h-3 text-amber-400 shrink-0 mt-0.5"></i>
|
||
<div class="flex-1">${m.contextNote || 'نکتهای ثبت نشده'}</div>
|
||
</div>
|
||
|
||
<!-- Action buttons: Meet & Neshan -->
|
||
<div class="flex items-center gap-2 pt-1">
|
||
<a href="${m.meetLink}" target="_blank" class="flex-1 bg-blue-600/20 hover:bg-blue-600 border border-blue-500/30 text-blue-300 hover:text-white py-1 px-2 rounded-lg text-[10px] font-semibold text-center transition-all flex items-center justify-center gap-1">
|
||
<i data-lucide="video" class="w-3 h-3"></i>
|
||
<span>ورود به گوگل میت</span>
|
||
</a>
|
||
<a href="${m.neshanLink}" target="_blank" class="flex-1 bg-emerald-600/20 hover:bg-emerald-600 border border-emerald-500/30 text-emerald-300 hover:text-white py-1 px-2 rounded-lg text-[10px] font-semibold text-center transition-all flex items-center justify-center gap-1">
|
||
<i data-lucide="map-pin" class="w-3 h-3"></i>
|
||
<span>مسیریابی نشان</span>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 4. Render Focus Deck
|
||
function renderFocusDeck() {
|
||
// Hamed View
|
||
const curFocus = appState.focusTasks[appState.focusIndex] || appState.focusTasks[0];
|
||
if (curFocus) {
|
||
const titleEl = document.getElementById('focusTaskTitle');
|
||
const descEl = document.getElementById('focusTaskDesc');
|
||
const prioEl = document.getElementById('focusTaskPrioBadge');
|
||
const deadEl = document.getElementById('focusTaskDeadline');
|
||
const noteEl = document.getElementById('focusTaskEANote');
|
||
const compMsg = document.getElementById('focusCompletedMsg');
|
||
const btnComp = document.getElementById('btnCompleteFocus');
|
||
|
||
if (titleEl) titleEl.innerText = curFocus.title;
|
||
if (descEl) descEl.innerText = curFocus.desc || 'شرحی درج نشده است.';
|
||
if (prioEl) prioEl.innerText = curFocus.priority;
|
||
if (deadEl) deadEl.innerText = 'ددلاین: ' + curFocus.deadline;
|
||
if (noteEl) noteEl.innerText = curFocus.noteFromEA || 'نکته خاصی از طرف دستیار ثبت نشده است.';
|
||
|
||
if (curFocus.status === 'done_by_hamed') {
|
||
if (compMsg) compMsg.classList.remove('hidden');
|
||
if (btnComp) {
|
||
btnComp.disabled = true;
|
||
btnComp.innerText = '✓ ارسال شده جهت راستیآزمایی محدثه';
|
||
btnComp.className = 'w-full sm:flex-1 bg-gray-800 text-gray-400 font-bold py-4 px-6 rounded-2xl cursor-not-allowed text-sm flex items-center justify-center gap-2';
|
||
}
|
||
} else {
|
||
if (compMsg) compMsg.classList.add('hidden');
|
||
if (btnComp) {
|
||
btnComp.disabled = false;
|
||
btnComp.innerText = '✓ انجام دادم (ارسال جهت بررسی و تایید محدثه)';
|
||
btnComp.className = 'w-full sm:flex-1 bg-gradient-to-r from-emerald-600 to-teal-600 hover:from-emerald-500 hover:to-teal-500 text-white font-bold py-4 px-6 rounded-2xl shadow-lg shadow-emerald-600/25 transition-all text-sm flex items-center justify-center gap-2';
|
||
}
|
||
}
|
||
}
|
||
|
||
// Mohadese Admin List View
|
||
const adminList = document.getElementById('focusTasksAdminList');
|
||
if (adminList) {
|
||
adminList.innerHTML = appState.focusTasks.map(f => {
|
||
const isDone = f.status === 'done_by_hamed';
|
||
const isVerified = f.status === 'verified_by_mohadese';
|
||
|
||
return `
|
||
<div class="bg-[#12141c] border ${isDone ? 'border-amber-500/50 bg-amber-500/5' : 'border-gray-800'} rounded-2xl p-5 space-y-3">
|
||
<div class="flex items-center justify-between">
|
||
<span class="text-xs font-bold text-white">${f.title}</span>
|
||
<span class="text-[10px] px-2 py-0.5 rounded-full font-bold ${isVerified ? 'bg-emerald-500/20 text-emerald-300' : isDone ? 'bg-amber-500/20 text-amber-300' : 'bg-blue-500/20 text-blue-300'}">
|
||
${isVerified ? 'تایید نهایی شد' : isDone ? 'حامد انجام داده (نیازمند تایید)' : 'در حال انجام توسط حامد'}
|
||
</span>
|
||
</div>
|
||
<p class="text-xs text-gray-400">${f.desc}</p>
|
||
<div class="bg-[#181b26] p-2.5 rounded-xl text-xs text-amber-200">
|
||
<span class="font-bold">یادداشت EA:</span> ${f.noteFromEA || '-'}
|
||
</div>
|
||
<div class="flex items-center justify-between pt-2 border-t border-gray-800">
|
||
<div class="text-[11px] text-gray-500">ددلاین: ${f.deadline}</div>
|
||
<div class="flex items-center gap-2">
|
||
${isDone ? `
|
||
<button onclick="verifyFocusTask('${f.id}')" class="bg-emerald-600 hover:bg-emerald-500 text-white text-xs px-3 py-1.5 rounded-xl font-bold">تایید ✓</button>
|
||
<button onclick="rejectFocusTask('${f.id}')" class="bg-rose-600 hover:bg-rose-500 text-white text-xs px-3 py-1.5 rounded-xl font-bold">رد ✗</button>
|
||
` : ''}
|
||
<button onclick="deleteFocusTask('${f.id}')" class="text-gray-400 hover:text-rose-400 p-1.5"><i data-lucide="trash-2" class="w-4 h-4"></i></button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
}
|
||
lucide.createIcons();
|
||
}
|
||
|
||
function prevFocusTask() {
|
||
if (appState.focusIndex > 0) {
|
||
appState.focusIndex--;
|
||
renderFocusDeck();
|
||
}
|
||
}
|
||
|
||
function nextFocusTask() {
|
||
if (appState.focusIndex < appState.focusTasks.length - 1) {
|
||
appState.focusIndex++;
|
||
renderFocusDeck();
|
||
}
|
||
}
|
||
|
||
async function completeCurrentFocusTask() {
|
||
const curFocus = appState.focusTasks[appState.focusIndex];
|
||
if (!curFocus) return;
|
||
try {
|
||
const res = await fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'complete_by_hamed', id: curFocus.id })
|
||
});
|
||
const data = await res.json();
|
||
if (data.focusTasks) {
|
||
appState.focusTasks = data.focusTasks;
|
||
renderFocusDeck();
|
||
}
|
||
} catch (e) {
|
||
curFocus.status = 'done_by_hamed';
|
||
renderFocusDeck();
|
||
}
|
||
}
|
||
|
||
async function verifyFocusTask(id) {
|
||
await fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'verify_by_ea', id: id })
|
||
});
|
||
await fetchServerState();
|
||
}
|
||
|
||
async function rejectFocusTask(id) {
|
||
const reason = prompt('دلیل عدم تایید یا توضیحات اصلاحی به حامد:');
|
||
if (reason === null) return;
|
||
await fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'reject_by_ea', id: id, reason: reason })
|
||
});
|
||
await fetchServerState();
|
||
}
|
||
|
||
async function deleteFocusTask(id) {
|
||
if (!confirm('آیا این تسک از صف تمرکز حذف شود؟')) return;
|
||
await fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'delete', id: id })
|
||
});
|
||
await fetchServerState();
|
||
}
|
||
|
||
// 5. Render Brain Dump
|
||
function renderBrainDump() {
|
||
const container = document.getElementById('brainDumpList');
|
||
if (!container) return;
|
||
|
||
container.innerHTML = appState.brainDump.map(b => {
|
||
const tagsHtml = (b.tags || []).map(tg => `<span class="bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full text-[10px] font-medium border border-amber-500/30">#${tg}</span>`).join(' ');
|
||
|
||
return `
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-2xl p-4 flex flex-col justify-between space-y-3 hover:border-gray-700 transition-all">
|
||
<div class="space-y-2">
|
||
<div class="flex items-center justify-between">
|
||
<span class="text-[10px] text-gray-500 font-mono">${b.timestamp || 'ثبت شده'}</span>
|
||
<span class="text-[10px] text-emerald-400 bg-emerald-500/10 px-2 py-0.5 rounded-md">مسئول: ${b.responsible === 'hamed' ? 'حامد' : 'محدثه'}</span>
|
||
</div>
|
||
<p class="text-xs text-gray-200 leading-relaxed font-medium">${b.text}</p>
|
||
<div class="flex flex-wrap gap-1.5 pt-1">${tagsHtml}</div>
|
||
</div>
|
||
|
||
<div class="flex items-center justify-between pt-3 border-t border-gray-800/80">
|
||
<button onclick="transferBrainDumpToTask('${b.id}')" class="bg-blue-600 hover:bg-blue-500 text-white text-[11px] font-semibold px-3 py-1.5 rounded-xl flex items-center gap-1 shadow-sm">
|
||
<i data-lucide="arrow-right-left" class="w-3 h-3"></i>
|
||
<span>انتقال مستقیم به تسکها</span>
|
||
</button>
|
||
<button onclick="deleteBrainDump('${b.id}')" class="text-gray-500 hover:text-rose-400 p-1"><i data-lucide="trash-2" class="w-3.5 h-3.5"></i></button>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
async function transferBrainDumpToTask(bid) {
|
||
await fetch('/executive/api/braindump', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'transfer_to_task', id: bid })
|
||
});
|
||
await fetchServerState();
|
||
alert('یادداشت با موفقیت به تسکهای مرکز فرماندهی منتقل شد.');
|
||
}
|
||
|
||
async function deleteBrainDump(bid) {
|
||
if (!confirm('حذف این یادداشت؟')) return;
|
||
await fetch('/executive/api/braindump', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'delete', id: bid })
|
||
});
|
||
await fetchServerState();
|
||
}
|
||
|
||
// 6. Render VIP Contacts (Full Edit Name, Role, Phone, Telegram, Notes, Priority)
|
||
function renderContacts() {
|
||
const container = document.getElementById('contactsList');
|
||
if (!container) return;
|
||
|
||
container.innerHTML = appState.contacts.map(c => {
|
||
return `
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-2xl p-4 space-y-3 hover:border-gray-700 transition-all">
|
||
<div class="flex items-center justify-between">
|
||
<div>
|
||
<h4 class="text-xs font-bold text-white flex items-center gap-1.5">
|
||
<i data-lucide="user" class="w-3.5 h-3.5 text-emerald-400"></i>
|
||
<span>${c.name}</span>
|
||
</h4>
|
||
<div class="text-[11px] text-gray-400 mt-0.5">${c.role}</div>
|
||
</div>
|
||
<span class="text-[10px] font-bold px-2 py-0.5 rounded-full ${c.priority === 'فوری' ? 'bg-rose-500/20 text-rose-300 border border-rose-500/30' : 'bg-blue-500/20 text-blue-300 border border-blue-500/30'}">
|
||
${c.priority}
|
||
</span>
|
||
</div>
|
||
|
||
<!-- Notes -->
|
||
<div class="bg-[#181b26] p-2.5 rounded-xl text-[11px] text-gray-300 border border-gray-800/80 leading-relaxed">
|
||
<span class="text-amber-400 font-bold">نکته جلسه:</span> ${c.notes || '-'}
|
||
</div>
|
||
|
||
<!-- Contact actions -->
|
||
<div class="flex items-center justify-between pt-2 border-t border-gray-800/80">
|
||
<div class="flex items-center gap-2">
|
||
${c.phone ? `<a href="tel:${c.phone}" class="p-1.5 rounded-lg bg-emerald-600/20 text-emerald-300 hover:bg-emerald-600 hover:text-white transition-all text-xs flex items-center gap-1"><i data-lucide="phone" class="w-3.5 h-3.5"></i> تماس</a>` : ''}
|
||
${c.telegram ? `<a href="https://t.me/${c.telegram.replace('@', '')}" target="_blank" class="p-1.5 rounded-lg bg-sky-600/20 text-sky-300 hover:bg-sky-600 hover:text-white transition-all text-xs flex items-center gap-1"><i data-lucide="send" class="w-3.5 h-3.5"></i> تلگرام</a>` : ''}
|
||
</div>
|
||
|
||
<!-- Edit & Delete -->
|
||
<div class="flex items-center gap-1">
|
||
<button onclick="editContact('${c.id}')" title="ویرایش کامل مخاطب و نام" class="p-1.5 rounded-lg bg-gray-800 hover:bg-gray-700 text-gray-300 hover:text-white transition-all text-xs">
|
||
<i data-lucide="edit-3" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
<button onclick="deleteContact('${c.id}')" title="حذف مخاطب" class="p-1.5 rounded-lg bg-gray-800 hover:bg-rose-500/20 text-gray-300 hover:text-rose-400 transition-all text-xs">
|
||
<i data-lucide="trash-2" class="w-3.5 h-3.5"></i>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 7. Render Finance & Cards
|
||
function renderFinance() {
|
||
const cardsEl = document.getElementById('accountsCards');
|
||
const tableEl = document.getElementById('txTableBody');
|
||
if (!cardsEl || !tableEl) return;
|
||
|
||
cardsEl.innerHTML = appState.accounts.map(acc => {
|
||
const balToman = (acc.balanceRial / 10).toLocaleString('fa-IR');
|
||
const limitToman = (acc.dailyLimitRial / 10).toLocaleString('fa-IR');
|
||
return `
|
||
<div class="bg-gradient-to-br from-[#12141c] to-[#181b26] border border-blue-500/30 rounded-3xl p-6 shadow-xl relative overflow-hidden">
|
||
<div class="flex items-center justify-between mb-4">
|
||
<span class="text-xs font-bold text-blue-300">${acc.bankName}</span>
|
||
<span class="text-[10px] bg-blue-500/20 text-blue-400 px-2 py-0.5 rounded-full font-mono">${acc.owner}</span>
|
||
</div>
|
||
<div class="font-mono text-lg text-white font-bold tracking-wider mb-4" dir="ltr">${acc.cardNumber}</div>
|
||
<div class="grid grid-cols-2 gap-4 pt-3 border-t border-gray-800">
|
||
<div>
|
||
<div class="text-[10px] text-gray-400">موجودی به تومان:</div>
|
||
<div class="text-sm font-bold text-emerald-400 font-mono">${balToman} تومان</div>
|
||
</div>
|
||
<div>
|
||
<div class="text-[10px] text-gray-400">سقف انتقال روزانه:</div>
|
||
<div class="text-sm font-bold text-gray-300 font-mono">${limitToman} تومان</div>
|
||
</div>
|
||
</div>
|
||
${acc.driveFolder ? `
|
||
<div class="mt-4 pt-3 border-t border-gray-800 flex justify-end">
|
||
<a href="${acc.driveFolder}" target="_blank" class="text-xs text-blue-400 hover:underline flex items-center gap-1">
|
||
<i data-lucide="folder" class="w-3.5 h-3.5"></i> مشاهده فاکتورها در درایو
|
||
</a>
|
||
</div>
|
||
` : ''}
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
|
||
tableEl.innerHTML = appState.transactions.map(tx => {
|
||
const amtToman = (tx.amountRial / 10).toLocaleString('fa-IR');
|
||
const amtRial = tx.amountRial.toLocaleString('fa-IR');
|
||
return `
|
||
<tr class="hover:bg-[#161924] transition-all">
|
||
<td class="p-3 font-medium text-white">${tx.title}</td>
|
||
<td class="p-3 font-mono font-bold text-emerald-400">${amtToman}</td>
|
||
<td class="p-3 font-mono text-gray-400">${amtRial}</td>
|
||
<td class="p-3 font-mono text-gray-400">${tx.date}</td>
|
||
<td class="p-3"><span class="bg-gray-800 text-gray-300 px-2 py-0.5 rounded-md text-[10px]">${tx.category}</span></td>
|
||
<td class="p-3">
|
||
${tx.driveLink ? `<a href="${tx.driveLink}" target="_blank" class="text-blue-400 hover:underline flex items-center gap-1"><i data-lucide="file-text" class="w-3 h-3"></i> رسید</a>` : '-'}
|
||
</td>
|
||
<td class="p-3 text-center">
|
||
<button onclick="deleteTx('${tx.id}')" class="text-gray-500 hover:text-rose-400"><i data-lucide="trash-2" class="w-3.5 h-3.5"></i></button>
|
||
</td>
|
||
</tr>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 8. Render Vault
|
||
function renderVault() {
|
||
const container = document.getElementById('vaultList');
|
||
if (!container) return;
|
||
|
||
container.innerHTML = appState.vault.map(v => {
|
||
return `
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-2xl p-4 flex flex-col justify-between space-y-3 hover:border-indigo-500/50 transition-all">
|
||
<div class="flex items-start gap-3">
|
||
<div class="w-10 h-10 rounded-xl bg-indigo-500/10 border border-indigo-500/20 flex items-center justify-center text-indigo-400 shrink-0">
|
||
<i data-lucide="folder" class="w-5 h-5"></i>
|
||
</div>
|
||
<div>
|
||
<div class="text-xs font-bold text-white">${v.name}</div>
|
||
<div class="text-[10px] text-gray-400 mt-0.5">${v.category}</div>
|
||
</div>
|
||
</div>
|
||
<a href="${v.url}" target="_blank" class="w-full bg-[#181b26] hover:bg-indigo-600 hover:text-white text-gray-300 text-center py-2 rounded-xl text-xs font-semibold transition-all flex items-center justify-center gap-1.5 border border-gray-800">
|
||
<i data-lucide="external-link" class="w-3.5 h-3.5"></i>
|
||
<span>باز کردن در گوگل درایو</span>
|
||
</a>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
// 9. Render Telegram
|
||
function renderTelegram() {
|
||
const container = document.getElementById('telegramList');
|
||
if (!container) return;
|
||
|
||
container.innerHTML = appState.telegramVIPs.map(tg => {
|
||
return `
|
||
<div class="bg-[#12141c] border border-gray-800 rounded-2xl p-4 flex items-center justify-between gap-4 hover:border-sky-500/30 transition-all">
|
||
<div class="flex items-center gap-3">
|
||
<div class="w-9 h-9 rounded-xl bg-sky-500/10 border border-sky-500/20 flex items-center justify-center text-sky-400 shrink-0">
|
||
<i data-lucide="send" class="w-4 h-4"></i>
|
||
</div>
|
||
<div>
|
||
<div class="flex items-center gap-2">
|
||
<span class="text-xs font-bold text-white">${tg.sender}</span>
|
||
<span class="text-[10px] bg-gray-800 text-gray-400 px-2 py-0.5 rounded-full font-mono">${tg.chatType}</span>
|
||
<span class="text-[10px] font-bold ${tg.priority === 'فوری' ? 'text-rose-400' : 'text-blue-400'}">${tg.priority}</span>
|
||
</div>
|
||
<p class="text-xs text-gray-300 mt-1">${tg.summary}</p>
|
||
</div>
|
||
</div>
|
||
<div class="flex items-center gap-2 shrink-0">
|
||
<span class="text-[10px] text-gray-500 font-mono">${tg.time}</span>
|
||
<button onclick="convertTelegramToTask('${tg.sender}', '${tg.summary}')" class="bg-blue-600 hover:bg-blue-500 text-white text-xs px-3 py-1.5 rounded-xl font-medium">تبدیل به تسک</button>
|
||
</div>
|
||
</div>
|
||
`;
|
||
}).join('');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
function convertTelegramToTask(sender, summary) {
|
||
document.getElementById('taskModalInputTitle').value = 'پیگیری پیام تلگرام از ' + sender;
|
||
document.getElementById('taskModalInputDesc').value = summary;
|
||
document.getElementById('taskModalInputResp').value = 'hamed';
|
||
document.getElementById('taskModalInputPrio').value = 'urgent';
|
||
openTaskModal();
|
||
}
|
||
|
||
// ==========================================
|
||
// ACTION HANDLERS (FULL CRUD)
|
||
// ==========================================
|
||
|
||
// Quick Task Fast Capture
|
||
async function submitQuickTask() {
|
||
const input = document.getElementById('quickTaskInput');
|
||
const resp = document.getElementById('quickTaskResp').value;
|
||
const prio = document.getElementById('quickTaskPrio').value;
|
||
const title = input.value.trim();
|
||
if (!title) return;
|
||
|
||
const newTask = {
|
||
title: title,
|
||
desc: '',
|
||
responsible: resp,
|
||
priority: prio,
|
||
deadline: 'امروز (تا ۲۴:۰۰)',
|
||
category: 'ثبت فوری',
|
||
status: 'pending'
|
||
};
|
||
|
||
try {
|
||
const res = await fetch('/executive/api/tasks', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'create', task: newTask })
|
||
});
|
||
const data = await res.json();
|
||
if (data.tasks) {
|
||
appState.tasks = data.tasks;
|
||
input.value = '';
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
} catch (e) {
|
||
appState.tasks.unshift(newTask);
|
||
input.value = '';
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
}
|
||
|
||
// Toggle Task Status
|
||
async function toggleTaskStatus(tid) {
|
||
try {
|
||
const res = await fetch('/executive/api/tasks', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'toggle', id: tid })
|
||
});
|
||
const data = await res.json();
|
||
if (data.tasks) {
|
||
appState.tasks = data.tasks;
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
} catch (e) {
|
||
const t = appState.tasks.find(x => x.id === tid);
|
||
if (t) t.status = t.status === 'completed' ? 'pending' : 'completed';
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
}
|
||
|
||
// Delete Task
|
||
async function deleteTask(tid) {
|
||
if (!confirm('آیا از حذف این اقدام اطمینان دارید؟')) return;
|
||
try {
|
||
const res = await fetch('/executive/api/tasks', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'delete', id: tid })
|
||
});
|
||
const data = await res.json();
|
||
if (data.tasks) {
|
||
appState.tasks = data.tasks;
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
} catch (e) {
|
||
appState.tasks = appState.tasks.filter(x => x.id !== tid);
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
}
|
||
|
||
// Edit Task Modal
|
||
function editTask(tid) {
|
||
const t = appState.tasks.find(x => x.id === tid);
|
||
if (!t) return;
|
||
document.getElementById('taskEditId').value = t.id;
|
||
document.getElementById('taskModalTitle').innerText = 'ویرایش تسک: ' + t.title;
|
||
document.getElementById('taskModalInputTitle').value = t.title;
|
||
document.getElementById('taskModalInputDesc').value = t.desc || '';
|
||
document.getElementById('taskModalInputResp').value = t.responsible || 'hamed';
|
||
document.getElementById('taskModalInputPrio').value = t.priority || 'urgent';
|
||
document.getElementById('taskModalInputDeadline').value = t.deadline || 'امروز';
|
||
document.getElementById('taskModalInputCategory').value = t.category || 'عمومی';
|
||
openModal('taskModal');
|
||
}
|
||
|
||
function openTaskModal() {
|
||
document.getElementById('taskEditId').value = '';
|
||
document.getElementById('taskModalTitle').innerText = 'ثبت اقدام حیاتی جدید';
|
||
document.getElementById('taskModalInputTitle').value = '';
|
||
document.getElementById('taskModalInputDesc').value = '';
|
||
document.getElementById('taskModalInputDeadline').value = 'امروز (تا ۱۸:۰۰)';
|
||
openModal('taskModal');
|
||
}
|
||
|
||
async function saveTaskModal() {
|
||
const id = document.getElementById('taskEditId').value;
|
||
const title = document.getElementById('taskModalInputTitle').value.trim();
|
||
const desc = document.getElementById('taskModalInputDesc').value.trim();
|
||
const responsible = document.getElementById('taskModalInputResp').value;
|
||
const priority = document.getElementById('taskModalInputPrio').value;
|
||
const deadline = document.getElementById('taskModalInputDeadline').value.trim();
|
||
const category = document.getElementById('taskModalInputCategory').value;
|
||
|
||
if (!title) {
|
||
alert('عنوان تسک الزامی است.');
|
||
return;
|
||
}
|
||
|
||
const taskObj = { id, title, desc, responsible, priority, deadline, category };
|
||
|
||
try {
|
||
const action = id ? 'update' : 'create';
|
||
const res = await fetch('/executive/api/tasks', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: action, task: taskObj })
|
||
});
|
||
const data = await res.json();
|
||
if (data.tasks) {
|
||
appState.tasks = data.tasks;
|
||
closeModal('taskModal');
|
||
renderTasks();
|
||
checkRedAlert();
|
||
}
|
||
} catch (e) {
|
||
closeModal('taskModal');
|
||
await fetchServerState();
|
||
}
|
||
}
|
||
|
||
function sendToFocusTunnel(tid) {
|
||
const t = appState.tasks.find(x => x.id === tid);
|
||
if (!t) return;
|
||
// Add or push to focus tasks
|
||
const newFocus = {
|
||
title: t.title,
|
||
desc: t.desc || '',
|
||
priority: t.priority === 'crisis' ? 'بحران' : t.priority === 'urgent' ? 'فوری' : 'بالا',
|
||
deadline: t.deadline,
|
||
noteFromEA: 'انتقال یافته از مرکز فرماندهی جهت تمرکز فوری مدیرعامل.'
|
||
};
|
||
fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify(Object.assign({ action: 'create' }, newFocus))
|
||
}).then(() => {
|
||
fetchServerState().then(() => {
|
||
setTab('focus');
|
||
});
|
||
});
|
||
}
|
||
|
||
// VIP Contacts Actions (Editing ALL fields including Name)
|
||
function openAddContactModal() {
|
||
document.getElementById('contactEditId').value = '';
|
||
document.getElementById('contactModalTitle').innerText = 'ثبت مخاطب VIP جدید';
|
||
document.getElementById('contactInputName').value = '';
|
||
document.getElementById('contactInputRole').value = '';
|
||
document.getElementById('contactInputPhone').value = '';
|
||
document.getElementById('contactInputTg').value = '';
|
||
document.getElementById('contactInputNotes').value = '';
|
||
openModal('contactModal');
|
||
}
|
||
|
||
function editContact(cid) {
|
||
const c = appState.contacts.find(x => x.id === cid);
|
||
if (!c) return;
|
||
document.getElementById('contactEditId').value = c.id;
|
||
document.getElementById('contactModalTitle').innerText = 'ویرایش مشخصات: ' + c.name;
|
||
document.getElementById('contactInputName').value = c.name;
|
||
document.getElementById('contactInputRole').value = c.role || '';
|
||
document.getElementById('contactInputPhone').value = c.phone || '';
|
||
document.getElementById('contactInputTg').value = c.telegram || '';
|
||
document.getElementById('contactInputPrio').value = c.priority || 'عادی';
|
||
document.getElementById('contactInputNotes').value = c.notes || '';
|
||
openModal('contactModal');
|
||
}
|
||
|
||
async function saveContactModal() {
|
||
const id = document.getElementById('contactEditId').value;
|
||
const name = document.getElementById('contactInputName').value.trim();
|
||
const role = document.getElementById('contactInputRole').value.trim();
|
||
const phone = document.getElementById('contactInputPhone').value.trim();
|
||
const telegram = document.getElementById('contactInputTg').value.trim();
|
||
const priority = document.getElementById('contactInputPrio').value;
|
||
const notes = document.getElementById('contactInputNotes').value.trim();
|
||
|
||
if (!name) {
|
||
alert('نام مخاطب الزامی است.');
|
||
return;
|
||
}
|
||
|
||
const cData = { id, name, role, phone, telegram, priority, notes };
|
||
const action = id ? 'update' : 'create';
|
||
|
||
try {
|
||
const res = await fetch('/executive/api/contacts', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action, contact: cData })
|
||
});
|
||
const data = await res.json();
|
||
if (data.contacts) {
|
||
appState.contacts = data.contacts;
|
||
closeModal('contactModal');
|
||
renderContacts();
|
||
}
|
||
} catch (e) {
|
||
closeModal('contactModal');
|
||
await fetchServerState();
|
||
}
|
||
}
|
||
|
||
async function deleteContact(cid) {
|
||
if (!confirm('آیا از حذف این مخاطب اطمینان دارید؟')) return;
|
||
await fetch('/executive/api/contacts', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'delete', id: cid })
|
||
});
|
||
await fetchServerState();
|
||
}
|
||
|
||
// Brain Dump Actions
|
||
function openAddBrainDumpModal() {
|
||
document.getElementById('brainDumpInputText').value = '';
|
||
document.getElementById('brainDumpInputTags').value = 'حامد, فوری';
|
||
openModal('brainDumpModal');
|
||
}
|
||
|
||
async function saveBrainDumpModal() {
|
||
const text = document.getElementById('brainDumpInputText').value.trim();
|
||
const tagsStr = document.getElementById('brainDumpInputTags').value.trim();
|
||
const resp = document.getElementById('brainDumpInputResp').value;
|
||
const prio = document.getElementById('brainDumpInputPrio').value;
|
||
|
||
if (!text) return;
|
||
const tags = tagsStr.split(',').map(s => s.trim()).filter(Boolean);
|
||
|
||
await fetch('/executive/api/braindump', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'create', text, tags, responsible: resp, priority: prio })
|
||
});
|
||
closeModal('brainDumpModal');
|
||
await fetchServerState();
|
||
}
|
||
|
||
// Focus Admin Actions (For EA)
|
||
function openAddFocusModal() {
|
||
document.getElementById('focusInputTitle').value = '';
|
||
document.getElementById('focusInputDesc').value = '';
|
||
document.getElementById('focusInputNoteEA').value = '';
|
||
document.getElementById('focusInputDeadline').value = 'تا ساعت ۱۸:۰۰ امروز';
|
||
openModal('addFocusModal');
|
||
}
|
||
|
||
async function saveAddFocusModal() {
|
||
const title = document.getElementById('focusInputTitle').value.trim();
|
||
const desc = document.getElementById('focusInputDesc').value.trim();
|
||
const noteFromEA = document.getElementById('focusInputNoteEA').value.trim();
|
||
const priority = document.getElementById('focusInputPrio').value;
|
||
const deadline = document.getElementById('focusInputDeadline').value.trim();
|
||
|
||
if (!title) return;
|
||
|
||
await fetch('/executive/api/focus', {
|
||
method: 'POST',
|
||
headers: {'Content-Type': 'application/json'},
|
||
body: JSON.stringify({ action: 'create', title, desc, noteFromEA, priority, deadline })
|
||
});
|
||
closeModal('addFocusModal');
|
||
await fetchServerState();
|
||
}
|
||
|
||
// Modal Helpers
|
||
function openModal(id) {
|
||
const m = document.getElementById(id);
|
||
if (m) m.classList.remove('hidden');
|
||
lucide.createIcons();
|
||
}
|
||
|
||
function closeModal(id) {
|
||
const m = document.getElementById(id);
|
||
if (m) m.classList.add('hidden');
|
||
}
|
||
|
||
// Initialize on load
|
||
window.addEventListener('DOMContentLoaded', () => {
|
||
lucide.createIcons();
|
||
// Auto-login if session exists
|
||
const savedRole = localStorage.getItem('ekeepa_user_role');
|
||
if (savedRole) {
|
||
appState.currentUser = savedRole;
|
||
initRoleViews(savedRole);
|
||
document.getElementById('authOverlay').classList.add('hidden');
|
||
fetchServerState();
|
||
}
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|