1599 lines
66 KiB
Plaintext
1599 lines
66 KiB
Plaintext
@model Fab2ApprovalSystem.Models.Audit
|
|
|
|
@{ 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%;
|
|
}
|
|
</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();">
|
|
|
|
@using (Html.BeginForm())
|
|
{
|
|
@Html.AntiForgeryToken()
|
|
<div>
|
|
<div class="panel panel-default center-block" data-spy="affix">
|
|
<input type="button" value="Back to Audit List" class="btn btn-primary btn-xs" id="AuditList" />
|
|
<input type="button" value="Save" class="btn btn-primary btn-xs" id="SaveAudit" />
|
|
</div>
|
|
</div>
|
|
<div class="panel panel-default center-block" style="font-size: 10px">
|
|
<div class="panel-body bg-warning">
|
|
<div class="row">
|
|
<div class="col-sm-12 text-center">
|
|
<font style="color: crimson; font-size:24px;font-weight: bolder">
|
|
Audit
|
|
</font>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default" style="font-size: 10px">
|
|
<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">Audit #:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.AuditNo, @Functions.ReturnAuditNoStringFormat(@Model.AuditNo), new { id = "txtAuditNo", @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.TextBoxFor(model => model.AuditTitle, new { id = "txtAuditTitle", @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">Audit Score:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.AuditScore, new { id = "txtAuditScore", @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">Audit Type:</label>
|
|
</div>
|
|
<div class="form-control-static col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditTypeIDs")
|
|
.BindTo(new SelectList(ViewBag.AuditTypeList, "AuditTypeID", "AuditTypeName"))
|
|
.Value(ViewBag.Nothing)
|
|
)
|
|
</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">Audit Date:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().DatePickerFor(model => model.AuditDate)
|
|
.Name("txtAuditDate")
|
|
.HtmlAttributes(new { @type = "text" })
|
|
)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Auditors:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditorIDs")
|
|
.BindTo(new SelectList(ViewBag.AuditorList, "AuditorID", "AuditorName"))
|
|
.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">Audit Finding Categories:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.AuditFindingCategories, new { id = "txtAuditFindingCategories", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue;width:100%" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-sm-3">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Audited Area:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditedAreaIDs")
|
|
.BindTo(new SelectList(ViewBag.AuditAreaList, "AuditedAreaID", "AuditedAreaName"))
|
|
.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">Audited Standard:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditedStandardIDs")
|
|
.BindTo(new SelectList(ViewBag.AuditStandardList, "ID", "Standard"))
|
|
.Value(ViewBag.Nothing)
|
|
)
|
|
</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">#Major Non Conformities:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.NoOfMajorNonConformities, new { id = "txtNoOfMajorNonConformities", @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">#Minor Non Conformities:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.NoOfMinorNonConformities, new { id = "txtNoOfMinorNonConformities", @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">Auditees:</label>
|
|
</div>
|
|
@*<div class="col-sm-9">
|
|
@Html.TextAreaFor(model => model.Auditees, 3, 6, new { id = "AuditeesResult", @class = "k-textbox", style = "font-size: 10px;width: 100%;" })
|
|
|
|
</div>*@
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditeesResult")
|
|
//.BindTo(new SelectList(ViewBag.UserList, "TeamMemberID", "TeamMemberName"))
|
|
.BindTo(new SelectList(ViewBag.UserList, "UserName", "UserName"))
|
|
.Value(ViewBag.AuditeeNames)
|
|
)
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-3">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Audit Status:</label>
|
|
</div>
|
|
@if (ViewBag.Is8DQA == "true")
|
|
{
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().DropDownList()
|
|
.Name("AuditStatus")
|
|
.DataTextField("Text")
|
|
.DataValueField("Value")
|
|
.BindTo(new List<SelectListItem>()
|
|
{
|
|
new SelectListItem()
|
|
{
|
|
Text = "Open",
|
|
Value = "0"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "Closed",
|
|
Value = "1"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "Cancelled",
|
|
Value = "2"
|
|
}
|
|
}
|
|
)
|
|
.Value(Model.AuditStatus.ToString())
|
|
)
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().DropDownList()
|
|
.Name("AuditStatus")
|
|
.DataTextField("Text")
|
|
.DataValueField("Value")
|
|
.BindTo(new List<SelectListItem>()
|
|
{
|
|
new SelectListItem()
|
|
{
|
|
Text = "Open",
|
|
Value = "0"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "Closed",
|
|
Value = "1"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "Cancelled",
|
|
Value = "2"
|
|
}
|
|
}
|
|
)
|
|
.Value(Model.AuditStatus.ToString())
|
|
.HtmlAttributes(new { Readonly = "Readonly" })
|
|
)
|
|
</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">#5S Non-Conformities:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.NoOf5SFindings, new { id = "txtNoOf5SFindings", @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">#Opportunities For Improvement:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBoxFor(model => model.NoOfOFIFindings, new { id = "txtNoOfOFIFindings", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="panel panel-default" style="font-size: 10px">
|
|
<div class="panel-body bg-info">
|
|
<div class="pull-left">
|
|
<h5>
|
|
<font style="color:crimson">
|
|
Documents Attachments
|
|
</font>
|
|
</h5>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div class="panel-body bg-warning">
|
|
|
|
<div class="form-group">
|
|
<div>
|
|
|
|
|
|
|
|
|
|
@(Html.Kendo().Upload()
|
|
.Name("AuditReportFiles")
|
|
.Async(a => a
|
|
.Save("AuditReportAttachSave", "Audit", new { auditNo = Model.AuditNo })
|
|
.AutoUpload(true)
|
|
)
|
|
.ShowFileList(false)
|
|
.Events(events => events
|
|
.Success("onFileUploadSuccess")
|
|
.Upload("checkFileType")
|
|
)
|
|
)
|
|
|
|
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.AuditReportAttachment>()
|
|
.Name("AuditReportAttachments")
|
|
.Columns(columns =>
|
|
{
|
|
columns.Bound(a => a.ID).Visible(false);
|
|
columns.Bound(a => a.AuditNo).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("DownloadAttachment"));
|
|
columns.Command(command => command.Custom("Delete").Click("DeleteAttachment"));
|
|
//columns.Command(command => command.Destroy());
|
|
|
|
|
|
})
|
|
|
|
.Sortable()
|
|
.Scrollable()
|
|
.HtmlAttributes(new { style = "height:200px; 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("AuditReportAttachment_Read", "Audit", new { auditNo = Model.AuditNo }))
|
|
.Destroy(destroy => destroy.Action("AuditReportAttachment_Destroy", "Audit"))
|
|
)
|
|
)
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div class="panel panel-default" style="font-size: 10px">
|
|
<div class="panel-body bg-info">
|
|
<div class="pull-left">
|
|
<h5>
|
|
<font style="color:crimson">
|
|
Findings
|
|
</font>
|
|
</h5>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div>
|
|
<div>
|
|
<input type="button" id="AddAuditFindingItem" value="Add Action Item" class="btn btn-primary btn-xs" />
|
|
</div>
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.AuditFindings>()
|
|
.Name("AuditFindings")
|
|
.Columns(columns =>
|
|
{
|
|
columns.Bound(a => a.ID).Visible(false);
|
|
columns.Bound(a => a.AuditNo).Visible(false);
|
|
columns.Bound(a => a.CAOwner).Visible(false);
|
|
columns.Bound(a => a.CANo).Visible(false);
|
|
columns.Bound(a => a.AuditFindingCategoryID).Visible(false);
|
|
columns.Bound(a => a.Title).Width("100px");
|
|
columns.Bound(a => a.Findings).Width("350px");
|
|
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
|
|
columns.Bound(a => a.FindingType).Title("Type").Width("50px");
|
|
columns.Bound(a => a.ViolatedClause).Width("250px");
|
|
columns.Bound(a => a.FindingCategories).Title("Categories").Width("150px").Encoded(false).Width("150px");
|
|
columns.Bound(a => a.CANoDisp).ClientTemplate("#=buildCALinks(CANo, CANoDisp)#").Width("50px");
|
|
columns.Bound(a => a.CAStatus).Title("8D Status").Width("50px");
|
|
columns.Bound(a => a.CAOwner).Title("8D Owner").Width("50px");
|
|
|
|
|
|
columns.Command(command => command.Custom("Edit").Click("EditAuditFindings")).Width("100px");
|
|
columns.Command(command => command.Custom("Delete").Click("DeletetAuditFindings")).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.ID);
|
|
})
|
|
.PageSize(20)
|
|
.Read(read => read.Action("GetAuditFindingsList", "Audit", new { auditNo = Model.AuditNo }))
|
|
)
|
|
.Resizable(resize => resize.Columns(true))
|
|
|
|
)
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
@*<div class="panel panel-default">
|
|
<div class="panel-body bg-warning">
|
|
<div>
|
|
<input type="button" id="AddCAFindingsItem" value="Add 5S/OFI Findings" class="btn btn-primary btn-xs" />
|
|
</div>
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CAFindings>()
|
|
.Name("CAFindings")
|
|
.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.CAFinding).Width("250px");
|
|
columns.Bound(a => a.CorrectiveAction).Width("250px");
|
|
columns.Bound(a => a.AssignedDate).Format("{0:MM/dd/yy}").Width("50px");
|
|
columns.Bound(a => a.Result).Width("100px");
|
|
columns.Bound(a => a.AttachmentLinks).ClientTemplate("#=buildLinks(AttachmentLinks, AuditNo)#").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.Command(c => c.Custom("Add-Remove File").Click("UploadCAFindingsAttachment")).Width("150px");
|
|
columns.Command(c => c.Custom("Edit").Click("EditCAFindingsItem")).Width("70px");
|
|
columns.Command(c => c.Custom("Delete").Click("DeleteCAFindingsItem")).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.AuditNo).DefaultValue(Model.AuditNo);
|
|
|
|
|
|
})
|
|
.PageSize(50)
|
|
.Read(read => read.Action("GetCAFindingsList", "Audit", new { auditNo = Model.AuditNo }))
|
|
)
|
|
)
|
|
</div>
|
|
</div>*@
|
|
|
|
|
|
|
|
<div class="modal fade" id="AuditFindingsForm" tabindex="0" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content" style="width: 1000px; font-size:11px">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
<h4 class="modal-title" id="myModalLabel">Edit Audit Findings</h4>
|
|
</div>
|
|
|
|
<div class="modal-body ">
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Title:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBox("txtCAFindingsTitle", null, new { @class = "k-textbox", style = "width:100%" })
|
|
@*@Html.TextArea("txtCAFindingsTitle", "", 5, 20, new { @class = "k-textbox", style = "width:100%" })*@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Findings:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextArea("txtAuditFindings", null, 5, 6, new { @class = "k-textbox", style = "width:100%" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Violated Clause:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBox("txtViolatedClause", null, new { @class = "k-textbox", style = "width:100%" })
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Type:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().DropDownList()
|
|
.Name("AuditFindingType")
|
|
.DataTextField("Text")
|
|
.DataValueField("Value")
|
|
.BindTo(new List<SelectListItem>()
|
|
{
|
|
new SelectListItem()
|
|
{
|
|
Text = "Minor",
|
|
Value = "Minor"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "Major",
|
|
Value = "Major"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "5S",
|
|
Value = "5S"
|
|
},
|
|
new SelectListItem()
|
|
{
|
|
Text = "OFI",
|
|
Value = "OFI"
|
|
},
|
|
}
|
|
)
|
|
.Value(Model.AuditStatus.ToString())
|
|
)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Corrective Action:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@Html.TextBox("CANos", null, new { @class = "k-textbox", style = "width:100%" })
|
|
|
|
@*@(Html.Kendo().DropDownList()
|
|
.Name("CANos")
|
|
.BindTo(new SelectList(ViewBag.CANoList, "CANo", "CANoDisp"))
|
|
.Value(ViewBag.Nothing)
|
|
)*@
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@*<h2 id="AddNewCAbtn"></h2>*@
|
|
<button id="AddNewCAbtn" type="button" class="btn btn-primary">Add New CA</button>
|
|
@*<button type="button" id="AddNewCAbtn" onclick="AddNewCA">Add New CA</button>*@
|
|
@*@(Html.Kendo().DropDownList()
|
|
.Name("CANos")
|
|
.BindTo(new SelectList(ViewBag.CANoList, "CANo", "CANoDisp"))
|
|
.Value(ViewBag.Nothing)
|
|
)*@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-sm-6">
|
|
<div class="row">
|
|
<div class="col-sm-3">
|
|
<label class="control-label pull-right">Audit Find Categories:</label>
|
|
</div>
|
|
<div class="col-sm-9">
|
|
@(Html.Kendo().MultiSelect()
|
|
.Name("AuditFindingCategoryIDs")
|
|
.BindTo(new SelectList(ViewBag.AuditFindingCategoryList, "AuditFindingCategoryID", "AuditFindingCategoryName"))
|
|
.Value(ViewBag.Nothing)
|
|
.HtmlAttributes(new { style = "font-size:11px" })
|
|
)
|
|
</div>
|
|
</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="SaveAuditFindings">Save changes</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>
|
|
|
|
|
|
<div class="modal fade" id="CAFindingsForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content" style="width: 600px">
|
|
<div class="modal-header" style="background-color: #e4daa1; font-size: 15px;">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
<h4 class="modal-title" id="myModalLabel">Edit 5S/OFI Findings:</h4>
|
|
</div>
|
|
<div class="modal-body" style="background-color: #75adc6; font-size: 12px;">
|
|
<table width="100%">
|
|
<tr>
|
|
<td width="100%">
|
|
<table class="table-condensed" border="0" width="100%">
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindings">5S/OFI Findings:</label>
|
|
</td>
|
|
<td width="75%">
|
|
|
|
@Html.TextBox("txtCAFindings", null, new { @class = "k-textbox", style = "width:100%" })
|
|
</td>
|
|
</tr>
|
|
@*<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindingsCorrectiveAction">Title:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@Html.TextArea("txtCAFindingsTitle", "", 5, 20, new { @class = "k-textbox", style = "width:100%" })
|
|
</td>
|
|
</tr>*@
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindingsCorrectiveAction">Corrective Action:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@Html.TextArea("txtCAFindingsCorrectiveAction", "", 5, 20, new { @class = "k-textbox", style = "width:100%" })
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindingsResult">Result:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@Html.TextBox("txtCAFindingsResult", null, new { @class = "k-textbox", style = "width:100%" })
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="CAFindingsResponsibilityOwner">Responsibility Owner:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@(Html.Kendo().DropDownList()
|
|
.Name("CAFindingsResponsibilityOwnerIds")
|
|
.BindTo(new SelectList(ViewBag.UserList, "UserID", "UserName"))
|
|
.Value(ViewBag.Nothing)
|
|
.OptionLabel("Select")
|
|
)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindingsECD">ECD:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@(Html.Kendo().DatePicker()
|
|
.Name("txtCAFindingsECD")
|
|
)
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="25%">
|
|
<label for="txtCAFindingsImplementedDate">Implemented Date:</label>
|
|
</td>
|
|
<td width="75%">
|
|
@(Html.Kendo().DatePicker()
|
|
.Name("txtCAFindingsImplementedDate")
|
|
)
|
|
</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="SaveCAFindings">OK</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="AddCAFindingsAttachmentForm" data-url='@Url.Action("GetCAFindingsItem")' 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">×</button>
|
|
<h4 class="modal-title" id="myModalLabel">Upload Attachments 5S/CAFindings:</h4>
|
|
</div>
|
|
<div class="modal-body" id="CAFindingsAttachmentContainer" style="background-color: #75adc6; font-size: 12px;">
|
|
@Html.Partial("_CAFindingsAttachment", Model.CAFindings)
|
|
</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>
|
|
|
|
}
|
|
</body>
|
|
<script type="text/javascript">
|
|
var auditFindingOperation;
|
|
var auditFindingsItemID ;
|
|
var currResponsibilityOwnerID;
|
|
|
|
$("div.k-multiselect-wrap input.k-input").attr("autocomplete", "off");
|
|
$(document).ready(function(){
|
|
|
|
var data = $("#AuditTypeIDs").data("kendoMultiSelect").value();
|
|
//if (data.indexOf('4') == -1 && data.indexOf('8') == -1)
|
|
if (data.indexOf('4') >= 0 || data.indexOf('5') >= 0 || data.indexOf('6') >= 0 || data.indexOf('7') >= 0 || data.indexOf('8') >= 0 || data.indexOf('9') >= 0 || data.indexOf('10') >= 0)
|
|
{
|
|
$("#txtAuditScore").prop("readonly", false);
|
|
$("#txtAuditScore").css({ "background-color": "white" });
|
|
}
|
|
else {
|
|
$("#txtAuditScore").prop("readonly", true);
|
|
$("#txtAuditScore").css({ "background-color": "lightblue" });
|
|
}
|
|
})
|
|
|
|
$("#SaveAudit").on('click', function (e) {
|
|
e.preventDefault();
|
|
var data = ReturnModelObject();
|
|
if (data.AuditStatus == '1')
|
|
{
|
|
|
|
$.ajax({
|
|
url: '/Audit/CheckCAStatus',
|
|
type: "POST",
|
|
datatype: "json",
|
|
data: {
|
|
auditNo: "@Model.AuditNo"
|
|
},
|
|
success: function (result) {
|
|
if (result != "0")
|
|
{
|
|
alert('Cannot close the Audit, There are Open Corrective Actions associated with this Audit');
|
|
}
|
|
|
|
else {
|
|
$.ajax({
|
|
url: '/Audit/Edit',
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(data),
|
|
success: function (result) {
|
|
if (result != "The Audit has been Succefully Saved and Closed") {
|
|
var url = '@Url.Action("Edit", "Audit", new { issueID = "__id__" })';
|
|
url = url.replace('amp;', '');
|
|
window.location.href = url.replace('__id__', "@Model.AuditNo");
|
|
}
|
|
|
|
},
|
|
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");
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
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");
|
|
}
|
|
|
|
})
|
|
}
|
|
else
|
|
{
|
|
SaveAuditData(data);
|
|
}
|
|
return false;
|
|
})
|
|
|
|
|
|
var SaveAuditData = function(data){
|
|
|
|
$.ajax({
|
|
url: '/Audit/Edit',
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(data),
|
|
success: function (result) {
|
|
if (result != "Successfully Saved") {
|
|
var url = '@Url.Action("Edit", "Audit", new { issueID = "__id__" })';
|
|
url = url.replace('amp;', '');
|
|
window.location.href = url.replace('__id__', "@Model.AuditNo");
|
|
}
|
|
else {
|
|
alert('Successfully Saved');
|
|
}
|
|
|
|
},
|
|
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");
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
$("#AuditTypeIDs").on('change', function(e){
|
|
|
|
var data = $("#AuditTypeIDs").data("kendoMultiSelect").value();
|
|
//alert(data.indexOf('4') + ' , ' + data.indexOf('8'));
|
|
if (data.indexOf('4') >= 0 || data.indexOf('5') >= 0 || data.indexOf('6') >= 0 || data.indexOf('7') >= 0 || data.indexOf('8') >= 0 || data.indexOf('9') >= 0 || data.indexOf('10') >= 0)
|
|
{
|
|
$("#txtAuditScore").prop("readonly", false);
|
|
$("#txtAuditScore").css({ "background-color": "white" });
|
|
}
|
|
else {
|
|
|
|
var major = parseInt($('#txtNoOfMajorNonConformities').val());
|
|
var minor = parseInt($('#txtNoOfMinorNonConformities').val());
|
|
var fiveS = parseInt($('#txtNoOf5SFindings').val());
|
|
var ofi = parseInt($('#txtNoOfOFIFindings').val());
|
|
|
|
$("#txtAuditScore").val(100 - ((major * 10) + (minor * 3) + fiveS + ofi));
|
|
$("#txtAuditScore").prop("readonly", true);
|
|
$("#txtAuditScore").css({ "background-color": "lightblue" });
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
$("#AddNewCAbtn").on('click', function () {
|
|
$.ajax({
|
|
url: "/CorrectiveAction/CreateFromAudit",
|
|
type: "POST",
|
|
datatype: "json",
|
|
success: function (data) {
|
|
alert("Success. CA# " + data + " created.");
|
|
document.getElementById('CANos').value = data;
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
}
|
|
});
|
|
})
|
|
|
|
|
|
function ReturnModelObject() {
|
|
|
|
var _AuditNo = "@Model.AuditNo";
|
|
var _Title = $("#txtAuditTitle").val();
|
|
var _AuditTypeIDs = $("#AuditTypeIDs").data("kendoMultiSelect").value();
|
|
var _AuditorIDs = $("#AuditorIDs").data("kendoMultiSelect").value();
|
|
var _AuditDate = $("#txtAuditDate").val();
|
|
var _AuditStatus = $("#AuditStatus").val();
|
|
var _AuditedAreaIDs = $("#AuditedAreaIDs").data("kendoMultiSelect").value();
|
|
var _Auditees = $("#AuditeesResult").data("kendoMultiSelect").value();
|
|
var _AuditScore = $("#txtAuditScore").val();
|
|
////var _AuditedStandardIDs = $("#AuditedStandardIDs").val();
|
|
|
|
var AuditeesToString = AuditeesToStringExplode(_Auditees);
|
|
|
|
var objectData = {
|
|
AuditNo: _AuditNo,
|
|
AuditTitle: _Title,
|
|
AuditTypeIDs: _AuditTypeIDs,
|
|
AuditorIDs: _AuditorIDs,
|
|
AuditDate: _AuditDate,
|
|
AuditStatus: _AuditStatus,
|
|
AuditedAreaIDs: _AuditedAreaIDs,
|
|
Auditees: AuditeesToString,
|
|
AuditScore: _AuditScore
|
|
//AuditedStandardIDs: _AuditedStandardIDs
|
|
}
|
|
|
|
return objectData;
|
|
}
|
|
|
|
function AuditeesToStringExplode(AuditeesList) {
|
|
var auditeesListToReturn = ''
|
|
|
|
AuditeesList.forEach(function (item) {
|
|
if (auditeesListToReturn == '') {
|
|
auditeesListToReturn = item
|
|
}
|
|
else {
|
|
auditeesListToReturn = auditeesListToReturn + ',' + item;
|
|
}
|
|
|
|
|
|
})
|
|
document.getElementById('AuditeesResult').value = auditeesListToReturn;
|
|
|
|
return auditeesListToReturn;
|
|
}
|
|
|
|
|
|
function onFileUploadSuccess(e) {
|
|
var grid = $("#AuditReportAttachments").data("kendoGrid");
|
|
grid.dataSource.read($('#txtAuditNo').val());
|
|
}
|
|
|
|
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 DeleteAttachment(e) {
|
|
e.preventDefault();
|
|
if (confirm("Are you sure you want to delete this Attachment?")) {
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var fileName = dataItem.FileGUID;
|
|
var attachmentID = dataItem.ID;
|
|
|
|
$.ajax({
|
|
url: "/Audit/DeleteAuditReportAttachment",
|
|
type: "POST",
|
|
datatype: "json",
|
|
data: {
|
|
attachID: attachmentID
|
|
},
|
|
success: function (data) {
|
|
var grid = $("#AuditReportAttachments").data("kendoGrid");
|
|
grid.dataSource.read($('#txtAuditNo').val());
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function DownloadAttachment(e) {
|
|
e.preventDefault();
|
|
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var fileName = dataItem.FileGUID;
|
|
var fileGUID = dataItem.FileGUID;
|
|
|
|
window.location = '/Audit/DownloadAuditReportAttachment?fileGuid=' + fileGUID + '&auditNo=' + @Model.AuditNo;
|
|
//window.open('/LotDisposition/DownloadFile?attachmentID=' + attachmentID, '_blank');
|
|
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
$("#AddAuditFindingItem").on('click', function (e) {
|
|
|
|
clearAuditFindingForm();
|
|
auditFindingOperation = 'Add';
|
|
$("#AuditFindingsForm").modal("show");
|
|
})
|
|
|
|
function EditAuditFindings(e)
|
|
{
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
auditFindingsItemID = dataItem.ID;
|
|
var findings = dataItem.Findings;
|
|
var findingType = dataItem.FindingType;
|
|
var violatedClause = dataItem.ViolatedClause;
|
|
var caNO = dataItem.CANo;
|
|
var findingTitle = dataItem.Title;
|
|
|
|
auditFindingOperation = 'Edit';
|
|
clearAuditFindingForm();
|
|
|
|
$("#txtCAFindingsTitle").val(findingTitle);
|
|
$("#txtAuditFindings").val(findings);
|
|
$("#txtViolatedClause").val(violatedClause);
|
|
$("#AuditFindingType").data("kendoDropDownList").value(findingType);
|
|
if (caNO != 0) {
|
|
$("#CANos").val(caNO);
|
|
}
|
|
|
|
//$("#CANos").val();
|
|
|
|
var tempAuditFindingCategory;
|
|
//alert(dataItem.ResponsiblePerson);
|
|
var data;
|
|
var dataArray;
|
|
|
|
|
|
$("#AuditFindingCategoryIDs").data("kendoMultiSelect").value("");
|
|
|
|
if (dataItem.AuditFindingCategoryID != null) {
|
|
tempAuditFindingCategory = dataItem.AuditFindingCategoryID.split(',');
|
|
|
|
|
|
var attValues = new Array();
|
|
for (i in tempAuditFindingCategory) {
|
|
attValues[i] = tempAuditFindingCategory[i]
|
|
}
|
|
}
|
|
|
|
$("#AuditFindingCategoryIDs").data("kendoMultiSelect").value(attValues);
|
|
|
|
e.preventDefault();
|
|
$("#AuditFindingsForm").modal("show");
|
|
|
|
|
|
}
|
|
|
|
$("#SaveAuditFindings").on('click', function () {
|
|
|
|
var objectData = ReturnAuditFindingsObject();
|
|
var url = "";
|
|
|
|
|
|
//if (IsCAAssignedToAudit(objectData.CANo) == "1") {
|
|
// alert("The CA is already assigned to different Audit#");
|
|
// return;
|
|
//}
|
|
if(objectData.CANo == "")
|
|
{
|
|
|
|
|
|
var message = CheckCanAddCAFinding();
|
|
if (message == '') {
|
|
if (auditFindingOperation == 'Add') {
|
|
url = "/Audit/InsertAuditFindingsItem";
|
|
}
|
|
else {
|
|
url = "/Audit/UpdateAuditFindingsItem";
|
|
}
|
|
|
|
$.ajax({
|
|
url: url,
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(objectData),
|
|
success: function (objdata) {
|
|
var grid = $("#AuditFindings").data("kendoGrid");
|
|
grid.dataSource.read($("@Model.AuditNo").val());
|
|
$("#AuditFindingsForm").modal("hide");
|
|
$('#txtNoOfMajorNonConformities').val(objdata.NoOfMajorNonConformities);
|
|
$('#txtNoOfMinorNonConformities').val(objdata.NoOfMinorNonConformities);
|
|
$('#txtNoOf5SFindings').val(objdata.NoOf5SFindings);
|
|
$('#txtNoOfOFIFindings').val(objdata.NoOfOFIFindings);
|
|
$('#txtAuditScore').val(objdata.AuditScore);
|
|
|
|
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
$("#AuditFindingsForm").modal("hide");
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
else {
|
|
alert(message);
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
var returnValue = "1";
|
|
var CANoFormatted = parseInt(objectData.CANo.toLowerCase().replace('c', '0'));
|
|
objectData.CANo = CANoFormatted;
|
|
//alert(objectData.CANo);
|
|
//alert(CANoFormatted);
|
|
$.ajax({
|
|
url: "/Audit/IsCAAssignedToAudit",
|
|
type: "POST",
|
|
datatype: "json",
|
|
data: {
|
|
caNo: CANoFormatted,
|
|
auditNo: @Model.AuditNo
|
|
//caNo: 005
|
|
},
|
|
success: function (data) {
|
|
if (data == "1") {
|
|
alert("The CA is already assigned to different Audit#");
|
|
return;
|
|
}
|
|
else {
|
|
|
|
|
|
|
|
if (auditFindingOperation == 'Add') {
|
|
url = "/Audit/InsertAuditFindingsItem";
|
|
}
|
|
else {
|
|
url = "/Audit/UpdateAuditFindingsItem";
|
|
}
|
|
|
|
$.ajax({
|
|
url: url,
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(objectData),
|
|
success: function (objdata) {
|
|
var grid = $("#AuditFindings").data("kendoGrid");
|
|
grid.dataSource.read($("@Model.AuditNo").val());
|
|
$("#AuditFindingsForm").modal("hide");
|
|
$('#txtNoOfMajorNonConformities').val(objdata.NoOfMajorNonConformities);
|
|
$('#txtNoOfMinorNonConformities').val(objdata.NoOfMinorNonConformities);
|
|
$('#txtNoOf5SFindings').val(objdata.NoOf5SFindings);
|
|
$('#txtNoOfOFIFindings').val(objdata.NoOfOFIFindings);
|
|
$('#txtAuditScore').val(objdata.AuditScore);
|
|
|
|
|
|
},
|
|
error: function (result) {
|
|
alert("Error adding finding!");
|
|
$("#AuditFindingsForm").modal("hide");
|
|
return;
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
},
|
|
error: function (result) {
|
|
alert("JRO Error " + result.responseText);
|
|
return returnValue;
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
function CheckCanAddCAFinding() {
|
|
var objectData = ReturnAuditFindingsObject();
|
|
var message = '';
|
|
|
|
if ((objectData.FindingType == 'Major' || objectData.FindingType == 'Minor') && objectData.CANo == '') {
|
|
message += "If Major or Minor finding is selected, then a Corrective Action must be added. \n"
|
|
}
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
|
function ReturnAuditFindingsObject() {
|
|
|
|
var findingCat = $("#AuditFindingCategoryIDs").data("kendoMultiSelect").value()
|
|
findingCat = findingCat.join();
|
|
if (auditFindingOperation == 'Add') {
|
|
var objectData = {
|
|
ID: 0,
|
|
AuditNo: "@Model.AuditNo",
|
|
Findings: $("#txtAuditFindings").val(),
|
|
ViolatedClause: $("#txtViolatedClause").val(),
|
|
FindingType: $("#AuditFindingType").data("kendoDropDownList").value(),
|
|
FindingCategories: findingCat + ',',
|
|
CANo: $("#CANos").val(),
|
|
Title: $("#txtCAFindingsTitle").val()
|
|
}
|
|
|
|
}
|
|
else {
|
|
var objectData = {
|
|
ID: auditFindingsItemID,
|
|
AuditNo: "@Model.AuditNo",
|
|
Findings: $("#txtAuditFindings").val(),
|
|
ViolatedClause: $("#txtViolatedClause").val(),
|
|
FindingType: $("#AuditFindingType").data("kendoDropDownList").value(),
|
|
FindingCategories: findingCat + ',',
|
|
CANo: $("#CANos").val(),
|
|
Title: $("#txtCAFindingsTitle").val()
|
|
}
|
|
}
|
|
|
|
return objectData;
|
|
}
|
|
|
|
function clearAuditFindingForm() {
|
|
$("#txtAuditFindings").val('');
|
|
$("#txtViolatedClause").val('');
|
|
$("#AuditFindingCategoryIDs").data("kendoMultiSelect").value("");
|
|
$("#CANos").val('');
|
|
$("#txtCAFindingsTitle").val('');
|
|
//$("#txtCorrectiveAction").val('');
|
|
//$("#CANos").data("kendoDropDownList").value(0)
|
|
}
|
|
|
|
|
|
|
|
function DeletetAuditFindings(e)
|
|
{
|
|
|
|
e.preventDefault();
|
|
if (confirm("Are you sure you want to delete this Audit Finding?")) {
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
|
|
var auditFindingsID = dataItem.ID;
|
|
|
|
$.ajax({
|
|
url: "/Audit/DeleteAuditFindingsItem",
|
|
type: "POST",
|
|
datatype: "json",
|
|
data: {
|
|
auditFindingsID: auditFindingsID
|
|
},
|
|
success: function (data) {
|
|
var grid = $("#AuditFindings").data("kendoGrid");
|
|
grid.dataSource.read($('#txtAuditNo').val());
|
|
|
|
$('#txtNoOfMajorNonConformities').val(data.NoOfMajorNonConformities);
|
|
$('#txtNoOfMinorNonConformities').val(data.NoOfMinorNonConformities);
|
|
$('#txtNoOf5SFindings').val(data.NoOf5SFindings);
|
|
$('#txtNoOfOFIFindings').val(data.NoOfOFIFindings);
|
|
$('#txtAuditScore').val(data.AuditScore);
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
$("#AuditList").on('click', function(){
|
|
var url = '@Url.Action("AuditList", "Home")';
|
|
window.location = url;
|
|
})
|
|
|
|
|
|
$(window).bind("beforeunload", function () {
|
|
//return confirm("Do you really want to close?");
|
|
$.ajax({
|
|
url: "/Audit/ReleaseLockOnDocument",
|
|
type: "GET",
|
|
datatype: "json",
|
|
data: {
|
|
issueID: ("@Model.AuditNo")
|
|
},
|
|
success: function () {
|
|
},
|
|
error: function (result) {
|
|
alert("ReleaseLockOnDocument - Failed " + result);
|
|
}
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
function buildCALinks(CAs, CANoDisp) {
|
|
|
|
return "<a href='/CorrectiveAction/Edit?IssueID=" + CAs + "'> " + CANoDisp + "</a>" + " ";
|
|
|
|
}
|
|
|
|
|
|
//CA Findings =======================================================================================================================
|
|
var caFindingsItemID;
|
|
var caFindingsOperation;
|
|
|
|
|
|
$("#AddCAFindingsItem").on('click', function (e) {
|
|
|
|
clearCAFindingsForm();
|
|
caFindingsOperation = 'Add';
|
|
$("#CAFindingsForm").modal("show");
|
|
})
|
|
|
|
|
|
|
|
function EditCAFindingsItem(e)
|
|
{
|
|
var ecdDate;
|
|
var tempecdDate;
|
|
|
|
var implementDate;
|
|
var tempimplementDate;
|
|
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
caFindingsItemID = dataItem.ID;
|
|
var caFindings = dataItem.CAFinding;
|
|
var correctivAction = dataItem.CorrectiveAction;
|
|
|
|
var result = dataItem.Result;
|
|
var attachmentLinks = dataItem.AttachmentLinks;
|
|
var ResponsibilityOwnerID = dataItem.ResponsibilityOwnerID;
|
|
var ecd = dataItem.ECD;
|
|
currResponsibilityOwnerID = dataItem.CurrentResponsibilityOwnerID;
|
|
|
|
|
|
|
|
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 = '';
|
|
|
|
|
|
caFindingsOperation = 'Edit';
|
|
clearCAFindingsForm();
|
|
|
|
$("#txtCAFindings").val(caFindings);
|
|
$("#txtCAFindingsCorrectiveAction").val(correctivAction);
|
|
$("#txtCAFindingsResult").val(result);
|
|
$("#CAFindingsResponsibilityOwnerIds").data("kendoDropDownList").value(ResponsibilityOwnerID);
|
|
$("#txtCAFindingsECD").val(ecdDate);
|
|
$("#txtCAFindingsImplementedDate").val(implementDate);
|
|
|
|
|
|
var tempImpIDs;
|
|
var data;
|
|
var dataArray;
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
$("#CAFindingsForm").modal("show");
|
|
|
|
|
|
}
|
|
|
|
$("#SaveCAFindings").on('click', function () {
|
|
|
|
var objectData = ReturnCAFindingsObject();
|
|
|
|
if (objectData.ResponsibilityOwnerID != '' && objectData.ECD == '')
|
|
{
|
|
alert('Please enter the ECD while entering the Responsible Owner');
|
|
return false;
|
|
}
|
|
|
|
var url = "";
|
|
|
|
|
|
if (caFindingsOperation == 'Add') {
|
|
url = "/Audit/InsertCAFindingsItem";
|
|
}
|
|
else {
|
|
url = "/Audit/UpdateCAFindingsItem";
|
|
}
|
|
|
|
$.ajax({
|
|
url: url,
|
|
type: "POST",
|
|
contentType: "application/json; charset=utf-8",
|
|
data: JSON.stringify(objectData),
|
|
success: function (objdata) {
|
|
var grid = $("#CAFindings").data("kendoGrid");
|
|
grid.dataSource.read($("@Model.AuditNo").val());
|
|
$("#CAFindingsForm").modal("hide");
|
|
|
|
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
//$("#CAFindingsForm").modal("hide");
|
|
}
|
|
});
|
|
|
|
|
|
})
|
|
|
|
|
|
function ReturnCAFindingsObject() {
|
|
|
|
|
|
if (caFindingsOperation == 'Add') {
|
|
var objectData = {
|
|
ID: 0,
|
|
AuditNo: '@Model.AuditNo',
|
|
CAFinding: $("#txtCAFindings").val(),
|
|
CorrectiveAction: $("#txtCAFindingsCorrectiveAction").val(),
|
|
Result: $("#txtCAFindingsResult").val(),
|
|
ECD: $("#txtCAFindingsECD").val(),
|
|
ImplementedDate: $("#txtCAFindingsImplementedDate").val(),
|
|
ResponsibilityOwnerID: $("#CAFindingsResponsibilityOwnerIds").data("kendoDropDownList").value(),
|
|
Title: $("txtCAFindingsTitle").val()
|
|
}
|
|
|
|
}
|
|
else {
|
|
var objectData = {
|
|
ID: caFindingsItemID,
|
|
AuditNo: '@Model.AuditNo',
|
|
CAFinding: $("#txtCAFindings").val(),
|
|
CorrectiveAction: $("#txtCAFindingsCorrectiveAction").val(),
|
|
Result: $("#txtCAFindingsResult").val(),
|
|
ECD: $("#txtCAFindingsECD").val(),
|
|
ImplementedDate: $("#txtCAFindingsImplementedDate").val(),
|
|
CurrentResponsibilityOwnerID: currResponsibilityOwnerID,
|
|
ResponsibilityOwnerID: $("#CAFindingsResponsibilityOwnerIds").data("kendoDropDownList").value(),
|
|
Title: $("txtCAFindingsTitle").val()
|
|
}
|
|
}
|
|
|
|
return objectData;
|
|
}
|
|
|
|
function clearCAFindingsForm() {
|
|
$("#txtCAFindings").val('');
|
|
$("#txtCAFindingsCorrectiveAction").val('')
|
|
$("#txtCAFindingsResult").val('');
|
|
$("#CAFindingsResponsibilityOwnerIds").data("kendoDropDownList").value(0);
|
|
$("#txtCAFindingsECD").val('');
|
|
$("#txtCAFindingsImplementedDate").val('');
|
|
|
|
}
|
|
|
|
|
|
|
|
function DeleteCAFindingsItem(e)
|
|
{
|
|
|
|
e.preventDefault();
|
|
if (confirm("Are you sure you want to delete this Audit Finding?")) {
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
|
|
var caFindingsID = dataItem.ID;
|
|
|
|
$.ajax({
|
|
url: "/Audit/DeleteCAFindingsItem", //TODO
|
|
type: "POST",
|
|
datatype: "json",
|
|
data: {
|
|
caFindingsID: caFindingsID
|
|
},
|
|
success: function (data) {
|
|
var grid = $("#CAFindings").data("kendoGrid");
|
|
grid.dataSource.read($('@Model.AuditNo').val());
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function UploadCAFindingsAttachment(e) {
|
|
e.preventDefault();
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var currentCAFindingsID = dataItem.ID;
|
|
|
|
var url = $('#AddCAFindingsAttachmentForm').data('url');
|
|
url = url + '?caFindingsID=' + currentCAFindingsID;
|
|
$.ajax({
|
|
url: url,
|
|
type: "GET",
|
|
datatype: "json",
|
|
success: function (data) {
|
|
|
|
$('#CAFindingsAttachmentContainer').html(data);
|
|
$("#AddCAFindingsAttachmentForm").modal('show')
|
|
|
|
},
|
|
error: function (result) {
|
|
alert("Failed " + result);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function buildLinks(fileNames, auditNo) {
|
|
var template = "";
|
|
|
|
//var fileName = 4;
|
|
|
|
//alert(workRequestID);
|
|
|
|
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='/Audit/DownloadAuditReportAttachment?fileGuid=" + fileGuid + "&auditNo=" + @Model.AuditNo + "'>" + fileName + "</a><BR>" + " ";
|
|
|
|
|
|
}
|
|
|
|
}
|
|
return template;
|
|
}
|
|
|
|
|
|
</script>
|