initial add
This commit is contained in:
208
Fab2ApprovalSystem/Views/LotTraveler/_HoldStepAttachments.cshtml
Normal file
208
Fab2ApprovalSystem/Views/LotTraveler/_HoldStepAttachments.cshtml
Normal file
@ -0,0 +1,208 @@
|
||||
@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">
|
||||
@if (@Model.currentStep != 3)
|
||||
{
|
||||
@(Html.Kendo().Upload()
|
||||
.Name("HoldStepAttachment")
|
||||
.Async(a => a
|
||||
.Save("HoldStepAttachSave", "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">
|
||||
@if (@Model.currentStep != 3)
|
||||
{
|
||||
@(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#/#=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.Destroy());
|
||||
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 }))
|
||||
.Destroy(destroy => destroy.Action("DeleteHoldStepAttachment", "LotTraveler"))
|
||||
)
|
||||
)
|
||||
}
|
||||
else
|
||||
{
|
||||
@(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">
|
||||
|
||||
$("#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 grid = $("#HoldStepAttachments").data("kendoGrid");
|
||||
grid.dataSource.read($("#holdStepID").val());
|
||||
|
||||
RefreshHoldStepGrid();
|
||||
RefreshWorkReqAttachmentsGrid();
|
||||
|
||||
}
|
||||
|
||||
|
||||
function UploadData(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();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
e.data = {
|
||||
holdStepID: $("#holdStepID").val(),
|
||||
currentRevision: $("#currentRevision").val(),
|
||||
swrNo: $("#swrNumber").val(),
|
||||
docType: $("#HoldStepAttachDocType").data("kendoDropDownList").value(),
|
||||
comments: $("#HoldStepAttachmentComments").val()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function RefreshHoldStepGrid()
|
||||
{
|
||||
var grid = $("#HoldSteps").data("kendoGrid");
|
||||
grid.dataSource.read($("#workRequestID").val());
|
||||
}
|
||||
|
||||
|
||||
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>
|
Reference in New Issue
Block a user