422 lines
16 KiB
Plaintext
422 lines
16 KiB
Plaintext
@using Microsoft.AspNet.Identity
|
|
@{
|
|
Layout = "_HomeLayout.cshtml";
|
|
}
|
|
|
|
<!DOCTYPE html>
|
|
<link rel="stylesheet" href="~/Scripts/js.cookie.js" />
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width" />
|
|
<title>@ViewBag.Title</title>
|
|
</head>
|
|
|
|
|
|
<body onload="LoadState();" onunload="SaveData()">
|
|
@*<body>*@
|
|
<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">
|
|
|
|
<label id="header" style="font-size: large; font-weight: bold; color: crimson; font-family: 'Times New Roman'">
|
|
All Documents
|
|
</label><br />
|
|
<label id="headerID" style="font-size: small; font-weight: bold; color: blue; font-family: 'Times New Roman'">
|
|
|
|
</label>
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div id="alltasklistdiv" class="k-content" style="font-size: 11px;">
|
|
@if ((bool)Session[GlobalVars.IS_ADMIN])
|
|
{
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.ViewModels.IssuesViewModel>()
|
|
.Name("alltasklist")
|
|
.Columns(columns =>
|
|
{
|
|
//columns.Bound(l => l.IssueID);
|
|
columns.Bound(l => l.IssueID).Template(@<text> @Html.ActionLink(@item.IssueID.ToString(), null)</text>)
|
|
.ClientTemplate("<a href='/#=DocumentType#/Edit?IssueID=#=DocID#'>#=formatIssueID(IssueID, SubDoc)#</a>");
|
|
columns.Bound(l => l.DocumentType);
|
|
columns.Bound(l => l.SubDoc);
|
|
columns.Bound(l => l.Originator);
|
|
columns.Bound(l => l.IssueDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Bound(l => l.Title);
|
|
columns.Bound(l => l.LotNos);
|
|
columns.Bound(l => l.PendingApprovers).HtmlAttributes(new { style = "font-weight: bold; color: red;" });
|
|
columns.Bound(l => l.SubmitedDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Bound(l => l.CloseDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Template(t => { }).HeaderTemplate("").ClientTemplate(@"
|
|
<a href='javascript: void(0)' class='abutton delete' onclick='deleteRow(this)' title='button delete'>button delete</a>");
|
|
//columns.Command(command => command.Destroy());
|
|
})
|
|
.Events(e => e.DataBound("onAllDocsDB"))
|
|
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
|
|
.Editable(editable => editable.Mode(GridEditMode.InLine))
|
|
.HtmlAttributes(new { style = "height: 700px;" })
|
|
.Scrollable()
|
|
.Sortable()
|
|
.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.IssueID);
|
|
|
|
//model.Field(p => p.TotalCost).Editable(false);
|
|
})
|
|
//.Events(e => e.RequestEnd("LoadState"))
|
|
.PageSize(50)
|
|
.Read(read => read.Action("GetDocuments", "Home"))
|
|
.Destroy(destroy => destroy.Action("DeleteItem", "Home"))
|
|
)
|
|
)
|
|
}
|
|
else
|
|
{
|
|
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.ViewModels.IssuesViewModel>()
|
|
.Name("alltasklist")
|
|
.Columns(columns =>
|
|
{
|
|
//columns.Bound(l => l.IssueID);
|
|
columns.Bound(l => l.IssueID).Template(@<text> @Html.ActionLink(@item.IssueID.ToString(), null)</text>)
|
|
.ClientTemplate("<a href='/#=DocumentType#/Edit?IssueID=#=DocID#'>#=IssueID#</a>");
|
|
columns.Bound(l => l.DocumentType);
|
|
columns.Bound(l => l.SubDoc);
|
|
columns.Bound(l => l.Originator);
|
|
columns.Bound(l => l.IssueDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Bound(l => l.Title);
|
|
columns.Bound(l => l.LotNos);
|
|
columns.Bound(l => l.PendingApprovers).HtmlAttributes(new { style = "font-weight: bold; color: red;" });
|
|
columns.Bound(l => l.SubmitedDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Bound(l => l.CloseDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
})
|
|
.Events(e => e.DataBound("onAllDocsDB"))
|
|
//.Selectable(selectable => selectable.Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
|
|
.Editable(editable => editable.Mode(GridEditMode.InLine))
|
|
.HtmlAttributes(new { style = "height: 700px;" })
|
|
.Scrollable()
|
|
.Sortable()
|
|
.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.IssueID);
|
|
|
|
//model.Field(p => p.TotalCost).Editable(false);
|
|
})
|
|
// .Events(e => e.RequestEnd("LoadState"))
|
|
.PageSize(50)
|
|
.Read(read => read.Action("GetDocuments", "Home"))
|
|
.Destroy(destroy => destroy.Action("DeleteItem", "Home"))
|
|
)
|
|
|
|
)
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="modal fade" id="ReAssignApproval" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
<h4 class="modal-title" id="myModalLabel">Re-Assign for Approval From: <label class="bg-danger" id="ReAssignApproverFromLabel">Me</label></h4>
|
|
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="control-group">
|
|
<div class="controls">
|
|
<h4 class="modal-title" id="myModalLabel">Re-Assign for Approval to:</h4>
|
|
<div id='lstReAssignApproval'>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-primary" id="ConfirmReAssignment">Confirm Re-assignment</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function () {
|
|
//try {
|
|
// var storTest = window['localStorage'];
|
|
// storTest.setItem("", ".");
|
|
// storTest.removeItem("");
|
|
//}
|
|
//catch (e) { alert("Please go away"); }
|
|
|
|
|
|
})
|
|
|
|
|
|
function SaveDataOld() {
|
|
// alert("save");
|
|
var grid = $("#alltasklist").data("kendoGrid");
|
|
|
|
var dataSource = grid.dataSource;
|
|
|
|
var state = {
|
|
//page: dataSource.page(),
|
|
filter: dataSource.filter()
|
|
};
|
|
var str = JSON.stringify(state);
|
|
try
|
|
{
|
|
var ls;
|
|
ls = localStorage;
|
|
ls.setItem("alltasklistFilter", str);
|
|
}
|
|
catch(e)
|
|
{
|
|
alert("Problem while storing the Grid Filter Settings");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function LoadStateOld () {
|
|
//alert("load");
|
|
var grid = $("#alltasklist").data("kendoGrid");
|
|
|
|
var dataSource = grid.dataSource;
|
|
var ls;
|
|
ls = localStorage;
|
|
var state = ls.getItem("alltasklistFilter");
|
|
state = JSON.parse(state);
|
|
var options = grid.options;
|
|
options.dataSource.filter = state.filter;
|
|
//options.dataSource.page = state.page;
|
|
grid.destroy();
|
|
|
|
$("#alltasklist")
|
|
.empty()
|
|
.kendoGrid(options);
|
|
|
|
displayfilter(state.filter)
|
|
|
|
}
|
|
|
|
function LoadState () {
|
|
//alert("load");
|
|
var grid = $("#alltasklist").data("kendoGrid");
|
|
try
|
|
{
|
|
var dataSource = grid.dataSource;
|
|
$.ajax({
|
|
url: "/Home/LoadAllDocumentsFilter",
|
|
datatype: "json",
|
|
success: function (state) {
|
|
//alert(state);
|
|
state = JSON.parse(state);
|
|
|
|
var options = grid.options;
|
|
//alert("Success");
|
|
|
|
//options.dataSource.page = state.page;
|
|
//options.dataSource.pageSize = state.pageSize;
|
|
//options.dataSource.sort = state.sort;
|
|
options.dataSource.filter = state.filter;
|
|
//options.dataSource.group = state.group;
|
|
displayfilter(state.filter);
|
|
|
|
grid.destroy();
|
|
|
|
$("#alltasklist")
|
|
.empty()
|
|
.kendoGrid(options);
|
|
|
|
|
|
},
|
|
error: function(result)
|
|
{
|
|
//alert(result)
|
|
}
|
|
});
|
|
}
|
|
catch(e)
|
|
{
|
|
alert("Problems while filtering...")
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function SaveData() {
|
|
// alert("save");
|
|
|
|
var grid = $("#alltasklist").data("kendoGrid");
|
|
|
|
var dataSource = grid.dataSource;
|
|
|
|
var state = {
|
|
//page: dataSource.page(),
|
|
//pageSize: dataSource.pageSize(),
|
|
//sort: dataSource.sort(),
|
|
filter: dataSource.filter()
|
|
//group: dataSource.group()
|
|
};
|
|
//var str = JSON.stringify(state);
|
|
|
|
$.ajax({
|
|
url: "/Home/SaveAllDocumentsFilter",
|
|
data: {
|
|
data: JSON.stringify(state)
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
function displayfilter(filter)
|
|
{
|
|
// alert(filter);
|
|
var currentFilter = filter; // get current filter
|
|
//alert(currentFilter);
|
|
// create HTML representation of the filter (this implementation works only for simple cases)
|
|
if (currentFilter != null) {
|
|
try {
|
|
var filterHtml = "";
|
|
currentFilter.filters.forEach(function (filter, index) {
|
|
//filterHtml += "[Field: " + filter.field + "]" +
|
|
// "[Operator: " + filter.operator + "]" +
|
|
// "[Value: " + filter.value + "]";
|
|
|
|
filterHtml += "[" + filter.field + " " +
|
|
filter.operator + " " +
|
|
"'" + filter.value + "'] ";
|
|
|
|
//if (currentFilter.filters.length > 1 && index !== currentFilter.filters.length - 1) {
|
|
// filterHtml += "[Logic: " + currentFilter.logic + "]/";
|
|
|
|
if (currentFilter.filters.length > 1 && index !== currentFilter.filters.length - 1) {
|
|
filterHtml += " " + currentFilter.logic + " ";
|
|
|
|
}
|
|
});
|
|
|
|
// display it somewhere
|
|
$("#filter").html(filterHtml);
|
|
if (filterHtml != '') {
|
|
$("#headerID").text(" Filter = " + filterHtml)
|
|
$("#headerID").css("color", "blue");
|
|
}
|
|
else {
|
|
$("#headerID").text("");
|
|
}
|
|
}
|
|
catch (ex) {
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function formatIssueID(num, docType) {
|
|
|
|
var length = 4;
|
|
var numStr = num.toString();
|
|
if (docType == 'ChangeControl') {
|
|
while (numStr.length < length) {
|
|
numStr = '0' + numStr;
|
|
}
|
|
numStr = 'P' + numStr
|
|
}
|
|
|
|
if (docType == 'PR') {
|
|
length = 6;
|
|
while (numStr.length < length) {
|
|
numStr = '0' + numStr;
|
|
}
|
|
numStr = 'PR' + numStr
|
|
}
|
|
|
|
return numStr;
|
|
}
|
|
|
|
function toggleDelegate() {
|
|
var control = document.getElementById("DelegateControl");
|
|
var label = document.getElementById("DelegateLabel");
|
|
|
|
control.classList.toggle("hideControl");
|
|
label.classList.toggle("hideControl");
|
|
}
|
|
|
|
function onAllDocsDB(e) {
|
|
var grid = $("#alltasklist").data("kendoGrid");
|
|
|
|
var dataSource = grid.dataSource;
|
|
|
|
var state = {
|
|
//page: dataSource.page(),
|
|
//pageSize: dataSource.pageSize(),
|
|
//sort: dataSource.sort(),
|
|
filter: dataSource.filter()
|
|
}
|
|
|
|
|
|
displayfilter(dataSource.filter());
|
|
}
|
|
</script>
|
|
|