kreta/KretaWeb/Areas/OsztalyCsoport/Views/Shared/_TbJogviszonyGridPartial.cshtml
2024-03-13 00:33:46 +01:00

82 lines
No EOL
3 KiB
Text

@using Kreta.Web.Areas.OsztalyCsoport.Models
@using Kreta.BusinessLogic.Classes
@using Kreta.Web.Helpers
@using Kreta.Web.Helpers.Grid
@using Kreta.Resources
@model String
<script type="text/javascript">
var TbJogviszonyPartialHelper = (function () {
var tbJogviszonyPartialHelper = function () { };
var gridName = "JogviszonyPartialGrid";
tbJogviszonyPartialHelper.dataBoundAdditionalFunction = function () {
var rowSelectHeaderCheckBox = $("#" + gridName + "_chk");
KretaCheckBoxHelper.setObjectValue(rowSelectHeaderCheckBox, false);
rowSelectHeaderCheckBox.parent().hide();
var rowSelectCheckBoxList = $("td input[id^='" + gridName + "_chk_'");
rowSelectCheckBoxList.off("change");
rowSelectCheckBoxList.on("change", function () {
var currentChecked = KretaCheckBoxHelper.getValue(this.id);
var currentRowdata = KretaGridHelper.getGridRowData(gridName, $(this).closest('tr').attr('data-uid'));
var options = $('#multiselect_to option');
$.each(options, function (index, o) {
if (o.value == currentRowdata.TanuloId) {
var jogviszonyIds = $(o).attr('jogviszonyId').split(',');
if (currentChecked) {
jogviszonyIds.push(currentRowdata.ID);
}
else {
jogviszonyIds.splice(jogviszonyIds.indexOf(currentRowdata.ID), 1);
}
if (jogviszonyIds.indexOf('0') > -1 && jogviszonyIds.length > 1) {
jogviszonyIds.splice(jogviszonyIds.indexOf('0'), 1);
}
if (jogviszonyIds.length == 0) {
jogviszonyIds.push('0');
}
$(o).attr('jogviszonyId', jogviszonyIds.join(','));
}
});
});
}
return tbJogviszonyPartialHelper;
})();
</script>
<div class="container-fluid">
<h3 class="content-content">@BesorolasResource.KisorolasTBJogviszonyGridCim</h3>
<h5>@BesorolasResource.JogviszonyVegeDatumNemLehetKisebbMintKezdet</h5>
@(Html.KretaGrid<TbJogviszonyPartialGridModel>(
name: "JogviszonyPartialGrid",
getUrl: new GridApiUrl(Constants.ApiControllers.OsztalyApi, "GetSorolasTbJogviszonyGrid", new Dictionary<string, string> { { "json", Model.ToString() } }),
dataBoundAdditionalFunction: "TbJogviszonyPartialHelper.dataBoundAdditionalFunction();",
allowFilterable: false,
allowPaging: false,
allowScrolling: true,
pageSizes: null,
useToolBar: false,
sort: sort => sort.Add(m => m.TanuloNeve).Descending()
)
.SelectBoxColumn(Html, string.Empty)
.Columns(columns =>
{
columns.Bound(c => c.TanuloNeve);
columns.Bound(c => c.JogviszonyKezdete).Format(SDAFormat.Format[SDAFormat.FormatType.ShortDate]);
columns.Bound(c => c.JogviszonyTipusa);
columns.Bound(c => c.JogviszonyKeletkezesenekJogcime);
columns.Bound(c => c.Megjegyzes);
})
.AutoBind(true)
.Sortable(sortable => sortable
.AllowUnsort(true)
.SortMode(GridSortMode.MultipleColumn))
)
</div>