Site-wide rich search with keyword highlighting + header search box
CI/CD / CI · dotnet build (push) Successful in 1m53s
CI/CD / Deploy · hamkadr (push) Successful in 2m47s

- /Search: searches shifts, hiring openings, and applicants together via
  Postgres ILIKE (every term must match across role/city/facility/title/
  description/tags/person). Results grouped per type.
- Keyword highlighting (<mark>) extended to shift & job cards (was talent-only),
  so matches stand out everywhere.
- Persistent header search box (.nav-search) → /Search; big hero box on the
  page itself.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-08 11:40:26 +03:30
parent 234bcd1f88
commit 9db4deafbc
6 changed files with 148 additions and 5 deletions
+56
View File
@@ -0,0 +1,56 @@
@page
@model JobsMedical.Web.Pages.SearchModel
@{
ViewData["Title"] = Model.HasQuery ? $"جستجو: {Model.Q}" : "جستجو";
ViewData["q"] = Model.Q; // drives highlighting in the cards
ViewData["NoIndex"] = true;
}
<div class="page-head">
<div class="container">
<h1>جستجو</h1>
<form method="get" class="search-hero">
<input type="search" name="Q" value="@Model.Q" placeholder="مثلاً: پرستار شب تهران، mmt، دندانپزشک پروانه‌دار…" autofocus />
<button type="submit" class="btn btn-accent">🔎 جستجو</button>
</form>
@if (Model.HasQuery)
{
<p class="muted">@JalaliDate.ToPersianDigits(Model.Total.ToString()) نتیجه برای «@Model.Q»</p>
}
</div>
</div>
<div class="container section">
@if (!Model.HasQuery)
{
<div class="card empty-state">یک عبارت بنویس تا در شیفت‌ها، استخدام‌ها و آماده‌به‌کارها جستجو شود. هر کلمه باید جایی پیدا شود.</div>
}
else if (Model.Total == 0)
{
<div class="card empty-state">نتیجه‌ای پیدا نشد. عبارت دیگری امتحان کن.</div>
}
else
{
@if (Model.Shifts.Count > 0)
{
<div class="section-head"><h2>شیفت‌ها (@JalaliDate.ToPersianDigits(Model.Shifts.Count.ToString()))</h2><a asp-page="/Shifts/Index">همه شیفت‌ها ←</a></div>
<div class="grid grid-3">
@foreach (var s in Model.Shifts) { <partial name="_ShiftCard" model="s" /> }
</div>
}
@if (Model.Jobs.Count > 0)
{
<div class="section-head" style="margin-top:24px;"><h2>استخدام‌ها (@JalaliDate.ToPersianDigits(Model.Jobs.Count.ToString()))</h2><a asp-page="/Jobs/Index">همه استخدام‌ها ←</a></div>
<div class="grid grid-3">
@foreach (var j in Model.Jobs) { <partial name="_JobCard" model="j" /> }
</div>
}
@if (Model.Talent.Count > 0)
{
<div class="section-head" style="margin-top:24px;"><h2>آماده به کار (@JalaliDate.ToPersianDigits(Model.Talent.Count.ToString()))</h2><a asp-page="/Talent/Index">همه ←</a></div>
<div class="grid grid-3">
@foreach (var t in Model.Talent) { <partial name="_TalentCard" model="t" /> }
</div>
}
}
</div>