173 lines
No EOL
7.6 KiB
Text
173 lines
No EOL
7.6 KiB
Text
@using Kreta.Web.Areas.Adminisztracio.Models
|
|
@using Kreta.Enums.ManualEnums
|
|
@using Kreta.BusinessLogic.Classes
|
|
@using Kreta.Web.Helpers.Grid;
|
|
@using Kreta.Resources
|
|
|
|
@model AktivTanevValtasaModel
|
|
|
|
@section AddCss {
|
|
@Styles.Render("~/Content/RendszerHibaErtesitesek")
|
|
}
|
|
|
|
@{
|
|
var itemModel = new AktivTanevValtasaItemModel();
|
|
var kellTTFWarning = true;
|
|
string uzenetFormat = "<div class='content'>{0}</div>",
|
|
partialViewName = "TanevvaltasElem";
|
|
}
|
|
|
|
@if (Model.LejartLicence)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.LejartLicenceTitle;
|
|
itemModel.Content = string.Format(uzenetFormat, AdminisztracioResource.LejartLicenceAdat);
|
|
itemModel.Type = AdminDashboardTipusEnum.Error;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
|
|
@if (Model.KiNemSoroltTanulokOsztaly > 0)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.OsztalybaJaroTanulok;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.OsztalybaJaroTanulokLeiras, Model.KiNemSoroltTanulokOsztaly));
|
|
itemModel.Type = AdminDashboardTipusEnum.Error;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
|
|
@if (Model.BeNemSoroltNebulok > 0)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.BeNemSoroltNebulok;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.BeNemSoroltNebulokLeiras, Model.BeNemSoroltNebulok));
|
|
itemModel.Type = AdminDashboardTipusEnum.Warning;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
|
|
@if (Model.KiNemSoroltTanulokCsoport > 0)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.CsoportbaJaroTanulok;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.CsoportbaJaroTanulokLeiras, Model.KiNemSoroltTanulokCsoport));
|
|
itemModel.Type = AdminDashboardTipusEnum.Warning;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
|
|
@if (Model.NemErtekeltOsszefuggoSzakmaiGyakorlatosTanulok > 0)
|
|
{
|
|
itemModel.Name = FeljegyzesekResource.OsszefuggoSzakmaiGyakorlat;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.MegXtanuloOsszefuggoSzakmaiGyakorlataNincsErtekelve, Model.NemErtekeltOsszefuggoSzakmaiGyakorlatosTanulok));
|
|
itemModel.Type = AdminDashboardTipusEnum.Warning;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
|
|
@if (kellTTFWarning)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.ElozetesTantargyfelosztas;
|
|
itemModel.Content = string.Format(uzenetFormat, AdminisztracioResource.ElozetesTantargyfelosztasLeiras);
|
|
itemModel.Type = AdminDashboardTipusEnum.Warning;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
@if (Model.AlkalmazottakAlapertekekkel.Any())
|
|
{
|
|
itemModel.Name = AdminisztracioResource.VanAlkalmazottakAlapertekekkel;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.AlkalmazottAlapertekekkelLeiras, string.Join(", ",Model.AlkalmazottakAlapertekekkel)));
|
|
itemModel.Type = AdminDashboardTipusEnum.Error;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
}
|
|
@if (Model.VanTorlendoAlkalmazott > 0)
|
|
{
|
|
itemModel.Name = AdminisztracioResource.MegszunoMunkaviszonyuAlkalmazottak;
|
|
itemModel.Content = string.Format(uzenetFormat, string.Format(AdminisztracioResource.MegszunoMunkaviszonyuAlkalmazottakLeiras, Model.VanTorlendoAlkalmazott));
|
|
itemModel.Type = AdminDashboardTipusEnum.Warning;
|
|
|
|
Html.RenderPartial(partialViewName, itemModel);
|
|
|
|
@(
|
|
Html.KretaGrid<TanevValtasAlkalmazottTorlesGridModel>
|
|
(
|
|
name: "AlkalmazottTorlesGrid",
|
|
getUrl: new GridApiUrl("AktivTanevValtasaApi", "GetAlkalmazottTorlesGrid", new Dictionary<string, string> { }),
|
|
allowScrolling: true,
|
|
sort: sort => sort.Add(m => m.AlkalmazottNev).Ascending()
|
|
)
|
|
.SelectBoxColumn(Html, 0, true) /* */
|
|
.Columns(columns =>
|
|
{
|
|
columns.Bound(c => c.AlkalmazottNev);
|
|
columns.Bound(c => c.OktatasiAzonosito).Width("20%");
|
|
columns.Bound(c => c.AlkalmazasKezdete).Format(SDAFormat.Format[SDAFormat.FormatType.ShortDate]).Width("10%");
|
|
columns.Bound(c => c.AlkalmazasVege).Format(SDAFormat.Format[SDAFormat.FormatType.ShortDate]).Width("10%");
|
|
})
|
|
)
|
|
}
|
|
|
|
<div class="container-fluid section-function">
|
|
<div class="row">
|
|
@Html.KretaButton("ButtonTanevvaltas", AdminisztracioResource.AktivTanevValtasa, clickEventName: "AktivTanevValtasaHelper.aktivTanevValtasaConfirmWindow").Enable(!(Model.KiNemSoroltTanulokOsztaly > 0) && !(Model.AlkalmazottakAlapertekekkel.Any()) && !Model.LejartLicence)
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
var AktivTanevValtasaHelper = (function () {
|
|
var aktivTanevValtasaHelper = function () { };
|
|
var gridName = "AlkalmazottTorlesGrid";
|
|
var url = {
|
|
Tanevvaltas: "@Url.Action("AktivTanevValtasa", "AktivTanevValtasa", new { area = "Adminisztracio" })",
|
|
AlkalmazottTorles: "@Url.Action("AlkalmazottTorles", "AktivTanevValtasa", new { area = "Adminisztracio" })"
|
|
}
|
|
|
|
function tanevValtasPost() {
|
|
var json = { kiNemSoroltTanulokOsztaly: @Model.KiNemSoroltTanulokOsztaly, alkalmazottakAlapertekekkel: @Model.AlkalmazottakAlapertekekkel.Count };
|
|
AjaxHelper.DoPost(url.Tanevvaltas, json, function (response) { window.location = response.url; }, function (response) { aktivTanevValtasaErrorResponse(response.status); });
|
|
}
|
|
|
|
function aktivTanevValtasa() {
|
|
var selectedRows = KretaGridHelper.getSelectedRowsByGridName(gridName);
|
|
if (selectedRows.length == 0) { tanevValtasPost(); }
|
|
else { alkalmazottTorles(selectedRows); }
|
|
}
|
|
|
|
function alkalmazottTorles(selectedRows) {
|
|
var torlendoAlkalmazottak = [];
|
|
$.each(selectedRows, function (index, value) {
|
|
torlendoAlkalmazottak.push({ AlkalmazottId: value.ID, AlkalmazottNev: value.AlkalmazottNev });
|
|
});
|
|
|
|
var json = { torlendoAlkalmazottak: torlendoAlkalmazottak };
|
|
AjaxHelper.DoPost(url.AlkalmazottTorles, json,
|
|
function (response) { tanevValtasPost(); },
|
|
function (response) {
|
|
if (typeof response.responseJSON !== "undefined") {
|
|
KretaWindowHelper.confirmWindow("@(CommonResource.Kerdes)", response.responseJSON.Message, tanevValtasPost);
|
|
}
|
|
else { tanevValtasPost(); }
|
|
});
|
|
}
|
|
|
|
function aktivTanevValtasaErrorResponse(statusCode) {
|
|
if(statusCode == 400){
|
|
KretaWindowHelper.warningWindow("@(CommonResource.Figyelmeztetes)", "@(AdminisztracioResource.ATanevvaltasNemSikerultMertVannakDiakokAkikBeVannakSorolvaOsztalyokba)");
|
|
}
|
|
else if (statusCode == 406){
|
|
KretaWindowHelper.warningWindow("@(CommonResource.Figyelmeztetes)", "@(AdminisztracioResource.ATanevvaltasNemSikerultMertVannakAlkalmazottakAlapertekekkel)");
|
|
}
|
|
else if (statusCode == 500){
|
|
KretaWindowHelper.warningWindow("@(CommonResource.Figyelmeztetes)", "@(AdminisztracioResource.TanevValtasKozbenHibaTortent)");
|
|
}
|
|
}
|
|
|
|
aktivTanevValtasaHelper.aktivTanevValtasaConfirmWindow = function (rowData) {
|
|
var message = "@(AdminisztracioResource.TanevvaltasMegerosites)";
|
|
if (@Model.NemErtekeltOsszefuggoSzakmaiGyakorlatosTanulok > 0) {
|
|
message += "<br> @(AdminisztracioResource.ATanevvaltasUtanMarNemLeszErtekelhetoAzOsszefuggoSzakmaiGyakorlat)";
|
|
}
|
|
KretaWindowHelper.confirmWindow("@(CommonResource.Kerdes)", message, aktivTanevValtasa);
|
|
}
|
|
|
|
return aktivTanevValtasaHelper;
|
|
})();
|
|
</script> |