kreta/KretaWeb/Areas/Adatszolgaltatasok/Views/VeglegesTantargyfelosztas/Index.cshtml
2024-03-13 00:33:46 +01:00

166 lines
No EOL
6.5 KiB
Text

@using Kreta.BusinessLogic.Classes
@using Kreta.Web.Areas.Adatszolgaltatasok.Models
@using Kreta.Web.Helpers.Grid
@using Kreta.Framework
@using Kreta.Resources
@using Kreta.Web.Helpers
@using Kreta.Web.Security
@model TantargyFelosztasSearchModel
@{
Layout = "~/Views/Shared/_MasterLayout.cshtml";
}
<div class="row">
@Html.KretaLabelFor(model => model.StatusTitle, 2, 10, id: "StatusTitle")
</div>
<div class="row RegNumberRow">
@Html.KretaLabelFor(model => model.RegNumber, 2, 10, id: "RegNumber")
</div>
@{
List<RowFunction> TTFelosztasRowFunctionList = new List<RowFunction> { };
List<FunctionCommand> TTFelosztasFunctionCommandList = new List<FunctionCommand>();
bool isKovtanev = ClaimData.SelectedTanevID == ClaimData.KovTanevID ? true : false;
//if (!Model.VeglegesTTF && !isKovtanev || !Model.VeglegesETTF && isKovtanev)
//{
TTFelosztasFunctionCommandList.Add(new FunctionCommand { Classes= "TTFelosztasFunctionButton", Name = "Veglegesites", NameResourceId = 4164/*Véglegesítés*/ });
//}
//else {
// TTFelosztasFunctionCommandList.Add(new FunctionCommand { Name = "VeglegesitesVisszavonasa", NameResourceId = 4167/*Véglegesítés visszavonása*/ , ClientAction = "TTFHelper.VeglegesitesVisszavonasa" });
//}
//TTFelosztasFunctionCommandList.Add(new FunctionCommand { Name = "simpleTTFExport", NameResourceId = 4002 /*Export(Egyszerű)*/ , ClientAction = "TTFHelper.SimpleExport" });
//TTFelosztasFunctionCommandList.Add(new FunctionCommand { Name = "lepedoTTFExport", NameResourceId = 4052/*Export(Kereszttáblás)*/ , ClientAction = "TTFHelper.LepedoExport" });
}
@(
Html.KretaGrid<TTFGridModel>
(
name: "TantargyFelosztasGrid",
getUrl: new GridApiUrl("TTFApi", "GetTantargyFelosztasok"),
dataBoundAdditionalFunction: "TTFHelper.getStatusz();",
allowFilterable: false,
allowPaging: true,
allowScrolling: true,
aggregates: aggregates => aggregates.Add(x => x.Oraszam).Sum()
)
.Columns(columns =>
{
columns.Bound(x => x.TanarElotagNelkul).SetDisplayProperty("Tanar");
columns.Bound(x => x.Tanev).Width("8%");
columns.Bound(x => x.OsztalyCsoport);
columns.Bound(x => x.Tantargy);
columns.Bound(x => x.Oraszam).Width("8%").ClientFooterTemplate(StringResourcesUtil.GetString(3026) + ": #= sum #");
})
.FunctionCommand(Html, TTFelosztasFunctionCommandList).RowFunction(Html, TTFelosztasRowFunctionList)
)
<script>
var TTFHelper = (function () {
$('.TTFelosztasFunctionButton').click(function () {
if ('@ApplicationData.OnTTFPrompt' !='False') {
ttfHelper.BiztonsagiKerdes();
}
else {
ttfHelper.Veglegesites();
}
//ttfHelper.getStatusz();
});
var url = {
SimpleExport: "@Url.Action("ExportEgyszeruTantargyfelosztas", "ElozetesTantargyfelosztas", new { area = "Adatszolgaltatasok" })",
Veglegesites: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "TTFApi", action = "Veglegesites" })",
GetStatusUrl: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "TTFApi", action = "GetStatus" })",
StoreSelectedTanar: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "TTFApi", action = "StoreSelectedTanar" })"
}
var ttfHelper = function () { };
ttfHelper.CloseWindow = function () {
closeAllWindow();
}
ttfHelper.SimpleExport = function () {
AjaxHelper.ShowIndicator();
setTimeout(AjaxHelper.DoPost("@Url.Action("ExportEgyszeruTantargyfelosztas", "TantargyFelosztas", new { area = "Tantargy" })", null, savefile), 1000);
}
ttfHelper.LepedoExport = function () {
AjaxHelper.ShowIndicator();
setTimeout(AjaxHelper.DoPost("@Url.Action("ExportLepedoTantargyfelosztas", "TantargyFelosztas", new { area = "Tantargy" })", null, savefile), 1000);
}
function savefile(e) {
var dataURI = "data:text/plain;base64," + e;
kendo.saveAs({
dataURI: dataURI,
fileName: "TTF" + new Date().toLocaleDateString().replace(".", "_") + ".xlsx",
});
setTimeout(AjaxHelper.HideIndicator(), 2000);
}
ttfHelper.BiztonsagiKerdes = function () {
KretaWindowHelper.confirmWindow("@AdatszolgaltatasokResource.BiztonsagiKerdes", "@AdatszolgaltatasokResource.TTFBiztonsagiKerdes", ttfHelper.Veglegesites, undefined, undefined, "@CommonResource.Folytatas", "@CommonResource.Vissza");
}
ttfHelper.getStatusz = function () {
getStatus();
}
ttfHelper.Veglegesites = function () {
AjaxHelper.DoPost(url.Veglegesites, null, function (data) { sikeresVeglegesites(data) });
};
function simpleExport() {
AjaxHelper.DoPost(url.SimpleExport, null);
}
function closeAllWindow() {
KretaWindowHelper.destroyAllWindow();
};
function refreshGrid() {
KretaGridHelper.refreshGrid("TantargyFelosztasGrid");
};
function sikeresVeglegesites(data) {
KretaWindowHelper.feedbackWindow("@(CommonResource.Siker)", "@(AdatszolgaltatasokResource.SikeresElfogadasraKuldes)", false, function () { location.reload(true) }, "@CommonResource.Ok");
setStatus(data);
};
function getStatus() {
AjaxHelper.DoGet(url.GetStatusUrl, {}, function (data) { setStatus(data) });
};
function setStatus(data) {
$('#StatusTitle').html(data.StatusTitle);
if (CommonUtils.isNullOrEmpty(data.RegNumber) == false) {
$('.RegNumberRow').show();
$('#RegNumber').html(data.RegNumber);
}
else {
$('.RegNumberRow').hide();
}
$('.TTFelosztasFunctionButton').prop("disabled", data.Islocked == true);
}
ttfHelper.onTanarChange = function () {
AjaxHelper.DoPost(url.StoreSelectedTanar, $('#TanarID').val());
}
return ttfHelper;
})();
</script>
<style>
.k-grid-content {
max-height: 58vh !important
}
</style>