ticket and respond

This commit is contained in:
2024-08-03 17:35:24 +03:30
parent 780bfc94c8
commit be864f564b
11 changed files with 246 additions and 105 deletions

View File

@ -1,7 +1,12 @@
@model IEnumerable<WebApplication1.Models.ticket>
@using WebApplication1.Models
@model IEnumerable<ticketlist>
@{
ViewBag.Title = "Index";
string status = "";
}
<h2>Index</h2>
@ -12,28 +17,38 @@
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.title)
Title
</th>
<th>
@Html.DisplayNameFor(model => model.content)
Sender username
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.title)
</td>
<td>
@Html.DisplayFor(modelItem => item.content)
</td>
<td>
@Html.ActionLink("Respond", "Respond", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.ticketTitle)
</td>
<td>
@Html.DisplayFor(modelItem => item.username)
</td>
<td>
@if (item.status == 1)
{
status = "awaiting response";
}
else if (item.status == 3)
{
status = "open";
}
@status
</td>
<td>
@Html.ActionLink("Respond", "Respond", new { id = item.ticketID })
</td>
</tr>
}
</table>

View File

@ -15,6 +15,16 @@
{
priority = "Normal";
}
string status = "";
if (ViewBag.targetTicket.status == 1)
{
status = "awaiting response";
}
else if (ViewBag.targetTicket.status == 3)
{
status = "open";
}
}
<h2>Edit</h2>
@ -49,11 +59,17 @@
<input class="form-control" placeholder=@priority readonly />
</div>
</div>
<div class="form-group">
Status
<div class="col-md-10">
<input class="form-control" placeholder=@status readonly />
</div>
</div>
<div class="form-group">
Content
<div class="col-md-10">
<textarea class="form-control" placeholder=@ViewBag.targetTicket.content></textarea>
<textarea class="form-control">@ViewBag.targetTicket.content</textarea>
</div>
</div>
<br />
@ -71,7 +87,7 @@
<div class="form-group">
@Html.LabelFor(model => model.content, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.content, new { @class = "form-control" } )
@Html.TextAreaFor(model => model.content, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.content, "", new { @class = "text-danger" })
</div>
</div>
@ -80,7 +96,8 @@
<div class="form-group">
<div class="col-md-10">
<input class="form-control" name="ticketid" value=@ViewBag.targetTicket.ID hidden />
<input class="form-control" name="ticketid" value=@ViewBag.targetTicket.ID readonly hidden />
<input class="form-control" name="ID" value=@ViewBag.targetTicket.responsid readonly hidden />
</div>
</div>

View File

@ -0,0 +1,45 @@
@model IEnumerable<WebApplication1.Models.response>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.title)
</th>
<th>
@Html.DisplayNameFor(model => model.content)
</th>
<th>
@Html.DisplayNameFor(model => model.adminid)
</th>
<th>
@Html.DisplayNameFor(model => model.ticketid)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.title)
</td>
<td>
@Html.DisplayFor(modelItem => item.content)
</td>
<td>
@Html.DisplayFor(modelItem => item.adminid)
</td>
<td>
@Html.DisplayFor(modelItem => item.ticketid)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
</table>

View File

@ -2,6 +2,7 @@
@{
ViewBag.Title = "Edit";
}
<h2>Edit</h2>
@ -10,50 +11,50 @@
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>ticket</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
<div class="form-horizontal">
<h4>ticket</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.HiddenFor(model => model.ID)
<section class="col-md-4">
<div class="form-group">
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
Title
<div class="col-md-10">
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
<input class="form-control" placeholder=@ViewBag.response.title readonly />
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.content, htmlAttributes: new { @class = "control-label col-md-2" })
Content
<div class="col-md-10">
@Html.EditorFor(model => model.content, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.content, "", new { @class = "text-danger" })
<textarea class="form-control" placeholder=@ViewBag.response.content></textarea>
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.priority, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.priority, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.priority, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.senderid, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.senderid, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.senderid, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
<br />
</section>
<div class="form-group">
@Html.LabelFor(model => model.title, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.title, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.title, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.content, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.TextAreaFor(model => model.content, new { @class = "form-control" })
@Html.ValidationMessageFor(model => model.content, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
}
<div>