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

296 lines
14 KiB
Text

@using Kreta.Web.Areas.Hianyzas.Models
@using Kreta.Web.Helpers.Grid
@using Kreta.Resources
@using Kreta.Web.Areas.Hianyzas.Controllers
@model FelmentesekSearchModel
@section AddCss {
@Styles.Render(Constants.General.FeljegyzesekCSS)
}
@{ string gridName = FelmentesekController.GridName;
string searchFormName = FelmentesekController.SearchFormName;
}
@section AddSearchPanel {
@using (Html.SearchPanelSideBar(searchFormName, gridName))
{
@Html.KretaTextBoxFor(x => x.TanuloNeve).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.OsztalyId, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperApi, action = "GetOsztalyListByEvfolyam" })).AutoBind(true).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.TantargyIdSearch, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "ComboBoxHelperApi", action = "GetTantargy" })).AutoBind(true).RenderSearchPanelSideBar()
@Html.KretaRangeDatePickerSideBar(x => x.KezdeteDateFrom, x => x.KezdeteDateTo)
@Html.KretaRangeDatePickerSideBar(x => x.VegeDateFrom, x => x.VegeDateTo)
@Html.KretaComboBoxFor(x => x.IsTanoraLatogatasaAloli, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperEnumApi, action = "GetIgenNemEnumList" })).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.IsErtekelesAloli, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperEnumApi, action = "GetIgenNemEnumList" })).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.IsSzovegesenErtekelheto, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperEnumApi, action = "GetIgenNemEnumList" })).RenderSearchPanelSideBar()
@Html.KretaTextBoxFor(x => x.FelmentesOka).RenderSearchPanelSideBar()
@Html.KretaRangeDatePickerSideBar(x => x.RogzitesDateFrom, x => x.RogzitesDateTo)
@Html.KretaTextBoxFor(x => x.RogzitoNeve).RenderSearchPanelSideBar()
@Html.KretaRangeDatePickerSideBar(x => x.ModositasDateFrom, x => x.ModositasDateTo)
@Html.KretaTextBoxFor(x => x.ModositoNeve).RenderSearchPanelSideBar()
}
}
@{
List<FunctionCommand> nestedExportFunctions = new List<FunctionCommand>
{
new FunctionCommand {Name = ImportExportCommonResource.Export, ClientAction = "FelmentesekHelper.getExport"},
new FunctionCommand {Name = FelmentesResource.AktivFelmentesekExport, ClientAction = "FelmentesekHelper.getExportAktiv"},
new FunctionCommand {Name = FelmentesResource.ToroltFelmentesekExport, ClientAction = "FelmentesekHelper.getExportTorolt"}
};
List<FunctionCommand> functionList = new List<FunctionCommand>
{
new FunctionCommand {Name = TanuloResource.Export.ToUpper(), NestedCommands = nestedExportFunctions }
};
var rowFunctionList = new List<RowFunction>
{
new RowFunction { Name = CommonResource.Modositas, ClientAction = "FelmentesekHelper.modFelmentes", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Modositas },
new RowFunction { Name = CommonResource.Adatok, ClientAction = "FelmentesekHelper.infoFelmentes", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Adatok },
new RowFunction { Name = CommonResource.Torles, ClientAction = "FelmentesekHelper.deleteConfirmWindow", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Torles }
};
var grid = Html.KretaGrid<FelmentesekGridModel>(
gridName,
new GridApiUrl(Constants.ApiControllers.FelmentesekApi, "GetFelmentesekGrid"),
useToolBar: true,
dataParameterFunction: searchFormName,
dataBoundAdditionalFunction: "FelmentesekHelper.setAthuzas(this)",
allowSorting: true,
allowScrolling: true,
allowPaging: true,
sort: sort => sort.Add(s => s.TanuloOsztalya)
)
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn)
)
.Columns(columns => {
columns.Bound(c => c.TanuloNeve);
columns.Bound(c => c.TanuloOsztalya);
columns.Bound(c => c.TantargyNev);
columns.Bound(c => c.KezdeteDate);
columns.Bound(c => c.VegeDate);
columns.Bound(c => c.TanoraLatogatasaAloli);
columns.Bound(c => c.ErtekelesAloli);
columns.Bound(c => c.SzovegesenErtekelheto);
columns.Bound(c => c.FelmentesOka);
columns.Bound(c => c.RogzitoNeve);
})
.ConditionalRowFunction(Html, rowFunctionList, "FelmentesekHelper.isTorolt")
.FunctionCommand(Html, functionList);
}
<div>
@(grid)
</div>
<script type="text/javascript">
var FelmentesekHelper = (function () {
var felmentesekHelper = function () { }
var gridName = "@gridName";
var formName = "FelmentesForm";
var searchFormName = "@searchFormName";
var url = {
ModFelmentes: "@Url.Action("ModFelmentes", Constants.Controllers.Felmentesek, new { area = Constants.Areas.Hianyzas })",
InfoFelmentes: "@Url.Action("InfoFelmentes", Constants.Controllers.Felmentesek, new { area = Constants.Areas.Hianyzas })",
SaveFelmentes: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.FelmentesekApi, action = "SaveFelmentes" })",
DeleteFelmentes: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.FelmentesekApi, action = "DeleteFelmentes" })",
getExport: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new {controller = Constants.ApiControllers.FelmentesekApi, action = "GetExportFelmentesekGrid" })",
getExportAktiv: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new {controller = Constants.ApiControllers.FelmentesekApi, action = "GetExportAktivFelmentesek" })",
getExportTorolt: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new {controller = Constants.ApiControllers.FelmentesekApi, action = "GetExportToroltFelmentesek" })"
};
felmentesekHelper.setAthuzas = function (sender) {
var toroltUids = sender.dataSource.data().filter(function (e) { return e.Torolt }).map(function (e) { return e.uid });
$.each(sender.items(), function () {
if (($.inArray(($(this).attr("data-uid")), toroltUids)) !== -1) {
$(this).addClass("kretaStrikedGridRow disabledItem");
}
});
}
felmentesekHelper.isTorolt = function (rowData) {
return !rowData.Torolt;
}
felmentesekHelper.getExport = function () {
KretaGridHelper.getExportBySearchForm(gridName, url.getExport, searchFormName);
}
felmentesekHelper.getExportAktiv = function () {
KretaGridHelper.getExportBySearchForm(gridName, url.getExportAktiv, searchFormName);
}
felmentesekHelper.getExportTorolt = function () {
KretaGridHelper.getExportBySearchForm(gridName, url.getExportTorolt, searchFormName);
}
felmentesekHelper.infoFelmentes = function (data) {
var postData = { Id: data.ID };
AjaxHelper.DoValidationPost(url.InfoFelmentes, formName, postData, popUpInfoFelmentesWindow);
}
felmentesekHelper.modFelmentes = function (data) {
var postData = { Id: data.ID };
AjaxHelper.DoValidationPost(url.ModFelmentes, formName, postData, popUpModFelmentesWindow);
}
felmentesekHelper.modFelmentesCancel = function () {
KretaWindowHelper.destroyWindow("modFelmentesWindow");
}
felmentesekHelper.infoFelmentesCancel = function () {
KretaWindowHelper.destroyWindow("infoFelmentesWindow");
}
felmentesekHelper.modFelmentesSave = function () {
var felmentesFormData = $('#' + formName);
var felmentesData = felmentesFormData.toObject();
felmentesData.IsKorabbiMulasztasokEllenorzese = true;
felmentesData.IsKorabbiMulasztasokModositasa = false;
AjaxHelper.DoValidationPost(url.SaveFelmentes, formName, felmentesData, felmentesSaveFeedBackOk);
}
felmentesekHelper.deleteConfirmWindow = function (data) {
KretaWindowHelper.confirmWindow("@(CommonResource.Kerdes)", "@(CommonResource.BiztosanTorli)", deleteFelmentes, data.ID);
}
function felmentesSaveFeedBackOk(data) {
if (data == "") {
KretaWindowHelper.successFeedBackWindow(KretaWindowHelper.destroyAllWindow);
refreshGrid(gridName);
}
else {
KretaWindowHelper.confirmWindow("@(CommonResource.Figyelmeztetes)",
"<div class ='felmentesWarrningMessage'> @(IgazolasResource.ARogzitenikivantFelmentesiAdatokKorabbiIdoszakraVonatkoznakEsATanuloOralatogatasiKotelezettsegetErintik)</div>"
+"<div id ='MulasztasGrid' ></div>"
+ "<div class ='felmentesWarrningMessage'> @(IgazolasResource.AFelmentesRogzitesenekFolytatasavalAFentiMulasztasiErtekekTorlesreKerulnek)</div>"
+ "<div class ='felmentesWarrningMessage'> @(IgazolasResource.KivanjaFolytatniAMentestAFentieketFigyelembeVeve)</div>"
, newFelmentesSaveKorabbiMulasztasokModositasa, null, null, "@(CommonResource.Folytatas)", "@(CommonResource.Megse)", null, false, false, false, null, 1000);
$("#MulasztasGrid").kendoGrid({
columns: [
{field: "Tantargyak", title: "@(IgazolasResource.TantargyakMulasztasDbPerc)",
headerAttributes: {
style: "text-align: left; vertical-align: top;"
},
attributes: {
style: "text-align: left;"
}},
{
field:
"IgazolasraVaroKeses", title: "@(IgazolasResource.IgazolasraVaroKeses)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},
{
field: "IgazolasraVaroHianyzas", title: "@(IgazolasResource.IgazolasraVaroHianyzas)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},
{
field: "IgazoltKeses", title: "@(IgazolasResource.IgazoltKeses)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},
{
field: "IgazoltHianyzas", title: "@(IgazolasResource.IgazoltHianyzas)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},
{
field: "IgazolatlanKeses", title: "@(IgazolasResource.IgazolatlanKeses)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},
{
field: "IgazolatlanHianyzas", title: "@(IgazolasResource.IgazolatlanHianyzas)", width: "90px",
headerAttributes: {
style: "text-align: center; vertical-align: top;"
},
attributes: {
"class": "mulasztasGrid-table-cell"
}
},],
});
var dataSource = new kendo.data.DataSource({
data:data.Data
});
var grid = $("#MulasztasGrid").data("kendoGrid");
grid.setDataSource(dataSource);
$("#KretaGeneratedConfrimWindow").parent().css("margin-top", "-175px");
}
}
function popUpModFelmentesWindow(data) {
var config = KretaWindowHelper.getWindowConfigContainer();
config.title = "@(FelmentesResource.FelmentesModositasa)";
config.width = "650px";
config.height = "525px";
config.content = data;
var modal = KretaWindowHelper.createWindow("modFelmentesWindow", config);
KretaWindowHelper.openWindow(modal, true);
}
function popUpInfoFelmentesWindow(data) {
var config = KretaWindowHelper.getWindowConfigContainer();
config.title = "@(FelmentesResource.FelmentesMegtekintese)";
config.width = "650px";
config.height = "525px";
config.content = data;
var modal = KretaWindowHelper.createWindow("infoFelmentesWindow", config);
KretaWindowHelper.openWindow(modal, true);
}
function deleteFelmentes(data) {
AjaxHelper.DoPost(url.DeleteFelmentes, data, deleteFelmentesResponseOk);
}
function deleteFelmentesResponseOk() {
KretaWindowHelper.successFeedBackWindow(KretaWindowHelper.destroyAllWindow);
KretaGridHelper.refreshGridSearchPanel(gridName, searchFormName);
}
function refreshGrid(gridName) {
KretaGridHelper.refreshGrid(gridName);
}
function feedbackError() {
var message = "@(CommonResource.Hiba)";
KretaWindowHelper.feedbackWindow("@(CommonResource.Hiba)", message, true, KretaWindowHelper.destroyAllWindow);
}
return felmentesekHelper;
})();
</script>