initial add

This commit is contained in:
Jonathan Ouellette
2022-09-27 14:10:30 -07:00
parent 91fd8a50a9
commit 580e90f6a2
3941 changed files with 954648 additions and 19 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,120 @@
@model Fab2ApprovalSystem.Models.D5D6CorrectivetAction
@Html.HiddenFor(model => model.ID, new { id = "d5d6ID" })
@Html.HiddenFor(model => model.CANo, new { id = "CANo" })
<div>
@(Html.Kendo().Upload()
.Name("D5D6CA_Attachemnt")
.Async(a => a
.Save("SaveD5D6CA_Attachemnt", "CorrectiveAction")
.AutoUpload(true)
)
.ShowFileList(false)
.Events(events => events.Upload("D5D6UploadData").Success("D5D6RefreshGrids")
)
)
</div>
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CA_Attachment>()
.Name("D5D56CA_Attachments")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.FileGUID).Visible(false);
columns.Bound(a => a.D5D6CAID).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("DownloadCAAttachment"));
columns.Command(command => command.Custom("Delete").Click("DeleteD5D6CAAttachment"));
})
.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("GetD5D6ItemAttachments", "CorrectiveAction", new { d5d6CAID = Model.ID }))
)
)
<script type="text/javascript">
var fileData;
function D5D6RefreshGrids(e) {
var grid = $("#D5D56CA_Attachments").data("kendoGrid");
grid.dataSource.read($("#d5d6ID").val());
RefreshD5D6CAGrid();
}
function D5D6UploadData(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|.slddrw|.sldprt)$/)) {
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
e.preventDefault();
}
});
e.data = {
d5d6CAID: $("#d5d6ID").val(),
caNo: $("#CANo").val()
};
}
function RefreshD5D6CAGrid() {
var grid = $("#D5D6CorrectivetActions").data("kendoGrid");
grid.dataSource.read($('@Model.CANo').val());
}
function DeleteD5D6CAAttachment(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: "/CorrectiveAction/DeleteCAAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID
},
success: function (data) {
RefreshD5D6CAGrid();
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
</script>

View File

@ -0,0 +1,136 @@
@model Fab2ApprovalSystem.Models.D7PreventiveAction
@Html.HiddenFor(model => model.ID, new { id = "d7ID" })
@Html.HiddenFor(model => model.CANo, new { id = "d7CANo" })
<div>
@(Html.Kendo().Upload()
.Name("D7PA_Attachemnt")
.Async(a => a
.Save("SaveD7PA_Attachemnt", "CorrectiveAction")
.AutoUpload(true)
)
.ShowFileList(false)
.Events(events => events.Upload("D7UploadData").Success("D7RefreshGrids").Error("D7FileUplaodError")
)
)
</div>
<div class="row">
<div class="col-sm-12">
@(Html.Kendo().Grid<Fab2ApprovalSystem.Models.CA_Attachment>()
.Name("D7PA_Attachments")
.Columns(columns =>
{
columns.Bound(a => a.ID).Visible(false);
columns.Bound(a => a.FileGUID).Visible(false);
columns.Bound(a => a.D5D6CAID).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("DownloadCAAttachment"));
columns.Command(command => command.Custom("Delete").Click("DeleteD7PAAttachment"));
})
.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("GetD7ItemAttachments", "CorrectiveAction", new { d7PAID = Model.ID }))
)
)
</div>
</div>
<script type="text/javascript">
var fileData;
function D7RefreshGrids(e) {
var grid = $("#D7PA_Attachments").data("kendoGrid");
grid.dataSource.read($("#d7ID").val());
RefreshD7PAGrid();
}
function D7UploadData(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|.slddrw|.sldprt)$/)) {
alert("Only Word/PowerPoint/Excel/PDF/Image/Text files can be uploaded!")
e.preventDefault();
}
});
e.data = {
d7PAID: $("#d7ID").val(),
caNo: $("#d7CANo").val()
};
}
function RefreshD7PAGrid() {
var grid = $("#D7PreventiveActions").data("kendoGrid");
grid.dataSource.read($('@Model.CANo').val());
}
function DeleteD7PAAttachment(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: "/CorrectiveAction/DeleteCAAttachment",
type: "POST",
datatype: "json",
data: {
attachmentID: attachmentID
},
success: function (data) {
RefreshGrids();
},
error: function (result) {
alert("Failed " + result);
}
});
}
}
function D7FileUplaodError(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);
}
alert("Error");
}
</script>