web: seznam Moje hlášení
Závady nahlášené přihlášeným uživatelem od nejnovějších: filtr podle stavu, stránkování, štítky stavů, kategorie a místo z číselníků a čas v českém pásmu. Položka v menu a site.js pro automatické odeslání filtru (bez inline skriptů kvůli CSP). Refs #22
This commit is contained in:
1 parent
6208fd3baf
commit
2fe939ba5c
10 files changed
+217
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using Helpdesk.Web.Api;
|
||||
|
||||
namespace Helpdesk.Web.Models;
|
||||
|
||||
public sealed class IssueListViewModel
|
||||
{
|
||||
/// <summary>Stavy závady v pořadí životního cyklu (kap. 6 návrhu) pro filtr.</summary>
|
||||
public static readonly IReadOnlyList<string> Statuses =
|
||||
["RECEIVED", "ASSIGNED", "IN_PROGRESS", "PENDING_VERIFICATION", "RESOLVED", "REJECTED"];
|
||||
|
||||
public required PagedResult<IssueSummary> Issues { get; init; }
|
||||
public required IReadOnlyDictionary<int, string> CategoryNames { get; init; }
|
||||
public required IReadOnlyDictionary<int, string> BuildingNames { get; init; }
|
||||
public string? Status { get; init; }
|
||||
|
||||
public string CategoryName(int id) => CategoryNames.GetValueOrDefault(id, "Neznámá kategorie");
|
||||
|
||||
/// <summary>Budova a upřesnění místa, např. „Budova B – učebna B-205“.</summary>
|
||||
public string? Location(IssueSummary issue)
|
||||
{
|
||||
var building = issue.BuildingId is { } id ? BuildingNames.GetValueOrDefault(id) : null;
|
||||
return (building, issue.LocationDetail) switch
|
||||
{
|
||||
(null, null or "") => null,
|
||||
(null, var detail) => detail,
|
||||
(var b, null or "") => b,
|
||||
var (b, detail) => $"{b} – {detail}",
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user