2025-05-28 13:34:48 -07:00

537 lines
20 KiB
Plaintext

@using Microsoft.AspNet.Identity
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>@ViewBag.Title - Mesa Approval</title>
@Styles.Render("~/Content/kendo/css")
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/jqw/css")
@Scripts.Render("~/bundles/modernizr")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/kendo")
@*<script src="~/Scripts/bootstrap.js"></script>
<script src="~/Scripts/respond.js"></script>*@
@Scripts.Render("~/bundles/bootstrap")
@Scripts.Render("~/Content/jqw/jq")
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
<style>
.red {
color: red;
}
.hide {
visibility: hidden;
}
.k-menu .k-link
{
color: crimson;
}
</style>
</head>
<body class="navbar-inner">
<div class=" navbar navbar-inverse navbar-fixed-top">
<div>
<div class="navbar-header">
@if (Request.IsAuthenticated)
{
@*@Html.ActionLink("Home", "Index", "Home", new { tabName = "MyTasks" }, new { @class = "navbar-brand" })*@
@Html.ActionLink("Home", "MyTasks", "Home", null, new { @class = "navbar-brand" })
}
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
@*<li>@Html.ActionLink("Reports", "Index", "Reports")</li>*@
@if (@GlobalVars.IsAdmin(Session))
{
<li>@Html.ActionLink("Admin", "Index", "Admin")</li>
}
@if (GlobalVars.IsManager(Session))
{
<li>@Html.ActionLink("Manager", "Index", "Manager")</li>
}
</ul>
@Html.Partial("_LoginPartial")
</div>
</div>
</div>
<nav class="navbar navbar-default" role="navigation" style="font-size: 11px">
<div class="container-fluid">
<!-- Collect the nav links, forms, and other content for toggling -->
<ul class="nav navbar-nav" id="myTab">
@*<li><a href=@Url.Action("SpecialWorkRequest", "Home", new { tabName = "AllTasks" })>Special Work Requests</a></li>*@
@*<li><a href="file:////temirwfp001.irworld.irf.com/UserData/QA/CommonRO/Projects/AVI Tool/">AVI Tool</a></li>*@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Create New<b class="caret"></b></a>
<ul class="dropdown-menu" style="font-size: 11px">
@*<li><a href=@Url.Action("Create", "LotDisposition")>Lot Dispostion</a></li>*@
@*<li><a href=@Url.Action("Create", "MRB")>Create MRB</a></li>*@
<li><a href=@Url.Action("Create", "ECN")>Create ECN/TECN</a></li>
@if (!string.IsNullOrWhiteSpace(GlobalVars.GetJWT(Session))) {
string jwt = GlobalVars.GetJWT(Session);
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = GlobalVars.GetRefreshToken(Session);
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=mrb/new";
<li><a href="@mrbUrl">Create MRB</a></li>
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>
} else {
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?redirectPath=mrb/new";
<li><a href="@mrbUrl">Create MRB</a></li>
string pcrbUrl = wasmClientUrl + "/redirect?redirectPath=pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>
}
@*<li><a href=@Url.Action("CreateWorkRequest", "LotTraveler")>Create Special Work Request</a></li>*@
@*<li><a href=@Url.Action("Create", "ChangeControl")>Create PCR</a></li>*@
<li><a href=@Url.Action("Create", "Audit")>Create Audit</a></li>
<li><a href=@Url.Action("Create", "CorrectiveAction")>Create Corrective Action</a></li>
@*@if (GlobalVars.GetCanCreatePartsRequest(Session))
{
<li><a href=@Url.Action("Create", "PartsRequest")>Create New/Repair Spare Parts Request</a></li>
}*@
@*<li><a href="#">Another Doc</a></li>*@
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" role="search">
@*<div class="form-group">
<input type="text" class="form-control" placeholder="Search" style="font-size: 11px">
</div>*@
@if (!GlobalVars.IsOOO(Session))
{
<button class="btn btn-default btn-primary" data-toggle="modal" id="OOO">Out Of Office</button>
}
else
{
<button class="btn btn-default btn-warning" id="OOOExpire">Expire OOO Status</button>
}
@*<button type="submit" class="btn btn-primary" style="font-size: 11px">Submit</button>*@
</form>
<!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
@(Html.Kendo().Menu()
.Name("menu")
.HtmlAttributes(new { style = "width:100%; font-size: 12px" })
.Items(menu =>
{
menu.Add().Text("My Inbox").Action("MyTasks", "Home");
menu.Add().Text("My Training").Action("ViewMyTrainingAssignments", "Training");
menu.Add().Text("Training Reports").Action("TrainingReports", "Training");
menu.Add().Text("All Documents").Action("AllDocuments", "Home");
string jwt = GlobalVars.GetJWT(Session);
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = GlobalVars.GetRefreshToken(Session);
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=mrb/all";
menu.Add().Text("MRB").Url(mrbUrl);
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=pcrb/all";
menu.Add().Text("PCRB").Url(pcrbUrl);
//menu.Add().Text("Special Work Requests").Action("SpecialWorkRequestList", "Home");
//menu.Add().Text("PCRB").Action("ChangeControlList", "Home");
//menu.Add().Text("MRB").Action("MRBList", "Home");
//menu.Add().Text("LotDisposition").Action("LotDispositionList", "Home");
menu.Add().Text("ECN").Action("ECNList", "Home");
menu.Add().Text("Audit").Action("AuditList", "Home");
menu.Add().Text("Corrective Action").Action("CorrectiveActionList", "Home");
//menu.Add().Text("New/Repair Spare Parts").Action("PartsRequestList", "Home");
}))
<div>
@RenderBody()
@*<hr />*@
<footer>
<p>&copy; @DateTime.Now.Year - Infineon Technologies</p>
</footer>
</div>
</body>
</html>
<div class="modal fade" id="OOODialog" 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">&times;</button>
<h4 class="modal-title" id="myModalLabel">Out Of Office for user: @User.Identity.GetUserName()</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="CurrentUser">Delegate To:</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="control-group">
<div class="controls">
<div class="controls">
@(Html.Kendo().DropDownList()
.Name("DelegateTo")
.HtmlAttributes(new { style = "width: 250px" })
.DataTextField("FullName")
.DataValueField("UserID")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetAllUserList", "Admin");
});
})
)
</div>
</div>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
<label for="CurrentUser">Start Date:</label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
<div class="controls">
<label for="CurrentUser">End Date:</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
@(Html.Kendo().DatePicker()
.Name("txtStartDate")
//.Value()
)
</div>
</div>
</div>
@*<div class="col-sm-6">
<div class="control-group">
<div class="controls">
<input type="text" id="test"/>
</div>
</div>
</div>*@
<div class="col-sm-6">
<div class="control-group">
<div class="controls">
@(Html.Kendo().DatePicker()
.Name("txtEndDate")
//.Value()
)
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveOOOInfo">Save</button>
</div>
</div>
</div>
</div>
<script>
var issueID="";
var docType = "";
var submitdate = "";
var userName = '@GlobalVars.GetUserName(Session)';
$(document).ready(function () {
})
@*$("#mytasklist").on("dblclick", "tr.k-state-selected", function (e) {
var grid = $("#mytasklist").data("kendoGrid");
var row = e.currentTarget;
var issueID = row.cells[0].innerText; //
var url = '@Url.Action("Edit", "LotDisposition", new { issueID = "__id__" })';
window.location.href = url.replace('__id__', issueID);
})
$("#alltasklist").on("dblclick", "tr.k-state-selected", function (e) {
var grid = $("#mytalltasklistasklist").data("kendoGrid");
var row = e.currentTarget;
var issueID = row.cells[0].innerText; //
var url = '@Url.Action("Edit", "LotDisposition", new { issueID = "__id__" })';
window.location.href = url.replace('__id__', issueID);
})*@
var userid = @GlobalVars.GetUserId(Session);
$("#IncludeAllDocuments").on("click", function () {
alert("clicked");
})
$('#OOO').on('click', function () {
$("#OOODialog").modal('show');
return false;
})
$('#OOOExpire').on('click', function () {
//alert('in');
var tab = $('#currentTab').val();
var urlString = '@Url.Action("ExpireOOOStatus", "Home")'; // '/Home/ExpireOOOStatus';
if (confirm('Are you sure you want to expire the OOO status')) {
$.ajax({
type: "Post",
url: urlString,
data: {
tab: tab
},
success: function (result) {
var urlString = '@Url.Action("MyTasks", "Home")'
window.location.href = urlString;
},
error: function (result) {
alert("Failed " + result.responseText);
}
});
}
return false;
})
$('#SaveOOOInfo').on('click', function () {
var tab = $('#currentTab').val();
var bfound = false;
if (userid == $("#DelegateTo").data("kendoDropDownList").value()) {
alert('The OOO person cannot be same as the delegate to person');
return false;
}
var fullDate = new Date()
//convert month to 2 digits
var twoDigitMonth = ((fullDate.getMonth().length + 1) === 1) ? (fullDate.getMonth() + 1) : '0' + (fullDate.getMonth() + 1);
var tempCurrentDate = twoDigitMonth + "/" + fullDate.getDate() + "/" + fullDate.getFullYear();
var arrCurrDate = tempCurrentDate.split('/');
var currentDate = new Date(arrCurrDate[2], arrCurrDate[0] - 1, arrCurrDate[1]);
if (!$("#txtStartDate").val() || !$("#txtEndDate").val()) {
alert('Start or the End Date cannot be blank');
return false;
}
var stDateEntered = $("#txtStartDate").val();
var arrStDate = stDateEntered.split('/');
var stDate = new Date(arrStDate[2], arrStDate[0] - 1, arrStDate[1]);
var endDateEntered = $("#txtEndDate").val();
var arrEndDate = endDateEntered.split('/');
var endDate = new Date(arrEndDate[2], arrEndDate[0] - 1, arrEndDate[1]);
if (stDate < currentDate) {
alert("Start Date should be greater than or equal the Current Date ");
return false;
}
if (endDate <= stDate) {
alert("The End Date should be greater than the Start Date ");
return false;
}
$("#OOODialog").modal('hide');
//var urlString = '/Home/SetOOOStatus';
var urlString = '@Url.Action("SetOOOStatus", "Home")';
$.ajax({
type: "Post",
url: urlString,
data: {
//oooUserID: userids,
delegatedTo: $("#DelegateTo").data("kendoDropDownList").value(),
startDate: $("#txtStartDate").val(),
endDate: $("#txtEndDate").val(),
tab: tab
},
success: function (result) {
if (result == "9") {
alert('The user which you selected for Delegation has already been assigned to another user for Delegation\n Please select a different user for Delgation')
}
else {
//var url = '@Url.Action("Index", "Home", new { tabName = "rep" })';
var url = '@Url.Action("MyTasks", "Home")';
window.location.href = url;
}
},
error: function (result) {
alert("Failed " + result.responseText);
}
});
return false;
});
function deleteRow(element) {
grid = $("#alltasklist").data("kendoGrid");
grid.removeRow($(element).closest("tr"));
}
function showReAssignRole(_pendingApprovers, _closeDate, _issueID, _docType, _submitDate) {
//alert(_closeDate);;
//alert(_pendingApprovers);
if (_pendingApprovers.indexOf(userName) == -1)
{
alert("You are not one of the approvers for this document");
return;
}
if (_submitDate == 'null')
{
alert("Cannot delegate the document as it has not been submitted yet");
return;
}
if (_closeDate != 'null') {
alert("Cannot delegate as the approval loop has already been closed");
return;
}
issueID = _issueID;
docType = _docType;
submitdate = _submitDate;
$('#ReAssignApproverFromLabel').text(userName);
// var searchText = ($("#txtSearch").val());
var url = "/Home/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');
//alert(dataItem.FullName);
}
$('#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;
}
};
//
ReAssignApproval(userids);
}
$("#ReAssignApproval").modal('hide');
return false;
});
var ReAssignApproval = function (userids) {
var urlString = '/Home/DelegateDocumentApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
issueID: issueID,
delegateTo: userids,
ecnTypeString: docType
},
success: function (result) {
var grid = $("#mytasklist").data("kendoGrid");
grid.dataSource.read();
}
});
};
</script>