Jonathan Ouellette 580e90f6a2 initial add
2022-09-27 14:10:30 -07:00

97 lines
3.2 KiB
Plaintext

@{
Layout = "_HomeLayout.cshtml";
}
@{
ViewBag.Title = "New/Repair Spare Parts Request List";
}
<div class="panel panel-default">
<div class="panel-heading">
<table style="width: 100%">
<tr>
<td align="center" style="font-size: 15px; font-weight: bold; color: crimson">
@ViewBag.Title
</td>
</tr>
</table>
</div>
<div id="npListdiv" class="k-content" style="font-size: 11px">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.PartsRequestList>()
.Name("PartsRequestList")
.Columns(columns =>
{
columns.Bound(l => l.PRNumber)
.ClientTemplate("<a href='/PartsRequest/Edit?IssueID=#=PRNumber#'>#=formatIssueID(PRNumber)#</a>").Width("100px");
columns.Bound(l => l.Title).Width("250px");
columns.Bound(l => l.Originator).Width("125px");
columns.Bound(l => l.Requestor).Width("125px");
columns.Bound(l => l.TechLead).Width("125px");
columns.Bound(l => l.Status).Width("100px");
columns.Bound(l => l.PendingApprovers);
if (Convert.ToBoolean(ViewBag.CanDeletePR))
{
columns.Template(@<text></text>).ClientTemplate(@"<a class=""k-grid-delete abutton delete"" href=""\#"">Delete</a>").Width(30);
}
})
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.Editable(editable => editable.Mode(GridEditMode.InLine))
.HtmlAttributes(new { style = "height:700px; width:100%; font-size: 11px" })
.Scrollable()
.Sortable()
.Resizable(r => r.Columns(true))
.Filterable(filterable => filterable
.Extra(false)
.Operators(operators => operators
.ForString(str => str
.Clear()
.Contains("Contains")
.DoesNotContain("Does not contain")
.StartsWith("Starts with")
.EndsWith("Ends with")
.IsEqualTo("Is equal to")
.IsNotEqualTo("Is not equal to ")
)
))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.PRNumber);
})
.PageSize(50)
.Read(read => read.Action("GetPartsRequestList", "Home"))
.Destroy(destroy => destroy.Action("DeletePR", "Home"))
.Events(events => events.Error("errorHandler"))
)
)
</div>
</div>
<script>
function formatIssueID(num) {
var length = 6;
var numStr = num.toString();
while (numStr.length < length) {
numStr = '0' + numStr;
}
numStr = 'PR' + numStr
return numStr;
}
function errorHandler(e, status) {
$("#PartsRequestList").data("kendoGrid").cancelChanges();
if (e.errorThrown != null) {
alert("Error: " + e.errorThrown);
} else {
alert("Server error");
}
}
</script>