Introduces new salary specification feature with interactive accordion component Implements detailed salary breakdown including: - Salary specification JSON data model - Salary specification page with printable view - Accordion component for expanding/collapsing salary details - Localization support for new salary labels Enhances employee salary transparency and detail presentation
46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using System.Text.Json;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using PlanTempus.Application.Features.Employees.Components;
|
|
|
|
namespace PlanTempus.Application.Features.Employees.Pages;
|
|
|
|
public class SalarySpecificationModel : PageModel
|
|
{
|
|
private readonly IWebHostEnvironment _environment;
|
|
|
|
public SalarySpecificationModel(IWebHostEnvironment environment)
|
|
{
|
|
_environment = environment;
|
|
}
|
|
|
|
public SalarySpecificationDto? Specification { get; private set; }
|
|
public string EmployeeName { get; private set; } = "Emma Larsen";
|
|
public string EmployeeNumber { get; private set; } = "EMP-001";
|
|
public string Department { get; private set; } = "Frisør";
|
|
public string EmploymentType { get; private set; } = "Fuldtid (37 t/uge)";
|
|
|
|
public IActionResult OnGet(string period)
|
|
{
|
|
var specs = LoadSalarySpecifications();
|
|
Specification = specs.FirstOrDefault(s => s.PeriodKey == period);
|
|
|
|
if (Specification == null)
|
|
{
|
|
return NotFound();
|
|
}
|
|
|
|
return Page();
|
|
}
|
|
|
|
private List<SalarySpecificationDto> LoadSalarySpecifications()
|
|
{
|
|
var jsonPath = Path.Combine(_environment.ContentRootPath, "Features", "Employees", "Data", "salarySpecificationMock.json");
|
|
var json = System.IO.File.ReadAllText(jsonPath);
|
|
var root = JsonSerializer.Deserialize<SalarySpecificationRoot>(json, new JsonSerializerOptions
|
|
{
|
|
PropertyNameCaseInsensitive = true
|
|
});
|
|
return root?.Specifications ?? new List<SalarySpecificationDto>();
|
|
}
|
|
}
|