initial add
This commit is contained in:
369
Fab2ApprovalSystem/Views/PartsRequest/Edit.cshtml
Normal file
369
Fab2ApprovalSystem/Views/PartsRequest/Edit.cshtml
Normal file
@ -0,0 +1,369 @@
|
||||
@model Fab2ApprovalSystem.Models.PartsRequest
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Parts Request - Edit";
|
||||
}
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-spacing: 5px;
|
||||
padding: 5px;
|
||||
border-color: white;
|
||||
border-color: white;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-header .k-link {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-grid-edit-row input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header .k-link {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.k-grid .k-edit-cell input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
|
||||
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
|
||||
<div>
|
||||
<div class="panel panel-default center-block" data-spy="affix">
|
||||
<input type="button" value="Back to List" class="btn btn-primary btn-xs" id="PRList" />
|
||||
<input type="button" value="Save" class="btn btn-primary btn-xs" id="SavePR" />
|
||||
<input type="button" value="Submit" class="btn btn-primary btn-xs" id="SubmitPR" />
|
||||
|
||||
<input type="button" value="Approval Log History" class="btn btn-primary btn-xs" id="ApprovalLogHistoryData" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default center-block" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<font style="color: crimson; font-size:24px;font-weight: bolder">
|
||||
New/Repair Spare Parts Request
|
||||
</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtPRNumber" class="control-label pull-right">Request #:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.PRNumber, @Functions.ReturnPartsRequestNoStringFormat(@Model.PRNumber),
|
||||
new { id = "txtPRNumber", @class = "k-textbox form-control", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtTitle" class="control-label pull-right">Title:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox form-control" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Submit Date:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.SubmitDate, "{0:MM/dd/yyyy}", new { id = "txSubmitDate", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Tech Lead:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("TechLeadID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.TechLeadID.ToString())
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Originator:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("OriginatorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.Value(Model.OriginatorID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Requestor:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("RequestorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.RequestorID.ToString())
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Status:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Status, new { id = "txtStatus", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Attached Documents:</label>
|
||||
<div>
|
||||
@(Html.Kendo().Upload()
|
||||
.Name("files")
|
||||
.Async(a => a
|
||||
.Save("AttachSave", "PartsRequest", new { PRNumber = Model.PRNumber })
|
||||
.AutoUpload(true)
|
||||
)
|
||||
.ShowFileList(false)
|
||||
.Events(events => events
|
||||
.Success("OnFileUploadSuccess")
|
||||
.Upload("CheckFileType")
|
||||
)
|
||||
)
|
||||
|
||||
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.PartsRequestAttachmentList>()
|
||||
.Name("Attachments")
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(a => a.AttachmentID).Visible(false);
|
||||
columns.Bound(a => a.PRNumber).Visible(false);
|
||||
columns.Bound(a => a.FileName).Template(@<text> @Html.ActionLink(@item.FileName.ToString(), null)</text>);
|
||||
columns.Bound(a => a.FullName);
|
||||
columns.Bound(a => a.UploadDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
||||
columns.Command(command => command.Custom("View").Click("DownloadAttachment"));
|
||||
columns.Command(command => command.Custom("Delete").Click("DeleteAttachment"));
|
||||
})
|
||||
.Sortable()
|
||||
.Scrollable()
|
||||
.HtmlAttributes(new { style = "height:100px; width:100%; font-size: 10px" })
|
||||
.DataSource(dataSource => dataSource
|
||||
.Ajax()
|
||||
.ServerOperation(false)
|
||||
.Events(events => events.Error("ErrorHandler"))
|
||||
.Model(model =>
|
||||
{
|
||||
model.Id(p => p.AttachmentID);
|
||||
})
|
||||
.PageSize(50)
|
||||
.Read(read => read.Action("Attachment_Read", "PartsRequest", new { PRNumber = Model.PRNumber }))
|
||||
)
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-info" style="font-size: 11px">
|
||||
<div class="panel-heading">
|
||||
<h5 style="font-weight:600">Description</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal col-sm-12">
|
||||
@Html.TextAreaFor(model => model.Description, 10, 60, new {
|
||||
id = "txtDescription",
|
||||
@class = "form-control",
|
||||
style = "font-size: 11px;width: 100%;" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Partial("_ApproversListPartial")
|
||||
|
||||
}
|
||||
|
||||
@Html.Partial("_ApprovalLogPartial")
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#PRList").on('click', function () {
|
||||
var url = '@Url.Action("PartsRequestList", "Home")';
|
||||
window.location = url;
|
||||
});
|
||||
|
||||
$("#SavePR").on('click', function (e) {
|
||||
SaveData(false);
|
||||
});
|
||||
|
||||
$("#SubmitPR").on('click', function (e) {
|
||||
SaveData(true);
|
||||
});
|
||||
|
||||
function GetPRNumber() {
|
||||
return $('#txtPRNumber').val().substr(2);
|
||||
}
|
||||
|
||||
function ReloadUI() {
|
||||
var url = '@Url.Action("Edit", "PartsRequest", new { issueID = "__id__" })';
|
||||
url = url.replace('amp;', '');
|
||||
window.location.href = url.replace('__id__', GetPRNumber());
|
||||
}
|
||||
|
||||
function DownloadAttachment(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
||||
var fileName = dataItem.FileName;
|
||||
var attachmentID = dataItem.AttachmentID;
|
||||
|
||||
window.location = '/PartsRequest/DownloadFile?attachmentID=' + attachmentID + '&prNumber=' + "@Model.PRNumber";
|
||||
|
||||
}
|
||||
|
||||
function DeleteAttachment(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
if (confirm("Are you sure you want to delete this attachment?")) {
|
||||
|
||||
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
||||
var fileName = dataItem.FileName;
|
||||
var attachmentID = dataItem.AttachmentID;
|
||||
|
||||
$.ajax({
|
||||
url: "/PartsRequest/DeleteAttachment",
|
||||
type: "POST",
|
||||
datatype: "json",
|
||||
data: {
|
||||
attachmentID: attachmentID,
|
||||
fileName: fileName,
|
||||
prNumber: GetPRNumber(),
|
||||
},
|
||||
success: function (data) {
|
||||
var grid = $("#Attachments").data("kendoGrid");
|
||||
grid.dataSource.read();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
DisplayAPIError("Delete Attachment", xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CheckFileType(e) {
|
||||
var files = e.files;
|
||||
$.each(files, function () {
|
||||
|
||||
if (!this.extension.toLowerCase().match(/^(.doc|.docx|.ppt|.pptx|.xls|.xlsx|.xlsm|.pdf|.gif|.jpeg|.jpg|.bmp|.png|.txt)$/)) {
|
||||
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function OnFileUploadSuccess(e) {
|
||||
var grid = $("#Attachments").data("kendoGrid");
|
||||
grid.dataSource.read();
|
||||
}
|
||||
|
||||
function ErrorHandler(e) {
|
||||
if (e.errors) {
|
||||
var message = "Errors:\n";
|
||||
$.each(e.errors, function (key, value) {
|
||||
if ('errors' in value) {
|
||||
$.each(value.errors, function () {
|
||||
message += this + "\n";
|
||||
});
|
||||
}
|
||||
});
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
|
||||
function SaveData(submitAfterSave) {
|
||||
|
||||
$.ajax({
|
||||
url: '/PartsRequest/Edit',
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
data: JSON.stringify(
|
||||
{
|
||||
PRNumber: GetPRNumber(),
|
||||
Title: $("#txtTitle").val(),
|
||||
RequestorID: $("#RequestorID").data("kendoDropDownList").value(),
|
||||
TechLeadID: $("#TechLeadID").data("kendoDropDownList").value(),
|
||||
Description: $("#txtDescription").val(),
|
||||
}),
|
||||
success: function (result) {
|
||||
if (submitAfterSave == true) {
|
||||
Submit();
|
||||
} else {
|
||||
alert("Data Saved");
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
DisplayAPIError("Save", xhr);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function Submit() {
|
||||
|
||||
$.ajax({
|
||||
url: "/PartsRequest/Submit",
|
||||
type: "POST",
|
||||
datatype: "json",
|
||||
data: {
|
||||
prNumber: GetPRNumber(),
|
||||
},
|
||||
success: function (data) {
|
||||
alert('Request submitted');
|
||||
ReloadUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
DisplayAPIError("Submit", xhr);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
368
Fab2ApprovalSystem/Views/PartsRequest/EditApproval.cshtml
Normal file
368
Fab2ApprovalSystem/Views/PartsRequest/EditApproval.cshtml
Normal file
@ -0,0 +1,368 @@
|
||||
@model Fab2ApprovalSystem.Models.PartsRequest
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Parts Request - Approval";
|
||||
}
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-spacing: 5px;
|
||||
padding: 5px;
|
||||
border-color: white;
|
||||
border-color: white;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-header .k-link {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-grid-edit-row input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header .k-link {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.k-grid .k-edit-cell input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
|
||||
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
<input type="hidden" id="currentStep" value="@Model.CurrentStep" />
|
||||
|
||||
<div>
|
||||
<div class="panel panel-default center-block" data-spy="affix">
|
||||
<input type="button" value="Back to List" class="btn btn-primary btn-xs" id="PRList" />
|
||||
|
||||
@if (Convert.ToBoolean(ViewBag.IsApprover))
|
||||
{
|
||||
<input type="button" value="Approve" class="btn btn-success btn-xs" id="ApproveDocument" />
|
||||
|
||||
if (Convert.ToBoolean(ViewBag.AllowReject))
|
||||
{
|
||||
<input type="button" value="Reject" class="btn btn-warning btn-xs" id="RejectDocument" />
|
||||
}
|
||||
}
|
||||
|
||||
<input type="button" value="Approval Log History" class="btn btn-primary btn-xs" id="ApprovalLogHistoryData" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default center-block" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<font style="color: crimson; font-size:24px;font-weight: bolder">
|
||||
New/Repair Spare Parts Request
|
||||
</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtPRNumber" class="control-label pull-right">Request #:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.PRNumber, @Functions.ReturnPartsRequestNoStringFormat(@Model.PRNumber),
|
||||
new { id = "txtPRNumber", @class = "k-textbox form-control", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtTitle" class="control-label pull-right">Title:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox form-control", Readonly = "Readonly" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Submit Date:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.SubmitDate, "{0:MM/dd/yyyy}", new { id = "txSubmitDate", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Tech Lead:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("TechLeadID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.TechLeadID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Originator:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("OriginatorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.Value(Model.OriginatorID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Requestor:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("RequestorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.RequestorID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Status:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Status, new { id = "txtStatus", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Attached Documents:</label>
|
||||
<div>
|
||||
|
||||
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.PartsRequestAttachmentList>()
|
||||
.Name("Attachments")
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(a => a.AttachmentID).Visible(false);
|
||||
columns.Bound(a => a.PRNumber).Visible(false);
|
||||
columns.Bound(a => a.FileName).Template(@<text> @Html.ActionLink(@item.FileName.ToString(), null)</text>);
|
||||
columns.Bound(a => a.FullName);
|
||||
columns.Bound(a => a.UploadDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
||||
columns.Command(command => command.Custom("View").Click("DownloadAttachment"));
|
||||
})
|
||||
.Sortable()
|
||||
.Scrollable()
|
||||
.HtmlAttributes(new { style = "height:100px; width:100%; font-size: 10px" })
|
||||
.DataSource(dataSource => dataSource
|
||||
.Ajax()
|
||||
.ServerOperation(false)
|
||||
.Events(events => events.Error("ErrorHandler"))
|
||||
.Model(model =>
|
||||
{
|
||||
model.Id(p => p.AttachmentID);
|
||||
})
|
||||
.PageSize(50)
|
||||
.Read(read => read.Action("Attachment_Read", "PartsRequest", new { PRNumber = Model.PRNumber }))
|
||||
)
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-info" style="font-size: 11px">
|
||||
<div class="panel-heading">
|
||||
<h5 style="font-weight:600">Description</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal col-sm-12">
|
||||
@Html.TextAreaFor(model => model.Description, 10, 60, new {
|
||||
id = "txtDescription",
|
||||
@class = "form-control",
|
||||
style = "font-size: 11px;width: 100%;",
|
||||
disabled = "disabled" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Partial("_ApproversListPartial")
|
||||
|
||||
}
|
||||
|
||||
<div class="modal fade" id="ApprovalComments" 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">Enter Approval Comments:</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea class="form-control" rows="3" id="approvalComments"></textarea>
|
||||
</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="submitApprovalComments">Confirm Approval</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="RejectComments" 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">Enter Reject Comments:</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea class="form-control" rows="3" id="rejectComments"></textarea>
|
||||
</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="submitRejectComments">Confirm Reject</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Partial("_ApprovalLogPartial")
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#PRList").on('click', function () {
|
||||
var url = '@Url.Action("PartsRequestList", "Home")';
|
||||
window.location = url;
|
||||
});
|
||||
|
||||
function ReloadUI() {
|
||||
var url = '@Url.Action("EditApproval", "PartsRequest", new { issueID = "__id__" })';
|
||||
url = url.replace('amp;', '');
|
||||
window.location.href = url.replace('__id__', GetPRNumber());
|
||||
}
|
||||
|
||||
function GetPRNumber() {
|
||||
return $('#txtPRNumber').val().substr(2);
|
||||
}
|
||||
|
||||
function ErrorHandler(e) {
|
||||
if (e.errors) {
|
||||
var message = "Errors:\n";
|
||||
$.each(e.errors, function (key, value) {
|
||||
if ('errors' in value) {
|
||||
$.each(value.errors, function () {
|
||||
message += this + "\n";
|
||||
});
|
||||
}
|
||||
});
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
|
||||
function DownloadAttachment(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
||||
var fileName = dataItem.FileName;
|
||||
var attachmentID = dataItem.AttachmentID;
|
||||
|
||||
window.location = '/PartsRequest/DownloadFile?attachmentID=' + attachmentID + '&prNumber=' + "@Model.PRNumber";
|
||||
|
||||
}
|
||||
|
||||
$('#ApproveDocument').on('click', function () {
|
||||
|
||||
$('#submitApprovalComments').attr("disabled", false);
|
||||
$("#ApprovalComments").modal('show');
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
$('#submitApprovalComments').on('click', function () {
|
||||
|
||||
$('#submitApprovalComments').attr("disabled", true);
|
||||
|
||||
$.ajax({
|
||||
url: "/PartsRequest/Approve",
|
||||
type: "POST",
|
||||
datatype: "json",
|
||||
data: {
|
||||
prNumber: GetPRNumber(),
|
||||
currentStep: $("#currentStep").val(),
|
||||
comments: $("#approvalComments").val(),
|
||||
},
|
||||
success: function (data) {
|
||||
$("#ApprovalComments").modal('hide');
|
||||
if (data != "OK") {
|
||||
alert(data);
|
||||
}
|
||||
ReloadUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$('#submitApprovalComments').attr("disabled", false);
|
||||
DisplayAPIError("Approval. Please approve the document again.", xhr);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#RejectDocument').on('click', function () {
|
||||
$('#RejectDocument').attr("disabled", false);
|
||||
$("#RejectComments").modal('show');
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#submitRejectComments').on('click', function () {
|
||||
$('#RejectDocument').attr("disabled", true);
|
||||
|
||||
$.ajax({
|
||||
url: "/PartsRequest/Reject",
|
||||
type: "POST",
|
||||
datatype: "json",
|
||||
data: {
|
||||
prNumber: GetPRNumber(),
|
||||
currentStep: $("#currentStep").val(),
|
||||
comments: $("#rejectComments").val(),
|
||||
},
|
||||
success: function (data) {
|
||||
$("#RejectComments").modal('hide');
|
||||
if (data != "OK") {
|
||||
alert(data);
|
||||
}
|
||||
ReloadUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
$('#submitRejectComments').attr("disabled", false);
|
||||
DisplayAPIError("Reject. Please reject the document again.", xhr);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
254
Fab2ApprovalSystem/Views/PartsRequest/ReadOnly.cshtml
Normal file
254
Fab2ApprovalSystem/Views/PartsRequest/ReadOnly.cshtml
Normal file
@ -0,0 +1,254 @@
|
||||
@model Fab2ApprovalSystem.Models.PartsRequest
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Parts Request - Read Only";
|
||||
}
|
||||
|
||||
<style>
|
||||
table {
|
||||
border-spacing: 5px;
|
||||
padding: 5px;
|
||||
border-color: white;
|
||||
border-color: white;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-header .k-link {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.k-grid-edit-row input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header .k-link {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.k-grid .k-grid-header .k-header {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.k-grid .k-edit-cell input {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
|
||||
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
<input type="hidden" id="currentStep" value="@Model.CurrentStep" />
|
||||
|
||||
<div>
|
||||
<div class="panel panel-default center-block" data-spy="affix">
|
||||
<input type="button" value="Back to List" class="btn btn-primary btn-xs" id="PRList" />
|
||||
|
||||
<input type="button" value="Approval Log History" class="btn btn-primary btn-xs" id="ApprovalLogHistoryData" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default center-block" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<font style="color: crimson; font-size:24px;font-weight: bolder">
|
||||
New/Repair Spare Parts Request
|
||||
</font>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtPRNumber" class="control-label pull-right">Request #:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.PRNumber, @Functions.ReturnPartsRequestNoStringFormat(@Model.PRNumber),
|
||||
new { id = "txtPRNumber", @class = "k-textbox form-control", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label for="txtTitle" class="control-label pull-right">Title:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox form-control", Readonly = "Readonly" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Submit Date:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.SubmitDate, "{0:MM/dd/yyyy}", new { id = "txSubmitDate", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Tech Lead:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("TechLeadID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.TechLeadID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Originator:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("OriginatorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.Value(Model.OriginatorID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-sm-8">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Requestor:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@(Html.Kendo().DropDownList()
|
||||
.Name("RequestorID")
|
||||
.BindTo(new SelectList(ViewBag.UserList, "UserID", "FullName"))
|
||||
.OptionLabel("Select")
|
||||
.Value(Model.RequestorID.ToString())
|
||||
.HtmlAttributes(new { disabled = "disabled" })
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal row">
|
||||
<div class="form-group col-sm-4">
|
||||
<div class="col-xs-4">
|
||||
<label class="control-label pull-right">Status:</label>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
@Html.TextBoxFor(model => model.Status, new { id = "txtStatus", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-group">
|
||||
<label class="control-label">Attached Documents:</label>
|
||||
<div>
|
||||
|
||||
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.PartsRequestAttachmentList>()
|
||||
.Name("Attachments")
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(a => a.AttachmentID).Visible(false);
|
||||
columns.Bound(a => a.PRNumber).Visible(false);
|
||||
columns.Bound(a => a.FileName).Template(@<text> @Html.ActionLink(@item.FileName.ToString(), null)</text>);
|
||||
columns.Bound(a => a.FullName);
|
||||
columns.Bound(a => a.UploadDate).Format("{0:MM/dd/yy hh:mm:ss}");
|
||||
columns.Command(command => command.Custom("View").Click("DownloadAttachment"));
|
||||
})
|
||||
.Sortable()
|
||||
.Scrollable()
|
||||
.HtmlAttributes(new { style = "height:100px; width:100%; font-size: 10px" })
|
||||
.DataSource(dataSource => dataSource
|
||||
.Ajax()
|
||||
.ServerOperation(false)
|
||||
.Events(events => events.Error("ErrorHandler"))
|
||||
.Model(model =>
|
||||
{
|
||||
model.Id(p => p.AttachmentID);
|
||||
})
|
||||
.PageSize(50)
|
||||
.Read(read => read.Action("Attachment_Read", "PartsRequest", new { PRNumber = Model.PRNumber }))
|
||||
)
|
||||
)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-info" style="font-size: 11px">
|
||||
<div class="panel-heading">
|
||||
<h5 style="font-weight:600">Description</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="form-horizontal col-sm-12">
|
||||
@Html.TextAreaFor(model => model.Description, 10, 60, new {
|
||||
id = "txtDescription",
|
||||
@class = "form-control",
|
||||
style = "font-size: 11px;width: 100%;",
|
||||
disabled = "disabled" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Partial("_ApproversListPartial")
|
||||
|
||||
}
|
||||
|
||||
@Html.Partial("_ApprovalLogPartial")
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$("#PRList").on('click', function () {
|
||||
var url = '@Url.Action("PartsRequestList", "Home")';
|
||||
window.location = url;
|
||||
});
|
||||
|
||||
function ReloadUI() {
|
||||
var url = '@Url.Action("EditApproval", "PartsRequest", new { issueID = "__id__" })';
|
||||
url = url.replace('amp;', '');
|
||||
window.location.href = url.replace('__id__', GetPRNumber());
|
||||
}
|
||||
|
||||
function GetPRNumber() {
|
||||
return $('#txtPRNumber').val().substr(2);
|
||||
}
|
||||
|
||||
function ErrorHandler(e) {
|
||||
if (e.errors) {
|
||||
var message = "Errors:\n";
|
||||
$.each(e.errors, function (key, value) {
|
||||
if ('errors' in value) {
|
||||
$.each(value.errors, function () {
|
||||
message += this + "\n";
|
||||
});
|
||||
}
|
||||
});
|
||||
alert(message);
|
||||
}
|
||||
}
|
||||
|
||||
function DownloadAttachment(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
||||
var fileName = dataItem.FileName;
|
||||
var attachmentID = dataItem.AttachmentID;
|
||||
|
||||
window.location = '/PartsRequest/DownloadFile?attachmentID=' + attachmentID + '&prNumber=' + "@Model.PRNumber";
|
||||
|
||||
}
|
||||
|
||||
</script>
|
@ -0,0 +1,50 @@
|
||||
<div class="modal fade" id="ApprovalLogHistoryDialog" 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">
|
||||
<h4 class="modal-title" id="myModalLabel">Approval Log History</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.ApprovalLogHistory>()
|
||||
.Name("ApprovalLogHistory")
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(a => a.ApprovalLogID).Visible(false);
|
||||
columns.Bound(a => a.FullName);
|
||||
columns.Bound(a => a.SubRole);
|
||||
columns.Bound(a => a.Operation);
|
||||
columns.Bound(a => a.OperationTime).Format("{0:MM/dd/yy hh:mm:ss}");
|
||||
})
|
||||
.Sortable()
|
||||
.Scrollable()
|
||||
.HtmlAttributes(new { style = "height:300px; width:100%; font-size: 12px" })
|
||||
.DataSource(dataSource => dataSource
|
||||
.Ajax()
|
||||
.ServerOperation(false)
|
||||
.Model(model =>
|
||||
{
|
||||
model.Id(p => p.ApprovalLogID);
|
||||
})
|
||||
.PageSize(50)
|
||||
.Read(read => read.Action("ApprovalLogHistory_Read", "PartsRequest", new { prNumber = Model.PRNumber }))
|
||||
)
|
||||
)
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
||||
$('#ApprovalLogHistoryData').on('click', function () {
|
||||
$("#ApprovalLogHistory").data('kendoGrid').dataSource.read();
|
||||
$("#ApprovalLogHistoryDialog").modal('show');
|
||||
return false;
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
@ -0,0 +1,272 @@
|
||||
<div class="panel panel-default" style="font-size: 10px">
|
||||
<div class="panel-info" style="font-size: 11px">
|
||||
<div class="panel-heading">
|
||||
<h5 style="font-weight:600">Approvers</h5>
|
||||
@if (ViewBag.ShowAddApprovers == true)
|
||||
{
|
||||
<button class="k-textbox" data-toggle="modal" id="additionalApprovers">
|
||||
Additional Approvers
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body bg-warning">
|
||||
<div class="col-sm-offset-0">
|
||||
|
||||
@(Html.Kendo().Grid<Fab2ApprovalSystem.ViewModels.ApproversListViewModel>()
|
||||
.Name("ApproversList")
|
||||
.Columns(columns =>
|
||||
{
|
||||
columns.Bound(a => a.UserID).Visible(false);
|
||||
columns.Bound(a => a.ApprovalID).Visible(false);
|
||||
columns.Bound(a => a.FullName);
|
||||
columns.Bound(a => a.RoleName);
|
||||
columns.Bound(a => a.SubRoleName);
|
||||
columns.Bound(a => a.Status);
|
||||
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy hh:mm:ss}"); ;
|
||||
columns.Bound(a => a.CompletedDate).Format("{0:MM/dd/yy hh:mm:ss}"); ;
|
||||
columns.Bound(a => a.Comments);
|
||||
|
||||
if (ViewBag.ShowReAssignApprovers)
|
||||
{
|
||||
columns.Command(command => command.Custom("Re-Assign").Click("showReAssignRole")).Width("100px");
|
||||
}
|
||||
|
||||
})
|
||||
.Sortable()
|
||||
.Scrollable()
|
||||
.HtmlAttributes(new { style = "height:200px; width:100%; font-size: 10px" })
|
||||
.DataSource(dataSource => dataSource
|
||||
.Ajax()
|
||||
.ServerOperation(false)
|
||||
.Model(model =>
|
||||
{
|
||||
model.Id(p => p.ApprovalID);
|
||||
})
|
||||
.PageSize(20)
|
||||
.Read(read => read.Action("GetApproversList", "PartsRequest", new { issueID = Model.PRNumber, step = Model.CurrentStep }))
|
||||
.Sort(s =>
|
||||
{
|
||||
s.Add("CompletedDate").Ascending();
|
||||
})
|
||||
)
|
||||
.Resizable(resize => resize.Columns(true))
|
||||
|
||||
)
|
||||
|
||||
</div>
|
||||
</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>
|
||||
<input type="hidden" id="ReAssignApproverFromUserID"/>
|
||||
</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>
|
||||
|
||||
<div class="modal fade" id="AdditionalApproval" 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">Add New Approvers:</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<div id='lstAdditionalApproval'>
|
||||
</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="confirmAdditionalApproval">Confirm Additional Approver</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function showReAssignRole(e) {
|
||||
|
||||
e.preventDefault();
|
||||
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
||||
|
||||
$('#ReAssignApproverFromLabel').text(dataItem.FullName);
|
||||
$('#ReAssignApproverFromUserID').val(dataItem.UserID);
|
||||
var issueID = GetPRNumber();
|
||||
reAssignFromUserid = dataItem.UserID;
|
||||
|
||||
if (dataItem.Status.indexOf("Pending") < 0)
|
||||
alert("Cannot ReAssign, because it is not in a Pending state");
|
||||
else {
|
||||
|
||||
var searchText = ($("#txtSearch").val());
|
||||
var url = "/PartsRequest/GetAllUsersList";
|
||||
var source =
|
||||
{
|
||||
datatype: "json",
|
||||
datafields: [
|
||||
{ name: 'UserID' },
|
||||
{ name: 'FullName' }
|
||||
],
|
||||
id: 'id',
|
||||
url: url,
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
|
||||
// Create a jqxListBox
|
||||
$("#lstReAssignApproval").jqxListBox({
|
||||
multipleextended: false, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250
|
||||
});
|
||||
|
||||
$("#ReAssignApproval").modal('show');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#ConfirmReAssignment').on('click', function () {
|
||||
// get selected items.
|
||||
var bfound = false;
|
||||
var userids;
|
||||
var itemsToAdd = $('#lstReAssignApproval').jqxListBox('getSelectedItems');
|
||||
|
||||
if (itemsToAdd.length > 0) {
|
||||
for (var i = 0; i < itemsToAdd.length; i++) {
|
||||
if (itemsToAdd[i].label != undefined) {
|
||||
var tempvalue = itemsToAdd[i].value;
|
||||
var templabel = itemsToAdd[i].label;
|
||||
if (userids == null)
|
||||
userids = tempvalue;
|
||||
else
|
||||
userids += "~" + tempvalue;
|
||||
}
|
||||
};
|
||||
if (userids != null) {
|
||||
ReAssignApproval(userids);
|
||||
}
|
||||
$("#ReAssignApproval").modal('hide');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var ReAssignApproval = function (userids) {
|
||||
|
||||
var urlString = '/PartsRequest/ReAssignApproval';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: urlString,
|
||||
data: {
|
||||
userIDs: userids,
|
||||
issueID: GetPRNumber(),
|
||||
step: $("#currentStep").val(),
|
||||
fromUserID: $('#ReAssignApproverFromUserID').val(),
|
||||
},
|
||||
success: function (result) {
|
||||
alert('Approval re-assigned');
|
||||
ReloadUI();
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
DisplayAPIError("Re-Assign Approval", xhr);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
$('#additionalApprovers').on('click', function () {
|
||||
|
||||
var searchText = ($("#txtSearch").val());
|
||||
var url = "/PartsRequest/GetAllUsersList";
|
||||
var source =
|
||||
{
|
||||
datatype: "json",
|
||||
datafields: [
|
||||
{ name: 'UserID' },
|
||||
{ name: 'FullName' }
|
||||
],
|
||||
id: 'id',
|
||||
url: url,
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
// Create a jqxListBox
|
||||
$("#lstAdditionalApproval").jqxListBox({
|
||||
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250
|
||||
});
|
||||
|
||||
$("#AdditionalApproval").modal('show');
|
||||
return false;
|
||||
})
|
||||
|
||||
$('#confirmAdditionalApproval').on('click', function () {
|
||||
// get selected items.
|
||||
var bfound = false;
|
||||
var userids;
|
||||
var itemsToAdd = $('#lstAdditionalApproval').jqxListBox('getSelectedItems');
|
||||
if (itemsToAdd.length > 0) {
|
||||
for (var i = 0; i < itemsToAdd.length; i++) {
|
||||
if (itemsToAdd[i].label != undefined) {
|
||||
var tempvalue = itemsToAdd[i].value;
|
||||
var templabel = itemsToAdd[i].label;
|
||||
if (userids == null)
|
||||
userids = tempvalue;
|
||||
else
|
||||
userids += "~" + tempvalue;
|
||||
}
|
||||
};
|
||||
if (userids != null) {
|
||||
AssignAdditionalApproval(userids);
|
||||
}
|
||||
$("#AdditionalApproval").modal('hide');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var AssignAdditionalApproval = function (userids) {
|
||||
|
||||
var urlString = '/PartsRequest/AddAdditionalApproval';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: urlString,
|
||||
data: {
|
||||
userIDs: userids,
|
||||
issueID: GetPRNumber(),
|
||||
step: $("#currentStep").val()
|
||||
},
|
||||
success: function (result) {
|
||||
var grid = $("#ApproversList").data("kendoGrid");
|
||||
grid.dataSource.read(GetPRNumber(), $("#currentStep").val());
|
||||
},
|
||||
error: function (result) {
|
||||
alert("Failed " + result);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user