init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
162
KretaWeb/Views/Shared/EgyHaztartasbanLevokEditor.cshtml
Normal file
162
KretaWeb/Views/Shared/EgyHaztartasbanLevokEditor.cshtml
Normal file
|
@ -0,0 +1,162 @@
|
|||
@using Kreta.Web.Helpers;
|
||||
@using Kreta.Web.Models;
|
||||
@using Kreta.Enums.ManualEnums;
|
||||
@model EgyhaztartasbanElokModel
|
||||
@{
|
||||
var formName = "EgyHaztartasbanLevokForm";
|
||||
}
|
||||
@Scripts.Render("~/bundles/moment")
|
||||
|
||||
<script type="text/javascript">
|
||||
var EgyHaztartasbanLevokHelper = (function () {
|
||||
var egyHaztartasbanLevokHelper = function () { };
|
||||
var ujCounter = 1;
|
||||
var url = {
|
||||
saveEgyHaztartasbanElokData: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "ProfilApi", action = "SaveEgyHaztartasbanElokData" })",
|
||||
loadEgyHaztartasbanElokData: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "ProfilApi", action = "LoadEgyHaztartasbanElokData" })"
|
||||
};
|
||||
|
||||
egyHaztartasbanLevokHelper.addNewRow = function (exitingData) {
|
||||
var url = "@Url.Action("GenerateNewEgyhaztartasbanElokRow", "Profil")";
|
||||
var model = {
|
||||
ID: exitingData.ID,
|
||||
Nev: exitingData.Nev,
|
||||
AnyjaNev: exitingData.AnyjaNev,
|
||||
SzuletesiIdo: exitingData.SzuletesiIdo,
|
||||
SzuletesiHely: exitingData.SzuletesiHely,
|
||||
Taj: exitingData.Taj,
|
||||
RokonsagiFok: exitingData.RokonsagiFok,
|
||||
Email: exitingData.Email,
|
||||
Telefon: exitingData.Telefon,
|
||||
RowNumber: ujCounter,
|
||||
isDeleted: false
|
||||
};
|
||||
|
||||
$.post(url, model, function (response) {
|
||||
var newRow = $("<div></div>").attr("data-status", @((int)ElerhetosegStatusEnum.New)).append(response);
|
||||
$("#newTable > .row").last().after(newRow);
|
||||
++ujCounter;
|
||||
});
|
||||
}
|
||||
|
||||
egyHaztartasbanLevokHelper.deleteRow = function (e) {
|
||||
var row = $(e.sender.element[0]).closest('div').parent().parent();
|
||||
$(row).attr("data-status", @((int)ElerhetosegStatusEnum.Deleted));
|
||||
var rowId = $(row).children('div').last().children().val();
|
||||
if (rowId != "") {
|
||||
row.hide(); revalidateForm();
|
||||
var Datas = []; Datas.push({ ID: rowId, isDeleted: true });
|
||||
var json = { Sorok: Datas };
|
||||
AjaxHelper.DoPost(url.saveEgyHaztartasbanElokData, json, successFeedBack, errorFeedBack);
|
||||
}
|
||||
else {
|
||||
$(row).parent().remove();
|
||||
revalidateForm();
|
||||
}
|
||||
}
|
||||
|
||||
egyHaztartasbanLevokHelper.Save = function () {
|
||||
var Datas = [];
|
||||
|
||||
var VisibleRows = $("#newTable [data-status=0]");
|
||||
if (VisibleRows.length > 0) {
|
||||
VisibleRows.each(function (index, value) {
|
||||
var row = $(value);
|
||||
Datas.push({
|
||||
ID: $(row).find("[id*=ID_]").val(),
|
||||
Nev: $(row).find("[id*=Nev_]:visible").val(),
|
||||
AnyjaNev: $(row).find("[id*=AnyjaNev_]:visible").val(),
|
||||
SzuletesiIdo: $(row).find("[id*=SzuletesiIdo_]:visible").val(),
|
||||
SzuletesiHely: $(row).find("[id*=SzuletesiHely_]:visible").val(),
|
||||
Taj: $(row).find("[id*=Taj_]:visible").val(),
|
||||
RokonsagiFok: $(row).find("[id*=RokonsagiFok_]").val(),
|
||||
Email: $(row).find("[id*=Email_]:visible").val(),
|
||||
Telefon: $(row).find("[id*=Telefon_]:visible").val(),
|
||||
RowNumber: index + 1,
|
||||
isDeleted: false
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var InvisibleRows = $("#newTable [data-status=2]");
|
||||
if (InvisibleRows.length > 0) {
|
||||
InvisibleRows.each(function (index, value) {
|
||||
var row = $(value);
|
||||
if ($(row).find("[id*=ID_]").val() != "") {
|
||||
Datas.push({
|
||||
ID: $(row).find("[id*=ID_]").val(),
|
||||
isDeleted: true
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (Datas.length > 0) {
|
||||
var json = { Sorok: Datas };
|
||||
AjaxHelper.DoPost(url.saveEgyHaztartasbanElokData, json, successFeedBack, errorFeedBack);
|
||||
}
|
||||
};
|
||||
|
||||
function successFeedBack() {
|
||||
revalidateForm();
|
||||
KretaWindowHelper.successFeedBackWindow();
|
||||
AjaxHelper.DoPost(url.loadEgyHaztartasbanElokData, null, reloadEgyhazTartasbanelokGrid);
|
||||
}
|
||||
|
||||
function reloadEgyhazTartasbanelokGrid(data)
|
||||
{
|
||||
$("#newTable [data-status]").remove();
|
||||
var json = $.parseJSON(data);
|
||||
$.each(json.Sorok, function (index, value) {
|
||||
value.SzuletesiIdo = moment(value.SzuletesiIdo).format('YYYY.MM.DD.');
|
||||
EgyHaztartasbanLevokHelper.addNewRow(value);
|
||||
});
|
||||
}
|
||||
|
||||
function revalidateForm() {
|
||||
$('#' + '@formName').valid();
|
||||
}
|
||||
|
||||
function errorFeedBack(data) {
|
||||
if (typeof (data.responseJSON.ModelState) !== "undefined") {
|
||||
AjaxHelper.CallRemoteErrors($('#' + '@formName'), data.responseJSON.ModelState);
|
||||
} else {
|
||||
AjaxHelper.ShowError(data);
|
||||
}
|
||||
}
|
||||
|
||||
return egyHaztartasbanLevokHelper;
|
||||
})();
|
||||
</script>
|
||||
|
||||
@using (Html.KretaForm(formName))
|
||||
{
|
||||
@Html.KretaValidationSummary()
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12" id="newTable">
|
||||
<div class="row">
|
||||
<div class="kendo-gridFunctionKommand">
|
||||
@Html.KretaButton("newRowBtn", CommonResource.Uj.ToUpper(), clickEventName: "EgyHaztartasbanLevokHelper.addNewRow", htmlAttributes: new Dictionary<string, object> { { "class", "newButtonPadding" } })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 20px"></div>
|
||||
<div class="row">
|
||||
@Html.KretaButton("ElerhetosegekModositasSaveBtn", CommonResource.Mentes, clickEventName: "EgyHaztartasbanLevokHelper.Save", htmlAttributes: new Dictionary<string, object> { { "class", "saveButton" } })
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var json = @Html.Raw(Json.Encode(@Model.Sorok));
|
||||
|
||||
$.each(json, function (index, value) {
|
||||
value.SzuletesiIdo = moment(value.SzuletesiIdo).format('YYYY.MM.DD.');
|
||||
EgyHaztartasbanLevokHelper.addNewRow(value);
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue