128 lines
4.6 KiB
Text
128 lines
4.6 KiB
Text
@using Kreta.Web.Areas.Intezmeny.Models
|
|
@using Kreta.Resources
|
|
@model IntezmenyModel
|
|
|
|
<script type="text/javascript">
|
|
kendo.ui.Upload.fn._supportsDrop = function () { return false; }
|
|
</script>
|
|
<style type="text/css">
|
|
.dokumentum-item-padding {
|
|
padding-top: 10px;
|
|
padding-bottom: 10px;
|
|
display: block;
|
|
}
|
|
|
|
i.dokumentum-item-padding.col-md-12 {
|
|
background-color: transparent;
|
|
}
|
|
|
|
a[id^="download"] {
|
|
margin-top: 10px;
|
|
margin-bottom: 10px;
|
|
padding: 0px;
|
|
}
|
|
|
|
.dokumentum-item-type {
|
|
height: 50px;
|
|
}
|
|
|
|
.dokumentum-item-filename {
|
|
word-wrap: break-word;
|
|
font-size: 12px;
|
|
line-height: 2;
|
|
height: 70px;
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
overflow: hidden auto;
|
|
}
|
|
|
|
.k-upload-status {
|
|
position: relative;
|
|
left: 5px;
|
|
}
|
|
</style>
|
|
<div class="container-fluid details section-title">
|
|
<div class="row">
|
|
<h3>@IntezmenyResource.KotelezoDokumentumok</h3>
|
|
</div>
|
|
<div class="@BootsrapHelper.GetOffsetSizeClasses(0)">
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.AlapitoOkirat)
|
|
</div>
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.SZMSZ)
|
|
</div>
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.PedagogiaiProgram)
|
|
</div>
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.Hazirend)
|
|
</div>
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.Munkaterv)
|
|
</div>
|
|
<div>
|
|
@Html.Action("IntezmenyiDokumentumPartial", "Intezmeny", Model.MukodesiEngedely)
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
var KotelezoDokumentumFileUploadHelper = (function () {
|
|
var url = {
|
|
saveDokumentum: "@Url.Action("UploadFile", "Intezmeny", new { area = "Intezmeny" })"
|
|
};
|
|
|
|
var kotelezoDokumentumFileUploadHelper = function () { };
|
|
|
|
kotelezoDokumentumFileUploadHelper.onSelect = function (tipus, e) {
|
|
KretaFileUpload.StopAnimation();
|
|
|
|
var allowedFileExtensionArray = [".pdf", ".doc", ".docx"];
|
|
const megaByte = 1024 * 1024;
|
|
var attachmentMaxFileSizeInBytes = ((tipus === "@Model.PedagogiaiProgram.Tipus") ? 15 * megaByte : 5 * megaByte);
|
|
var attachments = e.files;
|
|
|
|
for(var i = 0; i<attachments.length;i++){
|
|
if (attachmentMaxFileSizeInBytes<attachments[i].size){
|
|
e.preventDefault();
|
|
var errorMessage = "@ErrorResource.HibaTortentXMBNalNemLehetNagyobbAFajlMerete";
|
|
errorMessage=errorMessage.replace("{0}",attachmentMaxFileSizeInBytes/(1024*1024));
|
|
KretaWindowHelper.feedbackWindow("@CommonResource.Hiba", errorMessage, true);
|
|
break;
|
|
}
|
|
|
|
if ($.inArray(attachments[i].extension.toLowerCase(), allowedFileExtensionArray)===-1){
|
|
e.preventDefault();
|
|
KretaWindowHelper.feedbackWindow("@CommonResource.Hiba","@ErrorResource.AFajlKiterjeszteseVagyTipusaNemMegfelelo", true);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
kotelezoDokumentumFileUploadHelper.uploadDokumentum = function (dokumentumTipus, e) {
|
|
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
|
e.sender.options.async.saveUrl = url.saveDokumentum;
|
|
e.data = { dokumentumTipus: dokumentumTipus };
|
|
var xhr = e.XMLHttpRequest;
|
|
if (xhr) {
|
|
xhr.addEventListener("readystatechange", function (e) {
|
|
if (xhr.readyState == 1 /* OPENED */) {
|
|
xhr.setRequestHeader("X-Request-Verification-Token", csrfToken);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
kotelezoDokumentumFileUploadHelper.onComplete = function (dokumentumTipus, e) {
|
|
var url = "@(Html.Raw(Url.Action("IntezmenyiDokumentumPartial", "Intezmeny")))";
|
|
$('#' + dokumentumTipus).parent().load(url, { model: { "Nev": "", "Tipus": dokumentumTipus, "Statusz": 0, "FajlNev": "", "IktatottDokumentumId": 0 } });
|
|
}
|
|
|
|
kotelezoDokumentumFileUploadHelper.onError = function (dokumentumTipus, e) {
|
|
KretaWindowHelper.feedbackWindow("@CommonResource.Hiba", "@ErrorResource.SikertelenFeltoltesKotelezoDokumentumon", true);
|
|
}
|
|
|
|
return kotelezoDokumentumFileUploadHelper;
|
|
})();
|
|
</script>
|