web: detail závady s průběhem řešení, komentáři, přílohami a akcemi
This commit is contained in:
1 parent
5d8b71c435
commit
ac3ec6aff7
14 files changed
+1006
-56
No files matched your search
@@ -38,7 +38,8 @@ public static class AttachmentRules
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NewIssueViewModel
|
||||
/// <summary>Údaje hlášení společné pro nové hlášení i jeho úpravu (partial <c>_IssueFields</c>).</summary>
|
||||
public abstract class IssueFormViewModel
|
||||
{
|
||||
[Required(ErrorMessage = "Zadejte název.")]
|
||||
[StringLength(200, ErrorMessage = "Název může mít nejvýše 200 znaků.")]
|
||||
@@ -46,7 +47,7 @@ public sealed class NewIssueViewModel
|
||||
public string Title { get; set; } = "";
|
||||
|
||||
[Required(ErrorMessage = "Popište závadu.")]
|
||||
[StringLength(4000, ErrorMessage = "Popis může mít nejvýše 4000 znaků.")]
|
||||
[StringLength(10_000, ErrorMessage = "Popis může mít nejvýše 10 000 znaků.")] // stejně jako v mobilu
|
||||
[Display(Name = "Popis")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
@@ -61,9 +62,6 @@ public sealed class NewIssueViewModel
|
||||
[Display(Name = "Upřesnění místa")]
|
||||
public string? LocationDetail { get; set; }
|
||||
|
||||
[Display(Name = "Fotografie nebo soubory")]
|
||||
public List<IFormFile> Files { get; set; } = [];
|
||||
|
||||
// Nabídky pro výběr – plní je kontroler z číselníků API.
|
||||
public IReadOnlyList<SelectListItem> Categories { get; set; } = [];
|
||||
public IReadOnlyList<SelectListItem> Buildings { get; set; } = [];
|
||||
@@ -74,3 +72,29 @@ public sealed class NewIssueViewModel
|
||||
Buildings = buildings.Select(b => new SelectListItem(b.Name, b.Id.ToString())).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NewIssueViewModel : IssueFormViewModel
|
||||
{
|
||||
[Display(Name = "Fotografie nebo soubory")]
|
||||
public List<IFormFile> Files { get; set; } = [];
|
||||
}
|
||||
|
||||
/// <summary>Úprava hlášení hlásičem, dokud ho vedení nepřiřadí (stav Přijata).</summary>
|
||||
public sealed class EditIssueViewModel : IssueFormViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>Verze, kterou uživatel upravuje; když se závada mezitím změní, API vrátí 409.</summary>
|
||||
public int RowVersion { get; set; }
|
||||
|
||||
public static EditIssueViewModel From(IssueDetail issue) => new()
|
||||
{
|
||||
Id = issue.Id,
|
||||
RowVersion = issue.RowVersion,
|
||||
Title = issue.Title,
|
||||
Description = issue.Description,
|
||||
CategoryId = issue.CategoryId,
|
||||
BuildingId = issue.BuildingId,
|
||||
LocationDetail = issue.LocationDetail,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user