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

261 lines
No EOL
11 KiB
Text

@using Kreta.Web.Security;
@using Kreta.Resources
@using Kreta.Web.Areas.GRModul.Models
@using Kreta.Web.Helpers
@using Kreta.Web.Helpers.Grid
@model KotvallSearchModel
@{
Layout = "~/Views/Shared/_MasterLayout.cshtml";
const string GridName = "KotvallGrid";
const string SearchForm = "searchForm";
const string KotVallApiController = Constants.ApiControllers.KotvallKezelesApi;
const string KotVallController = Constants.Controllers.Kotelezettsegvallalas;
}
@section AddSearchPanel {
@using (Html.SearchPanelSideBar(SearchForm, GridName))
{
@Html.KretaComboBoxFor(x => x.Tanev, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "ComboBoxHelperApi", action = "GetTanevek" }), "Text", "Value", onChangeFunction: "KotvallHelper.onChangeTanev(e)").AutoBind(true).RenderSearchPanelSideBar()
@Html.KretaTextBoxFor(x => x.Sorszam).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.BejelentoIdpEgyediAzonosito, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "ComboBoxHelperApi", action = "GetAllAlkalmazottByTanev" , cascadeFilter = Model.Tanev}), "Text", "Value").AutoBind(true).RenderSearchPanelSideBar()
@Html.KretaComboBoxFor(x => x.StatuszId, Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.KotvallKezelesApi, action = "GetKotvallStatusList" })).AutoBind(true).RenderSearchPanelSideBar()
@Html.KretaTextBoxFor(x => x.BeszerzesTargya).RenderSearchPanelSideBar()
@Html.KretaRangeNumericSideBar(x => x.BruttoErtekTol, x => x.BruttoErtekIg, precision: 0, needTolIgLabels: true, step: 1.0)}
}
<style type="text/css">
.rowFunction {
width: 40px !important;
}
</style>
@(
Html.KretaGrid<KotvallGridModel>
(
GridName,
new GridApiUrl(Constants.ApiControllers.KotvallKezelesApi, "GetKotvallGrid", new Dictionary<string, string>()),
dataParameterFunction: SearchForm,
allowScrolling: true,
sort: sort => sort.Add(x => x.Sorszam).Ascending()
)
.Columns(columns =>
{
columns.Bound(x => x.Sorszam);
columns.Bound(x => x.BejelentoNeve);
columns.Bound(x => x.StatuszNeve);
columns.Bound(x => x.BeszerzesTargya);
columns.Bound(x => x.BruttoErtek).Format("{0:n0}");
})
.FunctionCommand(Html, new List<FunctionCommand>
{
new FunctionCommand { Name = CommonResource.Uj, ClientAction="KotvallHelper.openNewWindow" },
new FunctionCommand { Name = ImportExportCommonResource.Export, ClientAction="KotvallHelper.getExport" },
})
.ConditionalRowFunction(Html, new List<RowFunction>
{
new RowFunction { Name = KotvallKezelesResource.Megtekintes, ClientAction = "KotvallHelper.openInfoWindow", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Adatok, },
}, "KotvallHelper.isAdatokVisible")
.ConditionalRowFunction(Html, new List<RowFunction>
{
new RowFunction { Name = CommonResource.Modositas, ClientAction = "KotvallHelper.openModifyWindow", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Modositas },
}, "KotvallHelper.isModositasVisible")
.ConditionalRowFunction(Html, new List<RowFunction>
{
new RowFunction { Name = KotvallKezelesResource.Visszavonas, ClientAction = "KotvallHelper.openVisszavonasConfirm", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.Torles },
}, "KotvallHelper.isVisszavonasVisible")
.ConditionalRowFunction(Html, new List<RowFunction>
{
new RowFunction { Name = CommonResource.TovabbiInfo, ClientAction = "KotvallHelper.openMoreInfoWindow", IconEnum = Kreta.Enums.ManualEnums.GridRowFunctionIconEnum.HaromPont },
}, "KotvallHelper.isTovabbiInfoVisible")
)
<script type="text/javascript">
$(document).ready(function () {
kendo.cultures.current.numberFormat[","] = '.';
});
var KotvallHelper = (function () {
var kotvallHelper = function () { };
var newModInfoPopUpName = "newModInfoWindow";
var popUpFormName = "KotvallForm";
var gridName = "@GridName";
var searchFormName = "@SearchForm";
var urls = {
OpenNewModInfoPopUp: "@Url.Action("OpenNewModInfoPopUp", KotVallController, new { area = Constants.Areas.GRModul })",
OpenKiegeszitoInfoPopUp: "@Url.Action("OpenKiegeszitoInfoPopUp", KotVallController, new { area = Constants.Areas.GRModul })",
SaveBeszerzesiIgeny: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = KotVallApiController, action = "SaveBeszerzesiIgeny" })",
GetAllAlkalmazottByTanev: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.ComboBoxHelperApi, action = "GetAllAlkalmazottByTanev" })",
Visszavonas: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = Constants.ApiControllers.KotvallKezelesApi, action = "Visszavonas" })",
GetExport: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new {controller = Constants.ApiControllers.KotvallKezelesApi, action = "GetKotvallExport" })",
}
kotvallHelper.isAdatokVisible = function (rowData) {
return rowData.IsViewEnabled;
};
kotvallHelper.isModositasVisible = function (rowData) {
return rowData.IsEditEnabled;
};
kotvallHelper.isVisszavonasVisible = function (rowData) {
return rowData.IsDeleteEnabled;
};
kotvallHelper.isTovabbiInfoVisible = function (rowData) {
return rowData.IsInfoEnabled;
};
kotvallHelper.onChangeTanev = function (e) {
var filterValue = e.sender.value();
if (filterValue == '') {
filterValue = 0;
}
AjaxHelper.DoGet(urls.GetAllAlkalmazottByTanev, { cascadeFilter: filterValue }, successAlkalmazottLekeres);
}
successAlkalmazottLekeres = function (data) {
var dataSource = new kendo.data.DataSource({
data: data
});
dataSource.read();
$('#BejelentoIdpEgyediAzonosito').data('kendoComboBox').value([]);
$('#BejelentoIdpEgyediAzonosito').data('kendoComboBox').trigger("change");
$('#BejelentoIdpEgyediAzonosito').data('kendoComboBox').setDataSource(dataSource);
$('#BejelentoIdpEgyediAzonosito').data('kendoComboBox').enable(true);
}
kotvallHelper.openNewWindow = function (data) {
var postData = { Id: null, IsInfoView: false };
AjaxHelper.DoPost(urls.OpenNewModInfoPopUp, postData, popUpNewWindow, errorOpenNewWindow);
}
kotvallHelper.openModifyWindow = function (data) {
var postData = { Id: data.ID, IsInfoView: false };
AjaxHelper.DoPost(urls.OpenNewModInfoPopUp, postData, popUpModWindow, errorOpenModifyWindow);
}
kotvallHelper.openInfoWindow = function (data) {
var postData = { Id: data.ID, IsInfoView: true };
AjaxHelper.DoPost(urls.OpenNewModInfoPopUp, postData, popUpInfoWindow, errorOpenInfoWindow);
}
kotvallHelper.openMoreInfoWindow = function (data) {
var postData = { Id: data.ID };
AjaxHelper.DoPost(urls.OpenKiegeszitoInfoPopUp, postData, popUpMoreInfoWindow, errorOpenMoreInfoWindow);
}
kotvallHelper.kotvallCancel = function () {
KretaWindowHelper.destroyWindow(newModInfoPopUpName);
}
kotvallHelper.kotvallSave = function () {
var formData = $('#' + popUpFormName);
var data = formData.toObject();
if (data.Id) {
KretaWindowHelper.confirmWindow("@CommonResource.Figyelem", "@KotvallKezelesResource.BiztosBenneHogyElkuldiAModositottBeszerzesiIgenyt", kotvallHelper.save, data);
}
else {
kotvallHelper.save(data);
}
}
kotvallHelper.save = function (data) {
AjaxHelper.DoValidationPost(urls.SaveBeszerzesiIgeny, popUpFormName, data, newModSaveFeedBackOk, errorSaveBeszerzesiIgeny);
}
kotvallHelper.getExport = function () {
KretaGridHelper.getExportBySearchForm(gridName, urls.GetExport, searchFormName);
}
function popUpNewWindow(data) {
openpopUpWindow(data,"@(KotvallKezelesResource.BeszerzesiIgenyBenyujtasa)")
}
function popUpModWindow(data) {
openpopUpWindow(data,"@(KotvallKezelesResource.BeszerzesiIgenySzerkesztese)")
}
function popUpInfoWindow(data) {
openpopUpWindow(data,"@(KotvallKezelesResource.BeszerzesiIgenyReszletei)")
}
function popUpMoreInfoWindow(data) {
openpopUpWindow(data,"@(KotvallKezelesResource.KiegeszitoInformaciok)", "450px", "250px")
}
function openpopUpWindow(data, title, width, height) {
var config = KretaWindowHelper.getWindowConfigContainer();
config.title = title;
config.content = data;
config.width = CommonUtils.isNullOrUndefined(width) ? "650px" : width;
config.height = CommonUtils.isNullOrUndefined(height) ? "525px" : height;
var modal = KretaWindowHelper.createWindow(newModInfoPopUpName, config);
KretaWindowHelper.openWindow(modal, true);
}
function newModSaveFeedBackOk() {
KretaWindowHelper.destroyWindow(newModInfoPopUpName);
KretaWindowHelper.successFeedBackWindow();
KretaGridHelper.refreshGrid(gridName);
}
kotvallHelper.openVisszavonasConfirm = function (rowData) {
KretaWindowHelper.confirmWindow("@CommonResource.Figyelem", "@KotvallKezelesResource.BiztosBenneHogyVisszavonjaABenyujtottIgenyet", kotvallHelper.visszavonas, parseInt(rowData.ID));
}
kotvallHelper.visszavonas = function (data) {
AjaxHelper.DoPost(urls.Visszavonas, data, successVisszavonas, errorVisszavonas);
}
successVisszavonas = function () {
KretaWindowHelper.successFeedBackWindow();
KretaGridHelper.refreshGrid(gridName);
}
errorVisszavonas = function (data) {
setHibaUzenet(data, '@ErrorResource.SikertelenIntezmenyiBeszerzesVisszavonas');
}
errorOpenNewWindow = function (data) {
setHibaUzenet(data);
}
errorOpenModifyWindow = function (data) {
setHibaUzenet(data, '@ErrorResource.SikertelenBeszerzesLekeres');
}
errorOpenInfoWindow = function (data) {
setHibaUzenet(data, '@ErrorResource.SikertelenBeszerzesLekeres');
}
errorOpenMoreInfoWindow = function (data) {
setHibaUzenet(data, '@ErrorResource.SikertelenBeszerzesLekeres');
}
errorSaveBeszerzesiIgeny = function (data) {
setHibaUzenet(data, '@ErrorResource.SikertelenBeszerzesFelvetel');
}
function setHibaUzenet(data, modelStateHibaUzenet) {
var uzenet;
if (data.responseJSON.Json) {
uzenet = data.responseJSON.Json.Uzenet + ((data.responseJSON.Json.MegjelenitendoHiba) ? ' (' + data.responseJSON.Json.MegjelenitendoHiba + ')' : '');
}
else if (data.responseJSON.ModelState && !CommonUtils.isNullOrUndefined(modelStateHibaUzenet)) {
uzenet = modelStateHibaUzenet;
}
else {
uzenet = data.responseJSON.Message;
}
KretaWindowHelper.feedbackWindow("@ErrorResource.Hiba", uzenet, true, null, "@CommonResource.Rendben");
}
return kotvallHelper;
})();
</script>