227 lines
8.5 KiB
Plaintext
227 lines
8.5 KiB
Plaintext
@model Fab2ApprovalSystem.Models.LTHoldStep
|
|
|
|
@Html.HiddenFor(model => model.LTWorkRequestID, new { id = "workRequestID" })
|
|
@Html.HiddenFor(model => model.ID, new { id = "holdStepID" })
|
|
@Html.HiddenFor(model => model.SWRNumber, new { id = "swrNumber" })
|
|
@Html.HiddenFor(model => model.Revision, new { id = "currentRevision" })
|
|
@Html.HiddenFor(model => model.currentStep, new { id = "currentStep" })
|
|
|
|
<div class="row">
|
|
<div class="col-sm-2">
|
|
<div class="control-group">
|
|
<label for="DocumentType">Document Type:</label>
|
|
<div class="controls" style="width:200px; font-size: 10px">
|
|
<div id="ex" class="k-content">
|
|
@(Html.Kendo().DropDownList()
|
|
.Name("HoldStepAttachDocType")
|
|
.DataTextField("Text")
|
|
.DataValueField("Value")
|
|
.BindTo(new List<SelectListItem>() {
|
|
new SelectListItem() {
|
|
Text = "Select",
|
|
Value = "Select"
|
|
},
|
|
new SelectListItem() {
|
|
Text = "Instructions",
|
|
Value = "Instructions"
|
|
},
|
|
new SelectListItem() {
|
|
Text = "Traveler",
|
|
Value = "Traveler"
|
|
},
|
|
new SelectListItem() {
|
|
Text = "Other",
|
|
Value = "Other"
|
|
}
|
|
|
|
})
|
|
.Value("1")
|
|
.HtmlAttributes(new { style = "width:100px;" })
|
|
)
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-sm-10">
|
|
<div class="control-group">
|
|
@(Html.Kendo().Upload()
|
|
.Name("HoldStepAttachment")
|
|
.Async(a => a
|
|
.Save("HoldStepAttachSaveRev", "LotTraveler")
|
|
.AutoUpload(true)
|
|
)
|
|
.ShowFileList(false)
|
|
.Events(events => events.Success("SetDocType").Upload("UploadData")
|
|
)
|
|
|
|
)
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<label for="HoldStepAttachmentComments">Comments:</label>
|
|
<textarea class="form-control" rows="3" id="HoldStepAttachmentComments"></textarea>
|
|
</div>
|
|
</div>
|
|
<!--.Save("AttachSave", "LotTraveler", new { holdStepID = Model.ID, currentRevision = Model.Revision, swrNo = Model.SWRNumber })-->
|
|
<div class="row">
|
|
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.LTWorkRequestAttachment>()
|
|
.Name("HoldStepAttachments")
|
|
.Columns(columns =>
|
|
{
|
|
columns.Bound(a => a.ID).Visible(false);
|
|
columns.Bound(a => a.FileGUID).Visible(false);
|
|
columns.Bound(a => a.LTHoldStepID).Visible(false);
|
|
columns.Bound(a => a.FileName).Template(@<text> @Html.ActionLink(@item.FileName.ToString(), null)</text>).Width("100px");
|
|
//.ClientTemplate("<a href='" + GlobalVars.AttachmentUrl + "LotTraveler/#=SWRNumber#/Rev#=Revision#/#=FileGUID#.#=FileExtension#' target='_blank'>#=FileName#</a>");
|
|
columns.Bound(a => a.DocType);
|
|
columns.Bound(a => a.UploadedByName);
|
|
columns.Bound(a => a.UploadDateTime).Format("{0:MM/dd/yy hh:mm:ss}");
|
|
columns.Command(c => c.Custom("View").Click("DownloadAttachment")).Width("100px"); ;
|
|
|
|
})
|
|
|
|
.Sortable()
|
|
.Scrollable()
|
|
.HtmlAttributes(new { style = "height:125; width:100%; font-size: 10px" })
|
|
.DataSource(dataSource => dataSource
|
|
.Ajax()
|
|
.ServerOperation(false)
|
|
.Model(model =>
|
|
{
|
|
model.Id(p => p.ID);
|
|
})
|
|
.PageSize(50)
|
|
.Read(read => read.Action("GetHoldStepAttachments", "LotTraveler", new { holdStepID = Model.ID }))
|
|
)
|
|
)
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var fileData;
|
|
|
|
$("#HoldStepAttachment").on('click', function (e) {
|
|
|
|
if ($("#HoldStepAttachDocType").data("kendoDropDownList").value() == "Select" ||
|
|
$("#HoldStepAttachmentComments").val() == '') {
|
|
|
|
alert('Document Type and Comments both needs to filled in before uploading a a file')
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
|
|
|
|
function SetDocType(e) {
|
|
|
|
var model = '@GlobalVars.GetCreateNewRevision(Session)';
|
|
|
|
if (model == "true") {
|
|
$.ajax({
|
|
url: '/LotTraveler/GetRevisedWrkReqIDFromHoldStepID',
|
|
type: "GET",
|
|
datatype: "json",
|
|
data: { prevHoldStepID: parseInt($("#holdStepID").val()) },
|
|
|
|
success: function (data) {
|
|
$("#AddHoldStepAttachmentFormRevision").modal('hide');
|
|
var url = '@Url.Action("WorkRequestRevision", "LotTraveler", new { workRequestID = "__id__" })';
|
|
url = url.replace('amp;', '');
|
|
window.location.href = url.replace('__id__', parseInt(data));
|
|
|
|
}
|
|
})
|
|
}
|
|
else {
|
|
var grid = $("#HoldStepAttachments").data("kendoGrid");
|
|
grid.dataSource.read($("#holdStepID").val());
|
|
|
|
RefreshHoldStepGrid();
|
|
RefreshWorkReqAttachmentsGrid();
|
|
}
|
|
}
|
|
|
|
|
|
function UploadData(e) {
|
|
fileData = 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)$/)) {
|
|
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
|
|
e.preventDefault();
|
|
}
|
|
|
|
});
|
|
|
|
//var baseFlowLocation = $("#BaseFlowLocations").data("kendoDropDownList").value();
|
|
//var baseFlowOperation = $("#BaseFlowOperations").data("kendoDropDownList").text();
|
|
//var baseFlowOperDesc = $("#txtOperationDesc").val();
|
|
//var changeInstructions = $("#ChangeInstructions").val();
|
|
|
|
|
|
|
|
//var data = ReturnModelObject();
|
|
////data.LTHoldStep = holdStepItem;
|
|
//data.RevisionComments = $("#revisionHoldStepComments").val();
|
|
|
|
e.data = {
|
|
workRequestID: $("#workRequestID").val(),
|
|
holdStepID: $("#holdStepID").val(),
|
|
currentRevision: $("#currentRevision").val(),
|
|
swrNo: $("#swrNumber").val(),
|
|
docType: $("#HoldStepAttachDocType").data("kendoDropDownList").value(),
|
|
revComments: $("#revisionHoldStepAttComments").val(),
|
|
comments: $("#HoldStepAttachmentComments").val()
|
|
};
|
|
}
|
|
|
|
|
|
function RefreshHoldStepGrid() {
|
|
var grid = $("#HoldSteps").data("kendoGrid");
|
|
grid.dataSource.read($("#workRequestID").val());
|
|
}
|
|
|
|
function RefreshWorkReqAttachmentsGrid() {
|
|
var grid = $("#WorkRequestAttachments").data("kendoGrid");
|
|
grid.dataSource.read($("@Model.ID").val());
|
|
|
|
|
|
}
|
|
|
|
|
|
//$("#submitHoldStepAttRevComments").on('click', function () {
|
|
|
|
|
|
|
|
// $.ajax({
|
|
// url: '/LotTraveler/HoldStepAttachSave',
|
|
// type: "POST",
|
|
// contentType: "application/json; charset=utf-8",
|
|
// data: { HoldStepAttachment: fileData, holdStepID: $("#holdStepID").val(), currentRevision: $("#currentRevision").val(), swrNo: $("#swrNumber").val(), docType: $("#docType").data("kendoDropDownList").value() },
|
|
// //data: JSON.stringify(fileData),
|
|
// success: function (data) {
|
|
// $("#WinHoldStepAttRevComments").modal('hide');
|
|
|
|
|
|
// }
|
|
// })
|
|
//})
|
|
|
|
function DownloadAttachment(e) {
|
|
e.preventDefault();
|
|
|
|
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
|
|
var fileGUID = dataItem.FileGUID;
|
|
var attachmentID = dataItem.AttachmentID;
|
|
|
|
window.location = '/LotTraveler/DownloadFile?fileGuid=' + fileGUID + '&swrNumber=' + "@Model.SWRNumber" + "&typeOfDoc=1";
|
|
|
|
}
|
|
|
|
</script>
|