From ed25bec200d6931c7e6efb4eaab6328ed8b56309 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Tue, 2 Jun 2026 15:09:46 +0330 Subject: [PATCH] =?UTF-8?q?fix:=203=20bugs=20=E2=80=94=20beauty=20icon=20c?= =?UTF-8?q?olor,=20appointments=20on=20dashboard,=20blog=20image=20edit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Beauty category icon: was pink (#C2185B), now uses site primary gold (var(--gold) / var(--gold-pale)) to match brand color 2. Dashboard now shows health requests: - Two new stat cards: total patients + pending requests (clickable) - 'آخرین درخواست‌ها' mini-table showing last 6 requests - Sidebar badge updates from dashboard load too - loadDashboard() now fetches /api/patients + /api/health-requests 3. Blog image edit fix: - applyCrop() now captures inputId/previewId BEFORE closeCropper() to prevent any potential race condition when replacing images Co-Authored-By: Claude Sonnet 4.5 --- DrSousan.Api/Pages/Index.cshtml | 2 +- DrSousan.Api/wwwroot/admin/index.html | 43 +++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/DrSousan.Api/Pages/Index.cshtml b/DrSousan.Api/Pages/Index.cshtml index c7b1eb7..9671b55 100644 --- a/DrSousan.Api/Pages/Index.cshtml +++ b/DrSousan.Api/Pages/Index.cshtml @@ -179,7 +179,7 @@ .health-cat-card { background:var(--white); border-radius:24px; padding:2.2rem; border:1px solid var(--border); display:flex; flex-direction:column; gap:1rem; } .health-cat-icon { width:60px; height:60px; border-radius:18px; display:flex; align-items:center; justify-content:center; } .health-cat-icon svg { width:28px; height:28px; } - .health-cat-icon.beauty { background:#FCE4EC; color:#C2185B; } + .health-cat-icon.beauty { background:var(--gold-pale); color:var(--gold); } .health-cat-icon.health { background:#E3F2FD; color:#1565C0; } .health-cat-card h3 { font-size:1.15rem; font-weight:700; color:var(--dark); } .health-cat-card p { font-size:.88rem; color:var(--mid); line-height:1.8; } diff --git a/DrSousan.Api/wwwroot/admin/index.html b/DrSousan.Api/wwwroot/admin/index.html index d3cf229..338deeb 100644 --- a/DrSousan.Api/wwwroot/admin/index.html +++ b/DrSousan.Api/wwwroot/admin/index.html @@ -310,10 +310,21 @@ tr:hover td{background:#FAFBFC}
کل بازدید مقالات
-
نظرات بیماران
-
مقالات بدون متا
-
+
تعداد بیماران
-
+
درخواست‌های جدید
-
-
-
پربازدیدترین مقالات
-
عنوانبازدیدعملیات
+
+
+
پربازدیدترین مقالات
+
عنوانبازدیدعملیات
+
+
+
+
آخرین درخواست‌های سلامت
+ +
+
نامتلفندستهوضعیت
+
@@ -1313,9 +1324,11 @@ async function sendReply(id) { // ── Dashboard ───────────────────────────────────────────────────────────────── async function loadDashboard() { - const [seo, testims] = await Promise.all([ + const [seo, testims, patients, reqs] = await Promise.all([ api('/api/seo/stats'), - api('/api/testimonials/all') + api('/api/testimonials/all'), + api('/api/patients'), + api('/api/health-requests') ]); if (seo) { document.getElementById('ds-posts').textContent = seo.total; @@ -1325,6 +1338,22 @@ async function loadDashboard() { tb.innerHTML = seo.topPosts.map(p=>`${p.title}${p.viewCount}مشاهده`).join(''); } if (testims) document.getElementById('ds-testimonials').textContent = testims.length; + if (patients) document.getElementById('ds-patients').textContent = patients.length; + if (reqs) { + const pending = reqs.filter(r=>!r.isHandled); + document.getElementById('ds-requests').textContent = pending.length; + const catLabel = {beauty:'زیبایی پوست', health:'سلامت عمومی'}; + document.getElementById('dashReqTable').innerHTML = reqs.slice(0,6).map(r=>` + + ${r.fullName} + ${r.phoneNumber} + ${catLabel[r.category]||r.category} + ${r.isHandled?'بررسی شده':'جدید'} + `).join('') || 'درخواستی وجود ندارد'; + // update sidebar badge + const badge = document.getElementById('healthreqBadge'); + if(pending.length>0){badge.textContent=pending.length;badge.style.display='inline';}else{badge.style.display='none';} + } } // ── Section settings ────────────────────────────────────────────────────────── @@ -1624,9 +1653,11 @@ async function applyCrop() { const out = document.createElement('canvas'); out.width = Math.round(sw); out.height = Math.round(sh); out.getContext('2d').drawImage(cropper.img, sx, sy, sw, sh, 0, 0, out.width, out.height); + // Capture targets BEFORE closing (closeCropper doesn't clear them, but be safe) + const _inputId = cropper.inputId, _previewId = cropper.previewId; out.toBlob(async blob => { closeCropper(); - const inputId = cropper.inputId, previewId = cropper.previewId; + const inputId = _inputId, previewId = _previewId; const btn = document.getElementById(`upload-btn-${inputId}`); const orig = btn.innerHTML; btn.innerHTML = ' در حال آپلود...';