Phares Mike (CSC FI SPS MESLEO) f110fba4cd Merged PR 13298: Added just one approval back in after removing the method call from bug 239935
Added just one approval back in after removing the method call from bug 239935

Added IExcelDataReader support into MK Project

Changed instructions below the ECN Title field to align with Windchill

Related work items: #225480, #244087
2025-03-19 21:19:06 +01:00

2981 lines
118 KiB
Plaintext

@model Fab2ApprovalSystem.Models.ECN
@{
ViewBag.Title = "Edit";
}
@{
Layout = "_ECNLayout.cshtml";
}
<link rel="stylesheet" href="/Content/kendo/kendo.blueopal.min.css" />
<style>
@@media (min-width: 768px) {
.col-sm-6 {
padding-left: 5px;
}
.col-sm-8 {
padding-left: 5px;
}
}
</style>
<body onload="StartTimers();" onmousemove="ResetTimers();" onkeydown="ResetTimers();">
@using (Html.BeginForm())
{
<input type="hidden" id="currentStep" value="@Model.CurrentStep" />
<input type="hidden" id="environment" value="@GlobalVars.DBConnection" />
<input type="hidden" id="workflownumber" value="@Model.WorkFlowNumber" />
@Html.AntiForgeryToken()
<div data-spy="affix">
@if (@Model.CurrentStep == 0)
{
<div data-spy="affix">
<input type="submit" value="Save" class="btn btn-primary btn-xs" />
<input type="button" value="Submit" class="btn btn-primary btn-xs" id="SubmitDocument" />
<input type="button" value="Approval Log History" class="btn btn-primary btn-xs" id="ApprovalLogHistoryData" />
</div>
}
else
{
if (ViewBag.IsApprover == "true")
{
<div data-spy="affix" data-offset-top="0">
<input type="submit" value="Save" class="btn btn-primary btn-xs" />
<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" />
</div>
}
}
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-warning">
<div class="row">
<div class="col-sm-12 text-center">
<div class="row">
<div class="col-sm-12">
<font style="color: crimson; font-size:24px;font-weight: bolder">
Engineering Change Notice
</font>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-body bg-warning">
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-3">
<div class="form-group">
<label class="control-label col-sm-4">ECN #:</label>
<div class="col-sm-8">
@Html.TextBoxFor(model => model.ECNNumber, new { id = "txtECNNumber", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Submit Date:</label>
<div class="col-sm-8">
@Html.TextBoxFor(model => model.SubmitedDate, new { id = "txSubmitDate", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Originator Name:</label>
<div class="col-sm-8">
@Html.TextBoxFor(model => model.OriginatorName, new { id = "txtOriginatorName", @class = "k-textbox", disabled = "disabled", style = "background-color:lightblue" })
@if (Session[GlobalVars.IS_ADMIN] != null)
{
<a href="javascript:undefined" id="lnkReassignOriginator" class="linkbutton edit" title="Re-assign Originator"></a>
}
</div>
</div>
@if (Model.ConvertedFromNumber != null && Model.IsECN)
{
<div class="form-group">
<font style="color:red; font-size:12px; font-weight:bold">
<label class="control-label col-sm-4">Converted from TECN: </label>
<div class="col-sm-4 col-sm-4">
<a style="color:red" href="Edit?IssueID=@Model.ConvertedFromNumber">@Model.ConvertedFromNumber</a>
</div>
</font>
</div>
}
@if (Model.ConvertedFromNumber != null && Model.IsTECN)
{
<div class="form-group">
<font style="color:red; font-size:12px; font-weight:bold">
<label class="control-label col-sm-4">Converted from E-TECN: </label>
<div class="col-sm-4 col-sm-4">
<a style="color:red" href="Edit?IssueID=@Model.ConvertedFromNumber">@Model.ConvertedFromNumber</a>
</div>
</font>
</div>
}
@if (Model.ConvertedToNumber != null && Model.IsEmergencyTECN)
{
<div class="form-group">
<font style="color: red; font-size: 12px; font-weight: bold">
<label class="control-label col-sm-4">Converted to TECN: </label>
<div class="col-sm-4 col-sm-4">
<a style="color:red" href="Edit?IssueID=@Model.ConvertedToNumber">@Model.ConvertedToNumber</a>
</div>
</font>
</div>
}
@if (Model.ConvertedToNumber != null && Model.IsTECN)
{
<div class="form-group">
<font style="color: red; font-size: 12px; font-weight: bold">
<label class="control-label col-sm-4">Converted to ECN: </label>
<div class="col-sm-4 col-sm-4">
<a style="color:red" href="Edit?IssueID=@Model.ConvertedToNumber">@Model.ConvertedToNumber</a>
</div>
</font>
</div>
}
</div>
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-4">ECN Title:</label>
<div class="col-sm-6">
@Html.TextBoxFor(model => model.Title, new { id = "txtTitle", @class = "k-textbox", style = "width:100%" })
</div>
<div class="col-sm-6 col-sm-offset-4" style="color: red;">
* (DO NOT USE Rev I, O, S, X, and Z)
</div>
<div class="col-sm-6 col-sm-offset-4" style="color: red;">
Revision Y is followed by AA-AY, AY is followed by BA-BY etc. YY is followed by AAA
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Approvers:</label>
<div class="col-sm-6">
@(Html.Kendo().MultiSelect()
.Name("DepartmentIDs")
.BindTo(new SelectList(ViewBag.Departments, "DepartmentID", "DepartmentName"))
.Value(ViewBag.Nothing)
)
</div>
<div class="col-sm-6 col-sm-offset-4" style="color:red;">
ECN: Qualtiy and Dept. Specific<br />PCRB: Quality, Production, Engineering, Dept. Specific (scope of change)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4"></label>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Affected Areas:</label>
<div class="col-sm-6">
@(Html.Kendo().MultiSelect()
.Name("ModuleIDs")
.BindTo(new SelectList(ViewBag.AffectedModules, "ModuleID", "ModuleName"))
.Value(ViewBag.Nothing)
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-3">
<div class="form-group">
<label class="control-label col-sm-4">Category:</label>
<div class="col-sm-6 col-sm-6">
@(Html.Kendo().DropDownListFor(model => model.CategoryID)
.Name("CategoryID")
.DataValueField("CategoryID")
.DataTextField("CategoryName")
.BindTo(ViewBag.Categories)
.OptionLabel("Select Category...")
)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">ITAR/EC:</label>
<div class="col-sm-6 col-sm-6">
@Html.CheckBoxFor(model => model.IsDocEC)
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">ECN/TECN Detail</h5>
</div>
</div>
@{ bool DisableTypeCheckboxes = !(Model.ConvertedFromNumber == null || Model.IsTECN); }
<div class="panel-body bg-warning">
<div class="col-lg-4">
<div class="form-horizontal col-sm-4">
<div class="form-group">
<label class="control-label col-sm-6">ECN:</label>
<div class="form-control-static col-sm-6">
@Html.CheckBoxFor(model => model.IsECN, (DisableTypeCheckboxes ? new { disabled = "disabled" } : null))
</div>
</div>
</div>
<div class="form-horizontal col-sm-4">
<div class="form-group">
<label class="control-label col-sm-6">TECN:</label>
<div class="form-control-static col-sm-6">
@Html.CheckBoxFor(model => model.IsTECN, (DisableTypeCheckboxes ? new { disabled = "disabled" } : null))
</div>
</div>
</div>
<div class="form-horizontal col-sm-4">
<div class="form-group">
<label class="control-label col-sm-6">Emergency:</label>
<div class="form-control-static col-sm-6">
@Html.CheckBoxFor(model => model.IsEmergencyTECN, (DisableTypeCheckboxes ? new { disabled = "disabled" } : null))
</div>
</div>
</div>
</div>
<div class="col-lg-8">
<div class="form-horizontal col-sm-4 col-lg-10">
<div class="form-group">
<label class="control-label col-sm-6 col-lg-3">Expiration Date:</label>
<div class="col-sm-6 col-lg-9">
@(Html.Kendo().DatePickerFor(model => model.ExpirationDate)
.Name("txtExpirationDate")
.HtmlAttributes(new { disabled = "disabled", @type = "", style = "width: 10em;" })
.Format("MM/dd/yyyy")
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-4 col-lg-1"></div>
<div class="form-horizontal col-sm-4 col-lg-1"></div>
</div>
</div>
<div class="panel-body bg-warning">
<div class="col-lg-4">
<div class="form-horizontal col-sm-4">
<div class="form-group">
<label class="control-label col-sm-6" style="padding-left: 0px"># lots affected:</label>
<div class="form-control-static col-sm-6">
@(Html.Kendo().DropDownList()
.Name("NumberOfLotsAffected")
.Items(i =>
{
i.Add().Text("").Value("");
i.Add().Text("NA").Value("NA");
i.Add().Text("< 10").Value("< 10");
i.Add().Text("> 10").Value("> 10");
})
.HtmlAttributes(new { style = "width: 5em;" })
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-4">
<div class="form-group">
<label class="control-label col-sm-6">Recipe Change?</label>
<div class="form-control-static col-sm-6">
@(Html.Kendo().DropDownList()
.Name("RecipeChange")
.Items(i =>
{
i.Add().Text("").Value("");
i.Add().Text("No").Value("False");
i.Add().Text("Yes").Value("True");
})
.HtmlAttributes(new { style = "width: 5em;" })
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-4">
</div>
</div>
<div class="col-lg-8">
<div class="form-horizontal col-sm-4 col-lg-10">
<div class="form-group">
<label class="control-label col-sm-6 col-lg-3">Affected Customers:</label>
<div class="form-control-static col-sm-6 col-lg-9">
@(Html.Kendo().MultiSelect()
.Name("ProductFamilyIDs")
.BindTo(new SelectList(ViewBag.ProductFamilies, "ProductFamilyID", "ProductFamily"))
.HtmlAttributes(new { style = "width: 100%;" })
.Value(Model.ProductFamilyIDs)
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-4 col-lg-1">
</div>
<div class="form-horizontal col-sm-4 col-lg-1">
</div>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-group">
<label class="control-label">Affected Documents:</label>
<div>
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("AttachSave", "ECN", new { ecnNumber = Model.ECNNumber })
.AutoUpload(true)
)
.ShowFileList(false)
.Events(events => events
.Success("onFileUploadSuccess")
.Upload("checkFileType")
.Error("onFileUploadError")
)
)
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.ECNAttachment>()
.Name("Attachments")
.Columns(columns =>
{
columns.Bound(a => a.AttachmentID).Visible(false);
columns.Bound(a => a.ECNNumber).Visible(false);
columns.Bound(a => a.FileName).Template(@<text> @Html.ActionLink(@item.FileName.ToString(), null)</text>);
//.ClientTemplate("<a href='" + GlobalVars.AttachmentUrl + "ECN/#=ECNNumber#/#=FileName#' target='_blank'>#=FileName#</a>");
columns.Bound(a => a.FullName);
columns.Bound(a => a.UploadDate).Format("{0:MM/dd/yy hh:mm:ss}");
columns.Command(command => command.Custom("View").Click("DownloadAttachment"));
columns.Command(command => command.Custom("Delete").Click("deleteAttachment"));
})
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:157px; 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.AttachmentID);
})
.PageSize(50)
.Read(read => read.Action("Attachment_Read", "ECN", new { ecnNumber = Model.ECNNumber }))
.Destroy(destroy => destroy.Action("Attachment_Destroy", "ECN"))
)
)
</div>
</div>
</div>
</div>
<table class="table-condensed" style="width:100%">
<tbody>
<tr>
<td>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">Description of Change</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-12">
@Html.TextAreaFor(model => model.DescriptionOfChange, 15, 30, new { id = "txtDescriptionOfChange", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
</td>
<td>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">Reason For Change</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-12">
@Html.TextAreaFor(model => model.ReasonForChange, 15, 30, new { id = "txtReasonForChange", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="panel panel-default" style="font-size: 10px;">
<div class="panel-info">
<div class="panel-heading">
<h5 style="font-weight:600">Training Notification</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-2">
<div class="form-group" style="display:none;">
<label class="control-label col-sm-4">Acknowledgment:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.AcknowledgementRequired)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Training:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.TrainingRequired)
</div>
</div>
</div>
<div class="form-horizontal col-sm-3">
<div class="form-group" style="display:none;">
<label class="control-label col-sm-4">Acknowledgement Notification to:</label>
<div class="col-sm-8 col-sm-6">
@(Html.Kendo().MultiSelect()
.Name("AcknowledgementByIDs")
.BindTo(new SelectList(ViewBag.AcknowledgementTrainingByIDs, "TrainingGroupID", "TrainingGroupName"))
.Events(e => e.Change("acknowledgeby_change"))
.Value(ViewBag.Nothing)
)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-4">Training Notification to:</label>
<div class="col-sm-8 col-sm-6">
@(Html.Kendo().MultiSelect()
.Name("TrainingByIDs")
.BindTo(new SelectList(ViewBag.AcknowledgementTrainingByIDs, "TrainingGroupID", "TrainingGroupName"))
.Events(e => e.Change("trainingby_change"))
.Value(ViewBag.Nothing)
.HtmlAttributes(new { Readonly = "Readonly" })
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-3" style="display:none;">
<div class="form-group">
<label class="control-label col-sm-4">Area:</label>
<div class="col-sm-8 col-sm-6">
@(Html.Kendo().MultiSelect()
.Name("AreaIDs")
.BindTo(new SelectList(ViewBag.AffectedAreas, "AreaID", "Area"))
.Value(ViewBag.Nothing)
)
</div>
</div>
</div>
<div class="form-horizontal col-sm-4" style="display:none;">
<div class="form-group">
<label class="control-label col-sm-4">Unit Process:</label>
<div class="col-sm-8 col-sm-8">
@(Html.Kendo().MultiSelect()
.Name("TechnologyIDs")
.BindTo(new SelectList(ViewBag.AffectedTechnologies, "TechnologyID", "Technology"))
.Value(ViewBag.Nothing)
)
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info">
<div class="panel-heading">
<h5 style="font-weight:600">Systems</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="col-lg-4">
<div class="form-horizontal col-sm-6 col-lg-5">
<div class="form-group">
<label class="control-label col-sm-6">PCRB Required:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.PCRBRequired)
</div>
</div>
</div>
<div class="form-horizontal col-sm-6 col-lg-7">
<div class="form-group">
<label class="control-label col-sm-6">PCRB#:</label>
<div class="form-control-static col-sm-6">
@Html.TextBoxFor(model => model.PCRBNumber, new { id = "txtPCRBNumber", @class = "k-textbox", @style = "max-width: 100%;" })
@*<button id="GetPCRB" onclick="RedirectToPCRB" style="max-width:100%">Go To PCRB</button>*@
</div>
</div>
</div>
</div>
<div class="col-lg-3">
@*<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-6">Metrology Change:</label>
<div class="form-control-static col-sm-2">
@*Metrology maps to TestProgramChangeRequired
@Html.EditorFor(model => model.TestProgramChangeRequired)
</div>
</div>
</div>*@
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-6">Metrology Change:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.MetrologyChangeRequired)
</div>
</div>
</div>
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-6">SPC Change:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.SPCChangeRequired)
</div>
</div>
</div>
</div>
<div class="col-lg-3">
@*<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-6">New Part Flow:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.NewPartFlowRequired)
</div>
</div>
</div>*@
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label class="control-label col-sm-6">FI Change:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.FIChangeRequired)
</div>
</div>
</div>
</div>
<div class="col-lg-2">
<div class="form-horizontal col-sm-6 col-lg-10">
<div class="form-group">
<label class="control-label col-sm-6">OI Change:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.SPNChangeRequired)
</div>
</div>
</div>
</div>
</div>
</div>
@*<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">Implementation Details</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-12">
<div>
@Html.TextAreaFor(model => model.ImplementationDetails, 15, 30, new { id = "txtImplementationDetails", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
</div>*@
<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">Change Impact</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-3">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">Impact On ESH:</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Positive:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.ImpactOnEnvironment, 1)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Negative:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.ImpactOnEnvironment, 2)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">N/A:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.ImpactOnEnvironment, 3)
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
@Html.TextAreaFor(model => model.ImpactOnEnvironmentDescription, 5, 30, new { id = "txtImpactOnEnvironmentDescription", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
<div class="form-horizontal col-sm-3">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">Impact On Capacity:</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Yes:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.ImpactOnCapacity, 1)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">No:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.ImpactOnCapacity, 0)
</div>
</div>
<div class="form-group">
<label class="col-sm-12 pull-left">If yes, what is the impact?</label>
<div class="col-sm-10">
@Html.TextAreaFor(model => model.ImpactOnCapacityDescription, 5, 30, new { id = "txtImpactOnCapacityDescription", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
@*<div class="form-horizontal col-sm-3">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">Affected Parts:</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">MA:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.IsMA)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">RH(ITAR):</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.IsRH)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">AU:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.IsAU)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Industrial:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.IsIndustrial)
</div>
</div>
</div>*@
<div class="form-horizontal col-sm-3">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">Material Consumption Change:</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Yes:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.MaterialConsumptionChangeRequired, 1)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">No:</label>
<div class="form-control-static col-sm-2">
@Html.RadioButtonFor(model => model.MaterialConsumptionChangeRequired, 0)
</div>
</div>
<div class="form-group">
<label class="col-sm-3">Description</label>
<div class="col-sm-10">
@Html.TextAreaFor(model => model.MaterialConsumptionChangeDescription, 5, 30, new { id = "txtMaterialConsumptionChangeDescription", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>
@*<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading" >
<h5 style="font-weight:600">Description Of Change</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-6">
<div class="form-group">
<div class="col-sm-10">
@Html.TextAreaFor(model => model.DescriptionOfChange, 5, 30, new { id = "txtDescriptionOfChange", @class = "form-control", style = "font-size: 11px;width: 100%;" })
</div>
</div>
</div>
</div>
</div>*@
@*<div class="panel panel-default" style="font-size: 10px">
<div class="panel-info" style="font-size: 11px">
<div class="panel-heading">
<h5 style="font-weight:600">Implementation</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">How will the change be implemented?One box must be checked:</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Not a flow change:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.NotAFlowChange)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">Attach ECN/TECNs to Lots:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.AttachECN_TECNToLots)
</div>
</div>
</div>
<div class="form-horizontal col-sm-6">
<div class="form-group">
<label style="font-weight:bolder; font-size:small">SPN Changes are applied to all lots in process</label>
</div>
<div class="form-group">
<label class="control-label col-sm-3">SPN flow change at Single Step</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.SPNFlowChangeAtSingleStep)
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">SPN flow change at Multiple Step:</label>
<div class="form-control-static col-sm-2">
@Html.EditorFor(model => model.SPNFlowChangeAtMultipleSteps)
</div>
</div>
</div>
</div>
</div>*@
<div class="panel panel-default" style="font-size: 10px">
<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>
}
</div>
<div class="panel-body bg-warning">
<div class="col-sm-offset-0">
@if (Session[GlobalVars.IS_ADMIN] != null)
{
if ((bool)Session[GlobalVars.IS_ADMIN] && (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", "ECN", new { issueID = Model.ECNNumber, step = Model.CurrentStep, isTECN = Model.IsTECN, isEmergrncyTECN = Model.IsEmergencyTECN }))
)
.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", "ECN", new { issueID = Model.ECNNumber, step = Model.CurrentStep, isTECN = Model.IsTECN, isEmergrncyTECN = Model.IsEmergencyTECN }))
)
.Resizable(resize => resize.Columns(true))
)
}
}
</div>
</div>
</div>
}
</body>
<div class="modal fade" id="ApprovalLogHistoryWin" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Approval Log History</h4>
</div>
<div class="modal-body">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.ApprovalLogHistory>()
.Name("ApprovalLogHistory")
.Columns(columns =>
{
columns.Bound(a => a.ApprovalLogID).Visible(false);
columns.Bound(a => a.FullName);
columns.Bound(a => a.SubRole);
columns.Bound(a => a.Operation);
columns.Bound(a => a.OperationTime).Format("{0:MM/dd/yy hh:mm:ss}");
columns.Bound(a => a.Comments);
})
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:300px; width:100%; font-size: 12px" })
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ApprovalLogID);
})
.PageSize(50)
.Read(read => read.Action("ApprovalLogHistory_Read", "ECN", new { ecnNumber = Model.ECNNumber }))
)
)
</div>
<div class="modal-footer">
<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="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>
<div class="modal fade" id="EECNApproversWin" 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 Approvers for :</h4>
</div>
<table border="0" cellpadding="4" cellspacing="4">
<tr>
<td>
<div id='lstAllUsers'>
</div>
</td>
<td>
&nbsp;&nbsp;
</td>
<td>
<table>
<tr>
<td>
<table>
<tr>
<td valign="bottom">
<input type="button" value=">>" class="btn btn-primary btn-xs" id="addEngineering" />
</td>
</tr>
<tr>
<td valign="top">
<br />
<input type="button" value="<<" class="btn btn-primary btn-xs" id="removeEngineering" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
&nbsp;&nbsp;
</td>
</tr>
<tr>
<td>
&nbsp;&nbsp;
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td valign="bottom">
<br />
<input type="button" value=">>" class="btn btn-primary btn-xs" id="addOperations" />
</td>
</tr>
<tr>change
<td valign="top">
<br />
<input type="button" value="<<" class="btn btn-primary btn-xs" id="removeOperations" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td>
&nbsp;&nbsp;
</td>
<td>
<table>
<tr>
<td>
Engineering:
</td>
</tr>
<tr>
<td>
<div id='lstEngineeringUsers'>
</div>
</td>
</tr>
<tr>
<td>
Operations:
</td>
</tr>
<tr>
<td>
<div id='lstOperationsUsers'>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="eecnApprovalConfirm">Confirm Additional Approver</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="timeout" tabindex="0" role="dialog" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog modal-lg" style="width:500px;">
<div class="modal-content">
<div class="modal-header" style="background-color: #fce0a3;">
<h3 class="modal-title">Page About To Timeout</h3>
</div>
<div class="modal-body" style="background-color: crimson; font-size: 20px; color:white">
You will automatically be redirected to your Home Page in 1 minute.<br />
To remain on this page please close this window or press the ESC key.
</div>
<div class="modal-footer" style="background-color: #fce0a3; ">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@Html.Partial("_ECNReassignOriginator")
<script type="text/javascript">
var docType;
var saveSuccessful = false;
var enumDocumentType = {
ECN: 3,
EECN: 4
}
$(document).ready(function () {
// on load ============================================
if ($('#IsEmergencyTECN').is(":checked")) {
docType = 4; //document type = Emergency TECN
//$('#txtExpirationDate').data('kendoDatePicker').readonly(true);
}
else if ($('#IsECN').is(":checked") || $('#IsTECN').is(":checked")) {
docType = 3; //document type = ECN/TECN
}
//RJK ITAR/EC)
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
// Events =============================================
$('#IsECN').on('change', function () {
if ($('#IsECN').is(":checked")) {
docType = 3; //document type = ECN/TECN
$('#txtExpirationDate').data('kendoDatePicker').value("");
$('#txtExpirationDate').data('kendoDatePicker').readonly(true);
$('#IsTECN').prop('checked', false);
$('#IsEmergencyTECN').prop('checked', false);
//$('#txtExtensionDate').data('kendoDatePicker').value("");
//$('#txtExtensionDate').data('kendoDatePicker').readonly(true);
}
})
//RJK ITAR/EC)
$('#IsDocEC').on('change', function () {
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
})
$('#IsRH').on('change', function () {
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
})
$('#IsAU').on('change', function () {
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
})
$('#IsMA').on('change', function () {
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
})
$('#IsIndustrial').on('change', function () {
CheckIsRHAndEC() ? disableAcknowledgementSection() : enableAcknowledgementSection()
})
$('#IsTECN').on('change', function () {
if ($('#IsTECN').is(":checked")) {
docType = 3; //document type = ECN/TECN
$('#txtExpirationDate').data('kendoDatePicker').value("");
$('#txtExpirationDate').data('kendoDatePicker').readonly(false);
$('#IsECN').prop('checked', false);
$('#IsEmergencyTECN').prop('checked', false);
}
})
$('#IsEmergencyTECN').on('change', function () {
if ($('#IsEmergencyTECN').is(":checked")) {
docType = 4; //document type = Emergency TECN
setETECNExpiration();
$('#IsECN').prop('checked', false);
$('#IsTECN').prop('checked', false);
}
else
{
$('#txtExpirationDate').data('kendoDatePicker').readonly(false);
$('#txtExpirationDate').data('kendoDatePicker').value("");
//$('#txtExtensionDate').data('kendoDatePicker').readonly(false);
}
})
$('#NewPartFlowRequired').on('change', function () {
if ($('#NewPartFlowRequired').is(":checked")) {
$('#SPNChangeRequired').prop('checked', true);
}
})
$('#TrainingRequired').on('change', function () {
if ($('#TrainingRequired').is(":checked")) {
$("#TrainingByIDs").data("kendoMultiSelect").readonly(false);
$('#AcknowledgementRequired').prop('checked', false);
}
if (!$('#TrainingRequired').is(":checked")) {
$("#TrainingByIDs").data("kendoMultiSelect").value("");
$("#TrainingByIDs").data("kendoMultiSelect").readonly(true);
}
});
$('#AcknowledgementRequired').on('change', function () {
if ($('#AcknowledgementRequired').is(":checked")) {
$('#TrainingRequired').prop('checked', false);
}
});
//=====================================================
var acknowledgementRequired;
if ($('#AcknowledgementRequired').is(':checked'))
acknowledgementRequired = 1
else
acknowledgementRequired = 0;
var trainingRequired;
if ($('#TrainingRequired').is(':checked'))
trainingRequired = 1;
else
trainingRequired = 0;
var trainingby = $("#TrainingByIDs").data("kendoMultiSelect").value();
var acknowledgeby = $("#AcknowledgementByIDs").data("kendoMultiSelect").value();
$("div.k-multiselect-wrap input.k-input").attr("autocomplete", "off");
});
function CheckIsRHAndEC() {
return (
(
($('#IsDocEC').is(':checked'))
)
||
(
($('#IsRH').is(':checked'))
&&
(!$('#IsMA').is(':checked') && !$('#IsAU').is(':checked') && !$('#IsIndustrial').is(':checked'))
)
);
}
function disableAcknowledgementSection() {
//$('#AcknowledgementRequired').prop('checked', false)
//$('#AcknowledgementRequired').prop('disabled', true)
//$('#AcknowledgementByIDs').data("kendoMultiSelect").value('');
//$('#AcknowledgementByIDs').data("kendoMultiSelect").readonly(true);
//$('#AreaIDs').data("kendoMultiSelect").value('');
//$('#AreaIDs').data("kendoMultiSelect").readonly(true);
//$('#TechnologyIDs').data("kendoMultiSelect").value('');
//$('#TechnologyIDs').data("kendoMultiSelect").readonly(true);
}
function enableAcknowledgementSection() {
//$('#AcknowledgementRequired').prop('disabled', false)
//$('#AcknowledgementByIDs').data("kendoMultiSelect").readonly(false);
//$('#AreaIDs').data("kendoMultiSelect").readonly(false);
//$('#TechnologyIDs').data("kendoMultiSelect").readonly(false);
}
function acknowledgeby_change(e) {
}
function trainingby_change(e) {
};
$('#ApprovalLogHistoryData').on('click', function () {
$("#ApprovalLogHistoryWin").modal('show');
return false;
})
$('form').submit(function (e) {
e.preventDefault();
saveData();
return false;
});
// Get the Responsibilty issue
$("#Area").change(function () {
$.ajax({
url: '@Url.Action("GetTechnology", "ECN")',
type: "Post",
data: { area: $("#Area").val() },
success: function (listItems) {
var ddl = $('#Technology').data("kendoDropDownList");
ddl.setDataSource(listItems);
},
error: function (result) {
alert("Failed " + result);
}
});
});
var saveData = function () {
saveSuccessful = false;
isDirty = false;
var ecnNumber = $("#txtECNNumber").val();
var title = $("#txtTitle").val();
var departments = $("#DepartmentIDs").data("kendoMultiSelect").value();
var moduleIDs = $("#ModuleIDs").data("kendoMultiSelect").value();
// var acknowledgementByIDs = $("#AcknowledgementByIDs").data("kendoMultiSelect").value();
var trainingByIDs = $("#TrainingByIDs").data("kendoMultiSelect").value();
//var areaIDs = $("#AreaIDs").data("kendoMultiSelect").value();
//var technologyIDs = $("#TechnologyIDs").data("kendoMultiSelect").value();
var productFamilyIDs = $("#ProductFamilyIDs").data("kendoMultiSelect").value();
var isECN;
if ($('#IsECN').is(':checked'))
isECN = 1;
else
isECN = 0;
var isTECN;
if ($('#IsTECN').is(':checked'))
isTECN = 1;
else
isTECN = 0;
var isEmergencyTECN
if ($('#IsEmergencyTECN').is(':checked'))
isEmergencyTECN = 1;
else
isEmergencyTECN = 0;
var expirationDate = $('#txtExpirationDate').val();
//var extensionDate = $('#txtExtensionDate').val();
var extensionDate = null;
//var cancellationDate = $('#txtCancellationDate').val();
var cancellationDate = null;
var acknowledgementRequired = 0;
//if ($('#AcknowledgementRequired').is(':checked'))
// acknowledgementRequired = 1
//else
// acknowledgementRequired = 0;
var trainingRequired;
if ($('#TrainingRequired').is(':checked'))
trainingRequired = 1;
else
trainingRequired = 0;
var area = $('#Area').val();
var technology = $('#Technology').val();
var pcrbRequired;
if ($('#PCRBRequired').is(':checked'))
pcrbRequired = 1;
else
pcrbRequired = 0;
var prcbNumber = $('#txtPCRBNumber').val();
//var testProgramChangeRequired;
//if ($('#TestProgramChangeRequired').is(':checked'))
// testProgramChangeRequired = 1;
//else
// testProgramChangeRequired = 0;
var metrologyChangeRequired;
if ($('#MetrologyChangeRequired').is(':checked'))
metrologyChangeRequired = 1;
else
metrologyChangeRequired = 0;
var spcChangeRequired;
if ($('#SPCChangeRequired').is(':checked'))
spcChangeRequired = 1;
else
spcChangeRequired = 0;
var newPartFlowRequired;
if ($('#NewPartFlowRequired').is(':checked'))
newPartFlowRequired = 1;
else
newPartFlowRequired = 0;
var spnChangeRequired;
if ($('#SPNChangeRequired').is(':checked'))
spnChangeRequired = 1;
else
spnChangeRequired = 0;
var fiChangeRequired;
if ($('#FIChangeRequired').is(':checked'))
fiChangeRequired = 1;
else
fiChangeRequired = 0;
var implementationDetails = $("#txtImplementationDetails").val();
// radio button
var impactOnEnvironment = $('input[name=ImpactOnEnvironment]:checked').val();
//alert(ecnNumber);
var impactOnEnvironmentDescription = $("#txtImpactOnEnvironmentDescription").val();
// radio button
var impactOnCapacity = $('input[name=ImpactOnCapacity]:checked').val();
var impactOnCapacityDescription = $("#txtImpactOnCapacityDescription").val();
//RJK ITAR/EC
var isDocEC = ($('#IsDocEC').is(':checked')) ? 1 : 0;
var isMA = ($('#IsMA').is(':checked')) ? 1 : 0;
var isRH;
if ($('#IsRH').is(':checked'))
isRH = 1;
else
isRH = 0;
var isAU;
if ($('#IsAU').is(':checked'))
isAU = 1;
else
isAU = 0;
var isIndustrial;
if ($('#IsIndustrial').is(':checked'))
isIndustrial = 1;
else
isIndustrial = 0;
var materialConsumptionChangeRequired;
if ($('#MaterialConsumptionChangeRequired').is(':checked'))
materialConsumptionChangeRequired = 1;
else
materialConsumptionChangeRequired = 0;
var materialConsumptionChangeDescription = $("#txtMaterialConsumptionChangeDescription").val();
var reasonForChange = $("#txtReasonForChange").val();
var descriptionOfChange = $("#txtDescriptionOfChange").val();
var notAFlowChange;
if ($('#NotAFlowChange').is(':checked'))
notAFlowChange = 1;
else
notAFlowChange = 0;
var attachECN_TECNToLots;
if ($('#AttachECN_TECNToLots').is(':checked'))
attachECN_TECNToLots = 1;
else
attachECN_TECNToLots = 0;
var spnFlowChangeAtSingleStep;
if ($('#SPNFlowChangeAtSingleStep').is(':checked'))
spnFlowChangeAtSingleStep = 1;
else
spnNFlowChangeAtSingleStep = 0;
var spnFlowChangeAtMultipleSteps;
if ($('#SPNFlowChangeAtMultipleSteps').is(':checked'))
spnFlowChangeAtMultipleSteps = 1;
else
spnFlowChangeAtMultipleSteps = 0;
//return false;
//alert("Saving...");
var categoryId = $("#CategoryID").data("kendoDropDownList").value();
var numberOfLotsAffected = $("#NumberOfLotsAffected").data("kendoDropDownList").value();
var recipeChange = null;
if ($('#RecipeChange').data("kendoDropDownList").value().toLowerCase() === "true") {
recipeChange = 1;
}
if ($('#RecipeChange').data("kendoDropDownList").value().toLowerCase() === "false") {
recipeChange = 0;
}
$.ajax({
url: '/ECN/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(
{
ECNNumber: ecnNumber,
Title: title,
DepartmentIDs: departments,
ModuleIDs: moduleIDs,
IsECN: isECN,
IsTECN:isTECN,
IsEmergencyTECN: isEmergencyTECN,
ExpirationDate: expirationDate,
ExtensionDate: extensionDate,
CancellationDate: cancellationDate,
AcknowledgementRequired: acknowledgementRequired,
//AcknowledgementByIDs: acknowledgementByIDs,
TrainingRequired: trainingRequired,
TrainingByIDs: trainingByIDs,
//AreaIDs: areaIDs,
//TechnologyIDs: technologyIDs,
PCRBRequired: pcrbRequired,
PCRBNumber: prcbNumber,
TestProgramChangeRequired: 0,
MetrologyChangeRequired: metrologyChangeRequired,
SPCChangeRequired: spcChangeRequired,
NewPartFlowRequired: newPartFlowRequired,
SPNChangeRequired: spnChangeRequired,
ImplementationDetails:implementationDetails ,
ImpactOnEnvironment: impactOnEnvironment,
ImpactOnEnvironmentDescription: impactOnEnvironmentDescription,
ImpactOnCapacity : impactOnCapacity ,
ImpactOnCapacityDescription: impactOnCapacityDescription,
IsMA: isMA,
IsRH: isRH,
IsAU: isAU,
IsIndustrial: isIndustrial,
MaterialConsumptionChangeRequired: materialConsumptionChangeRequired,
MaterialConsumptionChangeDescription: materialConsumptionChangeDescription,
ReasonForChange: reasonForChange,
DescriptionOfChange: descriptionOfChange,
NotAFlowChange: notAFlowChange,
AttachECN_TECNToLots: attachECN_TECNToLots,
SPNFlowChangeAtSingleStep: spnFlowChangeAtSingleStep,
SPNFlowChangeAtMultipleSteps: spnFlowChangeAtMultipleSteps,
CategoryId: categoryId,
FIChangeRequired: fiChangeRequired,
NumberOfLotsAffected: numberOfLotsAffected,
RecipeChange: recipeChange,
ProductFamilyIDs: productFamilyIDs,
//RJK ITAR/EC
IsDocEC: isDocEC
}),
success: function (result) {
//alert("success " + result.UserName);
alert("Data Saved");
saveSuccessful = true;
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status = 401) {
}
else {
alert("Failed too" + jqXHR.responseText);
}
}
});
}
$('#SubmitDocument').on('click', function () {
saveSuccessful = false;
isDirty = false;
var error = '';
var ecnNumber = $("#txtECNNumber").val();
var departments = $("#DepartmentIDs").data("kendoMultiSelect").value();
var moduleIDs = $("#ModuleIDs").data("kendoMultiSelect").value();
//var areaIDs = $("#AreaIDs").data("kendoMultiSelect").value();
//var technologyIDs = $("#TechnologyIDs").data("kendoMultiSelect").value();
//var acknowledgementByIDs = $("#AcknowledgementByIDs").data("kendoMultiSelect").value();
var trainingByIDs = $("#TrainingByIDs").data("kendoMultiSelect").value();
var productFamilyIDs = $("#ProductFamilyIDs").data("kendoMultiSelect").value();
var title = $("#txtTitle").val();
//var cancellationDate = $('#txtCancellationDate').val();
var cancellationDate = null;
var isECN;
if ($('#IsECN').is(':checked'))
isECN = 1;
else
isECN = 0;
var isTECN;
if ($('#IsTECN').is(':checked'))
isTECN = 1;
else
isTECN = 0;
var isEmergencyTECN
if ($('#IsEmergencyTECN').is(':checked'))
isEmergencyTECN = 1;
else
isEmergencyTECN = 0;
expirationDate = $('#txtExpirationDate').val();
//extensionDate = $('#txtExtensionDate').val();
extensionDate = null;
var acknowledgementRequired = 0;
//if ($('#AcknowledgementRequired').is(':checked'))
// acknowledgementRequired = 1
//else
// acknowledgementRequired = 0;
var trainingRequired;
if ($('#TrainingRequired').is(':checked'))
trainingRequired = 1;
else
trainingRequired = 0;
var area = $('#Area').val();
var technology = $('#Technology').val();
var pcrbRequired;
if ($('#PCRBRequired').is(':checked'))
pcrbRequired = 1;
else
pcrbRequired = 0;
var prcbNumber = $('#txtPCRBNumber').val();
//var testProgramChangeRequired;
//if ($('#TestProgramChangeRequired').is(':checked'))
// testProgramChangeRequired = 1;
//else
// testProgramChangeRequired = 0;
var metrologyChangeRequired;
if ($('#MetrologyChangeRequired').is(':checked'))
metrologyChangeRequired = 1;
else
metrologyChangeRequired = 0;
var spcChangeRequired;
if ($('#SPCChangeRequired').is(':checked'))
spcChangeRequired = 1;
else
spcChangeRequired = 0;
var newPartFlowRequired;
if ($('#NewPartFlowRequired').is(':checked'))
newPartFlowRequired = 1;
else
newPartFlowRequired = 0;
var spnChangeRequired;
if ($('#SPNChangeRequired').is(':checked'))
spnChangeRequired = 1;
else
spnChangeRequired = 0;
var fiChangeRequired;
if ($('#FIChangeRequired').is(':checked'))
fiChangeRequired = 1;
else
fiChangeRequired = 0;
var implementationDetails = $("#txtImplementationDetails").val();
// radio button
var impactOnEnvironment = $('input[name=ImpactOnEnvironment]:checked').val();
//alert(ecnNumber);
var impactOnEnvironmentDescription = $("#txtImpactOnEnvironmentDescription").val();
// radio button
var impactOnCapacity = $('input[name=ImpactOnCapacity]:checked').val();
var impactOnCapacityDescription = $("#txtImpactOnCapacityDescription").val();
var isMA;
if ($('#IsMA').is(':checked'))
isMA = 1;
else
isMA = 0;
var isRH;
if ($('#IsRH').is(':checked'))
isRH = 1;
else
isRH = 0;
var isAU;
if ($('#IsAU').is(':checked'))
isAU = 1;
else
isAU = 0;
var isIndustrial;
if ($('#IsIndustrial').is(':checked'))
isIndustrial = 1;
else
isIndustrial = 0;
var materialConsumptionChangeRequired;
if ($('#MaterialConsumptionChangeRequired').is(':checked'))
materialConsumptionChangeRequired = 1;
else
materialConsumptionChangeRequired = 0;
var materialConsumptionChangeDescription = $("#txtMaterialConsumptionChangeDescription").val();
var reasonForChange = $("#txtReasonForChange").val();
var descriptionOfChange = $("#txtDescriptionOfChange").val();
var notAFlowChange;
if ($('#NotAFlowChange').is(':checked'))
notAFlowChange = 1;
else
notAFlowChange = 0;
var attachECN_TECNToLots;
if ($('#AttachECN_TECNToLots').is(':checked'))
attachECN_TECNToLots = 1;
else
attachECN_TECNToLots = 0;
var spnFlowChangeAtSingleStep;
if ($('#SPNFlowChangeAtSingleStep').is(':checked'))
spnFlowChangeAtSingleStep = 1;
else
spnNFlowChangeAtSingleStep = 0;
var spnFlowChangeAtMultipleSteps;
if ($('#SPNFlowChangeAtMultipleSteps').is(':checked'))
spnFlowChangeAtMultipleSteps = 1;
else
spnFlowChangeAtMultipleSteps = 0;
var numberOfLotsAffected = $("#NumberOfLotsAffected").data("kendoDropDownList").value();
var recipeChange = null;
if ($('#RecipeChange').data("kendoDropDownList").value().toLowerCase() === "true") {
recipeChange = 1;
}
if ($('#RecipeChange').data("kendoDropDownList").value().toLowerCase() === "false") {
recipeChange = 0;
}
//return false;
//alert("Saving...");
//You need to indicate whether the document is ano ECN, TECN or an Emergency TECN
if (isECN == 0 && isTECN == 0 && isEmergencyTECN == 0) {
error += 'You need to indicate whether the document is an ECN, TECN or an Emergency TECN \n';
}
// The document can either be an [ECN] or a [TECN] or an [Emergency TECN]
if (
(isECN == 1 && isTECN == 1 && isEmergencyTECN == 1)
||
(isECN == 1 && isTECN == 1)
||
(isECN == 1 && isEmergencyTECN == 1)
||
(isTECN == 1 && isEmergencyTECN == 1)
) {
error += 'The document can either be an [ECN] or a [TECN] or an [Emergency TECN] \n';
}
if (notAFlowChange == 0 && attachECN_TECNToLots == 0 && spnFlowChangeAtSingleStep == 0 && spnFlowChangeAtMultipleSteps == 0)
{
error += 'You need to specify either it is [Not a flow change] or [Attach ECN/TECN to lots] or [SPN Flow Change At Multiple Steps] or [SPN Flow Change At Multiple Steps] \n';
}
if (departments.length == 0) {
error += "At least one [Approvers] needs to be selected\n";
}
//if (acknowledgementRequired == 1 && acknowledgementByIDs.length == 0){
// error += "Please select at least value from [Acknowlegement By] list \n";
//}
if (document.getElementById("ModuleIDs").value == '') {
error += "Please select an affected area. \n";
}
//alert(expirationDate);
if ((isTECN || isEmergencyTECN) && expirationDate == '')
error += "Please enter an expiration date for this TECN \n";
var days = returnNoOfDays();
if (isTECN && days > 90)
error += "TECN can only be valid for a maximum of 90 days\n";
if (pcrbRequired == 1 && prcbNumber == '') {
error += "You need to enter a PCRB Number if PCRB box is checked\n";
}
if (acknowledgementRequired == 1 || trainingRequired == 1) {
//alert($("#AcknowledgementByIDs").data("kendoMultiSelect").text());
//if (acknowledgementByIDs.indexOf("1") >= 0 || trainingByIDs.indexOf("1") >= 0) // operations
//{
// if (technologyIDs.length == 0 || areaIDs.length == 0) {
// error += "You need to select [Area] and [Unit Process] \n";
// }
//}
//else if (areaIDs.length == 0) {
// error += "You need to select [Area] \n";
//}
//if (technologyIDs.length == 0 || areaIDs.length == 0) {
// error += "You need to select [Area] and [Unit Process] \n";
//}
}
if (title == '')
error += 'Please enter a Title for the document before submitting\n';
var categoryId = $("#CategoryID").data("kendoDropDownList").value();
if (categoryId < 1)
error += "Category must be specified\n";
if (numberOfLotsAffected == null || numberOfLotsAffected == "") {
error += "# lots affected must be specified\n";
}
if (recipeChange == null)
error += "Recipe Change must be specified\n";
if ((numberOfLotsAffected != null && numberOfLotsAffected.toLowerCase() != "na") ||
(recipeChange == 1)) {
if (productFamilyIDs.length == 0) {
error += "At least one affected customer must be selected\n";
}
}
if (trainingRequired && trainingByIDs.length <= 0) {
error += "Training Required is selected, but no groups have been chosen.\n";
}
if (!trainingRequired && trainingByIDs.length > 0) {
error += "Training groups are selected, but the flag has been set.\n";
}
if (error != '')
{
alert("Before Submitting the document..... \n" + error);
return false;
}
$.ajax({
url: '/ECN/Edit',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(
{
ECNNumber: ecnNumber,
Title: title,
DepartmentIDs: departments,
ModuleIDs: moduleIDs,
IsECN: isECN,
IsTECN: isTECN,
IsEmergencyTECN: isEmergencyTECN,
ExpirationDate: expirationDate,
ExtensionDate: extensionDate,
CancellationDate: cancellationDate,
AcknowledgementRequired: acknowledgementRequired,
//AcknowledgementByIDs: acknowledgementByIDs,
TrainingRequired: trainingRequired,
TrainingByIDs: trainingByIDs,
//AreaIDs: areaIDs,
//TechnologyIDs: technologyIDs,
//AreaID: area,
//TechnologyID: technology,
PCRBRequired: pcrbRequired,
PCRBNumber: prcbNumber,
TestProgramChangeRequired: 0,
MetrologyChangeRequired: metrologyChangeRequired,
SPCChangeRequired: spcChangeRequired,
NewPartFlowRequired: newPartFlowRequired,
SPNChangeRequired: spnChangeRequired,
ImplementationDetails: implementationDetails,
ImpactOnEnvironment: impactOnEnvironment,
ImpactOnEnvironmentDescription: impactOnEnvironmentDescription,
ImpactOnCapacity: impactOnCapacity,
ImpactOnCapacityDescription: impactOnCapacityDescription,
IsMA: isMA,
IsRH: isRH,
IsAU: isAU,
IsIndustrial: isIndustrial,
MaterialConsumptionChangeRequired: materialConsumptionChangeRequired,
MaterialConsumptionChangeDescription: materialConsumptionChangeDescription,
ReasonForChange: reasonForChange,
DescriptionOfChange: descriptionOfChange,
NotAFlowChange: notAFlowChange,
AttachECN_TECNToLots: attachECN_TECNToLots,
SPNFlowChangeAtSingleStep: spnFlowChangeAtSingleStep,
SPNFlowChangeAtMultipleSteps: spnFlowChangeAtMultipleSteps,
CategoryID: categoryId,
FIChangeRequired: fiChangeRequired,
NumberOfLotsAffected: numberOfLotsAffected,
RecipeChange: recipeChange,
ProductFamilyIDs: productFamilyIDs
}),
success: function (result) {
//alert("success " + result.UserName);
submitForApproval();
},
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status = 401) {
}
else {
alert("Failed too" + jqXHR.responseText);
}
}
});
})
var submitForApproval = function () {
if (docType == enumDocumentType.EECN) {
var url = "/ECN/GetAllUsersList";
var source =
{
datatype: "json",
datafields: [
{ name: 'UserID' },
{ name: 'FullName' }
],
id: 'id',
url: url,
};
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxListBox
$("#lstAllUsers").jqxListBox({
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 250
});
displayUserRoles(-1);
$("#EECNApproversWin").modal('show');
}
else {
var ecnTypeString = '';
if ($('#IsECN').is(':checked')) {
ecnTypeString = "ECN"
}
else if ($('#IsTECN').is(':checked')) {
ecnTypeString = "TECN"
}
else if ($('#IsEmergencyTECN').is(':checked')) {
ecnTypeString = "E-TECN"
}
$.ajax({
url: "/ECN/CheckCanSubmit",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val()
},
success: function () {
$.ajax({
url: "/ECN/SubmitDocument",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
documentType: docType,
ecnTypeString: ecnTypeString
},
success: function (data) {
if (data == 'Redirect') {
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
}
else if (data == 'ITAR') {
alert('You are not Authorized to submit this document as it contains ITAR data');
}
else {
// TODO alert an error message
}
},
error: function (result) {
alert("Server/Netork Error occured... Please resubmit again");
}
});
},
error: function (result) {
alert("Cannot submit the document as the TECN that this was derived from, is in the Process of being extended");
return;
}
});
}
}
/*File attachments ===========================================================================================*/
function deleteAttachment(e) {
e.preventDefault();
if (confirm("Are you sure you want to delete this request?")) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var fileName = dataItem.FileName;
var attachmentID = dataItem.AttachmentID;
$.ajax({
url: "/ECN/DeleteAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID,
fileName: fileName,
ecnNumber: $('#txtECNNumber').val()
},
success: function (data) {
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read($('#txtECNNumber').val());
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function onFileUploadSuccess(e) {
//alert(e.message);
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read($('#txtECNNumber').val());
}
function onFileUploadError(e) {
alert("Error Uploading File!!! " + e.XMLHttpRequest.responseText);
var grid = $("#Attachments").data("kendoGrid");
grid.dataSource.read($('#txtECNNumber').val());
}
function checkFileType(e) {
var files = e.files;
$.each(files, function () {
if (!this.extension.toLowerCase().match(/^(.doc|.docx|.ppt|.pptx|.xls|.xlsx|.xlsm|.pdf|.gif|.jpeg|.jpg|.bmp|.png|.txt|.slddrw|.sldprt)$/)) {
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
e.preventDefault();
}
});
}
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);
}
}
$('#ApproveDocument').on('click', function () {
$('#submitApprovalComments').attr("disabled", false);
// Save the document first if it was changed
//if (isDirty == 'true') {
// isDirty = 'false';
$("form:first").trigger("submit");
//}
$("#ApprovalComments").modal('show');
return false;
});
$('#submitApprovalComments').on('click', function () {
$('#submitApprovalComments').attr("disabled", true);
var ecnTypeString = '';
if ($('#IsECN').is(':checked'))
ecnTypeString = "ECN"
else if ($('#IsTECN').is(':checked')) {
ecnTypeString = "TECN"
}
else if ($('#IsEmergencyTECN').is(':checked'))
ecnTypeString = "E-TECN"
$.ajax({
url: "/ECN/Approve",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
currentStep: $("#currentStep").val(),
comments: $("#approvalComments").val(),
documentType: docType,
ecnTypeString: ecnTypeString
},
success: function (data) {
$("#ApprovalComments").modal('hide');
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
$('#submitApprovalComments').attr("disabled", false);
alert("Server error, Please Approve the document again");
}
});
});
$('#RejectDocument').on('click', function () {
// Save the document first if it was changed
$('#RejectDocument').attr("disabled", false);
//if (isDirty == 'true') {
//isDirty = 'false';
$("form:first").trigger("submit");
//}
$("#RejectComments").modal('show');
return false;
});
$('#submitRejectComments').on('click', function () {
$('#RejectDocument').attr("disabled", true);
var ecnTypeString = '';
if ($('#IsECN').is(':checked'))
ecnTypeString = "ECN"
else if ($('#IsTECN').is(':checked'))
ecnTypeString = "TECN"
else if ($('#IsEmergencyTECN').is(':checked'))
ecnTypeString = "E-TECN"
$.ajax({
url: "/ECN/Reject",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
currentStep: $("#currentStep").val(),
comments: $("#rejectComments").val(),
docType: docType,
ecnTypeString: ecnTypeString
},
success: function (data) {
$("#RejectComments").modal('hide');
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
$('#submitRejectComments').attr("disabled", false);
alert("Server error, Please Reject the document again");
}
});
});
function showReAssignRole(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$('#ReAssignApproverFromLabel').text(dataItem.FullName);
var issueID = $("#txtECNNumber").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 searchText = ($("#txtSearch").val());
var url = "/ECN/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 = '/ECN/ReAssignApproverByAdmin';
//if (arrayOfValues.length == 0)
// return false;
//var isRH;
//if ($('#IsRH').is(':checked'))
// isRH = 1;
//else
// isRH = 0;
var ecnTypeString = '';
if ($('#IsECN').is(':checked'))
ecnTypeString = "ECN"
else if ($('#IsTECN').is(':checked'))
ecnTypeString = "TECN"
else if ($('#IsEmergencyTECN').is(':checked'))
ecnTypeString = "E-TECN"
$.ajax({
type: "Post",
url: urlString,
data: {
issueID: $("#txtECNNumber").val(),
reAssignApproverFrom: reAssignFromUserid,
reAssignApproverTo: userids,
step: $("#currentStep").val(),
docType: docType,
ecnTypeString: ecnTypeString
},
success: function (result) {
//var grid = $("#ApproversList").data("kendoGrid");
//grid.dataSource.read($('#txtECNNumber').val(), $("#currentStep").val());
var url = '@Url.Action("Edit", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
}
});
};
//Region Additional Aprovers
$('#additionalApprovers').on('click', function () {
var searchText = ($("#txtSearch").val());
var url = "/ECN/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 ecnTypeString = '';
if ($('#IsECN').is(':checked'))
ecnTypeString = "ECN"
else if ($('#IsTECN').is(':checked'))
ecnTypeString = "TECN"
else if ($('#IsEmergencyTECN').is(':checked'))
ecnTypeString = "E-TECN"
var urlString = '/ECN/AddAdditionalApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
userIDs: userids,
issueID: $("#txtECNNumber").val(),
step: $("#currentStep").val(),
docType: docType,
ecnTypeString: ecnTypeString
},
success: function (result) {
var grid = $("#ApproversList").data("kendoGrid");
grid.dataSource.read($('#txtECNNumber').val(), $("#currentStep").val());
},
error: function (result) {
alert("Failed " + result);
}
});
};
// Region Re-ASssign Approvers
$('#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 = "/ECN/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 ecnTypeString = '';
if ($('#IsECN').is(':checked'))
ecnTypeString = "ECN"
else if ($('#IsTECN').is(':checked'))
ecnTypeString = "TECN"
else if ($('#IsEmergencyTECN').is(':checked'))
ecnTypeString = "E-TECN"
var urlString = '/ECN/ReAssignApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
userIDs: userids,
issueID: $("#txtECNNumber").val(),
step: $("#currentStep").val(),
docType: docType,
ecnTypeString: ecnTypeString
},
success: function (result) {
//var grid = $("#ApproversList").data("kendoGrid");
//grid.dataSource.read($('#txtIssueID').val(), $("#currentStep").val());
var url = '@Url.Action("Edit", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
alert("Failed " + result);
}
});
};
function displayUserRoles(id) {
var url = "/Admin/GetAllUserListBySubRole?SubRole=" + id;
var source =
{
datatype: "json",
datafields: [
{ name: 'UserID' },
{ name: 'FullName' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
// Create a jqxListBox
$("#lstEngineeringUsers").jqxListBox({
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 120
});
$("#lstEngineeringUsers").on('select', function (event) {
if (event.args) {
var item = event.args.item;
if (item) {
var valueelement = $("<div></div>");
valueelement.text("Value: " + item.value);
var labelelement = $("<div></div>");
labelelement.text("Label: " + item.label);
}
}
});
$("#lstOperationsUsers").jqxListBox({
multipleextended: true, theme: "arctic", source: dataAdapter, displayMember: "FullName", valueMember: "UserID", width: 200, height: 120
});
$("#lstOperationsUsers").on('select', function (event) {
if (event.args) {
var item = event.args.item;
if (item) {
var valueelement = $("<div></div>");
valueelement.text("Value: " + item.value);
var labelelement = $("<div></div>");
labelelement.text("Label: " + item.label);
}
}
});
}
// ENGINEERING==============================================================================
$('#addEngineering').on('click', function () {
// get selected items.
var bfound = false;
var userids;
var itemsToAdd = $('#lstAllUsers').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;
var itemsAdded = $("#lstEngineeringUsers").jqxListBox('getItems');
for (var x = 0; x < itemsAdded.length; x++) {
if (itemsAdded[x].label == templabel) {
bfound = true;
break;
};
};
if (!bfound) {
$("#lstEngineeringUsers").jqxListBox('addItem', { label: templabel, value: tempvalue });
}
bfound = false;
}
};
}
// unselect all the selected items
$("#lstAllUsers").jqxListBox({ selectedIndex: -1 });
});
$('#removeEngineering').on('click', function () {
// get items.
var userids;
var tempValue;
var items = $("#lstEngineeringUsers").jqxListBox('getSelectedItems');
if (items.length > 0) {
for (var i = items.length - 1; i >= 0; i--) {
tempValue = items[i].value;
$("#lstEngineeringUsers").jqxListBox('removeItem', tempValue);
};
}
});
// OPERATIONS==============================================================================
$('#addOperations').on('click', function () {
// get selected items.
var bfound = false;
var userids;
var itemsToAdd = $('#lstAllUsers').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;
var itemsAdded = $("#lstOperationsUsers").jqxListBox('getItems');
for (var x = 0; x < itemsAdded.length; x++) {
if (itemsAdded[x].label == templabel) {
bfound = true;
break;
};
};
if (!bfound) {
$("#lstOperationsUsers").jqxListBox('addItem', { label: templabel, value: tempvalue });
}
bfound = false;
}
};
}
// unselect all the selected items
$("#lstAllUsers").jqxListBox({ selectedIndex: -1 });
});
$('#removeOperations').on('click', function () {
// get items.
var userids;
var tempValue;
var items = $("#lstOperationsUsers").jqxListBox('getSelectedItems');
if (items.length > 0) {
for (var i = items.length - 1; i >= 0; i--) {
tempValue = items[i].value;
$("#lstOperationsUsers").jqxListBox('removeItem', tempValue);
};
}
});
// Region Emergency TECN
$('#eecnApprovalConfirm').on('click', function () {
$.ajax({
url: "/ECN/SubmitDocument_EmergencyTECN",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
documentType: docType
},
success: function (data) {
processEECNApproversSelection();
},
error: function (result) {
alert("Failed on Submit" + result);
}
});
})
var processEECNApproversSelection = function () {
var engUserids;
var opUserids;
// Engineering region ======================================================
var itemsAdded = $("#lstEngineeringUsers").jqxListBox('getItems');
for (var x = 0; x < itemsAdded.length; x++) {
var tempvalue = itemsAdded[x].value;
var templabel = itemsAdded[x].label;
if (engUserids == null)
engUserids = tempvalue;
else
engUserids += "~" + tempvalue;
};
// Engineering region ======================================================
itemsAdded = $("#lstOperationsUsers").jqxListBox('getItems');
for (var x = 0; x < itemsAdded.length; x++) {
var tempvalue = itemsAdded[x].value;
var templabel = itemsAdded[x].label;
if (opUserids == null)
opUserids = tempvalue;
else
opUserids += "~" + tempvalue;
};
// alert(userids);
//return false;
//
if (engUserids == null) {
alert('Please select at least one person for [Engineering] approval');
return false;
}
if (opUserids == null) {
alert('Please select at least one person for [Operations] approval');
return false;
}
AssignEECNApproval(engUserids, opUserids)
}
var AssignEECNApproval = function (engUserids, opUserids) {
var urlString = '/ECN/AddEECNApproval';
$.ajax({
type: "Post",
url: urlString,
data: {
ecnNumber: $("#txtECNNumber").val(),
step: $("#currentStep").val(),
engUserIDs: engUserids,
opUserIDs: opUserids
},
success: function (result) {
$('#EECNApproversWin').modal('hide');
var url = '@Url.Action("Edit", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
alert("Failed " + result);
}
});
};
var weekEndExcluded = false;
var natDays = [
//[11, 1, 2012, 'mx'], [11, 2, 2012, 'mx'], [11, 19, 2012, 'mx'],
//[12, 12, 2012, 'mx'], [12, 20, 2012, 'mx'], [12, 25, 2012, 'mx'], [12, 31, 2012, 'mx'],
//[1, 2, 2013, 'mx'], [1, 3, 2013, 'mx'], [1, 4, 2013, 'mx'], [1, 1, 2014, 'mx'], [1, 2, 2014, 'mx']
];
function AddBusinessDays(weekDaysToAdd) {
weekEndIncluded = false;
var curdate = new Date();
var realDaysToAdd = 0;
while (weekDaysToAdd > 0) {
curdate.setDate(curdate.getDate() + 1);
realDaysToAdd++;
//check if current day is business day
if (noWeekendsOrHolidays(curdate)[0]) {
weekDaysToAdd--;
}
else {
weekEndIncluded = true;
}
}
return realDaysToAdd;
}
function nationalDays(date) {
for (i = 0; i < natDays.length; i++) {
if (date.getMonth() == natDays[i][0] - 1 && date.getDate() == natDays[i][1]) {
return [false, natDays[i][2] + '_day'];
}
}
return [true, ''];
}
function noWeekendsOrHolidays(date) {
var noWeekend = $.datepicker.noWeekends(date);
if (noWeekend[0]) {
return nationalDays(date);
} else {
return noWeekend;
}
}
var setETECNExpiration = function () {
var expirationDate = new Date();
var weekDays = AddBusinessDays(1);
expirationDate.setDate(expirationDate.getDate() + weekDays);
var twoDigitMonth = ((expirationDate.getMonth().length + 1) === 1) ? (expirationDate.getMonth() + 1) : (expirationDate.getMonth() + 1);
var tempDate = twoDigitMonth + "/" + expirationDate.getDate() + "/" + expirationDate.getFullYear();
//var arrCurrDate = tempCurrentDate.split('/');
//var expirationDate = new Date(arrCurrDate[2], arrCurrDate[0] - 1, arrCurrDate[1]);
if (!weekEndExcluded) {
var hours = (expirationDate.getHours()) > 9 ? (expirationDate.getHours()) : "0" + (expirationDate.getHours());
var minutes = (expirationDate.getMinutes()) > 9 ? (expirationDate.getMinutes()) : "0" + (expirationDate.getMinutes());
var seconds = (expirationDate.getSeconds()) > 9 ? (expirationDate.getSeconds()) : "0" + (expirationDate.getSeconds());
}
else // if the weekend was excluded then set the expirationtime to 9:00 AM Monday
{
var hours = "09";
var minutes = "00";
var seconds = "00";
}
$('#txtExpirationDate').val(tempDate + " " + hours + ":" + minutes + ":" + seconds);
}
var returnNoOfDays = function () {
var start = new Date();
var end = new Date($('#txtExpirationDate').val());
var diff = new Date(end - start);
// get days
var days = diff / 1000 / 60 / 60 / 24;
//alert(days);
return days
}
function DownloadAttachment(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var fileName = dataItem.FileName;
var attachmentID = dataItem.AttachmentID;
window.open('/ECN/DownloadFile?attachmentID=' + attachmentID + '&ecnNumber=' + "@Model.ECNNumber", '_blank');
}
$("#GetPCRB").on('click', function RedirectToPCRB() {
var pcrb = $("#txtPCRBNumber").val()
if (pcrb.indexOf('P', 0) >= 0) {
pcrb = pcrb.substring(1, pcrb.length);
}
pcrb = parseInt(pcrb);
$.ajax({
type: "Post",
url: "/ECN/PCRBExists",
data: {
pcrb: pcrb
},
success: function (result) {
if (result == "1") {
var pcrb = $("#txtPCRBNumber").val()
if (pcrb.indexOf('P', 0) >= 0) {
pcrb = pcrb.substring(1, pcrb.length);
}
window.location = '/ChangeControl/Edit?issueID=' + parseInt(pcrb);
}
else
alert("PCRB does does not exist in the system")
}
});
})
$(document).ajaxComplete(function (event, request, settings) {
//alert(request.status)
if (request.status == 401 && errorCodeDisplayed == false) {
errorCodeDisplayed = true;
alert("You session has timed out.\nChanges will not be saved")
var url = '@Url.Action("Login", "Account")';
window.location.href(url);
}
});
$(window).bind("beforeunload", function () {
//return confirm("Do you really want to close?");
alert("Document Submitted");
$.ajax({
url: "/ECN/ReleaseLockOnDocument",
type: "GET",
datatype: "json",
data: {
issueID: ("@Model.ECNNumber")
},
success: function () {
},
error: function (result) {
alert("ReleaseLockOnDocument - Failed " + result);
}
});
})
@*function IdleTimeout() {
//window.location = logoutUrl;
var url = '@Url.Action("MyTasks", "Home")';
window.location.href = url;
}*@
//=============================================================================================================
// the code is already in "~/Scripts/common.js", but for some reason IE 10 does not recognizes the path, hence the duplication below==========================
//var timoutWarning = 840000; // Display warning in 14 mins.
//var timoutNow = 900000; // Timeout in 15 mins 1000 * 60 * 15 = 15 mins
//var logoutUrl = '/Account/LogOff'; // URL to logout page.
//var warningTimer;
//var timeoutTimer;
//// Start timers.
//function StartTimers() {
// warningTimer = setTimeout("IdleWarning()", timoutWarning);
// timeoutTimer = setTimeout("IdleTimeout()", timoutNow);
//}
//// Reset timers.
//function ResetTimers() {
// clearTimeout(warningTimer);
// clearTimeout(timeoutTimer);
// StartTimers();
//}
//// Show idle timeout warning dialog.
//function IdleWarning() {
// $("#timeout").modal('show');
//}
//------================================================= End of duplication
</script>