@using System.Security.Claims @using Microsoft.EntityFrameworkCore @inject JobsMedical.Web.Services.NotificationService Notifications @inject JobsMedical.Web.Data.AppDbContext Db @{ var title = ViewData["Title"] as string; int unreadCount = 0; int meId = 0; string? meFullName = null; string? mePhone = null; bool meHasAvatar = false; if (User.Identity?.IsAuthenticated == true && int.TryParse(User.FindFirstValue(ClaimTypes.NameIdentifier), out meId)) { unreadCount = await Notifications.UnreadCountAsync(meId); var info = await Db.Users.Where(u => u.Id == meId) .Select(u => new { u.FullName, u.Phone, HasAvatar = u.Avatar != null }).FirstOrDefaultAsync(); meFullName = string.IsNullOrWhiteSpace(info?.FullName) ? null : info!.FullName!.Trim(); mePhone = info?.Phone; meHasAvatar = info?.HasAvatar ?? false; } // Avatar glyph/label: prefer a real name; never show a bare phone digit like "0". var meInitial = meFullName is not null ? meFullName.Substring(0, 1) : "👤"; var meLabel = meFullName ?? "حساب من"; // Single, role-aware dashboard entry — the full menu lives in the panel sub-nav (_PanelNav). var dashUrl = "/Me/Index"; var dashLabel = "داشبورد من"; var dashIcon = "🗂️"; if (User.IsInRole("Admin")) { dashUrl = "/Admin/Overview"; dashLabel = "پنل مدیریت"; dashIcon = "🛠️"; } else if (User.IsInRole("FacilityAdmin")) { dashUrl = "/Employer/Index"; dashLabel = "پنل کارفرما"; dashIcon = "🏥"; } // --- SEO context --- var baseUrl = $"{Context.Request.Scheme}://{Context.Request.Host}"; var path = Context.Request.Path.Value ?? "/"; var canonical = baseUrl + (path == "/" ? "" : path); // canonical ignores query string var pageDesc = ViewData["Description"] as string ?? "همکادر؛ سامانه یافتن شیفت و موقعیت استخدامی برای کادر درمان (پزشک، پرستار، ماما و تکنسین) در بیمارستانها و کلینیکهای تهران."; var pageTitle = title is null ? "همکادر | شیفت و استخدام کادر درمان" : title + " | همکادر"; var ogImage = ViewData["OgImage"] as string ?? baseUrl + "/icons/icon-512.png"; // Private/applicant areas must never be indexed. string[] noindexPrefixes = { "/Admin", "/Me", "/Employer", "/Account", "/Preferences" }; var noIndex = (ViewData["NoIndex"] as bool? ?? false) || noindexPrefixes.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)); // Show the centralized dashboard sub-nav on any logged-in panel page. string[] panelPrefixes = { "/Admin", "/Me", "/Employer", "/Preferences" }; var showPanelNav = User.Identity?.IsAuthenticated == true && panelPrefixes.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)); }