init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
878
KretaWeb/Scripts/AjaxHelper.js
Normal file
878
KretaWeb/Scripts/AjaxHelper.js
Normal file
|
@ -0,0 +1,878 @@
|
|||
var AjaxHelper = (function () {
|
||||
var ajaxHelper = function () {};
|
||||
var postedUrlAndButtonId = ['', ''];
|
||||
ajaxHelper.ProgresUrl = '';
|
||||
|
||||
ajaxHelper.AsyncPingPost = function (url, successCallBack) {
|
||||
asyncPingPost(url, successCallBack);
|
||||
};
|
||||
ajaxHelper.AsyncPost = function (
|
||||
url,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doRequest(
|
||||
url,
|
||||
true,
|
||||
data,
|
||||
undefined,
|
||||
'POST',
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
ajaxHelper.AsyncGet = function (
|
||||
url,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack
|
||||
) {
|
||||
doRequest(
|
||||
url,
|
||||
true,
|
||||
data,
|
||||
undefined,
|
||||
'GET',
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack
|
||||
);
|
||||
};
|
||||
ajaxHelper.DoAsyncValidationPost = function (
|
||||
url,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doValidationPost(
|
||||
url,
|
||||
true,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
|
||||
ajaxHelper.DoPost = function (
|
||||
url,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doRequest(
|
||||
url,
|
||||
true,
|
||||
data,
|
||||
undefined,
|
||||
'POST',
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
|
||||
ajaxHelper.DoPostQuery = function (
|
||||
url,
|
||||
data,
|
||||
query,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doRequest(
|
||||
url,
|
||||
true,
|
||||
data,
|
||||
query,
|
||||
'POST',
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
ajaxHelper.DoPostElement = function (
|
||||
url,
|
||||
element,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doPostElement(
|
||||
url,
|
||||
true,
|
||||
element,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
|
||||
ajaxHelper.DoValidationPost = function (
|
||||
url,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
doValidationPost(
|
||||
url,
|
||||
true,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
};
|
||||
|
||||
ajaxHelper.DoGet = function (
|
||||
url,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack
|
||||
) {
|
||||
doRequest(
|
||||
url,
|
||||
true,
|
||||
undefined,
|
||||
data,
|
||||
'GET',
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack
|
||||
);
|
||||
};
|
||||
|
||||
ajaxHelper.ShowIndicator = function () {
|
||||
showLoadingIndicator();
|
||||
};
|
||||
|
||||
ajaxHelper.HideIndicator = function () {
|
||||
hideLoadingIndicator();
|
||||
};
|
||||
|
||||
ajaxHelper.RemoteErrors = function (jForm, errors) {
|
||||
remoteErrors(jForm, errors);
|
||||
};
|
||||
|
||||
ajaxHelper.CallRemoteErrors = function (formName, modelState) {
|
||||
remoteErrors(formName, modelState);
|
||||
};
|
||||
|
||||
ajaxHelper.ShowError = function (responseJSON) {
|
||||
showErrorOrReportError(responseJSON);
|
||||
};
|
||||
|
||||
function doRequest(
|
||||
url,
|
||||
isAsync,
|
||||
data,
|
||||
query,
|
||||
requestType,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
if (!CommonUtils.isUndefined(query)) {
|
||||
url = url + '?' + $.param(query);
|
||||
}
|
||||
|
||||
var jsonData = null;
|
||||
if (data != null) {
|
||||
jsonData = JSON.stringify(data);
|
||||
}
|
||||
ajaxRequest(
|
||||
url,
|
||||
isAsync,
|
||||
jsonData,
|
||||
requestType,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
}
|
||||
|
||||
function doPostElement(
|
||||
url,
|
||||
isAsync,
|
||||
element,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
element = $('#' + element);
|
||||
removeValidatonSummaryClass(element);
|
||||
if (element.valid()) {
|
||||
var data = element.toObject();
|
||||
$.each(element.find('[id$=ModelForm]'), function () {
|
||||
if (!CommonUtils.isNullOrUndefined($(this))) {
|
||||
data[$(this).attr('id').replace('ModelForm', 'Model')] =
|
||||
$(this).toObject();
|
||||
}
|
||||
});
|
||||
var jsonData = JSON.stringify(data);
|
||||
ajaxValidationPost(
|
||||
url,
|
||||
isAsync,
|
||||
element,
|
||||
jsonData,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function doValidationPost(
|
||||
url,
|
||||
isAsync,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
element = $('#' + element);
|
||||
$.each(element.find('[id$=ModelForm]'), function () {
|
||||
if (!CommonUtils.isNullOrUndefined($(this))) {
|
||||
data[$(this).attr('id').replace('ModelForm', 'Model')] =
|
||||
$(this).toObject();
|
||||
}
|
||||
});
|
||||
var jsonData = JSON.stringify(data);
|
||||
ajaxValidationPost(
|
||||
url,
|
||||
isAsync,
|
||||
element,
|
||||
jsonData,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
);
|
||||
}
|
||||
|
||||
function ajaxValidationPost(
|
||||
url,
|
||||
isAsync,
|
||||
element,
|
||||
data,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
if (!CommonUtils.isNullOrUndefined(buttonId)) {
|
||||
if (
|
||||
postedUrlAndButtonId.find(
|
||||
(element) => element.Url == url && element.ButtonId == buttonId
|
||||
) != undefined
|
||||
) {
|
||||
return;
|
||||
} else {
|
||||
postedUrlAndButtonId.push({ Url: url, ButtonId: buttonId });
|
||||
}
|
||||
}
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { 'X-Request-Verification-Token': csrfToken },
|
||||
url: url,
|
||||
data: data,
|
||||
async: isAsync,
|
||||
cache: false,
|
||||
datatype: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function (data) {
|
||||
try {
|
||||
clearErrors(element);
|
||||
callDelegateAjaxMethod(successCallBack, data);
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
},
|
||||
error: function (response) {
|
||||
errorValidationHandler(response, element, errorCallBack);
|
||||
},
|
||||
complete: function () {
|
||||
if (!CommonUtils.isNullOrUndefined(buttonId)) {
|
||||
var aktivUrlButtonId = [url, buttonId];
|
||||
postedUrlAndButtonId.splice(
|
||||
postedUrlAndButtonId.indexOf(aktivUrlButtonId),
|
||||
1
|
||||
);
|
||||
}
|
||||
try {
|
||||
callDelegateAjaxMethodComplete(completeCallBack);
|
||||
checkTimeOut();
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function asyncPingPost(url, successCallBack) {
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { 'X-Request-Verification-Token': csrfToken },
|
||||
url: url,
|
||||
async: true,
|
||||
cache: false,
|
||||
global: false,
|
||||
datatype: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function (data) {
|
||||
try {
|
||||
callDelegateAjaxMethod(successCallBack, data);
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxRequest(
|
||||
url,
|
||||
isAsync,
|
||||
data,
|
||||
requestType,
|
||||
successCallBack,
|
||||
errorCallBack,
|
||||
completeCallBack,
|
||||
buttonId
|
||||
) {
|
||||
if (!CommonUtils.isNullOrUndefined(buttonId)) {
|
||||
if (
|
||||
postedUrlAndButtonId.find(
|
||||
(element) => element.Url == url && element.ButtonId == buttonId
|
||||
) != undefined
|
||||
) {
|
||||
return;
|
||||
} else {
|
||||
postedUrlAndButtonId.push({ Url: url, ButtonId: buttonId });
|
||||
}
|
||||
}
|
||||
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
$.ajax({
|
||||
type: requestType,
|
||||
headers: { 'X-Request-Verification-Token': csrfToken },
|
||||
url: url,
|
||||
data: data,
|
||||
async: isAsync,
|
||||
cache: false,
|
||||
datatype: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
success: function (data) {
|
||||
try {
|
||||
callDelegateAjaxMethod(successCallBack, data);
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
},
|
||||
error: function (response) {
|
||||
errorHandler(response, errorCallBack);
|
||||
},
|
||||
complete: function () {
|
||||
if (!CommonUtils.isNullOrUndefined(buttonId)) {
|
||||
var aktivUrlButtonId = [url, buttonId];
|
||||
postedUrlAndButtonId.splice(
|
||||
postedUrlAndButtonId.indexOf(aktivUrlButtonId),
|
||||
1
|
||||
);
|
||||
}
|
||||
try {
|
||||
callDelegateAjaxMethodComplete(completeCallBack);
|
||||
checkTimeOut();
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function errorHandler(response, errorCallBack) {
|
||||
try {
|
||||
if (CommonUtils.isFunction(errorCallBack)) {
|
||||
errorCallBack(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.status == 491 /*WarningMegszakitas*/) {
|
||||
if (typeof response.responseJSON.Json !== 'undefined') {
|
||||
remoteServerWarrning(response.responseJSON.Json);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
showErrorOrReportError(response);
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
}
|
||||
|
||||
function errorValidationHandler(response, element, errorCallBack) {
|
||||
try {
|
||||
if (response.status == 491 /*WarningMegszakitas*/) {
|
||||
if (typeof response.responseJSON.Json !== 'undefined') {
|
||||
remoteServerWarrning(response.responseJSON.Json);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(response.responseJSON.ModelState)) {
|
||||
remoteErrors(element, response.responseJSON.ModelState);
|
||||
}
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(response.responseJSON.MVCModelState)) {
|
||||
mvcRemoteErrors(element, response.responseJSON.MVCModelState);
|
||||
}
|
||||
|
||||
if (CommonUtils.isFunction(errorCallBack)) {
|
||||
errorCallBack(response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.responseJSON.ErrorCode) {
|
||||
showReportError(response.responseJSON);
|
||||
} else {
|
||||
// ha bármilyen modelstate error van, akkor az alert error nem kell
|
||||
if (
|
||||
CommonUtils.isNullOrUndefined(response.responseJSON.ModelState) &&
|
||||
CommonUtils.isNullOrUndefined(response.responseJSON.MVCModelState)
|
||||
) {
|
||||
if (CommonUtils.isNullOrUndefined(response.responseJSON.ModelState))
|
||||
var closeFuntion = undefined;
|
||||
|
||||
if (response.responseJSON.CloseFunction) {
|
||||
closeFuntion = new Function(response.responseJSON.CloseFunction);
|
||||
}
|
||||
|
||||
showError(response.responseJSON.Message, closeFuntion);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
}
|
||||
|
||||
function callDelegateAjaxMethod(callBack, data) {
|
||||
if (CommonUtils.isFunction(callBack)) {
|
||||
callBack(data);
|
||||
}
|
||||
}
|
||||
|
||||
function callDelegateAjaxMethodComplete(callBack) {
|
||||
if (CommonUtils.isFunction(callBack)) {
|
||||
callBack();
|
||||
}
|
||||
}
|
||||
|
||||
function checkTimeOut() {
|
||||
if (!SessionHandler) {
|
||||
SessionHandler.Start();
|
||||
}
|
||||
}
|
||||
|
||||
function showLoadingIndicator() {
|
||||
var progress = $('#KretaProgressBar');
|
||||
if (progress) {
|
||||
var highest = 10000;
|
||||
$('body')
|
||||
.children()
|
||||
.each(function () {
|
||||
var current = parseInt($(this).css('z-index'), 10);
|
||||
if (current && highest < current) highest = current;
|
||||
});
|
||||
progress.css('z-index', highest + 1);
|
||||
|
||||
progress.show();
|
||||
progress.addClass('isOverlayActiv');
|
||||
$('input:submit').each(function () {
|
||||
$(this).addClass('disabledInputOnSubmit');
|
||||
$(this).prop('disabled', true);
|
||||
});
|
||||
$('button').each(function () {
|
||||
var button = $(this).data('kendoButton');
|
||||
if (typeof button !== 'undefined') {
|
||||
if ($(this).addClass('ignore-ajaxhelper') == false) {
|
||||
$(this).addClass('disabledKendoButtonOnSubmit');
|
||||
button.enable(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hideLoadingIndicator() {
|
||||
var progress = $('#KretaProgressBar');
|
||||
if (progress) {
|
||||
progress.hide();
|
||||
progress.removeClass('isOverlayActiv');
|
||||
$('.disabledInputOnSubmit').each(function () {
|
||||
$(this).prop('disabled', false);
|
||||
$(this).removeClass('disabledInputOnSubmit');
|
||||
});
|
||||
$('.disabledKendoButtonOnSubmit').each(function () {
|
||||
var button = $(this).data('kendoButton');
|
||||
if (
|
||||
typeof button !== 'undefined' &&
|
||||
$(this).addClass('ignore-ajaxhelper') == false
|
||||
) {
|
||||
button.enable(true);
|
||||
}
|
||||
$(this).removeClass('disabledKendoButtonOnSubmit');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function mvcRemoteErrors(jForm, errors) {
|
||||
function handleInput(id, error) {
|
||||
var toApply = function () {
|
||||
var control = $('#' + id);
|
||||
var label = $('label[for="' + id + '"]');
|
||||
|
||||
control.attr('title', getEncodedTextWithLineBreak(error));
|
||||
label.addClass('labelError');
|
||||
};
|
||||
setTimeout(toApply, 0);
|
||||
}
|
||||
|
||||
jForm.find('.labelError').removeClass('labelError');
|
||||
jForm.find('.field-validation-error').remove();
|
||||
|
||||
var container = jForm.find('.kreta-validation-summary');
|
||||
var list = container.find('ul');
|
||||
list.empty();
|
||||
|
||||
container
|
||||
.addClass('validation-summary-valid')
|
||||
.removeClass('validation-summary-errors');
|
||||
$('.kreta-validation-summary').css({ display: 'none' });
|
||||
|
||||
$.each(errors, function (i, error) {
|
||||
var errorData =
|
||||
"<label id='" +
|
||||
error.Key +
|
||||
i +
|
||||
"-error' class='error labelError' for='" +
|
||||
error.Key +
|
||||
"'>" +
|
||||
getEncodedTextWithLineBreak(error.Message) +
|
||||
'</label>';
|
||||
$('<li />').html(errorData).appendTo(list);
|
||||
handleInput(error.Key, error.Message);
|
||||
});
|
||||
container
|
||||
.addClass('validation-summary-errors')
|
||||
.removeClass('validation-summary-valid');
|
||||
$('.kreta-validation-summary').css({ display: 'block' });
|
||||
}
|
||||
|
||||
function remoteErrors(jForm, errors) {
|
||||
function handleInput(name, error) {
|
||||
var toApply = function () {
|
||||
for (var i = 0; i < error.length; i++) {
|
||||
var errorMessage = error[i];
|
||||
name = name.replace(/^model\./g, '');
|
||||
|
||||
var id = name.replace(/\./g, '_');
|
||||
|
||||
var control = $('#' + id);
|
||||
var label = $('label[for="' + name + '"]');
|
||||
|
||||
control.attr('title', getEncodedTextWithLineBreak(errorMessage));
|
||||
label.addClass('labelError');
|
||||
}
|
||||
};
|
||||
setTimeout(toApply, 0);
|
||||
}
|
||||
|
||||
jForm.find('.labelError').removeClass('labelError');
|
||||
jForm.find('.field-validation-error').remove();
|
||||
|
||||
var container = jForm.find('.kreta-validation-summary');
|
||||
var list = container.find('ul');
|
||||
list.empty();
|
||||
|
||||
container
|
||||
.addClass('validation-summary-valid')
|
||||
.removeClass('validation-summary-errors');
|
||||
$('.kreta-validation-summary').css({ display: 'none' });
|
||||
|
||||
$.each(errors, function (name, error) {
|
||||
if (error && error.length > 0) {
|
||||
$.each(error, function (i, ival) {
|
||||
var modelName;
|
||||
var splittedStringLength = name.split('.').length;
|
||||
|
||||
if (splittedStringLength == 2) {
|
||||
modelName = name.replace(name.slice(0, name.indexOf('.') + 1), '');
|
||||
} else if (splittedStringLength > 2) {
|
||||
modelName = name
|
||||
.replace(name.slice(0, name.indexOf('.') + 1), '')
|
||||
.replace('.', '_');
|
||||
} else {
|
||||
modelName = name;
|
||||
}
|
||||
|
||||
var errorData =
|
||||
"<label id='" +
|
||||
modelName +
|
||||
"-error' class='error labelError' for='" +
|
||||
modelName +
|
||||
"'>" +
|
||||
getEncodedTextWithLineBreak(ival) +
|
||||
'</label>';
|
||||
$('<li />').html(errorData).appendTo(list);
|
||||
});
|
||||
container
|
||||
.addClass('validation-summary-errors')
|
||||
.removeClass('validation-summary-valid');
|
||||
$('.kreta-validation-summary').css({ display: 'block' });
|
||||
|
||||
handleInput(name, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function clearErrors(jForm) {
|
||||
remoteErrors(jForm, []);
|
||||
}
|
||||
|
||||
function remoteServerWarrning(warning) {
|
||||
var closeFuntion = undefined;
|
||||
|
||||
if (warning.CloseFunction) {
|
||||
closeFuntion = new Function(warning.CloseFunction);
|
||||
}
|
||||
|
||||
KretaWindowHelper.confirmWindow(
|
||||
Globalization.Figyelem,
|
||||
warning.Msg,
|
||||
new Function(warning.SuccessFunction),
|
||||
null,
|
||||
closeFuntion,
|
||||
Globalization.Folytatas,
|
||||
Globalization.Megsem
|
||||
);
|
||||
}
|
||||
|
||||
function getEncodedTextWithLineBreak(text) {
|
||||
return kendo
|
||||
.htmlEncode(text)
|
||||
.replaceAll(kendo.htmlEncode('<br>'), '<br />')
|
||||
.replaceAll(kendo.htmlEncode('<br />'), '<br />')
|
||||
.replaceAll(kendo.htmlEncode('<br/>'), '<br />');
|
||||
}
|
||||
|
||||
function showReportError(errorJson) {
|
||||
if (errorJson.Message && errorJson.Message.length > 0) {
|
||||
if (typeof KretaWindowHelper !== 'undefined') {
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
Globalization.Hiba,
|
||||
errorJson.Message.replace(CommonUtils.LineBreakRegex, '<br />'),
|
||||
true
|
||||
);
|
||||
} else {
|
||||
logConsolError(errorJson.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showError(error, closeFuntion) {
|
||||
if (error && error.length > 0) {
|
||||
if (typeof KretaWindowHelper !== 'undefined') {
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
Globalization.Hiba,
|
||||
error,
|
||||
true,
|
||||
closeFuntion
|
||||
);
|
||||
} else {
|
||||
logConsolError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logConsolError(e) {
|
||||
if (
|
||||
typeof console !== 'undefined' &&
|
||||
typeof console.error !== 'undefined'
|
||||
) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
function showErrorOrReportError(data) {
|
||||
if (data.responseJSON) {
|
||||
if (data.responseJSON.ErrorCode) {
|
||||
showReportError(data.responseJSON);
|
||||
} else {
|
||||
if (data.responseJSON.Message) {
|
||||
var closeFuntion = undefined;
|
||||
|
||||
if (data.responseJSON.CloseFunction) {
|
||||
closeFuntion = new Function(data.responseJSON.CloseFunction);
|
||||
}
|
||||
|
||||
showError(
|
||||
data.responseJSON.Message.replace(
|
||||
CommonUtils.LineBreakRegex,
|
||||
'<br />'
|
||||
),
|
||||
closeFuntion
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeValidatonSummaryClass(item) {
|
||||
var container = item.find('.kreta-validation-summary');
|
||||
if (container.length > 0) {
|
||||
var list = container.find('ul');
|
||||
list.empty();
|
||||
}
|
||||
}
|
||||
|
||||
ajaxHelper.DownloadFile = function (
|
||||
url,
|
||||
payload,
|
||||
isGet,
|
||||
scriptAfterAjaxCall
|
||||
) {
|
||||
ajaxHelper.ShowIndicator();
|
||||
|
||||
var method = isGet ? 'GET' : 'POST';
|
||||
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
|
||||
var options = {
|
||||
method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
'X-Request-Verification-Token': csrfToken
|
||||
}
|
||||
};
|
||||
|
||||
if (payload) {
|
||||
if (isGet) {
|
||||
var query = Object.keys(payload)
|
||||
.map(
|
||||
(key) =>
|
||||
encodeURIComponent(key) + '=' + encodeURIComponent(payload[key])
|
||||
)
|
||||
.join('&');
|
||||
|
||||
url += '?' + query;
|
||||
} else {
|
||||
Object.assign(options, { body: JSON.stringify(payload) });
|
||||
}
|
||||
}
|
||||
|
||||
fetch(url, options)
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
response.json().then(function (json) {
|
||||
ajaxHelper.HideIndicator();
|
||||
|
||||
if (json && json.Message) {
|
||||
KretaWindowHelper.warningWindow('Hiba', json.Message);
|
||||
}
|
||||
|
||||
if (typeof scriptAfterAjaxCall === 'function') {
|
||||
scriptAfterAjaxCall();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (response.redirected) {
|
||||
ajaxHelper.HideIndicator();
|
||||
if (typeof scriptAfterAjaxCall === 'function') {
|
||||
scriptAfterAjaxCall();
|
||||
}
|
||||
|
||||
window.location.href = response.url;
|
||||
} else {
|
||||
var realFileName = '';
|
||||
var disposition = response.headers.get('content-disposition');
|
||||
|
||||
var fileNameMatch = /filename="?([^"]*?)"?(;|$)/g.exec(disposition);
|
||||
|
||||
if (fileNameMatch && fileNameMatch.length > 1) {
|
||||
realFileName = decodeURIComponent(fileNameMatch[1]);
|
||||
} else {
|
||||
fileNameMatch =
|
||||
/(?:.*filename\*|filename)=(?:([^'"]*)''|("))([^;]+)\2(?:[;`\n]|$)/g.exec(
|
||||
disposition
|
||||
);
|
||||
|
||||
if (fileNameMatch && fileNameMatch.length > 3) {
|
||||
var realFileName = decodeURIComponent(fileNameMatch[3]);
|
||||
}
|
||||
}
|
||||
|
||||
if (realFileName) {
|
||||
response.blob().then(function (blob) {
|
||||
ajaxHelper.HideIndicator();
|
||||
|
||||
var a = document.createElement('a');
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = realFileName;
|
||||
a.click();
|
||||
a.remove();
|
||||
|
||||
if (typeof scriptAfterAjaxCall === 'function') {
|
||||
scriptAfterAjaxCall();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ajaxHelper.HideIndicator();
|
||||
if (typeof scriptAfterAjaxCall === 'function') {
|
||||
scriptAfterAjaxCall();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
ajaxHelper.HideIndicator();
|
||||
if (typeof scriptAfterAjaxCall === 'function') {
|
||||
scriptAfterAjaxCall();
|
||||
}
|
||||
logConsolError(err);
|
||||
});
|
||||
};
|
||||
|
||||
return ajaxHelper;
|
||||
})();
|
34
KretaWeb/Scripts/AmiKepzesiJellemzokHelper.js
Normal file
34
KretaWeb/Scripts/AmiKepzesiJellemzokHelper.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
var AmiKepzesiJellemzokHelper = function () {
|
||||
var helper = function () {};
|
||||
|
||||
helper.setAmiKepzesiJellemzokRequiredProperty = function (isRequired) {
|
||||
var isRequiredAmiKepzesiJellemzok = $('#IsRequiredAmiKepzesiJellemzok');
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(isRequiredAmiKepzesiJellemzok)) {
|
||||
isRequiredAmiKepzesiJellemzok.val(isRequired);
|
||||
setLabelRequiredProperties(isRequired, 'MuveszetiAgId');
|
||||
setLabelRequiredProperties(isRequired, 'TanszakTipusId');
|
||||
}
|
||||
};
|
||||
|
||||
function setLabelRequiredProperties(isRequired, labelId) {
|
||||
if (isRequired) {
|
||||
if (
|
||||
$("[for*='" + labelId + "']")
|
||||
.text()
|
||||
.indexOf('*') === -1
|
||||
) {
|
||||
$("[for*='" + labelId + "']").append(
|
||||
$('<span>', {
|
||||
class: 'required-indicator',
|
||||
style: 'padding-left:4px'
|
||||
}).text('*')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$("[for*='" + labelId + "'] .required-indicator").remove();
|
||||
}
|
||||
}
|
||||
|
||||
return helper;
|
||||
};
|
838
KretaWeb/Scripts/Common.js
Normal file
838
KretaWeb/Scripts/Common.js
Normal file
|
@ -0,0 +1,838 @@
|
|||
if (!String.prototype.format) {
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
return typeof args[number] !== 'undefined' ? args[number] : match;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.hasValue) {
|
||||
Array.prototype.hasValue = function (key, value) {
|
||||
for (var item in this) {
|
||||
if (this.hasOwnProperty(item)) {
|
||||
if (this[item][key] === value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.contains) {
|
||||
Array.prototype.contains = function (value) {
|
||||
if ($.inArray(value, this) === -1) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.endsWith) {
|
||||
String.prototype.endsWith = function (suffix) {
|
||||
return this.indexOf(suffix, this.length - suffix.length) !== -1;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.isBase64) {
|
||||
String.prototype.isBase64 = function () {
|
||||
try {
|
||||
var decodedText = atob(this);
|
||||
var encodedText = btoa(decodedText);
|
||||
var isBase64Text = encodedText == this;
|
||||
return isBase64Text;
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$.fn.onKeyPressEnter = function (func) {
|
||||
return this.each(function () {
|
||||
$(this).keypress(function (event) {
|
||||
var keycode = parseInt(event.keyCode ? event.keyCode : event.which);
|
||||
if (keycode === 13) {
|
||||
func.call(this, event);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.onKeyPressLeft = function (func) {
|
||||
return this.each(function () {
|
||||
$(this).keypress(function (event) {
|
||||
var keycode = parseInt(event.keyCode ? event.keyCode : event.which);
|
||||
if (keycode === 37) {
|
||||
func.call(this, event);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.onKeyPressRight = function (func) {
|
||||
return this.each(function () {
|
||||
$(this).keypress(function (event) {
|
||||
var keycode = parseInt(event.keyCode ? event.keyCode : event.which);
|
||||
if (keycode === 39) {
|
||||
func.call(this, event);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
jQuery.fn.extend({
|
||||
insertAtCaret: function (myValue) {
|
||||
return this.each(function (i) {
|
||||
if (document.selection) {
|
||||
//For browsers like Internet Explorer
|
||||
this.focus();
|
||||
var sel = document.selection.createRange();
|
||||
sel.text = myValue;
|
||||
this.focus();
|
||||
} else if (this.selectionStart || this.selectionStart == '0') {
|
||||
//For browsers like Firefox and Webkit based
|
||||
var startPos = this.selectionStart;
|
||||
var endPos = this.selectionEnd;
|
||||
var scrollTop = this.scrollTop;
|
||||
this.value =
|
||||
this.value.substring(0, startPos) +
|
||||
myValue +
|
||||
this.value.substring(endPos, this.value.length);
|
||||
this.focus();
|
||||
this.selectionStart = startPos + myValue.length;
|
||||
this.selectionEnd = startPos + myValue.length;
|
||||
this.scrollTop = scrollTop;
|
||||
} else {
|
||||
this.value += myValue;
|
||||
this.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.resetForm = function () {
|
||||
var form = $(this);
|
||||
|
||||
var inputs = form.find(
|
||||
"input:not([disabled]):not(.disabledItem):not([type='hidden'])"
|
||||
);
|
||||
|
||||
$.each(inputs, function () {
|
||||
var input = $(this);
|
||||
|
||||
var type = input.prop('type');
|
||||
|
||||
if (type === 'checkbox' || type === 'radio') {
|
||||
input.prop('checked', false);
|
||||
} else {
|
||||
input.val('');
|
||||
}
|
||||
});
|
||||
|
||||
var multiselects = form.find('select[multiple]');
|
||||
|
||||
$.each(multiselects, function () {
|
||||
var multiselect = $(this);
|
||||
|
||||
var kendoMultiSelect = multiselect.data('kendoMultiSelect');
|
||||
|
||||
if (typeof kendoMultiSelect !== 'undefined') kendoMultiSelect.value([]);
|
||||
});
|
||||
};
|
||||
|
||||
var CommonUtils = (function () {
|
||||
var commonUtils = function () {};
|
||||
|
||||
commonUtils.allowOnlyNumber = function (e) {
|
||||
return allowOnlyNumber(e);
|
||||
};
|
||||
commonUtils.checkBrowserVersion = function () {
|
||||
return CheckBrowserVersion();
|
||||
};
|
||||
commonUtils.checkKendoComboBoxHasItemByValue = function (
|
||||
comboBoxName,
|
||||
value
|
||||
) {
|
||||
return checkKendoComboBoxHasItemByValue(comboBoxName, value);
|
||||
};
|
||||
commonUtils.createGuid = function (withoutHyphen) {
|
||||
return createGuid(withoutHyphen);
|
||||
};
|
||||
commonUtils.exists = function (variable) {
|
||||
return exists(variable);
|
||||
};
|
||||
commonUtils.getHtmlInnerTextFromString = function (variable) {
|
||||
return getHtmlInnerTextFromString(variable);
|
||||
};
|
||||
commonUtils.getNormalizedHtmlFromString = function (variable) {
|
||||
return getNormalizedHtmlFromString(variable);
|
||||
};
|
||||
commonUtils.isBool = function (variable) {
|
||||
return isBool(variable);
|
||||
};
|
||||
commonUtils.isFunction = function (variable) {
|
||||
return isFunction(variable);
|
||||
};
|
||||
commonUtils.isNull = function (variable) {
|
||||
return isNull(variable);
|
||||
};
|
||||
commonUtils.isNullOrEmpty = function (variable) {
|
||||
return isNullOrEmpty(variable);
|
||||
};
|
||||
commonUtils.isNullOrUndefined = function (variable) {
|
||||
return isNull(variable) || isUndefined(variable);
|
||||
};
|
||||
commonUtils.isNullOrWhiteSpace = function (variable, checkUnstrippedText) {
|
||||
return isNullOrWhiteSpace(variable, checkUnstrippedText);
|
||||
};
|
||||
commonUtils.isNullOrEmptyOrUndefined = function (variable) {
|
||||
return isNullOrEmpty(variable) || isUndefined(variable);
|
||||
};
|
||||
commonUtils.isUndefined = function (variable) {
|
||||
return isUndefined(variable);
|
||||
};
|
||||
commonUtils.parseBool = function (variable) {
|
||||
return parseBool(variable);
|
||||
};
|
||||
commonUtils.parseNull = function (variable) {
|
||||
return parseNull(variable);
|
||||
};
|
||||
commonUtils.setCaretPosition = function (input, position) {
|
||||
return setCaretPosition(input, position);
|
||||
};
|
||||
commonUtils.Log = function (text) {
|
||||
if (!isUndefined(console) && !isUndefined(console.error)) {
|
||||
console.error(text);
|
||||
}
|
||||
};
|
||||
|
||||
commonUtils.formFileDownload = function (url, fileId) {
|
||||
if ($('#hidden-form').length > 0) {
|
||||
$('#hidden-form').remove();
|
||||
}
|
||||
|
||||
$('<form>')
|
||||
.attr({
|
||||
method: 'POST',
|
||||
id: 'hidden-form',
|
||||
action: url
|
||||
})
|
||||
.appendTo('body');
|
||||
|
||||
$('<input>')
|
||||
.attr({
|
||||
type: 'hidden',
|
||||
id: 'Id',
|
||||
name: 'Id',
|
||||
value: fileId
|
||||
})
|
||||
.appendTo('#hidden-form');
|
||||
|
||||
$('#hidden-form').submit();
|
||||
};
|
||||
|
||||
commonUtils.LineBreakRegex = new RegExp('\r?\n', 'g');
|
||||
|
||||
function createGuid(withoutHyphen) {
|
||||
function s4() {
|
||||
return Math.floor((1 + Math.random()) * 0x10000)
|
||||
.toString(16)
|
||||
.substring(1);
|
||||
}
|
||||
if (withoutHyphen) {
|
||||
return s4() + s4() + s4() + s4() + s4() + s4() + s4() + s4();
|
||||
}
|
||||
return (
|
||||
s4() +
|
||||
s4() +
|
||||
'-' +
|
||||
s4() +
|
||||
'-' +
|
||||
s4() +
|
||||
'-' +
|
||||
s4() +
|
||||
'-' +
|
||||
s4() +
|
||||
s4() +
|
||||
s4()
|
||||
);
|
||||
}
|
||||
|
||||
function parseBool(variable) {
|
||||
if (
|
||||
variable === 'true' ||
|
||||
variable === 'True' ||
|
||||
variable === true ||
|
||||
variable === 1 ||
|
||||
variable === '1'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseNull(variable) {
|
||||
if (variable.toLowerCase() === 'null') {
|
||||
return null;
|
||||
}
|
||||
return variable;
|
||||
}
|
||||
|
||||
function exists(object) {
|
||||
return object.length > 0;
|
||||
}
|
||||
|
||||
function isUndefined(variable) {
|
||||
return typeof variable === 'undefined';
|
||||
}
|
||||
|
||||
function isNull(variable) {
|
||||
return variable == null;
|
||||
}
|
||||
|
||||
function isNullOrEmpty(variable) {
|
||||
return isNull(variable) || variable === '';
|
||||
}
|
||||
|
||||
function isNullOrWhiteSpace(variable, checkUnstrippedText) {
|
||||
if (typeof variable !== 'string') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isUndefined(checkUnstrippedText)) {
|
||||
checkUnstrippedText = true;
|
||||
}
|
||||
|
||||
var text;
|
||||
if (checkUnstrippedText) {
|
||||
text = variable;
|
||||
} else {
|
||||
text = getHtmlInnerTextFromString(variable);
|
||||
}
|
||||
|
||||
var result = text.trim();
|
||||
return isNullOrEmpty(result);
|
||||
}
|
||||
|
||||
function isBool(variable) {
|
||||
return typeof variable === 'boolean';
|
||||
}
|
||||
|
||||
function isFunction(variable) {
|
||||
return typeof variable === 'function';
|
||||
}
|
||||
|
||||
function getNormalizedHtmlFromString(variable) {
|
||||
var tempDivElement = document.createElement('textarea');
|
||||
tempDivElement.innerHTML = variable;
|
||||
return tempDivElement.value;
|
||||
}
|
||||
|
||||
function getHtmlInnerTextFromString(variable) {
|
||||
var tempDivElement = document.createElement('div');
|
||||
tempDivElement.innerHTML = getNormalizedHtmlFromString(variable);
|
||||
return tempDivElement.innerText;
|
||||
}
|
||||
|
||||
function allowOnlyNumber(e) {
|
||||
// Allow: backspace, delete, tab, escape, enter and .
|
||||
if (
|
||||
$.inArray(e.keyCode, [46, 8, 9, 27, 13, 110]) !== -1 ||
|
||||
// Allow: Ctrl/cmd+A
|
||||
(e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) ||
|
||||
// Allow: Ctrl/cmd+C
|
||||
(e.keyCode == 67 && (e.ctrlKey === true || e.metaKey === true)) ||
|
||||
// Allow: Ctrl/cmd+X
|
||||
(e.keyCode == 88 && (e.ctrlKey === true || e.metaKey === true)) ||
|
||||
// Allow: home, end, left, up, right, down
|
||||
(e.keyCode >= 35 && e.keyCode <= 40)
|
||||
) {
|
||||
// let it happen, don't do anything
|
||||
return;
|
||||
}
|
||||
// Ensure that it is a number and stop the keypress
|
||||
if (
|
||||
(e.shiftKey || e.keyCode < 48 || e.keyCode > 57) &&
|
||||
(e.keyCode < 96 || e.keyCode > 105)
|
||||
) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
function checkKendoComboBoxHasItemByValue(comboBoxName, value) {
|
||||
var kendoComboBox = KretaComboBoxHelper.getKendoComboBoxData(comboBoxName);
|
||||
var comboBoxItemsByValue = $.grep(kendoComboBox.dataItems(), function (e) {
|
||||
return e.Value === value;
|
||||
});
|
||||
var result = comboBoxItemsByValue.length > 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
function CheckBrowserVersion() {
|
||||
// ha mobilon lévő böngészőről nézi a böngészőt, nincs figyelmeztetés
|
||||
var indexOfMOBI = navigator.userAgent.indexOf('Mobi');
|
||||
if (indexOfMOBI !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var MinVersionEdgeHTML = 14;
|
||||
var MinVersionFirefox = 50;
|
||||
var MinVersionChrome = 50;
|
||||
var MinVersionOpera = 36;
|
||||
|
||||
var KretaBrowser = (function () {
|
||||
var userAgent = navigator.userAgent;
|
||||
|
||||
var arr =
|
||||
userAgent.match(
|
||||
/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i
|
||||
) || [];
|
||||
|
||||
var browser = arr[1];
|
||||
var version = arr[2];
|
||||
|
||||
//IE
|
||||
if (/trident/i.test(browser)) {
|
||||
browser = 'IE';
|
||||
var ieVersionArr = /\brv[ :]+(\d+)/g.exec(userAgent) || [];
|
||||
version = ieVersionArr[1] || '';
|
||||
|
||||
return { browser: browser, version: version };
|
||||
}
|
||||
|
||||
//Opera és Edge
|
||||
if (browser === 'Chrome') {
|
||||
var isEdgeOrOperaArr = userAgent.match(/\b(OPR|Edge)\/(\d+)/i);
|
||||
if (isEdgeOrOperaArr !== null) {
|
||||
browser = isEdgeOrOperaArr[1].replace('OPR', 'Opera');
|
||||
version = isEdgeOrOperaArr[2];
|
||||
|
||||
return { browser: browser, version: version };
|
||||
}
|
||||
}
|
||||
|
||||
var isOtherVersionArr = userAgent.match(/version\/(\d+)/i);
|
||||
|
||||
//Safari
|
||||
if (isOtherVersionArr !== null) {
|
||||
version = isOtherVersionArr[1];
|
||||
}
|
||||
|
||||
return { browser: browser, version: version };
|
||||
})();
|
||||
|
||||
// verzió és böngésző ellenőrzés
|
||||
if (
|
||||
KretaBrowser.browser === 'Edge' &&
|
||||
KretaBrowser.version >= MinVersionEdgeHTML
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
KretaBrowser.browser === 'Opera' &&
|
||||
KretaBrowser.version >= MinVersionOpera
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
KretaBrowser.browser === 'Firefox' &&
|
||||
KretaBrowser.version >= MinVersionFirefox
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
KretaBrowser.browser === 'Chrome' &&
|
||||
KretaBrowser.version >= MinVersionChrome
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function setCaretPosition(input, position) {
|
||||
if (input.setSelectionRange) {
|
||||
// Modern browsers
|
||||
input.focus();
|
||||
input.setSelectionRange(position, position);
|
||||
} else if (input.createTextRange) {
|
||||
// IE8 and below
|
||||
var textRange = input.createTextRange();
|
||||
textRange.collapse(true);
|
||||
textRange.moveEnd('character', position);
|
||||
textRange.moveStart('character', position);
|
||||
textRange.select();
|
||||
}
|
||||
}
|
||||
|
||||
commonUtils.hunSorterWithKey = function (key) {
|
||||
return function hunSort(x, y) {
|
||||
if (!x.hasOwnProperty(key) || !y.hasOwnProperty(key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var a = x[key];
|
||||
var b = y[key];
|
||||
var hunABC = [
|
||||
'A',
|
||||
'Á',
|
||||
'B',
|
||||
'C',
|
||||
'CS',
|
||||
'D',
|
||||
'DZ',
|
||||
'DZS',
|
||||
'E',
|
||||
'É',
|
||||
'F',
|
||||
'G',
|
||||
'GY',
|
||||
'H',
|
||||
'I',
|
||||
'Í',
|
||||
'J',
|
||||
'K',
|
||||
'L',
|
||||
'LY',
|
||||
'M',
|
||||
'N',
|
||||
'NY',
|
||||
'O',
|
||||
'Ó',
|
||||
'Ö',
|
||||
'Ő',
|
||||
'P',
|
||||
'Q',
|
||||
'R',
|
||||
'S',
|
||||
'SZ',
|
||||
'T',
|
||||
'TY',
|
||||
'U',
|
||||
'Ú',
|
||||
'Ü',
|
||||
'Ű',
|
||||
'V',
|
||||
'W',
|
||||
'X',
|
||||
'Y',
|
||||
'Z',
|
||||
'ZS'
|
||||
];
|
||||
var digraphs = ['CS', 'DZ', 'GY', 'LY', 'NY', 'SZ', 'TY', 'ZS'];
|
||||
var trigraphs = ['DZS'];
|
||||
var hunAccentsMap = {
|
||||
Á: 'A',
|
||||
É: 'E',
|
||||
Í: 'I',
|
||||
Ó: 'O',
|
||||
Ő: 'Ö',
|
||||
Ú: 'U',
|
||||
Ű: 'Ü'
|
||||
};
|
||||
var foreignCharactersMap = {
|
||||
// A
|
||||
À: 'A',
|
||||
Â: 'A',
|
||||
Ă: 'A',
|
||||
Ä: 'A',
|
||||
Ą: 'A',
|
||||
Å: 'A',
|
||||
Ā: 'A',
|
||||
Æ: 'A',
|
||||
// C
|
||||
Č: 'C',
|
||||
Ć: 'C',
|
||||
Ç: 'C',
|
||||
// D
|
||||
Ď: 'D',
|
||||
Ð: 'D',
|
||||
Dž: 'D',
|
||||
Đ: 'D',
|
||||
// E
|
||||
È: 'E',
|
||||
Ê: 'E',
|
||||
Ě: 'E',
|
||||
Ë: 'E',
|
||||
Ę: 'E',
|
||||
Ē: 'E',
|
||||
// G
|
||||
Ğ: 'G',
|
||||
// I
|
||||
Ì: 'I',
|
||||
Î: 'I',
|
||||
Ï: 'I',
|
||||
İ: 'I',
|
||||
Ī: 'I',
|
||||
// L
|
||||
Ĺ: 'L',
|
||||
Ľ: 'L',
|
||||
Lj: 'L',
|
||||
Ł: 'L',
|
||||
Ḷ: 'L',
|
||||
Ḹ: 'L',
|
||||
// N
|
||||
Ň: 'N',
|
||||
Ñ: 'N',
|
||||
Nj: 'N',
|
||||
// O
|
||||
Ò: 'O',
|
||||
Ô: 'O',
|
||||
Õ: 'O',
|
||||
Ō: 'O',
|
||||
Ø: 'O',
|
||||
Œ: 'O',
|
||||
// R
|
||||
Ŕ: 'R',
|
||||
Ř: 'R',
|
||||
Ṛ: 'R',
|
||||
Ṝ: 'R',
|
||||
// S
|
||||
Ś: 'S',
|
||||
Š: 'S',
|
||||
Ŝ: 'S',
|
||||
Ș: 'S',
|
||||
Ş: 'S',
|
||||
// T
|
||||
Ť: 'T',
|
||||
Ț: 'T',
|
||||
Þ: 'T',
|
||||
// U
|
||||
Ù: 'U',
|
||||
Û: 'U',
|
||||
Ů: 'U',
|
||||
Ū: 'U',
|
||||
// Y
|
||||
Ý: 'Y',
|
||||
Ÿ: 'Y',
|
||||
// Z
|
||||
Ź: 'Z',
|
||||
Ż: 'Z',
|
||||
Ž: 'Z'
|
||||
};
|
||||
var removeAccent = false;
|
||||
|
||||
// clean special characters and replace ssz -> szsz
|
||||
var cleanerRegex =
|
||||
/(.)(?=\1)(DZS|CS|DZ|GY|LY|NY|SZ|TY|ZS)| |-|\[|\]|\.|\(|\)|/g;
|
||||
|
||||
var cleanForeignCharacters = function cleanForeignCharacters(text) {
|
||||
return [].concat(text).reduce(function (acc, curr) {
|
||||
return acc + (foreignCharactersMap[curr] || curr);
|
||||
}, '');
|
||||
};
|
||||
|
||||
var getUpperCaseAndReplaxeTwiceOccured =
|
||||
function getUpperCaseAndReplaxeTwiceOccured(text) {
|
||||
return cleanForeignCharacters(text.toUpperCase()).replace(
|
||||
cleanerRegex,
|
||||
'$2$2'
|
||||
);
|
||||
};
|
||||
|
||||
var aUpper = getUpperCaseAndReplaxeTwiceOccured(a);
|
||||
var bUpper = getUpperCaseAndReplaxeTwiceOccured(b);
|
||||
|
||||
var compareNumbers = function compareNumbers(i, j) {
|
||||
if (i < j) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (i > j) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
var getCharAndShift = function getCharAndShift(text, index) {
|
||||
var shift = 3;
|
||||
var _char = '';
|
||||
|
||||
if (trigraphs.includes(text.substring(index, index + shift))) {
|
||||
_char = text.substring(index, index + shift);
|
||||
} else {
|
||||
shift = 2;
|
||||
|
||||
if (digraphs.includes(text.substring(index, index + shift))) {
|
||||
_char = text.substring(index, index + shift);
|
||||
} else {
|
||||
shift = 1;
|
||||
_char = text.charAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
shift: shift,
|
||||
char: _char,
|
||||
isNumber: Number.isInteger(parseInt(_char))
|
||||
};
|
||||
};
|
||||
|
||||
var getIndex = function getIndex(_char2) {
|
||||
return hunABC.indexOf(
|
||||
(removeAccent && hunAccentsMap[_char2]) || _char2
|
||||
);
|
||||
};
|
||||
|
||||
var compareTexts = function compareTexts(_ref) {
|
||||
var aIndex = _ref.aIndex,
|
||||
bIndex = _ref.bIndex;
|
||||
|
||||
var _getCharAndShift = getCharAndShift(aUpper, aIndex),
|
||||
aShift = _getCharAndShift.shift,
|
||||
aCurrentChar = _getCharAndShift['char'],
|
||||
aIsNumber = _getCharAndShift.isNumber;
|
||||
|
||||
var _getCharAndShift2 = getCharAndShift(bUpper, bIndex),
|
||||
bShift = _getCharAndShift2.shift,
|
||||
bCurrentChar = _getCharAndShift2['char'],
|
||||
bIsNumber = _getCharAndShift2.isNumber;
|
||||
|
||||
var aCharIndex = getIndex(aCurrentChar);
|
||||
var bCharIndex = getIndex(bCurrentChar);
|
||||
|
||||
if (aIsNumber && bIsNumber) {
|
||||
var aNumber = parseInt(aCurrentChar);
|
||||
var bNumber = parseInt(bCurrentChar);
|
||||
if (aNumber !== bNumber) {
|
||||
return compareNumbers(aNumber, bNumber);
|
||||
}
|
||||
} else if (aCharIndex !== bCharIndex) {
|
||||
return compareNumbers(aCharIndex, bCharIndex);
|
||||
}
|
||||
|
||||
return compareTexts({
|
||||
aIndex: aIndex + aShift,
|
||||
bIndex: bIndex + bShift
|
||||
});
|
||||
};
|
||||
|
||||
var cleanAccent = function cleanAccent(text) {
|
||||
return [].concat(text).reduce(function (acc, curr) {
|
||||
return acc + (hunAccentsMap[curr] || curr);
|
||||
}, '');
|
||||
};
|
||||
|
||||
if (aUpper === bUpper) {
|
||||
var aFirstChar = getIndex(a.charAt(0));
|
||||
var bFirstChar = getIndex(b.charAt(0));
|
||||
return compareNumbers(aFirstChar, bFirstChar);
|
||||
}
|
||||
|
||||
return compareTexts({
|
||||
aIndex: 0,
|
||||
bIndex: 0
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
commonUtils.getBankszamlaVezetoBankAjax = function (url, bankszamlaszam) {
|
||||
if (bankszamlaszam === undefined) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $.ajax({
|
||||
type: 'POST',
|
||||
global: false,
|
||||
dataType: 'html',
|
||||
url: url,
|
||||
data: { bankszamlaszam: bankszamlaszam },
|
||||
success: function (data) {
|
||||
tmp = data;
|
||||
},
|
||||
error: function (xhr, textStatus, errorThrown) {
|
||||
tmp = '';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
commonUtils.dateFormat = 'YYYY-MM-DD';
|
||||
commonUtils.dateTimeFormat = 'YYYY-MM-DD HH:mm';
|
||||
|
||||
commonUtils.getUtcTimeFromDateAndTime = function (date, time) {
|
||||
var datum;
|
||||
if (CommonUtils.isNullOrUndefined(date)) {
|
||||
datum = moment(new Date()).format(commonUtils.dateFormat);
|
||||
} else {
|
||||
var parameterDateFormat =
|
||||
date.indexOf('-') > -1 ? commonUtils.dateFormat : 'YYYY. MM. DD.';
|
||||
datum = moment(date, parameterDateFormat).format(commonUtils.dateFormat);
|
||||
}
|
||||
|
||||
var splittedTime = '';
|
||||
if (time.length <= 5) {
|
||||
splittedTime = time.substr(time.length - 5);
|
||||
} else {
|
||||
splittedTime = moment(time, 'HH:mm:ss').format('LT'); // LT -> AM/PM szerepel a time-nál
|
||||
}
|
||||
|
||||
var idopont = moment(datum + splittedTime, commonUtils.dateTimeFormat);
|
||||
var utcIdopont = moment(idopont).utc().format(commonUtils.dateTimeFormat);
|
||||
|
||||
var utcTime = moment(utcIdopont).format('HH:mm');
|
||||
return utcTime;
|
||||
};
|
||||
|
||||
commonUtils.SetUtcDateTimeFromDatetime = function (dateTime) {
|
||||
return (
|
||||
moment(dateTime).format('YYYY-MM-DD') +
|
||||
' ' +
|
||||
commonUtils.getUtcTimeFromDateAndTime(
|
||||
moment(dateTime).format('YYYY-MM-DD'),
|
||||
moment(dateTime).format('HH:mm:ss')
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
commonUtils.EscapeControlCharacters = function (jsonString) {
|
||||
return (
|
||||
jsonString
|
||||
.replace(/\n/g, '\\n') // line feed
|
||||
.replace(/\r/g, '\\r') // carriage return
|
||||
.replace(/\t/g, '\\t') // horizontal tab
|
||||
//.replace(/\b/g, "\\b") // backspace
|
||||
.replace(/\v/g, '\\v') // vertical tab
|
||||
//.replace(/\a/g, "\\a") // bell
|
||||
.replace(/\f/g, '\\f')
|
||||
); // form feed
|
||||
};
|
||||
|
||||
commonUtils.JSONparse = function (json) {
|
||||
if (json.substring(1, 2) === '\r' || json.substring(1, 2) === '\n') {
|
||||
return JSON.parse(json);
|
||||
}
|
||||
|
||||
return JSON.parse(CommonUtils.EscapeControlCharacters(json));
|
||||
};
|
||||
|
||||
//Required if mezők UI oldali ellenőrzése
|
||||
//params: expression: bool, fieldId:string, errorMessage:string -> (pl.: '@Html.Raw(TanuloResource.TanterviJellemzoMegadasaKotelezo.Replace(Environment.NewLine, ""))' )
|
||||
commonUtils.UpdateRequiredProperies = function (expression, fieldId, errorMessage) {
|
||||
if (expression) {
|
||||
$(fieldId).rules("add", "required");
|
||||
$(fieldId).attr("data-rule-required", "true");
|
||||
$(fieldId).attr("data-msg-required", errorMessage);
|
||||
$(fieldId).attr("aria-required", "true");
|
||||
}
|
||||
else {
|
||||
$(fieldId).rules("remove", "required");
|
||||
$(fieldId).attr("data-rule-required", "false");
|
||||
$(fieldId).attr("aria-required", "false");
|
||||
}
|
||||
}
|
||||
|
||||
commonUtils.ConvertToDateWithPointsFormat = function (dateWithPoints) {
|
||||
if (dateWithPoints.includes('.')) {
|
||||
splitarray = dateWithPoints.split(".");
|
||||
|
||||
return splitarray[0] + "-" + splitarray[1] + "-" + splitarray[2];
|
||||
}
|
||||
|
||||
return dateWithPoints;
|
||||
}
|
||||
|
||||
return commonUtils;
|
||||
})();
|
54
KretaWeb/Scripts/ErrorHandler.js
Normal file
54
KretaWeb/Scripts/ErrorHandler.js
Normal file
|
@ -0,0 +1,54 @@
|
|||
function GlobalErrorHandler(url) {
|
||||
this.url = url;
|
||||
|
||||
function logConsolError(e) {
|
||||
if (
|
||||
typeof console !== 'undefined' &&
|
||||
typeof console.error !== 'undefined'
|
||||
) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||
try {
|
||||
var message = {};
|
||||
message.Message = msg;
|
||||
message.URL = url;
|
||||
message.Line = lineNo;
|
||||
message.Column = columnNo;
|
||||
message.Error = error;
|
||||
message.Agent = navigator.userAgent;
|
||||
|
||||
if (error && error.stack) {
|
||||
message.StackTrace = error.stack;
|
||||
}
|
||||
|
||||
if (
|
||||
message.Message == 'Unspecified error.' &&
|
||||
message.Line == 1 &&
|
||||
message.Column == 1
|
||||
) {
|
||||
return; /*IE dob egy hibát bezárásnál ha a consol fel volt nyitva.*/
|
||||
}
|
||||
var csrfToken = $("input[name='__RequestVerificationToken']").val();
|
||||
var stringData = JSON.stringify({ clientError: message });
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { 'X-Request-Verification-Token': csrfToken },
|
||||
url: this.url,
|
||||
data: stringData,
|
||||
async: true,
|
||||
cache: false,
|
||||
datatype: 'json',
|
||||
contentType: 'application/json; charset=utf-8',
|
||||
error: function (response) {
|
||||
logConsolError(msg);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
logConsolError(e);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
66
KretaWeb/Scripts/IskolaorUzenetKuldes.js
Normal file
66
KretaWeb/Scripts/IskolaorUzenetKuldes.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
var IskolaorHelper = (function () {
|
||||
var iskolaorHelper = function () {};
|
||||
|
||||
iskolaorHelper.addSablonText = function () {
|
||||
var meglevoUzenet = $('#IskolaorUzenet').val();
|
||||
$('#IskolaorUzenet').val(
|
||||
meglevoUzenet +
|
||||
(meglevoUzenet.length > 0 ? ' ' : '') +
|
||||
this.element.text()
|
||||
);
|
||||
};
|
||||
|
||||
iskolaorHelper.iskolaorChanged = function () {
|
||||
if ($('#IskolaorId').data('kendoDropDownList').value() == '') {
|
||||
$('#popupId button').prop('disabled', true);
|
||||
$('#popupId textarea').prop('disabled', true);
|
||||
} else {
|
||||
$('#popupId button').removeProp('disabled');
|
||||
$('#popupId textarea').removeProp('disabled');
|
||||
}
|
||||
var iskorId = $('#IskolaorId').data('kendoDropDownList').value();
|
||||
$('#IskolaorTelefonszam').val(
|
||||
iskorId == '' ? '' : iskolaorAdatok[iskorId].Telszam
|
||||
);
|
||||
};
|
||||
|
||||
iskolaorHelper.sendUzenet = function () {
|
||||
var iskolaorUid = $('#IskolaorId').data('kendoDropDownList').value();
|
||||
var collectionUUID =
|
||||
$('#IntezmenyAzonosito').val() +
|
||||
':' +
|
||||
iskolaorAdatok[iskolaorUid].IdpAzon;
|
||||
var documentID = moment(new Date())
|
||||
.local()
|
||||
.format('YYYY-MM-DDThh:mm:ss.SSS[Z]');
|
||||
var kuldoNeve = $('#KuldoNev').val();
|
||||
var kuldoTelefonszama = $('#KuldoTelefonszam').val();
|
||||
var kuldoUid = $('#KuldoID').val();
|
||||
var uzenet = $('#IskolaorUzenet').val();
|
||||
|
||||
var db = firebase.firestore();
|
||||
db.collection(collectionUUID)
|
||||
.doc(documentID)
|
||||
.set({
|
||||
teacherName: kuldoNeve,
|
||||
teacherPhone: kuldoTelefonszama,
|
||||
teacherUid: kuldoUid,
|
||||
message: uzenet
|
||||
})
|
||||
.then(() => {
|
||||
KretaWindowHelper.successFeedBackWindow(
|
||||
null,
|
||||
Globalization.SikeresIskolaorUzenetKuldes
|
||||
);
|
||||
KretaWindowHelper.destroyAllWindow();
|
||||
})
|
||||
.catch((error) => {
|
||||
KretaWindowHelper.notification(
|
||||
Globalization.SikertelenIskolaorUzenetKuldes,
|
||||
'error'
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
return iskolaorHelper;
|
||||
})();
|
205
KretaWeb/Scripts/JegyzekAdatokHelper.js
Normal file
205
KretaWeb/Scripts/JegyzekAdatokHelper.js
Normal file
|
@ -0,0 +1,205 @@
|
|||
var JegyzekAdatokHelper = function () {
|
||||
var helper = function () {};
|
||||
|
||||
helper.AgazatUjSzktTipusEnumNa = null;
|
||||
helper.SzakmaTipusEnumNa = null;
|
||||
helper.SzakmairanyTipusEnumNa = null;
|
||||
helper.TanulmanyiTeruletNktTipusEnumNa = null;
|
||||
helper.SzakkepesitesNktTipusEnumNa = null;
|
||||
helper.SzakiranyNktTipusEnumNa = null;
|
||||
helper.SzakmacsoportTipusEnumNa = null;
|
||||
helper.AgazatTipusEnumNa = null;
|
||||
helper.SzakkepesitesTipusEnumNa = null;
|
||||
helper.ReszszakkepesitesTipusEnumNa = null;
|
||||
helper.AgazatReszSzakmaTipusEnumNa = null;
|
||||
helper.SzakmaReszSzakmaTipusEnumNa = null;
|
||||
helper.ReszSzakmaTipusEnumNa = null;
|
||||
helper.modelPrefix = '';
|
||||
|
||||
helper.changedJegyzekCombok = function () {
|
||||
var ujSzktAllNa = getUjSzktAllNa();
|
||||
var nktAllNa = getNktAllNa();
|
||||
var regiSzktAllNa = getRegiSzktAllNa();
|
||||
var ujSzktReszszakmakAllNa = getUjSzktReszszakmakAllNa();
|
||||
|
||||
if (ujSzktAllNa + nktAllNa + regiSzktAllNa + ujSzktReszszakmakAllNa == 0) {
|
||||
setDisabledClass('ujSzktCombo', false);
|
||||
setDisabledClass('nktCombo', false);
|
||||
setDisabledClass('regiSzktCombo', false);
|
||||
setDisabledClass('ujSzktReszszakmakCombo', false);
|
||||
setCheckboxhide(true);
|
||||
} else if (
|
||||
ujSzktAllNa + nktAllNa + regiSzktAllNa + ujSzktReszszakmakAllNa ==
|
||||
1
|
||||
) {
|
||||
//NOTE: ha csak egy sectionbol van valasztva akkor a tobbit letiltani
|
||||
setDisabledClass('ujSzktCombo', true);
|
||||
setDisabledClass('nktCombo', true);
|
||||
setDisabledClass('regiSzktCombo', true);
|
||||
setDisabledClass('ujSzktReszszakmakCombo', true);
|
||||
if (ujSzktAllNa == 1) {
|
||||
setDisabledClass('ujSzktCombo', false);
|
||||
} else if (nktAllNa == 1) {
|
||||
setDisabledClass('nktCombo', false);
|
||||
} else if (regiSzktAllNa == 1) {
|
||||
setDisabledClass('regiSzktCombo', false);
|
||||
} else if (ujSzktReszszakmakAllNa == 1) {
|
||||
setDisabledClass('ujSzktReszszakmakCombo', false);
|
||||
}
|
||||
setCheckboxhide(true);
|
||||
} else {
|
||||
//NOTE: ha tobb mint egy sectionbol van valasztva akkor a checkboxokat beallitani
|
||||
setDisabledClass('ujSzktCombo', true);
|
||||
setDisabledClass('nktCombo', true);
|
||||
setDisabledClass('regiSzktCombo', true);
|
||||
setDisabledClass('ujSzktReszszakmakCombo', true);
|
||||
setCheckboxhide(false);
|
||||
}
|
||||
};
|
||||
|
||||
function getUjSzktAllNa() {
|
||||
/*Új Szkt*/
|
||||
var isNaAgazatUjSzktTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#AgazatUjSzktTipus').data('kendoComboBox')
|
||||
) ||
|
||||
$('#AgazatUjSzktTipus').data('kendoComboBox').value() ==
|
||||
helper.AgazatUjSzktTipusEnumNa;
|
||||
var isNaSzakmaTipusEnum =
|
||||
CommonUtils.isNullOrUndefined($('#SzakmaTipus').data('kendoComboBox')) ||
|
||||
$('#SzakmaTipus').data('kendoComboBox').value() ==
|
||||
helper.SzakmaTipusEnumNa;
|
||||
var isNaSzakmairanyTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#SzakmairanyTipus').data('kendoComboBox')
|
||||
) ||
|
||||
$('#SzakmairanyTipus').data('kendoComboBox').value() ==
|
||||
helper.SzakmairanyTipusEnumNa;
|
||||
return isNaAgazatUjSzktTipusEnum &&
|
||||
isNaSzakmaTipusEnum &&
|
||||
isNaSzakmairanyTipusEnum
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
function getNktAllNa() {
|
||||
/*Nkt.*/
|
||||
var isNaTanulmanyiTeruletNktTipusEnumEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#TanulmanyiTeruletNktTipus').data('kendoComboBox')
|
||||
) ||
|
||||
$('#TanulmanyiTeruletNktTipus').data('kendoComboBox').value() ==
|
||||
helper.TanulmanyiTeruletNktTipusEnumNa;
|
||||
var isNaSzakkepesitesNktTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#SzakkepesitesNktTipus').data('kendoComboBox')
|
||||
) ||
|
||||
$('#SzakkepesitesNktTipus').data('kendoComboBox').value() ==
|
||||
helper.SzakkepesitesNktTipusEnumNa;
|
||||
var isNaSzakiranyNktTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#SzakiranyNktTipus').data('kendoComboBox')
|
||||
) ||
|
||||
$('#SzakiranyNktTipus').data('kendoComboBox').value() ==
|
||||
helper.SzakiranyNktTipusEnumNa;
|
||||
return isNaTanulmanyiTeruletNktTipusEnumEnum &&
|
||||
isNaSzakkepesitesNktTipusEnum &&
|
||||
isNaSzakiranyNktTipusEnum
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
function getRegiSzktAllNa() {
|
||||
/*Régi Szkt. - OKJ*/
|
||||
var isNaSzakmacsoportTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#' + helper.modelPrefix + 'SzakmacsoportId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#' + helper.modelPrefix + 'SzakmacsoportId')
|
||||
.data('kendoComboBox')
|
||||
.value() == helper.SzakmacsoportTipusEnumNa;
|
||||
var isNaAgazatTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#' + helper.modelPrefix + 'AgazatId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#' + helper.modelPrefix + 'AgazatId')
|
||||
.data('kendoComboBox')
|
||||
.value() == helper.AgazatTipusEnumNa;
|
||||
var isNaSzakkepesitesTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#' + helper.modelPrefix + 'SzakkepesitesId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#' + helper.modelPrefix + 'SzakkepesitesId')
|
||||
.data('kendoComboBox')
|
||||
.value() == helper.SzakkepesitesTipusEnumNa;
|
||||
var isNaReszszakkepesitesTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#' + helper.modelPrefix + 'ReszSzakkepesitesId').data(
|
||||
'kendoComboBox'
|
||||
)
|
||||
) ||
|
||||
$('#' + helper.modelPrefix + 'ReszSzakkepesitesId')
|
||||
.data('kendoComboBox')
|
||||
.value() == helper.ReszszakkepesitesTipusEnumNa;
|
||||
return isNaSzakmacsoportTipusEnum &&
|
||||
isNaAgazatTipusEnum &&
|
||||
isNaSzakkepesitesTipusEnum &&
|
||||
isNaReszszakkepesitesTipusEnum
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
function getUjSzktReszszakmakAllNa() {
|
||||
/*Uj Szkt Részszakmák.*/
|
||||
var isNaAgazatReszSzakmaTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#AgazatReszSzakmaTipusId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#AgazatReszSzakmaTipusId').data('kendoComboBox').value() ==
|
||||
helper.AgazatReszSzakmaTipusEnumNa;
|
||||
var isNaSzakmaReszSzakmaTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#SzakmaReszSzakmaTipusId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#SzakmaReszSzakmaTipusId').data('kendoComboBox').value() ==
|
||||
helper.SzakmaReszSzakmaTipusEnumNa;
|
||||
var isNaReszSzakmaTipusEnum =
|
||||
CommonUtils.isNullOrUndefined(
|
||||
$('#ReszSzakmaTipusId').data('kendoComboBox')
|
||||
) ||
|
||||
$('#ReszSzakmaTipusId').data('kendoComboBox').value() ==
|
||||
helper.ReszSzakmaTipusEnumNa;
|
||||
return isNaAgazatReszSzakmaTipusEnum &&
|
||||
isNaSzakmaReszSzakmaTipusEnum &&
|
||||
isNaReszSzakmaTipusEnum
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
||||
function setDisabledClass(className, disable) {
|
||||
$.each($('.' + className), function () {
|
||||
if (disable) {
|
||||
$(this).addClass('disabledItem');
|
||||
} else {
|
||||
$(this).removeClass('disabledItem');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setCheckboxhide(hide) {
|
||||
const group = [
|
||||
'#IsUjSzktBlokkAlkalmaz',
|
||||
'#IsNktBlokkAlkalmaz',
|
||||
'#IsRegiSzktBlokkAlkalmaz',
|
||||
'#IsUjSzktReszSzakmakBlokkAlkalmaz'
|
||||
];
|
||||
for (let chbx of group) {
|
||||
if (CommonUtils.parseBool(hide)) {
|
||||
$(chbx).siblings('label').first().hide();
|
||||
} else {
|
||||
$(chbx).siblings('label').first().show();
|
||||
}
|
||||
}
|
||||
}
|
||||
return helper;
|
||||
};
|
196
KretaWeb/Scripts/JiraRestHelper.js
Normal file
196
KretaWeb/Scripts/JiraRestHelper.js
Normal file
|
@ -0,0 +1,196 @@
|
|||
var JiraRestHelper = (function () {
|
||||
var helper = function () {};
|
||||
|
||||
helper.urls = {
|
||||
UgyfelSzolgalatPopUp: null,
|
||||
BejelentesPopUp: null,
|
||||
KommunikaciosPopUp: null,
|
||||
|
||||
CreateCommentToBejegyzes: null,
|
||||
CreateBejelentes: null,
|
||||
CreateDbVisszaallitas: null,
|
||||
CreateUjUrlIgenyles: null,
|
||||
CreateKonferenciaJelentkezes: null
|
||||
};
|
||||
helper.popUpTitles = {
|
||||
UgyfelSzolgalat: { title: '', text: '' },
|
||||
Bejelentes: { title: '', text: '' },
|
||||
Kommunikacios: { title: '', text: '' }
|
||||
};
|
||||
|
||||
helper.createCommentToBejegyzes = function (
|
||||
id,
|
||||
leiras,
|
||||
csatolmanyArray,
|
||||
successCallBack,
|
||||
errorCallBack
|
||||
) {
|
||||
AjaxHelper.AsyncPost(
|
||||
helper.urls.CreateCommentToBejegyzes,
|
||||
{ Id: id, Comment: leiras, CsatolmanyArray: csatolmanyArray },
|
||||
successCallBack,
|
||||
errorCallBack
|
||||
);
|
||||
};
|
||||
helper.createBejelentes = function (
|
||||
cim,
|
||||
leiras,
|
||||
requestTypeId,
|
||||
csatolmanyArray,
|
||||
userAndBrowserInformation,
|
||||
errorCallBack
|
||||
) {
|
||||
AjaxHelper.DoAsyncValidationPost(
|
||||
helper.urls.CreateBejelentes,
|
||||
'UgyfelszolgValidation',
|
||||
{
|
||||
Cim: cim,
|
||||
Leiras: leiras,
|
||||
RequestTypeId: requestTypeId,
|
||||
CsatolmanyArray: csatolmanyArray,
|
||||
UserAndBrowserInformation: userAndBrowserInformation
|
||||
},
|
||||
function () {
|
||||
successCallBack('BejelentesWindow');
|
||||
},
|
||||
errorCallBack
|
||||
);
|
||||
};
|
||||
helper.createDbVisszaallitas = function (
|
||||
date,
|
||||
requestTypeId,
|
||||
userAndBrowserInformation
|
||||
) {
|
||||
AjaxHelper.DoAsyncValidationPost(
|
||||
helper.urls.CreateDbVisszaallitas,
|
||||
'UgyfelszolgValidation',
|
||||
{
|
||||
Datum: date,
|
||||
RequestTypeId: requestTypeId,
|
||||
UserAndBrowserInformation: userAndBrowserInformation
|
||||
},
|
||||
function () {
|
||||
successCallBack('BejelentesWindow');
|
||||
}
|
||||
);
|
||||
};
|
||||
helper.createUjUrlIgenyles = function (
|
||||
ujUrlName,
|
||||
requestTypeId,
|
||||
userAndBrowserInformation
|
||||
) {
|
||||
AjaxHelper.DoAsyncValidationPost(
|
||||
helper.urls.CreateUjUrlIgenyles,
|
||||
'UgyfelszolgValidation',
|
||||
{
|
||||
UjUrlName: ujUrlName,
|
||||
RequestTypeId: requestTypeId,
|
||||
UserAndBrowserInformation: userAndBrowserInformation
|
||||
},
|
||||
function () {
|
||||
successCallBack('BejelentesWindow');
|
||||
}
|
||||
);
|
||||
};
|
||||
helper.createKonferenciaJelentkezes = function (
|
||||
jelentkezoSzemelyekSzama,
|
||||
jelentkezoSzemelyekListaja,
|
||||
egyebUzenet,
|
||||
requestTypeId,
|
||||
userAndBrowserInformation
|
||||
) {
|
||||
AjaxHelper.DoAsyncValidationPost(
|
||||
helper.urls.CreateKonferenciaJelentkezes,
|
||||
'UgyfelszolgValidation',
|
||||
{
|
||||
JelentkezoSzemelyekSzama: jelentkezoSzemelyekSzama,
|
||||
JelentkezoSzemelyekListaja: jelentkezoSzemelyekListaja,
|
||||
EgyebUzenet: egyebUzenet,
|
||||
RequestTypeId: requestTypeId,
|
||||
UserAndBrowserInformation: userAndBrowserInformation
|
||||
},
|
||||
function () {
|
||||
successCallBack('BejelentesWindow');
|
||||
}
|
||||
);
|
||||
};
|
||||
helper.popUpUgyfelSzolgalatWindow = function () {
|
||||
AjaxHelper.DoPost(helper.urls.UgyfelSzolgalatPopUp, null, function (data) {
|
||||
openPopUp(helper.popUpTitles.UgyfelSzolgalat, data);
|
||||
});
|
||||
};
|
||||
helper.popUpBejelentesWindow = function (id, key) {
|
||||
AjaxHelper.DoPost(
|
||||
helper.urls.BejelentesPopUp,
|
||||
{ typeId: id, typeKey: key },
|
||||
function (data) {
|
||||
openPopUp(helper.popUpTitles.Bejelentes, data);
|
||||
}
|
||||
);
|
||||
};
|
||||
helper.popUpKommunikaciosWindow = function (rowData) {
|
||||
AjaxHelper.DoPost(
|
||||
helper.urls.KommunikaciosPopUp,
|
||||
{ id: rowData.ID },
|
||||
function (data) {
|
||||
openPopUp(helper.popUpTitles.Kommunikacios, data);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
function openPopUp(info, data) {
|
||||
var config = KretaWindowHelper.getWindowConfigContainer();
|
||||
config.title = info.text;
|
||||
config.content = data;
|
||||
if (info.text === 'UgyfelSzolgalat') {
|
||||
config.width = '90%';
|
||||
config.height = '90%';
|
||||
} else {
|
||||
config.width = '85%';
|
||||
config.height = '85%';
|
||||
}
|
||||
|
||||
var modal = KretaWindowHelper.createWindow(info.title, config);
|
||||
KretaWindowHelper.openWindow(modal, true);
|
||||
}
|
||||
|
||||
function successCallBack(viewName) {
|
||||
KretaWindowHelper.destroyWindow(viewName);
|
||||
KretaGridHelper.refreshGrid('UgyfelszolgalatGrid');
|
||||
}
|
||||
|
||||
helper.successCallBack = function (viewName) {
|
||||
successCallBack(viewName);
|
||||
};
|
||||
|
||||
var descriptionMaxLength;
|
||||
helper.ValidateDescriptionLength = function (descriptionMaxLengthParameter) {
|
||||
Number.isInteger =
|
||||
Number.isInteger ||
|
||||
function (value) {
|
||||
return (
|
||||
typeof value === 'number' &&
|
||||
isFinite(value) &&
|
||||
Math.floor(value) === value
|
||||
);
|
||||
};
|
||||
if (Number.isInteger(descriptionMaxLengthParameter))
|
||||
descriptionMaxLength = descriptionMaxLengthParameter;
|
||||
var descriptionText = $('.validateDescriptionLength');
|
||||
var labelText = $('#validateDescriptionLengthLabel');
|
||||
|
||||
if (descriptionText.val().length > descriptionMaxLength) {
|
||||
labelText.addClass('validateErrorLabelColor');
|
||||
descriptionText.val(
|
||||
descriptionText.val().substring(0, descriptionMaxLength)
|
||||
);
|
||||
} else {
|
||||
labelText.removeClass('validateErrorLabelColor');
|
||||
}
|
||||
|
||||
labelText.text(
|
||||
'Karakter: ' + descriptionMaxLength + '/' + descriptionText.val().length
|
||||
);
|
||||
};
|
||||
return helper;
|
||||
})();
|
33
KretaWeb/Scripts/KendoHelper/KretaChartHelper.js
Normal file
33
KretaWeb/Scripts/KendoHelper/KretaChartHelper.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var KretaChartHelper = (function () {
|
||||
var kretaChartHelper = function () {};
|
||||
|
||||
kretaChartHelper.getKendoChartData = function (chartId) {
|
||||
var chart = $('#' + chartId);
|
||||
var chartData = chart.data('kendoChart');
|
||||
|
||||
return chartData;
|
||||
};
|
||||
|
||||
kretaChartHelper.setDatasource = function (chartId, categories, seriesData) {
|
||||
$('#' + chartId).kendoChart({
|
||||
categoryAxis: {
|
||||
categories: categories
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: seriesData
|
||||
}
|
||||
]
|
||||
});
|
||||
kretaChartHelper.refreshChart(chartId);
|
||||
};
|
||||
|
||||
kretaChartHelper.refreshChart = function (chartId) {
|
||||
var chartData = kretaChartHelper.getKendoChartData(chartId);
|
||||
|
||||
chartData.dataSource.read();
|
||||
chartData.refresh();
|
||||
};
|
||||
|
||||
return kretaChartHelper;
|
||||
})();
|
27
KretaWeb/Scripts/KendoHelper/KretaCheckBoxHelper.js
Normal file
27
KretaWeb/Scripts/KendoHelper/KretaCheckBoxHelper.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
var KretaCheckBoxHelper = (function () {
|
||||
var kretaCheckBoxHelper = function () {};
|
||||
|
||||
kretaCheckBoxHelper.getValue = function (checkBoxId) {
|
||||
var result = $('#' + checkBoxId).is(':checked');
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
kretaCheckBoxHelper.setValue = function (checkBoxId, value) {
|
||||
$('#' + checkBoxId).prop('checked', value);
|
||||
};
|
||||
|
||||
kretaCheckBoxHelper.setObjectValue = function (checkBox, value) {
|
||||
checkBox.prop('checked', value);
|
||||
};
|
||||
|
||||
kretaCheckBoxHelper.enable = function (checkBoxId) {
|
||||
$('#' + checkBoxId).prop('disabled', false);
|
||||
};
|
||||
|
||||
kretaCheckBoxHelper.disable = function (checkBoxId) {
|
||||
$('#' + checkBoxId).prop('disabled', true);
|
||||
};
|
||||
|
||||
return kretaCheckBoxHelper;
|
||||
})();
|
183
KretaWeb/Scripts/KendoHelper/KretaComboBoxHelper.js
Normal file
183
KretaWeb/Scripts/KendoHelper/KretaComboBoxHelper.js
Normal file
|
@ -0,0 +1,183 @@
|
|||
var KretaComboBoxHelper = (function () {
|
||||
var kretaComboBoxHelper = function () {};
|
||||
|
||||
kretaComboBoxHelper.getKendoComboBoxData = function (comboBoxId) {
|
||||
var comboBox = $('#' + comboBoxId);
|
||||
var comboBoxData = comboBox.data('kendoComboBox');
|
||||
return comboBoxData;
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.getKendoValue = function (comboBoxId) {
|
||||
var comboBoxData = kretaComboBoxHelper.getKendoComboBoxData(comboBoxId);
|
||||
var result = comboBoxData.value();
|
||||
return result;
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.getCascadeData = function (inputName) {
|
||||
if (inputName.indexOf(',') >= 0) {
|
||||
var array = inputName.split(',');
|
||||
var data = '';
|
||||
$.each(array, function (key, value) {
|
||||
if (data.length > 0 && $('#' + value).val() != '') {
|
||||
data += ',';
|
||||
}
|
||||
|
||||
if (value.indexOf('#') >= 0) {
|
||||
data += $(value).val();
|
||||
} else {
|
||||
data += $('#' + value).val();
|
||||
}
|
||||
});
|
||||
return { cascadeFilter: data };
|
||||
} else {
|
||||
return { cascadeFilter: $(inputName).val() };
|
||||
}
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.getServerFilteringData = function (inputName) {
|
||||
return { serverFilter: $(inputName).val() };
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.getServerFilteringComboBoxTextData = function (
|
||||
inputName
|
||||
) {
|
||||
var textValue = $(inputName).data('kendoComboBox').text();
|
||||
if (textValue.length > 0) {
|
||||
return { serverFilter: textValue };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.refreshComboBox = function (inputName) {
|
||||
var widget = $('#' + inputName).data('kendoComboBox');
|
||||
widget.dataSource.read();
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.setFirstItem = function (inputName, setIfHasOnlyOneItem) {
|
||||
var widget = $('#' + inputName).data('kendoComboBox');
|
||||
if (setIfHasOnlyOneItem) {
|
||||
if (widget.dataSource.data().length === 1) {
|
||||
widget.value(widget.dataSource.data()[0].Value);
|
||||
}
|
||||
} else {
|
||||
//NOTE: Check if has item!
|
||||
if (widget.dataSource.data().length > 0) {
|
||||
widget.value(widget.dataSource.data()[0].Value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.onChange = function (e) {
|
||||
elementId = e.sender.element[0].id.replace('.', '_');
|
||||
$('input[name="' + elementId + '"]').attr(
|
||||
'title',
|
||||
$('input[name="' + elementId + '_input' + '"]').attr('title')
|
||||
); /*validációs üzenet buborékolása*/
|
||||
|
||||
var comboBox = $('#' + elementId).data('kendoComboBox');
|
||||
checkSelectedValue(comboBox);
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.checkSelectedValue = function (elementId) {
|
||||
var comboBox = $('#' + elementId).data('kendoComboBox');
|
||||
checkSelectedValue(comboBox);
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.onDataBound = function (e) {
|
||||
var elementId = e.sender.element[0].id;
|
||||
var comboBox = $('#' + elementId).data('kendoComboBox');
|
||||
if (typeof comboBox !== 'undefined') {
|
||||
if (!comboBox.element.attr('placeholder')) {
|
||||
comboBox.element.attr(
|
||||
'placeholder',
|
||||
comboBox.input.attr('placeholder')
|
||||
);
|
||||
}
|
||||
|
||||
var dataSource = comboBox.dataSource;
|
||||
if (dataSource != null) {
|
||||
if (dataSource.data().length == 1) {
|
||||
var data = dataSource.data()[0];
|
||||
comboBox.value(data.Value);
|
||||
comboBox.trigger('change');
|
||||
} else {
|
||||
checkSelectedValue(comboBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.onDataBoundWithoutSetSingleElement = function (e) {
|
||||
var elementId = e.sender.element[0].id;
|
||||
var comboBox = $('#' + elementId).data('kendoComboBox');
|
||||
if (typeof comboBox !== 'undefined') {
|
||||
if (!comboBox.element.attr('placeholder')) {
|
||||
comboBox.element.attr(
|
||||
'placeholder',
|
||||
comboBox.input.attr('placeholder')
|
||||
);
|
||||
}
|
||||
|
||||
var dataSource = comboBox.dataSource;
|
||||
if (dataSource != null) {
|
||||
if (dataSource.data().length != 1) {
|
||||
checkSelectedValue(comboBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.onOpenDropdown = function (e) {
|
||||
var elementId = e.sender.element[0].id;
|
||||
var comboBox = $('#' + elementId).data('kendoComboBox');
|
||||
|
||||
var maxWidth = 800;
|
||||
var comboMinWidth = $('#' + elementId)
|
||||
.parents('.k-combobox')
|
||||
.width();
|
||||
if (comboMinWidth > maxWidth) {
|
||||
maxWidth = comboMinWidth;
|
||||
}
|
||||
|
||||
comboBox.list.css('maxWidth', maxWidth);
|
||||
comboBox.list.css('minWidth', comboMinWidth);
|
||||
comboBox.list.width('auto');
|
||||
};
|
||||
|
||||
kretaComboBoxHelper.setKendoValue = function (comboBoxData, value) {
|
||||
comboBoxData.value(value);
|
||||
comboBoxData.trigger('change');
|
||||
};
|
||||
|
||||
function checkSelectedValue(comboBox) {
|
||||
if (comboBox.selectedIndex === -1 && comboBox.value()) {
|
||||
comboBox.value(null);
|
||||
comboBox.input.attr(
|
||||
'placeholder',
|
||||
comboBox.element.attr('data-msg-unknownvalue')
|
||||
);
|
||||
} else {
|
||||
comboBox.input.attr('placeholder', comboBox.element.attr('placeholder'));
|
||||
}
|
||||
}
|
||||
|
||||
kretaComboBoxHelper.getIndexForValue = function (comboBoxId, value) {
|
||||
var data = kretaComboBoxHelper
|
||||
.getKendoComboBoxData(comboBoxId)
|
||||
.dataSource.data();
|
||||
|
||||
var index = -1;
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
if (data[i].Value === value) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return index;
|
||||
};
|
||||
|
||||
return kretaComboBoxHelper;
|
||||
})();
|
147
KretaWeb/Scripts/KendoHelper/KretaDateTimeHelper.js
Normal file
147
KretaWeb/Scripts/KendoHelper/KretaDateTimeHelper.js
Normal file
|
@ -0,0 +1,147 @@
|
|||
var KretaDateTimeHelper = (function () {
|
||||
var kretaDateTimeHelper = function () {};
|
||||
|
||||
kretaDateTimeHelper.getKendoDatePickerData = function (datePickerId) {
|
||||
var datePicker = $('#' + datePickerId);
|
||||
var datePickerData = datePicker.data('kendoDatePicker');
|
||||
return datePickerData;
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.compare = function (lhsDate, rhsDate) {
|
||||
var lhs = kendo.parseDate(lhsDate).getTime();
|
||||
var rhs = kendo.parseDate(rhsDate).getTime();
|
||||
|
||||
return lhs < rhs ? -1 : lhs === rhs ? 0 : 1;
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.validateDate = function (e) {
|
||||
var id = e.attr('id');
|
||||
var val = e.val().replace(/\s/g, '');
|
||||
|
||||
var parsedDate = kendo.parseDate(val);
|
||||
if (parsedDate == null) {
|
||||
const kendoDatePicker = $('#' + id).data('kendoDatePicker');
|
||||
|
||||
if (typeof kendoDatePicker !== 'undefined') {
|
||||
kendoDatePicker.value('');
|
||||
return;
|
||||
}
|
||||
|
||||
const kendoTimePicker = $('#' + id).data('kendoTimePicker');
|
||||
|
||||
if (typeof kendoTimePicker !== 'undefined') {
|
||||
kendoTimePicker.value('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.validateDateTime = function (e) {
|
||||
var id = e.attr('id');
|
||||
var val = e.val().replace(/\s/g, '');
|
||||
|
||||
var parsedDate = kendo.parseDate(val);
|
||||
if (parsedDate == null) {
|
||||
$('#' + id)
|
||||
.data('kendoDateTimePicker')
|
||||
.value('');
|
||||
}
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.validateTime = function (e) {
|
||||
var id = e.attr('id');
|
||||
var value = e.val().replace(/\s/g, '');
|
||||
|
||||
var parsedDate = kendo.parseDate(value);
|
||||
if (parsedDate == null) {
|
||||
$('#' + id)
|
||||
.data('kendoTimePicker')
|
||||
.value(e.attr('value'));
|
||||
}
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.getDate = function (datePickerId) {
|
||||
return kretaDateTimeHelper.getKendoDatePickerData(datePickerId).value();
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.setDate = function (datePickerId, value) {
|
||||
var parsedDate = kendo.parseDate(value);
|
||||
kretaDateTimeHelper.getKendoDatePickerData(datePickerId).value(parsedDate);
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.setToday = function (datePickerId) {
|
||||
var newDate = new Date();
|
||||
kretaDateTimeHelper.setDate(datePickerId, newDate);
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.clear = function (datePickerId) {
|
||||
kretaDateTimeHelper.getKendoDatePickerData(datePickerId).value(null);
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.SetMaskedTimepicker = function () {
|
||||
$("input[data-role='maskedtimepicker']").kendoMaskedTextBox({
|
||||
mask: '12:34',
|
||||
rules: {
|
||||
1: /[0-2]/,
|
||||
2: /[0-9]/,
|
||||
3: /[0-5]/,
|
||||
4: /[0-9]/
|
||||
}
|
||||
});
|
||||
var timePicker = $("input[data-role='maskedtimepicker']");
|
||||
timePicker.on('focusout mouseleave', function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
$("input[data-role='maskedtimepicker']").each(function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.SetTimepicker = function () {
|
||||
$("input[data-role='timepicker']").kendoMaskedTextBox({
|
||||
mask: '12:34',
|
||||
rules: {
|
||||
1: /[0-2]/,
|
||||
2: /[0-9]/,
|
||||
3: /[0-5]/,
|
||||
4: /[0-9]/
|
||||
}
|
||||
});
|
||||
|
||||
var timePicker = $("input[data-role='timepicker']");
|
||||
timePicker.on('focusout mouseleave', function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
$("input[data-role='timepicker']").each(function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
};
|
||||
|
||||
kretaDateTimeHelper.SetMaskedTimepickerById = function (id) {
|
||||
$('#' + id).kendoMaskedTimePicker();
|
||||
|
||||
var el = document.getElementById(id);
|
||||
if (el) {
|
||||
el.style.width = null;
|
||||
}
|
||||
|
||||
$('#' + id).kendoMaskedTextBox({
|
||||
mask: '12:34',
|
||||
rules: {
|
||||
1: /[0-2]/,
|
||||
2: /[0-9]/,
|
||||
3: /[0-5]/,
|
||||
4: /[0-9]/
|
||||
}
|
||||
});
|
||||
|
||||
$('#' + id).on('focusout mouseleave', function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
$('#' + id).each(function () {
|
||||
kretaDateTimeHelper.validateTime($(this));
|
||||
});
|
||||
};
|
||||
|
||||
return kretaDateTimeHelper;
|
||||
})();
|
16
KretaWeb/Scripts/KendoHelper/KretaDropDownListHelper.js
Normal file
16
KretaWeb/Scripts/KendoHelper/KretaDropDownListHelper.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
var KretaDropDownListHelper = (function () {
|
||||
var kretaDropDownListHelper = function () {};
|
||||
|
||||
kretaDropDownListHelper.getKendoDropDownListData = function (dropDownListId) {
|
||||
var dropDownList = $('#' + dropDownListId);
|
||||
var dropDownListData = dropDownList.data('kendoDropDownList');
|
||||
return dropDownListData;
|
||||
};
|
||||
|
||||
kretaDropDownListHelper.refreshDropDownList = function (inputName) {
|
||||
var widget = $('#' + inputName).data('kendoDropDownList');
|
||||
widget.dataSource.read();
|
||||
};
|
||||
|
||||
return kretaDropDownListHelper;
|
||||
})();
|
177
KretaWeb/Scripts/KendoHelper/KretaFileUpload.js
Normal file
177
KretaWeb/Scripts/KendoHelper/KretaFileUpload.js
Normal file
|
@ -0,0 +1,177 @@
|
|||
var KretaFileUpload = (function () {
|
||||
var kretaFileUpload = function () {};
|
||||
|
||||
kretaFileUpload.GetUploadControl = function (uploadInputName) {
|
||||
return getUploadControl(uploadInputName);
|
||||
};
|
||||
kretaFileUpload.ResetUploadControl = function (uploadInputContainerId) {
|
||||
$('#' + uploadInputContainerId)
|
||||
.find('.k-delete')
|
||||
.click();
|
||||
return 0;
|
||||
};
|
||||
kretaFileUpload.DisplayValidationInfo = function (uploadInputContainerId) {
|
||||
var uploadInputContainer = $('#' + uploadInputContainerId).find(
|
||||
'.k-widget.k-upload'
|
||||
);
|
||||
uploadInputContainer.append(
|
||||
"<div id='FileUploadValidationInfo' style='display:inline;'></div>"
|
||||
);
|
||||
return 0;
|
||||
};
|
||||
|
||||
kretaFileUpload.DisplayValidationInfo = function (
|
||||
uploadInputContainerId,
|
||||
fileUploadValidationContainerId
|
||||
) {
|
||||
var uploadInputContainer = $('#' + uploadInputContainerId).find(
|
||||
'.k-widget.k-upload'
|
||||
);
|
||||
uploadInputContainer.append(
|
||||
"<div id='" +
|
||||
fileUploadValidationContainerId +
|
||||
"' style='display:inline;'></div>"
|
||||
);
|
||||
return 0;
|
||||
};
|
||||
|
||||
var stopAnimation = false;
|
||||
var animationTimeOut;
|
||||
|
||||
kretaFileUpload.StopAnimation = function () {
|
||||
stopAnimation = true;
|
||||
$('#FileUploadValidationInfo').html('');
|
||||
clearTimeout(animationTimeOut);
|
||||
};
|
||||
|
||||
kretaFileUpload.StopAnimation = function (fileUploadValidationContainerId) {
|
||||
stopAnimation = true;
|
||||
$('#' + fileUploadValidationContainerId).html('');
|
||||
clearTimeout(animationTimeOut);
|
||||
};
|
||||
|
||||
kretaFileUpload.StartAnimation = function () {
|
||||
stopAnimation = false;
|
||||
};
|
||||
kretaFileUpload.VaidationInfoExtensionContainerAnimation = function (
|
||||
allowedFileExtensionArray,
|
||||
start
|
||||
) {
|
||||
if (stopAnimation) {
|
||||
kretaFileUpload.StopAnimation();
|
||||
return 0;
|
||||
}
|
||||
var extensionContainer = $('#FileUploadValidationInfo');
|
||||
extensionContainer.append(
|
||||
(start < 3 ? ' ' : ', ') + allowedFileExtensionArray[start]
|
||||
);
|
||||
if (start < allowedFileExtensionArray.length - 1) {
|
||||
animationTimeOut = setTimeout(function () {
|
||||
kretaFileUpload.VaidationInfoExtensionContainerAnimation(
|
||||
allowedFileExtensionArray,
|
||||
start + 1
|
||||
);
|
||||
}, 20);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
kretaFileUpload.VaidationInfoExtensionContainerAnimation = function (
|
||||
fileUploadValidationContainerId,
|
||||
allowedFileExtensionArray,
|
||||
start
|
||||
) {
|
||||
if (stopAnimation) {
|
||||
kretaFileUpload.StopAnimation();
|
||||
return 0;
|
||||
}
|
||||
var extensionContainer = $('#' + fileUploadValidationContainerId);
|
||||
extensionContainer.append(
|
||||
(start < 3 ? ' ' : ', ') + allowedFileExtensionArray[start]
|
||||
);
|
||||
if (start < allowedFileExtensionArray.length - 1) {
|
||||
animationTimeOut = setTimeout(function () {
|
||||
kretaFileUpload.VaidationInfoExtensionContainerAnimation(
|
||||
fileUploadValidationContainerId,
|
||||
allowedFileExtensionArray,
|
||||
start + 1
|
||||
);
|
||||
}, 20);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
kretaFileUpload.EnableUpload = function (uploadInputName) {
|
||||
getUploadControl(uploadInputName).enable();
|
||||
};
|
||||
kretaFileUpload.DisableUpload = function (uploadInputName) {
|
||||
getUploadControl(uploadInputName).disable();
|
||||
};
|
||||
kretaFileUpload.ToggleEnabled = function (uploadInputName) {
|
||||
getUploadControl(uploadInputName).toggle();
|
||||
};
|
||||
|
||||
function getUploadControl(inputName) {
|
||||
return $('#' + inputName).data('kendoUpload');
|
||||
}
|
||||
|
||||
kretaFileUpload.SendAttachmentsAsBase64EncodedString = function (
|
||||
inputName,
|
||||
sendRequest
|
||||
) {
|
||||
function addCsatolmanyWithBase64EncodedConvertedFile(
|
||||
file,
|
||||
callbackAddCsatolmany,
|
||||
callbackSendRequest,
|
||||
csatolmanyArray,
|
||||
fileName
|
||||
) {
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onloadend = function () {
|
||||
callbackAddCsatolmany(
|
||||
callbackSendRequest,
|
||||
csatolmanyArray,
|
||||
fileName,
|
||||
reader.result
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
function addCsatolmany(
|
||||
callbackSendRequest,
|
||||
csatolmanyArray,
|
||||
name,
|
||||
base64EncodedString
|
||||
) {
|
||||
csatolmanyArray.push({
|
||||
Name: name,
|
||||
ContentAsBase64EncodedString: base64EncodedString
|
||||
});
|
||||
if (typeof callbackSendRequest !== 'undefined')
|
||||
callbackSendRequest(csatolmanyArray);
|
||||
}
|
||||
|
||||
var csatolmanyArray = [];
|
||||
var csatolmanyInputFileArray =
|
||||
getUploadControl(inputName).wrapper.find("input[type='file']");
|
||||
|
||||
var csatolmanyokSzama = csatolmanyInputFileArray.length - 1;
|
||||
for (var i = 0; i < csatolmanyokSzama; i++) {
|
||||
var bouquetCsatolmanyArray = csatolmanyInputFileArray[i].files;
|
||||
var bouquetCsatolmanyokSzama = bouquetCsatolmanyArray.length;
|
||||
for (var j = 0; j < bouquetCsatolmanyokSzama; j++) {
|
||||
addCsatolmanyWithBase64EncodedConvertedFile(
|
||||
bouquetCsatolmanyArray[j],
|
||||
addCsatolmany,
|
||||
i == csatolmanyokSzama - 1 && j == bouquetCsatolmanyokSzama - 1
|
||||
? sendRequest
|
||||
: undefined,
|
||||
csatolmanyArray,
|
||||
bouquetCsatolmanyArray[j].name
|
||||
);
|
||||
}
|
||||
}
|
||||
if (csatolmanyokSzama < 1) sendRequest(csatolmanyArray);
|
||||
};
|
||||
|
||||
return kretaFileUpload;
|
||||
})();
|
86
KretaWeb/Scripts/KendoHelper/KretaForm.js
Normal file
86
KretaWeb/Scripts/KendoHelper/KretaForm.js
Normal file
|
@ -0,0 +1,86 @@
|
|||
var KretaForm = (function () {
|
||||
var kretaform = function () {};
|
||||
kretaform.validate = function (form) {
|
||||
validate(form);
|
||||
};
|
||||
|
||||
function validate(form) {
|
||||
form.validate({
|
||||
errorPlacement: function (error, element) {
|
||||
element.attr('title', error.text());
|
||||
element
|
||||
.prev(
|
||||
'label[for="' + $(element).attr('name').replace('_', '.') + '"]'
|
||||
)
|
||||
.addClass('labelError');
|
||||
element
|
||||
.closest('div')
|
||||
.prev()
|
||||
.find(
|
||||
'label[for="' + $(element).attr('name').replace('_', '.') + '"]'
|
||||
)
|
||||
.addClass('labelError');
|
||||
|
||||
var container = form.find('.kreta-validation-summary');
|
||||
list = container.find('ul');
|
||||
|
||||
if (error && error.length > 0) {
|
||||
$.each(error, function (i, ival) {
|
||||
$('<li/>').html(ival).appendTo(list);
|
||||
});
|
||||
container
|
||||
.addClass('validation-summary-errors')
|
||||
.removeClass('validation-summary-valid');
|
||||
}
|
||||
},
|
||||
success: function (errorLabel) {
|
||||
$(
|
||||
'label[for="' + $(errorLabel).attr('for').replace('_', '.') + '"]'
|
||||
).removeClass('labelError'); //Nested Model Hack
|
||||
$('label[for=' + $(errorLabel).attr('for') + ']').removeClass(
|
||||
'labelError'
|
||||
); //DropDown Hack
|
||||
errorLabel.parent('li').css({ display: 'none' });
|
||||
},
|
||||
showErrors: function (errorMap, errorList) {
|
||||
var errorCount = this.numberOfInvalids();
|
||||
|
||||
this.defaultShowErrors();
|
||||
$.each(errorList, function (i, ival) {
|
||||
var elementId = $(ival.element).attr('id');
|
||||
if (typeof elementId !== 'undefined') {
|
||||
$('label[for=' + elementId + ']').addClass('labelError'); //DropDown Hack
|
||||
$('label[for="' + elementId.replace('_', '.') + '"]').addClass(
|
||||
'labelError'
|
||||
); //Nested Model Hack
|
||||
var elem = '#' + elementId + '-error';
|
||||
$(elem).parent('li').css({ display: 'list-item' });
|
||||
}
|
||||
});
|
||||
|
||||
var container = form.find('.kreta-validation-summary');
|
||||
var labelErrors = container.find('.labelError');
|
||||
var textContents = container.find('ul');
|
||||
|
||||
$.each(labelErrors, function (i, element) {
|
||||
if ($(element).text() === '') {
|
||||
$(element).parent('li').css({ display: 'none' });
|
||||
}
|
||||
});
|
||||
|
||||
if (
|
||||
errorCount > 0 ||
|
||||
(typeof labelErrors !== 'undefined' && labelErrors.length > 0)
|
||||
) {
|
||||
container.css({ display: 'block' });
|
||||
}
|
||||
if (typeof textContents !== 'undefined' && textContents.text() === '') {
|
||||
container.css({ display: 'none' });
|
||||
}
|
||||
},
|
||||
ignore: "input[type='file'].ignore-validation"
|
||||
});
|
||||
}
|
||||
|
||||
return kretaform;
|
||||
})();
|
875
KretaWeb/Scripts/KendoHelper/KretaGridHelper.js
Normal file
875
KretaWeb/Scripts/KendoHelper/KretaGridHelper.js
Normal file
|
@ -0,0 +1,875 @@
|
|||
var KretaGridHelper = (function () {
|
||||
var kretaGridHelper = function () {};
|
||||
|
||||
kretaGridHelper.getKendoGridData = function (gridId) {
|
||||
var grid = $('#' + gridId);
|
||||
var gridData = grid.data('kendoGrid');
|
||||
return gridData;
|
||||
};
|
||||
|
||||
kretaGridHelper.refreshGrid = function (gridName) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
if (!CommonUtils.isNullOrUndefined(gridData)) {
|
||||
gridData.dataSource.read();
|
||||
gridData.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.refreshGridSearchPanel = function (gridName, formName) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
if (!CommonUtils.isNullOrUndefined(gridData)) {
|
||||
var query = {
|
||||
data: searchPanelReloadGrid(formName),
|
||||
page: gridData.dataSource._page,
|
||||
pageSize: gridData.dataSource.pageSize(),
|
||||
sort: gridData.dataSource.sort(),
|
||||
filter: gridData.dataSource.filter()
|
||||
};
|
||||
gridData.dataSource.query(query);
|
||||
gridData.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.getSearchParameters = function (formName) {
|
||||
var result = { data: JSON.stringify($(formName).toObject()) };
|
||||
return result;
|
||||
};
|
||||
|
||||
kretaGridHelper.refreshGridByFormName = function (gridName, formName) {
|
||||
var searchParameterObject =
|
||||
kretaGridHelper.getSearchParameterObject(formName);
|
||||
if (!CommonUtils.isNull(searchParameterObject)) {
|
||||
kretaGridHelper.refreshGridByObject(gridName, searchParameterObject);
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.getSearchParameterObject = function (formName) {
|
||||
var formElement = $('#' + formName);
|
||||
if (!CommonUtils.exists(formElement)) {
|
||||
return null;
|
||||
}
|
||||
var result = formElement.toObject();
|
||||
return result;
|
||||
};
|
||||
|
||||
kretaGridHelper.getSearchParametersWithoutInputNames = function (
|
||||
searchFormName
|
||||
) {
|
||||
var data = CommonUtils.JSONparse(
|
||||
kretaGridHelper.getSearchParameters('#' + searchFormName).data
|
||||
);
|
||||
for (var key in data) {
|
||||
var k = key + '_input';
|
||||
if (data.hasOwnProperty(k)) {
|
||||
delete data[k];
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
|
||||
kretaGridHelper.refreshGridByObject = function (
|
||||
gridName,
|
||||
searchParameterObject
|
||||
) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
if (!CommonUtils.isNullOrUndefined(gridData)) {
|
||||
var data = kretaGridHelper.getSearchParameterData(searchParameterObject);
|
||||
gridData.dataSource.read(data);
|
||||
gridData.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.clearGridData = function (gridName) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
if (!CommonUtils.isNullOrUndefined(gridData)) {
|
||||
var data = [];
|
||||
gridData.dataSource.read(data);
|
||||
gridData.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.getSearchParameterData = function (searchParameterObject) {
|
||||
var result = {
|
||||
data: JSON.stringify(remove_inputProperties(searchParameterObject))
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
kretaGridHelper.init = function (e) {
|
||||
var gridName = e.sender.element.attr('id');
|
||||
initSpecColumns(gridName);
|
||||
handleDirtyRead(gridName);
|
||||
detailGridInit(gridName);
|
||||
|
||||
var grid = $('#' + gridName).data('kendoGrid');
|
||||
grid.thead.kendoTooltip({
|
||||
filter: 'th[data-gridheadertooltip]',
|
||||
content: function (e) {
|
||||
var target = e.target;
|
||||
return target.data('gridheadertooltip');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
kretaGridHelper.initToolBar = function (e, gridName) {
|
||||
if (e.type != 'read') {
|
||||
return;
|
||||
}
|
||||
initPager(e, gridName);
|
||||
};
|
||||
|
||||
kretaGridHelper.selectAll = function (sender, gridName) {
|
||||
var state = sender.is(':checked');
|
||||
$('#' + gridName)
|
||||
.find('*[data-selectGroup="' + gridName + '"]')
|
||||
.prop('checked', state);
|
||||
};
|
||||
|
||||
kretaGridHelper.rowFunctionCall = function (
|
||||
sender,
|
||||
gridId,
|
||||
jsFunction,
|
||||
sendSender
|
||||
) {
|
||||
sendSender = sendSender || false;
|
||||
var parentRow = sender.closest('tr').attr('data-uid');
|
||||
var rowData = kretaGridHelper.getGridRowData(gridId, parentRow);
|
||||
if (sendSender) {
|
||||
jsFunction(sender, rowData);
|
||||
} else {
|
||||
jsFunction(rowData);
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.getRowId = function (sender, gridId) {
|
||||
var parentRow = sender.closest('tr').attr('data-uid');
|
||||
var rowData = kretaGridHelper.getGridRowData(gridId, parentRow);
|
||||
return rowData.ID;
|
||||
};
|
||||
|
||||
kretaGridHelper.getRowData = function (sender, gridId) {
|
||||
var parentRow = sender.closest('tr').attr('data-uid');
|
||||
var rowData = kretaGridHelper.getGridRowData(gridId, parentRow);
|
||||
return rowData;
|
||||
};
|
||||
|
||||
kretaGridHelper.updateDirtyInputsData = function (gridId) {
|
||||
var dirtyRows = getDirtyRows(gridId);
|
||||
$.each(dirtyRows, function (i, row) {
|
||||
updateRowDataFromInput(row);
|
||||
});
|
||||
};
|
||||
|
||||
kretaGridHelper.getAllRows = function (gridName) {
|
||||
var allRows = kretaGridHelper.getKendoGridData(gridName).dataSource.data();
|
||||
$.each(allRows, function (i, row) {
|
||||
kretaGridHelper.addInputToRowData(row);
|
||||
});
|
||||
return allRows;
|
||||
};
|
||||
|
||||
kretaGridHelper.getAllRowsWithDataAttribute = function (
|
||||
gridName,
|
||||
dataAttributes
|
||||
) {
|
||||
var allRows = kretaGridHelper.getKendoGridData(gridName).dataSource.data();
|
||||
$.each(allRows, function (i, row) {
|
||||
addInputAndDataAttributeToRowData(row, dataAttributes);
|
||||
});
|
||||
return allRows;
|
||||
};
|
||||
|
||||
kretaGridHelper.functionCommandCall = function (sender, gridId, jsFunction) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridId);
|
||||
if (!CommonUtils.isNullOrUndefined(gridData)) {
|
||||
jsFunction(gridData.dataSource.data());
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.getSelectedCheckboxIds = function (gridName) {
|
||||
var data = { Items: [] };
|
||||
|
||||
$.each($('td.gridSelectCheckBox input:checkbox'), function (i, v) {
|
||||
if ($(v).prop('checked') == true) {
|
||||
data.Items.push({ Id: kretaGridHelper.getRowId($(v), gridName) });
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
kretaGridHelper.getSelectedRowsByGridName = function (gridName) {
|
||||
var selectedRows = [];
|
||||
$.each(
|
||||
$('#' + gridName + ' td.gridSelectCheckBox input:checkbox'),
|
||||
function (i, e) {
|
||||
if ($(e).prop('checked') == true) {
|
||||
var rowId = $(e).closest('tr').attr('data-uid');
|
||||
var rowData = kretaGridHelper.getGridRowData(gridName, rowId);
|
||||
kretaGridHelper.addInputToRowData(rowData);
|
||||
selectedRows.push(rowData);
|
||||
}
|
||||
}
|
||||
);
|
||||
return selectedRows;
|
||||
};
|
||||
|
||||
kretaGridHelper.getModifiedRows = function (gridName) {
|
||||
var dirtyRows = getDirtyRows(gridName);
|
||||
$.each(dirtyRows, function (i, row) {
|
||||
kretaGridHelper.addInputToRowData(row);
|
||||
});
|
||||
return dirtyRows;
|
||||
};
|
||||
|
||||
kretaGridHelper.haveModifiedRows = function (gridName) {
|
||||
if (getDirtyRows(gridName).length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
kretaGridHelper.openAllGrid = function () {
|
||||
var plusElements = $('.k-master-row .k-plus');
|
||||
var minusElements = $('.k-master-row .k-minus');
|
||||
|
||||
if (plusElements.length > 0) {
|
||||
$('.k-master-row .k-plus').click();
|
||||
}
|
||||
if (minusElements.length > 0) {
|
||||
$('.k-master-row .k-minus').click();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.exportGrid = function (
|
||||
grid,
|
||||
exportFileName,
|
||||
customColumnArray,
|
||||
customDateColumnWidth,
|
||||
popupExport,
|
||||
exportHiddenColumns
|
||||
) {
|
||||
var exportcolumnurl = $('[data-exportcolumnurl]').data('exportcolumnurl');
|
||||
var exportdataurl = $('[data-exportdataurl]').data('exportdataurl');
|
||||
|
||||
if (
|
||||
typeof exportcolumnurl !== 'undefined' &&
|
||||
typeof exportdataurl !== 'undefined' &&
|
||||
(popupExport == false || popupExport == 'undefined')
|
||||
) {
|
||||
AjaxHelper.DoPost(exportcolumnurl, null, setExportColumns);
|
||||
var customFilterData = '-';
|
||||
if ($('#searchForm').length) {
|
||||
customFilterData = JSON.stringify($('#searchForm').toObject());
|
||||
}
|
||||
|
||||
function setExportColumns(data) {
|
||||
var columnsArray = [];
|
||||
$.each(data, function (key, value) {
|
||||
if (
|
||||
customColumnArray !== 'undefined' &&
|
||||
customColumnArray.length > 0
|
||||
) {
|
||||
if ($.inArray(value.Field, customColumnArray) !== -1) {
|
||||
columnsArray.push({
|
||||
field: value.Field,
|
||||
title: value.Title
|
||||
});
|
||||
}
|
||||
} else {
|
||||
columnsArray.push({
|
||||
field: value.Field,
|
||||
title: value.Title
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var sort = $('#' + grid.id)
|
||||
.data('kendoGrid')
|
||||
.dataSource.sort();
|
||||
var dir = '-';
|
||||
var field = '-';
|
||||
if (typeof sort !== 'undefined' && sort.length > 0) {
|
||||
dir = sort[0].dir;
|
||||
field = sort[0].field;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: exportdataurl,
|
||||
data: {
|
||||
searchFilter: customFilterData,
|
||||
sortColumn: field,
|
||||
sortDir: dir
|
||||
},
|
||||
success: function (data) {
|
||||
var exportDiv = $('<div>', { id: 'exportDiv' });
|
||||
var dataSource = new kendo.data.DataSource({
|
||||
data: data.Data
|
||||
});
|
||||
dataSource.read();
|
||||
|
||||
var exportGrid = exportDiv.kendoGrid({
|
||||
columns: columnsArray,
|
||||
excel: { fileName: exportFileName }
|
||||
});
|
||||
|
||||
var grid = exportGrid.data('kendoGrid');
|
||||
grid.setDataSource(dataSource);
|
||||
grid.saveAsExcel();
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var exportDiv = $('<div>', { id: 'exportDiv' });
|
||||
var columnTemplates = [];
|
||||
var hiddenColumnsCount = 0;
|
||||
|
||||
var columns = $('#' + grid.attributes.id.value).data('kendoGrid').columns;
|
||||
$.each(columns, function (i, v) {
|
||||
v.footerTemplate = null;
|
||||
if (exportHiddenColumns) {
|
||||
v.hidden = undefined;
|
||||
} else if (v.hidden === true) {
|
||||
hiddenColumnsCount++;
|
||||
}
|
||||
|
||||
if (columns[i].template && columns[i].field != null) {
|
||||
columnTemplates.push({
|
||||
cellIndex: i - 1,
|
||||
template: kendo.template(columns[i].template)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var exportGrid = exportDiv.kendoGrid({ columns: columns });
|
||||
var dataSource = $('#' + grid.attributes.id.value).data(
|
||||
'kendoGrid'
|
||||
).dataSource;
|
||||
var grid = exportGrid.data('kendoGrid');
|
||||
|
||||
$.each(grid.columns, function (i, v) {
|
||||
if (CommonUtils.isNullOrUndefined(customDateColumnWidth)) {
|
||||
v.width = null;
|
||||
} else {
|
||||
v.width = CommonUtils.isNullOrUndefined(v.format)
|
||||
? null
|
||||
: customDateColumnWidth;
|
||||
}
|
||||
});
|
||||
grid.setDataSource(dataSource);
|
||||
grid.options.excel.fileName = exportFileName;
|
||||
grid.options.excel.allPages = true;
|
||||
|
||||
if (popupExport === true) {
|
||||
grid.bind('excelExport', function (e) {
|
||||
var elem = document.createElement('div');
|
||||
for (var i = 1; i < e.workbook.sheets[0].rows.length; i++) {
|
||||
var row = e.workbook.sheets[0].rows[i];
|
||||
var dataItem = e.data[i - 1];
|
||||
for (var j = 0; j < columnTemplates.length; j++) {
|
||||
var columnTemplate = columnTemplates[j];
|
||||
elem.innerHTML = columnTemplate.template(dataItem);
|
||||
if (
|
||||
row.cells[columnTemplate.cellIndex - hiddenColumnsCount] !=
|
||||
'undefined'
|
||||
) {
|
||||
row.cells[columnTemplate.cellIndex - hiddenColumnsCount].value =
|
||||
elem.textContent || elem.innerText || '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
grid.saveAsExcel();
|
||||
}
|
||||
};
|
||||
|
||||
kretaGridHelper.exportGridAndSaveAsExcel = function (
|
||||
columnsNameAndTitleArray,
|
||||
gridDataSource,
|
||||
exportFileName
|
||||
) {
|
||||
var columnsNameAndTitleArrayConvertedForKendoGrid = [];
|
||||
$.each(columnsNameAndTitleArray, function (key, value) {
|
||||
columnsNameAndTitleArrayConvertedForKendoGrid.push({
|
||||
field: value.Field,
|
||||
title: value.Title
|
||||
});
|
||||
});
|
||||
|
||||
var exportDiv = $('<div>', { id: 'exportDiv' });
|
||||
var exportGrid = exportDiv.kendoGrid({
|
||||
columns: columnsNameAndTitleArrayConvertedForKendoGrid
|
||||
});
|
||||
var grid = exportGrid.data('kendoGrid');
|
||||
|
||||
var dataSource = new kendo.data.DataSource({
|
||||
data: gridDataSource.Data
|
||||
});
|
||||
dataSource.read();
|
||||
|
||||
grid.setDataSource(dataSource);
|
||||
|
||||
if (typeof exportFileName === 'undefined') {
|
||||
exportFileName = 'Export';
|
||||
}
|
||||
grid.options.excel.fileName = exportFileName;
|
||||
grid.saveAsExcel();
|
||||
};
|
||||
|
||||
kretaGridHelper.resetHeaderCheckbox = function (gridName) {
|
||||
$('#' + gridName + '_chk').prop('checked', false);
|
||||
};
|
||||
|
||||
function initSpecColumns(gridName) {
|
||||
var specInput = $('[data-inputParentGrid = "' + gridName + '"]');
|
||||
$.each(specInput, function (i, e) {
|
||||
eval($(e).children('script').last().html());
|
||||
$(e).change(function () {
|
||||
inputFieldChange($(this), gridName);
|
||||
});
|
||||
});
|
||||
|
||||
handleDropdownSpecColumn(gridName);
|
||||
|
||||
var rowCommand = $('[data-rowFunctionParent = "' + gridName + '"]');
|
||||
$.each(rowCommand, function (i, e) {
|
||||
eval($(e).children('script').last().html());
|
||||
});
|
||||
}
|
||||
|
||||
function handleDropdownSpecColumn(gridName) {
|
||||
var specDropDownInput = $(
|
||||
'.gridDropDownList[data-inputParentGrid = "' + gridName + '"]'
|
||||
);
|
||||
var urls = [];
|
||||
|
||||
$.each(specDropDownInput, function () {
|
||||
var url = $(this).data('dropdownurl');
|
||||
if (!CommonUtils.isUndefined(url)) {
|
||||
var dataReadFunction = null;
|
||||
|
||||
try {
|
||||
var stringFunction = $(this).data('readdatahandler');
|
||||
if (stringFunction != '') {
|
||||
dataReadFunction = new Function(stringFunction);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
var dropdownUrl = $.grep(urls, function (item) {
|
||||
return item.url == url;
|
||||
});
|
||||
if (dropdownUrl.length < 1) {
|
||||
urls.push({
|
||||
element: [{ Id: '#' + $(this).attr('data-uddlId') }],
|
||||
url: url,
|
||||
dataReadFunction: dataReadFunction,
|
||||
dropdownGroupCustomOrder: $(this).attr(
|
||||
'data-dropdownGroupCustomOrder'
|
||||
)
|
||||
});
|
||||
} else {
|
||||
dropdownUrl[0].element.push({
|
||||
Id: '#' + $(this).attr('data-uddlId')
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.each(urls, function () {
|
||||
var e = this.element;
|
||||
var dropdownGroupCustomOrder = this.dropdownGroupCustomOrder;
|
||||
if (this.dataReadFunction != null) {
|
||||
AjaxHelper.DoGet(this.url, this.dataReadFunction(), function (d) {
|
||||
setDropdown(d, e, dropdownGroupCustomOrder);
|
||||
});
|
||||
} else {
|
||||
AjaxHelper.DoGet(this.url, {}, function (d) {
|
||||
setDropdown(d, e, dropdownGroupCustomOrder);
|
||||
});
|
||||
}
|
||||
|
||||
function setDropdown(data, elements, dropdownGroupCustomOrder) {
|
||||
var useGroup = false;
|
||||
var dataSource = new kendo.data.DataSource({
|
||||
data: []
|
||||
});
|
||||
|
||||
$.each(data, function (i, e) {
|
||||
dataSource.fetch(function () {
|
||||
if (e.Group != null) {
|
||||
dataSource.add({
|
||||
Value: e.Value,
|
||||
Text: e.Text,
|
||||
Group: e.Group,
|
||||
SortId: i
|
||||
});
|
||||
useGroup = true;
|
||||
} else if (e.GroupName != null) {
|
||||
dataSource.add({
|
||||
Value: e.Value,
|
||||
Text: e.Text,
|
||||
Group: e.GroupName,
|
||||
SortId: i
|
||||
});
|
||||
useGroup = true;
|
||||
} else {
|
||||
dataSource.add({ Value: e.Value, Text: e.Text });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (useGroup) {
|
||||
if (typeof dropdownGroupCustomOrder === 'undefined') {
|
||||
dataSource.group({ field: 'Group' });
|
||||
} else {
|
||||
dataSource.group({ field: 'Group', dir: dropdownGroupCustomOrder });
|
||||
}
|
||||
dataSource.sort({ field: 'SortId', dir: 'asc' });
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$.each(elements, function () {
|
||||
var ddl = $(this.Id).data('kendoDropDownList');
|
||||
var combo = $(this.Id).data('kendoComboBox');
|
||||
|
||||
if (ddl) {
|
||||
ddl.setDataSource(dataSource);
|
||||
ddl.value($(this.Id).attr('value'));
|
||||
} else if (combo) {
|
||||
combo.setDataSource(dataSource);
|
||||
combo.value($(this.Id).attr('value'));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleDirtyRead(gridName) {
|
||||
var headerRow = $('#' + gridName)
|
||||
.find('thead')
|
||||
.first();
|
||||
var sortColumnHeader = headerRow.find("th[data-role='columnsorter']");
|
||||
$.each(sortColumnHeader, function (i, elem) {
|
||||
$(elem).unbind('click.kendoGrid');
|
||||
$(elem).bindFirst('click.kendoGrid', function (e) {
|
||||
dirtyRowConfirm(e, gridName);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dirtyRowConfirm(e, gridName) {
|
||||
if (getDirtyRows(gridName).length > 0) {
|
||||
if (confirm(Globalization.GridAdatvesztesFigyelmeztetes) == false) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kretaGridHelper.addInputToRowData = function (rowData) {
|
||||
var inputControls = $('[data-uid ="' + rowData.uid + '"]').find(
|
||||
'[data-rowInputName]'
|
||||
);
|
||||
var rowInputs = [];
|
||||
$.each(inputControls, function (y, input) {
|
||||
var val = '';
|
||||
if ($(input).prop('type') === 'checkbox') {
|
||||
val = $(input).prop('checked');
|
||||
} else if ($(input).attr('data-role') === 'timepicker') {
|
||||
val = kendo.toString($(input).data('kendoTimePicker').value(), 'H:mm');
|
||||
} else {
|
||||
val = $(input).val();
|
||||
}
|
||||
rowInputs.push({ name: $(input).attr('data-rowInputName'), value: val });
|
||||
rowData['ki_' + $(input).attr('data-rowInputName')] = val;
|
||||
});
|
||||
rowData.input = rowInputs;
|
||||
};
|
||||
|
||||
function addInputAndDataAttributeToRowData(rowData, dataAttributes) {
|
||||
var rowInputs = [];
|
||||
|
||||
$.each(dataAttributes, function (i, v) {
|
||||
var element = $('[data-uid ="' + rowData.uid + '"]').find(
|
||||
'[data-' + v + ']'
|
||||
);
|
||||
var value = $(element).attr('data-' + v);
|
||||
|
||||
if (value === 'null') {
|
||||
value = null;
|
||||
}
|
||||
|
||||
rowInputs.push({ name: v, value: value });
|
||||
rowData['ki_' + v] = value;
|
||||
});
|
||||
|
||||
var inputControls = $('[data-uid ="' + rowData.uid + '"]').find(
|
||||
'[data-rowInputName]'
|
||||
);
|
||||
|
||||
$.each(inputControls, function (y, input) {
|
||||
var val = '';
|
||||
if ($(input).prop('type') === 'checkbox') {
|
||||
val = $(input).prop('checked');
|
||||
} else if ($(input).attr('data-role') === 'timepicker') {
|
||||
val = kendo.toString($(input).data('kendoTimePicker').value(), 'H:mm');
|
||||
} else {
|
||||
val = $(input).val();
|
||||
}
|
||||
rowInputs.push({ name: $(input).attr('data-rowInputName'), value: val });
|
||||
rowData['ki_' + $(input).attr('data-rowInputName')] = val;
|
||||
});
|
||||
rowData.input = rowInputs;
|
||||
}
|
||||
|
||||
function updateRowDataFromInput(rowData) {
|
||||
var inputControls = $('[data-uid ="' + rowData.uid + '"]').find(
|
||||
'[data-rowInputName]'
|
||||
);
|
||||
$.each(inputControls, function (y, input) {
|
||||
var val = '';
|
||||
if ($(input).prop('type') === 'checkbox') {
|
||||
val = $(input).prop('checked');
|
||||
} else if ($(input).attr('data-role') === 'timepicker') {
|
||||
val = kendo.toString($(input).data('kendoTimePicker').value(), 'H:mm');
|
||||
} else {
|
||||
val = $(input).val();
|
||||
}
|
||||
rowData[$(input).attr('data-rowInputName')] = val;
|
||||
});
|
||||
}
|
||||
|
||||
function getDirtyRows(gridName) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName).dataSource.data();
|
||||
var dirty = $.grep(gridData, function (item) {
|
||||
return item.dirty;
|
||||
});
|
||||
return dirty;
|
||||
}
|
||||
|
||||
function inputFieldChange(sender, gridName) {
|
||||
var parentRow = sender.closest('tr').attr('data-uid');
|
||||
var rowData = kretaGridHelper.getGridRowData(gridName, parentRow);
|
||||
rowData.dirty = true;
|
||||
}
|
||||
|
||||
function searchPanelReloadGrid(formName) {
|
||||
var formObject = $('#' + formName).toObject();
|
||||
var result = JSON.stringify(remove_inputProperties(formObject));
|
||||
return result;
|
||||
}
|
||||
|
||||
function remove_inputProperties(object) {
|
||||
//TCs: az _input részben a felesleges szöveges érték van, ami ha html kódot tartalmaz, akkor üresen jelenik meg a grid
|
||||
var result = {};
|
||||
for (var property in object) {
|
||||
if (!property.endsWith('_input')) {
|
||||
result[property] = object[property];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
kretaGridHelper.getGridRowData = function (gridId, rowId) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridId);
|
||||
var rowData = null;
|
||||
$.each(gridData.dataSource.data(), function (i, e) {
|
||||
if (e.uid == rowId) {
|
||||
rowData = e;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return rowData;
|
||||
};
|
||||
|
||||
kretaGridHelper.setRowToDirty = function (gridId, id) {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridId);
|
||||
$.each(gridData.dataSource.data(), function (i, e) {
|
||||
if (parseInt(e.ID) == id) {
|
||||
e.dirty = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function initPager(responsEvent, gridName) {
|
||||
function initBackButton() {
|
||||
var button = grid.find('.kendoGrid-Back');
|
||||
button.removeClass('k-state-disabled');
|
||||
button.unbind('click.kendoGrid');
|
||||
if (currentPage <= 1) {
|
||||
button.addClass('k-state-disabled');
|
||||
} else {
|
||||
button.bind('click.kendoGrid', function (e) {
|
||||
dirtyRowConfirm(e, gridName);
|
||||
});
|
||||
button.bind('click.kendoGrid', function () {
|
||||
gridData.page(gridData.page() - 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initNextButton() {
|
||||
var button = grid.find('.kendoGrid-Next');
|
||||
button.removeClass('k-state-disabled');
|
||||
button.unbind('click.kendoGrid');
|
||||
if (currentPage >= totalPage) {
|
||||
button.addClass('k-state-disabled');
|
||||
} else {
|
||||
button.bind('click.kendoGrid', function (e) {
|
||||
dirtyRowConfirm(e, gridName);
|
||||
});
|
||||
button.bind('click.kendoGrid', function () {
|
||||
gridData.page(gridData.page() + 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function initCounter() {
|
||||
var info = grid.find('.kendoGrid-PageInfo');
|
||||
var min = (currentPage - 1) * pageSize + 1;
|
||||
var max = currentPage * pageSize;
|
||||
if (max > total) {
|
||||
max = total;
|
||||
}
|
||||
info.text(
|
||||
(isNaN(min) ? 0 : min) + ' - ' + (isNaN(max) ? 0 : max) + ' / ' + total
|
||||
);
|
||||
}
|
||||
|
||||
function initPageSize() {
|
||||
var dropdown = $('#' + gridName + '_PageSize');
|
||||
dropdown.unbind('change.kendoGrid');
|
||||
dropdown.bind('change.kendoGrid', function () {
|
||||
gridData.pageSize($(this).val());
|
||||
});
|
||||
}
|
||||
|
||||
function hideIfUnnecessary() {
|
||||
var pager = grid.find('.k-grid-pager');
|
||||
|
||||
grid.find('span.kendoGrid-PageInfo').hide();
|
||||
|
||||
if (totalPage > 1) {
|
||||
pager.find('.k-dropdown').show();
|
||||
pager.find('.kendoGrid-Back').show();
|
||||
pager.find('.kendoGrid-Next').show();
|
||||
|
||||
grid.find('span.kendoGrid-PageInfo').show();
|
||||
} else {
|
||||
if (gridData.pageSize() == 100) {
|
||||
pager.find('.k-dropdown').hide();
|
||||
}
|
||||
pager.find('.kendoGrid-Back').hide();
|
||||
pager.find('.kendoGrid-Next').hide();
|
||||
|
||||
var pagerInfo = grid.find('span.kendoGrid-PageInfo.mustShowPagerCount');
|
||||
if (pagerInfo.length > 0) {
|
||||
if (pagerInfo.text().indexOf(' - 0 / 0') === -1) {
|
||||
grid.find('span.kendoGrid-PageInfo').show();
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
grid.find('.kendo-gridFunctionKommand').length == 0 &&
|
||||
grid.find('.k-i-excel').length == 0 &&
|
||||
grid.find('.k-i-pdf').length == 0 &&
|
||||
grid.find('span.kendoGrid-PageInfo.mustShowPagerCount').length == 0
|
||||
) {
|
||||
grid.find('.k-grid-toolbar').remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var total = responsEvent.response.Total;
|
||||
var pageSize = responsEvent.sender._pageSize;
|
||||
var currentPage = responsEvent.sender._page;
|
||||
var totalPage = Math.ceil(total / pageSize);
|
||||
|
||||
var grid = $('#' + gridName);
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName).dataSource;
|
||||
initBackButton();
|
||||
initNextButton();
|
||||
initCounter();
|
||||
initPageSize();
|
||||
hideIfUnnecessary();
|
||||
}
|
||||
|
||||
function detailGridInit(gridName) {
|
||||
if (typeof $('#' + gridName).attr('clientTemplateUrl') !== 'undefined') {
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
gridData.unbind('detailInit');
|
||||
gridData.bind('detailInit', function (e) {
|
||||
if ($('#' + gridName).attr('clientTemplateWholeDataRow') == 'True') {
|
||||
AjaxHelper.DoPost(
|
||||
$('#' + gridName).attr('clientTemplateUrl'),
|
||||
kretaGridHelper.getGridRowData(gridName, e.data.uid),
|
||||
function (data) {
|
||||
e.detailCell.append(data);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
AjaxHelper.DoPost(
|
||||
$('#' + gridName).attr('clientTemplateUrl'),
|
||||
{
|
||||
Id: e.data.ID
|
||||
},
|
||||
function (data) {
|
||||
e.detailCell.append(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//NOTE: Ezzel szűrjük az export-ot a SearchPanelSideBar-ban lévő property-kkel.
|
||||
//Ha null, akkor visszakapjuk az összes elemet a gridben, szűrés nélkül.
|
||||
kretaGridHelper.getExportBySearchForm = function (
|
||||
gridName,
|
||||
url,
|
||||
searchFormName
|
||||
) {
|
||||
var searchParameters = null;
|
||||
if (searchFormName) {
|
||||
searchParameters = kretaGridHelper.getSearchParameters(
|
||||
`#${searchFormName}`
|
||||
);
|
||||
}
|
||||
|
||||
kretaGridHelper.getExport(gridName, url, searchParameters);
|
||||
};
|
||||
|
||||
//NOTE: Ezzel szűrjük az export-ot már előre elkészített searchParameters objektummal.
|
||||
//Figyelni, kell, hogy a c# oldalon benne legyenek a szűrő modelben a searchParameters property-jei!
|
||||
//Ha null, akkor üres string-ként adjuk át a searchParameters-t és nem történik semmilyen szűrés.
|
||||
kretaGridHelper.getExport = function (gridName, url, searchParameters) {
|
||||
if (CommonUtils.isNullOrUndefined(searchParameters)) {
|
||||
searchParameters = { data: '' };
|
||||
}
|
||||
|
||||
var gridData = kretaGridHelper.getKendoGridData(gridName);
|
||||
var params = gridData.dataSource._params();
|
||||
var dataSourceRequest = gridData.dataSource.transport.parameterMap(params);
|
||||
var data = Object.assign(dataSourceRequest, searchParameters);
|
||||
|
||||
AjaxHelper.DownloadFile(url, data, true);
|
||||
};
|
||||
|
||||
return kretaGridHelper;
|
||||
})();
|
||||
|
||||
$.fn.bindFirst = function (name, fn) {
|
||||
this.on(name, fn);
|
||||
this.each(function () {
|
||||
var handlers = $._data(this, 'events')[name.split('.')[0]];
|
||||
// take out the handler we just inserted from the end
|
||||
var handler = handlers.pop();
|
||||
// move it at the beginning
|
||||
handlers.splice(0, 0, handler);
|
||||
});
|
||||
};
|
73
KretaWeb/Scripts/KendoHelper/KretaImportGridHelper.js
Normal file
73
KretaWeb/Scripts/KendoHelper/KretaImportGridHelper.js
Normal file
|
@ -0,0 +1,73 @@
|
|||
var KretaImportGridHelper = (function () {
|
||||
var kretaImportGridHelper = function () {};
|
||||
|
||||
kretaImportGridHelper.initializeGrid = function (
|
||||
gridId,
|
||||
columns,
|
||||
dataSource,
|
||||
rowTemplateId
|
||||
) {
|
||||
var defaultImportPreviewPopupHeight = 768;
|
||||
var gridHeight = 675;
|
||||
var gridContentMaxHeight = 586;
|
||||
|
||||
var currentImportPreviewPopupHeight = $('#ImportPreviewPopup')
|
||||
.parent()
|
||||
.height();
|
||||
if (defaultImportPreviewPopupHeight !== currentImportPreviewPopupHeight) {
|
||||
var difference =
|
||||
defaultImportPreviewPopupHeight - currentImportPreviewPopupHeight;
|
||||
gridHeight -= difference;
|
||||
gridContentMaxHeight -= difference;
|
||||
}
|
||||
|
||||
$('#' + gridId).kendoGrid({
|
||||
columns: columns,
|
||||
dataSource: dataSource,
|
||||
sortable: true,
|
||||
pageable: {
|
||||
alwaysVisible: false,
|
||||
pageSize: 15,
|
||||
buttonCount: 5,
|
||||
messages: {
|
||||
display: '{0} - {1} / {2}',
|
||||
empty: Globalization.NincsAdat,
|
||||
first: Globalization.ElsoOldal,
|
||||
last: Globalization.UtolsoOldal,
|
||||
next: Globalization.KovetkezoOldal,
|
||||
previous: Globalization.ElozoOldal,
|
||||
morePages: Globalization.TobbOldal
|
||||
}
|
||||
},
|
||||
noRecords: true,
|
||||
messages: {
|
||||
noRecords: Globalization.NincsTalalat
|
||||
},
|
||||
height: gridHeight
|
||||
});
|
||||
|
||||
var grid = KretaGridHelper.getKendoGridData(gridId);
|
||||
if (!CommonUtils.isNullOrEmpty(rowTemplateId)) {
|
||||
grid.setOptions({
|
||||
rowTemplate: window.kendo.template($('#' + rowTemplateId).html())
|
||||
});
|
||||
}
|
||||
|
||||
grid.content.attr(
|
||||
'style',
|
||||
'max-height: ' + gridContentMaxHeight + 'px !important;'
|
||||
);
|
||||
grid.table.css('min-width', '100%');
|
||||
};
|
||||
|
||||
kretaImportGridHelper.getFormObject = function (formName) {
|
||||
var formElement = $('#' + formName);
|
||||
if (!CommonUtils.exists(formElement)) {
|
||||
return null;
|
||||
}
|
||||
var result = formElement.toObject();
|
||||
return result;
|
||||
};
|
||||
|
||||
return kretaImportGridHelper;
|
||||
})();
|
84
KretaWeb/Scripts/KendoHelper/KretaMaskedDateTimepicker.js
Normal file
84
KretaWeb/Scripts/KendoHelper/KretaMaskedDateTimepicker.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
(function ($) {
|
||||
var kendo = window.kendo,
|
||||
ui = kendo.ui,
|
||||
Widget = ui.Widget,
|
||||
proxy = $.proxy,
|
||||
CHANGE = 'change',
|
||||
PROGRESS = 'progress',
|
||||
ERROR = 'error',
|
||||
NS = '.generalInfo';
|
||||
|
||||
var MaskedDateTimePicker = Widget.extend({
|
||||
init: function (element, options) {
|
||||
var that = this;
|
||||
Widget.fn.init.call(this, element, options);
|
||||
|
||||
var mask = '0000. 00. 00. 00:00';
|
||||
var format = 'yyyy. MM. dd. HH:mm';
|
||||
var parseFormats = 'yyyy. MM. dd. HH:mm';
|
||||
var minDate = '1900. 01. 01. 00:00';
|
||||
var maxDate = '2100. 01. 01. 00:00';
|
||||
|
||||
if (typeof options !== 'undefined') {
|
||||
$.each(options, function (index, value) {
|
||||
if (index == 'dateOptions.mask') {
|
||||
mask = value;
|
||||
}
|
||||
if (index == 'dateOptions.format') {
|
||||
format = value;
|
||||
}
|
||||
if (index == 'dateOptions.parseFormats') {
|
||||
parseFormats = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var dateTimePickerOptions = {};
|
||||
|
||||
//ha már van rajta datePicker (MVC-s helper miatt), akkor azt levesszük, de a beállításait megtartjuk
|
||||
var dateTimePicker = $(element).data('kendoDateTimePicker');
|
||||
if (typeof dateTimePicker !== 'undefined') {
|
||||
dateTimePickerOptions = dateTimePicker.options;
|
||||
dateTimePicker.destroy();
|
||||
}
|
||||
|
||||
dateTimePickerOptions.format = format;
|
||||
dateTimePickerOptions.parseFormats = parseFormats;
|
||||
dateTimePickerOptions.minDate = minDate;
|
||||
dateTimePickerOptions.maxDate = maxDate;
|
||||
|
||||
$(element)
|
||||
.kendoMaskedTextBox({ mask: mask, culture: 'en-US' })
|
||||
.kendoDateTimePicker(dateTimePickerOptions)
|
||||
.closest('.k-datetimepicker')
|
||||
.add(element)
|
||||
.removeClass('k-textbox');
|
||||
|
||||
that.element.data('kendoDateTimePicker').bind('change', function () {
|
||||
that.trigger(CHANGE);
|
||||
});
|
||||
},
|
||||
options: {
|
||||
name: 'MaskedDateTimePicker',
|
||||
dateOptions: {}
|
||||
},
|
||||
events: [CHANGE],
|
||||
destroy: function () {
|
||||
var that = this;
|
||||
Widget.fn.destroy.call(that);
|
||||
|
||||
kendo.destroy(that.element);
|
||||
},
|
||||
value: function (value) {
|
||||
var datetimepicker = this.element.data('kendoDateTimePicker');
|
||||
|
||||
if (CommonUtils.isNullOrUndefined(value)) {
|
||||
return datetimepicker.value();
|
||||
}
|
||||
|
||||
datetimepicker.value(value);
|
||||
}
|
||||
});
|
||||
|
||||
ui.plugin(MaskedDateTimePicker);
|
||||
})(window.kendo.jQuery);
|
84
KretaWeb/Scripts/KendoHelper/KretaMaskedDatepicker.js
Normal file
84
KretaWeb/Scripts/KendoHelper/KretaMaskedDatepicker.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
(function ($) {
|
||||
var kendo = window.kendo,
|
||||
ui = kendo.ui,
|
||||
Widget = ui.Widget,
|
||||
proxy = $.proxy,
|
||||
CHANGE = 'change',
|
||||
PROGRESS = 'progress',
|
||||
ERROR = 'error',
|
||||
NS = '.generalInfo';
|
||||
|
||||
var MaskedDatePicker = Widget.extend({
|
||||
init: function (element, options) {
|
||||
var that = this;
|
||||
Widget.fn.init.call(this, element, options);
|
||||
|
||||
var mask = '0000. 00. 00.';
|
||||
var format = 'yyyy. MM. dd.';
|
||||
var parseFormats = 'yyyy. MM. dd.';
|
||||
var minDate = '1900. 01. 01.';
|
||||
var maxDate = '2100. 01. 01.';
|
||||
|
||||
if (typeof options !== 'undefined') {
|
||||
$.each(options, function (index, value) {
|
||||
if (index == 'dateOptions.mask') {
|
||||
mask = value;
|
||||
}
|
||||
if (index == 'dateOptions.format') {
|
||||
format = value;
|
||||
}
|
||||
if (index == 'dateOptions.parseFormats') {
|
||||
parseFormats = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var datePickerOptions = {};
|
||||
|
||||
//ha már van rajta datePicker (MVC-s helper miatt), akkor azt levesszük, de a beállításait megtartjuk
|
||||
var datePicker = $(element).data('kendoDatePicker');
|
||||
if (typeof datePicker !== 'undefined') {
|
||||
datePickerOptions = datePicker.options;
|
||||
datePicker.destroy();
|
||||
}
|
||||
|
||||
datePickerOptions.format = format;
|
||||
datePickerOptions.parseFormats = parseFormats;
|
||||
datePickerOptions.minDate = minDate;
|
||||
datePickerOptions.maxDate = maxDate;
|
||||
|
||||
$(element)
|
||||
.kendoMaskedTextBox({ mask: mask, culture: 'en-US' })
|
||||
.kendoDatePicker(datePickerOptions)
|
||||
.closest('.k-datepicker')
|
||||
.add(element)
|
||||
.removeClass('k-textbox');
|
||||
|
||||
that.element.data('kendoDatePicker').bind('change', function () {
|
||||
that.trigger(CHANGE);
|
||||
});
|
||||
},
|
||||
options: {
|
||||
name: 'MaskedDatePicker',
|
||||
dateOptions: {}
|
||||
},
|
||||
events: [CHANGE],
|
||||
destroy: function () {
|
||||
var that = this;
|
||||
Widget.fn.destroy.call(that);
|
||||
|
||||
kendo.destroy(that.element);
|
||||
},
|
||||
value: function (value) {
|
||||
var datepicker = this.element.data('kendoDatePicker');
|
||||
|
||||
if (CommonUtils.isNullOrUndefined(value)) {
|
||||
return datepicker.value();
|
||||
}
|
||||
|
||||
datepicker.value(value);
|
||||
}
|
||||
});
|
||||
|
||||
ui.plugin(MaskedDatePicker);
|
||||
})(window.kendo.jQuery);
|
71
KretaWeb/Scripts/KendoHelper/KretaMaskedTimepicker.js
Normal file
71
KretaWeb/Scripts/KendoHelper/KretaMaskedTimepicker.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
(function ($) {
|
||||
var kendo = window.kendo,
|
||||
ui = kendo.ui,
|
||||
Widget = ui.Widget,
|
||||
proxy = $.proxy,
|
||||
CHANGE = 'change',
|
||||
PROGRESS = 'progress',
|
||||
ERROR = 'error',
|
||||
NS = '.generalInfo';
|
||||
|
||||
var MaskedTimePicker = Widget.extend({
|
||||
init: function (element, options) {
|
||||
var that = this;
|
||||
Widget.fn.init.call(this, element, options);
|
||||
|
||||
var mask = '00:00';
|
||||
var format = 'HH:mm';
|
||||
var parseFormats = 'HH:mm';
|
||||
|
||||
if (typeof options !== 'undefined') {
|
||||
$.each(options, function (index, value) {
|
||||
if (index == 'dateOptions.mask') {
|
||||
mask = value;
|
||||
}
|
||||
if (index == 'dateOptions.format') {
|
||||
format = value;
|
||||
}
|
||||
if (index == 'dateOptions.parseFormats') {
|
||||
parseFormats = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(element)
|
||||
.kendoMaskedTextBox({ mask: mask })
|
||||
.kendoTimePicker({
|
||||
format: format,
|
||||
parseFormats: parseFormats
|
||||
})
|
||||
.closest('.k-timepicker')
|
||||
.add(element)
|
||||
.removeClass('k-textbox');
|
||||
|
||||
that.element.data('kendoTimePicker').bind('change', function () {
|
||||
that.trigger(CHANGE);
|
||||
});
|
||||
},
|
||||
options: {
|
||||
name: 'MaskedTimePicker',
|
||||
dateOptions: {}
|
||||
},
|
||||
events: [CHANGE],
|
||||
destroy: function () {
|
||||
var that = this;
|
||||
Widget.fn.destroy.call(that);
|
||||
|
||||
kendo.destroy(that.element);
|
||||
},
|
||||
value: function (value) {
|
||||
var datetimepicker = this.element.data('kendoTimePicker');
|
||||
|
||||
if (CommonUtils.isNullOrUndefined(value)) {
|
||||
return datetimepicker.value();
|
||||
}
|
||||
|
||||
datetimepicker.value(value);
|
||||
}
|
||||
});
|
||||
|
||||
ui.plugin(MaskedTimePicker);
|
||||
})(window.kendo.jQuery);
|
138
KretaWeb/Scripts/KendoHelper/KretaMultiSelectHelper.js
Normal file
138
KretaWeb/Scripts/KendoHelper/KretaMultiSelectHelper.js
Normal file
|
@ -0,0 +1,138 @@
|
|||
var KretaMultiSelectHelper = (function () {
|
||||
var kretaMultiSelectHelper = function () {};
|
||||
|
||||
kretaMultiSelectHelper.getKendoMultiSelectData = function (multiSelectId) {
|
||||
var multiSelectBox = $('#' + multiSelectId);
|
||||
var multiSelectData = multiSelectBox
|
||||
.kendoMultiSelect()
|
||||
.data('kendoMultiSelect');
|
||||
|
||||
return multiSelectData;
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.getCascadeData = function (inputName) {
|
||||
if (inputName.indexOf(',') >= 0) {
|
||||
var array = inputName.split(',');
|
||||
var data = '';
|
||||
|
||||
$.each(array, function (key, value) {
|
||||
if (data.length) {
|
||||
data += ',';
|
||||
}
|
||||
|
||||
if (value.indexOf('#') >= 0) {
|
||||
data += $(value).val();
|
||||
} else {
|
||||
data += $('#' + value).val();
|
||||
}
|
||||
});
|
||||
|
||||
return { cascadeFilter: data };
|
||||
}
|
||||
|
||||
return { cascadeFilter: $(inputName).val() };
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.getServerFilteringData = function (inputName) {
|
||||
return { serverFilter: $(inputName).val() };
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.getServerFilteringMultiSelectTextData = function (
|
||||
inputName
|
||||
) {
|
||||
var textValue = $(inputName).data('kendoMultiSelect').text();
|
||||
|
||||
if (textValue.length) {
|
||||
return { serverFilter: textValue };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.refreshMultiSelectBox = function (inputName) {
|
||||
var widget = $('#' + inputName)
|
||||
.kendoMultiSelect()
|
||||
.data('kendoMultiSelect');
|
||||
|
||||
widget.dataSource.read();
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.setFirstItem = function (
|
||||
inputName,
|
||||
setIfHasOnlyOneItem
|
||||
) {
|
||||
var widget = $('#' + inputName)
|
||||
.kendoMultiSelect()
|
||||
.data('kendoMultiSelect');
|
||||
|
||||
if (setIfHasOnlyOneItem) {
|
||||
if (widget.dataSource.data().length === 1) {
|
||||
widget.value(widget.dataSource.data()[0].Value);
|
||||
}
|
||||
} else {
|
||||
if (widget.dataSource.data().length > 0) {
|
||||
widget.value(widget.dataSource.data()[0].Value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function validateDataInChange(elementId) {
|
||||
elementId = elementId.replace('.', '_');
|
||||
$('input[name="' + elementId + '"]').attr(
|
||||
'title',
|
||||
$('input[name="' + elementId + '_input"]').attr('title')
|
||||
);
|
||||
|
||||
var widget = $('#' + elementId)
|
||||
.kendoMultiSelect()
|
||||
.data('kendoMultiSelect');
|
||||
|
||||
if (widget.selectedIndex === -1 && widget.value()) {
|
||||
if (widget.dataSource.view().length) {
|
||||
widget.select(0);
|
||||
} else {
|
||||
widget.value(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kretaMultiSelectHelper.validateCascadeDataInChange = function (e) {
|
||||
validateDataInChange(e.id);
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.validateDataInChange = function (e) {
|
||||
validateDataInChange(e.sender.element[0].id);
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.dataBoundMultiSelect = function (e) {
|
||||
var elementId = e.sender.element[0].id;
|
||||
var multiSelect = $('#' + elementId).data('kendoMultiSelect');
|
||||
|
||||
if (typeof multiSelect !== 'undefined') {
|
||||
var dataSource = multiSelect.dataSource;
|
||||
|
||||
if (dataSource != null) {
|
||||
if (dataSource.data().length == 1) {
|
||||
var data = dataSource.data()[0];
|
||||
|
||||
multiSelect.value(data.Value);
|
||||
multiSelect.trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.onOpenDropdownMultiSelect = function (e) {
|
||||
var elementId = e.sender.element[0].id;
|
||||
var MultiBox = $('#' + elementId).data('kendoMultiSelect');
|
||||
|
||||
return MultiBox;
|
||||
};
|
||||
|
||||
kretaMultiSelectHelper.setKendoValue = function (comboBoxData, value) {
|
||||
comboBoxData.value(value);
|
||||
comboBoxData.trigger('change');
|
||||
};
|
||||
|
||||
return kretaMultiSelectHelper;
|
||||
})();
|
27
KretaWeb/Scripts/KendoHelper/KretaNumericHelper.js
Normal file
27
KretaWeb/Scripts/KendoHelper/KretaNumericHelper.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
var KretaNumericHelper = (function () {
|
||||
var kretaNumericHelper = function () {};
|
||||
|
||||
kretaNumericHelper.getKendoNumericTextBoxData = function (numericTextBoxId) {
|
||||
var numericTextBox = $('#' + numericTextBoxId);
|
||||
var numericTextBoxData = numericTextBox.data('kendoNumericTextBox');
|
||||
return numericTextBoxData;
|
||||
};
|
||||
|
||||
kretaNumericHelper.setValue = function (numericTextBoxId, value) {
|
||||
var numericTextBoxData =
|
||||
kretaNumericHelper.getKendoNumericTextBoxData(numericTextBoxId);
|
||||
numericTextBoxData.value(value);
|
||||
};
|
||||
|
||||
kretaNumericHelper.setTitle = function (e) {
|
||||
var inputName = e.sender.element[0].id;
|
||||
$('#' + inputName).attr(
|
||||
'title',
|
||||
$('#' + inputName)
|
||||
.prev('input')
|
||||
.attr('title')
|
||||
);
|
||||
};
|
||||
|
||||
return kretaNumericHelper;
|
||||
})();
|
742
KretaWeb/Scripts/KendoHelper/KretaOsztalybaSorolasHelper.js
Normal file
742
KretaWeb/Scripts/KendoHelper/KretaOsztalybaSorolasHelper.js
Normal file
|
@ -0,0 +1,742 @@
|
|||
var KretaOsztalybaSorolasHelper = (function () {
|
||||
var kretaOsztalybaSorolasHelper = function () {};
|
||||
|
||||
//Selectedre állítja egy select összes option-jét
|
||||
kretaOsztalybaSorolasHelper.selectAllOptions = function (selStr) {
|
||||
var selObj = document.getElementById(selStr);
|
||||
for (var i = 0; i < selObj.options.length; i++) {
|
||||
selObj.options[i].selected = true;
|
||||
}
|
||||
};
|
||||
|
||||
//Leszedi a selectedet egy select összes option-jéről
|
||||
kretaOsztalybaSorolasHelper.deSelectAllOptions = function (selStr) {
|
||||
var selObj = document.getElementById(selStr);
|
||||
for (var i = 0; i < selObj.options.length; i++) {
|
||||
selObj.options[i].selected = false;
|
||||
}
|
||||
$('#sortNameFromElement').click();
|
||||
$('#sortNameToElement').click();
|
||||
};
|
||||
|
||||
//A jobb oldali tanuló listát frissíti
|
||||
kretaOsztalybaSorolasHelper.replaceToTanuloList = function (data) {
|
||||
$('#multiselect_to').find('option').remove().end();
|
||||
$('#ToElementsCount').text('0');
|
||||
|
||||
if (data.length) {
|
||||
$.each(data, function (key, value) {
|
||||
var $option = $('<option disabled></option>')
|
||||
.attr('value', data[key].Value)
|
||||
.attr('fromId', $('#FromDDL').val())
|
||||
.attr('szulDatum', data[key].SzulDatum)
|
||||
.attr('neme', data[key].Neme)
|
||||
.attr('nevElotagNelkul', data[key].NevElotagNelkul)
|
||||
.attr('jogviszonyCount', data[key].JogviszonyCount)
|
||||
.attr('jogviszonyId', '0')
|
||||
.text(data[key].Text);
|
||||
var oldText;
|
||||
var date;
|
||||
if (!data[key].Aktiv) {
|
||||
$option.css({ background: '#C5D3E2', color: '#828EB2' });
|
||||
|
||||
if (data[key].KisorolasDatum != null) {
|
||||
oldText = $option.text();
|
||||
date = new Date(data[key].KisorolasDatum);
|
||||
$option.text(
|
||||
oldText + ' Kisorolva: ' + date.toLocaleDateString('hu-HU')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (data[key].BesorolasDatum != null) {
|
||||
oldText = $option.text();
|
||||
date = new Date(data[key].BesorolasDatum);
|
||||
$option.text(
|
||||
oldText + ' Besorolva: ' + date.toLocaleDateString('hu-HU')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$('#multiselect_to').append($option);
|
||||
});
|
||||
|
||||
$('#multiselect_to').unbind();
|
||||
$('#multiselect_to option').unbind();
|
||||
//KretaOsztalybaSorolasHelper.setMultiClickOption("SorolasForm");
|
||||
$('#ToElementsCountIn').text($('#multiselect_to option').length);
|
||||
|
||||
setTimeout(function () {
|
||||
$('#multiselect_to').click(function () {
|
||||
$('#ToElementsCount').text($('#multiselect_to :selected').length);
|
||||
});
|
||||
}, 1);
|
||||
|
||||
if (KretaOsztalybaSorolasHelper.msieversion()) {
|
||||
$('#multiselect_to option')
|
||||
.mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var select = this;
|
||||
var scroll = select.scrollTop;
|
||||
|
||||
e.target.selected = !e.target.selected;
|
||||
|
||||
setTimeout(function () {
|
||||
select.scrollTop = scroll;
|
||||
}, 0);
|
||||
|
||||
$('#multiselect_to').focus();
|
||||
})
|
||||
.mousemove(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
} else {
|
||||
$('#multiselect_to')
|
||||
.mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var select = this;
|
||||
var scroll = select.scrollTop;
|
||||
|
||||
e.target.selected = !e.target.selected;
|
||||
|
||||
setTimeout(function () {
|
||||
select.scrollTop = scroll;
|
||||
}, 0);
|
||||
|
||||
$('#multiselect_to').focus();
|
||||
})
|
||||
.mousemove(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftFrom();
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftTo();
|
||||
};
|
||||
|
||||
//A bal oldali tanuló listát frissíti
|
||||
kretaOsztalybaSorolasHelper.replaceFromTanuloList = function (data) {
|
||||
let selectedOptions = $('#multiselect')
|
||||
.find('option:selected')
|
||||
.toArray()
|
||||
.map((i) => i.value);
|
||||
|
||||
$('#multiselect').find('option').remove().end();
|
||||
$('#FromElementsCount').text('0');
|
||||
|
||||
if (data.length) {
|
||||
$.each(data, function (key, value) {
|
||||
var $option = $('<option></option>')
|
||||
.attr('value', data[key].Value)
|
||||
.attr('fromId', $('#FromDDL').val())
|
||||
.attr('szulDatum', data[key].SzulDatum)
|
||||
.attr('neme', data[key].Neme)
|
||||
.attr('nevElotagNelkul', data[key].NevElotagNelkul)
|
||||
.attr('jogviszonyCount', data[key].JogviszonyCount)
|
||||
.attr('jogviszonyId', '0')
|
||||
.text(data[key].Text);
|
||||
var oldText;
|
||||
var date;
|
||||
if (!data[key].Aktiv) {
|
||||
$option.attr('disabled', 'disabled');
|
||||
$option.css({ background: '#C5D3E2', color: '#828EB2' });
|
||||
|
||||
if (data[key].KisorolasDatum != null) {
|
||||
oldText = $option.text();
|
||||
date = new Date(data[key].KisorolasDatum);
|
||||
$option.text(
|
||||
oldText + ' Kisorolva: ' + date.toLocaleDateString('hu-HU')
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (data[key].KisorolasDatum != null) {
|
||||
oldText = $option.text();
|
||||
date = new Date(data[key].KisorolasDatum);
|
||||
$option.text(
|
||||
oldText + ' Kisorolva: ' + date.toLocaleDateString('hu-HU')
|
||||
);
|
||||
}
|
||||
|
||||
if (data[key].BesorolasDatum != null) {
|
||||
oldText = $option.text();
|
||||
date = new Date(data[key].BesorolasDatum);
|
||||
$option.text(
|
||||
oldText + ' Besorolva: ' + date.toLocaleDateString('hu-HU')
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof getNincsRogzitettAtiratkozasiZaradek === 'function') {
|
||||
$option.attr(
|
||||
'class',
|
||||
data[key].Vegzaradek != null ? 'green' : 'red'
|
||||
);
|
||||
$option.attr(
|
||||
'data-fa-icon',
|
||||
data[key].Vegzaradek != null ? '\uf00c' : '\uf00d'
|
||||
);
|
||||
$option.attr(
|
||||
'title',
|
||||
data[key].Vegzaradek != null
|
||||
? data[key].Vegzaradek
|
||||
: KretaOsztalybaSorolasHelper.NincsRogzitettAtiratkozasiZaradek()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$('#multiselect').append($option);
|
||||
});
|
||||
|
||||
$('#multiselect').unbind();
|
||||
$('#multiselect option').unbind();
|
||||
KretaOsztalybaSorolasHelper.setMultiClickOption('SorolasForm');
|
||||
$('#FromElementsCountIn').text($('#multiselect option').length);
|
||||
|
||||
setTimeout(function () {
|
||||
$('#multiselect').click(function () {
|
||||
$('#FromElementsCount').text($('#multiselect :selected').length);
|
||||
});
|
||||
}, 1);
|
||||
|
||||
if (KretaOsztalybaSorolasHelper.msieversion()) {
|
||||
$('#multiselect option')
|
||||
.mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var select = this;
|
||||
var scroll = select.scrollTop;
|
||||
|
||||
e.target.selected = !e.target.selected;
|
||||
|
||||
setTimeout(function () {
|
||||
select.scrollTop = scroll;
|
||||
}, 0);
|
||||
|
||||
$('#multiselect').focus();
|
||||
})
|
||||
.mousemove(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
} else {
|
||||
$('#multiselect')
|
||||
.mousedown(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var select = this;
|
||||
var scroll = select.scrollTop;
|
||||
|
||||
e.target.selected = !e.target.selected;
|
||||
|
||||
setTimeout(function () {
|
||||
select.scrollTop = scroll;
|
||||
}, 0);
|
||||
|
||||
$('#multiselect').focus();
|
||||
})
|
||||
.mousemove(function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftFrom();
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftTo();
|
||||
|
||||
$('#multiselect')
|
||||
.find('option')
|
||||
.toArray()
|
||||
.filter((i) => selectedOptions.includes(i.value))
|
||||
.forEach((i) => (i.selected = true));
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftFrom = function () {
|
||||
var fromOptionSelector = '#multiselect option';
|
||||
var lastOptionFrom = null;
|
||||
|
||||
// Többes kiválasztás
|
||||
$(fromOptionSelector).on('click', function (e) {
|
||||
if (!lastOptionFrom) {
|
||||
lastOptionFrom = this;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.shiftKey) {
|
||||
var from = $(fromOptionSelector).index(this);
|
||||
var to = $(fromOptionSelector).index(lastOptionFrom);
|
||||
|
||||
var start = Math.min(from, to);
|
||||
var end = Math.max(from, to) + 1;
|
||||
|
||||
$(fromOptionSelector)
|
||||
.slice(start, end)
|
||||
.filter(':not(:disabled)')
|
||||
.prop('selected', lastOptionFrom.selected);
|
||||
}
|
||||
|
||||
lastOptionFrom = this;
|
||||
});
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.multiselectWithShiftTo = function () {
|
||||
var toOptionSelector = '#multiselect_to option';
|
||||
var lastOptionTo = null;
|
||||
|
||||
// Többes kiválasztás
|
||||
$(toOptionSelector).on('click', function (e) {
|
||||
if (!lastOptionTo) {
|
||||
lastOptionTo = this;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.shiftKey) {
|
||||
var from = $(toOptionSelector).index(this);
|
||||
var to = $(toOptionSelector).index(lastOptionTo);
|
||||
|
||||
var start = Math.min(from, to);
|
||||
var end = Math.max(from, to) + 1;
|
||||
|
||||
$(toOptionSelector)
|
||||
.slice(start, end)
|
||||
.filter(':not(:disabled)')
|
||||
.prop('selected', lastOptionTo.selected);
|
||||
}
|
||||
|
||||
lastOptionTo = this;
|
||||
});
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.setMultiClickOption = function (formName) {
|
||||
if (KretaOsztalybaSorolasHelper.msieversion()) {
|
||||
window.selectedIEOptions = {};
|
||||
$('#multiselect').click(function (e) {
|
||||
var $this = $(this),
|
||||
options = this.options,
|
||||
option,
|
||||
value,
|
||||
n;
|
||||
|
||||
value = $this.val();
|
||||
|
||||
for (n = 0; n < options.length; ++n) {
|
||||
option = options[n];
|
||||
if (option.value == value) {
|
||||
window.selectedIEOptions[value] = !window.selectedIEOptions[value];
|
||||
}
|
||||
option.selected = !!window.selectedIEOptions[option.value];
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
window.selectedToIEOptions = {};
|
||||
$('#multiselect_to').click(function (e) {
|
||||
var $this = $(this),
|
||||
options = this.options,
|
||||
option,
|
||||
value,
|
||||
n;
|
||||
|
||||
value = $this.val();
|
||||
|
||||
for (n = 0; n < options.length; ++n) {
|
||||
option = options[n];
|
||||
if (option.value == value) {
|
||||
window.selectedToIEOptions[value] =
|
||||
!window.selectedToIEOptions[value];
|
||||
}
|
||||
option.selected = !!window.selectedToIEOptions[option.value];
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.msieversion = function () {
|
||||
var ua = window.navigator.userAgent;
|
||||
var msie = ua.indexOf('MSIE ');
|
||||
|
||||
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.sizeListSelect = function ($selectObject) {
|
||||
if (!(typeof $selectObject[0].options === 'undefined')) {
|
||||
var opts = $selectObject[0].options.length;
|
||||
opts = opts > 18 ? opts : 18;
|
||||
$selectObject[0].size = opts;
|
||||
$selectObject.parent('.selectBoxDiv').height($selectObject.height());
|
||||
$selectObject.parent('.selectBoxDiv').height(400);
|
||||
}
|
||||
};
|
||||
|
||||
//Engedélyezi vagy letiltja a multiselect button-öket
|
||||
kretaOsztalybaSorolasHelper.setMultiselectButton = function (dropdownName) {
|
||||
$('#' + dropdownName).change(function () {
|
||||
if (
|
||||
$('#' + dropdownName)
|
||||
.data('kendoComboBox')
|
||||
.value() != ''
|
||||
) {
|
||||
$('#multiselect_rightAll').prop('disabled', false);
|
||||
$('#multiselect_rightSelected').prop('disabled', false);
|
||||
$('#multiselect_leftAll').prop('disabled', false);
|
||||
$('#multiselect_leftSelected').prop('disabled', false);
|
||||
} else {
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//Beállítja az aktuális napot
|
||||
kretaOsztalybaSorolasHelper.today = function () {
|
||||
var todayDate = kendo.toString(kendo.parseDate(new Date()));
|
||||
var minDate = $('#Datum').data('kendoDatePicker').min();
|
||||
var maxDate = $('#Datum').data('kendoDatePicker').max();
|
||||
|
||||
if (
|
||||
!KretaOsztalybaSorolasHelper.dateCheck(
|
||||
new Date(minDate),
|
||||
new Date(maxDate),
|
||||
new Date()
|
||||
)
|
||||
) {
|
||||
KretaWindowHelper.warningWindow(
|
||||
Globalization.Figyelem,
|
||||
'A mai dátum nem esik bele az aktuális tanév kezdő és záró dátuma közé!',
|
||||
undefined,
|
||||
'todayWarrning'
|
||||
);
|
||||
}
|
||||
|
||||
$('#Datum').data('kendoDatePicker').value(todayDate);
|
||||
$('#Datum').focus().focusout();
|
||||
$('#Datum').data('kendoDatePicker').trigger('change');
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.dateCheck = function (from, to, check) {
|
||||
var fDate, lDate, cDate;
|
||||
|
||||
fDate = Date.parse(from);
|
||||
lDate = Date.parse(to);
|
||||
cDate = Date.parse(check);
|
||||
|
||||
if (cDate <= lDate && cDate >= fDate) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
//Törli egy select összes option-jét
|
||||
kretaOsztalybaSorolasHelper.removeOptions = function (selectName) {
|
||||
$('#' + selectName)
|
||||
.find('option')
|
||||
.remove()
|
||||
.end();
|
||||
};
|
||||
|
||||
//Ellenőrzés, hogy lehet -e engedélyezni a multiselect button-öket
|
||||
kretaOsztalybaSorolasHelper.checkData = function (
|
||||
fromDDL,
|
||||
toDDL,
|
||||
isKovTanev
|
||||
) {
|
||||
var fromValue = $('#' + fromDDL)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
var toValue = $('#' + toDDL)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
var toDatasource = $('#' + toDDL).data('kendoComboBox').dataSource;
|
||||
var FilterId = 0;
|
||||
//Összes osztályra vonatkozó feltétel
|
||||
if (fromValue == -1) {
|
||||
$.each(toDatasource.data(), function (i, v) {
|
||||
if (v.Value == toValue) {
|
||||
FilterId = v.FilterId;
|
||||
}
|
||||
});
|
||||
if (FilterId != null) {
|
||||
$('#multiSelectErrorMsg').text(
|
||||
'Az összes osztály listából osztálybontott csoportba nem lehet sorolni!'
|
||||
);
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
} else {
|
||||
$('#multiSelectErrorMsg').text('');
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', false);
|
||||
$('#multiselect_rightSelected').prop('disabled', false);
|
||||
$('#multiselect_leftAll').prop('disabled', false);
|
||||
$('#multiselect_leftSelected').prop('disabled', false);
|
||||
}
|
||||
} else {
|
||||
$.each(toDatasource.data(), function (i, v) {
|
||||
if (v.Value == toValue) {
|
||||
FilterId = v.FilterId;
|
||||
}
|
||||
});
|
||||
|
||||
if (
|
||||
fromValue != FilterId &&
|
||||
FilterId != null &&
|
||||
(CommonUtils.isNullOrUndefined(isKovTanev) || isKovTanev == false)
|
||||
) {
|
||||
$('#multiSelectErrorMsg').text(
|
||||
Globalization.OsztalybontottCsoportOsztalyNemEgyezik
|
||||
);
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
} else {
|
||||
$('#multiSelectErrorMsg').text('');
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', false);
|
||||
$('#multiselect_rightSelected').prop('disabled', false);
|
||||
$('#multiselect_leftAll').prop('disabled', false);
|
||||
$('#multiselect_leftSelected').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
if (fromValue == '' || toValue == '') {
|
||||
$('#multiSelectErrorMsg').text('');
|
||||
}
|
||||
};
|
||||
|
||||
//Ellenőrzés, hogy lehet -e engedélyezni a multiselect button-öket csoportok esetében
|
||||
kretaOsztalybaSorolasHelper.checkCsoportData = function (fromDDL, toDDL) {
|
||||
var fromValue = $('#' + fromDDL)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
var toValue = $('#' + toDDL)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
var fromDatasource = $('#' + fromDDL).data('kendoComboBox').dataSource;
|
||||
var toDatasource = $('#' + toDDL).data('kendoComboBox').dataSource;
|
||||
|
||||
var FromFilterId = 0;
|
||||
var ToFilterId = 0;
|
||||
|
||||
$.each(fromDatasource.data(), function (i, v) {
|
||||
if (v.Value == fromValue) {
|
||||
FromFilterId = v.FilterId;
|
||||
}
|
||||
});
|
||||
$.each(toDatasource.data(), function (i, v) {
|
||||
if (v.Value == toValue) {
|
||||
ToFilterId = v.FilterId;
|
||||
}
|
||||
});
|
||||
|
||||
if (ToFilterId != null && FromFilterId != ToFilterId) {
|
||||
$('#multiSelectErrorMsg').text(
|
||||
Globalization.OsztalybontottCsoportOsztalyNemEgyezik
|
||||
);
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
} else {
|
||||
$('#multiSelectErrorMsg').text('');
|
||||
|
||||
$('#multiselect_rightAll').prop('disabled', false);
|
||||
$('#multiselect_rightSelected').prop('disabled', false);
|
||||
$('#multiselect_leftAll').prop('disabled', false);
|
||||
$('#multiselect_leftSelected').prop('disabled', false);
|
||||
}
|
||||
|
||||
if (fromValue == '' || toValue == '') {
|
||||
$('#multiSelectErrorMsg').text('');
|
||||
}
|
||||
};
|
||||
|
||||
//Összeállítja az elküldendő json object-et
|
||||
kretaOsztalybaSorolasHelper.createJson = function (formName) {
|
||||
var array = new Array();
|
||||
$.each($('#multiselect_to option'), function (key, value) {
|
||||
if (!$(this).attr('disabled')) {
|
||||
array.push({
|
||||
Id: value.value,
|
||||
fromid: $(value).attr('fromid'),
|
||||
jogviszonycount: $(value).attr('jogviszonycount'),
|
||||
jogviszonyids: $(value).attr('jogviszonyid'),
|
||||
isVanMentettVegzaradek: !CommonUtils.isNullOrUndefined(
|
||||
$(value).attr('class')
|
||||
)
|
||||
? $(value).attr('class').indexOf('green') !== -1
|
||||
: 'false'
|
||||
});
|
||||
}
|
||||
});
|
||||
var json = $('#' + formName).toObject();
|
||||
json.ToElements = array;
|
||||
if (!CommonUtils.isNullOrUndefined($('#SorolasZaradek').html())) {
|
||||
var zaradekData = $('#SorolasZaradek').toObject();
|
||||
if (!CommonUtils.isNullOrUndefined($('#TanuloCsoportId').val())) {
|
||||
zaradekData.TanuloCsoportId = $('#TanuloCsoportId').val();
|
||||
}
|
||||
zaradekData.ZaradekSzovegList = getZaradekSzovegList();
|
||||
json.Zaradek = zaradekData;
|
||||
} else {
|
||||
json.Zaradek = null;
|
||||
}
|
||||
return json;
|
||||
};
|
||||
|
||||
//Újratölti egy combobox értékkészletét
|
||||
kretaOsztalybaSorolasHelper.reloadDDL = function (DDL_Name) {
|
||||
$('#' + DDL_Name)
|
||||
.data('kendoComboBox')
|
||||
.trigger('change');
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.checkPrePost = function (inputName) {
|
||||
var val = $('#' + inputName)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
var txt = $('#' + inputName)
|
||||
.data('kendoComboBox')
|
||||
.text();
|
||||
|
||||
if ($.isNumeric(val) && val != txt) {
|
||||
$('#FromDDL, #ToDDL').change();
|
||||
return true;
|
||||
} else {
|
||||
$('#' + inputName)
|
||||
.data('kendoComboBox')
|
||||
.value('');
|
||||
$('#' + inputName)
|
||||
.data('kendoComboBox')
|
||||
.trigger('change');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.afterSaveReloadDDL = function () {
|
||||
$('#multiselect > option').remove().end();
|
||||
$('#multiselect_to > option').remove().end();
|
||||
var toDDL = $('#ToDDL').data('kendoComboBox');
|
||||
toDDL.value('');
|
||||
var fromDDl = $('#FromDDL').data('kendoComboBox');
|
||||
fromDDl.value('');
|
||||
|
||||
$('#ToElementsCount').text(0);
|
||||
$('#ToElementsCountIn').text(0);
|
||||
$('#FromElementsCount').text(0);
|
||||
$('#FromElementsCountIn').text($('#multiselect > option').length);
|
||||
window.oldComboBoxValue = '';
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined($('#JogvMegszuneseJogcimTipusId')) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#JogvMegszuneseJogcimTipusId').data('kendoComboBox')
|
||||
)
|
||||
) {
|
||||
var JogvMegszuneseJogcimTipusIdDDl = $(
|
||||
'#JogvMegszuneseJogcimTipusId'
|
||||
).data('kendoComboBox');
|
||||
JogvMegszuneseJogcimTipusIdDDl.value('');
|
||||
}
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined($('#JogviszonyVege')) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#JogviszonyVege').data('kendoDatePicker')
|
||||
)
|
||||
) {
|
||||
$('#JogviszonyVege').data('kendoDatePicker').value('');
|
||||
}
|
||||
if (!CommonUtils.isNullOrUndefined($('.SorolasTbJogviszonyPartial'))) {
|
||||
$('.SorolasTbJogviszonyPartial').empty();
|
||||
}
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.afterErrorReloadDDL = function () {
|
||||
var fromDDl = $('#FromDDL').data('kendoComboBox');
|
||||
fromDDl.trigger('change');
|
||||
var toDDL = $('#ToDDL').data('kendoComboBox');
|
||||
toDDL.trigger('change');
|
||||
|
||||
$('#FromElementsCountIn').text($('#multiselect > option').length);
|
||||
window.oldComboBoxValue = '';
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.resetForm = function (fromDDL, toDDL) {
|
||||
// bal oldal
|
||||
$('#' + fromDDL)
|
||||
.data('kendoComboBox')
|
||||
.value('');
|
||||
$('#multiselect > option').remove().end();
|
||||
$('#FromElementsCount').text('0');
|
||||
|
||||
//jobb oldal
|
||||
$('#' + toDDL)
|
||||
.data('kendoComboBox')
|
||||
.value('');
|
||||
$('#multiselect_to > option').remove().end();
|
||||
$('#ToElementsCount').text('0');
|
||||
|
||||
//záradék
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#ZaradekAdatszotar').data('kendoComboBox')
|
||||
)
|
||||
) {
|
||||
$('#ZaradekAdatszotar').data('kendoComboBox').value('');
|
||||
}
|
||||
$('[id^=ZaradekSzovegTextArea_]').val('');
|
||||
$('#IsBizonyitvanybanMegjelenik').prop('checked', false);
|
||||
$('#IsTorzslaponMegjelenik').prop('checked', false);
|
||||
$('#IsOsztalynaplobanMegjelenik').prop('checked', false);
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.NincsRogzitettAtiratkozasiZaradek = function () {
|
||||
return getNincsRogzitettAtiratkozasiZaradek();
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.LoadJogviszonyGrid = function () {
|
||||
$.each($('#multiselect_to option'), function (key, value) {
|
||||
if (!$(this).attr('disabled')) {
|
||||
$(value).attr('jogviszonyid', '0');
|
||||
}
|
||||
});
|
||||
if (typeof loadJogviszonyPartialGrid === 'function') {
|
||||
loadJogviszonyPartialGrid();
|
||||
}
|
||||
};
|
||||
|
||||
kretaOsztalybaSorolasHelper.disableMultiselectButtons = function () {
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
};
|
||||
|
||||
function getZaradekSzovegList() {
|
||||
var zaradekSzovegList = [];
|
||||
var zaradekSzovegQuery = $("textarea[name^='ZaradekSzovegTextArea_']");
|
||||
zaradekSzovegQuery.each(function (index, value) {
|
||||
var zaradekSzovegTextArea = $(value);
|
||||
var szoveg = zaradekSzovegTextArea.val();
|
||||
var nyelvId = zaradekSzovegTextArea.data('nyelv-id');
|
||||
zaradekSzovegList[index] = {
|
||||
NyelvId: nyelvId,
|
||||
Szoveg: szoveg
|
||||
};
|
||||
});
|
||||
return zaradekSzovegList;
|
||||
}
|
||||
|
||||
return kretaOsztalybaSorolasHelper;
|
||||
})();
|
19
KretaWeb/Scripts/KendoHelper/KretaPanelBarHelper.js
Normal file
19
KretaWeb/Scripts/KendoHelper/KretaPanelBarHelper.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
var KretaPanelBarHelper = (function () {
|
||||
var kretaPanelBarHelper = function () {};
|
||||
|
||||
kretaPanelBarHelper.getKendoPanelBarData = function (id) {
|
||||
var panelBar = $('#' + id);
|
||||
var panelBarData = panelBar.data('kendoPanelBar');
|
||||
return panelBarData;
|
||||
};
|
||||
|
||||
kretaPanelBarHelper.getPanelBarItem = function (panelBarId, panelBarItemId) {
|
||||
var panelBar = kretaPanelBarHelper.getKendoPanelBarData(panelBarId);
|
||||
var panelBarItem = panelBar.element
|
||||
.children('#' + panelBarItemId)
|
||||
.children('div');
|
||||
return panelBarItem;
|
||||
};
|
||||
|
||||
return kretaPanelBarHelper;
|
||||
})();
|
12
KretaWeb/Scripts/KendoHelper/KretaRadioButtonListHelper.js
Normal file
12
KretaWeb/Scripts/KendoHelper/KretaRadioButtonListHelper.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
var KretaRadioButtonListHelper = (function () {
|
||||
var kretaRadioButtonListHelper = function () {};
|
||||
|
||||
kretaRadioButtonListHelper.getSelectedValue = function (radioButtonListId) {
|
||||
var result = $(
|
||||
"input:radio[name='" + radioButtonListId + "']:checked"
|
||||
).val();
|
||||
return result;
|
||||
};
|
||||
|
||||
return kretaRadioButtonListHelper;
|
||||
})();
|
25
KretaWeb/Scripts/KendoHelper/KretaSwitchButtonHelper.js
Normal file
25
KretaWeb/Scripts/KendoHelper/KretaSwitchButtonHelper.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*Kreta switch button helper
|
||||
Ez a function állítja a kreate switch button mogotti bindolt checkboxot.
|
||||
*/
|
||||
var SwitchButtonHelper = (function () {
|
||||
var switchButtonHelper = function () {};
|
||||
|
||||
switchButtonHelper.switchButtonChange = function switchButtonChange(
|
||||
fieldnameId,
|
||||
hiddenNameId
|
||||
) {
|
||||
if ($('#' + fieldnameId).prop('disabled') == true) {
|
||||
return;
|
||||
}
|
||||
if ($('#' + fieldnameId).is(':checked')) {
|
||||
$('#' + fieldnameId).prop('checked', false);
|
||||
$('#' + fieldnameId).val(false);
|
||||
$('#' + hiddenNameId).val(false);
|
||||
} else {
|
||||
$('#' + fieldnameId).prop('checked', true);
|
||||
$('#' + fieldnameId).val(true);
|
||||
$('#' + hiddenNameId).val(true);
|
||||
}
|
||||
};
|
||||
return switchButtonHelper;
|
||||
})();
|
76
KretaWeb/Scripts/KendoHelper/KretaTooltipHelper.js
Normal file
76
KretaWeb/Scripts/KendoHelper/KretaTooltipHelper.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
var KretaTooltipHelper = (function () {
|
||||
var kretaTooltipHelper = function () {};
|
||||
|
||||
kretaTooltipHelper.setTooltip = function (
|
||||
tooltipElement,
|
||||
tooltipTemplateSelector
|
||||
) {
|
||||
tooltipElement.kendoTooltip({
|
||||
content: kendo.template($(tooltipTemplateSelector).html()),
|
||||
position: 'top',
|
||||
show: function () {
|
||||
var that = this;
|
||||
var tooltips = $('[data-role=tooltip]');
|
||||
|
||||
tooltips.each(function () {
|
||||
var tooltip = $(this).data('kendoTooltip');
|
||||
if (tooltip && tooltip !== that) {
|
||||
tooltip.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
kretaTooltipHelper.setGridCellTooltip = function (
|
||||
tooltipElement,
|
||||
tooltipTemplateSelector
|
||||
) {
|
||||
tooltipElement.kendoTooltip({
|
||||
content: kendo.template($(tooltipTemplateSelector).html()),
|
||||
filter: 'span',
|
||||
position: 'bottom',
|
||||
show: function (e) {
|
||||
var rect = e.sender.element[0].getBoundingClientRect();
|
||||
var left = rect.left;
|
||||
var top = rect.top;
|
||||
var height = rect.height;
|
||||
var animationContainer = e.sender.popup.element.parent()[0];
|
||||
|
||||
var width = window.innerWidth;
|
||||
var toolTipMaxWidth = 600;
|
||||
|
||||
if (parseInt(left + toolTipMaxWidth, 10) > width) {
|
||||
toolTipMaxWidth = parseInt(width - left, 10);
|
||||
}
|
||||
|
||||
animationContainer.style.top = parseInt(top + height, 10) + 'px';
|
||||
animationContainer.style.left = parseInt(left, 10) + 'px';
|
||||
animationContainer.style.maxWidth = toolTipMaxWidth + 'px';
|
||||
|
||||
var that = this;
|
||||
var tooltips = $('[data-role=tooltip]');
|
||||
|
||||
tooltips.each(function () {
|
||||
var tooltip = $(this).data('kendoTooltip');
|
||||
if (tooltip && tooltip !== that) {
|
||||
tooltip.hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
showAfter: 300
|
||||
});
|
||||
};
|
||||
|
||||
kretaTooltipHelper.hidaAllTooltips = function () {
|
||||
var tooltips = $('[data-role=tooltip]');
|
||||
tooltips.each(function () {
|
||||
var tooltip = $(this).data('kendoTooltip');
|
||||
if (tooltip) {
|
||||
tooltip.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return kretaTooltipHelper;
|
||||
})();
|
776
KretaWeb/Scripts/KendoHelper/KretaWindowHelper.js
Normal file
776
KretaWeb/Scripts/KendoHelper/KretaWindowHelper.js
Normal file
|
@ -0,0 +1,776 @@
|
|||
var KretaWindowHelper = (function () {
|
||||
var kretaWindowHelper = function () {};
|
||||
|
||||
var MIN_HEIGHT = 125;
|
||||
var MIN_WIDTH = 320;
|
||||
|
||||
kretaWindowHelper.getWindowConfigContainer = function () {
|
||||
return {
|
||||
actions: null,
|
||||
content: null,
|
||||
resizable: false,
|
||||
closeFunction: null,
|
||||
width: '90%',
|
||||
height: '90%',
|
||||
maxWidth: null,
|
||||
maxHeight: null,
|
||||
minWidth: MIN_WIDTH + 'px',
|
||||
minHeight: MIN_HEIGHT + 'px',
|
||||
title: ''
|
||||
};
|
||||
};
|
||||
|
||||
kretaWindowHelper.createWindow = function (id, config) {
|
||||
var element = getOrCreateWindowElement(id);
|
||||
var position = getPosition();
|
||||
var modal = element.data('kendoWindow');
|
||||
|
||||
if (!modal) {
|
||||
modal = createModal(element, position, config);
|
||||
} else {
|
||||
modal.setOptions({ position: position });
|
||||
}
|
||||
return modal;
|
||||
};
|
||||
|
||||
kretaWindowHelper.confirmWindow = function (
|
||||
title,
|
||||
content,
|
||||
jsFunction,
|
||||
jsFunctionParameter,
|
||||
jsFunctionClose,
|
||||
okString,
|
||||
closeString,
|
||||
isNestedConfirm,
|
||||
showCloseButton,
|
||||
isNote,
|
||||
isNoteRequired,
|
||||
noteCaption,
|
||||
width,
|
||||
height
|
||||
) {
|
||||
var wind = $('#KretaGeneratedConfrimWindowNest').data('kendoWindow');
|
||||
if (wind != undefined) {
|
||||
wind.destroy();
|
||||
}
|
||||
var confirmWindowId = 'KretaGeneratedConfrimWindow';
|
||||
if (isNestedConfirm) {
|
||||
confirmWindowId += 'Nest';
|
||||
}
|
||||
if ($('#' + confirmWindowId).length > 0) {
|
||||
return false;
|
||||
}
|
||||
var actions = [];
|
||||
if (showCloseButton) {
|
||||
actions = ['Close'];
|
||||
}
|
||||
var kendoWindow = $('<div id ="' + confirmWindowId + '" />').kendoWindow({
|
||||
title: title,
|
||||
actions: actions,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(height)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: height
|
||||
});
|
||||
}
|
||||
if (!CommonUtils.isNullOrUndefined(width)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
width: width
|
||||
});
|
||||
}
|
||||
|
||||
var okBtnMsg = Globalization.Igen,
|
||||
closeBtnMsg = Globalization.Nem;
|
||||
if (typeof okString !== 'undefined') {
|
||||
okBtnMsg = okString;
|
||||
}
|
||||
if (typeof closeString !== 'undefined') {
|
||||
closeBtnMsg = closeString;
|
||||
}
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer" id="' +
|
||||
confirmWindowId +
|
||||
'"><div class="modalOuter"><div class="modalContent"><div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;"><span><i class="fa fa-info confirmWindowIcon"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>';
|
||||
|
||||
if (isNote) {
|
||||
data += "<div class='modalConfirmNote'>";
|
||||
data +=
|
||||
"<div class='noteCaption'>" +
|
||||
noteCaption +
|
||||
"</div><input class='k-textbox' type='text' id='modalNote' /> <div class='noteValidation'>" +
|
||||
Globalization.KotelezoMegadni +
|
||||
'</div>';
|
||||
data += '</div>';
|
||||
}
|
||||
|
||||
data +=
|
||||
'<div class="modalFooter modalFooterStatic"><div style="float:right; padding-left: 5px;">';
|
||||
data +=
|
||||
'<div class="k-button k-button-icontext closeYesConfirm" style="padding: 10px 14px;"><span></span>' +
|
||||
okBtnMsg +
|
||||
'</div>';
|
||||
data +=
|
||||
' <div class="k-button k-button-icontext closeNoConfirm" style="padding: 10px 14px;"><span></span>' +
|
||||
closeBtnMsg +
|
||||
'</div>';
|
||||
data += '</div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeNoConfirm')
|
||||
.click(function () {
|
||||
if (CommonUtils.isFunction(jsFunctionClose)) {
|
||||
jsFunctionClose();
|
||||
}
|
||||
var wind = kendoWindow.data('kendoWindow');
|
||||
if (wind != undefined) {
|
||||
wind.destroy();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeYesConfirm')
|
||||
.click(function () {
|
||||
if (isNote) {
|
||||
var note = $('#modalNote').val();
|
||||
if (isNoteRequired && CommonUtils.isNullOrWhiteSpace(note)) {
|
||||
$('#modalNote').addClass('required');
|
||||
$('div.noteValidation').addClass('noteRequired');
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommonUtils.parseBool(isNestedConfirm)) {
|
||||
jsFunction(jsFunctionParameter, note);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
jsFunction(jsFunctionParameter, note);
|
||||
}, 1);
|
||||
}
|
||||
} else if (CommonUtils.isFunction(jsFunction)) {
|
||||
if (CommonUtils.parseBool(isNestedConfirm)) {
|
||||
jsFunction(jsFunctionParameter);
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
jsFunction(jsFunctionParameter);
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
var wind = kendoWindow.data('kendoWindow');
|
||||
if (wind != undefined) {
|
||||
wind.destroy();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.errorHandlerWindow = function (
|
||||
title,
|
||||
content,
|
||||
closejsFunction,
|
||||
reportErrorJsFunction,
|
||||
name
|
||||
) {
|
||||
var element;
|
||||
if (!CommonUtils.isUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer"><div class="modalOuter"><div class="modalContent"><div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;"><span><i class="fa fa-exclamation feedBackWindowIconError"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>' +
|
||||
'<div class="modalFooter modalFooterStatic">' +
|
||||
'<div style="float:left; padding-right: 5px;"><a class="k-button k-button-icontext reportError" href="javascript:void(null)">' +
|
||||
Globalization.Hibabejelentese +
|
||||
'</a></div>' +
|
||||
'<div style="float:right; padding-left: 5px;"><a class="k-button k-button-icontext closeFeedback" href="javascript:void(null)">' +
|
||||
Globalization.Vissza +
|
||||
'</a></div>' +
|
||||
'</div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.reportError')
|
||||
.click(function () {
|
||||
if (CommonUtils.isFunction(reportErrorJsFunction)) {
|
||||
reportErrorJsFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(closejsFunction)) {
|
||||
closejsFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.feedbackWindow = function (
|
||||
title,
|
||||
content,
|
||||
isError,
|
||||
jsFunction,
|
||||
backButtonText,
|
||||
name,
|
||||
newHeight,
|
||||
closeButtonId
|
||||
) {
|
||||
var element;
|
||||
if (!CommonUtils.isNullOrUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(newHeight)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: newHeight
|
||||
});
|
||||
}
|
||||
|
||||
var closeId = CommonUtils.isNullOrUndefined(closeButtonId)
|
||||
? ''
|
||||
: ' id ="' + closeButtonId + '"';
|
||||
var backText = CommonUtils.isNullOrUndefined(backButtonText)
|
||||
? Globalization.Vissza
|
||||
: backButtonText;
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer">' +
|
||||
'<div class="modalOuter">' +
|
||||
'<div class="modalContent">' +
|
||||
'<div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;">' +
|
||||
'<span><i class="fa ' +
|
||||
(isError == true
|
||||
? 'fa-exclamation feedBackWindowIconError'
|
||||
: 'fa-check feedBackWindowIconSuccess') +
|
||||
'"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>' +
|
||||
'<div class="modalFooter modalFooterStatic">' +
|
||||
'<div style="float:right; padding-left: 5px;"><a class="k-button k-button-icontext closeFeedback" href="javascript:void(null)"' +
|
||||
closeId +
|
||||
'>' +
|
||||
backText +
|
||||
'</a></div></div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(jsFunction)) {
|
||||
jsFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.feedbackWindowWithLink = function (
|
||||
title,
|
||||
content,
|
||||
linkText,
|
||||
linkUrl,
|
||||
isError,
|
||||
jsFunction,
|
||||
backButtonText,
|
||||
name,
|
||||
newHeight
|
||||
) {
|
||||
var element;
|
||||
if (!CommonUtils.isUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(newHeight)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: newHeight
|
||||
});
|
||||
}
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer"><div class="modalOuter"><div class="modalContent"><div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;"><span><i class="fa ' +
|
||||
(isError == true
|
||||
? 'fa-exclamation feedBackWindowIconError'
|
||||
: 'fa-check feedBackWindowIconSuccess') +
|
||||
'"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>';
|
||||
data +=
|
||||
'<div class="modalFooter modalFooterStatic" style="height: 64px;"><div style="float:right; padding-left: 5px;">';
|
||||
data +=
|
||||
'<div class="BtnCancel" style="float: right; padding-right: 5px;"><a class="k-button k-button-icontext closeFeedback" href="javascript:void(null)">' +
|
||||
(CommonUtils.isUndefined(backButtonText)
|
||||
? Globalization.Vissza
|
||||
: backButtonText) +
|
||||
'</a></div>';
|
||||
data +=
|
||||
'<div class="BtnOk" style="float: right;"><a class="k-button k-button-icontext" href="' +
|
||||
linkUrl +
|
||||
'">' +
|
||||
(CommonUtils.isUndefined(linkText)
|
||||
? Globalization.TovabbiInfo
|
||||
: linkText) +
|
||||
'</a></div>';
|
||||
data += '</div></div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(jsFunction)) {
|
||||
jsFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.warningWindow = function (
|
||||
title,
|
||||
content,
|
||||
jsFunction,
|
||||
name,
|
||||
newHeight,
|
||||
customButtonText = null
|
||||
) {
|
||||
var element;
|
||||
if (!CommonUtils.isUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var buttonText = '';
|
||||
if (CommonUtils.isNullOrUndefined(customButtonText)) {
|
||||
buttonText = Globalization.Vissza;
|
||||
} else {
|
||||
buttonText = customButtonText;
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(newHeight)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: newHeight
|
||||
});
|
||||
}
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer"><div class="modalOuter"><div class="modalContent"><div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;"><span><i class="fa fa-exclamation-triangle warningWindowIcon"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>';
|
||||
data +=
|
||||
'<div class="modalFooter modalFooterStatic"><div style="float:right; padding-left: 5px;"><a class="k-button k-button-icontext closeWarning" href="javascript:void(null)">' +
|
||||
buttonText +
|
||||
'</a></div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeWarning')
|
||||
.click(function () {
|
||||
if (CommonUtils.isFunction(jsFunction)) {
|
||||
jsFunction();
|
||||
}
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.defaultWindow = function (title, content, name, newHeight) {
|
||||
var element;
|
||||
if (!CommonUtils.isUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(newHeight)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: newHeight
|
||||
});
|
||||
}
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer"><div class="modalOuter"><div class="modalContent"><div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;"><span> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>';
|
||||
data +=
|
||||
'<div class="modalFooter modalFooterStatic"><div style="float:right; padding-left: 5px;"><a class="k-button k-button-icontext closeFeedback" href="javascript:void(null)">' +
|
||||
Globalization.Vissza +
|
||||
'</a></div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.closeFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
kretaWindowHelper.destroyAllWindow = function () {
|
||||
$('.k-window-content').each(function () {
|
||||
$(this).data('kendoWindow').destroy();
|
||||
});
|
||||
};
|
||||
|
||||
kretaWindowHelper.getKendoWindowData = function (id) {
|
||||
var modal = $('#' + id).data('kendoWindow');
|
||||
return modal;
|
||||
};
|
||||
|
||||
kretaWindowHelper.setWindowHeight = function (id, height) {
|
||||
var kendoWindowData = kretaWindowHelper.getKendoWindowData(id);
|
||||
kendoWindowData.setOptions({
|
||||
height: height
|
||||
});
|
||||
};
|
||||
|
||||
kretaWindowHelper.openWindow = function (modal, center) {
|
||||
openWindow(modal, center);
|
||||
};
|
||||
|
||||
kretaWindowHelper.destroyWindow = function (id) {
|
||||
destroyWindow(id);
|
||||
};
|
||||
|
||||
kretaWindowHelper.successFeedBackWindow = function (
|
||||
jsFunction,
|
||||
customMessageText
|
||||
) {
|
||||
if (!GlobalSystemParams.SuccessFeedBackWindowNeeded) {
|
||||
if (CommonUtils.isUndefined(customMessageText)) {
|
||||
customMessageText = Globalization.SikeresMentes;
|
||||
}
|
||||
|
||||
KretaWindowHelper.notification(customMessageText, 'success');
|
||||
}
|
||||
|
||||
if (CommonUtils.isFunction(jsFunction)) {
|
||||
jsFunction();
|
||||
}
|
||||
};
|
||||
|
||||
kretaWindowHelper.notification = function (customMessageText, type) {
|
||||
var element = getOrCreateWindowElement('kretaNotification');
|
||||
|
||||
element.kendoNotification({
|
||||
show: notificationShow
|
||||
});
|
||||
|
||||
var widget = element.data('kendoNotification');
|
||||
|
||||
widget.show(customMessageText, type);
|
||||
};
|
||||
|
||||
function notificationShow(e) {
|
||||
var highest = 10000;
|
||||
$('body')
|
||||
.children()
|
||||
.each(function () {
|
||||
var current = parseInt($(this).css('z-index'), 10);
|
||||
if (current && highest < current) highest = current;
|
||||
});
|
||||
|
||||
e.element.parent().css('z-index', highest + 1);
|
||||
}
|
||||
|
||||
function getOrCreateWindowElement(id) {
|
||||
var element = $('#' + id);
|
||||
|
||||
if (!element.length) {
|
||||
element = $('<div></div>', { id: id }).appendTo('body');
|
||||
} else {
|
||||
element.remove();
|
||||
element = $('<div></div>', { id: id }).appendTo('body');
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
function getPosition() {
|
||||
var position = {
|
||||
top: function () {
|
||||
return 0;
|
||||
},
|
||||
left: function () {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
return position;
|
||||
}
|
||||
|
||||
function createModal(element, position, config) {
|
||||
modal = element
|
||||
.kendoWindow({
|
||||
title: config.title,
|
||||
width: config.width,
|
||||
height: config.height,
|
||||
minWidth: config.minWidth,
|
||||
minHeight: config.minHeight,
|
||||
maxHeight: config.maxHeight == null ? undefined : config.maxHeight,
|
||||
maxWidth: config.maxWidth == null ? undefined : config.maxWidth,
|
||||
actions: config.actions ? config.actions : ['Maximize', 'Close'],
|
||||
visible: false,
|
||||
modal: true,
|
||||
resizable: config.resizable,
|
||||
position: position,
|
||||
close: function () {
|
||||
if (CommonUtils.isFunction(config.closeFunction)) {
|
||||
config.closeFunction();
|
||||
}
|
||||
element.empty();
|
||||
this.destroy();
|
||||
}
|
||||
})
|
||||
.data('kendoWindow')
|
||||
.content(config.content);
|
||||
|
||||
$.validator.unobtrusive.parse('form');
|
||||
|
||||
return modal;
|
||||
}
|
||||
|
||||
function openWindow(modal, center) {
|
||||
if (modal) {
|
||||
if (center) {
|
||||
modal.center();
|
||||
}
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
function destroyWindow(id) {
|
||||
var modal = $('#' + id).data('kendoWindow');
|
||||
if (modal) {
|
||||
modal.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
kretaWindowHelper.feedbackWindowWithThreeButton = function (
|
||||
title,
|
||||
content,
|
||||
isError,
|
||||
firstButtonText,
|
||||
secondButtonText,
|
||||
thirdButtonText,
|
||||
jsFirstFunction,
|
||||
jsSecondFunction,
|
||||
jsThirdFunction,
|
||||
firstButtonId,
|
||||
secondButtonId,
|
||||
thirdButtonId,
|
||||
name,
|
||||
newHeight,
|
||||
firstFnData,
|
||||
secondFnData,
|
||||
thirdFnData
|
||||
) {
|
||||
var element;
|
||||
if (!CommonUtils.isNullOrUndefined(name)) {
|
||||
element = $('<div />', {
|
||||
name: name
|
||||
});
|
||||
} else {
|
||||
element = $('<div />');
|
||||
}
|
||||
|
||||
var kendoWindow = element.kendoWindow({
|
||||
title: title,
|
||||
actions: [],
|
||||
resizable: false,
|
||||
modal: true,
|
||||
minHeight: MIN_HEIGHT,
|
||||
minWidth: MIN_WIDTH
|
||||
});
|
||||
|
||||
if (!CommonUtils.isNullOrUndefined(newHeight)) {
|
||||
kendoWindow.data('kendoWindow').setOptions({
|
||||
height: newHeight
|
||||
});
|
||||
}
|
||||
|
||||
var firstId = CommonUtils.isNullOrUndefined(firstButtonId)
|
||||
? ''
|
||||
: ' id ="' + firstButtonId + '"';
|
||||
var firstText = CommonUtils.isNullOrUndefined(firstButtonText)
|
||||
? Globalization.Vissza
|
||||
: firstButtonText;
|
||||
var secondId = CommonUtils.isNullOrUndefined(secondButtonId)
|
||||
? ''
|
||||
: ' id ="' + secondButtonId + '"';
|
||||
var secondText = CommonUtils.isNullOrUndefined(secondButtonText)
|
||||
? Globalization.Vissza
|
||||
: secondButtonText;
|
||||
var thirdId = CommonUtils.isNullOrUndefined(thirdButtonId)
|
||||
? ''
|
||||
: ' id ="' + thirdButtonId + '"';
|
||||
var thirdText = CommonUtils.isNullOrUndefined(thirdButtonText)
|
||||
? Globalization.Vissza
|
||||
: thirdButtonText;
|
||||
|
||||
var data =
|
||||
'<div class="modalContainer">' +
|
||||
'<div class="modalOuter">' +
|
||||
'<div class="modalContent">' +
|
||||
'<div style="padding: 20px; min-width: ' +
|
||||
MIN_WIDTH +
|
||||
'px; max-width: 1000px;">' +
|
||||
'<span><i class="fa ' +
|
||||
(isError == undefined
|
||||
? ''
|
||||
: isError == true
|
||||
? 'fa-exclamation feedBackWindowIconError'
|
||||
: 'fa-check feedBackWindowIconSuccess') +
|
||||
'"></i> </span>' +
|
||||
content +
|
||||
'</div></div></div></div>' +
|
||||
'<div class="modalFooter modalFooterStatic">' +
|
||||
'<div style="float:right; padding-left: 5px;"><a class="k-button k-button-icontext firstFeedback" href="javascript:void(null)"' +
|
||||
firstId +
|
||||
'>' +
|
||||
firstText +
|
||||
'</a>' +
|
||||
'<a style="margin-left: 10px; margin-right: 10px;" class="k-button k-button-icontext secondFeedback" href="javascript:void(null)"' +
|
||||
secondId +
|
||||
'>' +
|
||||
secondText +
|
||||
'</a>' +
|
||||
'<a class="k-button k-button-icontext thirdFeedback" href="javascript:void(null)"' +
|
||||
thirdId +
|
||||
'>' +
|
||||
thirdText +
|
||||
'</a>' +
|
||||
'</div></div>';
|
||||
|
||||
kendoWindow.data('kendoWindow').content(data).center().open();
|
||||
|
||||
kendoWindow
|
||||
.find('.firstFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(jsFirstFunction)) {
|
||||
if (firstFnData !== undefined) {
|
||||
jsFirstFunction(firstFnData);
|
||||
}
|
||||
jsFirstFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
kendoWindow
|
||||
.find('.secondFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(jsSecondFunction)) {
|
||||
if (secondFnData !== undefined) {
|
||||
jsSecondFunction(secondFnData);
|
||||
}
|
||||
jsSecondFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
kendoWindow
|
||||
.find('.thirdFeedback')
|
||||
.click(function () {
|
||||
kendoWindow.data('kendoWindow').destroy();
|
||||
if (CommonUtils.isFunction(jsThirdFunction)) {
|
||||
if (thirdFnData !== undefined) {
|
||||
jsThirdFunction(thirdFnData);
|
||||
}
|
||||
jsThirdFunction();
|
||||
}
|
||||
})
|
||||
.end();
|
||||
};
|
||||
|
||||
return kretaWindowHelper;
|
||||
})();
|
263
KretaWeb/Scripts/KendoHelper/KretaWizard.js
Normal file
263
KretaWeb/Scripts/KendoHelper/KretaWizard.js
Normal file
|
@ -0,0 +1,263 @@
|
|||
var KretaWizardHelper = (function () {
|
||||
var kretaWizardHelper = function () {};
|
||||
|
||||
kretaWizardHelper.loadView = function (instance) {
|
||||
AjaxHelper.DoPost(
|
||||
instance.currentUrl,
|
||||
instance.dataToBeSentOnNextPage,
|
||||
function (data) {
|
||||
fillViewArea(instance, data, instance.oldData);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
function fillViewArea(instance, data) {
|
||||
var area = $(instance.wizardBodyId);
|
||||
area.empty();
|
||||
area.append(data);
|
||||
setButtonVisible(instance);
|
||||
if (instance.oldData != null) {
|
||||
readyEventPopulate(instance.wizardFormId, instance.oldData);
|
||||
}
|
||||
instance.onReadyEvent(instance);
|
||||
}
|
||||
|
||||
function setButtonVisible(instance) {
|
||||
if (instance.historyList.length > 0) {
|
||||
$(instance.backButtonId).show();
|
||||
} else {
|
||||
$(instance.backButtonId).hide();
|
||||
}
|
||||
|
||||
if (instance.showCancel) {
|
||||
$(instance.cancelButtonId).show();
|
||||
} else {
|
||||
$(instance.cancelButtonId).hide();
|
||||
}
|
||||
|
||||
if (instance.showNext) {
|
||||
$(instance.nextButtonId).show();
|
||||
} else {
|
||||
$(instance.nextButtonId).hide();
|
||||
}
|
||||
|
||||
if (instance.showEnd) {
|
||||
$(instance.endButtonId).show();
|
||||
} else {
|
||||
$(instance.endButtonId).hide();
|
||||
}
|
||||
}
|
||||
|
||||
function readyEventPopulate(frm, data) {
|
||||
$.each(data, function (key, value) {
|
||||
var $ctrl = $(frm + ' ' + '[name=' + key + ']');
|
||||
switch ($ctrl.attr('type')) {
|
||||
case 'text':
|
||||
case 'input':
|
||||
if ($ctrl.attr('data-role') == 'combobox') {
|
||||
$ctrl.data('kendoComboBox').value(value);
|
||||
} else {
|
||||
$ctrl.val(value);
|
||||
}
|
||||
case 'hidden':
|
||||
$ctrl.val(value);
|
||||
break;
|
||||
case 'radio':
|
||||
case 'checkbox':
|
||||
$ctrl.each(function () {
|
||||
if ($(this).attr('value') == value) {
|
||||
$(this).attr('checked', value);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
$ctrl.val(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return kretaWizardHelper;
|
||||
})();
|
||||
|
||||
function KretaWizard(
|
||||
url,
|
||||
baseModel,
|
||||
showNext,
|
||||
showEnd,
|
||||
showCancel,
|
||||
showProgressBar,
|
||||
showStepDisplay
|
||||
) {
|
||||
this.currentUrl = url;
|
||||
this.baseModel = baseModel;
|
||||
this.backButtonId = '#wizardBackBtn';
|
||||
this.nextButtonId = '#wizardNextBtn';
|
||||
this.wizardBodyId = '#wizardContent';
|
||||
this.endButtonId = '#wizardEndBtn';
|
||||
this.cancelButtonId = '#wizardCancelBtn';
|
||||
this.wizardFormId = '#WizardForm';
|
||||
this.progressBarId = '#wizardProgressBar';
|
||||
this.stepDisplayId = '#wizardStepDisplay';
|
||||
this.historyList = [];
|
||||
this.onNextEvent = function () {};
|
||||
this.onBackEvent = function () {};
|
||||
this.onReadyEvent = function () {};
|
||||
this.onEndEvent = function () {};
|
||||
this.onCancelEvent = function () {};
|
||||
this.oldData = null;
|
||||
this.justTrigerNext = false; /*next button just trugger event*/
|
||||
this.showEnd = false;
|
||||
this.showNext = showNext == null ? true : showNext;
|
||||
this.showEnd = showEnd == null ? false : showEnd;
|
||||
this.overrideWindowSize = false;
|
||||
this.dataToBeSentOnNextPage = null;
|
||||
this.showCancel = showCancel == null ? false : showCancel;
|
||||
this.showProgressBar = showProgressBar == null ? false : showProgressBar;
|
||||
this.showStepDisplay = showStepDisplay == null ? false : showStepDisplay;
|
||||
}
|
||||
|
||||
KretaWizard.prototype.ManualNext = function (
|
||||
nextUrl,
|
||||
nextStepId,
|
||||
showNextButton,
|
||||
showEnd
|
||||
) {
|
||||
this.historyList.push({
|
||||
url: this.currentUrl,
|
||||
model: $(this.wizardFormId).toObject(),
|
||||
showNext: this.showNext,
|
||||
showEnd: this.showEnd,
|
||||
actualStepId: this.baseModel.actualStepId,
|
||||
justTrigerNext: this.justTrigerNext
|
||||
});
|
||||
this.currentUrl = nextUrl;
|
||||
this.baseModel.actualStepId = nextStepId;
|
||||
this.showNext = showNextButton == null ? true : showNextButton;
|
||||
this.showEnd = showEnd == null ? false : showEnd;
|
||||
this.oldData = null;
|
||||
|
||||
KretaWizardHelper.loadView(this);
|
||||
};
|
||||
|
||||
KretaWizard.prototype.GetModel = function (index) {
|
||||
if (CommonUtils.isNullOrUndefined(index) || index == 0) {
|
||||
var result = $(this.wizardFormId).toObject();
|
||||
for (var i = this.historyList.length - 1; i > 0; i--) {
|
||||
$.extend(result, this.historyList[i].model);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
var historyIndex = this.historyList.length - index;
|
||||
if (historyIndex >= 0 && historyIndex < this.historyList.length) {
|
||||
return this.historyList[historyIndex].model;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
KretaWizard.prototype.Next = function () {
|
||||
if (this.justTrigerNext) {
|
||||
this.onNextEvent(this);
|
||||
} else {
|
||||
this.historyList.push({
|
||||
url: this.currentUrl,
|
||||
model: $(this.wizardFormId).toObject(),
|
||||
showNext: this.showNext,
|
||||
showEnd: this.showEnd,
|
||||
actualStepId: this.baseModel.actualStepId,
|
||||
justTrigerNext: this.justTrigerNext
|
||||
});
|
||||
this.oldData = null;
|
||||
|
||||
var result = this.onNextEvent(this);
|
||||
if (result == null || result) {
|
||||
KretaWizardHelper.loadView(this);
|
||||
} else {
|
||||
this.historyList.pop();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
KretaWizard.prototype.Back = function () {
|
||||
if (this.historyList.length > 0) {
|
||||
var lastView = this.historyList.pop();
|
||||
this.currentUrl = lastView.url;
|
||||
this.oldData = lastView.model;
|
||||
this.showNext = lastView.showNext;
|
||||
this.showEnd = lastView.showEnd;
|
||||
this.baseModel.actualStepId = lastView.actualStepId;
|
||||
this.justTrigerNext = lastView.justTrigerNext;
|
||||
}
|
||||
|
||||
this.onBackEvent(this);
|
||||
KretaWizardHelper.loadView(this);
|
||||
};
|
||||
|
||||
KretaWizard.prototype.Open = function (
|
||||
url,
|
||||
title,
|
||||
onmodal,
|
||||
formContentContainer
|
||||
) {
|
||||
var wizardThis = this;
|
||||
wizardThis.onmodal = onmodal;
|
||||
wizardThis.formContentContainer = formContentContainer;
|
||||
|
||||
AjaxHelper.DoPost(url, null, getWizardGlobalContent);
|
||||
|
||||
function getWizardGlobalContent(data) {
|
||||
var config = KretaWindowHelper.getWindowConfigContainer();
|
||||
config.content = data;
|
||||
config.title = title;
|
||||
|
||||
if (wizardThis.overrideWindowSize === false) {
|
||||
config.width = 600;
|
||||
config.height = 265;
|
||||
}
|
||||
|
||||
var modal;
|
||||
if (wizardThis.onmodal !== false) {
|
||||
modal = KretaWindowHelper.createWindow('wizardWindow', config);
|
||||
}
|
||||
|
||||
KretaWizardHelper.loadView(wizardThis);
|
||||
|
||||
if (wizardThis.onmodal === false) {
|
||||
$(wizardThis.formContentContainer.selector).html(data);
|
||||
$(wizardThis.formContentContainer.selector)
|
||||
.first()
|
||||
.css('height', wizardThis.formContentContainer.height);
|
||||
}
|
||||
|
||||
$(wizardThis.nextButtonId).bind('click', function () {
|
||||
wizardThis.Next();
|
||||
});
|
||||
$(wizardThis.backButtonId).bind('click', function () {
|
||||
wizardThis.Back();
|
||||
});
|
||||
$(wizardThis.endButtonId).bind('click', function () {
|
||||
wizardThis.onEndEvent(wizardThis);
|
||||
});
|
||||
$(wizardThis.cancelButtonId).bind('click', function () {
|
||||
wizardThis.onCancelEvent(wizardThis);
|
||||
});
|
||||
|
||||
if (wizardThis.showProgressBar === true) {
|
||||
$(wizardThis.progressBarId).css('display', '');
|
||||
}
|
||||
if (wizardThis.showStepDisplay === true) {
|
||||
$(wizardThis.stepDisplayId).css('visibility', '');
|
||||
} else {
|
||||
$(wizardThis.stepDisplayId).css('display', 'none');
|
||||
}
|
||||
|
||||
if (modal) {
|
||||
KretaWindowHelper.openWindow(modal, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
KretaWizard.prototype.RemoveLastFromHistory = function () {
|
||||
this.historyList.pop();
|
||||
};
|
1248
KretaWeb/Scripts/KendoHelper/kendo.messages.hu-HU.js
Normal file
1248
KretaWeb/Scripts/KendoHelper/kendo.messages.hu-HU.js
Normal file
File diff suppressed because it is too large
Load diff
98
KretaWeb/Scripts/KirSzinkronHelper.js
Normal file
98
KretaWeb/Scripts/KirSzinkronHelper.js
Normal file
|
@ -0,0 +1,98 @@
|
|||
var KirSzinkronHelper = (function () {
|
||||
var kirSzinkronHelper = function () {};
|
||||
|
||||
var szinkronData = [];
|
||||
|
||||
kirSzinkronHelper.gridCellClickKreta = function (
|
||||
e,
|
||||
cellData,
|
||||
isImportFromKir
|
||||
) {
|
||||
onChooseData(e, cellData, false, isImportFromKir);
|
||||
};
|
||||
|
||||
kirSzinkronHelper.gridCellClickKir = function (e, cellData, isImportFromKir) {
|
||||
onChooseData(e, cellData, true, isImportFromKir);
|
||||
};
|
||||
|
||||
function onChooseData(e, cellData, isKirData, isImportFromKir) {
|
||||
var kirCellId = '#kir_ertek_' + e;
|
||||
var kretaCellId = '#kreta_ertek_' + e;
|
||||
|
||||
if (isKirData) {
|
||||
if ($(kirCellId).parent().hasClass('selectedKirSzinkronData')) {
|
||||
$(kirCellId).parent().removeClass('selectedKirSzinkronData');
|
||||
$('#kivalasztottOszlopSzoveg_' + e).val('');
|
||||
} else {
|
||||
$(kirCellId).parent().addClass('selectedKirSzinkronData');
|
||||
$(kretaCellId).parent().removeClass('selectedKirSzinkronData');
|
||||
$('#kivalasztottOszlopSzoveg_' + e).val(
|
||||
isImportFromKir ? cellData.innerText : ''
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ($(kretaCellId).parent().hasClass('selectedKirSzinkronData')) {
|
||||
$(kretaCellId).parent().removeClass('selectedKirSzinkronData');
|
||||
$('#kivalasztottOszlopSzoveg_' + e).val('');
|
||||
} else {
|
||||
$(kretaCellId).parent().addClass('selectedKirSzinkronData');
|
||||
$(kirCellId).parent().removeClass('selectedKirSzinkronData');
|
||||
$('#kivalasztottOszlopSzoveg_' + e).val(
|
||||
isImportFromKir ? '' : cellData.innerText
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
kirSzinkronHelper.collectSzinkronData = function (gridNameList, modifyUrl) {
|
||||
var gridNameArray = gridNameList.split(',');
|
||||
$.each(gridNameArray, function (index, value) {
|
||||
var grid = KretaGridHelper.getKendoGridData(value);
|
||||
if (!CommonUtils.isUndefined(grid)) {
|
||||
var gridData = grid.dataItems();
|
||||
|
||||
for (var i = 0; i < gridData.length; i++) {
|
||||
var tartalom = $(
|
||||
'#kivalasztottOszlopSzoveg_' + gridData[i].AdatAzonositoNeve
|
||||
).val();
|
||||
|
||||
if (!CommonUtils.isUndefined(tartalom) && tartalom !== '') {
|
||||
szinkronData.push({
|
||||
key: gridData[i].AdatAzonositoNeve,
|
||||
value: tartalom
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var formData = $('#KirImportModel').toObject();
|
||||
var postData = {
|
||||
FelhasznaloId: formData['FelhasznaloId'],
|
||||
ValtozasDictData: szinkronData
|
||||
};
|
||||
AjaxHelper.DoPost(
|
||||
modifyUrl,
|
||||
postData,
|
||||
saveKirDataResponseOk,
|
||||
saveKirDataResponseError
|
||||
);
|
||||
};
|
||||
|
||||
function saveKirDataResponseOk() {
|
||||
KretaWindowHelper.successFeedBackWindow(KretaWindowHelper.destroyAllWindow);
|
||||
szinkronData = [];
|
||||
}
|
||||
|
||||
function saveKirDataResponseError() {
|
||||
var msg = '@(CommonResource.Hiba)';
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
'@(CommonResource.Hiba)',
|
||||
msg,
|
||||
true,
|
||||
KretaWindowHelper.destroyAllWindow
|
||||
);
|
||||
szinkronData = [];
|
||||
}
|
||||
|
||||
return kirSzinkronHelper;
|
||||
})();
|
197
KretaWeb/Scripts/OsztalyBevitelVisibilityHelper.js
Normal file
197
KretaWeb/Scripts/OsztalyBevitelVisibilityHelper.js
Normal file
|
@ -0,0 +1,197 @@
|
|||
var OsztalyBevitelVisibilityHelper = function () {
|
||||
var helper = function () {};
|
||||
|
||||
helper.feladatellatasiHelyIsSzakkepzesesJSON = '';
|
||||
helper.feladatellatasiHelyIsNktJSON = '';
|
||||
helper.isSelectedTanev20_21OrLater = '';
|
||||
helper.isSelectedTanev21_22OrLater = '';
|
||||
helper.szakmacsoportTipusNa = null;
|
||||
helper.agazatTipusNa = null;
|
||||
helper.szakkepesitesTipusNa = null;
|
||||
helper.reszszakkepesiteTipusNa = null;
|
||||
helper.agazatTipusUjSzktNa = null;
|
||||
helper.szakmaTipusUjSzktNa = null;
|
||||
helper.szakmairanyTipusUjSzktNa = null;
|
||||
helper.tanulmanyiTeruletNktTipusNa = null;
|
||||
helper.szakkepesitesNktTipusNa = null;
|
||||
helper.szakiranyNktTipusNa = null;
|
||||
|
||||
helper.SetGimnaziunTobbOsztalyosVisibility = function (selectedFeladHelyId) {
|
||||
var feladatellatasiHelyIsGimnazium = CommonUtils.JSONparse(
|
||||
$('#GimnaziumIdsJSON').val()
|
||||
);
|
||||
var isGimnazium = false;
|
||||
|
||||
$.each(feladatellatasiHelyIsGimnazium, function (index, value) {
|
||||
if (value == selectedFeladHelyId) {
|
||||
isGimnazium = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var div = $('#Gimnazium');
|
||||
if (isGimnazium) {
|
||||
div.show();
|
||||
} else {
|
||||
div.hide();
|
||||
}
|
||||
};
|
||||
|
||||
//Nevelés-oktatás EGYMI
|
||||
helper.SetSzakkepesitesBlokkVisibilityNevOktEsEgymi = function (
|
||||
selectedFeladHelyId
|
||||
) {
|
||||
var selectedFeladHelyIsSzakkepzeses = getSelectedFelhelyType(
|
||||
helper.feladatellatasiHelyIsSzakkepzesesJSON,
|
||||
selectedFeladHelyId
|
||||
);
|
||||
|
||||
var selectedFeladHelyIsNkt = getSelectedFelhelyType(
|
||||
helper.feladatellatasiHelyIsNktJSON,
|
||||
selectedFeladHelyId
|
||||
);
|
||||
|
||||
var ujSzktContainer = $('#ujSzktContainer');
|
||||
var regiSzktContainer = $('#regiSzktContainer');
|
||||
var nktContainer = $('#NktContainer');
|
||||
|
||||
if (
|
||||
helper.isSelectedTanev20_21OrLater &&
|
||||
!helper.isSelectedTanev21_22OrLater
|
||||
) {
|
||||
if (selectedFeladHelyIsSzakkepzeses) {
|
||||
regiSzktContainer.show();
|
||||
ujSzktContainer.show();
|
||||
} else {
|
||||
regiSzktContainer.hide();
|
||||
ujSzktContainer.hide();
|
||||
setRegiSzktDataToDefault();
|
||||
setUjSzktDataToDefault();
|
||||
}
|
||||
|
||||
if (selectedFeladHelyIsNkt) {
|
||||
nktContainer.show();
|
||||
} else {
|
||||
nktContainer.hide();
|
||||
setNktDataToDefault();
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
selectedFeladHelyIsSzakkepzeses &&
|
||||
!helper.isSelectedTanev21_22OrLater
|
||||
) {
|
||||
regiSzktContainer.show();
|
||||
} else {
|
||||
regiSzktContainer.hide();
|
||||
setRegiSzktDataToDefault();
|
||||
}
|
||||
ujSzktContainer.hide();
|
||||
nktContainer.hide();
|
||||
setUjSzktDataToDefault();
|
||||
setNktDataToDefault();
|
||||
}
|
||||
|
||||
setOsztalyKepzesiJellemzokVisibility(
|
||||
selectedFeladHelyIsNkt && helper.isSelectedTanev21_22OrLater
|
||||
);
|
||||
};
|
||||
|
||||
//AMI
|
||||
helper.SetSzakkepesitesBlokkVisibilityAmi = function (selectedFeladHelyId) {
|
||||
var selectedFeladHelyIsNkt = getSelectedFelhelyType(
|
||||
helper.feladatellatasiHelyIsNktJSON,
|
||||
selectedFeladHelyId
|
||||
);
|
||||
|
||||
var nktContainer = $('#NktContainer');
|
||||
|
||||
if (
|
||||
selectedFeladHelyIsNkt &&
|
||||
helper.isSelectedTanev20_21OrLater &&
|
||||
!helper.isSelectedTanev21_22OrLater
|
||||
) {
|
||||
nktContainer.show();
|
||||
} else {
|
||||
nktContainer.hide();
|
||||
setNktDataToDefault();
|
||||
}
|
||||
|
||||
setOsztalyKepzesiJellemzokVisibility(
|
||||
selectedFeladHelyIsNkt && helper.isSelectedTanev21_22OrLater
|
||||
);
|
||||
};
|
||||
|
||||
function getSelectedFelhelyType(felhelyJSON, selectedFeladHelyId) {
|
||||
var result = false;
|
||||
var felhelyDictionary = '';
|
||||
if (CommonUtils.isNullOrUndefined(felhelyJSON)) {
|
||||
return result;
|
||||
} else {
|
||||
felhelyDictionary = CommonUtils.JSONparse(felhelyJSON);
|
||||
}
|
||||
|
||||
$.each(felhelyDictionary, function (id, value) {
|
||||
if (id === selectedFeladHelyId) {
|
||||
result = value;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function setRegiSzktDataToDefault() {
|
||||
$('#SzakmacsoportId')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakmacsoportTipusNa);
|
||||
$('#AgazatId').data('kendoComboBox').value(helper.agazatTipusNa);
|
||||
$('#SzakkepesitesId')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakkepesitesTipusNa);
|
||||
$('#ReszSzakkepesitesId')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.reszszakkepesiteTipusNa);
|
||||
}
|
||||
|
||||
function setUjSzktDataToDefault() {
|
||||
$('#AgazatUjSzktTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.agazatTipusUjSzktNa);
|
||||
$('#SzakmaTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakmaTipusUjSzktNa);
|
||||
$('#SzakmairanyTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakmairanyTipusUjSzktNa);
|
||||
}
|
||||
|
||||
function setNktDataToDefault() {
|
||||
$('#TanulmanyiTeruletNktTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.tanulmanyiTeruletNktTipusNa);
|
||||
$('#SzakkepesitesNktTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakkepesitesNktTipusNa);
|
||||
$('#SzakiranyNktTipusId ')
|
||||
.data('kendoComboBox')
|
||||
.value(helper.szakiranyNktTipusNa);
|
||||
}
|
||||
|
||||
function setOsztalyKepzesiJellemzokVisibility(isVisible) {
|
||||
var kepzesijellemzoTabstripItem = $('#OsztalyKepzesiJellemzok_TabStripId');
|
||||
if (!CommonUtils.isNullOrUndefined(kepzesijellemzoTabstripItem)) {
|
||||
if (isVisible) {
|
||||
$('#OsztalyKepzesiJellemzok_TabStripId').attr(
|
||||
'style',
|
||||
'display:block !important'
|
||||
);
|
||||
} else {
|
||||
$('#OsztalyKepzesiJellemzok_TabStripId').attr(
|
||||
'style',
|
||||
'display:none !important'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return helper;
|
||||
};
|
446
KretaWeb/Scripts/OsztalyCsoportbaSorolas.js
Normal file
446
KretaWeb/Scripts/OsztalyCsoportbaSorolas.js
Normal file
|
@ -0,0 +1,446 @@
|
|||
var SorolasLogic = function () {
|
||||
var helper = function () {};
|
||||
|
||||
var formName = 'SorolasForm';
|
||||
var fromSelectName = 'multiselect';
|
||||
var toSelectName = 'multiselect_to';
|
||||
var toDdl = 'ToDDL';
|
||||
var fromDdl = 'FromDDL';
|
||||
var keltezesHelyeName = 'KeltezesHelye';
|
||||
var keltezesDatumaName = 'KeltezesDatuma';
|
||||
|
||||
helper.FromUrl = '';
|
||||
helper.FromAdditionalFunction = null;
|
||||
helper.ToUrl = '';
|
||||
helper.ToAdditionalFunction = null;
|
||||
helper.SaveUrl = '';
|
||||
helper.SaveAdditionalFunction = null;
|
||||
helper.SaveOnErrorFunction = null;
|
||||
helper.IsDefaultFeedbackWindow = true;
|
||||
helper.SelectedOsztalyId = null;
|
||||
helper.JogviszonyVegeValidationMessage = '';
|
||||
helper.JogvMegszuneseJogcimTipusIdValidationMessage = '';
|
||||
|
||||
helper.Save = function (zaradekTextName) {
|
||||
if (!CommonUtils.isNullOrEmpty(zaradekTextName)) {
|
||||
var zaradekText = $('#' + zaradekTextName);
|
||||
var keltezesHelyeText = $('#' + keltezesHelyeName);
|
||||
var keltezesDatumaDP = $('#' + keltezesDatumaName);
|
||||
zaradekText.removeClass('error');
|
||||
keltezesHelyeText.removeClass('error');
|
||||
keltezesDatumaDP.removeClass('error');
|
||||
$('#' + zaradekTextName + '-error')
|
||||
.parent()
|
||||
.remove();
|
||||
if ($('#' + toSelectName + ' option.red').length == 0) {
|
||||
zaradekText.attr('data-rule-required', 'false');
|
||||
zaradekText.attr('aria-required', 'false');
|
||||
zaradekText.rules('remove', 'required');
|
||||
zaradekText.rules('add', { required: false });
|
||||
|
||||
keltezesHelyeText.attr('data-rule-required', 'false');
|
||||
keltezesHelyeText.attr('aria-required', 'false');
|
||||
keltezesHelyeText.rules('remove', 'required');
|
||||
|
||||
keltezesDatumaDP.attr('data-rule-required', 'false');
|
||||
keltezesDatumaDP.attr('aria-required', 'false');
|
||||
keltezesDatumaDP.rules('remove', 'required');
|
||||
} else {
|
||||
zaradekText.attr('data-rule-required', 'true');
|
||||
zaradekText.attr('aria-required', 'true');
|
||||
zaradekText.rules('add', 'required');
|
||||
|
||||
keltezesHelyeText.attr('data-rule-required', 'true');
|
||||
keltezesHelyeText.attr('aria-required', 'true');
|
||||
keltezesHelyeText.rules('add', 'required');
|
||||
|
||||
keltezesDatumaDP.attr('data-rule-required', 'true');
|
||||
keltezesDatumaDP.attr('aria-required', 'true');
|
||||
keltezesDatumaDP.rules('add', 'required');
|
||||
}
|
||||
|
||||
CheckJogviszonyValidation();
|
||||
|
||||
var validator = $('#' + formName).validate();
|
||||
$('#' + zaradekTextName, '#' + formName).each(function () {
|
||||
validator.successList.push(this); //mark as error free
|
||||
validator.showErrors(); //remove error messages if present
|
||||
});
|
||||
//validator.resetForm();//remove error class on name elements and clear history
|
||||
validator.reset(); //remove all error and success data
|
||||
}
|
||||
var fromValue = $('#' + fromSelectName).val();
|
||||
KretaOsztalybaSorolasHelper.selectAllOptions(fromSelectName);
|
||||
var toValue = $('#' + toSelectName).val();
|
||||
KretaOsztalybaSorolasHelper.selectAllOptions(toSelectName);
|
||||
var json = KretaOsztalybaSorolasHelper.createJson(formName);
|
||||
|
||||
if ($('#' + formName).valid()) {
|
||||
if (json.ToElements.length > 0) {
|
||||
if (!CommonUtils.isNullOrEmpty(zaradekTextName)) {
|
||||
if (CommonUtils.isNullOrEmpty(zaradekText.val())) {
|
||||
//Minden elemnel van mentett ki/atsorolasi zaradek de a szoveg nincs kitoltve
|
||||
if ($('#' + toSelectName + ' option.red').length === 0) {
|
||||
SaveAtsorolas(json);
|
||||
}
|
||||
} else {
|
||||
//Van akinél van rögzített és van akinél még nincs. Felületen ki van töltve
|
||||
if (
|
||||
$('#' + toSelectName + ' option.green').length > 0 &&
|
||||
$('#' + toSelectName + ' option.red').length > 0
|
||||
) {
|
||||
KretaWindowHelper.feedbackWindowWithThreeButton(
|
||||
Globalization.Kerdes,
|
||||
Globalization.EgyesTanulokMarRendelkeznekKiAtsorolasiZaradekkalKerdes,
|
||||
false,
|
||||
Globalization.RogzitesMindenkinek,
|
||||
Globalization.RogzitesAkinekMegNincsen,
|
||||
Globalization.Vissza,
|
||||
RogzitesMindenkinek,
|
||||
RogzitesAkinekMegNincsen,
|
||||
null
|
||||
);
|
||||
}
|
||||
//Felületen meg van adva és vagy csak záradékkal rendelkező elemek vannak, vagy csak záradékkal nem rendelkezőek
|
||||
if (
|
||||
$('#' + toSelectName + ' option.green').length === 0 ||
|
||||
$('#' + toSelectName + ' option.red').length === 0
|
||||
) {
|
||||
RogzitesMindenkinek();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RogzitesMindenkinek(json);
|
||||
}
|
||||
} else {
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
Globalization.Hiba,
|
||||
Globalization.MenteshezLegalabbEgyTanulo,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
KretaOsztalybaSorolasHelper.deSelectAllOptions(fromSelectName);
|
||||
$('#' + fromSelectName).val(fromValue);
|
||||
KretaOsztalybaSorolasHelper.deSelectAllOptions(toSelectName);
|
||||
$('#' + toSelectName).val(toValue);
|
||||
};
|
||||
|
||||
helper.changeFromDdl = function (dynamicPropertiesObject) {
|
||||
var senderValue = $('#' + fromDdl)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
if (senderValue != '') {
|
||||
if (KretaOsztalybaSorolasHelper.checkPrePost(fromDdl)) {
|
||||
var data = createChangeDdlData(
|
||||
{ Id: senderValue },
|
||||
dynamicPropertiesObject
|
||||
);
|
||||
AjaxHelper.DoGet(
|
||||
helper.FromUrl,
|
||||
data,
|
||||
KretaOsztalybaSorolasHelper.replaceFromTanuloList
|
||||
);
|
||||
if (typeof helper.FromAdditionalFunction === 'function') {
|
||||
helper.FromAdditionalFunction();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
KretaOsztalybaSorolasHelper.removeOptions(fromSelectName);
|
||||
}
|
||||
};
|
||||
|
||||
helper.changeToDdl = function (dynamicPropertiesObject) {
|
||||
var sender = $('#' + toDdl).data('kendoComboBox');
|
||||
var senderValue = sender.value();
|
||||
if (senderValue != '') {
|
||||
helper.SelectedOsztalyId = senderValue;
|
||||
if (window.oldComboBoxValue != '') {
|
||||
KretaWindowHelper.confirmWindow(
|
||||
Globalization.Kerdes,
|
||||
Globalization.OsztalyCsoportbaSorolasModositasFigyelmeztetes,
|
||||
function () {
|
||||
changeToAjax(senderValue, dynamicPropertiesObject);
|
||||
window.oldComboBoxValue = '';
|
||||
helper.setDateRequiredDivVisibility();
|
||||
},
|
||||
senderValue,
|
||||
function () {
|
||||
sender.value(window.oldComboBoxValue);
|
||||
window.oldComboBoxValue = '';
|
||||
},
|
||||
Globalization.Rendben,
|
||||
Globalization.Vissza
|
||||
);
|
||||
} else {
|
||||
changeToAjax(senderValue, dynamicPropertiesObject);
|
||||
}
|
||||
} else {
|
||||
KretaOsztalybaSorolasHelper.removeOptions(toSelectName);
|
||||
helper.SelectedOsztalyId = null;
|
||||
}
|
||||
};
|
||||
|
||||
helper.init = function (dropKovTanevAlert) {
|
||||
window.oldComboBoxValue = '';
|
||||
KretaOsztalybaSorolasHelper.setMultiselectButton(toDdl);
|
||||
|
||||
setTimeout(function () {
|
||||
function combobox_open(e) {
|
||||
window.oldComboBoxValue = $('#' + toDdl)
|
||||
.data('kendoComboBox')
|
||||
.value();
|
||||
}
|
||||
$('#' + toDdl)
|
||||
.data('kendoComboBox')
|
||||
.bind('open', combobox_open);
|
||||
}, 1);
|
||||
|
||||
if (typeof dropKovTanevAlert !== 'undefined' && dropKovTanevAlert) {
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
Globalization.Hiba,
|
||||
Globalization.HianyzoKovTanev /*A rendszerben nem található meg jelenleg következő tanév, így a besorolás nem lehetséges!*/,
|
||||
true
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
helper.initDate = function (id) {
|
||||
$('#' + id).focusout(function () {
|
||||
kendoControl = $(this).data('kendoDatePicker');
|
||||
var value = $(this).val().replace(' ', '').replace(' ', '');
|
||||
var dateValue = new Date(value);
|
||||
var minDate = kendoControl.min();
|
||||
var maxDate = kendoControl.max();
|
||||
var deleteDatePickerValue = false;
|
||||
|
||||
if (minDate != null) {
|
||||
if (dateValue < minDate) {
|
||||
deleteDatePickerValue = true;
|
||||
}
|
||||
}
|
||||
if (maxDate != null) {
|
||||
if (dateValue > maxDate) {
|
||||
deleteDatePickerValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (deleteDatePickerValue) {
|
||||
kendoControl.value('');
|
||||
}
|
||||
});
|
||||
|
||||
$('#Datum').on('focusout', function () {
|
||||
$('#Datum').data('kendoDatePicker').trigger('change');
|
||||
});
|
||||
};
|
||||
|
||||
helper.setDate = function (id, datum) {
|
||||
$('#' + id)
|
||||
.data('kendoDatePicker')
|
||||
.value(datum);
|
||||
$('#' + id)
|
||||
.focus()
|
||||
.focusout();
|
||||
$('#' + id)
|
||||
.data('kendoDatePicker')
|
||||
.trigger('change');
|
||||
};
|
||||
|
||||
helper.setFromAndToDdl = function (dynamicPropertiesObject) {
|
||||
helper.changeFromDdl(dynamicPropertiesObject);
|
||||
helper.changeToDdl(dynamicPropertiesObject);
|
||||
};
|
||||
|
||||
helper.setDateRequiredDivVisibility = function () {
|
||||
if ($('#Datum').length) {
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined($('#Datum')) &&
|
||||
!CommonUtils.isNullOrUndefined($('#Datum').data('kendoDatePicker')) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#Datum').data('kendoDatePicker').value()
|
||||
)
|
||||
) {
|
||||
$('#dateRequiredDiv').hide();
|
||||
$('#multiselect_rightAll').prop('disabled', false);
|
||||
$('#multiselect_rightSelected').prop('disabled', false);
|
||||
$('#multiselect_leftAll').prop('disabled', false);
|
||||
$('#multiselect_leftSelected').prop('disabled', false);
|
||||
} else {
|
||||
$('#dateRequiredDiv').show();
|
||||
$('#multiselect_rightAll').prop('disabled', true);
|
||||
$('#multiselect_rightSelected').prop('disabled', true);
|
||||
$('#multiselect_leftAll').prop('disabled', true);
|
||||
$('#multiselect_leftSelected').prop('disabled', true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function changeToAjax(senderValue, dynamicPropertiesObject) {
|
||||
if (KretaOsztalybaSorolasHelper.checkPrePost(toDdl)) {
|
||||
var data = createChangeDdlData(
|
||||
{ Id: senderValue },
|
||||
dynamicPropertiesObject
|
||||
);
|
||||
AjaxHelper.DoGet(
|
||||
helper.ToUrl,
|
||||
data,
|
||||
KretaOsztalybaSorolasHelper.replaceToTanuloList
|
||||
);
|
||||
if (typeof helper.ToAdditionalFunction === 'function') {
|
||||
helper.ToAdditionalFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createChangeDdlData(originalData, dynamicPropertiesObject) {
|
||||
if (!CommonUtils.isNullOrUndefined(dynamicPropertiesObject)) {
|
||||
originalData = Object.assign(originalData, dynamicPropertiesObject);
|
||||
}
|
||||
|
||||
var data = null;
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined($('#Datum')) &&
|
||||
!CommonUtils.isNullOrUndefined($('#Datum').data('kendoDatePicker')) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#Datum').data('kendoDatePicker').value()
|
||||
)
|
||||
) {
|
||||
var datum = moment
|
||||
.utc(kendo.parseDate($('#Datum').data('kendoDatePicker').value(), 'u'))
|
||||
.local()
|
||||
.format();
|
||||
if (!CommonUtils.isNullOrEmpty(datum)) {
|
||||
data = {
|
||||
datum: datum
|
||||
};
|
||||
originalData = Object.assign(originalData, data);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!CommonUtils.isNullOrUndefined($('#KilepesDatum')) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#KilepesDatum').data('kendoDatePicker')
|
||||
) &&
|
||||
!CommonUtils.isNullOrUndefined(
|
||||
$('#KilepesDatum').data('kendoDatePicker').value()
|
||||
)
|
||||
) {
|
||||
var datum = moment
|
||||
.utc(
|
||||
kendo.parseDate(
|
||||
$('#KilepesDatum').data('kendoDatePicker').value(),
|
||||
'u'
|
||||
)
|
||||
)
|
||||
.local()
|
||||
.format();
|
||||
if (!CommonUtils.isNullOrEmpty(datum)) {
|
||||
data = {
|
||||
kilepesDatum: datum
|
||||
};
|
||||
originalData = Object.assign(originalData, data);
|
||||
}
|
||||
}
|
||||
|
||||
return originalData;
|
||||
}
|
||||
|
||||
function saveFeedBackOk(afterSaveFunction) {
|
||||
if (typeof afterSaveFunction === 'function') {
|
||||
afterSaveFunction();
|
||||
}
|
||||
if (helper.IsDefaultFeedbackWindow) {
|
||||
|
||||
KretaWindowHelper.feedbackWindow(
|
||||
Globalization.Siker,
|
||||
Globalization.SikeresMentes,
|
||||
false
|
||||
);
|
||||
}
|
||||
KretaOsztalybaSorolasHelper.resetForm(fromDdl, toDdl);
|
||||
}
|
||||
|
||||
function RogzitesAkinekMegNincsen() {
|
||||
var json = KretaOsztalybaSorolasHelper.createJson(formName);
|
||||
var zaradekRogzitesArray = new Array();
|
||||
|
||||
$.each(json.ToElements, function (key, value) {
|
||||
if (value.isVanMentettVegzaradek) {
|
||||
zaradekRogzitesArray.push({
|
||||
Id: value.Id,
|
||||
fromid: value.fromid,
|
||||
jogviszonycount: value.jogviszonycount,
|
||||
jogviszonyids: value.jogviszonyids,
|
||||
isVanMentettVegzaradek: value.isVanMentettVegzaradek,
|
||||
isKellFeluletenMegadottZaradekRogzitese: false
|
||||
});
|
||||
} else {
|
||||
zaradekRogzitesArray.push({
|
||||
Id: value.Id,
|
||||
fromid: value.fromid,
|
||||
jogviszonycount: value.jogviszonycount,
|
||||
jogviszonyids: value.jogviszonyids,
|
||||
isVanMentettVegzaradek: value.isVanMentettVegzaradek,
|
||||
isKellFeluletenMegadottZaradekRogzitese: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
json.ToElements = zaradekRogzitesArray;
|
||||
|
||||
SaveAtsorolas(json);
|
||||
}
|
||||
|
||||
function RogzitesMindenkinek() {
|
||||
var json = KretaOsztalybaSorolasHelper.createJson(formName);
|
||||
var zaradekRogzitesArray = new Array();
|
||||
|
||||
$.each(json.ToElements, function (key, value) {
|
||||
zaradekRogzitesArray.push({
|
||||
Id: value.Id,
|
||||
fromid: value.fromid,
|
||||
jogviszonycount: value.jogviszonycount,
|
||||
jogviszonyids: value.jogviszonyids,
|
||||
isVanMentettVegzaradek: value.isVanMentettVegzaradek,
|
||||
isKellFeluletenMegadottZaradekRogzitese: true
|
||||
});
|
||||
});
|
||||
json.ToElements = zaradekRogzitesArray;
|
||||
SaveAtsorolas(json);
|
||||
}
|
||||
|
||||
function SaveAtsorolas(json) {
|
||||
AjaxHelper.DoValidationPost(
|
||||
helper.SaveUrl,
|
||||
formName,
|
||||
json,
|
||||
function () {
|
||||
saveFeedBackOk(helper.SaveAdditionalFunction);
|
||||
},
|
||||
helper.SaveOnErrorFunction
|
||||
);
|
||||
}
|
||||
|
||||
function CheckJogviszonyValidation() {
|
||||
var jogviszonyVizsgalat = $("#IsJogviszonyVizsgalat").val();
|
||||
if (jogviszonyVizsgalat !== undefined) {
|
||||
|
||||
var jogviszonyVege = $('#JogviszonyVege');
|
||||
var jogvMegszuneseJogcimTipusId = $('#JogvMegszuneseJogcimTipusId');
|
||||
|
||||
if (jogviszonyVizsgalat === 'true') {
|
||||
CommonUtils.UpdateRequiredProperies((jogviszonyVege !== undefined && jogviszonyVege !== null && jogviszonyVege.length > 0), '#JogviszonyVege', helper.JogviszonyVegeValidationMessage)
|
||||
CommonUtils.UpdateRequiredProperies((jogvMegszuneseJogcimTipusId !== undefined && jogvMegszuneseJogcimTipusId !== null && jogvMegszuneseJogcimTipusId.length > 0), '#JogvMegszuneseJogcimTipusId', helper.JogvMegszuneseJogcimTipusIdValidationMessage)
|
||||
}
|
||||
else {
|
||||
CommonUtils.UpdateRequiredProperies(false, '#JogviszonyVege', helper.JogviszonyVegeValidationMessage)
|
||||
CommonUtils.UpdateRequiredProperies(false, '#JogvMegszuneseJogcimTipusId', helper.JogvMegszuneseJogcimTipusIdValidationMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return helper;
|
||||
};
|
1091
KretaWeb/Scripts/SDAFullCalendar.js
Normal file
1091
KretaWeb/Scripts/SDAFullCalendar.js
Normal file
File diff suppressed because it is too large
Load diff
36
KretaWeb/Scripts/SearchPanelHelper.js
Normal file
36
KretaWeb/Scripts/SearchPanelHelper.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
var SearchPanelHelper = (function () {
|
||||
var searchPanelHelper = function () {};
|
||||
|
||||
searchPanelHelper.SetSearchComboBoxVisibility = function (
|
||||
comboBoxId,
|
||||
isVisible
|
||||
) {
|
||||
var comboBox = $('#' + comboBoxId);
|
||||
var comboBoxData = KretaComboBoxHelper.getKendoComboBoxData(comboBoxId);
|
||||
if (isVisible) {
|
||||
comboBox.closest('div.searchPanelRow').show();
|
||||
} else {
|
||||
comboBox.closest('div.searchPanelRow').hide();
|
||||
comboBoxData.select(-1);
|
||||
}
|
||||
};
|
||||
|
||||
searchPanelHelper.SetSearchPanelVisibility = function (isVisible) {
|
||||
var sideBarToggleButton = $('li#searchPanelFul');
|
||||
if (isVisible) {
|
||||
$('div.sidebar-container').show();
|
||||
sideBarToggleButton.removeClass('disabled');
|
||||
sideBarToggleButton.off('click');
|
||||
MasterLayout.OpenSideBar(sideBarToggleButton);
|
||||
} else {
|
||||
$('div.sidebar-container').hide();
|
||||
sideBarToggleButton.addClass('disabled');
|
||||
sideBarToggleButton.on('click', function () {
|
||||
MasterLayout.OpenCloseSideBar($(this));
|
||||
});
|
||||
MasterLayout.CloseSideBar(sideBarToggleButton);
|
||||
}
|
||||
};
|
||||
|
||||
return searchPanelHelper;
|
||||
})();
|
102
KretaWeb/Scripts/SessionHandler.js
Normal file
102
KretaWeb/Scripts/SessionHandler.js
Normal file
|
@ -0,0 +1,102 @@
|
|||
var SessionHandler = (function () {
|
||||
var sessionHandler = function () {};
|
||||
|
||||
var interval = 0;
|
||||
var countDownTimer;
|
||||
var timerSpanElement;
|
||||
var timerUrl;
|
||||
var warnTime = 60;
|
||||
var refreshTime = 60;
|
||||
var warningTrigered = false;
|
||||
|
||||
var warnMethod = function () {};
|
||||
var endMethod = function () {};
|
||||
|
||||
sessionHandler.SetTimeSpanElement = function (element) {
|
||||
timerSpanElement = element;
|
||||
};
|
||||
sessionHandler.Url = function (url) {
|
||||
timerUrl = url;
|
||||
};
|
||||
sessionHandler.WarningTime = function (second) {
|
||||
warnTime = second;
|
||||
};
|
||||
sessionHandler.WarnMethod = function (method) {
|
||||
warnMethod = method;
|
||||
};
|
||||
sessionHandler.EndMethod = function (method) {
|
||||
endMethod = method;
|
||||
};
|
||||
sessionHandler.Start = function () {
|
||||
getRemainingTime();
|
||||
};
|
||||
sessionHandler.Clear = function () {
|
||||
resetInterval();
|
||||
};
|
||||
|
||||
function startSessionTimer(duration) {
|
||||
var countDownTimer = 0;
|
||||
var actualTime = duration;
|
||||
resetInterval();
|
||||
interval = setInterval(function () {
|
||||
var minutes = parseInt(actualTime / 60, 10);
|
||||
var seconds = parseInt(actualTime % 60, 10);
|
||||
|
||||
minutes = minutes < 10 ? '0' + minutes : minutes;
|
||||
seconds = seconds < 10 ? '0' + seconds : seconds;
|
||||
setSpanText(minutes, seconds);
|
||||
countDownTimer = countDownTimer + 1;
|
||||
actualTime = duration - countDownTimer;
|
||||
|
||||
if (actualTime < warnTime) {
|
||||
if (!warningTrigered) {
|
||||
getRemainingTime();
|
||||
}
|
||||
} else {
|
||||
warningTrigered = false;
|
||||
}
|
||||
|
||||
if (countDownTimer > refreshTime || actualTime < 1) {
|
||||
getRemainingTime();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function getRemainingTime() {
|
||||
resetInterval();
|
||||
if (typeof timerUrl !== 'undefined') {
|
||||
AjaxHelper.AsyncPingPost(timerUrl, remainingTimeCallback);
|
||||
}
|
||||
}
|
||||
|
||||
function remainingTimeCallback(remainingSeconds) {
|
||||
if (remainingSeconds < 1) {
|
||||
resetInterval();
|
||||
endMethod();
|
||||
return;
|
||||
}
|
||||
if (remainingSeconds < warnTime) {
|
||||
if (!warningTrigered) {
|
||||
warningTrigered = true;
|
||||
warnMethod();
|
||||
}
|
||||
}
|
||||
|
||||
startSessionTimer(remainingSeconds);
|
||||
}
|
||||
|
||||
function resetInterval() {
|
||||
clearInterval(interval);
|
||||
interval = 0;
|
||||
}
|
||||
|
||||
function setSpanText(minutes, seconds) {
|
||||
if (timerSpanElement) {
|
||||
if (timerSpanElement.is('p')) {
|
||||
timerSpanElement.text('(' + minutes + ':' + seconds + ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sessionHandler;
|
||||
})();
|
174
KretaWeb/Scripts/_MasterLayout.js
Normal file
174
KretaWeb/Scripts/_MasterLayout.js
Normal file
|
@ -0,0 +1,174 @@
|
|||
var MasterLayout = (function () {
|
||||
var masterLayout = function () {};
|
||||
|
||||
var layoutModel = null;
|
||||
var poi = {
|
||||
leftSideBarButton: '#layout_leftsidebarButton',
|
||||
leftSideBar: '#layout_slidePanel',
|
||||
organizationName: '#layout_organizationName',
|
||||
organizationName2: '#layout_organizationName2',
|
||||
homeUrl: '#layout_navbar_home',
|
||||
userMenu: '#layout_userMenu',
|
||||
userMenu2: '#layout_userMenu2',
|
||||
userMenuTemplate: '#UserMenuTemplate',
|
||||
sessionTimeCounter: '.usermenu_timer'
|
||||
};
|
||||
|
||||
AjaxHelper.ProgresUrl = UrlHelper.ExtendTime;
|
||||
|
||||
masterLayout.OpenCloseSideBar = function (sender) {
|
||||
toggleSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.OpenSideBar = function (sender) {
|
||||
openSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.CloseSideBar = function (sender) {
|
||||
closeSideBar(sender);
|
||||
};
|
||||
|
||||
masterLayout.LogOut = function () {
|
||||
logOut();
|
||||
};
|
||||
|
||||
function callBackRedirect(data) {
|
||||
window.location.assign(data.Url);
|
||||
}
|
||||
|
||||
function toggleSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
var visible = sideBar.attr('data-open') === 'true';
|
||||
$(toggleButton).removeClass('right left');
|
||||
if (visible) {
|
||||
$('.sidebar-container').addClass('sidebar-open');
|
||||
$('.content-container').addClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'visible');
|
||||
$(toggleButton).addClass('left');
|
||||
sideBar.attr('data-open', 'false');
|
||||
} else {
|
||||
$('.sidebar-container').removeClass('sidebar-open');
|
||||
$('.content-container').removeClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'hidden');
|
||||
$(toggleButton).addClass('right');
|
||||
sideBar.attr('data-open', 'true');
|
||||
}
|
||||
}
|
||||
|
||||
function openSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
$(toggleButton).removeClass('right left');
|
||||
$('.sidebar-container').addClass('sidebar-open');
|
||||
$('.content-container').addClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'visible');
|
||||
$(toggleButton).addClass('left');
|
||||
sideBar.attr('data-open', 'false');
|
||||
}
|
||||
|
||||
function closeSideBar(toggleButton) {
|
||||
var sideBar = $(poi.leftSideBar);
|
||||
$(toggleButton).removeClass('right left');
|
||||
$('.sidebar-container').removeClass('sidebar-open');
|
||||
$('.content-container').removeClass('sidebar-open');
|
||||
$('.sb-elements').css('visibility', 'hidden');
|
||||
$(toggleButton).addClass('right');
|
||||
sideBar.attr('data-open', 'true');
|
||||
}
|
||||
|
||||
function initLayoutPage(data) {
|
||||
layoutModel = data;
|
||||
$(poi.organizationName).text(layoutModel.OrganizationName);
|
||||
$(poi.organizationName2).text(layoutModel.OrganizationName);
|
||||
$(poi.homeUrl).prop('href', layoutModel.HomePageUrl);
|
||||
$(poi.userMenuTemplate).tmpl(layoutModel.UserMenu).appendTo(poi.userMenu);
|
||||
$(poi.userMenuTemplate).tmpl(layoutModel.UserMenu).appendTo(poi.userMenu2);
|
||||
|
||||
searchPanelGlobalChangeEvent();
|
||||
toggleSideBar($(poi.leftSideBarButton));
|
||||
|
||||
initCountDown();
|
||||
}
|
||||
|
||||
masterLayout.searchWithEnter = false;
|
||||
|
||||
function searchPanelGlobalChangeEvent() {
|
||||
var searchpanel = $('#layout_SearchPanelContainer');
|
||||
if (searchpanel.length < 1) {
|
||||
return;
|
||||
}
|
||||
var gridname = searchpanel.attr('data-gridId');
|
||||
var serchpanelItems = searchpanel.find('input');
|
||||
serchpanelItems.unbind('change.Kreta');
|
||||
serchpanelItems.bind('change.Kreta', function () {
|
||||
if (masterLayout.searchWithEnter) {
|
||||
masterLayout.searchWithEnter = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var offset = $('.content-container').offset();
|
||||
$('#' + gridname).addClass('disabledGrid');
|
||||
var popupNotification = $('#popupNotification').data('kendoNotification');
|
||||
if (popupNotification) {
|
||||
popupNotification.hide();
|
||||
popupNotification.setOptions({
|
||||
position: {
|
||||
top: offset.top,
|
||||
left: offset.left,
|
||||
right: 15
|
||||
},
|
||||
width: $('.content-container').width() + 38
|
||||
});
|
||||
popupNotification.show(Globalization.KeresesFigyelmeztetes, 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function logOut() {
|
||||
if (GlobalSystemParams.IdpLoginEnabled) {
|
||||
location.href = UrlHelper.LogOutPath;
|
||||
} else {
|
||||
AjaxHelper.DoPost(UrlHelper.LogOutPath, undefined, callBackRedirect);
|
||||
}
|
||||
}
|
||||
|
||||
function initCountDown() {
|
||||
SessionHandler.SetTimeSpanElement($(poi.sessionTimeCounter));
|
||||
SessionHandler.Url(UrlHelper.RemainingTime);
|
||||
SessionHandler.WarnMethod(timeOutWarn);
|
||||
SessionHandler.EndMethod(timeOut);
|
||||
SessionHandler.Start();
|
||||
}
|
||||
|
||||
function timeOutWarn() {
|
||||
if ($('div[name=timeOutWarn]').length > 0) return;
|
||||
KretaWindowHelper.warningWindow(
|
||||
Globalization.Figyelem + '!',
|
||||
Globalization.MunkamenetLejar,
|
||||
refreshTimeOut,
|
||||
'timeOutWarn',
|
||||
null,
|
||||
Globalization.Rendben
|
||||
);
|
||||
}
|
||||
|
||||
function refreshTimeOut() {
|
||||
SessionHandler.Clear();
|
||||
AjaxHelper.DoPost(UrlHelper.ExtendTime, null, function () {
|
||||
SessionHandler.Start();
|
||||
});
|
||||
}
|
||||
|
||||
function timeOut() {
|
||||
logOut();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
AjaxHelper.DoPost(
|
||||
UrlHelper.GetLayoutInformationPath,
|
||||
{ url: UrlHelper.CurrentControlPath },
|
||||
initLayoutPage
|
||||
);
|
||||
});
|
||||
|
||||
return masterLayout;
|
||||
})();
|
512
KretaWeb/Scripts/jquery-serializeObject.js
vendored
Normal file
512
KretaWeb/Scripts/jquery-serializeObject.js
vendored
Normal file
|
@ -0,0 +1,512 @@
|
|||
/**
|
||||
* Copyright (c) 2010 Maxim Vasiliev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author Maxim Vasiliev
|
||||
* Date: 09.09.2010
|
||||
* Time: 19:02:33
|
||||
*/
|
||||
|
||||
(function (root, factory) {
|
||||
if (
|
||||
typeof exports !== 'undefined' &&
|
||||
typeof module !== 'undefined' &&
|
||||
module.exports
|
||||
) {
|
||||
// NodeJS
|
||||
module.exports = factory();
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(factory);
|
||||
} else {
|
||||
// Browser globals
|
||||
root.form2js = factory();
|
||||
}
|
||||
})(this, function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Returns form values represented as Javascript object
|
||||
* "name" attribute defines structure of resulting object
|
||||
*
|
||||
* @param rootNode {Element|String} root form element (or it's id) or array of root elements
|
||||
* @param delimiter {String} structure parts delimiter defaults to '.'
|
||||
* @param skipEmpty {Boolean} should skip empty text values, defaults to true
|
||||
* @param nodeCallback {Function} custom function to get node value
|
||||
* @param useIdIfEmptyName {Boolean} if true value of id attribute of field will be used if name of field is empty
|
||||
*/
|
||||
function form2js(
|
||||
rootNode,
|
||||
delimiter,
|
||||
skipEmpty,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
) {
|
||||
getDisabled = getDisabled ? true : false;
|
||||
if (typeof skipEmpty === 'undefined' || skipEmpty == null) skipEmpty = true;
|
||||
if (typeof delimiter === 'undefined' || delimiter == null) delimiter = '.';
|
||||
if (arguments.length < 5) useIdIfEmptyName = false;
|
||||
|
||||
rootNode =
|
||||
typeof rootNode == 'string'
|
||||
? document.getElementById(rootNode)
|
||||
: rootNode;
|
||||
|
||||
var formValues = [],
|
||||
currNode,
|
||||
i = 0;
|
||||
|
||||
/* If rootNode is array - combine values */
|
||||
if (
|
||||
rootNode.constructor == Array ||
|
||||
(typeof NodeList !== 'undefined' && rootNode.constructor == NodeList)
|
||||
) {
|
||||
while ((currNode = rootNode[i++])) {
|
||||
formValues = formValues.concat(
|
||||
getFormValues(currNode, nodeCallback, useIdIfEmptyName, getDisabled)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
formValues = getFormValues(
|
||||
rootNode,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
);
|
||||
}
|
||||
|
||||
return processNameValues(formValues, skipEmpty, delimiter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes collection of { name: 'name', value: 'value' } objects.
|
||||
* @param nameValues
|
||||
* @param skipEmpty if true skips elements with value == '' or value == null
|
||||
* @param delimiter
|
||||
*/
|
||||
function processNameValues(nameValues, skipEmpty, delimiter) {
|
||||
var result = {},
|
||||
arrays = {},
|
||||
i,
|
||||
j,
|
||||
k,
|
||||
l,
|
||||
value,
|
||||
nameParts,
|
||||
currResult,
|
||||
arrNameFull,
|
||||
arrName,
|
||||
arrIdx,
|
||||
namePart,
|
||||
name,
|
||||
_nameParts;
|
||||
|
||||
for (i = 0; i < nameValues.length; i++) {
|
||||
value = nameValues[i].value;
|
||||
|
||||
if (skipEmpty && (value === '' || value === null)) continue;
|
||||
|
||||
name = nameValues[i].name;
|
||||
_nameParts = name.split(delimiter);
|
||||
nameParts = [];
|
||||
currResult = result;
|
||||
arrNameFull = '';
|
||||
|
||||
for (j = 0; j < _nameParts.length; j++) {
|
||||
namePart = _nameParts[j].split('][');
|
||||
if (namePart.length > 1) {
|
||||
for (k = 0; k < namePart.length; k++) {
|
||||
if (k == 0) {
|
||||
namePart[k] = namePart[k] + ']';
|
||||
} else if (k == namePart.length - 1) {
|
||||
namePart[k] = '[' + namePart[k];
|
||||
} else {
|
||||
namePart[k] = '[' + namePart[k] + ']';
|
||||
}
|
||||
|
||||
arrIdx = namePart[k].match(/([a-z_]+)?\[([a-z_][a-z0-9_]+?)\]/i);
|
||||
if (arrIdx) {
|
||||
for (l = 1; l < arrIdx.length; l++) {
|
||||
if (arrIdx[l]) nameParts.push(arrIdx[l]);
|
||||
}
|
||||
} else {
|
||||
nameParts.push(namePart[k]);
|
||||
}
|
||||
}
|
||||
} else nameParts = nameParts.concat(namePart);
|
||||
}
|
||||
|
||||
for (j = 0; j < nameParts.length; j++) {
|
||||
namePart = nameParts[j];
|
||||
|
||||
if (namePart.indexOf('[]') > -1 && j == nameParts.length - 1) {
|
||||
arrName = namePart.substr(0, namePart.indexOf('['));
|
||||
arrNameFull += arrName;
|
||||
|
||||
if (!currResult[arrName]) currResult[arrName] = [];
|
||||
currResult[arrName].push(value);
|
||||
} else if (namePart.indexOf('[') > -1) {
|
||||
arrName = namePart.substr(0, namePart.indexOf('['));
|
||||
arrIdx = namePart.replace(/(^([a-z_]+)?\[)|(\]$)/gi, '');
|
||||
|
||||
/* Unique array name */
|
||||
arrNameFull += '_' + arrName + '_' + arrIdx;
|
||||
|
||||
/*
|
||||
* Because arrIdx in field name can be not zero-based and step can be
|
||||
* other than 1, we can't use them in target array directly.
|
||||
* Instead we're making a hash where key is arrIdx and value is a reference to
|
||||
* added array element
|
||||
*/
|
||||
|
||||
if (!arrays[arrNameFull]) arrays[arrNameFull] = {};
|
||||
if (arrName != '' && !currResult[arrName]) currResult[arrName] = [];
|
||||
|
||||
if (j == nameParts.length - 1) {
|
||||
if (arrName == '') {
|
||||
currResult.push(value);
|
||||
arrays[arrNameFull][arrIdx] = currResult[currResult.length - 1];
|
||||
} else {
|
||||
currResult[arrName].push(value);
|
||||
arrays[arrNameFull][arrIdx] =
|
||||
currResult[arrName][currResult[arrName].length - 1];
|
||||
}
|
||||
} else {
|
||||
if (!arrays[arrNameFull][arrIdx]) {
|
||||
if (/^[0-9a-z_]+\[?/i.test(nameParts[j + 1]))
|
||||
currResult[arrName].push({});
|
||||
else currResult[arrName].push([]);
|
||||
|
||||
arrays[arrNameFull][arrIdx] =
|
||||
currResult[arrName][currResult[arrName].length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
currResult = arrays[arrNameFull][arrIdx];
|
||||
} else {
|
||||
arrNameFull += namePart;
|
||||
|
||||
if (j < nameParts.length - 1) {
|
||||
/* Not the last part of name - means object */ if (
|
||||
!currResult[namePart]
|
||||
)
|
||||
currResult[namePart] = {};
|
||||
currResult = currResult[namePart];
|
||||
} else {
|
||||
currResult[namePart] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getFormValues(
|
||||
rootNode,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
) {
|
||||
var result = extractNodeValues(
|
||||
rootNode,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
);
|
||||
return result.length > 0
|
||||
? result
|
||||
: getSubFormValues(rootNode, nodeCallback, useIdIfEmptyName, getDisabled);
|
||||
}
|
||||
|
||||
function getSubFormValues(
|
||||
rootNode,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
) {
|
||||
var result = [],
|
||||
currentNode = rootNode.firstChild;
|
||||
|
||||
while (currentNode) {
|
||||
result = result.concat(
|
||||
extractNodeValues(
|
||||
currentNode,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
)
|
||||
);
|
||||
currentNode = currentNode.nextSibling;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function extractNodeValues(
|
||||
node,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
) {
|
||||
if (node.disabled && !getDisabled) return [];
|
||||
|
||||
var callbackResult,
|
||||
fieldValue,
|
||||
result,
|
||||
fieldName = getFieldName(node, useIdIfEmptyName);
|
||||
|
||||
callbackResult = nodeCallback && nodeCallback(node);
|
||||
|
||||
if (callbackResult && callbackResult.name) {
|
||||
result = [callbackResult];
|
||||
} else if (fieldName != '' && node.nodeName.match(/INPUT|TEXTAREA/i)) {
|
||||
fieldValue = getFieldValue(node, getDisabled);
|
||||
if (null === fieldValue) {
|
||||
result = [];
|
||||
} else {
|
||||
result = [{ name: fieldName, value: fieldValue }];
|
||||
}
|
||||
} else if (fieldName != '' && node.nodeName.match(/SELECT/i)) {
|
||||
fieldValue = getFieldValue(node, getDisabled);
|
||||
result = [{ name: fieldName.replace(/\[\]$/, ''), value: fieldValue }];
|
||||
} else {
|
||||
result = getSubFormValues(
|
||||
node,
|
||||
nodeCallback,
|
||||
useIdIfEmptyName,
|
||||
getDisabled
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getFieldName(node, useIdIfEmptyName) {
|
||||
if (node.name && node.name != '') return node.name;
|
||||
else if (useIdIfEmptyName && node.id && node.id != '') return node.id;
|
||||
else return '';
|
||||
}
|
||||
|
||||
function htmlEscape(text) {
|
||||
if (!text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
// Matching minden elemre, ami < és > között van.
|
||||
// Capture groupba a < és > közötti tartalom kerül, így csak a relációs jelek cserélődnek le.
|
||||
return text.replace(/<([\w\W]+?)>/g, '$lt;$1$gt;');
|
||||
}
|
||||
|
||||
function getFieldValue(fieldNode, getDisabled) {
|
||||
if (fieldNode.disabled && !getDisabled) return null;
|
||||
|
||||
switch (fieldNode.nodeName) {
|
||||
case 'INPUT':
|
||||
case 'TEXTAREA':
|
||||
switch (fieldNode.type.toLowerCase()) {
|
||||
case 'radio':
|
||||
if (fieldNode.checked && fieldNode.value === 'false') return false;
|
||||
case 'checkbox':
|
||||
if (fieldNode.checked && fieldNode.value === 'true') return true;
|
||||
if (!fieldNode.checked && fieldNode.value === 'true') return false;
|
||||
if (fieldNode.checked) return fieldNode.value;
|
||||
break;
|
||||
case 'hidden':
|
||||
var chk = $(
|
||||
'form input[type=checkbox][name="' + fieldNode.name + '"]'
|
||||
);
|
||||
if (chk.length > 0) {
|
||||
return chk.prop('checked');
|
||||
} else {
|
||||
return fieldNode.value;
|
||||
}
|
||||
break;
|
||||
case 'button':
|
||||
case 'reset':
|
||||
case 'submit':
|
||||
case 'image':
|
||||
return '';
|
||||
break;
|
||||
case 'textarea':
|
||||
if ($.inArray('htmlEditor', fieldNode.classList) !== -1) {
|
||||
return fieldNode.value;
|
||||
} else {
|
||||
return htmlEscape(fieldNode.value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return htmlEscape(fieldNode.value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'SELECT':
|
||||
return getSelectedOptionValue(fieldNode);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function getSelectedOptionValue(selectNode) {
|
||||
var multiple = selectNode.multiple,
|
||||
result = [],
|
||||
options,
|
||||
i,
|
||||
l;
|
||||
|
||||
if (!multiple) return selectNode.value;
|
||||
|
||||
for (
|
||||
options = selectNode.getElementsByTagName('option'),
|
||||
i = 0,
|
||||
l = options.length;
|
||||
i < l;
|
||||
i++
|
||||
) {
|
||||
if (options[i].selected) result.push(options[i].value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return form2js;
|
||||
});
|
||||
|
||||
/**
|
||||
* Copyright (c) 2010 Maxim Vasiliev
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* @author Maxim Vasiliev
|
||||
* Date: 29.06.11
|
||||
* Time: 20:09
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
/**
|
||||
* jQuery wrapper for form2object()
|
||||
* Extracts data from child inputs into javascript object
|
||||
*/
|
||||
$.fn.toObject = function (options) {
|
||||
var result = [],
|
||||
settings = {
|
||||
mode: 'first', // what to convert: 'all' or 'first' matched node
|
||||
delimiter: '.',
|
||||
skipEmpty: true,
|
||||
nodeCallback: null,
|
||||
useIdIfEmptyName: false,
|
||||
getDisabled: false
|
||||
};
|
||||
|
||||
if (options) {
|
||||
$.extend(settings, options);
|
||||
}
|
||||
|
||||
switch (settings.mode) {
|
||||
case 'first':
|
||||
return form2js(
|
||||
this.get(0),
|
||||
settings.delimiter,
|
||||
settings.skipEmpty,
|
||||
settings.nodeCallback,
|
||||
settings.useIdIfEmptyName,
|
||||
settings.getDisabled
|
||||
);
|
||||
break;
|
||||
case 'all':
|
||||
this.each(function () {
|
||||
result.push(
|
||||
form2js(
|
||||
this,
|
||||
settings.delimiter,
|
||||
settings.skipEmpty,
|
||||
settings.nodeCallback,
|
||||
settings.useIdIfEmptyName,
|
||||
settings.getDisabled
|
||||
)
|
||||
);
|
||||
});
|
||||
return result;
|
||||
break;
|
||||
case 'combine':
|
||||
return form2js(
|
||||
Array.prototype.slice.call(this),
|
||||
settings.delimiter,
|
||||
settings.skipEmpty,
|
||||
settings.nodeCallback,
|
||||
settings.useIdIfEmptyName,
|
||||
settings.getDisabled
|
||||
);
|
||||
break;
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
//Json sorosítani lehet vele a form-t
|
||||
$.fn.serializeObject = function () {
|
||||
var o = {};
|
||||
var a = this.find('input, textarea')
|
||||
.filter(function () {
|
||||
if ($(this).attr('type') == 'hidden') {
|
||||
// filter out those with checked checkboxes
|
||||
var name = $(this).attr('name');
|
||||
return !$('form input[type=checkbox][name="' + name + '"]').prop(
|
||||
'checked'
|
||||
);
|
||||
} else {
|
||||
// include all other input
|
||||
return true;
|
||||
}
|
||||
})
|
||||
.serializeArray();
|
||||
$.each(a, function () {
|
||||
if (typeof o[this.name] !== 'undefined') {
|
||||
if (!o[this.name].push) {
|
||||
o[this.name] = [o[this.name]];
|
||||
}
|
||||
o[this.name].push(this.value || '');
|
||||
} else {
|
||||
o[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return o;
|
||||
};
|
683
KretaWeb/Scripts/jquery.tmpl.js
Normal file
683
KretaWeb/Scripts/jquery.tmpl.js
Normal file
|
@ -0,0 +1,683 @@
|
|||
/*!
|
||||
* $ Templates Plugin 1.0.4
|
||||
* https://github.com/KanbanSolutions/jquery-tmpl
|
||||
*
|
||||
* Copyright Software Freedom Conservancy, Inc.
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
/*
|
||||
Tags:
|
||||
{%if <condition> %}<action>{%/if%}
|
||||
{%if <condition> %}<action>{%else%}<action>{%/if%}
|
||||
{%if <condition> %}<action>{%elif <condition> %}<action>{%else%}<action>{%/if%}
|
||||
{%each <array_or_object> %}$value, $index{%/each%}
|
||||
{%tmpl <template>%}
|
||||
{%= js call %}
|
||||
{%html js call %}
|
||||
*/
|
||||
(function ($, undefined) {
|
||||
var oldManip = $.fn.domManip,
|
||||
tmplItmAtt = '_tmplitem',
|
||||
newTmplItems = {},
|
||||
wrappedItems = {},
|
||||
appendToTmplItems,
|
||||
topTmplItem = { key: 0, data: {} },
|
||||
itemKey = 0,
|
||||
cloneIndex = 0,
|
||||
stack = [];
|
||||
|
||||
var regex = {
|
||||
sq_escape: /([\\'])/g,
|
||||
sq_unescape: /\\'/g,
|
||||
dq_unescape: /\\\\/g,
|
||||
nl_strip: /[\r\t\n]/g,
|
||||
shortcut_replace: /\$\{([^\}]*)\}/g,
|
||||
lang_parse:
|
||||
/\{\%(\/?)(\w+|.)(?:\(((?:[^\%]|\%(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\%]|\%(?!\}))*?)\))?\s*\%\}/g,
|
||||
old_lang_parse:
|
||||
/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
|
||||
template_anotate: /(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,
|
||||
text_only_template: /^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
|
||||
html_expr: /^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! |\{\%! /,
|
||||
last_word: /\w$/
|
||||
};
|
||||
|
||||
function newTmplItem(options, parentItem, fn, data) {
|
||||
// Returns a template item data structure for a new rendered instance of a template (a 'template item').
|
||||
// The content field is a hierarchical array of strings and nested items (to be
|
||||
// removed and replaced by nodes field of dom elements, once inserted in DOM).
|
||||
var newItem = {
|
||||
data:
|
||||
data || data === 0 || data === false
|
||||
? data
|
||||
: parentItem
|
||||
? parentItem.data
|
||||
: {},
|
||||
_wrap: parentItem ? parentItem._wrap : null,
|
||||
tmpl: null,
|
||||
parent: parentItem || null,
|
||||
nodes: [],
|
||||
calls: tiCalls,
|
||||
nest: tiNest,
|
||||
wrap: tiWrap,
|
||||
html: tiHtml,
|
||||
update: tiUpdate
|
||||
};
|
||||
if (options) {
|
||||
$.extend(newItem, options, { nodes: [], parent: parentItem });
|
||||
}
|
||||
if (fn) {
|
||||
// Build the hierarchical content to be used during insertion into DOM
|
||||
newItem.tmpl = fn;
|
||||
newItem._ctnt =
|
||||
newItem._ctnt ||
|
||||
($.isFunction(newItem.tmpl) && newItem.tmpl($, newItem)) ||
|
||||
fn;
|
||||
newItem.key = ++itemKey;
|
||||
// Keep track of new template item, until it is stored as $ Data on DOM element
|
||||
(stack.length ? wrappedItems : newTmplItems)[itemKey] = newItem;
|
||||
}
|
||||
return newItem;
|
||||
}
|
||||
|
||||
// Override appendTo etc., in order to provide support for targeting multiple elements. (This code would disappear if integrated in jquery core).
|
||||
$.each(
|
||||
{
|
||||
appendTo: 'append',
|
||||
prependTo: 'prepend',
|
||||
insertBefore: 'before',
|
||||
insertAfter: 'after',
|
||||
replaceAll: 'replaceWith'
|
||||
},
|
||||
function (name, original) {
|
||||
$.fn[name] = function (selector) {
|
||||
var ret = [],
|
||||
insert = $(selector),
|
||||
elems,
|
||||
i,
|
||||
l,
|
||||
tmplItems,
|
||||
parent = this.length === 1 && this[0].parentNode;
|
||||
|
||||
appendToTmplItems = newTmplItems || {};
|
||||
if (
|
||||
parent &&
|
||||
parent.nodeType === 11 &&
|
||||
parent.childNodes.length === 1 &&
|
||||
insert.length === 1
|
||||
) {
|
||||
insert[original](this[0]);
|
||||
ret = this;
|
||||
} else {
|
||||
for (i = 0, l = insert.length; i < l; i++) {
|
||||
cloneIndex = i;
|
||||
elems = (i > 0 ? this.clone(true) : this).get();
|
||||
$(insert[i])[original](elems);
|
||||
ret = ret.concat(elems);
|
||||
}
|
||||
cloneIndex = 0;
|
||||
ret = this.pushStack(ret, name, insert.selector);
|
||||
}
|
||||
tmplItems = appendToTmplItems;
|
||||
appendToTmplItems = null;
|
||||
$.tmpl.complete(tmplItems);
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
$.fn.extend({
|
||||
// Use first wrapped element as template markup.
|
||||
// Return wrapped set of template items, obtained by rendering template against data.
|
||||
tmpl: function (data, options, parentItem) {
|
||||
var ret = $.tmpl(this[0], data, options, parentItem);
|
||||
return ret;
|
||||
},
|
||||
|
||||
// Find which rendered template item the first wrapped DOM element belongs to
|
||||
tmplItem: function () {
|
||||
var ret = $.tmplItem(this[0]);
|
||||
return ret;
|
||||
},
|
||||
|
||||
// Consider the first wrapped element as a template declaration, and get the compiled template or store it as a named template.
|
||||
template: function (name) {
|
||||
var ret = $.template(name, this[0]);
|
||||
return ret;
|
||||
},
|
||||
|
||||
domManip: function (args, table, callback, options) {
|
||||
if (args[0] && $.isArray(args[0])) {
|
||||
var dmArgs = $.makeArray(arguments),
|
||||
elems = args[0],
|
||||
elemsLength = elems.length,
|
||||
i = 0,
|
||||
tmplItem;
|
||||
while (
|
||||
i < elemsLength &&
|
||||
!(tmplItem = $.data(elems[i++], 'tmplItem'))
|
||||
) {}
|
||||
if (tmplItem && cloneIndex) {
|
||||
dmArgs[2] = function (fragClone) {
|
||||
// Handler called by oldManip when rendered template has been inserted into DOM.
|
||||
$.tmpl.afterManip(this, fragClone, callback);
|
||||
};
|
||||
}
|
||||
oldManip.apply(this, dmArgs);
|
||||
} else {
|
||||
oldManip.apply(this, arguments);
|
||||
}
|
||||
cloneIndex = 0;
|
||||
if (!appendToTmplItems) {
|
||||
$.tmpl.complete(newTmplItems);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend({
|
||||
// Return wrapped set of template items, obtained by rendering template against data.
|
||||
tmpl: function (tmpl, data, options, parentItem) {
|
||||
var ret,
|
||||
topLevel = !parentItem;
|
||||
if (topLevel) {
|
||||
// This is a top-level tmpl call (not from a nested template using {{tmpl}})
|
||||
parentItem = topTmplItem;
|
||||
tmpl = $.template[tmpl] || $.template(null, tmpl);
|
||||
wrappedItems = {}; // Any wrapped items will be rebuilt, since this is top level
|
||||
} else if (!tmpl) {
|
||||
// The template item is already associated with DOM - this is a refresh.
|
||||
// Re-evaluate rendered template for the parentItem
|
||||
tmpl = parentItem.tmpl;
|
||||
newTmplItems[parentItem.key] = parentItem;
|
||||
parentItem.nodes = [];
|
||||
if (parentItem.wrapped) {
|
||||
updateWrapped(parentItem, parentItem.wrapped);
|
||||
}
|
||||
// Rebuild, without creating a new template item
|
||||
return $(build(parentItem, null, parentItem.tmpl($, parentItem)));
|
||||
}
|
||||
if (!tmpl) {
|
||||
return []; // Could throw...
|
||||
}
|
||||
if (typeof data === 'function') {
|
||||
data = data.call(parentItem || {});
|
||||
}
|
||||
if (options && options.wrapped) {
|
||||
updateWrapped(options, options.wrapped);
|
||||
}
|
||||
ret = $.isArray(data)
|
||||
? $.map(data, function (dataItem) {
|
||||
return dataItem
|
||||
? newTmplItem(options, parentItem, tmpl, dataItem)
|
||||
: null;
|
||||
})
|
||||
: [newTmplItem(options, parentItem, tmpl, data)];
|
||||
return topLevel ? $(build(parentItem, null, ret)) : ret;
|
||||
},
|
||||
|
||||
// Return rendered template item for an element.
|
||||
tmplItem: function (elem) {
|
||||
var tmplItem;
|
||||
if (elem instanceof $) {
|
||||
elem = elem[0];
|
||||
}
|
||||
while (
|
||||
elem &&
|
||||
elem.nodeType === 1 &&
|
||||
!(tmplItem = $.data(elem, 'tmplItem')) &&
|
||||
(elem = elem.parentNode)
|
||||
) {}
|
||||
return tmplItem || topTmplItem;
|
||||
},
|
||||
|
||||
// Set:
|
||||
// Use $.template( name, tmpl ) to cache a named template,
|
||||
// where tmpl is a template string, a script element or a $ instance wrapping a script element, etc.
|
||||
// Use $( "selector" ).template( name ) to provide access by name to a script block template declaration.
|
||||
|
||||
// Get:
|
||||
// Use $.template( name ) to access a cached template.
|
||||
// Also $( selectorToScriptBlock ).template(), or $.template( null, templateString )
|
||||
// will return the compiled template, without adding a name reference.
|
||||
// If templateString includes at least one HTML tag, $.template( templateString ) is equivalent
|
||||
// to $.template( null, templateString )
|
||||
template: function (name, tmpl) {
|
||||
if (tmpl) {
|
||||
// Compile template and associate with name
|
||||
if (typeof tmpl === 'string') {
|
||||
// This is an HTML string being passed directly in.
|
||||
tmpl = buildTmplFn(tmpl);
|
||||
} else if (tmpl instanceof $) {
|
||||
tmpl = tmpl[0] || {};
|
||||
}
|
||||
if (tmpl.nodeType) {
|
||||
// If this is a template block, use cached copy, or generate tmpl function and cache.
|
||||
tmpl =
|
||||
$.data(tmpl, 'tmpl') ||
|
||||
$.data(tmpl, 'tmpl', buildTmplFn(tmpl.innerHTML));
|
||||
// Issue: In IE, if the container element is not a script block, the innerHTML will remove quotes from attribute values whenever the value does not include white space.
|
||||
// This means that foo="${x}" will not work if the value of x includes white space: foo="${x}" -> foo=value of x.
|
||||
// To correct this, include space in tag: foo="${ x }" -> foo="value of x"
|
||||
}
|
||||
return typeof name === 'string' ? ($.template[name] = tmpl) : tmpl;
|
||||
}
|
||||
// Return named compiled template
|
||||
return name
|
||||
? typeof name !== 'string'
|
||||
? $.template(null, name)
|
||||
: $.template[name] ||
|
||||
// If not in map, treat as a selector. (If integrated with core, use quickExpr.exec)
|
||||
$.template(null, name)
|
||||
: null;
|
||||
},
|
||||
|
||||
encode: function (text) {
|
||||
// Do HTML encoding replacing < > & and ' and " by corresponding entities.
|
||||
return ('' + text)
|
||||
.split('<')
|
||||
.join('<')
|
||||
.split('>')
|
||||
.join('>')
|
||||
.split('"')
|
||||
.join('"')
|
||||
.split("'")
|
||||
.join(''');
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.tmpl, {
|
||||
tag: {
|
||||
tmpl: {
|
||||
_default: { $2: 'null' },
|
||||
open: 'if($notnull_1){__=__.concat($item.nest($1,$2));}'
|
||||
// tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions)
|
||||
// This means that {{tmpl foo}} treats foo as a template (which IS a function).
|
||||
// Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}.
|
||||
},
|
||||
wrap: {
|
||||
_default: { $2: 'null' },
|
||||
open: '$item.calls(__,$1,$2);__=[];',
|
||||
close: 'call=$item.calls();__=call._.concat($item.wrap(call,__));'
|
||||
},
|
||||
each: {
|
||||
_default: { $2: '$index, $value' },
|
||||
open: 'if($notnull_1){$.each($1a,function($2){with(this){',
|
||||
close: '}});}'
|
||||
},
|
||||
if: {
|
||||
open: 'if(($notnull_1) && $1a){',
|
||||
close: '}'
|
||||
},
|
||||
else: {
|
||||
open: '}else{'
|
||||
},
|
||||
elif: {
|
||||
open: '}else if(($notnull_1) && $1a){'
|
||||
},
|
||||
elseif: {
|
||||
open: '}else if(($notnull_1) && $1a){'
|
||||
},
|
||||
html: {
|
||||
// Unecoded expression evaluation.
|
||||
open: 'if($notnull_1){__.push($1a);}'
|
||||
},
|
||||
'=': {
|
||||
// Encoded expression evaluation. Abbreviated form is ${}.
|
||||
_default: { $1: '$data' },
|
||||
open: 'if($notnull_1){__.push($.encode($1a));}'
|
||||
},
|
||||
'!': {
|
||||
// Comment tag. Skipped by parser
|
||||
open: ''
|
||||
}
|
||||
},
|
||||
|
||||
// This stub can be overridden, e.g. in jquery.tmplPlus for providing rendered events
|
||||
complete: function (items) {
|
||||
newTmplItems = {};
|
||||
},
|
||||
|
||||
// Call this from code which overrides domManip, or equivalent
|
||||
// Manage cloning/storing template items etc.
|
||||
afterManip: function afterManip(elem, fragClone, callback) {
|
||||
// Provides cloned fragment ready for fixup prior to and after insertion into DOM
|
||||
var content =
|
||||
fragClone.nodeType === 11
|
||||
? $.makeArray(fragClone.childNodes)
|
||||
: fragClone.nodeType === 1
|
||||
? [fragClone]
|
||||
: [];
|
||||
|
||||
// Return fragment to original caller (e.g. append) for DOM insertion
|
||||
callback.call(elem, fragClone);
|
||||
|
||||
// Fragment has been inserted:- Add inserted nodes to tmplItem data structure. Replace inserted element annotations by $.data.
|
||||
storeTmplItems(content);
|
||||
cloneIndex++;
|
||||
}
|
||||
});
|
||||
|
||||
//========================== Private helper functions, used by code above ==========================
|
||||
|
||||
function build(tmplItem, nested, content) {
|
||||
// Convert hierarchical content into flat string array
|
||||
// and finally return array of fragments ready for DOM insertion
|
||||
var frag,
|
||||
ret = content
|
||||
? $.map(content, function (item) {
|
||||
return typeof item === 'string'
|
||||
? // Insert template item annotations, to be converted to $.data( "tmplItem" ) when elems are inserted into DOM.
|
||||
tmplItem.key
|
||||
? item.replace(
|
||||
regex.template_anotate,
|
||||
'$1 ' + tmplItmAtt + '="' + tmplItem.key + '" $2'
|
||||
)
|
||||
: item
|
||||
: // This is a child template item. Build nested template.
|
||||
build(item, tmplItem, item._ctnt);
|
||||
})
|
||||
: // If content is not defined, insert tmplItem directly. Not a template item. May be a string, or a string array, e.g. from {{html $item.html()}}.
|
||||
tmplItem;
|
||||
if (nested) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
// top-level template
|
||||
ret = ret.join('');
|
||||
|
||||
// Support templates which have initial or final text nodes, or consist only of text
|
||||
// Also support HTML entities within the HTML markup.
|
||||
ret.replace(
|
||||
regex.text_only_template,
|
||||
function (all, before, middle, after) {
|
||||
frag = $(middle).get();
|
||||
|
||||
storeTmplItems(frag);
|
||||
if (before) {
|
||||
frag = unencode(before).concat(frag);
|
||||
}
|
||||
if (after) {
|
||||
frag = frag.concat(unencode(after));
|
||||
}
|
||||
}
|
||||
);
|
||||
return frag ? frag : unencode(ret);
|
||||
}
|
||||
|
||||
function unencode(text) {
|
||||
// Use createElement, since createTextNode will not render HTML entities correctly
|
||||
var el = document.createElement('div');
|
||||
el.innerHTML = text;
|
||||
return $.makeArray(el.childNodes);
|
||||
}
|
||||
|
||||
// Generate a reusable function that will serve to render a template against data
|
||||
function buildTmplFn(markup) {
|
||||
var parse_tag = function (all, slash, type, fnargs, target, parens, args) {
|
||||
if (!type) {
|
||||
return "');__.push('";
|
||||
}
|
||||
|
||||
var tag = $.tmpl.tag[type],
|
||||
def,
|
||||
expr,
|
||||
exprAutoFnDetect;
|
||||
if (!tag && window.console && console.group) {
|
||||
console.group('Exception');
|
||||
console.error(markup);
|
||||
console.error('Unknown tag: ', type);
|
||||
console.error(all);
|
||||
console.groupEnd('Exception');
|
||||
}
|
||||
if (!tag) {
|
||||
return "');__.push('";
|
||||
}
|
||||
def = tag._default || [];
|
||||
if (parens && !regex.last_word.test(target)) {
|
||||
target += parens;
|
||||
parens = '';
|
||||
}
|
||||
if (target) {
|
||||
target = unescape(target);
|
||||
args = args ? ',' + unescape(args) + ')' : parens ? ')' : '';
|
||||
// Support for target being things like a.toLowerCase();
|
||||
// In that case don't call with template item as 'this' pointer. Just evaluate...
|
||||
expr = parens
|
||||
? target.indexOf('.') > -1
|
||||
? target + unescape(parens)
|
||||
: '(' + target + ').call($item' + args
|
||||
: target;
|
||||
exprAutoFnDetect = parens
|
||||
? expr
|
||||
: '(typeof(' +
|
||||
target +
|
||||
")==='function'?(" +
|
||||
target +
|
||||
').call($item):(' +
|
||||
target +
|
||||
'))';
|
||||
} else {
|
||||
exprAutoFnDetect = expr = def.$1 || 'null';
|
||||
}
|
||||
fnargs = unescape(fnargs);
|
||||
return (
|
||||
"');" +
|
||||
tag[slash ? 'close' : 'open']
|
||||
.split('$notnull_1')
|
||||
.join(
|
||||
target
|
||||
? 'typeof(' + target + ")!=='undefined' && (" + target + ')!=null'
|
||||
: 'true'
|
||||
)
|
||||
.split('$1a')
|
||||
.join(exprAutoFnDetect)
|
||||
.split('$1')
|
||||
.join(expr)
|
||||
.split('$2')
|
||||
.join(fnargs || def.$2 || '') +
|
||||
"__.push('"
|
||||
);
|
||||
};
|
||||
|
||||
var depreciated_parse = function () {
|
||||
if ($.tmpl.tag[arguments[2]]) {
|
||||
console.group('Depreciated');
|
||||
console.info(markup);
|
||||
console.info(
|
||||
'Markup has old style indicators, use {% %} instead of {{ }}'
|
||||
);
|
||||
console.info(arguments[0]);
|
||||
console.groupEnd('Depreciated');
|
||||
return parse_tag.apply(this, arguments);
|
||||
} else {
|
||||
return "');__.push('{{" + arguments[2] + "}}');__.push('";
|
||||
}
|
||||
};
|
||||
|
||||
// Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
|
||||
// Introduce the data as local variables using with(){}
|
||||
var parsed_markup_data =
|
||||
"var $=$,call,__=[],$data=$item.data; with($data){__.push('";
|
||||
|
||||
// Convert the template into pure JavaScript
|
||||
var parsed_markup = $.trim(markup);
|
||||
parsed_markup = parsed_markup.replace(regex.sq_escape, '\\$1');
|
||||
parsed_markup = parsed_markup.replace(regex.nl_strip, ' ');
|
||||
parsed_markup = parsed_markup.replace(regex.shortcut_replace, '{%= $1%}');
|
||||
parsed_markup = parsed_markup.replace(regex.lang_parse, parse_tag);
|
||||
parsed_markup = parsed_markup.replace(
|
||||
regex.old_lang_parse,
|
||||
depreciated_parse
|
||||
);
|
||||
parsed_markup_data += parsed_markup;
|
||||
|
||||
parsed_markup_data += "');}return __;";
|
||||
|
||||
return new Function('$', '$item', parsed_markup_data);
|
||||
}
|
||||
|
||||
function updateWrapped(options, wrapped) {
|
||||
// Build the wrapped content.
|
||||
options._wrap = build(
|
||||
options,
|
||||
true,
|
||||
// Suport imperative scenario in which options.wrapped can be set to a selector or an HTML string.
|
||||
$.isArray(wrapped)
|
||||
? wrapped
|
||||
: [regex.html_expr.test(wrapped) ? wrapped : $(wrapped).html()]
|
||||
).join('');
|
||||
}
|
||||
|
||||
function unescape(args) {
|
||||
return args
|
||||
? args.replace(regex.sq_unescape, "'").replace(regex.dq_unescape, '\\')
|
||||
: null;
|
||||
}
|
||||
|
||||
function outerHtml(elem) {
|
||||
var div = document.createElement('div');
|
||||
div.appendChild(elem.cloneNode(true));
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
// Store template items in $.data(), ensuring a unique tmplItem data data structure for each rendered template instance.
|
||||
function storeTmplItems(content) {
|
||||
var keySuffix = '_' + cloneIndex,
|
||||
elem,
|
||||
elems,
|
||||
newClonedItems = {},
|
||||
i,
|
||||
l,
|
||||
m;
|
||||
for (i = 0, l = content.length; i < l; i++) {
|
||||
if ((elem = content[i]).nodeType !== 1) {
|
||||
continue;
|
||||
}
|
||||
elems = elem.getElementsByTagName('*');
|
||||
for (m = elems.length - 1; m >= 0; m--) {
|
||||
processItemKey(elems[m]);
|
||||
}
|
||||
processItemKey(elem);
|
||||
}
|
||||
function processItemKey(el) {
|
||||
var pntKey,
|
||||
pntNode = el,
|
||||
pntItem,
|
||||
tmplItem,
|
||||
key;
|
||||
// Ensure that each rendered template inserted into the DOM has its own template item,
|
||||
if ((key = el.getAttribute(tmplItmAtt))) {
|
||||
while (
|
||||
pntNode.parentNode &&
|
||||
(pntNode = pntNode.parentNode).nodeType === 1 &&
|
||||
!(pntKey = pntNode.getAttribute(tmplItmAtt))
|
||||
) {}
|
||||
if (pntKey !== key) {
|
||||
// The next ancestor with a _tmplitem expando is on a different key than this one.
|
||||
// So this is a top-level element within this template item
|
||||
// Set pntNode to the key of the parentNode, or to 0 if pntNode.parentNode is null, or pntNode is a fragment.
|
||||
pntNode = pntNode.parentNode
|
||||
? pntNode.nodeType === 11
|
||||
? 0
|
||||
: pntNode.getAttribute(tmplItmAtt) || 0
|
||||
: 0;
|
||||
if (!(tmplItem = newTmplItems[key])) {
|
||||
// The item is for wrapped content, and was copied from the temporary parent wrappedItem.
|
||||
tmplItem = wrappedItems[key];
|
||||
tmplItem = newTmplItem(
|
||||
tmplItem,
|
||||
newTmplItems[pntNode] || wrappedItems[pntNode]
|
||||
);
|
||||
tmplItem.key = ++itemKey;
|
||||
newTmplItems[itemKey] = tmplItem;
|
||||
}
|
||||
if (cloneIndex) {
|
||||
cloneTmplItem(key);
|
||||
}
|
||||
}
|
||||
el.removeAttribute(tmplItmAtt);
|
||||
} else if (cloneIndex && (tmplItem = $.data(el, 'tmplItem'))) {
|
||||
// This was a rendered element, cloned during append or appendTo etc.
|
||||
// TmplItem stored in $ data has already been cloned in cloneCopyEvent. We must replace it with a fresh cloned tmplItem.
|
||||
cloneTmplItem(tmplItem.key);
|
||||
newTmplItems[tmplItem.key] = tmplItem;
|
||||
pntNode = $.data(el.parentNode, 'tmplItem');
|
||||
pntNode = pntNode ? pntNode.key : 0;
|
||||
}
|
||||
if (tmplItem) {
|
||||
pntItem = tmplItem;
|
||||
// Find the template item of the parent element.
|
||||
// (Using !=, not !==, since pntItem.key is number, and pntNode may be a string)
|
||||
while (pntItem && pntItem.key != pntNode) {
|
||||
// Add this element as a top-level node for this rendered template item, as well as for any
|
||||
// ancestor items between this item and the item of its parent element
|
||||
pntItem.nodes.push(el);
|
||||
pntItem = pntItem.parent;
|
||||
}
|
||||
// Delete content built during rendering - reduce API surface area and memory use, and avoid exposing of stale data after rendering...
|
||||
delete tmplItem._ctnt;
|
||||
delete tmplItem._wrap;
|
||||
// Store template item as $ data on the element
|
||||
$.data(el, 'tmplItem', tmplItem);
|
||||
}
|
||||
function cloneTmplItem(key) {
|
||||
key = key + keySuffix;
|
||||
tmplItem = newClonedItems[key] =
|
||||
newClonedItems[key] ||
|
||||
newTmplItem(
|
||||
tmplItem,
|
||||
newTmplItems[tmplItem.parent.key + keySuffix] || tmplItem.parent
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---- Helper functions for template item ----
|
||||
|
||||
function tiCalls(content, tmpl, data, options) {
|
||||
if (!content) {
|
||||
return stack.pop();
|
||||
}
|
||||
stack.push({
|
||||
_: content,
|
||||
tmpl: tmpl,
|
||||
item: this,
|
||||
data: data,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
function tiNest(tmpl, data, options) {
|
||||
// nested template, using {{tmpl}} tag
|
||||
return $.tmpl($.template(tmpl), data, options, this);
|
||||
}
|
||||
|
||||
function tiWrap(call, wrapped) {
|
||||
// nested template, using {{wrap}} tag
|
||||
var options = call.options || {};
|
||||
options.wrapped = wrapped;
|
||||
// Apply the template, which may incorporate wrapped content,
|
||||
return $.tmpl($.template(call.tmpl), call.data, options, call.item);
|
||||
}
|
||||
|
||||
function tiHtml(filter, textOnly) {
|
||||
var wrapped = this._wrap;
|
||||
return $.map(
|
||||
$($.isArray(wrapped) ? wrapped.join('') : wrapped).filter(filter || '*'),
|
||||
function (e) {
|
||||
return textOnly
|
||||
? e.innerText || e.textContent
|
||||
: e.outerHTML || outerHtml(e);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function tiUpdate() {
|
||||
var coll = this.nodes;
|
||||
$.tmpl(null, null, null, this).insertBefore(coll[0]);
|
||||
$(coll).remove();
|
||||
}
|
||||
})(jQuery);
|
253
KretaWeb/Scripts/mvcfoolproof.unobtrusive.js
Normal file
253
KretaWeb/Scripts/mvcfoolproof.unobtrusive.js
Normal file
|
@ -0,0 +1,253 @@
|
|||
var foolproof = function () {};
|
||||
foolproof.is = function (value1, operator, value2, passOnNull) {
|
||||
if (passOnNull) {
|
||||
var isNullish = function (input) {
|
||||
return input == null || typeof input === 'undefined' || input == '';
|
||||
};
|
||||
|
||||
var value1nullish = isNullish(value1);
|
||||
var value2nullish = isNullish(value2);
|
||||
|
||||
if ((value1nullish && !value2nullish) || (value2nullish && !value1nullish))
|
||||
return true;
|
||||
}
|
||||
|
||||
var isNumeric = function (input) {
|
||||
return input - 0 == input && input.length > 0;
|
||||
};
|
||||
|
||||
var isDate = function (input) {
|
||||
var dateTest = new RegExp(
|
||||
/(?=\d)^(?:(?!(?:10\D(?:0?[5-9]|1[0-4])\D(?:1582))|(?:0?9\D(?:0?[3-9]|1[0-3])\D(?:1752)))((?:0?[13578]|1[02])|(?:0?[469]|11)(?!\/31)(?!-31)(?!\.31)|(?:0?2(?=.?(?:(?:29.(?!000[04]|(?:(?:1[^0-6]|[2468][^048]|[3579][^26])00))(?:(?:(?:\d\d)(?:[02468][048]|[13579][26])(?!\x20BC))|(?:00(?:42|3[0369]|2[147]|1[258]|09)\x20BC))))))|(?:0?2(?=.(?:(?:\d\D)|(?:[01]\d)|(?:2[0-8])))))([-.\/])(0?[1-9]|[12]\d|3[01])\2(?!0000)((?=(?:00(?:4[0-5]|[0-3]?\d)\x20BC)|(?:\d{4}(?!\x20BC)))\d{4}(?:\x20BC)?)(?:$|(?=\x20\d)\x20))?((?:(?:0?[1-9]|1[012])(?::[0-5]\d){0,2}(?:\x20[aApP][mM]))|(?:[01]\d|2[0-3])(?::[0-5]\d){1,2})?$/
|
||||
);
|
||||
|
||||
return dateTest.test(input);
|
||||
};
|
||||
|
||||
var isBool = function (input) {
|
||||
return (
|
||||
input === true || input === false || input === 'true' || input === 'false'
|
||||
);
|
||||
};
|
||||
|
||||
if (isDate(value1)) {
|
||||
value1 = Date.parse(value1);
|
||||
value2 = Date.parse(value2);
|
||||
} else if (isBool(value1)) {
|
||||
if (value1 == 'false') value1 = false;
|
||||
if (value2 == 'false') value2 = false;
|
||||
value1 = !!value1;
|
||||
value2 = !!value2;
|
||||
} else if (isNumeric(value1)) {
|
||||
value1 = parseFloat(value1);
|
||||
value2 = parseFloat(value2);
|
||||
}
|
||||
|
||||
switch (operator) {
|
||||
case 'EqualTo':
|
||||
if (value1 == value2) return true;
|
||||
break;
|
||||
case 'NotEqualTo':
|
||||
if (value1 != value2) return true;
|
||||
break;
|
||||
case 'GreaterThan':
|
||||
if (value1 > value2) return true;
|
||||
break;
|
||||
case 'LessThan':
|
||||
if (value1 < value2) return true;
|
||||
break;
|
||||
case 'GreaterThanOrEqualTo':
|
||||
if (value1 >= value2) return true;
|
||||
break;
|
||||
case 'LessThanOrEqualTo':
|
||||
if (value1 <= value2) return true;
|
||||
break;
|
||||
case 'RegExMatch':
|
||||
return new RegExp(value2).test(value1);
|
||||
break;
|
||||
case 'NotRegExMatch':
|
||||
return !new RegExp(value2).test(value1);
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
foolproof.getId = function (element, dependentPropety) {
|
||||
var pos = element.id.lastIndexOf('_') + 1;
|
||||
return element.id.substr(0, pos) + dependentPropety.replace(/\./g, '_');
|
||||
};
|
||||
|
||||
foolproof.getName = function (element, dependentPropety) {
|
||||
var pos = element.name.lastIndexOf('.') + 1;
|
||||
return element.name.substr(0, pos) + dependentPropety;
|
||||
};
|
||||
|
||||
(function () {
|
||||
jQuery.validator.addMethod('is', function (value, element, params) {
|
||||
var dependentProperty = foolproof.getId(
|
||||
element,
|
||||
params['dependentproperty']
|
||||
);
|
||||
var operator = params['operator'];
|
||||
var passOnNull = params['passonnull'];
|
||||
var dependentValue = document.getElementById(dependentProperty).value;
|
||||
|
||||
if (foolproof.is(value, operator, dependentValue, passOnNull)) return true;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery.validator.addMethod('requiredif', function (value, element, params) {
|
||||
var dependentProperty = foolproof.getName(
|
||||
element,
|
||||
params['dependentproperty']
|
||||
);
|
||||
var dependentTestValue = params['dependentvalue'];
|
||||
var operator = params['operator'];
|
||||
var pattern = params['pattern'];
|
||||
var dependentPropertyElement =
|
||||
document.getElementsByName(dependentProperty);
|
||||
var dependentValue = null;
|
||||
|
||||
if (dependentPropertyElement.length > 1) {
|
||||
for (var index = 0; index != dependentPropertyElement.length; index++)
|
||||
if (dependentPropertyElement[index]['checked']) {
|
||||
dependentValue = dependentPropertyElement[index].value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dependentValue == null) dependentValue = false;
|
||||
} else dependentValue = dependentPropertyElement[0].value;
|
||||
|
||||
if (foolproof.is(dependentValue, operator, dependentTestValue)) {
|
||||
if (pattern == null) {
|
||||
if (
|
||||
value != null &&
|
||||
value
|
||||
.toString()
|
||||
.replace(/^\s\s*/, '')
|
||||
.replace(/\s\s*$/, '') != ''
|
||||
)
|
||||
return true;
|
||||
} else return new RegExp(pattern).test(value);
|
||||
} else return true;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery.validator.addMethod(
|
||||
'requiredifempty',
|
||||
function (value, element, params) {
|
||||
var dependentProperty = foolproof.getId(
|
||||
element,
|
||||
params['dependentproperty']
|
||||
);
|
||||
var dependentValue = document.getElementById(dependentProperty).value;
|
||||
|
||||
if (
|
||||
dependentValue == null ||
|
||||
dependentValue
|
||||
.toString()
|
||||
.replace(/^\s\s*/, '')
|
||||
.replace(/\s\s*$/, '') == ''
|
||||
) {
|
||||
if (
|
||||
value != null &&
|
||||
value
|
||||
.toString()
|
||||
.replace(/^\s\s*/, '')
|
||||
.replace(/\s\s*$/, '') != ''
|
||||
)
|
||||
return true;
|
||||
} else return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
jQuery.validator.addMethod(
|
||||
'requiredifnotempty',
|
||||
function (value, element, params) {
|
||||
var dependentProperty = foolproof.getId(
|
||||
element,
|
||||
params['dependentproperty']
|
||||
);
|
||||
var dependentValue = document.getElementById(dependentProperty).value;
|
||||
|
||||
if (
|
||||
dependentValue != null &&
|
||||
dependentValue
|
||||
.toString()
|
||||
.replace(/^\s\s*/, '')
|
||||
.replace(/\s\s*$/, '') != ''
|
||||
) {
|
||||
if (
|
||||
value != null &&
|
||||
value
|
||||
.toString()
|
||||
.replace(/^\s\s*/, '')
|
||||
.replace(/\s\s*$/, '') != ''
|
||||
)
|
||||
return true;
|
||||
} else return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
var setValidationValues = function (options, ruleName, value) {
|
||||
options.rules[ruleName] = value;
|
||||
if (options.message) {
|
||||
options.messages[ruleName] = options.message;
|
||||
}
|
||||
};
|
||||
|
||||
var $Unob = $.validator.unobtrusive;
|
||||
|
||||
$Unob.adapters.add(
|
||||
'requiredif',
|
||||
['dependentproperty', 'dependentvalue', 'operator', 'pattern'],
|
||||
function (options) {
|
||||
var value = {
|
||||
dependentproperty: options.params.dependentproperty,
|
||||
dependentvalue: options.params.dependentvalue,
|
||||
operator: options.params.operator,
|
||||
pattern: options.params.pattern
|
||||
};
|
||||
setValidationValues(options, 'requiredif', value);
|
||||
}
|
||||
);
|
||||
|
||||
$Unob.adapters.add(
|
||||
'is',
|
||||
['dependentproperty', 'operator', 'passonnull'],
|
||||
function (options) {
|
||||
setValidationValues(options, 'is', {
|
||||
dependentproperty: options.params.dependentproperty,
|
||||
operator: options.params.operator,
|
||||
passonnull: options.params.passonnull
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$Unob.adapters.add(
|
||||
'requiredifempty',
|
||||
['dependentproperty'],
|
||||
function (options) {
|
||||
setValidationValues(options, 'requiredifempty', {
|
||||
dependentproperty: options.params.dependentproperty
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
$Unob.adapters.add(
|
||||
'requiredifnotempty',
|
||||
['dependentproperty'],
|
||||
function (options) {
|
||||
setValidationValues(options, 'requiredifnotempty', {
|
||||
dependentproperty: options.params.dependentproperty
|
||||
});
|
||||
}
|
||||
);
|
||||
})();
|
3
KretaWeb/Scripts/setMomentLocaleToHu.js
Normal file
3
KretaWeb/Scripts/setMomentLocaleToHu.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
//NOTE: A moment.js default locale-ja 'en' ezt nem állítjuk sehol viszont néhány helyen a hu.min.js meghívása maitt magyarra vált
|
||||
//ha e nélkül loadoljuk a momentet.js-t a locale 'en'-re vált és hibás működést fog eredményezni.
|
||||
(moment.defineLocale || moment.lang).call(moment, 'hu', {});
|
Loading…
Add table
Add a link
Reference in a new issue