Mike Phares b586da5c82 Removed PdfViewController, HtmlViewRenderer and FakeView to be replaced with ViewEngineResult Render method
Added HttpException class for missing HttpException for net8

Wrapped HttpContext.Session, GetJsonResult, IsAjaxRequest and GetUserIdentityName in controllers for net8

Added AuthenticationService to test Fab2ApprovalMKLink code for net8

Compile conditionally flags to debug in dotnet core
2025-05-23 12:27:09 -07:00

5226 lines
232 KiB
Plaintext

@model Fab2ApprovalSystem.Models.CorrectiveAction
@{
ViewBag.Title = "Edit";
}
<style>
table {
border-spacing: 5px;
padding: 5px;
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%;
}
#cover-spin {
position: fixed;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
z-index: 9999;
display: none;
}
@@-webkit-keyframes spin {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
@@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#cover-spin::after {
content: '';
display: block;
position: absolute;
left: 48%;
top: 40%;
width: 40px;
height: 40px;
border-style: solid;
border-color: black;
border-top-color: transparent;
border-width: 4px;
border-radius: 50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
#documentControls{
z-index:9998;
}
</style>
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
<link rel="stylesheet" href="~/Content/kendogridcustom.css" />
<body onload="StartTimers();" onmousemove="ResetTimers();" onkeydown="ResetTimers();">
<div id="cover-spin">
</div>
@using (Html.BeginForm())
{
<input type="hidden" id="currentStep" value="@Model.CurrentStep" />
<input type="hidden" id="CANo" value="@Model.CANo" />
<input type="hidden" id="workFlowNumber" value="@Model.WorkFlowNumber" />
<input type="hidden" id="approvalStatus" value="@Model.ApprovalStatus" />
<div id="documentControls">
@if (ViewBag.IsApprover == "true")
{
<div data-spy="affix" data-offset-top="0" data-offset-bottom="500">
<input type="button" value="Approve" class="btn btn-success btn-xs" id="ApproveDocument" />
<input type="button" value="Reject" class="btn btn-warning btn-xs" id="RejectDocument" />
<input type="button" value="Back to CA List" class="btn btn-primary btn-xs" id="CAList" />
<input type="button" value="Save" class="btn btn-primary btn-xs" id="SaveCorrectiveAction" />
<input type="button" value="Section Approval Log" class="btn btn-primary btn-xs" id="ShowSectionApprovalLog" />
</div>
}
else
{
<div>
<div class="panel panel-default center-block" data-spy="affix">
<input type="button" value="Back to CA List" class="btn btn-primary btn-xs" id="CAList" />
<input type="button" value="Save" class="btn btn-primary btn-xs" id="SaveCorrectiveAction" />
<input type="button" value="Section Approval Log" class="btn btn-primary btn-xs" id="ShowSectionApprovalLog" />
</div>
</div>
}
</div>
@Html.AntiForgeryToken()
<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">
Corrective Action
</font>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<h5>Basic Information</h5>
</div>
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA #:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.CANoDisp, new { id = "txtCANo", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Title:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.CATitle, new { id = "txtCATitle", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Requestor:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("RequestorList")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = " font-size:10px" })
.Value(Model.RequestorID.ToString())
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">D0 IssueDate:</label>
</div>
<div class="form-control-static col-sm-9">
@Html.TextBoxFor(model => model.IssueDate, new { id = "txtIssueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*CA Assignee:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("D1AssigneeList")
//.BindTo(new SelectList(ViewBag.UserList, "D1AssigneeID", "D1AssigneeName"))
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = "font-size:10px" })
.Value(Model.D1AssigneeID.ToString())
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*CA Source:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("CASourceList")
.BindTo(new SelectList(ViewBag.CASourceList, "CASourceID", "CASourceName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = "font-size:10px" })
.Value(Model.CASourceID.ToString())
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Departments:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().MultiSelect()
.Name("ModuleIDs")
.BindTo(new SelectList(ViewBag.ModuleList, "ModuleID", "ModuleName"))
.HtmlAttributes(new { style = "font-size:10px" })
.Value(ViewBag.Nothing)
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Status:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.StatusName, new { id = "txtStatusName", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*CA QA:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("D1QAList")
//.BindTo(new SelectList(ViewBag.UserList, "D1QAID", "D1QAName"))
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = "font-size:10px" })
.Value(Model.QAID.ToString())
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*CA Due Date:</label>
</div>
<div class="col-sm-9">
@if (Model.D8DueDate != null)
{
@Html.TextBoxFor(model => model.D8DueDate, new { id = "txtD8DueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
}
else
{
@(Html.Kendo().DatePickerFor(model => model.D8DueDate)
.Name("txtD8DueDate")
)
}
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Tool:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.Tools, new { id = "txtTool", @class = "k-textbox" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Approval Date:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.ApprovedDate, new { id = "txtApprovedDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Related MRB:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.RelatedMRB, new { id = "txtRelatedMRB", @class = "k-textbox" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Related Audit#:</label>
</div>
<div class="col-sm-9">
<a href='/Audit/Edit?IssueID=@Model.RelatedAudit'>@Functions.ReturnAuditNoStringFormat(@Model.RelatedAudit) </a>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA Type:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("CATypeList")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "Upto D0",
Value = "D0"
},
new SelectListItem()
{
Text = "Upto D3",
Value = "D3"
},
new SelectListItem()
{
Text = "Upto D6",
Value = "D6"
}
,
new SelectListItem()
{
Text = "Upto D8",
Value = "D8"
}
}
)
.Value(Model.CAType)
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA Standard Type:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("CAStandardTypeList")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "IATF16949",
Value = "IATF16949"
},
new SelectListItem()
{
Text = "ISO14001",
Value = "ISO14001"
},
new SelectListItem()
{
Text = "ISO45001",
Value = "ISO45001"
}
}
)
.OptionLabel("Select")
.Value(Model.CAStandardType)
)
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Related Audit Findings:</label>
</div>
<div class="col-sm-9">
@Html.TextArea("txtRelatedAuditFindings", (string)(ViewBag.AuditFinding), new { @class = "form-control", name = "txtRelatedAuditFindings", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Related Audit Finding Categories:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().MultiSelect()
.Name("RelatedAuditFindingsCategories")
.BindTo(new SelectList(ViewBag.AuditFindingCategoriesOptions, "AuditFindingCategoryID", "AuditFindingCategoryName"))
.HtmlAttributes(new { style = " font-size:10px", Readonly = "Readonly" })
.Value(ViewBag.AuditFindingCategories)
)
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Related Audit Violated Clause:</label>
</div>
<div class="col-sm-9">
@Html.TextBox("txtRelatedViolatedClause", (string)(ViewBag.ViolatedClause), new { @class = "form-control", name = "txtRelatedAuditFindings", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA Ready:</label>
</div>
<div class="col-sm-9">
@Html.EditorFor(model => model.CASubmitted)
</div>
</div>
</div>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-group">
<label class="control-label">Affected Documents:</label>
<div class="col-sm-12">
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("AttachSave", "CorrectiveAction", new { caNo = Model.CANo })
.AutoUpload(true)
)
.ShowFileList(false)
.Events(events => events
.Success("onFileUploadSuccess")
.Upload("CheckFileType")
.Error("onFileUploadError")
)
)
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CA_Attachment>()
.Name("Attachments")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CANo).Visible(false);
columns.Bound(a => a.FileGUID).Visible(false);
columns.Bound(a => a.FileName);
columns.Bound(a => a.UploadedByName);
columns.Bound(a => a.UploadDateTime).Format("{0:MM/dd/yy hh:mm:ss}");
columns.Command(command => command.Custom("View").Click("DownloadCAAttachment"));
columns.Command(command => command.Custom("Delete").Click("DeleteCAAttachment"));
})
.Scrollable()
.Sortable()
.HtmlAttributes(new { style = "height:300px; width:100%; font-size: 10px", Readonly = "Readonly" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.ID);
})
.PageSize(50)
.Read(read => read.Action("Attachment_Read", "CorrectiveAction", new { caNO = Model.CANo }))
.Destroy(destroy => destroy.Action("DeleteCAAttachment", "CorrectionAction"))
)
)
</div>
</div>
</div>
</div>
<div id="D0ScrollPoint"></div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D0 - Pipeline Analysis
</font>
</h5>
</td>
<td>
<ul>
<li>Pipeline analysis (where is the suspect product?)</li>
<li>Provide Emergency Response Actions.</li>
<li>Evaluate the processing data for applicable lots.</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD2" role="button" data-toggle="collapse" href="#collapseSectionD0" aria-expanded="true" aria-controls="collapseSectionD0">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD0">
<div class="panel-body bg-warning" style="font-size: 14px">
<label class="control-label ">D0 Completed:</label>
@Html.EditorFor(model => model.D0Completed)
<label class="control-label ">D0 Approved:</label>
@Html.EditorFor(model => model.D0Approved)
@if (ViewBag.IsSectionApprover == true && Model.D0Completed == true && Model.D0Approved != true)
{
<input type="button" class="btn" value="Approve" id="ApproveD0" />
<input type="button" class="btn" value="Reject" id="RejectD0" />
}
</div>
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-6">
<font style="color: black; font-size:11px;font-weight: bolder">
*D0-Comments
</font>
@Html.TextAreaFor(model => model.D0Comments, 20, 30, new { id = "d0Comments", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D1 - Establish the Team
</font>
</h5>
</td>
<td>
<ul>
<li>Identify Team members.</li>
<li>Identify Team Captain.</li>
<li>Identify Team Sponsor.</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD2" role="button" data-toggle="collapse" href="#collapseSectionD1" aria-expanded="true" aria-controls="collapseSectionD1">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD1">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*CA Team Members:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().MultiSelect()
.Name("TeamMemberIDs")
//.BindTo(new SelectList(ViewBag.UserList, "TeamMemberID", "TeamMemberName"))
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.Value(ViewBag.Nothing)
)
</div>
<div class="col-sm-3">
<label class="control-label pull-right">*CA Team Captain:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("TeamCaptainList")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = " font-size:10px" })
.Value(Model.TeamCaptainID.ToString())
)
</div>
<div class="col-sm-3">
<label class="control-label pull-right">*CA Sponsor:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("CASponsorList")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.OptionLabel("Select")
.HtmlAttributes(new { style = " font-size:10px" })
.Value(Model.CASponsorID.ToString())
)
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D2 - Describe the Problem
</font>
</h5>
</td>
<td>
<ul>
<li>Analyze existing data.</li>
<li>Report lot codes and date codes.</li>
<li>Identify "What is wrong with what".</li>
<li>Prepare Problem Description.</li>
<li>Develop "Is/Is Not" worksheet (1 of 4).</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD2" role="button" data-toggle="collapse" href="#collapseSectionD2" aria-expanded="true" aria-controls="collapseSectionD2">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD2">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Customer Name:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.CustomerName, new { id = "txtCustomerName", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Customer Part#:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.CustomerPartNo, new { id = "txtCustomerPartNo", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">IFX Part#:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.IFXPartNo, new { id = "txtIFXPartNo", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Part Qty:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.PartQty, new { id = "txtPartQty", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Invoice #:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.InvoiceNo, new { id = "txtInvoiceNo", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Purchase Order #:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.PurchaseOrderNo, new { id = "txtPurchaseOrderNo", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Sales Order #:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.SalesOrderNo, new { id = "txtSalesOrderNo", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Dollar Impact:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.DollarImpact, new { id = "txtDollarImpact", @class = "k-textbox", style = "width:100%" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Background Info:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.BackgroundInfo, 20, 30, new { id = "txtBackgroundInfo", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Analysis:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.Analysis, 20, 30, new { id = "txtAnalysis", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Visual Verification:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.VisualVerification, 20, 30, new { id = "txtVisualVerification", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="D3ScrollPoint"></div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D3 - Develop Interim Containment Actions (ICAs)
</font>
</h5>
</td>
<td>
<ul>
<li>Check Team Composition.</li>
<li>Description of containment action.</li>
<li>Verify ICAs prior to implementation.</li>
<li>Implement ICA activities or quantify the risk to the customer.</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD3" role="button" data-toggle="collapse" href="#collapseSectionD3" aria-expanded="true" aria-controls="collapseSectionD3">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD3">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-2" style="font-size: 14px">
<label class="control-label ">D3 Completed:</label>
@Html.EditorFor(model => model.D3Completed)
<label class="control-label ">D3 Approved:</label>
@Html.EditorFor(model => model.D3Approved)
@if (ViewBag.IsSectionApprover == true && Model.D3Completed == true && Model.D3Approved != true)
{
<input type="button" class="btn" value="Approve" id="ApproveD3" />
<input type="button" class="btn" value="Reject" id="RejectD3" />
}
</div>
<div class="col-sm-3" style="font-size: 14px">
<label class="control-label ">D3 Due Date:</label>
@*@Html.EditorFor(model => model.D3DueDate, new { id = "txtD3DueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })*@
@Html.TextBoxFor(model => model.D3DueDate, new { id = "txtD3DueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
<div class="col-sm-6 pull-right">
@Html.ActionLink("Link to blank forms (FTA, Fish Bone 5Whys, Is/Is Not)", "DownloadTemplatesFiles")
</div>
</div>
<div class="row">
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*Interim Containment Action:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.InterimContainmentAction, 20, 30, new { id = "txtInterimContainmentAction", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*ICA Verification Results:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.ICAVerificationResults, 20, 30, new { id = "txtICAVerificationResults", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">*ICA Validation Activities:</label>
</div>
<div class="col-sm-9">
@Html.TextAreaFor(model => model.ICAValidationActivities, 20, 30, new { id = "txtICAValidationActivities", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="D4ScrollPoint"></div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D4 - Define and Verify Root Cause and Escape Point.
</font>
</h5>
</td>
<td>
<ul>
<li>Check Team Composition.</li>
<li>Perform Comparative Analysis (2 of 4).</li>
<li>Develop root cause theories (3 of 4).</li>
<li>Evaluate each potential root cause against the Problem Description (4 of 4).</li>
<li>Identify the "Escape Point" where the effect of the root cause could have been detected.</li>
<li>Report on DOEs, flow charts, fishbone diagrams.</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD4" role="button" data-toggle="collapse" href="#collapseSectionD4" aria-expanded="false" aria-controls="collapseSectionD4">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD4">
<div class="panel-body bg-warning">
@*<div class="row">*@
<div class="col-sm-6 pull-left">
<label class="control-label ">D4 Completed:</label>
@Html.EditorFor(model => model.D4Completed)
<label class="control-label ">D4 Approved:</label>
@Html.EditorFor(model => model.D4Approved)
@if (ViewBag.IsSectionApprover == true && Model.D4Completed == true && Model.D4Approved != true)
{
<input type="button" class="btn" value="Approve" id="ApproveD4" />
<input type="button" class="btn" value="Reject" id="RejectD4" />
}
</div>
<div class="panel-body bg-warning" style="font-size: 14px">
</div>
<div class="col-sm-6 pull-right">
@Html.ActionLink("Link to blank forms (FTA, Fish Bone 5Whys, Is/Is Not)", "DownloadTemplatesFiles")
</div>
@*</div>*@
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-12">
<font style="color: crimson;">
Enter in at least one root cause.
</font>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">Root Cause 1:</label>
@Html.TextAreaFor(model => model.D4RootCause1, 5, 30, new { id = "txtD4RootCause1", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">Root Cause 2:</label>
@Html.TextAreaFor(model => model.D4RootCause2, 5, 30, new { id = "txtD4RootCause2", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">Root Cause 3:</label>
@Html.TextAreaFor(model => model.D4RootCause3, 5, 30, new { id = "txtD4RootCause3", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">Root Cause4:</label>
@Html.TextAreaFor(model => model.D4RootCause4, 5, 30, new { id = "txtD4RootCause4", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
<div class="col-sm-6" style="font-size: 10px">
<div class="row">
<div class="col-sm-12">
@(Html.Kendo().Upload()
.Name("D4Files")
.Async(a => a
.Save("D4FilesAttachSave", "CorrectiveAction", new { caNo = Model.CANo })
.AutoUpload(true)
)
.ShowFileList(false)
.Events(events => events
.Success("onD4FileUploadSuccess")
.Upload("CheckFileType")
)
)
</div>
</div>
<div class="row">
<div class="col-sm-12">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CA_Attachment>()
.Name("D4Attachments")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CANo).Visible(false);
columns.Bound(a => a.FileGUID).Visible(false);
columns.Bound(a => a.FileName);
columns.Bound(a => a.UploadedByName);
columns.Bound(a => a.UploadDateTime).Format("{0:MM/dd/yy hh:mm:ss}");
columns.Command(command => command.Custom("View").Click("DownloadCAAttachment"));
columns.Command(command => command.Custom("Delete").Click("DeleteD4CAAttachment"));
})
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:300px; width:100%; font-size: 10px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.ID);
})
.PageSize(50)
.Read(read => read.Action("GetD4AttachmentList", "CorrectiveAction", new { caNO = Model.CANo }))
)
)
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">*Root Cause Verification:</label>
@Html.TextAreaFor(model => model.RootCauseVerification, 5, 30, new { id = "txtRootCauseVerification", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
<div class="row">
<div class="col-sm-12">
<label class="control-label pull-left">*Escape Point:</label>
@Html.TextAreaFor(model => model.EscapePoint, 5, 30, new { id = "txtEscapePoint", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="D5ScrollPoint"></div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
Corrective/Preventitive Action D5/D6/D7
</font>
</h5>
</td>
<td>
<h5>
D5
</h5>
<ul>
<li>Check Team Composition.</li>
<li>Select best PCAs for removal of root causes.</li>
<li>Select best PCAs for elimination of escape points.</li>
<li>Verify that all actions will be successful without causing undesirable effects.</li>
<li>Provide necessary process change notification for applicable changes.</li>
<li>Provide assessment of risk to the customer.</li>
</ul>
</td>
<td>
<h5>
D6
</h5>
<ul>
<li>Implement PCAs identified in D5.</li>
<li>Perform Comparative Analysis (2 of 4).</li>
<li>Remove applicable ICAs.</li>
<li>Validate the PCAs and monitor long-term effects.</li>
</ul>
</td>
<td>
<h5>
D7
</h5>
<ul>
<li>Address the cause of the cause (systems changes).</li>
<li>Modify necessary systems to prevent recurrence.</li>
<li>Review the impact on FMEA.</li>
<li>Review Impact on Process Control Plan.</li>
</ul>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD5D6" role="button" data-toggle="collapse" href="#collapseSectionD5D6" aria-expanded="true" aria-controls="collapseSectionD5D6">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD5D6">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-4" style="font-size: 14px">
<label class="control-label ">D5/D6/D7 Completed:</label>
@Html.EditorFor(model => model.D5Completed)
<label class="control-label ">D5/D6/D7 Approved:</label>
@Html.EditorFor(model => model.D5Approved)
<label class="control-label ">D5/D6/D7 Validated:</label>
@Html.EditorFor(model => model.D6Validated)
@if (ViewBag.IsSectionApprover == true && Model.D5Completed == true && Model.D5Approved != true)
{
<input type="button" class="btn" value="Approve" id="ApproveD5D6D7" />
<input type="button" class="btn" value="Reject" id="RejectD5D6D7" />
}
</div>
<div class="col-sm-3" style="font-size: 14px">
<label class="control-label ">D5/D6/D7 Due Date:</label>
@*@Html.EditorFor(model => model.D3DueDate, new { id = "txtD3DueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })*@
@Html.TextBoxFor(model => model.D5D7DueDate, new { id = "txtD5D7DueDate", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
@*<table>
<tr>
<td>
<label class="control-label ">D5/D6/D7 Completed:</label>
@Html.EditorFor(model => model.D5Completed)
</td>
<td>
<label class="control-label ">D5/D6/D7 Approved:</label>
@Html.EditorFor(model => model.D5Approved)
</td>
<td>
<label class="control-label ">D5/D6/D7 Validated:</label>
@Html.EditorFor(model => model.D6Validated)
</td>
@if (ViewBag.IsSectionApprover == true && Model.D5Completed == true && Model.D5Approved != true)
{
<td><input type="button" class="btn" value="Approve" id="ApproveD5D6D7" /></td>
<td><input type="button" class="btn" value="Reject" id="RejectD5D6D7" /></td>
}
</tr>
</table>*@
</div>
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-12">
<font style="color: crimson;">
Enter in at least corrective/preventitive action item.
</font>
</div>
</div>
<div>
@if (!Model.D5Completed)
{
<input type="button" id="AddD5D6CorrectiveActionItem" value="Add D5-D6-D7 Corrective/Preventitive Action Item" class="btn btn-primary btn-xs" />
}
</div>
@if (!Model.D5Completed)
{
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.D5D6CorrectivetAction>()
.Name("D5D6CorrectivetActions")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CurrentResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ImprovementID).Visible(false);
columns.Bound(a => a.CorrectiveAction).Width("500px");
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
columns.Bound(a => a.CARequired).Width("50px").Title("Choose").Visible(false);
columns.Bound(a => a.ActionType).Width("50px").Title("Action Type");
columns.Bound(a => a.Result).Width("100px");
columns.Bound(a => a.ECNLinks).ClientTemplate("#=buildECNLinks(ECNLinks)#").Width("100px");
columns.Bound(a => a.AttachmentLinks).ClientTemplate("#=buildLinks(AttachmentLinks, CANo)#").Width("100px");
columns.Bound(a => a.ResponsibilityOwnerName).Width("100px");
columns.Bound(a => a.ECD).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.ImplementedDate).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.Improvement).Width("150px").Format("{0:MM/dd/yy hh:mm:ss}");
//columns.Command(c => c.Custom("Add-Remove File").Click("UploadD5D6CAAttachment")).Width("150px");
columns.Command(c => c.Custom("Edit").Click("EditD5D6CorrectivetActionItem")).Width("70px");
columns.Command(c => c.Custom("Delete").Click("DeletetD5D6CorrectivetActionItem")).Width("70px");
})
//.ToolBar(toolbar => toolbar.Create().Text("Add Item"))
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:125; width:100%; font-size: 11px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(a => a.CANo).DefaultValue(Model.CANo);
})
.PageSize(50)
.Read(read => read.Action("GetD5D6CorrectivetActionList", "CorrectiveAction", new { caNo = Model.CANo }))
)
)
}
else if (Model.D5Completed && !Model.D5Approved)
{
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.D5D6CorrectivetAction>()
.Name("D5D6CorrectivetActions")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CurrentResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ImprovementID).Visible(false);
columns.Bound(a => a.CorrectiveAction).Width("500px");
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
columns.Bound(a => a.CARequired).Width("50px").Title("Choose").Visible(false);
columns.Bound(a => a.ActionType).Width("50px").Title("Action Type");
columns.Bound(a => a.Result).Width("100px");
columns.Bound(a => a.ECNLinks).ClientTemplate("#=buildECNLinks(ECNLinks)#").Width("100px");
columns.Bound(a => a.AttachmentLinks).ClientTemplate("#=buildLinks(AttachmentLinks, CANo)#").Width("100px");
columns.Bound(a => a.ResponsibilityOwnerName).Width("100px");
columns.Bound(a => a.ECD).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.ImplementedDate).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.Improvement).Width("150px").Format("{0:MM/dd/yy hh:mm:ss}");
//columns.Command(c => c.Custom("Add-Remove File").Click("UploadD5D6CAAttachment")).Width("150px");
//columns.Command(c => c.Custom("Edit").Click("EditD5D6CorrectivetActionItem")).Width("70px");
//columns.Command(c => c.Custom("Delete").Click("DeletetD5D6CorrectivetActionItem")).Width("70px");
})
//.ToolBar(toolbar => toolbar.Create().Text("Add Item"))
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:125; width:100%; font-size: 11px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(a => a.CANo).DefaultValue(Model.CANo);
})
.PageSize(50)
.Read(read => read.Action("GetD5D6CorrectivetActionList", "CorrectiveAction", new { caNo = Model.CANo }))
)
)
}
else if (Model.D5Completed && Model.D5Approved && !Model.D6Validated)
{
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.D5D6CorrectivetAction>()
.Name("D5D6CorrectivetActions")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CurrentResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ImprovementID).Visible(false);
columns.Bound(a => a.CorrectiveAction).Width("500px");
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
columns.Bound(a => a.CARequired).Width("50px").Title("Choose").Visible(false);
columns.Bound(a => a.ActionType).Width("50px").Title("Action Type");
columns.Bound(a => a.Result).Width("100px");
columns.Bound(a => a.ECNLinks).ClientTemplate("#=buildECNLinks(ECNLinks)#").Width("100px");
columns.Bound(a => a.AttachmentLinks).ClientTemplate("#=buildLinks(AttachmentLinks, CANo)#").Width("100px");
columns.Bound(a => a.ResponsibilityOwnerName).Width("100px");
columns.Bound(a => a.ECD).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.ImplementedDate).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.Improvement).Width("150px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Command(c => c.Custom("Edit").Click("EditD5D6CorrectivetActionItem")).Width("70px");
})
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:125; width:100%; font-size: 11px" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(a => a.CANo).DefaultValue(Model.CANo);
})
.PageSize(50)
.Read(read => read.Action("GetD5D6CorrectivetActionList", "CorrectiveAction", new { caNo = Model.CANo }))
)
)
}
else if (Model.D6Validated)
{
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.D5D6CorrectivetAction>()
.Name("D5D6CorrectivetActions")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.CurrentResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ResponsibilityOwnerID).Visible(false);
columns.Bound(a => a.ImprovementID).Visible(false);
columns.Bound(a => a.CorrectiveAction).Width("500px");
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
columns.Bound(a => a.CARequired).Width("50px").Title("Choose").Visible(false);
columns.Bound(a => a.ActionType).Width("50px").Title("Action Type");
columns.Bound(a => a.Result).Width("100px");
columns.Bound(a => a.ECNLinks).ClientTemplate("#=buildECNLinks(ECNLinks)#").Width("100px");
columns.Bound(a => a.AttachmentLinks).ClientTemplate("#=buildLinks(AttachmentLinks, CANo)#").Width("100px");
columns.Bound(a => a.ResponsibilityOwnerName).Width("100px");
columns.Bound(a => a.ECD).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.ImplementedDate).Width("100px").Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.Improvement).Width("150px").Format("{0:MM/dd/yy hh:mm:ss}");
})
.Resizable(resize => resize.Columns(true))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:125; width:100%; font-size: 11px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(a => a.CANo).DefaultValue(Model.CANo);
})
.PageSize(50)
.Read(read => read.Action("GetD5D6CorrectivetActionList", "CorrectiveAction", new { caNo = Model.CANo }))
)
)
}
</div>
</div>
</div>
<div id="D8ScrollPoint"></div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<table style="margin-top:20px">
<tr>
<td>
<h5>
<font style="color: crimson; font-weight: bold">
D8 - Congratulate the team.
</font>
</h5>
</td>
</tr>
</table>
<a class="btn btn-xs pull-right alert-info" id="SectionD8" role="button" data-toggle="collapse" href="#collapseSectionD8" aria-expanded="true" aria-controls="collapseSectionD8">
Show/Hide
</a>
</div>
<div class="collapse" id="collapseSectionD8">
<div class="panel-body bg-warning">
<label class="control-label ">D8 Completed:</label>
@Html.EditorFor(model => model.D8Completed)
<label class="control-label ">D8 Approved:</label>
@Html.EditorFor(model => model.D8Approved)
@if (ViewBag.IsSectionApprover == true && Model.D8Completed == true && Model.D8Approved != true)
{
<input type="button" class="btn" value="Approve" id="ApproveD8" />
<input type="button" class="btn" value="Reject" id="RejectD8" />
}
</div>
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-6 text-left">
<font style="color: black; font-size:12px;font-weight: bolder">
How we recognized the team:
</font>
@Html.TextAreaFor(model => model.D8TeamRecognition, 3, 100, new { id = "txtD8TeamRecognition", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
<div class="col-sm-6">
<font style="color: black; font-size:12px;font-weight: bolder">
*Lessons Learned:
</font>
@Html.TextAreaFor(model => model.D8LessonsLearned, 3, 100, new { id = "txtD8LessonsLearned", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-danger">
<h5>
<font style="color: crimson; font-weight: bold">
Follow Up
</font>
<a class="btn btn-xs pull-right alert-info" id="FollowUpSection" role="button" data-toggle="collapse" href="#collapseSectionFollowUp" aria-expanded="true" aria-controls="collapseSectionFollowUp">
Show/Hide
</a>
</h5>
</div>
<div class="collapse" id="collapseSectionFollowUp">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-6 text-left">
<font style="color: black; font-size:12px;font-weight: bolder">
Follow Up Due Date
</font>
@(Html.Kendo().DatePickerFor(model => model.FollowUpDate)
.Name("txtFollowUpDate")
.Format("yyyy-MM-dd")
)
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
@if (true)
{
<div class="panel-heading">
@if (ViewBag.IsApprover == "true")
{
<button class="k-textbox" data-toggle="modal" id="reAssignApprovers">
Re-Assign Approvers
</button>
<button class="k-textbox" data-toggle="modal" id="additionalApprovers">
Additional Approvers
</button>
}
else if (((GlobalVars.IsAdmin(Session) && (Request.IsAuthenticated))) && Model.ClosedDate == null)
{
<button class="k-textbox" data-toggle="modal" id="additionalApprovers">
Additional Approvers
</button>
}
</div>
<div class="panel-body bg-warning">
<div class="col-sm-offset-0">
@if (GlobalVars.IsAdmin(Session) && (Request.IsAuthenticated))
{
@(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);
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()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ApprovalID);
})
.PageSize(20)
.Read(read => read.Action("GetApproversList", "CorrectiveAction", new { issueID = Model.CANo, step = Model.CurrentStep }))
)
.Resizable(resize => resize.Columns(true))
)
}
else
{
@(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);
//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()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ApprovalID);
})
.PageSize(20)
.Read(read => read.Action("GetApproversList", "CorrectiveAction", new { issueID = Model.CANo, step = Model.CurrentStep }))
)
.Resizable(resize => resize.Columns(true))
)
}
</div>
</div>
}
</div>
}
<div class="modal fade" id="D3ContainmentActionForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Edit Containment Action:</h4>
</div>
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
<table>
<tr>
<td width="25%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="100%" colspan="2">
<label for="txtECN">Enter ECN#:</label>
</td>
</tr>
<tr>
<td>
@Html.TextBox("txtECN", null, new { @class = "k-textbox", style = "width:100%" })
</td>
<td>
<input type="button" id='AddECN' value="Add ECN" />
</td>
</tr>
<tr>
<td colspan="2">
<select multiple id="lstECNs" style="height: 250px; width: 100%; font-family: Tahoma; border-color: lightgrey"></select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" id='RemoveECN' value="Remove ECN" />
</td>
</tr>
</table>
</td>
<td width="75%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="25%">
<label for="txtContainmentAction">Containment Action:</label>
</td>
<td width="75%">
@Html.TextArea("txtContainmentAction", null, 5, 6, new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="25%">
<label for="txtResult">Result:</label>
</td>
<td width="75%">
@Html.TextBox("txtResult", null, new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="25%">
<label for="ResponsibilityOwner">Responsibility Owner:</label>
</td>
<td width="75%">
@(Html.Kendo().DropDownList()
.Name("ResponsibilityOwnerIds")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.Value(ViewBag.Nothing)
.OptionLabel("Select")
)
</td>
</tr>
<tr>
<td width="25%">
<label for="txtECD">ECD:</label>
</td>
<td width="75%">
@(Html.Kendo().DatePicker()
.Name("txtECD")
)
</td>
</tr>
<tr>
<td width="25%">
<label for="txtImplementedDate">Implemented Date:</label>
</td>
<td width="75%">
@(Html.Kendo().DatePicker()
.Name("txtImplementedDate")
)
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveD3ContainmentAction">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="D5D6CorrectiveActionForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 800px">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Edit Corrective Action:</h4>
</div>
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
<table width="100%">
<tr>
<td width="20%">
<input type="hidden" value="" id="hiddenItemNumber" />
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="100%" colspan="2">
@if (Model.D5Approved)
{
<label for="txtD5D6ECN">*Enter ECN#:</label>
}
else
{
<label for="txtD5D6ECN">Enter ECN#:</label>
}
</td>
</tr>
<tr>
<td colspan="2">
@(Html.Kendo().MultiSelect()
.Name("lstD5D6ECNs")
//.BindTo(new SelectList(ViewBag.UserList, "TeamMemberID", "TeamMemberName"))
.BindTo(new SelectList(ViewBag.ECNList, "IssueID", "IssueID"))
.Value(ViewBag.Nothing)
)
</td>
</tr>
<tr>
<td colspan="2">
<button type="button" class="btn btn-default" id="uploadAIAttachments">Attachments</button>
</td>
</tr>
</table>
</td>
<td width="80%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="40%" class="pull-right">
<label for="txtD5D6CorrectiveAction">*Corrective Action:</label>
</td>
<td width="60%">
@Html.TextArea("txtD5D6CorrectiveAction", "", 5, 20, new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
@if (Model.D5Approved)
{
<label for="txtD5D6Result">*Result:</label>
}
else
{
<label for="txtD5D6Result">Result:</label>
}
</td>
<td>
@*@Html.TextBox("txtD5D6Result", null, new { @class = "k-textbox", style = "width:100%" })*@
@Html.TextArea("txtD5D6Result", "", 10, 40 , new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="ResponsibilityOwner">*Responsibility Owner:</label>
</td>
<td width="60%">
@(Html.Kendo().DropDownList()
.Name("D5D6ResponsibilityOwnerIds")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.Value(ViewBag.Nothing)
.OptionLabel("Select")
)
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtD5D6ECD">*ECD:</label>
</td>
<td width="60%">
@(Html.Kendo().DatePicker()
.Name("txtD5D6ECD")
)
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
@if (Model.D5Approved)
{
<label for="txtD5D6ImplementedDate">*Implemented Date:</label>
}
else
{
<label for="txtD5D6ImplementedDate">Implemented Date:</label>
}
</td>
<td width="60%">
@(Html.Kendo().DatePicker()
.Name("txtD5D6ImplementedDate")
)
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtChoose">*Action Type:</label>
</td>
<td width="60%">
@(Html.Kendo().DropDownList()
.Name("txtActionType")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "Corrective",
Value = "Corrective"
},
new SelectListItem()
{
Text = "Preventitive",
Value = "Preventitive"
}
}
)
.Value("0")
)
</td>
</tr>
<tr>
<td>
<input type="hidden" id="CARequired" value="1" />
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtImprovement">*Improvement Category:</label>
</td>
<td width="60%">
@(Html.Kendo().MultiSelect()
.Name("D5D6ImprovementIDs")
.BindTo(new SelectList(ViewBag.D5D6ImprovementIDs, "D5D6ImprovementID", "D5D6ImprovementName"))
.Value(ViewBag.Nothing)
.HtmlAttributes(new { style = "font-size:12px" })
)
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveD5D6CorrectivetAction">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AddD5D6AttachmentForm" data-url='@Url.Action("GetD5D6CAItem")' tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Upload Attachments D5-D6 CA:</h4>
</div>
<div class="modal-body" id="D5D6AttachmentContainer" style="background-color: #75adc6; font-size: 12px;">
@Html.Partial("_D5D6CAAttachment", Model.D5D6CorrectivetAction)
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="SectionApprovalLog" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Section Approval Log:</h4>
</div>
<div class="modal-body" id="SectionApprovalLogContainer" style="background-color: #75adc6; font-size: 12px;">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CASectionApproval>()
.Name("SectionApprovalList")
.Columns(columns =>
{
columns.Bound(a => a.Fullname);
columns.Bound(a => a.DSection);
columns.Bound(a => a.ApprovalStatus);
columns.Bound(a => a.DateAssigned).Format("{0:MM/dd/yy hh:mm:ss}"); ;
columns.Bound(a => a.DateCompleted).Format("{0:MM/dd/yy hh:mm:ss}"); ;
columns.Bound(a => a.Comments);
})
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "width:100%; font-size: 10px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
//.Model(model =>
//{
// model.Id(p => p.);
//})
.PageSize(300)
.Read(read => read.Action("GetSectionApprovalLog", "CorrectiveAction", new { caNo = Model.CANo }))
)
.Resizable(resize => resize.Columns(true))
)
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="D7PreventiveActionForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 800px">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Edit Preventive Action:</h4>
</div>
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
<table width="100%">
<tr>
<td width="20%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="100%" colspan="2">
<label for="txtD7ECN">Enter ECN#:</label>
</td>
</tr>
<tr>
<td>
@Html.TextBox("txtD7ECN", null, new { @class = "k-textbox", style = "width:100%" })
</td>
<td>
<input width:100%" type="button" id='D7AddECN' value="Add ECN" />
</td>
</tr>
<tr>
<td colspan="2">
<select multiple id="lstD7ECNs" style="height: 250px; width: 100%; font-family: Tahoma; border-color: lightgrey"></select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" id='D7RemoveECN' value="Remove ECN" />
</td>
</tr>
</table>
</td>
<td width="80%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="40%" class="pull-right">
<label for="txtPreventiveAction">Preventive Action:</label>
</td>
<td width="60%">
@Html.TextArea("txtPreventiveAction", "", 5, 20, new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtD7Result">Result:</label>
</td>
<td>
@Html.TextBox("txtD7Result", null, new { @class = "k-textbox", style = "width:100%" })
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="ResponsibilityOwner">Responsibility Owner:</label>
</td>
<td width="60%">
@(Html.Kendo().DropDownList()
.Name("D7ResponsibilityOwnerIds")
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
.Value(ViewBag.Nothing)
.OptionLabel("Select")
)
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtD5D6ECD">ECD:</label>
</td>
<td width="60%">
@(Html.Kendo().DatePicker()
.Name("txtD7ECD")
)
</td>
</tr>
<tr>
<td width="40%" class="pull-right">
<label for="txtD7ImplementedDate">Implemented Date:</label>
</td>
<td width="60%">
@(Html.Kendo().DatePicker()
.Name("txtD7ImplementedDate")
)
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveD7PreventiveAction">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AddD7AttachmentForm" data-url='@Url.Action("GetD7PAItem")' tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Upload Attachments D7 PA:</h4>
</div>
<div class="modal-body" id="D7AttachmentContainer" style="background-color: #75adc6; font-size: 12px;">
@Html.Partial("_D7PAAttachment", Model.D7PreventiveAction)
</div>
<div class="modal-footer" style="background-color: #e4daa1; font-size: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<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">&times;</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">&times;</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>
<div class="modal fade" id="SectionRejectComments" 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">Enter Section Rejection Comments:</h4>
</div>
<div class="modal-body">
<textarea class="form-control" rows="3" id="sectionRejectComments"></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="submitSectionComments">Confirm Rejection</button>
</div>
</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">&times;</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>
<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">&times;</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="additionalApproval">Confirm Additional Approver</button>
</div>
</div>
</div>
</div>
</body>
@if (ViewBag.IsSectionApprover == true && Model.D0Completed == true && Model.D0Approved != true)
{
<script>
document.getElementById("D0ScrollPoint").scrollIntoView();
</script>
}
@if (ViewBag.IsSectionApprover == true && Model.D3Completed == true && Model.D3Approved != true)
{
<script>
document.getElementById("D3ScrollPoint").scrollIntoView();
</script>
}
@if (ViewBag.IsSectionApprover == true && Model.D4Completed == true && Model.D4Approved != true)
{
<script>
document.getElementById("D4ScrollPoint").scrollIntoView();
</script>
}
@if ((ViewBag.IsSectionApprover == true && Model.D5Completed == true && Model.D5Approved != true) || (ViewBag.IsAIAssignee == true && Model.D5Approved == true))
{
<script>
document.getElementById("D5ScrollPoint").scrollIntoView();
</script>
}
@if (ViewBag.IsSectionApprover == true && Model.D8Completed == true && Model.D8Approved != true)
{
<script>
document.getElementById("D8ScrollPoint").scrollIntoView();
</script>
}
<script type="text/javascript">
var d3ContainmentActionOperation;
var d5CorrectiveActionOperation;
var d7PrevetativeActionOperation;
var d3ContainmenActionID;
var d5CorrectiveActionID;
var d7PreventiveActionID;
var triggerApproval = false;
var triggerApprovalSection = false;
var sectionApproval = false;
var currentResponsibilityOwnerID = '';
var currentD5D6AttachmentLinks;
var currentD7AttachmentLinks;
var currentRejectingSection = '';
var currentUserId = @(GlobalVars.GetUserId(Session))
var currentRequestor = @(Model.RequestorID);
$("div.k-multiselect-wrap input.k-input").attr("autocomplete", "off");
$(document).ready(function(){
ShowSectionsOnLoad();
if ($('#CASubmitted').is(':checked')) {
$('#CASubmitted').attr("disabled", true);
}
if ($('#D0Completed').is(':checked')) {
$('#D0Completed').attr("disabled", true);
$('#txtCATitle').attr("disabled", true);
$("#RequestorList").data("kendoDropDownList").enable(false);
//$('#ModuleIDs').attr("disabled", true);
$('#CASourceList').attr("disabled", true);
$('#D1AssigneeList').data("kendoDropDownList").enable(false);
$('#D1QAList').data("kendoDropDownList").enable(false);
$('#CASourceList').data("kendoDropDownList").enable(false);
$('#ModuleIDs').data("kendoMultiSelect").enable(false);
$('#txtD8DueDate').attr("disabled", true);
$('#txtTool').attr("disabled", true);
$('#txtApprovedDate').attr("disabled", true);
$('#txtRelatedMRB').attr("disabled", true);
$('#CATypeList').data("kendoDropDownList").enable(false);
$('#CAStandardTypeList').data("kendoDropDownList").enable(false);
$('#d0Comments').attr("disabled", true);
}
//if ($('#D0Approved').is(':checked'))
$('#D0Approved').attr("disabled", true);
if ($('#D3Completed').is(':checked')) {
$('#D3Completed').attr("disabled", true);
$('#TeamMemberIDs').data("kendoMultiSelect").enable(false);
$('#TeamCaptainList').data("kendoDropDownList").enable(false);
$('#CASponsorList').data("kendoDropDownList").enable(false);
$('#txtCustomerName').attr("disabled", true);
$('#txtCustomerPartNo').attr("disabled", true);
$('#txtIFXPartNo').attr("disabled", true);
$('#txtPartQty').attr("disabled", true);
$('#txtInvoiceNo').attr("disabled", true);
$('#txtPurchaseOrderNo').attr("disabled", true);
$('#txtSalesOrderNo').attr("disabled", true);
$('#txtDollarImpact').attr("disabled", true);
$('#txtBackgroundInfo').attr("disabled", true);
$('#txtAnalysis').attr("disabled", true);
$('#txtVisualVerification').attr("disabled", true);
$('#txtInterimContainmentAction').attr("disabled", true);
$('#txtICAVerificationResults').attr("disabled", true);
$('#txtICAValidationActivities').attr("disabled", true);
}
//if ($('#D3Approved').is(':checked'))
$('#D3Approved').attr("disabled", true);
if ($('#D4Completed').is(':checked')) {
$('#D4Completed').attr("disabled", true);
$('#txtD4RootCause1').attr("disabled", true);
$('#txtD4RootCause2').attr("disabled", true);
$('#txtD4RootCause3').attr("disabled", true);
$('#txtD4RootCause4').attr("disabled", true);
$('#txtRootCauseVerification').attr("disabled", true);
$('#txtEscapePoint').attr("disabled", true);
}
$('#D4Approved').attr("disabled",true);
if ($('#D5Completed').is(':checked')) {
$('#D5Completed').attr("disabled", true);
}
$('#D5Approved').attr("disabled", true);
if ($('#D6Validated').is(':checked'))
$('#D6Validated').attr("disabled",true);
if ($('#D8Completed').is(':checked')) {
$('#D8Completed').attr("disabled", true);
$('#txtD8TeamRecognition').attr("disabled", true);
$('#txtD8LessonsLearned').attr("disabled", true);
}
$('#D8Approved').attr("disabled", true);
})
function ShowSectionsOnLoad() {
var data = ReturnModelObject();
if (data.CAType == 'D0') {
$('#collapseSectionD0').collapse("show")
}
if (data.CAType == 'D3') {
$('#collapseSectionD0').collapse("show")
$('#collapseSectionD1').collapse("show")
$('#collapseSectionD2').collapse("show")
$('#collapseSectionD3').collapse("show")
}
if (data.CAType == 'D6') {
$('#collapseSectionD0').collapse("show")
$('#collapseSectionD1').collapse("show")
$('#collapseSectionD2').collapse("show")
$('#collapseSectionD3').collapse("show")
$('#collapseSectionD4').collapse("show")
$('#collapseSectionD5D6').collapse("show")
}
if (data.CAType == 'D8') {
$('#collapseSectionD0').collapse("show")
$('#collapseSectionD1').collapse("show")
$('#collapseSectionD2').collapse("show")
$('#collapseSectionD3').collapse("show")
$('#collapseSectionD4').collapse("show")
$('#collapseSectionD5D6').collapse("show")
$('#collapseSectionD8').collapse("show")
}
if (data.D8Completed) {
$('#collapseSectionFollowUp').collapse("show")
}
}
function ShowSections() {
var data = ReturnModelObject();
var isD0Vis = $('#collapseSectionD0').is(":visible");
var isD1Vis = $('#collapseSectionD1').is(":visible");
var isD2Vis = $('#collapseSectionD2').is(":visible");
var isD3Vis = $('#collapseSectionD3').is(":visible");
var isD4Vis = $('#collapseSectionD4').is(":visible");
var isD5D6Vis = $('#collapseSectionD5D6').is(":visible");
var isD8Vis = $('#collapseSectionD8').is(":visible");
var isFollowUpVis = $('#collapseSectionFollowUp').is(":visible");
if (data.CAType == 'D0') {
if (!isD0Vis) {
$('#collapseSectionD0').collapse("toggle")
}
if (isD1Vis) {
$('#collapseSectionD1').collapse("toggle")
}
if (isD2Vis) {
$('#collapseSectionD2').collapse("toggle")
}
if (isD3Vis) {
$('#collapseSectionD3').collapse("toggle")
}
if (isD4Vis) {
$('#collapseSectionD4').collapse("toggle")
}
if (isD5D6Vis) {
$('#collapseSectionD5D6').collapse("toggle")
}
if (isD8Vis) {
$('#collapseSectionD8').collapse("toggle")
}
}
if (data.CAType == 'D3') {
if (!isD0Vis) {
$('#collapseSectionD0').collapse("toggle")
}
if (!isD1Vis) {
$('#collapseSectionD1').collapse("toggle")
}
if (!isD2Vis) {
$('#collapseSectionD2').collapse("toggle")
}
if (!isD3Vis) {
$('#collapseSectionD3').collapse("toggle")
}
if (isD4Vis) {
$('#collapseSectionD4').collapse("toggle")
}
if (isD5D6Vis) {
$('#collapseSectionD5D6').collapse("toggle")
}
if (isD8Vis) {
$('#collapseSectionD8').collapse("toggle")
}
}
if (data.CAType == 'D4') {
if (!isD0Vis) {
$('#collapseSectionD0').collapse("toggle")
}
if (!isD1Vis) {
$('#collapseSectionD1').collapse("toggle")
}
if (!isD2Vis) {
$('#collapseSectionD2').collapse("toggle")
}
if (!isD3Vis) {
$('#collapseSectionD3').collapse("toggle")
}
if (!isD4Vis) {
$('#collapseSectionD4').collapse("toggle")
}
if (isD5D6Vis) {
$('#collapseSectionD5D6').collapse("toggle")
}
if (isD8Vis) {
$('#collapseSectionD8').collapse("toggle")
}
}
if (data.CAType == 'D6') {
if (!isD0Vis) {
$('#collapseSectionD0').collapse("toggle")
}
if (!isD1Vis) {
$('#collapseSectionD1').collapse("toggle")
}
if (!isD2Vis) {
$('#collapseSectionD2').collapse("toggle")
}
if (!isD3Vis) {
$('#collapseSectionD3').collapse("toggle")
}
if (!isD4Vis) {
$('#collapseSectionD4').collapse("toggle")
}
if (!isD5D6Vis) {
$('#collapseSectionD5D6').collapse("toggle")
}
if (isD8Vis) {
$('#collapseSectionD8').collapse("toggle")
}
}
if (data.CAType == 'D8') {
if (!isD0Vis) {
$('#collapseSectionD0').collapse("toggle")
}
if (!isD1Vis) {
$('#collapseSectionD1').collapse("toggle")
}
if (!isD2Vis) {
$('#collapseSectionD2').collapse("toggle")
}
if (!isD3Vis) {
$('#collapseSectionD3').collapse("toggle")
}
if (!isD4Vis) {
$('#collapseSectionD4').collapse("toggle")
}
if (!isD5D6Vis) {
$('#collapseSectionD5D6').collapse("toggle")
}
if (!isD8Vis) {
$('#collapseSectionD8').collapse("toggle")
}
}
if (data.D8Completed) {
if (!isFollowUpVis) {
$('#collapseSectionFollowUp').collapse("toggle")
}
}
}
function HideAllSections() {
//$('.collapse').collapse("hide");
//$('.collapse').collapse("dispose");
//$('#collapseSectionD1').collapse("hide");
//$('#collapseSectionD2').collapse("hide");
//$('#collapseSectionD3').collapse("hide");
//$('#collapseSectionD4').collapse("hide");
//$('#collapseSectionD5D6').collapse("hide");
//$('#collapseSectionD8').collapse("hide");
}
function checkCanCompleteCA()
{
var data = ReturnModelObject();
if ((data.CAType == "D0" && data.D0Completed) ||
(data.CAType == "D3" && data.D3Approved) ||
(data.CAType == "D6" && data.D6Validated) ||
(data.CAType == "D8" && data.D8Approved) )
{
if ('@ViewBag.Is8DQA' == "true" || '@ViewBag.CanCompleteCA' == "true")
{
return true;
}
else
{
alert("Only a QA or the Owner is allowed to complete the CA");
return false;
}
}
return true;
}
var validateD0 = function () {
var message = '';
var dataItem = ReturnModelObject();
if (!$('#CASubmitted').is(":checked")) { message += "CA Needs to be marked as ready.\n"; }
if (dataItem.CATitle == '') { message += "CA Title\n"; }
if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
if (dataItem.CASourceID == '') { message += "CA Source\n"; }
if (dataItem.ModuleID == '') { message += "Module\n"; }
if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
if (dataItem.D0Comments == '') { message += "D0 Comments\n"; }
//if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
if (message != '')
message = "Please enter the following fields to complete D0\n" + message;
return message;
}
var validateD3 = function(){
var message = '';
var dataItem = ReturnModelObject();
if (dataItem.CATitle == ''){ message += "CA Title\n";}
if (dataItem.RequestorID == ''){message += "RequestorID\n";}
if (dataItem.D1AssigneeID == ''){message += "Assignee\n";}
if (dataItem.CASourceID == ''){message += "CA Source\n";}
if (dataItem.ModuleID == ''){message += "Module\n";}
if (dataItem.D8DueDate == ''){message += "CA Due Date\n";}
if (dataItem.TeamMemberIDs == ''){message += "Team Members\n";}
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
if (dataItem.BackgroundInfo == '') message += "Background Info\n";
if (dataItem.Analysis == '') message += "Analysis\n";
if (dataItem.VisualVerification == '') message += "Visual Verification Info\n";
if (dataItem.InterimContainmentAction == '') message += "Interim Containment Actions Info\n";
if (dataItem.ICAVerificationResults == '') message += "ICA Verification Results\n";
if (dataItem.ICAValidationActivities == '') message += "ICA Validation Activities\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (message != '')
message = "Please enter the following fields to complete D3\n" + message;
return message;
}
var validateD3Approval = function () {
var message = '';
//var dataItem = ReturnModelObject();
//if (dataItem.CATitle == '') { message += "CA Title\n"; }
//if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
//if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
//if (dataItem.CASourceID == '') { message += "CA Source\n"; }
//if (dataItem.ModuleID == '') { message += "Module\n"; }
//if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
//if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (message != '')
message = "Please enter the following fields to complete D3\n" + message;
return message;
}
var validateD4 = function () {
var message = '';
var dataItem = ReturnModelObject();
if (dataItem.CATitle == '') { message += "CA Title\n"; }
if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
if (dataItem.CASourceID == '') { message += "CA Source\n"; }
if (dataItem.ModuleID == '') { message += "Module\n"; }
if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
if (dataItem.BackgroundInfo == '') message += "Background Info\n";
if (dataItem.Analysis == '') message += "Analysis\n";
if (dataItem.VisualVerification == '') message += "Visual Verification Info\n";
if (dataItem.InterimContainmentAction == '') message += "Interim Containment Actions Info\n";
if (dataItem.ICAVerificationResults == '') message += "ICA Verification Results\n";
if (dataItem.ICAValidationActivities == '') message += "ICA Validation Activities\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (dataItem.D4RootCause1 == '' && dataItem.D4RootCause2 == '' && dataItem.D4RootCause3 == '' && dataItem.D4RootCause4 == '') message += "At least one root cause must be entered\n";
if (dataItem.RootCauseVerification == '') message += "Root Cause Verification\n";
if (dataItem.EscapePoint == '') message += "Escape Point\n";
if (message != '')
message = "Please enter the following fields to complete D3\n" + message;
return message;
}
validateD5 = function(){
var vgrid = $("#D5D6CorrectivetActions").data("kendoGrid");
//Getting grid items
var items = vgrid.dataSource.data();
var errorMsg = '';
if (items.length == 0) {
alert("Please enter at least one Corrective/Preventitive action...\n");
return false;
}
// iterate through the Grid
for (i = 0; i < items.length; i++) {
var item = items[i];
if (item.CARequired == "Yes")
{
if (item.ECD == null){
errorMsg += 'ECD \n';
}
if (item.Improvement == null){
errorMsg += 'ECD \n';
}
if (item.ResponsibilityOwnerName == null){
errorMsg = 'Responsibility Owner \n';
}
}
if (errorMsg != ''){
alert('Please enter the following fields before validating D5 \n' + errorMsg)
return false;
}
}
return true;
}
var validateD4Approval = function () {
var message = '';
//var dataItem = ReturnModelObject();
//if (dataItem.CATitle == '') { message += "CA Title\n"; }
//if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
//if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
//if (dataItem.CASourceID == '') { message += "CA Source\n"; }
//if (dataItem.ModuleID == '') { message += "Module\n"; }
//if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
//if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (message != '')
message = "Please enter the following fields to approve D4\n" + message;
return message;
}
var validateD5Approval = function () {
var message = '';
//var dataItem = ReturnModelObject();
//if (dataItem.CATitle == '') { message += "CA Title\n"; }
//if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
//if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
//if (dataItem.CASourceID == '') { message += "CA Source\n"; }
//if (dataItem.ModuleID == '') { message += "Module\n"; }
//if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
//if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (message != '')
message = "Please enter the following fields to approve D5/D6/D7\n" + message;
return message;
}
validateD6 = function(){
var vgrid = $("#D5D6CorrectivetActions").data("kendoGrid");
//Getting grid items
var items = vgrid.dataSource.data();
var errorMsg = '';
for (i = 0; i < items.length; i++) {
var item = items[i];
if (item.CARequired == "Yes")
{
if (item.ECD == null){
errorMsg += 'ECD \n';
}
if (item.ImplementedDate == null){
errorMsg += 'ImplementedDate \n';
}
if (item.ECNLinks == null && item.AttachmentLinks == null){
errorMsg += 'ECNs or Attachments \n';
}
if (item.ResponsibilityOwnerName == null){
errorMsg += 'Responsibility Owner \n';
}
}
else
{
if (item.ECD == null){
errorMsg += 'ECD \n';
}
if (item.ImplementedDate == null){
errorMsg += 'ImplementedDate \n';
}
if (item.ResponsibilityOwnerName == null){
errorMsg += 'Responsibility Owner \n';
}
}
if (errorMsg != ''){
alert('Please enter the following fields before validating D6 \n' + errorMsg)
return false;
}
}
return true;
}
validateD7 = function(){
var vgrid = $("#D7PreventiveActions").data("kendoGrid");
//Getting grid items
var items = vgrid.dataSource.data();
var errorMsg = '';
for (i = 0; i < items.length; i++) {
var item = items[i];
if (item.ECD == null){
errorMsg += 'ECD \n';
}
if (item.ImplementedDate == null){
errorMsg = 'ImplementedDate \n';
}
if (item.ECNLinks == null && item.AttachmentLinks == null){
errorMsg += 'ECNs oR Attachments \n';
}
if (item.ResponsibilityOwnerName == null){
errorMsg += 'Responsibility Owner \n';
}
if (errorMsg != ''){
alert('Please enter the following fields before completing D7 \n' + errorMsg)
return false;
}
}
return true;
}
var validateD8 = function () {
var message = '';
var dataItem = ReturnModelObject();
if (!$('#D6Validated').is(":checked")) message += "D5/D6/D7 Needs to be validated\n."
if (dataItem.CATitle == '') { message += "CA Title\n"; }
if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
if (dataItem.CASourceID == '') { message += "CA Source\n"; }
if (dataItem.ModuleID == '') { message += "Module\n"; }
if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
if (dataItem.BackgroundInfo == '') message += "Background Info\n";
if (dataItem.Analysis == '') message += "Analysis\n";
if (dataItem.VisualVerification == '') message += "Visual Verification Info\n";
if (dataItem.InterimContainmentAction == '') message += "Interim Containment Actions Info\n";
if (dataItem.ICAVerificationResults == '') message += "ICA Verification Results\n";
if (dataItem.ICAValidationActivities == '') message += "ICA Validation Activities\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (dataItem.D4RootCause1 == '' && dataItem.D4RootCause2 == '' && dataItem.D4RootCause3 == '' && dataItem.D4RootCause4 == '') message += "At least one root cause must be entered\n";
if (dataItem.RootCauseVerification == '') message += "Root Cause Verification\n";
if (dataItem.EscapePoint == '') message += "Escape Point\n";
if (dataItem.D8LessonsLearned == '') message += "Lessons Learned\n"
if (message != '')
message = "Please enter the following fields to complete D8\n" + message;
return message;
}
var validateD8Approval = function () {
var message = '';
//var dataItem = ReturnModelObject();
//if (dataItem.CATitle == '') { message += "CA Title\n"; }
//if (dataItem.RequestorID == '') { message += "RequestorID\n"; }
//if (dataItem.D1AssigneeID == '') { message += "Assignee\n"; }
//if (dataItem.CASourceID == '') { message += "CA Source\n"; }
//if (dataItem.ModuleID == '') { message += "Module\n"; }
//if (dataItem.D8DueDate == '') { message += "CA Due Date\n"; }
//if (dataItem.TeamMemberIDs == '') { message += "Team Members\n"; }
//if (dataItem.D2ProblemDescription == '') message += "Problem Description\n";
//if (dataItem.RiskAssessmentAreaIDs == '') message += "Risk Assessment\n";
//if (dataItem.D3RiskAssessmentNotes == '')message += "Notes\n";
if (message != '')
message = "Please enter the following fields to complete D8\n" + message;
return message;
}
$('#CATypeList').on('change', function () {
HideAllSections();
ShowSections();
})
$('#D0Completed').on('change', function () {
data = ReturnModelObject();
if (currentUserId == data.D1AssigneeID) {
var message = validateD0();
if (message == '') {
TriggerSectionApproval('D0')
}
else {
$('#D0Completed').prop('checked', false);
alert(message);
}
}
else {
$('#D0Completed').prop('checked', false);
alert('Only the 8D assignee can complete a section')
}
})
$('#ApproveD0').on('click', function () {
$('#cover-spin').show(0);
if (!$('#D0Completed').is(":checked")) {
//$('#D3Completed').prop('checked', false);
alert("D0 must be completed before it can be approved.")
$('#cover-spin').hide(0);
//$('#D3Approved').prop('checked', false);
return;
}
//$('#D0Approved').prop('checked', true);
ApproveSection('D0')
//if (!checkCanCompleteCA()) {
// $('#D0Complete').prop('checked', false);
// return;
//}
})
$('#RejectD0').on('click', function () {
if (!$('#D0Completed').is(":checked")) {
alert("D0 must be completed before it can be rejected.")
$('#cover-spin').hide(0);
return;
}
currentRejectingSection = 'D0';
$('#D0Completed').prop('checked', false);
$("#SectionRejectComments").modal('show');
})
$('#D3Completed').on('change', function () {
$('#cover-spin').show(0);
data = ReturnModelObject();
if (data.D0Approved != true) {
alert('D0 must be approved before D3 can be completed.');
$('#D3Completed').prop('checked', false);
$('#cover-spin').hide(0);
return
}
if (currentUserId == data.D1AssigneeID) {
var message = validateD3();
if (message == '') {
//trigger QA Approval here
$('#D3Completed').attr("disabled", true);
TriggerSectionApproval('D3')
}
else {
$('#D3Completed').prop('checked', false);
alert(message);
$('#cover-spin').hide(0);
return
}
if (!$('#D0Completed').is(":checked")) {
$('#D3Completed').prop('checked', false);
alert("Please complete D0 before completing D3")
$('#cover-spin').hide(0);
return;
}
}
else {
$('#D3Completed').prop('checked', false);
alert('Only the 8D assignee can complete a section')
}
})
$('#D3Approved').on('change', function () {
if (!$('#D3Completed').is(":checked")) {
$('#D3Completed').prop('checked', false);
alert("Please complete D3 before approving D3")
$('#D3Approved').prop('checked', false);
return;
}
if (true) {
}
var message = validateD3Approval();
if (message == '') {
if (!checkCanCompleteCA()) {
$('#D3Approved').prop('checked', false);
return;
}
}
else {
$('#D3Approved').prop('checked', false);
alert(message);
}
})
$('#ApproveD3').on('click', function () {
if (!$('#D3Completed').is(":checked")) {
//$('#D3Completed').prop('checked', false);
alert("D3 must be completed before it can be approved.")
//$('#D3Approved').prop('checked', false);
return;
}
var message = validateD3Approval();
if (message == '') {
//$('#D3Approved').prop('checked', true);
ApproveSection('D3')
}
//if (message == '') {
// if (!checkCanCompleteCA()) {
// $('#D3Approved').prop('checked', false);
// return;
// }
//}
//else {
// $('#D3Approved').prop('checked', false);
// alert(message);
//}
})
$('#RejectD3').on('click', function () {
if (!$('#D3Completed').is(":checked")) {
//$('#D3Completed').prop('checked', false);
alert("D3 must be completed before it can be rejected.")
//$('#D3Approved').prop('checked', false);
return;
}
currentRejectingSection = 'D3';
$('#D3Completed').prop('checked', false);
$("#SectionRejectComments").modal('show');
})
function ApproveSection(dSection) {
$('#cover-spin').show(0);
var data = ReturnModelObject();
var sendInfo = {
issueID: data.CANo,
dSection: dSection
};
$.ajax({
url: '/CorrectiveAction/ApproveSection',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
else {
if (result.indexOf("Last Approver") < 0) {
$('#' + dSection + 'Approved').prop('checked', false);
}
else {
$('#' + dSection + 'Approved').prop('checked', true);
//ApproveSection('D5D6D7');
if (dSection == 'D5D6D7') {
$('#D5Approved').prop('checked', true);
TriggerSectionValidation('D5D6D7Validation')
}
//StartD6D7Validation();
}
//
SaveCA();
@*alert(result);
if (result.indexOf("Approval initiated") >= 0) {
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
}
else {
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0)) {
$("#txtStatusName").val("D1");
}
}*@
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
})
}
function ValidateSection(dSection) {
$('#cover-spin').show(0);
var data = ReturnModelObject();
var sendInfo = {
issueID: data.CANo,
dSection: dSection
};
$.ajax({
url: '/CorrectiveAction/ApproveSection',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(sendInfo),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
else {
if (result.indexOf("Last Approver") < 0) {
$('#' + dSection + 'Approved').prop('checked', false);
}
else {
$('#D6Validated').prop('checked', true);
//ApproveSection('D5D6D7');
//StartD6D7Validation();
}
//
SaveCA();
@* alert(result);
if (result.indexOf("Approval initiated") >= 0) {
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
}
else {
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0)) {
$("#txtStatusName").val("D1");
}
}*@
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
$('#cover-spin').hide(0);
}
})
}
$('#D4Completed').on('change', function () {
data = ReturnModelObject();
if (currentUserId == data.D1AssigneeID) {
if (!$('#D3Approved').is(":checked")) {
$('#D4Completed').prop('checked', false);
alert("D3 must be approved before D4 can be completed.")
return;
}
var message = validateD4();
if (message == '') {
TriggerSectionApproval('D4')
}
else {
$('#D4Completed').prop('checked', false);
alert(message);
return
}
}
else {
$('#D4Completed').prop('checked', false);
alert('Only the 8D assignee can complete a section')
}
})
$('#ApproveD4').on('click', function () {
if (!$('#D4Completed').is(":checked")) {
//$('#D3Completed').prop('checked', false);
alert("D4 must be completed before it can be approved.")
//$('#D3Approved').prop('checked', false);
return;
}
var message = validateD4Approval();
if (message == '') {
//$('#D4Approved').prop('checked', true);
ApproveSection('D4')
}
})
$('#RejectD4').on('click', function () {
if (!$('#D4Completed').is(":checked")) {
alert("D4 must be completed before it can be rejected.")
return;
}
currentRejectingSection = 'D4';
$('#D4Completed').prop('checked', false);
$("#SectionRejectComments").modal('show');
})
//$('#D5Completed').on('change', function () {
// if (!$('#D4Completed').is(":checked"))
// {
// $('#D5Completed').prop('checked', false);
// alert("Please complete D4 before completing D5")
// }
// if (!validateD5())
// {
// $('#D5Completed').prop('checked', false);
// }
//})
$('#D5Completed').on('change', function () {
data = ReturnModelObject();
if (currentUserId == data.D1AssigneeID) {
if (!$('#D4Approved').is(":checked")) {
$('#D5Completed').prop('checked', false);
alert("D4 must be approved before D5 can be completed.")
return;
}
if (!validateD5()) {
$('#D5Completed').prop('checked', false);
return;
}
TriggerSectionApproval('D5D6D7');
}
else {
$('#D5Completed').prop('checked', false);
alert('Only the 8D assignee can complete a section')
}
//var message = validateD3();
})
//$('#D5Approved').on('change', function () {
// if (!$('#D5Completed').is(":checked")) {
// $('#D5Approved').prop('checked', false);
// alert("Please complete D5 before approving D5")
// }
// if (!validateD5()) {
// $('#D5Completed').prop('checked', false);
// }
//})
$('#ApproveD5D6D7').on('click', function () {
$('#cover-spin').show(0);
if (!$('#D5Completed').is(":checked")) {
//$('#D3Completed').prop('checked', false);
alert("D5 must be completed before it can be approved.")
//$('#D3Approved').prop('checked', false);
$('#cover-spin').hide(0);
return;
}
var message = validateD5Approval();
if (message == '') {
//$('#D3Approved').prop('checked', true);
ApproveSection('D5D6D7');
//TriggerSectionValidation('D5D6D7Validation')
}
//$('#cover-spin').hide(0);
})
$('#D6Validated').on('change', function () {
data = ReturnModelObject();
if (currentUserId == data.RequestorID || '@ViewBag.Is8DQA' == "true" || '@ViewBag.CanCompleteCA' == "true") {
if (!checkCanCompleteCA()) {
$('#D6Validated').prop('checked', false);
$('#cover-spin').hide(0);
return;
}
if (!$('#D5Approved').is(":checked")) {
$('#D6Validated').prop('checked', false);
$('#cover-spin').hide(0);
alert("D5 Must be approved by QA.")
return;
}
if (!validateD6()) {
$('#D6Validated').prop('checked', false);
$('#cover-spin').hide(0);
return;
}
}
else {
$('#D6Validated').prop('checked', false);
alert('Only the 8D requestor or QA can validate')
$('#cover-spin').hide(0);
return;
}
ValidateSection('D5D6D7Validation')
//$('#cover-spin').hide(0);
})
$('#D7Completed').on('change', function () {
if (!$('#D6Validated').is(":checked"))
{
$('#D7Completed').prop('checked', false);
alert("Please validate D6 before completing D7")
}
if (!validateD7())
{
$('#D7Validated').prop('checked', false);
}
})
$('#D5D6D7Approve').on('click', function () {
if (!$('#D5Completed').is(":checked")) {
alert("D5 must be completed before it can be approved.")
return;
}
var message = validateD5Approval();
if (message == '') {
ApproveSection('D5')
}
})
$('#RejectD5D6D7').on('click', function () {
if (!$('#D5Completed').is(":checked")) {
alert("D5/D6/D7 must be completed before it can be rejected.")
return;
}
currentRejectingSection = 'D5D6D7';
$('#D5Completed').prop('checked', false);
$("#SectionRejectComments").modal('show');
})
$('#D8Completed').on('change', function () {
$('#cover-spin').show(0);
data = ReturnModelObject();
if (currentUserId == data.D1AssigneeID) {
var message = validateD8();
if (message == '') {
TriggerSectionApproval('D8')
}
else {
$('#D8Completed').prop('checked', false);
alert(message);
$('#cover-spin').hide(0);
}
}
else {
$('#D8Completed').prop('checked', false);
alert('Only the 8D assignee can complete a section')
$('#cover-spin').hide(0);
}
})
$('#ApproveD8').on('click', function () {
$('#cover-spin').show(0);
if (!$('#D8Completed').is(":checked")) {
alert("D8 must be completed before it can be approved.")
$('#cover-spin').hide(0);
return;
}
var message = validateD8Approval();
if (message == '') {
//$('#D8Approved').prop('checked', true);
ApproveSection('D8')
}
})
$('#RejectD8').on('click', function () {
if (!$('#D8Completed').is(":checked")) {
alert("D8 must be completed before it can be rejected.")
return;
}
currentRejectingSection = 'D8';
$('#D8Completed').prop('checked', false);
$("#SectionRejectComments").modal('show');
})
function TriggerSectionApproval(section) {
$('#cover-spin').show(0);
var data = ReturnModelObject();
var confirmationMessage = "Submit " + section + " completion for approval?";
if (!confirm(confirmationMessage)) {
$('#' + section + 'Completed').prop('checked', false);
if (section == 'D5D6D7') {
$('#D5Completed').prop('checked', false);
}
$('#cover-spin').hide(0);
return;
}
else {
data.TriggerSectionApproval = true;
data.SectionApproval = section;
//alert('getting here')
$.ajax({
url: '/CorrectiveAction/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
else {
alert(result);
if (result.indexOf("Approval initiated") >= 0) {
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
}
else {
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0)) {
$("#txtStatusName").val("D1");
}
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
})
}
return false;
}
function TriggerSectionValidation(section) {
$('#cover-spin').show(0);
var data = ReturnModelObject();
data.TriggerSectionApproval = true;
data.SectionApproval = section;
$.ajax({
url: '/CorrectiveAction/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
else {
alert(result);
if (result.indexOf("Validation initiated") >= 0) {
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
$('#cover-spin').hide(0);
}
else {
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0)) {
$("#txtStatusName").val("D1");
}
$('#cover-spin').hide(0);
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
$('#cover-spin').hide(0);
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
})
return false;
}
function SaveCA() {
$('#cover-spin').show(0);
var data = ReturnModelObject();
var confirmationMessage = "This CA is set to type " + data.CAType + " and you have completed " + data.CAType + ";Are you sure you want to complete the 8D.\n The 8D will be submitted for Approval, No changes to the document will be allowed after this, except by the Approvers";
if ((data.CAType == "D0" && data.D0Approved) ||
(data.CAType == "D3" && data.D3Approved) ||
(data.CAType == "D6" && data.D6Validated) ||
(data.CAType == "D8" && data.D8Approved))
{
data.TriggerApproval = true;
}
$.ajax({
url: '/CorrectiveAction/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0 && result.indexOf("User is not authorized") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
if (result.indexOf("User is not authorized") >= 0) {
alert("User is not authorized to make changes to this CA. Must be designated either a Requestor, Assignee, or QA by the requestor.")
}
else
{
alert(result);
if (result.indexOf("Successfully Saved") >= 0)
{
$('#cover-spin').hide(0);
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
}
else
{
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0))
{
$("#txtStatusName").val("D1");
}
$('#cover-spin').hide(0);
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
$('#cover-spin').hide(0);
}
})
return false;
}
$("#CASubmitted").on('click', function () {
var submittedValue = $("#CASubmitted").val();
if (submittedValue) {
//If checkbox is now selected as true
caAssignee = $("#D1AssigneeList").val();
caQa = $("#D1QAList").val();
title = $("#txtCATitle").val();
caSource = $("#CASourceList").val();
caDueDate = $("#txtD8DueDate").val();
caRequestor = $("#RequestorList").val();
var errorMessage = '';
if (caAssignee == '') {
errorMessage += 'CA Assignee is missing! \n'
}
if (caQa == '') {
errorMessage += 'CA QA is missing! \n'
}
if (title == '') {
errorMessage += 'CA Title is missing! \n'
}
if (caSource == '') {
errorMessage += 'CA Source is missing! \n'
}
if (caDueDate == '') {
errorMessage += 'CA D8 Due Date is missing! \n'
}
if (caRequestor == '') {
errorMessage += 'CA Requestor is missing! \n'
}
if (errorMessage != '') {
//Uncheck CA Ready Checkbox
//Display reason what's missing'
$("#CASubmitted").prop('checked', false);
alert('Error! Not able to select CA Ready!\n The following fields must be completed:\n ' + errorMessage);
}
}
});
$("#SaveCorrectiveAction").on('click', function (e) {
$('#cover-spin').show(0);
e.preventDefault();
var data = ReturnModelObject();
var confirmationMessage = "This CA is set to type " + data.CAType + " and you have completed " + data.CAType + ";Are you sure you want to complete the 8D.\n The 8D will be submitted for Approval, No changes to the document will be allowed after this, except by the Approvers";
if (data.CASubmitted) {
$('#CASubmitted').attr("disabled", true);
}
if ((data.CAType == "D0" && data.D0Approved) ||
(data.CAType == "D3" && data.D3Approved) ||
(data.CAType == "D6" && data.D7Approved) ||
(data.CAType == "D8" && data.D8Approved) )
{
if (!confirm(confirmationMessage))
return;
else
{
data.TriggerApproval = true;
}
}
$.ajax({
url: '/CorrectiveAction/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function (result) {
if (result.indexOf("Successfully Saved") < 0 && result.indexOf("User is not authorized") < 0) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
$('#cover-spin').hide(0);
}
if (result.indexOf("User is not authorized") >= 0) {
alert("User is not authorized to make changes to this CA. Must be designated either a Requestor, Assignee, or QA by the requestor.")
$('#cover-spin').hide(0);
}
else
{
alert(result);
$('#cover-spin').hide(0);
if (result.indexOf("Approval initiated") >= 0)
{
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.CANo");
}
else
{
SetStageCompletionCheckBoxes();
if (data.D1AssigneeID != '' && ('@Model.Status' == 0))
{
$("#txtStatusName").val("D1");
}
}
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
$('#cover-spin').hide(0);
}
})
return false;
})
var SetStageCompletionCheckBoxes = function(){
if ($('#D3Completed').is(':checked'))
$('#D3Completed').attr("disabled",true);
if ($('#D4Completed').is(':checked'))
$('#D4Completed').attr("disabled",true);
if ($('#D5Completed').is(':checked'))
$('#D5Completed').attr("disabled", true);
if ($('#D5Approved').is(':checked'))
$('#D5Approved').attr("disabled", true);
if ($('#D6Validated').is(':checked'))
$('#D6Validated').attr("disabled",true);
if ($('#D7Completed').is(':checked'))
$('#D7Completed').attr("disabled",true);
if ($('#D8Completed').is(':checked'))
$('#D8Completed').attr("disabled",true);
}
var ReturnModelObject = function () {
var isCASubmitted;
if ($('#CASubmitted').is(':checked'))
isCASubmitted = 1;
else
isCASubmitted = 0;
var isD0Completed
if ($('#D0Completed').is(':checked'))
isD0Completed = 1;
else
isD0Completed = 0;
var isD0Approved
if ($('#D0Approved').is(':checked')) {
isD0Approved = 1;
}
else
isD0Approved = 0;
var isD3Completed
if ($('#D3Completed').is(':checked'))
isD3Completed = 1;
else
isD3Completed = 0;
var isD3Approved
if ($('#D3Approved').is(':checked'))
isD3Approved = 1;
else
isD3Approved = 0;
var isD4Completed;
if ($('#D4Completed').is(':checked'))
isD4Completed = 1;
else
isD4Completed = 0;
var isD4Approved;
if ($('#D4Approved').is(':checked'))
isD4Approved = 1;
else
isD4Approved = 0;
var isD5Completed;
if ($('#D5Completed').is(':checked'))
isD5Completed = 1;
else
isD5Completed = 0;
var isD5Approved;
if ($('#D5Approved').is(':checked'))
isD5Approved = 1;
else
isD5Approved = 0;
var isD6Validated;
if ($('#D6Validated').is(':checked'))
isD6Validated = 1;
else
isD6Validated = 0;
var isD7Completed;
if ($('#D7Completed').is(':checked'))
isD7Completed = 1;
else
isD7Completed = 0;
var isD8Completed;
if ($('#D8Completed').is(':checked'))
isD8Completed = 1;
else
isD8Completed = 0;
var isD8Approved;
if ($('#D8Approved').is(':checked'))
isD8Approved = 1;
else
isD8Approved = 0;
var objectData = {
CANo: "@Model.CANo",
CATitle: $("#txtCATitle").val(),
RequestorID: $("#RequestorList").data("kendoDropDownList").value(),
IssueDate: $("#txtIssueDate").val(),
CurrentD1AssigneeID: '@Model.CurrentD1AssigneeID',
D1AssigneeID: $("#D1AssigneeList").data("kendoDropDownList").value(),
CASourceID: $("#CASourceList").data("kendoDropDownList").value(),
ModuleIDs: $("#ModuleIDs").data("kendoMultiSelect").value(),
QAID: $("#D1QAList").data("kendoDropDownList").value(),
D8DueDate: $("#txtD8DueDate").val(),
Tools: $("#txtTool").val(),
ApprovedDate: $("#txtApprovedDate").val(),
TeamMemberIDs: $("#TeamMemberIDs").data("kendoMultiSelect").value(),
RelatedMRB: $("#txtRelatedMRB").val(),
RelatedAudit: $("#txtRelatedAudit").val(),
CAType : $("#CATypeList").data("kendoDropDownList").value(),
WorkFlowNumber: $("#workFlowNumber").val(),
TeamCaptainID: $("#TeamCaptainList").data("kendoDropDownList").value(),
CASponsorID: $("#CASponsorList").data("kendoDropDownList").value(),
CASubmitted: isCASubmitted,
CAStandardType : $("#CAStandardTypeList").data("kendoDropDownList").value(),
//D0
D0Comments : $("#d0Comments").val(),
D0Completed: isD0Completed,
D0Approved: isD0Approved,
//d2
CustomerName: $("#txtCustomerName").val(),
CustomerPartNo: $("#txtCustomerPartNo").val(),
IFXPartNo: $("#txtIFXPartNo").val(),
PartQty: $("#txtPartQty").val(),
InvoiceNo: $("#txtInvoiceNo").val(),
PurchaseOrderNo: $("#txtPurchaseOrderNo").val(),
SalesOrderNo: $("#txtSalesOrderNo").val(),
DollarImpact: $("#txtDollarImpact").val(),
BackgroundInfo: $("#txtBackgroundInfo").val(),
Analysis: $("#txtAnalysis").val(),
VisualVerification: $("#txtVisualVerification").val(),
//d3
InterimContainmentAction: $("#txtInterimContainmentAction").val(),
ICAVerificationResults: $("#txtICAVerificationResults").val(),
ICAValidationActivities: $("#txtICAValidationActivities").val(),
//d4
RootCauseVerification: $("#txtRootCauseVerification").val(),
EscapePoint: $("#txtEscapePoint").val(),
D2ProblemDescription: $("#txtD2ProblemDescription").val(),
RiskAssessmentAreaIDs : '',
D3RiskAssessmentNotes: $("#txtD3RiskAssessmentNotes").val(),
D0Completed: isD0Completed,
D3Completed: isD3Completed,
D3Approved: isD3Approved,
D4RootCause1: $("#txtD4RootCause1").val(),
D4RootCause2: $("#txtD4RootCause2").val(),
D4RootCause3: $("#txtD4RootCause3").val(),
D4RootCause4: $("#txtD4RootCause4").val(),
D4Completed: isD4Completed,
D4Approved: isD4Approved,
D5Completed: isD5Completed,
D5Approved: isD5Approved,
D6Validated: isD6Validated,
D7Completed: isD7Completed,
D8Completed: isD8Completed,
D8Approved: isD8Approved,
D8TeamRecognition: $("#txtD8TeamRecognition").val(),
D8LessonsLearned: $("#txtD8LessonsLearned").val(),
//Follow Up
FollowUpDate: $("#txtFollowUpDate").val(),
TriggerApproval: triggerApproval,
TriggerSectionApproval: triggerApprovalSection,
SectionApproval: sectionApproval
}
return objectData;
}
$("#CAList").on('click', function () {
var url = '@Url.Action("CorrectiveActionList", "Home")';
window.location = url;
})
function buildECNLinks(ECNs) {
var template = "";
if (ECNs != null) {
var tempValue = ECNs.split(',');
for (var i = 0; i < tempValue.length; i++) {
template += "<a href='/ECN/Edit?IssueID=" + tempValue[i] + "'> " + tempValue[i] + ",</a>" + " ";
}
}
return template;
}
function EditD3ContainmentActionItem(e) {
var ecdDate;
var tempecdDate;
var implementDate;
var tempimplementDate;
d3ContainmentActionOperation = "Edit";
clearECNListBox();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
d3ContainmenActionID = dataItem.ID;
var ecnLinks = dataItem.ECNLinks;
if (dataItem.ECD != null) {
tempecdDate = new Date(dataItem.ECD);
ecdDate = (tempecdDate.getMonth() + 1) + '/' + tempecdDate.getDate() + '/' + tempecdDate.getFullYear();
}
else
ecdDate = '';
if (dataItem.ImplementedDate != null) {
tempimplementDate = new Date(dataItem.ImplementedDate);
implementDate = (tempimplementDate.getMonth() + 1) + '/' + tempimplementDate.getDate() + '/' + tempimplementDate.getFullYear();
}
else
implementDate = '';
currentResponsibilityOwnerID = dataItem.CurrentResponsibilityOwnerID;
$("#txtContainmentAction").val(dataItem.ContainmentAction);
$("#txtResult").val(dataItem.Result);
$("#ResponsibilityOwnerIds").data("kendoDropDownList").value(dataItem.ResponsibilityOwnerID);
$("#txtECD").val(ecdDate);
$("#txtImplementedDate").val(implementDate);
SetECN_SelectedListBox(ecnLinks);
$("#D3ContainmentActionForm").modal('show');
e.preventDefault();
}
$("#AddD3ContainmentActionItem").on('click', function(e){
d3ContainmentActionOperation = "Add";
clearECNListBox();
$("#txtContainmentAction").val('');
$("#txtResult").val('');
$("#ResponsibilityOwnerIds").data("kendoDropDownList").value(0);
$("#txtECD").val('');
$("#txtImplementedDate").val('');
$("#D3ContainmentActionForm").modal('show');
e.preventDefault();
})
var clearECNListBox = function () {
$('#lstECNs').each(function () {
this.options.length = 0;
$(this)[0].options.length = 0;
});
}
function SetECN_SelectedListBox(ECNs) {
var innerHtml = '';
if (ECNs != null) {
var selectedECNs = ECNs.split(',');
for (i in selectedECNs) {
innerHtml += '<option value="' + selectedECNs[i].trim() + '">' + selectedECNs[i].trim() + '</option>';
}
$('#lstECNs').append(innerHtml);
}
}
$("#SaveD3ContainmentAction").on('click', function(e){
e.preventDefault();
var ecns = "";
var lds = "";
$('#lstECNs option').each(function () {
if (ecns.length == 0)
ecns = this.value;
else
ecns += ', ' + this.value;
});
if ($("#ResponsibilityOwnerIds").data("kendoDropDownList").value() != '' && $("#txtECD").val() == '')
{
alert('Please enter the ECD while entering the Responsible Owner');
return false;
}
var url;
if (d3ContainmentActionOperation == "Edit")
url = "/CorrectiveAction/UpdateD3ContainmentAction";
else
url = "/CorrectiveAction/InsertD3ContainmentAction";
$.ajax({
url: url,
type: "POST",
datatype: "json",
data: {
ID: d3ContainmenActionID,
CANo: @Model.CANo,
ContainmentAction: $("#txtContainmentAction").val(),
Result: $("#txtResult ").val(),
ECNLinks:ecns,
CurrentResponsibilityOwnerID: currentResponsibilityOwnerID,
ResponsibilityOwnerID:$("#ResponsibilityOwnerIds").data("kendoDropDownList").value(),
ECD:$("#txtECD").val(),
ImplementedDate: $("#txtImplementedDate").val()
},
success: function (data) {
var grid = $("#D3ContainmentActions").data("kendoGrid");
grid.dataSource.read($("@Model.CANo").val());
},
error: function (result) {
alert("Failed " + result);
}
});
$("#D3ContainmentActionForm").modal('hide');
})
$("#AddECN").on('click', function () {
$('#lstECNs').append('<option value="' + $("#txtECN").val() + '">' + $("#txtECN").val() + '</option>');
})
$("#RemoveECN").on('click', function (e) {
e.preventDefault();
$("#lstECNs option:selected").remove();
})
function DeleteD3ContainmentActionItem(e)
{
e.preventDefault();
if (confirm("Are you sure you want to delete this Action Item?")) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var d3ContainmentActionID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeletetD3ContainmentActionItem",
type: "POST",
datatype: "json",
data: {
d3ContainmentActionID: d3ContainmentActionID
},
success: function (data) {
var grid = $("#D3ContainmentActions").data("kendoGrid");
grid.dataSource.read($('@Model.CANo').val());
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function error_handler(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 CheckFileType(e) {
var files = e.files;
$.each(files, function () {
if (!this.extension.toLowerCase().match(/^(.doc|.docx|.ppt|.pptx|.xls|.xlsx|.pdf|.gif|.jpeg|.jpg|.bmp|.png|.txt|.slddrw|.sldprt)$/)) {
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
e.preventDefault();
}
});
}
function onD2FileUploadSuccess(e) {
var grid = $("#D2Attachments").data("kendoGrid");
grid.dataSource.read("@Model.CANo");
}
function DownloadCAAttachment(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var fileName = dataItem.FileGUID;
var fileGUID = dataItem.FileGUID;
window.location = '/CorrectiveAction/DownloadCAAttachment?fileGuid=' + fileGUID + '&caNo=' + @Model.CANo;
}
function onFileUploadSuccess(e) {
//alert(e.message);
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read($('#txtCANo').val());
}
function onFileUploadError(e) {
alert("Error Uploading File!!! Please Try Again...");
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read($('#txtCANo').val());
}
function onD4FileUploadSuccess(e) {
var grid = $("#D4Attachments").data("kendoGrid");
grid.dataSource.read("@Model.CANo");
}
function DeleteCAAttachment(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.FileGUID;
var attachmentID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeleteCAAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID
},
success: function (data) {
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read("@Model.CANo");
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function DeleteD2CAAttachment(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.FileGUID;
var attachmentID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeleteCAAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID
},
success: function (data) {
var grid = $("#D2Attachments").data("kendoGrid");
grid.dataSource.read("@Model.CANo");
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function DeleteD4CAAttachment(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.FileGUID;
var attachmentID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeleteCAAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID
},
success: function (data) {
var grid = $("#D4Attachments").data("kendoGrid");
grid.dataSource.read("@Model.CANo");
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function buildLinks(fileNames, caNo) {
var template = "";
if (fileNames != null) {
var tempValue = fileNames.split(',');
for (var i = 0; i < tempValue.length; i++) {
var tempValue2 = tempValue[i].split('~');
var fileName = tempValue2[0];
var fileGuid = tempValue2[1];
var tempFile = fileName.split('.');
var fileExtension = tempFile[tempFile.length - 1];
template += "<a href='/CorrectiveAction/DownloadCAAttachment?fileGuid=" + fileGuid + "&caNo=" + @Model.CANo + "'>" + fileName + "</a><BR>" + " ";
}
}
return template;
}
var d5d6CAItemID;
var caD5D6Operation;
$("#ShowSectionApprovalLog").on('click', function () {
$("#SectionApprovalLog").modal('show');
})
$("#AddD5D6CorrectiveActionItem").on('click', function (e) {
clearD5D6CAForm();
caD5D6Operation = 'Add';
$("#D5D6CorrectiveActionForm").modal("show");
})
function EditD5D6CorrectivetActionItem(e)
{
var ecdDate;
var tempecdDate;
var implementDate;
var tempimplementDate;
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
d5d6CAItemID = dataItem.ID;
var correctivetAction = dataItem.CorrectiveAction;
var ActionType = dataItem.ActionType;
var result = dataItem.Result;
var ecnLnks = dataItem.ECNLinks;
ecnLnks = ECNsFromStringToList(ecnLnks);
var attachmentLinks = dataItem.AttachmentLinks;
currentD5D6AttachmentLinks = attachmentLinks;
currentResponsibilityOwnerID = dataItem.CurrentResponsibilityOwnerID;
var ResponsibilityOwnerID = dataItem.ResponsibilityOwnerID;
var ecd = dataItem.ECD;
if (dataItem.ECD != null) {
tempecdDate = new Date(dataItem.ECD);
ecdDate = (tempecdDate.getMonth() + 1) + '/' + tempecdDate.getDate() + '/' + tempecdDate.getFullYear();
}
else
ecdDate = '';
if (dataItem.ImplementedDate != null) {
tempimplementDate = new Date(dataItem.ImplementedDate);
implementDate = (tempimplementDate.getMonth() + 1) + '/' + tempimplementDate.getDate() + '/' + tempimplementDate.getFullYear();
}
else
implementDate = '';
caD5D6Operation = 'Edit';
clearD5D6CAForm();
$("#hiddenItemNumber").val(d5d6CAItemID);
$("#txtD5D6CorrectiveAction").val(correctivetAction);
$("#txtD5D6Result").val(result);
$("#D5D6ResponsibilityOwnerIds").data("kendoDropDownList").value(ResponsibilityOwnerID);
$("#txtD5D6ECD").val(ecdDate);
$("#txtD5D6ImplementedDate").val(implementDate);
$("#txtActionType").data("kendoDropDownList").value(ActionType == "Corrective" ? "1" : "2");
$("#D5D6ResponsibilityOwnerIds").data("kendoDropDownList").value(ResponsibilityOwnerID);
document.getElementById("CARequired").value = 1
$("#lstD5D6ECNs").data("kendoMultiSelect").value(ecnLnks)
var tempImpIDs;
var data;
var dataArray;
$("#D5D6ImprovementIDs").data("kendoMultiSelect").value("");
if (dataItem.ImprovementID != null) {
tempImpIDs = dataItem.ImprovementID.split(',');
var attValues = new Array();
for (i in tempImpIDs) {
attValues[i] = tempImpIDs[i]
}
}
$("#D5D6ImprovementIDs").data("kendoMultiSelect").value(attValues);
e.preventDefault();
$("#D5D6CorrectiveActionForm").modal("show");
}
$("#SaveD5D6CorrectivetAction").on('click', function () {
$('#cover-spin').show(0);
var objectData = ReturnD5D6CAObject();
var url = "";
if (!validateD5D6SaveForm(objectData)) {
$('#cover-spin').hide(0);
return false;
}
if (objectData.ResponsibilityOwnerID != '' && objectData.ECD == '')
{
alert('Please enter the ECD while entering the Responsible Owner');
$('#cover-spin').hide(0);
return false;
}
if (objectData.ImplementedDate != null && objectData.ImplementedDate != '') {
objectData.IsImplemented = true;
}
if (caD5D6Operation == 'Add') {
url = "/CorrectiveAction/InsertD5D6CAItem";
}
else {
url = "/CorrectiveAction/UpdateD5D6CAItem";
}
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objectData),
success: function (objdata) {
$('#cover-spin').hide(0);
var grid = $("#D5D6CorrectivetActions").data("kendoGrid");
grid.dataSource.read($("@Model.CANo").val());
$("#D5D6CorrectiveActionForm").modal("hide");
},
error: function (result) {
alert("Failed " + result);
$("#D5D6CorrectiveActionForm").modal("hide");
$('#cover-spin').hide(0);
}
});
})
$("#uploadAIAttachments").on('click', function (e) {
e.preventDefault();
var itemId = $("#hiddenItemNumber").val();
if (itemId == '') {
alert('Please save the Action Item before attempting to upload a document...');
return;
}
var currentd5d6caID = itemId;
var url = $('#AddD5D6AttachmentForm').data('url');
url = url + '?d5d6caID=' + currentd5d6caID;
$.ajax({
url: url,
type: "GET",
datatype: "json",
success: function (data) {
$('#D5D6AttachmentContainer').html(data);
$("#AddD5D6AttachmentForm").modal('show')
},
error: function (result) {
alert("Failed " + result);
}
});
})
validateD5D6SaveForm = function(data){
var errorMessage = '';
if (data.ResponsibilityOwnerID == '')
{
errorMessage += 'Responsible Owner\n';
}
if (data.CorrectiveAction == '') {
errorMessage += 'Corrective Action \n';
}
if (data.ECD == '')
{
errorMessage += 'ECD \n';
}
if (data.ImprovementID == ',')
{
errorMessage += 'Improvement Category \n';
}
if (data.ActionType == '') {
errorMessage += 'Action Type \n';
}
if (errorMessage != '')
{
alert('The following fields are required: \n' + errorMessage ) ;
return false;
}
if (data.ImplementedDate != '')
{
if (data.ECNLinks == '' && currentD5D6AttachmentLinks == null)
{
errorMessage += 'ECN or Attachment Link';
}
if (errorMessage != '')
{
alert('The following fields are required if the [Implemented Date] field is filled \n' + errorMessage ) ;
return false;
}
}
if (data.CorrectiveAction.length > 1000) {
$('#cover-spin').hide(0);
alert("Corrective Action field must be less than 1000 characters! Data not saved!");
return false;
}
if (data.Result.length > 1000) {
$('#cover-spin').hide(0);
alert("Result field must be less than 1000 characters! Data not saved!");
return false;
}
return true;
}
function ReturnD5D6CAObject() {
var ecns;
ecns = "";
var _ECNs = $("#lstD5D6ECNs").data("kendoMultiSelect").value();
ecns = ECNsToStringExplode(_ECNs);
var d5d6ImprovementIDs = $("#D5D6ImprovementIDs").data("kendoMultiSelect").value()
d5d6ImprovementIDs = d5d6ImprovementIDs.join();
if (caD5D6Operation == 'Add') {
var objectData = {
ID: 0,
CANo: '@Model.CANo',
CorrectiveAction: $("#txtD5D6CorrectiveAction").val(),
CARequired: document.getElementById("CARequired").value,
Result: $("#txtD5D6Result").val(),
ECNLinks: ecns,
ECD: $("#txtD5D6ECD").val(),
ImplementedDate: $("#txtD5D6ImplementedDate").val(),
IsImplemented: false,
ActionType: $("#txtActionType").data("kendoDropDownList").value(),
CurrentResponsibilityOwnerID: currentResponsibilityOwnerID,
ResponsibilityOwnerID: $("#D5D6ResponsibilityOwnerIds").data("kendoDropDownList").value(),
ImprovementID: d5d6ImprovementIDs + ','
}
}
else {
var objectData = {
ID: d5d6CAItemID,
CANo: '@Model.CANo',
CorrectiveAction: $("#txtD5D6CorrectiveAction").val(),
//CARequired:$("#CARequired").data("kendoDropDownList").value(),
CARequired: document.getElementById("CARequired").value,
Result: $("#txtD5D6Result").val(),
ECNLinks: ecns,
ECD: $("#txtD5D6ECD").val(),
ImplementedDate: $("#txtD5D6ImplementedDate").val(),
IsImplemented: false,
ActionType: $("#txtActionType").data("kendoDropDownList").value(),
CurrentResponsibilityOwnerID: currentResponsibilityOwnerID,
ResponsibilityOwnerID: $("#D5D6ResponsibilityOwnerIds").data("kendoDropDownList").value(),
ImprovementID: d5d6ImprovementIDs + ','
}
}
return objectData;
}
function ECNsToStringExplode(ECNList) {
var ecnListToReturn = ''
ECNList.forEach(function (item) {
if (ecnListToReturn == '') {
ecnListToReturn = item
}
else {
ecnListToReturn = ecnListToReturn + ',' + item;
}
})
return ecnListToReturn;
}
function ECNsFromStringToList(ECNList) {
if (ECNList == '' || ECNList == null) {
return '';
}
var ecnArray = ECNList.split(',');
return ecnArray;
}
function clearD5D6CAForm() {
$("#hiddenItemNumber").val('');
$("#txtD5D6CorrectiveAction").val('');
$("#txtD5D6Result").val('');
$("#D5D6ResponsibilityOwnerIds").data("kendoDropDownList").value(0);
$("#txtD5D6ECD").val('');
$("#txtD5D6ImplementedDate").val('');
document.getElementById("CARequired").value = 0,
$("#D5D6ImprovementIDs").data("kendoMultiSelect").value("");
$('#lstD5D6ECNs').data("kendoMultiSelect").value("");
}
function DeletetD5D6CorrectivetActionItem(e)
{
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
if (dataItem.ImplementedDate != null) {
alert('Unable to delete implemented actions.');
return;
}
if (confirm("Are you sure you want to delete this Audit Finding?")) {
var d5d6CAID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeleteD5D6CAItem",
type: "POST",
datatype: "json",
data: {
d5d6CAID: d5d6CAID
},
success: function (data) {
var grid = $("#D5D6CorrectivetActions").data("kendoGrid");
grid.dataSource.read($('@Model.CANo').val());
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function UploadD5D6CAAttachment(e) {
alert('functioning');
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var currentd5d6caID = dataItem.ID;
var url = $('#AddD5D6AttachmentForm').data('url');
url = url + '?d5d6caID=' + currentd5d6caID;
$.ajax({
url: url,
type: "GET",
datatype: "json",
success: function (data) {
$('#D5D6AttachmentContainer').html(data);
$("#AddD5D6AttachmentForm").modal('show')
},
error: function (result) {
alert("Failed " + result);
}
});
}
/// D7=================================================================================================================================================================
var d7PAItemID;
var paD7Operation;
$("#D7AddECN").on('click', function () {
$('#lstD7ECNs').append('<option value="' + $("#txtD7ECN").val() + '">' + $("#txtD7ECN").val() + '</option>');
})
$("#D7RemoveECN").on('click', function (e) {
e.preventDefault();
$("#lstD7ECNs option:selected").remove();
})
$("#AddD7PreventiveActionItem").on('click', function (e) {
clearD7PAForm();
paD7Operation = 'Add';
$("#D7PreventiveActionForm").modal("show");
})
function EditD7PreventiveActionItem(e)
{
var ecdDate;
var tempecdDate;
var implementDate;
var tempimplementDate;
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
d7PAItemID = dataItem.ID;
var preventivetAction = dataItem.PreventiveAction;
var result = dataItem.Result;
var ecnLnks = dataItem.ECNLinks;
var attachmentLinks = dataItem.AttachmentLinks;
currentD7AttachmentLinks = attachmentLinks;
currentResponsibilityOwnerID = dataItem.CurrentResponsibilityOwnerID;
var ResponsibilityOwnerID = dataItem.ResponsibilityOwnerID;
var ecd = dataItem.ECD;
if (dataItem.ECD != null) {
tempecdDate = new Date(dataItem.ECD);
ecdDate = (tempecdDate.getMonth() + 1) + '/' + tempecdDate.getDate() + '/' + tempecdDate.getFullYear();
}
else
ecdDate = '';
if (dataItem.ImplementedDate != null) {
tempimplementDate = new Date(dataItem.ImplementedDate);
implementDate = (tempimplementDate.getMonth() + 1) + '/' + tempimplementDate.getDate() + '/' + tempimplementDate.getFullYear();
}
else
implementDate = '';
paD7Operation = 'Edit';
clearD7PAForm();
$("#txtPreventiveAction").val(preventivetAction);
$("#txtD7Result").val(result);
$("#D7ResponsibilityOwnerIds").data("kendoDropDownList").value(ResponsibilityOwnerID);
$("#txtD7ECD").val(ecdDate);
$("#txtD7ImplementedDate").val(implementDate);
$("#D7ResponsibilityOwnerIds").data("kendoDropDownList").value(ResponsibilityOwnerID);;
SetD7ECN_SelectedListBox(ecnLnks);
var tempImpIDs;
var data;
var dataArray;
e.preventDefault();
$("#D7PreventiveActionForm").modal("show");
}
$("#SaveD7PreventiveAction").on('click', function () {
var objectData = ReturnD7PAObject();
var url = "";
validateD7SaveForm(objectData);
if (objectData.ResponsibilityOwnerID != '' && objectData.ECD == '')
{
alert('Please enter the ECD while entering the Responsible Owner');
return false;
}
if (paD7Operation == 'Add') {
url = "/CorrectiveAction/InsertD7PAItem";
}
else {
url = "/CorrectiveAction/UpdateD7PAItem";
}
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objectData),
success: function (objdata) {
var grid = $("#D7PreventiveActions").data("kendoGrid");
grid.dataSource.read($("@Model.CANo").val());
$("#D7PreventiveActionForm").modal("hide");
},
error: function (result) {
alert("Failed " + result);
$("#D7PreventiveActionForm").modal("hide");
}
});
})
function ReturnD7PAObject() {
var ecns;
ecns = "";
$('#lstD7ECNs option').each(function () {
if (ecns.length == 0)
ecns = this.value;
else
ecns += ', ' + this.value;
});
if (paD7Operation == 'Add') {
var objectData = {
ID: 0,
CANo: '@Model.CANo',
PreventiveAction: $("#txtPreventiveAction").val(),
Result: $("#txtD7Result").val(),
ECNLinks: ecns,
ECD: $("#txtD7ECD").val(),
ImplementedDate: $("#txtD7ImplementedDate").val(),
CurrentResponsibilityOwnerID: currentResponsibilityOwnerID,
ResponsibilityOwnerID: $("#D7ResponsibilityOwnerIds").data("kendoDropDownList").value()
}
}
else {
var objectData = {
ID: d7PAItemID,
CANo: '@Model.CANo',
PreventiveAction: $("#txtPreventiveAction").val(),
Result: $("#txtD7Result").val(),
ECNLinks: ecns,
ECD: $("#txtD7ECD").val(),
ImplementedDate: $("#txtD7ImplementedDate").val(),
CurrentResponsibilityOwnerID: currentResponsibilityOwnerID,
ResponsibilityOwnerID: $("#D7ResponsibilityOwnerIds").data("kendoDropDownList").value()
}
}
return objectData;
}
validateD7SaveForm = function(data){
var errorMessage = '';
if (data.ImplementedDate != '')
{
if (data.ECNLinks == '' && currentD7AttachmentLinks == null)
{
errorMessage += 'ECN or Attachment Link';
}
if (errorMessage != '')
{
alert('The following fields are required if the [Implemented Date] field is filled \n' + errorMessage ) ;
return false;
}
}
}
function clearD7PAForm() {
$("#txtPreventiveAction").val('');
$("#txtD7Result").val('');
$("#D7ResponsibilityOwnerIds").data("kendoDropDownList").value(0);
$("#txtD7ECD").val('');
$("#txtD7ImplementedDate").val('');
$('#lstD7ECNs').each(function () {
this.options.length = 0;
$(this)[0].options.length = 0;
});
}
function DeleteD7PreventiveActionItem(e)
{
e.preventDefault();
if (confirm("Are you sure you want to delete this Audit Finding?")) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var d7PAID = dataItem.ID;
$.ajax({
url: "/CorrectiveAction/DeleteD7PAItem",
type: "POST",
datatype: "json",
data: {
d7PAID: d7PAID
},
success: function (data) {
var grid = $("#D7PreventiveActions").data("kendoGrid");
grid.dataSource.read($('@Model.CANo').val());
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function SetD7ECN_SelectedListBox(ECNs) {
var innerHtml = '';
if (ECNs != null) {
var selectedECNs = ECNs.split(',');
for (i in selectedECNs) {
innerHtml += '<option value="' + selectedECNs[i].trim() + '">' + selectedECNs[i].trim() + '</option>';
}
$('#lstD7ECNs').append(innerHtml);
}
}
function UploadD7PAAttachment(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var currentd7paID = dataItem.ID;
var url = $('#AddD7AttachmentForm').data('url');
url = url + '?d7paID=' + currentd7paID;
$.ajax({
url: url,
type: "GET",
datatype: "json",
success: function (data) {
$('#D7AttachmentContainer').html(data);
$("#AddD7AttachmentForm").modal('show')
},
error: function (result) {
alert("Failed " + result);
}
});
}
$(window).bind("beforeunload", function () {
//return confirm("Do you really want to close?");
$.ajax({
url: "/CorrectiveAction/ReleaseLockOnDocument",
type: "GET",
datatype: "json",
data: {
issueID: ("@Model.CANo")
},
success: function () {
},
error: function (result) {
alert("ReleaseLockOnDocument - Failed " + result);
}
});
})
$("#SectionD2D3").on('click', function () {
var element = document.getElementById("SectionD2D3");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
$("#SectionD4").on('click', function () {
var element = document.getElementById("SectionD4");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
$("#SectionD5D6").on('click', function () {
var element = document.getElementById("SectionD5D6");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
$("#SectionD7").on('click', function () {
var element = document.getElementById("SectionD7");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
$("#SectionD8").on('click', function () {
var element = document.getElementById("SectionD8");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
$("#FollowUpSection").on('click', function () {
var element = document.getElementById("FollowUpSection");
if (element.innerHTML.trim() == "Show/Hide")
element.innerHTML = "Collapse";
else
element.innerHTML = "Show/Hide";
})
var docType = 9;
$('#reAssignApprovers').on('click', function () {
// reset this variable to indicate that the current Approver of the document is the person Re-Assigning it to someone else.
reAssignFromUserid = "";
var url = "/CorrectiveAction/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) {
//alert(reAssignFromUserid);
if (reAssignFromUserid != '') {
ReAssignApprovalByAdmin(userids);
}
else {
ReAssignApproval(userids);
}
}
$("#ReAssignApproval").modal('hide');
return false;
}
});
var ReAssignApproval = function (userids) {
var urlString = '/CorrectiveAction/ReAssignApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
userIDs: userids,
issueID: $("#CANo").val(),
step: $("#currentStep").val(),
docType: docType
},
success: function (result) {
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
},
error: function (result) {
alert("Failed " + result);
}
});
};
var ReAssignApprovalByAdmin = function (userids) {
var urlString = '/CorrectiveAction/ReAssignApproverByAdmin';
$.ajax({
type: "Post",
url: urlString,
data: {
issueID: $("#CANo").val(),
reAssignApproverFrom: reAssignFromUserid,
reAssignApproverTo: userids,
step: $("#currentStep").val(),
docType: docType
},
success: function (result) {
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
}
});
};
//Region Additional Aprovers
$('#additionalApprovers').on('click', function () {
var searchText = ($("#txtSearch").val());
var url = "/CorrectiveAction/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;
})
$('#additionalApproval').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 = '/CorrectiveAction/AddAdditionalApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
userIDs: userids,
issueID: $("#CANo").val(),
step: $("#currentStep").val(),
docType: docType
},
success: function (result) {
var grid = $("#ApproversList").data("kendoGrid");
grid.dataSource.read($("#CANo").val(), $("#currentStep").val());
},
error: function (result) {
alert("Failed " + result);
}
});
};
function showReAssignRole(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$('#ReAssignApproverFromLabel').text(dataItem.FullName);
var issueID = $("#CANo").val();
reAssignFromUserid = dataItem.UserID;
//if (dataItem.Status != 'Pending')
if (dataItem.Status.indexOf("Pending") < 0)
alert("Cannot ReAssign, because it is not in a Pending state");
else
{
var url = "/CorrectiveAction/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;
//alert(dataItem.FullName);
}
}
var ReAssignApprovalByAdmin = function (userids) {
var urlString = '/CorrectiveAction/ReAssignApproverByAdmin';
//if (arrayOfValues.length == 0)
// return false;
$.ajax({
type: "Post",
url: urlString,
data: {
issueID: $("#CANo").val(),
reAssignApproverFrom: reAssignFromUserid,
reAssignApproverTo: userids,
step: $("#currentStep").val()
},
success: function (result) {
//var grid = $("#ApproversList").data("kendoGrid");
//grid.dataSource.read($('#txtIssueID').val(), $("#currentStep").val());
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
}
});
};
$('#ApproveDocument').on('click', function () {
$('#submitApprovalComments').attr("disabled", false);
$("#ApprovalComments").modal('show');
return false;
});
$('#submitApprovalComments').on('click', function () {
$('#cover-spin').show(0);
$('#submitApprovalComments').attr("disabled", true);
$.ajax({
url: "/CorrectiveAction/Approve",
type: "GET",
datatype: "json",
data: {
issueID: $("#CANo").val(),
currentStep: $("#currentStep").val(),
comments: $("#approvalComments").val()
},
success: function (data) {
$("#ApprovalComments").modal('hide');
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
},
error: function (data) {
$("#ApprovalComments").modal('hide');
var url = '@Url.Action("ReadOnlyCA", "CorrectiveAction", new { caNo = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
}
});
});
$('#RejectDocument').on('click', function () {
$('#submitRejectComments').attr("disabled", false);
$("#RejectComments").modal('show');
return false;
});
$('#submitRejectComments').on('click', function () {
$('#cover-spin').show(0);
if ($("#rejectComments").val() == '')
{
alert("Please enter a valid reason for the Reject");
$('#cover-spin').hide(0);
return false;
}
$('#submitRejectComments').attr("disabled", false);
$.ajax({
url: "/CorrectiveAction/Reject",
type: "GET",
datatype: "json",
data: {
issueID: $("#CANo").val(),
currentStep: $("#currentStep").val(),
comments: $("#rejectComments").val()
},
success: function (data) {
$("#RejectComments").modal('hide');
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());
},
error: function (result) {
$('#submitRejectComments').attr("disabled", false);
alert("Server error, Please Reject the document again");
}
});
});
$('#submitSectionComments').on('click', function () {
//alert('getting to rejection');
$('#cover-spin').show(0);
if ($("#sectionRejectComments").val() == '')
{
alert("Please enter a valid reason for the Reject");
$('#cover-spin').hide(0);
return false;
}
$('#submitRejectComments').attr("disabled", false);
$.ajax({
url: "/CorrectiveAction/RejectSection",
type: "POST",
datatype: "json",
data: {
issueID: $("#CANo").val(),
dSection: currentRejectingSection,
comments: $("#sectionRejectComments").val()
},
success: function (data) {
SaveCA();
@*$("#SectionRejectComments").modal('hide');
var url = '@Url.Action("Edit", "CorrectiveAction", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#CANo").val());*@
},
error: function (result) {
$('#submitRejectComments').attr("disabled", false);
alert("Server error, Please Reject the document again");
}
});
});
</script>