c7e4bf059e
Three policy pages tailored to همکادر: /Privacy (data collected, use, sharing, no Google services, cookies, security), /Rules (accurate info, allowed listings, conduct, prohibited content, verification badge meaning, reports), /Terms (intermediary nature/no employment guarantee, account terms, scraped-listing disclaimer, liability, IP, governing law = Iran). Linked from the footer; .legal long-form reading style added. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
181 lines
9.3 KiB
Plaintext
181 lines
9.3 KiB
Plaintext
@using System.Security.Claims
|
||
@inject JobsMedical.Web.Services.NotificationService Notifications
|
||
@{
|
||
var title = ViewData["Title"] as string;
|
||
int unreadCount = 0;
|
||
if (User.Identity?.IsAuthenticated == true && int.TryParse(User.FindFirstValue(ClaimTypes.NameIdentifier), out var _uid))
|
||
{
|
||
unreadCount = await Notifications.UnreadCountAsync(_uid);
|
||
}
|
||
}
|
||
<!DOCTYPE html>
|
||
<html lang="fa" dir="rtl">
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>@(title is null ? "همکادر | شیفت و استخدام کادر درمان" : title + " | همکادر")</title>
|
||
<meta name="description" content="@(ViewData["Description"] as string ?? "همکادر؛ سامانه یافتن شیفت و موقعیت استخدامی برای کادر درمان (پزشک، پرستار، ماما و تکنسین) در بیمارستانها و کلینیکهای تهران.")" />
|
||
@* Preload the body-weight font so the swap from Tahoma happens fast. Vazirmatn is
|
||
self-hosted under wwwroot/fonts (@@font-face in site.css) — no external CDN. *@
|
||
<link rel="preload" href="~/fonts/Vazirmatn-Regular.woff2" as="font" type="font/woff2" crossorigin />
|
||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||
|
||
@* PWA: installable app (Web/Windows/Android via this manifest; iOS via apple-* tags) *@
|
||
<link rel="manifest" href="/manifest.webmanifest" />
|
||
<meta name="theme-color" content="#0e8f8a" />
|
||
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png" />
|
||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||
<meta name="mobile-web-app-capable" content="yes" />
|
||
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
|
||
<meta name="apple-mobile-web-app-title" content="همکادر" />
|
||
</head>
|
||
<body data-unread="@unreadCount" data-authed="@(User.Identity?.IsAuthenticated == true ? "1" : "0")">
|
||
<header class="site-header">
|
||
<div class="container header-inner">
|
||
<a class="brand" asp-page="/Index">
|
||
<span class="brand-mark">ه</span>
|
||
<span class="brand-text">همکادر</span>
|
||
</a>
|
||
|
||
@* Always-visible bell on mobile (next to the burger) so notifications stay one tap away *@
|
||
@if (User.Identity?.IsAuthenticated == true)
|
||
{
|
||
<a class="bell-mobile js-bell" asp-page="/Me/Notifications" title="اعلانها">🔔@if (unreadCount > 0) {<span class="bell-badge">@JalaliDate.ToPersianDigits(unreadCount > 99 ? "99+" : unreadCount.ToString())</span>}</a>
|
||
}
|
||
|
||
<input type="checkbox" id="nav-toggle" class="nav-toggle" hidden />
|
||
<label for="nav-toggle" class="nav-burger" aria-label="باز/بستن منو">
|
||
<span></span><span></span><span></span>
|
||
</label>
|
||
|
||
<div class="nav-collapse">
|
||
<nav class="main-nav">
|
||
<a asp-page="/Index">خانه</a>
|
||
<a asp-page="/Shifts/Index">شیفتها</a>
|
||
<a asp-page="/Jobs/Index">استخدام</a>
|
||
<a asp-page="/Calendar/Index">تقویم هفتگی</a>
|
||
<a asp-page="/Download">دریافت اپ</a>
|
||
<a asp-page="/Facilities/Index">مراکز درمانی</a>
|
||
<a asp-page="/Preferences/Index">علاقهمندیها</a>
|
||
</nav>
|
||
<div class="header-actions">
|
||
@if (User.Identity?.IsAuthenticated == true)
|
||
{
|
||
@if (User.IsInRole("Admin"))
|
||
{
|
||
<a class="nav-action" asp-page="/Admin/Overview">پنل مدیریت</a>
|
||
<a class="nav-action" asp-page="/Admin/Settings">تنظیمات</a>
|
||
}
|
||
@if (User.IsInRole("FacilityAdmin"))
|
||
{
|
||
<a class="nav-action" asp-page="/Employer/Index">پنل کارفرما</a>
|
||
}
|
||
<a class="nav-action bell-inline js-bell" asp-page="/Me/Notifications" title="اعلانها"><span class="bell-ico">🔔</span><span class="bell-label">اعلانها</span>@if (unreadCount > 0) {<span class="bell-badge">@JalaliDate.ToPersianDigits(unreadCount > 99 ? "99+" : unreadCount.ToString())</span>}</a>
|
||
<a class="nav-action" asp-page="/Me/Index">پنل کارجو</a>
|
||
<form method="post" asp-page="/Account/Logout" style="display:contents;">
|
||
<button type="submit" class="btn btn-outline btn-sm">خروج</button>
|
||
</form>
|
||
}
|
||
else
|
||
{
|
||
<a class="btn btn-outline btn-sm" asp-page="/Account/Login">ورود</a>
|
||
}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
<main role="main">
|
||
@RenderBody()
|
||
</main>
|
||
|
||
<footer class="site-footer">
|
||
<div class="container footer-inner">
|
||
<div>
|
||
<span class="brand-mark sm">ه</span>
|
||
<strong>همکادر</strong>
|
||
<p class="muted">سامانه واسط میان کادر درمان و مراکز درمانی برای شیفت و استخدام</p>
|
||
</div>
|
||
<div class="muted">
|
||
<div class="footer-links">
|
||
<a asp-page="/Download" style="font-weight:700;">📲 دریافت اپلیکیشن</a>
|
||
<a asp-page="/Privacy">حریم خصوصی</a>
|
||
<a asp-page="/Rules">قوانین و مقررات</a>
|
||
<a asp-page="/Terms">شرایط استفاده</a>
|
||
</div>
|
||
© ۱۴۰۵ همکادر — همه حقوق محفوظ است
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<div id="toast-host" class="toast-host" aria-live="polite"></div>
|
||
|
||
@* Register the PWA service worker (offline + push notifications). *@
|
||
<script>
|
||
if ('serviceWorker' in navigator) {
|
||
window.addEventListener('load', function () { navigator.serviceWorker.register('/sw.js').catch(function () {}); });
|
||
}
|
||
</script>
|
||
|
||
@* Live in-app notifications over SSE (our own origin — works in Iran, no Google push).
|
||
Updates the bell badge, shows a toast, and fires a local OS notification when allowed. *@
|
||
@if (User.Identity?.IsAuthenticated == true)
|
||
{
|
||
<script>
|
||
(function () {
|
||
var faDigits = ['۰','۱','۲','۳','۴','۵','۶','۷','۸','۹'];
|
||
function toFa(s){ return String(s).replace(/[0-9]/g, function(d){ return faDigits[+d]; }); }
|
||
var count = parseInt(document.body.getAttribute('data-unread') || '0', 10) || 0;
|
||
|
||
function paintBell() {
|
||
document.querySelectorAll('.js-bell').forEach(function (bell) {
|
||
var badge = bell.querySelector('.bell-badge');
|
||
if (count > 0) {
|
||
if (!badge) { badge = document.createElement('span'); badge.className = 'bell-badge'; bell.appendChild(badge); }
|
||
badge.textContent = toFa(count > 99 ? '99+' : count);
|
||
} else if (badge) { badge.remove(); }
|
||
});
|
||
}
|
||
|
||
function toast(n) {
|
||
var host = document.getElementById('toast-host');
|
||
if (!host) return;
|
||
var el = document.createElement('a');
|
||
el.className = 'toast';
|
||
el.href = n.url || '/';
|
||
el.innerHTML = '<span class="toast-ico">🔔</span><span class="toast-body"><strong></strong><span></span></span>';
|
||
el.querySelector('strong').textContent = n.title || 'همکادر';
|
||
el.querySelector('.toast-body span').textContent = n.body || '';
|
||
host.appendChild(el);
|
||
requestAnimationFrame(function(){ el.classList.add('show'); });
|
||
setTimeout(function(){ el.classList.remove('show'); setTimeout(function(){ el.remove(); }, 300); }, 6000);
|
||
}
|
||
|
||
function osNotify(n) {
|
||
if (!('Notification' in window) || Notification.permission !== 'granted' || !navigator.serviceWorker) return;
|
||
navigator.serviceWorker.ready.then(function (reg) {
|
||
reg.showNotification(n.title || 'همکادر', {
|
||
body: n.body || '', icon: '/icons/icon-192.png', badge: '/icons/icon-192.png',
|
||
dir: 'rtl', lang: 'fa', tag: n.url || '/', data: { url: n.url || '/' }
|
||
});
|
||
}).catch(function(){});
|
||
}
|
||
|
||
if (!('EventSource' in window)) return;
|
||
var es;
|
||
function connect() {
|
||
es = new EventSource('/notifications/stream');
|
||
es.addEventListener('notice', function (ev) {
|
||
var n; try { n = JSON.parse(ev.data); } catch (_) { return; }
|
||
count++; paintBell(); toast(n); osNotify(n);
|
||
});
|
||
// EventSource auto-reconnects on transient errors; nothing else needed.
|
||
}
|
||
connect();
|
||
})();
|
||
</script>
|
||
}
|
||
@await RenderSectionAsync("Scripts", required: false)
|
||
</body>
|
||
</html>
|