Jonathan Ouellette 580e90f6a2 initial add
2022-09-27 14:10:30 -07:00

1499 lines
55 KiB
Plaintext

@model Fab2ApprovalSystem.Models.CCMeeting
@{
ViewBag.Title = "Meeting";
}
<style>
table {
border-spacing: 5px;
padding: 5px;
border-color: white;
}
</style>
<body onload="StartTimers();" onmousemove="ResetTimers();" onkeydown="ResetTimers();">
@using (Html.BeginForm())
{
<input type="hidden" id="txtMeetingID" value="@Model.MeetingID" />
if(Model.Status == 0)
{
<div data-spy="affix">
<div data-spy="affix" data-offset-top="0">
<input type="button" value="Save" class="btn btn-primary btn-xs" id="SaveMeeting" />
<input type="button" value="Back to PCRB" class="btn btn-primary btn-xs" id="BackToCC" />
</div>
</div>
}
else
{
<div data-spy="affix">
<div data-spy="affix" data-offset-top="0">
<input type="button" value="Back to PCRB" class="btn btn-primary btn-xs" id="BackToCC" />
</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">
Meeting Summary (@(Model.Decision == -1 ? "Open" : (Model.Decision == 0 ? "Closed- NotApproved" : "Closed-Approved")))
</font>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body bg-warning">
<div class="row">
@*<div class="col-sm-8">
<label class="control-label">Meeting List:</label>
@(Html.Kendo().DropDownList()
.Name("MeetingList")
.BindTo(new SelectList(ViewBag.MeetingList, "MeetingID", "MeetingInfo"))
.OptionLabel("Select")
.HtmlAttributes(new { style ="width: 300px; font-size:10px" })
)
<input type="button" value="Display MeetingInfo" class="btn btn-primary btn-xs" id="GetMeeting" />
</div>*@
@*<div class="col-sm-2 pull-right" style="color:crimson; font-weight:bold">
@(Model.Status == 1 ? "Closed Date:" + Model.ClosedDate.Value.ToString("MM/dd/yyyy") : (Model.Status == 2 ? "Cancelled Date:" + Model.CancelledDate.Value.ToString("MM/dd/yyyy") : ""))
</div>
<div class="col-sm-2 pull-right" style="color:crimson; font-weight:bold">
Meeting Status: @(Model.Status == 0 ? "Open" : (Model.Status == 1 ? "Closed" : "Cancelled"))
</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-2">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Plan #:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.PlanNumber, "P" + "{0:0000}", new { id = "txtPlanNumber", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
<div class="col-sm-4">
<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.Title, new { id = "txtTitle", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue;width:100%" })
</div>
</div>
</div>
<div class="col-sm-2">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Change Level</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.ChangeLevel, new { id = "txtChangeLevel", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue;width:100%" })
</div>
</div>
</div>
<div class="col-sm-2">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">PCRB</label>
</div>
<div class="col-sm-9">
@*@(Html.Kendo().MultiSelect()
.Name("PCRB")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "Select",
Value = "Select"
},
new SelectListItem()
{
Text = "PCR1",
Value = "PCR1"
},
new SelectListItem()
{
Text = "PCR2",
Value = "PCR2"
},
new SelectListItem()
{
Text = "PCR3",
Value = "PCR3"
}
}
)
.Value(Model.PCRB.ToString())
)*@
@(Html.Kendo().MultiSelect()
.Name("PCRValueIDs")
.BindTo(new SelectList(ViewBag.PCRValues, "PCRValueID", "PCRValueName"))
.Value(ViewBag.Nothing)
)
</div>
</div>
</div>
<div class="col-sm-2">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">Meeting Date:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DatePickerFor(model => model.MeetingDate)
.Name("txtMeetingDate")
)
</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">
Attendees
</font>
</h5>
</div>
</div>
<div class="panel-body bg-warning">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CCMeetingAttendee>()
.Name("MeetingAttendees")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.MeetingID).Visible(false);
columns.Bound(a => a.AttendeeName).Width("300px");
columns.Bound(a => a.JobTitle).Width("100px");
columns.Bound(a => a.Location).Width("200px");
columns.Command(c => c.Custom("Edit Attendee").Click("EditAttendee")).Width("100px");
//columns.Command(c => c.Edit()).Width("80px");
//columns.Command(c => c.Custom("Save Attendee").Click("SaveNewAttendee")).Width("100px");
})
.Events(e => e.DataBound("onAttendeeDataBound"))
.ToolBar(toolbar => toolbar.Create().Text("Add Item"))
.Sortable()
.Scrollable()
.Resizable(resize => resize.Columns(true))
.HtmlAttributes(new { style = "height:300px; width:100%; font-size: 11px" })
.DataSource(dataSource => dataSource
.Ajax()
//.Batch(false)
.ServerOperation(false)
.Model(model =>
{
model.Id(p => p.ID);
model.Field(a => a.MeetingID).DefaultValue(Model.MeetingID);
model.Field(a => a.JobTitle).Editable(true);
})
.PageSize(50)
.Read(read => read.Action("GetMeetingAttendees", "ChangeControl", new { meetingID = Model.MeetingID }))
.Create(create => create.Action("InsertMeetingAttendee", "ChangeControl"))
.Update(update => update.Action("UpdateMeetingAttendee", "ChangeControl"))
)
)
</div>
</div>
<div class="panel-body bg-info">
<div class="pull-left">
<h5>
<font style="color:crimson">
Document Attachments
</font>
</h5>
</div>
</div>
<div class="panel-body bg-warning">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CCMeetingAttachment>()
.Name("MeetingAttachmentGrid")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.MeetingID).Visible(false);
columns.Bound(a => a.FileGUID).Visible(false);
columns.Bound(a => a.FileName).Width("100px");
columns.Bound(a => a.Title).Width("100px");
columns.Bound(a => a.UploadedByName).Width("50px").Title("Uploaded By");
columns.Bound(a => a.UploadDateTime).Format("{0:MM/dd/yy hh:mm:ss}").Width("50px").Title("Uploaded Date"); ;
columns.Command(c => c.Edit()).Width("80px");
columns.Command(c => c.Destroy()).Width("40px");
columns.Command(c => c.Custom("View Doc").Click("DownloadMeetingAttachment")).Width("40px");
columns.Command(c => c.Custom("Upload Doc").Click("UploadMeetingAttachment")).Width("70px");
})
.Events(e => e.DataBound("onMeetingAttachmentDataBound"))
.ToolBar(toolbar => toolbar.Create().Text("Add Item"))
.Sortable()
.Scrollable()
.Resizable(resize => resize.Columns(true))
.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.MeetingID).DefaultValue(Model.MeetingID);
model.Field(a => a.UploadDateTime).Editable(false);
model.Field(a => a.UploadedByName).Editable(false);
model.Field(a => a.FileName).Editable(false);
})
.PageSize(50)
.Read(read => read.Action("GetMeetingAttachments", "ChangeControl", new { meetingID = Model.MeetingID }))
.Create(create => create.Action("InsertMeetingAttachmentItemAttrib", "ChangeControl"))
.Destroy(destroy => destroy.Action("DeleteMeetingAttachment", "ChangeControl"))
.Update(update => update.Action("UpdateMeetingAttachmentAttrib", "ChangeControl"))
)
)
</div>
<div class="panel panel-default">
<div class="panel-body bg-info">
<div class="pull-left">
<table>
<tr>
<td style="font-size: 14px; font-weight:bold">
Decisions:
</td>
<td>
&nbsp;&nbsp;
</td>
<td>
<input type="checkbox" id="chkApproved" name="Approved" value="Approved"/> <label for="chkApproved"></label>Approved
</td>
<td>
&nbsp;&nbsp;
</td>
<td>
<input type="checkbox" id="chkNotApproved" name="Not Approved" value="Not Approved" /><label for="chkNotApproved"></label>Not Approved
</td>
</tr>
</table>
</div>
</div>
<div>
<input type="button" id="AddDecisionNotes" value="AddDecisionNotes" class="btn btn-primary btn-xs" />
</div>
<div class="panel-body bg-warning">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CCDecisionSummary>()
.Name("DecisionSummary")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.DecisionNotes).ClientTemplate("#=changeNewLine(DecisionNotes)#").Width("500px");
columns.Bound(a => a.ECNLinks).ClientTemplate("#=buildECNLinks(ECNLinks)#").Width("100px");
columns.Bound(a => a.LotDispoLinks).ClientTemplate("#=buildLotDispoLinks(LotDispoLinks)#").Width("100px");
//columns.Command(c => c.Edit()).Width("80px");
columns.Command(c => c.Custom("Edit Notes").Click("EditDecisionNotes")).Width("70px");
columns.Command(c => c.Destroy()).Width("40px");
columns.Command(c => c.Custom("Edit ECN-LotDispo Links").Click("EditECNLotDispoLinks")).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.MeetingID).DefaultValue(Model.MeetingID);
model.Field(a => a.ECNLinks).Editable(false);
model.Field(a => a.LotDispoLinks).Editable(false);
})
.PageSize(50)
.Read(read => read.Action("GetDecisionsSummaryList", "ChangeControl", new { meetingID = Model.MeetingID }))
//.Create(create => create.Action("InsertDecisionsSummary", "ChangeControl"))
.Destroy(destroy => destroy.Action("DeleteDecisionsSummary", "ChangeControl"))
//.Update(update => update.Action("UpdateDecisionsSummary", "ChangeControl"))
)
)
</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">
Notes
</font>
</h5>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-12">
@Html.TextAreaFor(model => model.Notes, 5, 50, new { id = "txtNotes", @class = "k-textbox", style = "width:100%;" })
</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">
Action Items
</font>
</h5>
</div>
</div>
<div class="panel-body bg-warning">
<div>
<input type="button" id="AddActionItem" value="Add Action Item" class="btn btn-primary btn-xs" />
</div>
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CCMeetingActionItem>()
.Name("MeetingActionItems")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.MeetingID).Visible(false);
columns.Bound(a => a.ResponsibleID).Visible(false);
columns.Bound(a => a.ActionItemName).Width("300px").Title("Action Item").ClientTemplate("#=changeNewLine(ActionItemName)#");
columns.Bound(a => a.ResponsiblePerson).Width("100px");
columns.Bound(a => a.Gating).Width("50px");
columns.Bound(a => a.DueDate).Width("50px").Format("{0:MM/dd/yy}").Width("150px");
columns.Command(c => c.Custom("Edit").Click("EditMeetingActionItem")).Width("70px");
columns.Command(c => c.Destroy()).Width("40px");
})
//.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.MeetingID).DefaultValue(Model.MeetingID);
})
.PageSize(50)
.Read(read => read.Action("GetMeetingActionItems", "ChangeControl", new { meetingID = Model.MeetingID }))
//.Create(create => create.Action("InsertMeetingActionItem", "ChangeControl"))
.Destroy(destroy => destroy.Action("DeleteMeetingActionItem", "ChangeControl"))
.Update(update => update.Action("UpdateMeetingActionItem", "ChangeControl"))
)
)
</div>
</div>
}
</body>
<div class="modal fade" id="WinAttachDocuments" 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">Select File:</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-8">
@(Html.Kendo().Upload()
.Name("files")
.Async(a => a
.Save("AttachSaveMeeting", "ChangeControl", new { planNumber = Model.PlanNumber, meetingID = Model.MeetingID })
.AutoUpload(true)
)
.Events(events => events.Success("RefreshAttachmentsGrid").Upload("UploadAdditionalData"))
.ShowFileList(false)
)
</div>
</div>
</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="ECN_LotDispoLinkForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Add/Remove ECNs-Lot Disposition links:</h4>
</div>
<div class="modal-body">
<table>
<tr>
<td width="50%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="100%" colspan="2">
<label for="txtECN">Enter ECN#:</label>
</td>
</tr>
<tr>
<td>
@Html.TextBox("txtECN", null, new { @class = "k-textbox", style="width:100%"})
</td>
<td>
<input width:100%" type="button" id='AddECN' value="Add ECN" />
</td>
</tr>
<tr>
<td colspan="2">
<select multiple id="lstECNs" style="height: 250px; width: 100%; font-family: Tahoma; border-color: lightgrey"></select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" id='RemoveECN' value="Remove ECN" />
</td>
</tr>
</table>
</td>
<td width="50%">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="100%" colspan="2">
<label for="txtLotDisposition">Enter Lot Disposition#:</label>
</td>
</tr>
<tr>
<td>
@Html.TextBox("txtLotDisposition", null, new { @class = "k-textbox", style="width:100%"})
</td>
<td>
<input width:100%" type="button" id='AddLotDispo' value="Add Lot Disposition" />
</td>
</tr>
<tr>
<td colspan="2">
<select multiple id="lstLotDisposition" style="height: 250px; width: 100%; font-family: Tahoma; border-color: lightgrey"></select>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" id='RemoveLotDispo' value="Remove Lot Disposition" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveECNsLotDispos">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="MeetingActionItemForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Add/Edit Action Items:</h4>
</div>
<div class="modal-body">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="25%">
<label for="txtActionItem">Action Item:</label>
</td>
<td width="75%">
@Html.TextArea("txtActionItem", "",5, 12, new { @class = "k-textbox", style="width:100%"})
</td>
</tr>
<tr>
<td width="25%">
<label for="ResponsibleIDs">Responsible Person:</label>
</td>
<td width="75%">
@(Html.Kendo().MultiSelect()
.Name("ResponsibleIDs")
.BindTo(new SelectList(ViewBag.AIResponsibles, "ResponsibleID", "ResponsibleName"))
.Value(ViewBag.Nothing)
.HtmlAttributes(new { style = "font-size:10px" })
)
</td>
</tr>
<tr>
<td width="25%">
<label for="dropGating">Gating:</label>
</td>
<td width="75%">
@(Html.Kendo().DropDownList()
.Name("dropGating")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "Yes",
Value = "1"
},
new SelectListItem()
{
Text = "No",
Value = "0"
}
}
)
.Value("0")
)
</td>
</tr>
<tr>
<td width="25%">
<label for="DueDate">Due Date:</label>
</td>
<td width="75%">
@(Html.Kendo().DatePicker()
.Name("txtDueDate")
)
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveMeetingActionItem">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="AttendeeForm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content" style="width: 700px">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel">Add/Edit Meeting Attendees:</h4>
</div>
<div class="modal-body">
<table class="table-condensed" border="0" width="100%">
<tr>
<td width="25%">
<label for="AttendeeIDs">Attendee Name:</label>
</td>
<td width="75%">
@(Html.Kendo().MultiSelect()
.Name("AttendeeIDs")
.BindTo(new SelectList(ViewBag.Attendees, "AttendeeID", "AttendeeName"))
//.OptionLabel("Select")
.Value(ViewBag.Nothing)
)
</td>
</tr>
<tr>
<td width="25%">
<label for="AttendeeIDs">Title:</label>
</td>
<td width="75%">
@Html.TextBox("JobTitle","", new { id = "JobTitle", @class = "k-textbox", style = "width:100%;" })
</td>
</tr>
<tr>
<td width="25%">
<label for="SiteIDs">Location:</label>
</td>
<td width="75%">
@(Html.Kendo().MultiSelect()
.Name("SiteIDs")
.BindTo(new SelectList(ViewBag.Sites, "SiteID", "SiteName"))
//.OptionLabel("Select")
.Value(ViewBag.Nothing)
)
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="SaveAttendee">OK</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="UpdateDecisionNotesWin" 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">Update Decision Notes:</h4>
</div>
<div class="modal-body">
@*<textarea class="form-control" rows="5" id="txtUpdatedDecisionNotes"></textarea>*@
@Html.TextArea("txtUpdatedDecisionNotes", "", 5, 12, new { @class = "k-textbox", style = "width:100%" })
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="ConfirmUpdateDecisionNotes">OK</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var summaryLinkID;
var actionItemID;
var actionItemOperation;
var actionDecisionNotes
var currentAttendeeID;
var currentAttachmentID;
$(document).ready(function () {
if ("@Model.Decision" == 1)
$('#chkApproved').prop('checked', true);
else if ("@Model.Decision" == 0)
$('#chkNotApproved').prop('checked', true);
})
$("#SaveMeeting").on('click', function (e) {
e.preventDefault();
var data = ReturnModelObject();
$.ajax({
url: '/ChangeControl/EditMeeting',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(data),
success: function (result) {
alert(result);
var decision = -1;
if ($('#chkApproved').is(":checked"))
decision = 1;
else if ($('#chkNotApproved').is(":checked"))
decision = 0;
if (result != "Successfully Saved" || decision != -1) {
var url = '@Url.Action("EditMeeting", "ChangeControl", new { meetingID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', "@Model.MeetingID");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert("There was an error while saving the data.Please re-load the page and check if your changes were saved \n. If the changes were not saved please contact the system administrator");
}
})
return false;
})
function ReturnModelObject() {
var pcrbs = $("#PCRValueIDs").data("kendoMultiSelect").value();
var decision;
if ($('#chkApproved').is(":checked"))
decision = 1;
else if ($('#chkNotApproved').is(":checked"))
decision = 0;
else
decision = -1;
var objecData = {
MeetingID: "@Model.MeetingID",
PlanNumber: "@Model.PlanNumber",
//PCRB: $("#PCRB").data("kendoDropDownList").value(),
PCRValueIDs: pcrbs,
ChangeLevel: $("#txtChangeLevel").val(),
MeetingDate: $("#txtMeetingDate").val(),
Notes: $("#txtNotes").val(),
Decision: decision
}
return objecData;
}
function validateDecision() {
var meetingdate = $("#txtMeetingDate").val();
var pcrbs = $("#PCRValueIDs").data("kendoMultiSelect").value();
var attendeeResult = true;
var vgrid = $("#MeetingAttendees").data("kendoGrid");
//Getting grid items
var items = vgrid.dataSource.data();
for (i = 0; i < items.length; i++) {
var item = items[i];
if (item.AttendeeName == null || item.AttendeeName == '') {
attendeeResult = false;
break;
}
}
if (meetingdate == '' || meetingdate == null) {
var fullDate = new Date();
//convert month to 2 digits
var twoDigitMonth = ((fullDate.getMonth() + 1) > 9) ? (fullDate.getMonth() + 1) : "0" + (fullDate.getMonth() + 1);
meetingdate = twoDigitMonth + "/" + fullDate.getDay() + "/" + fullDate.getFullYear();
$("#txtMeetingDate").val(meetingdate);
//return false;
}
if (pcrbs == '' || attendeeResult == false) {
return false;
}
else
return true;
}
$('#chkApproved').on('change', function () {
if (confirm("Are you sure you want to Approve the Meeting?")) {
if ($('#chkApproved').is(":checked")) {
if (validateDecision() == false) {
alert("Please make sure to populate PCRB / Attendee Names / Meeting Date, before the decision made")
$('#chkApproved').prop('checked', false);
}
else {
$('#chkNotApproved').prop('checked', false);
$("#SaveMeeting").click();
}
}
}
else {
$('#chkApproved').prop('checked', false);
}
})
$('#chkNotApproved').on('change', function () {
if (confirm("Are you sure you want to Approve the Meeting?")) {
if ($('#chkNotApproved').is(":checked")) {
if (validateDecision() == false) {
alert("Please make sure to populate PCRB and the Attendee Names, before the decision made")
$('#chkNotApproved').prop('checked', false);
}
$('#chkApproved').prop('checked', false);
$("#SaveMeeting").click();
}
}
else {
$('#chkNotApproved').prop('checked', false);
}
})
function DownloadMeetingAttachment(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var fileGUID = dataItem.FileGUID;
var attachmentID = dataItem.AttachmentID;
if (fileGUID != null) {
window.location = '/ChangeControl/DownloadMeetingFile?fileGuid=' + fileGUID + '&planNumber=' + "@Model.PlanNumber";
}
else {
alert("There is no Attachment to display ")
}
}
function UploadMeetingAttachment(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
currentAttachmentID = dataItem.ID;
e.preventDefault();
$("#WinAttachDocuments").modal('show');
}
function RefreshAttachmentsGrid() {
var grid = $("#MeetingAttachmentGrid").data("kendoGrid");
grid.dataSource.read($("@Model.PlanNumber").val());
}
function UploadAdditionalData(e) {
e.data =
{
attachID: currentAttachmentID
}
}
function buildECNLinks(ECNs) {
var template = "";
if (ECNs != null) {
var tempValue = ECNs.split(',');
for (var i = 0; i < tempValue.length; i++) {
template += "<a href='/ECN/Edit?IssueID=" + tempValue[i] + "'> " + tempValue[i] + ", </a>" + " ";
}
}
return template;
}
function buildLotDispoLinks(lotDispos) {
var template = "";
if (lotDispos != null) {
var tempValue = lotDispos.split(',');
for (var i = 0; i < tempValue.length; i++) {
template += "<a href='/LotDisposition/Edit?IssueID=" + tempValue[i] + "'>" + tempValue[i] + ", </a>" + " ";
}
}
return template;
}
function EditECNLotDispoLinks(e) {
clearECNsLotDisposListBox();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
summaryLinkID = dataItem.ID;
var ecnLinks = dataItem.ECNLinks;
var lotDispoLinks = dataItem.LotDispoLinks;
setECN_LDSelectedListBox(ecnLinks, lotDispoLinks);
$("#ECN_LotDispoLinkForm").modal('show');
e.preventDefault();
}
var clearECNsLotDisposListBox = function () {
$('#lstECNs').each(function () {
this.options.length = 0;
$(this)[0].options.length = 0;
});
$('#lstLotDisposition').each(function () {
this.options.length = 0;
$(this)[0].options.length = 0;
});
}
function setECN_LDSelectedListBox(ECNs, lotDispos) {
var innerHtml = '';
if (ECNs != null) {
var selectedECNs = ECNs.split(',');
for (i in selectedECNs) {
innerHtml += '<option value="' + selectedECNs[i].trim() + '">' + selectedECNs[i].trim() + '</option>';
}
$('#lstECNs').append(innerHtml);
}
if (lotDispos != null) {
var selectedLDs = lotDispos.split(',');
innerHtml = '';
for (i in selectedLDs) {
innerHtml += '<option value="' + selectedLDs[i].trim() + '">' + selectedLDs[i].trim() + '</option>';
}
$('#lstLotDisposition').append(innerHtml);
}
}
$("#AddECN").on('click', function () {
$('#lstECNs').append('<option value="' + $("#txtECN").val() + '">' + $("#txtECN").val() + '</option>');
})
$("#RemoveECN").on('click', function (e) {
e.preventDefault();
$("#lstECNs option:selected").remove();
})
$("#AddLotDispo").on('click', function (e) {
$('#lstLotDisposition').append('<option value="' + $("#txtLotDisposition").val() + '">' + $("#txtLotDisposition").val() + '</option>');
})
$("#RemoveLotDispo").on('click', function (e) {
e.preventDefault();
$("#lstLotDisposition option:selected").remove();
})
$("#SaveECNsLotDispos").on('click', function (e) {
e.preventDefault();
var ecns = "";
var lds = "";
$('#lstECNs option').each(function () {
if (ecns.length == 0)
ecns = this.value;
else
ecns += ', ' + this.value;
});
$('#lstLotDisposition option').each(function () {
if (lds.length == 0)
lds = this.value;
else
lds += ', ' + this.value;
});
var url = "/ChangeControl/UpdateECN_LotDispoLinks";
$.ajax({
url: url,
type: "POST",
datatype: "json",
data: {
id: summaryLinkID,
ecnLinks: ecns,
lotDispoLinks: lds
},
success: function (data) {
var grid = $("#DecisionSummary").data("kendoGrid");
grid.dataSource.read($("@Model.MeetingID").val());
},
error: function (result) {
alert("Failed " + result);
}
});
$("#ECN_LotDispoLinkForm").modal('hide');
})
function clearMeetingForm() {
$("#txtActionItem").val('');
//$("#ResponsibleIDs").data("kendoMultiSelect").value("");
$("#dropGating").data("kendoDropDownList").value("0");
$("#txtDueDate").val('');
}
function EditMeetingActionItem(e) {
var ddate;
var dueDate;
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
actionItemID = dataItem.ID;
var gating = dataItem.Gating;
if (dataItem.DueDate != null) {
ddate = new Date(dataItem.DueDate);
dueDate = (ddate.getMonth() + 1) + '/' + ddate.getDate() + '/' + ddate.getFullYear();
}
else
dueDate = '';
clearMeetingForm();
$("#txtActionItem").val(dataItem.ActionItemName);
$("#dropGating").data("kendoDropDownList").value(gating == "Yes" ? "1" : "0");
$("#txtDueDate").val(dueDate);
var temResponsible;
//alert(dataItem.ResponsiblePerson);
var data;
var dataArray;
$("#ResponsibleIDs").data("kendoMultiSelect").value("");
if (dataItem.ResponsibleID != null) {
temResponsible = dataItem.ResponsibleID.split(',');
var attValues = new Array();
}
$("#ResponsibleIDs").data("kendoMultiSelect").value(temResponsible);
actionItemOperation = 'Edit';
e.preventDefault()
$("#MeetingActionItemForm").modal("show");
}
$("#AddActionItem").on('click', function (e) {
clearMeetingForm();
actionItemOperation = 'Add';
$("#MeetingActionItemForm").modal("show");
})
$("#SaveMeetingActionItem").on('click', function () {
var objectData = ReturnMeetingActionObject();
var url = "";
if (actionItemOperation == 'Add') {
url = "/ChangeControl/InsertMeetingActionItem";
}
else {
url = "/ChangeControl/UpdateMeetingActionItem";
}
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objectData),
success: function (data) {
var grid = $("#MeetingActionItems").data("kendoGrid");
grid.dataSource.read($("@Model.MeetingID").val());
$("#MeetingActionItemForm").modal("hide");
},
error: function (result) {
alert("Failed " + result);
$("#MeetingActionItemForm").modal("hide");
}
});
})
function ReturnMeetingActionObject() {
var resp = $("#ResponsibleIDs").data("kendoMultiSelect").value()
resp = resp.join();
if (actionItemOperation == 'Add') {
var objectData = {
ID: 0,
MeetingID: "@Model.MeetingID",
ActionItemName: $("#txtActionItem").val(),
ResponsibleID: resp + ',',
Gating: $("#dropGating").data("kendoDropDownList").value() == '1' ? true : false,
DueDate: $("#txtDueDate").val()
}
}
else {
var objectData = {
ID: actionItemID,
ActionItemName: $("#txtActionItem").val(),
ResponsibleID: resp + ',',
Gating: $("#dropGating").data("kendoDropDownList").value(),
DueDate: $("#txtDueDate").val()
}
}
return objectData;
}
$("#BackToCC").on('click', function () {
window.location = '/ChangeControl/Edit?issueID=' + "@Model.PlanNumber";
})
$("#GetMeeting").on('click', function (e) {
e.preventDefault()
var meetingid = $("#MeetingList").data("kendoDropDownList").value();
window.location.href = "/ChangeControl/EditMeeting?meetingID=" + meetingid;
})
$("#CloseMeeting").on('click', function () {
if (confirm("Are you sure you want to close the Meeting")) {
var url = '/ChangeControl/CloseMeeting?meetingID=' + "@Model.MeetingID";
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
},
error: function (result) {
alert("Failed " + result);
}
});
}
})
$("#CancelMeeting").on('click', function () {
if (confirm("Are you sure you want to cancel the Meeting")) {
var url = '/ChangeControl/CancelMeeting?meetingID=' + "@Model.MeetingID";
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
},
error: function (result) {
alert("Failed " + result);
}
});
}
})
function onAttendeeDataBound() {
//Selects all edit buttons
var grid = $("#MeetingAttendees").data("kendoGrid");
var gridData = grid.dataSource.view();
}
function onMeetingAttachmentDataBound() {
//Selects all edit buttons
var grid = $("#MeetingAttachmentGrid").data("kendoGrid");
var gridData = grid.dataSource.view();
for (var i = 0; i < gridData.length; i++) {
var currentUid = gridData[i].uid;
if (gridData[i].Title == 'Meeting Presentation (Required)') {
var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']");
var editButton = $(currenRow).find(".k-grid-edit");
var deleteButton = $(currenRow).find(".k-grid-delete");
editButton.hide();
deleteButton.hide();
}
}
}
function onDecisionsDataBound() {
//Selects all edit buttons
var grid = $("#DecisionSummary").data("kendoGrid");
var gridData = grid.dataSource.view();
for (var i = 0; i < gridData.length; i++) {
var currentUid = gridData[i].uid;
var currenRow = grid.table.find("tr[data-uid='" + currentUid + "']");
var editButton = $(currenRow).find(".k-grid-edit");
var deleteButton = $(currenRow).find(".k-grid-delete");
editButton.hide();
//deleteButton.hide();
}
}
function SaveNewAttendee(e) {
var meetingId = @Model.MeetingID;
var attendee = $("#AttendeeIDs").data("kendoMultiSelect").value();
var title = document.getElementById("JobTitle").value;
var site = $("#SiteIDs").data("kendoMultiSelect").value();
if (attendee == "Select" || site == "Select") {
alert("Please select value for Attendee/Site");
return;
}
var url = "/ChangeControl/UpdateMeetingAttendee"
$.ajax({
url: "/ChangeControl/InsertNewMeetingAttendee?meetingId=" + meetingId + "&attendeeName=" + attendee + "&jobTitle"+title+"&siteName=" + site,
//url:url,
type: "GET",
datatype: "json",
//contentType: "application/json; charset=utf-8",
//data:
// {
// id: currentAttendeeID,
// attendeeName: $("#AttendeeIDs").data("kendoMultiSelect").value(),
// siteName: $("#SiteIDs").data("kendoMultiSelect").value()
// },
success: function (data) {
var grid = $("#MeetingAttendees").data("kendoGrid");
grid.dataSource.read($("@Model.MeetingID").val());
$("#AttendeeForm").modal("hide");
},
error: function (result) {
alert("Failed " + result);
$("#AttendeeForm").modal("hide");
}
});
}
function EditAttendee(e) {
var temAttendee = "";
var temLocation = "";
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
currentAttendeeID = dataItem.ID;
//alert(dataItem.JobTitle);
//current
$("#SiteIDs").data("kendoMultiSelect").value("");
$("#AttendeeIDs").data("kendoMultiSelect").value("");
if (dataItem.AttendeeName != null) {
temAttendee = dataItem.AttendeeName.split(',');
var attValues = new Array();
for (i in temAttendee) {
attValues[i] = temAttendee[i]
}
}
//$("#JobTitle").data("kendoMultiSelect").value(dataItem.JobTitle);
document.getElementById('JobTitle').value = dataItem.JobTitle;
$("#AttendeeIDs").data("kendoMultiSelect").value(temAttendee);
if (dataItem.Location != null) {
temLocation = dataItem.Location.split(',');
var locValues = new Array();
for (i in temLocation) {
locValues[i] = temLocation[i]
}
}
$("#SiteIDs").data("kendoMultiSelect").value(locValues);
//var attendee = $("#AttendeeIDs").kendoMultiSelect().data("kendoMultiSelect");
//var site = $("#SiteIDs").kendoMultiSelect().data("kendoMultiSelect");
//var att = site.value(dataItem.AttendeeName) ;
//site.value(dataItem.Location);
e.preventDefault();
$("#AttendeeForm").modal('show');
}
$("#SaveAttendee").on('click', function () {
if (currentAttendeeID === "" || currentAttendeeID === 0) {
SaveNewAttendee();
return;
}
var attendee = $("#AttendeeIDs").data("kendoMultiSelect").value();
//var title = $("#JobTitle").value();
var title = document.getElementById('JobTitle').value;
var site = $("#SiteIDs").data("kendoMultiSelect").value();
if (attendee == "Select" || site == "Select") {
alert("Please select value for Attendee/Site");
return;
}
var url = "/ChangeControl/UpdateMeetingAttendee"
$.ajax({
url: "/ChangeControl/UpdateMeetingAttendee?id=" + currentAttendeeID + "&attendeeName=" + attendee + "&jobTitle=" + title + "&siteName=" + site,
//url:url,
type: "GET",
datatype: "json",
//contentType: "application/json; charset=utf-8",
//data:
// {
// id: currentAttendeeID,
// attendeeName: $("#AttendeeIDs").data("kendoMultiSelect").value(),
// siteName: $("#SiteIDs").data("kendoMultiSelect").value()
// },
success: function (data) {
var grid = $("#MeetingAttendees").data("kendoGrid");
grid.dataSource.read($("@Model.MeetingID").val());
$("#AttendeeForm").modal("hide");
},
error: function (result) {
alert("Failed " + result);
$("#AttendeeForm").modal("hide");
}
});
})
$(window).bind("beforeunload", function () {
//return confirm("Do you really want to close?");
$.ajax({
url: "/ChangeControl/ReleaseLockOnDocument",
type: "GET",
datatype: "json",
data: {
planNumber: ("@Model.PlanNumber")
},
success: function () {
},
error: function (result) {
alert("Failed " + result);
}
});
})
$("#AddDecisionNotes").on('click', function (e) {
$('#ConfirmUpdateDecisionNotes').attr("disabled", false);
$("#txtUpdatedDecisionNotes").val('')
actionDecisionNotes = 'Add';
$("#UpdateDecisionNotesWin").modal('show');
})
function EditDecisionNotes(e) {
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
summaryLinkID = dataItem.ID;
actionDecisionNotes = 'Update';
$("#txtUpdatedDecisionNotes").val(dataItem.DecisionNotes);
$('#ConfirmUpdateDecisionNotes').attr("disabled", false);
$("#UpdateDecisionNotesWin").modal('show');
e.preventDefault();
}
$("#ConfirmUpdateDecisionNotes").on('click', function (e) {
var url = "";
if (actionDecisionNotes == "Add") {
url = '/ChangeControl/InsertDecisionsSummary';
}
else {
url = '/ChangeControl/UpdateMeetingDecisionNotes';
}
var objectData = {
ID: summaryLinkID,
MeetingID: "@Model.MeetingID",
DecisionNotes: $("#txtUpdatedDecisionNotes").val()
}
$.ajax({
url: url,
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(objectData),
success: function (data) {
var grid = $("#DecisionSummary").data("kendoGrid");
grid.dataSource.read($("@Model.MeetingID").val());
$("#UpdateDecisionNotesWin").modal('hide');
},
error: function (result) {
alert("Failed " + result);
$("#UpdateDecisionNotesWin").modal("hide");
}
});
})
function changeNewLine(text) {
if (text != null) {
var regexp = new RegExp('\n', 'g');
return text.replace(regexp, '<br>');
}
else
return '';
}
@*function IdleTimeout() {
//window.location = logoutUrl;
var url = '@Url.Action("ChangeControl", "Home")';
window.location.href = url;
}*@
</script>