71 lines
2.0 KiB
Plaintext
71 lines
2.0 KiB
Plaintext
@page
|
|
@using Models;
|
|
@using System.Globalization
|
|
@using System.Security.Claims;
|
|
@model WebApp.Pages.ComplaintModel
|
|
@{
|
|
Complaint complaint = (Complaint)ViewData["complaint"];
|
|
ViewData["Title"] = $"{complaint.Title}";
|
|
}
|
|
<h1 @if (complaint.Severity == ComplaintSeverity.URGENT)
|
|
{
|
|
@: style="color: red;"
|
|
}
|
|
else if (complaint.Severity == ComplaintSeverity.HIGH)
|
|
{
|
|
@: style="color: orange;"
|
|
}
|
|
@if (complaint.Severity == ComplaintSeverity.LOW)
|
|
{
|
|
@: style="color: darkgreen;"
|
|
}>
|
|
@complaint.Title
|
|
</h1>
|
|
<p>
|
|
Filed @complaint.PublishDate.ToString("g") by @complaint.Author.Name
|
|
</p>
|
|
<p>
|
|
@complaint.Status - @complaint.Severity
|
|
</p>
|
|
<hr/>
|
|
<p>@Html.Raw(complaint.Description.Replace(Environment.NewLine, "<br />"))</p>
|
|
<br/>
|
|
<h3>Comments</h3>
|
|
@if (complaint.Responses.Count() == 0)
|
|
{
|
|
<p>No comments found</p>
|
|
}
|
|
else
|
|
{
|
|
foreach (Comment comment in complaint.Responses)
|
|
{
|
|
DisplayComment(comment, 0);
|
|
}
|
|
}
|
|
<a href="./AddComment?t=complaint&id=@complaint.ID" class="btn btn-primary">Add reply</a>
|
|
|
|
@{
|
|
void DisplayComment(Comment comment, int level)
|
|
{
|
|
<div class="d-flex flex-row">
|
|
@for (int i = 0; i < level; i++)
|
|
{
|
|
<a class="me-3" href="#"></a>
|
|
}
|
|
<div class="card flex-fill">
|
|
<div class="card-body">
|
|
<h5 class="card-title">@comment.Author.Name @Html.Raw((comment.Author.Role == UserRole.ADMIN || comment.Author.Role == UserRole.MANAGER) ? $"<b>({CultureInfo.CurrentCulture.TextInfo.ToTitleCase(comment.Author.Role.ToString().ToLower())})</b>" : "")</h5>
|
|
<h6>@comment.PublishDate.ToString("g")</h6>
|
|
<p class="card-text">@Html.Raw(comment.Description.Replace(Environment.NewLine, "<br />"))</p>
|
|
</div>
|
|
@if (comment.Responses.Count != 0)
|
|
{
|
|
foreach (var response in comment.Responses)
|
|
{
|
|
DisplayComment(response, level + 1);
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
} |