2fb86a435e
ASP.NET Core 10 Razor Pages + PostgreSQL/EF Core. RTL Persian, Jalali dates, self-hosted Vazirmatn, teal/coral brand. Features: - Shift listings: browse/filter (city, district, role, type, pay), weekly Jalali calendar, detail + interest handoff, near-me distance sort - Hiring (استخدام) listings with employment type + salary range - Pattern-engine recommendations + anonymous interest tracking (visitor cookie) - Heuristic Persian listing-parser + admin queue (raw channel post → shift/job) - Phone-OTP cookie auth + visitor-history linking + profile Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
66 lines
1.8 KiB
C#
66 lines
1.8 KiB
C#
using JobsMedical.Web.Data;
|
|
using JobsMedical.Web.Models;
|
|
using JobsMedical.Web.Services;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace JobsMedical.Web.Pages.Jobs;
|
|
|
|
public class DetailsModel : PageModel
|
|
{
|
|
private readonly AppDbContext _db;
|
|
private readonly InterestService _interest;
|
|
|
|
public DetailsModel(AppDbContext db, InterestService interest)
|
|
{
|
|
_db = db;
|
|
_interest = interest;
|
|
}
|
|
|
|
public JobOpening? Job { get; private set; }
|
|
public bool ShowContact { get; private set; }
|
|
public bool Saved { get; private set; }
|
|
|
|
public async Task<IActionResult> OnGetAsync(int id)
|
|
{
|
|
await LoadAsync(id);
|
|
if (Job is null) return NotFound();
|
|
await _interest.LogJobAsync(InterestEventType.View, id);
|
|
return Page();
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostInterestAsync(int id)
|
|
{
|
|
await LoadAsync(id);
|
|
if (Job is null) return NotFound();
|
|
await _interest.LogJobAsync(InterestEventType.Apply, id);
|
|
ShowContact = true;
|
|
return Page();
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostSaveAsync(int id)
|
|
{
|
|
await LoadAsync(id);
|
|
if (Job is null) return NotFound();
|
|
await _interest.LogJobAsync(InterestEventType.Save, id);
|
|
Saved = true;
|
|
return Page();
|
|
}
|
|
|
|
public async Task<IActionResult> OnPostDismissAsync(int id)
|
|
{
|
|
await _interest.LogJobAsync(InterestEventType.Dismiss, id);
|
|
return RedirectToPage("/Jobs/Index");
|
|
}
|
|
|
|
private async Task LoadAsync(int id)
|
|
{
|
|
Job = await _db.JobOpenings
|
|
.Include(j => j.Facility).ThenInclude(f => f.City)
|
|
.Include(j => j.Facility).ThenInclude(f => f.District)
|
|
.Include(j => j.Role)
|
|
.FirstOrDefaultAsync(j => j.Id == id);
|
|
}
|
|
}
|