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

94 lines
No EOL
4.5 KiB
Text

@using Kreta.Enums
@using Kreta.BusinessLogic.Classes
@using Kreta.Web.Helpers.Grid
@using Kreta.Web.Areas.Hianyzas.Models
@using Kreta.Resources
@model HianyzasokSearchModel
@{
var searchFormName = "searchForm";
}
@section AddSearchPanel {
@using (Html.SearchPanelSideBar(searchFormName, "HianyzasGrid"))
{
@Html.KretaRangeDatePickerSideBar(model => model.IdoszakKezdete, model => model.IdoszakVege)
@Html.KretaNumericFor(x => x.Oraszam).Min(0).Max(24).Step(1).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.TantargyId, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperApi, action = "GetTantargyList" })).RenderSearchPanelSideBar()
@Html.KretaTextBoxFor(x => x.Tema).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.MulasztasTipus, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperApi, action = "GetMulasztasTipusList" })).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.Igazolt, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperEnumApi, action = "GetIgenNemEnumList" })).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.TanoraiCeluMulasztas, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperEnumApi, action = "GetIgenNemEnumList" })).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.IgazolasTipus, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperApi, action = "GetIgazolasTipusList" })).RenderSearchPanelSideBar()
@Html.KretaRangeDatePickerSideBar(model => model.RogzitesKezdete, model => model.RogzitesVege)
@Html.HiddenFor(x => x.MulaszatasId);
}
}
<div>
@(
Html.KretaGrid<HianyzasGridModel>
(
"HianyzasGrid",
new GridApiUrl("HianyzasokApi", "GetHianyzasGrid"),
dataParameterFunction: "searchForm",
dataBoundAdditionalFunction: "HianyzasGridHelper.HighlightRow();",
sort: sort => sort.Add(m => m.MulasztasDatum).Descending(),
allowScrolling: true
)
.Columns(columns =>
{
columns.Bound(m => m.MulasztasDatum).Width("10%").Format(SDAFormat.Format[SDAFormat.FormatType.ShortDate]);
columns.Bound(m => m.Oraszam).Width("10%");
columns.Bound(m => m.Targy);
columns.Bound(m => m.Tema);
columns.Bound(m => m.MulasztasTipus_DNAME).ClientTemplate("#if (MulasztasTipus == \"" + (int)@MulasztasTipusEnum.keses + "\" && Perc != null) {# #:MulasztasTipus_DNAME# (#:Perc# " + StringResourcesUtils.GetString(220) + ") #} else {# #:MulasztasTipus_DNAME# #} #");
columns.Bound(m => m.Igazolt_BNAME).Width("10%");
columns.Bound(m => m.TanoraiCeluMulasztas_BNAME).Width("10%");
columns.Bound(m => m.IgazolasTipus_DNAME);
columns.Bound(m => m.RogzitesDatum).Width("10%").Format(SDAFormat.Format[SDAFormat.FormatType.ShortDate]);
})
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn))
.FunctionCommand(Html, new List<FunctionCommand>
{
new FunctionCommand
{
Name = ImportExportCommonResource.Export.ToUpper(),
ClientAction = "HianyzasGridHelper.export"
}
})
)
</div>
@section AddJs{
<script type="text/javascript">
var HianyzasGridHelper = (function () {
var hianyzasGridHelper = function () { };
var searchFormName = "@searchFormName";
var url = {
Export: "@Url.Action("Export", Constants.Controllers.Hianyzasok, new { area = Constants.Areas.Hianyzas })",
}
hianyzasGridHelper.HighlightRow = function () {
KretaGridHelper.getAllRows("HianyzasGrid").forEach(val => {
if (val.ID == "@Model.MulaszatasId") {
document.querySelector(`tr[data-uid="${val.uid}"]`).style.backgroundColor = "#54A5D1";
}
});
}
hianyzasGridHelper.export = function () {
window.location = url.Export + "?" + $.param(KretaGridHelper.getSearchParametersWithoutInputNames(searchFormName));
}
return hianyzasGridHelper;
})();
</script>
}