function open_drawer(drawer_name) {
$("#drawer_button_icon_1").hide();
$("#drawer_button_icon_2").show();
$("#drawer_button").css("background", "#d0e7ba");
setTimeout(function() {
$("#drawer_button_icon_1").show();
$("#drawer_button_icon_2").hide();
$("#drawer_button").css("background", "none");
}, 3000);
$.ajax({
type: "GET",
url: "http://source.tiss.sk/elcom/",
data: "set=" + drawer_name,
success: function(msg){
}
});
}
function toggle_settings(code) {
$.ajax({
type: "GET",
url: "sub_pages/system/settings_toggle.php",
data: "code=" + code,
success: function(msg){
alert(trans("Zmena tohto nastavenia sa ostatným prihláseným používateľom prejaví až po odhlásení a prihlásení!"));
location.reload();
}
});
}
function checkemail(str){
var filter=/^.+@.+\..{2,3}$/
if(filter.test(str)) testresults = true;
else {
testresults = false;
}
return (testresults);
}
function validate_email_user() {
if(checkemail($("#email_user_home").val())) {
return true;
}
else {
$("#email_user_home_warning").show();
return false;
}
}
function how_to_contact_change(id) {
$(".how_to_contact_button").each(function() {
if(parseInt($(this).data("id")) == parseInt(id) && $("input[name=how_to_contact_save]").val() != id) {
$(this).removeClass("btn-default");
$(this).addClass("btn-info");
}
else {
$(this).removeClass("btn-info");
$(this).addClass("btn-default");
}
})
if($("input[name=how_to_contact_save]").val() == id) {
$("input[name=how_to_contact_save]").val("");
}
else {
$("input[name=how_to_contact_save]").val(id);
}
}
function how_to_contact_change_in_order(id_client, id) {
$(".how_to_contact_button_" + id_client).fadeTo("fast", 0.2);
$(".how_to_contact_loading_" + id_client).show();
$(".how_to_contact_button_" + id_client).each(function() {
if(parseInt($(this).data("id")) == parseInt(id) && $("input[name=how_to_contact_save]").val() != id) {
$(this).removeClass("btn-default");
$(this).addClass("btn-info");
}
else {
$(this).removeClass("btn-info");
$(this).addClass("btn-default");
}
})
if($("input[name=how_to_contact_save]").val() == id) {
$("input[name=how_to_contact_save]").val("");
}
else {
$("input[name=how_to_contact_save]").val(id);
}
$.ajax({
type: "GET",
url: "sub_pages/clients/ajax/client_how_to_contact_save.php",
data: "id_client=" + id_client + "&id=" + $("input[name=how_to_contact_save]").val(),
success: function(msg){
$(".how_to_contact_loading_" + id_client).hide();
$(".how_to_contact_button_" + id_client).fadeTo("fast", 1);
}
});
}
function preaccount_change_in_order(id_product_used, preaccount) {
$(".preaccount_" + id_product_used).fadeTo("fast", 0.2);
$(".preaccount_" + id_product_used).each(function() {
if($(this).data("id") == preaccount) {
$(this).removeClass("btn-default");
$(this).addClass("btn-info");
}
else {
$(this).removeClass("btn-info");
$(this).addClass("btn-default");
}
})
$.ajax({
type: "GET",
url: "sub_pages/orders/ajax/preaccount_save.php",
data: "id_product_used=" + id_product_used + "&preaccount=" + preaccount,
success: function(msg){
$(".preaccount_" + id_product_used).fadeTo("fast", 1);
}
});
}
function load_system_note() {
$.ajax({
type: "POST",
url: "sub_pages/system/load_system_log.php",
cache: false,
timeout: 20000,
success: function(data){
$('#system_note').html(data);
}
});
}
function count_sms_cahrs(input) {
var cena_jednej = 0.05;
var text = $(input).val();
var pocet_znakov = text.length;
var typ = 0;
if(text == accent_fold(text)) {
// nema diakritiku
console.log("nema");
if(pocet_znakov <= 160) typ = 1;
else typ = 3;
}
else {
// ma
console.log("ma");
if(pocet_znakov <= 70) typ = 5;
else typ = 7;
}
$("#sms_type").val(typ);
$("#message_info").html("Počet znakov: " + pocet_znakov + " Typ SMS: " + typ + "");
}
var accent_map = {
'ẚ':'a','Á':'a','á':'a','À':'a','à':'a','Ă':'a','ă':'a','Ắ':'a','ắ':'a','Ằ':'a','ằ':'a','Ẵ':'a','ẵ':'a','Ẳ':'a','ẳ':'a','Â':'a','â':'a','Ấ':'a','ấ':'a','Ầ':'a','ầ':'a','Ẫ':'a','ẫ':'a','Ẩ':'a','ẩ':'a','Ǎ':'a','ǎ':'a','Å':'a','å':'a','Ǻ':'a','ǻ':'a','Ä':'a','ä':'a','Ǟ':'a','ǟ':'a','Ã':'a','ã':'a','Ȧ':'a','ȧ':'a','Ǡ':'a','ǡ':'a','Ą':'a','ą':'a','Ā':'a','ā':'a','Ả':'a','ả':'a','Ȁ':'a','ȁ':'a','Ȃ':'a','ȃ':'a','Ạ':'a','ạ':'a','Ặ':'a','ặ':'a','Ậ':'a','ậ':'a','Ḁ':'a','ḁ':'a','Ⱥ':'a','ⱥ':'a','Ǽ':'a','ǽ':'a','Ǣ':'a','ǣ':'a',
'Ḃ':'b','ḃ':'b','ḅ':'b','Ḇ':'b','ḇ':'b','Ƀ':'b','ƀ':'b','ᵬ':'b','Ɓ':'b','ɓ':'b','Ƃ':'b','ƃ':'b',
'Ć':'c','ć':'c','Ĉ':'c','ĉ':'c','Č':'c','č':'c','Ċ':'c','ċ':'c','Ç':'c','ç':'c','Ḉ':'c','ḉ':'c','Ȼ':'c','ȼ':'c','Ƈ':'c','ƈ':'c','ɕ':'c',
'Ď':'d','ď':'d','Ḋ':'d','ḋ':'d','Ḑ':'d','ḑ':'d','Ḍ':'d','ḍ':'d','Ḓ':'d','ḓ':'d','Ḏ':'d','ḏ':'d','Đ':'d','đ':'d','ᵭ':'d','Ɖ':'d','ɖ':'d','Ɗ':'d','ɗ':'d','Ƌ':'d','ƌ':'d','ȡ':'d','ð':'d',
'É':'e','Ə':'e','Ǝ':'e','ǝ':'e','é':'e','È':'e','è':'e','Ĕ':'e','ĕ':'e','Ê':'e','ê':'e','Ế':'e','ế':'e','Ề':'e','ề':'e','Ễ':'e','ễ':'e','Ể':'e','ể':'e','Ě':'e','ě':'e','Ë':'e','ë':'e','Ẽ':'e','ẽ':'e','Ė':'e','ė':'e','Ȩ':'e','ȩ':'e','Ḝ':'e','ḝ':'e','Ę':'e','ę':'e','Ē':'e','ē':'e','Ḗ':'e','ḗ':'e','Ḕ':'e','ḕ':'e','Ẻ':'e','ẻ':'e','Ȅ':'e','ȅ':'e','Ȇ':'e','ȇ':'e','Ẹ':'e','ẹ':'e','Ệ':'e','ệ':'e','Ḙ':'e','ḙ':'e','Ḛ':'e','ḛ':'e','Ɇ':'e','ɇ':'e','ɚ':'e','ɝ':'e',
'Ḟ':'f','ḟ':'f','ᵮ':'f','Ƒ':'f','ƒ':'f',
'Ǵ':'g','ǵ':'g','Ğ':'g','ğ':'g','Ĝ':'g','ĝ':'g','Ǧ':'g','ǧ':'g','Ġ':'g','ġ':'g','Ģ':'g','ģ':'g','Ḡ':'g','ḡ':'g','Ǥ':'g','ǥ':'g','Ɠ':'g','ɠ':'g',
'Ĥ':'h','ĥ':'h','Ȟ':'h','ȟ':'h','Ḧ':'h','ḧ':'h','Ḣ':'h','ḣ':'h','ḩ':'h','Ḥ':'h','ḥ':'h','ḫ':'h','̱':'h','ẖ':'h','Ħ':'h','ħ':'h','Ⱨ':'h','ⱨ':'h',
'Í':'i','í':'i','Ì':'i','ì':'i','Ĭ':'i','ĭ':'i','Î':'i','î':'i','Ǐ':'i','ǐ':'i','Ï':'i','ï':'i','Ḯ':'i','ḯ':'i','Ĩ':'i','ĩ':'i','İ':'i','i':'i','Į':'i','į':'i','Ī':'i','ī':'i','Ỉ':'i','ỉ':'i','Ȉ':'i','ȉ':'i','Ȋ':'i','ȋ':'i','Ị':'i','ị':'i','Ḭ':'i','ḭ':'i','ı':'i','Ɨ':'i','ɨ':'i',
'Ĵ':'j','ĵ':'j','̌':'j','ǰ':'j','ȷ':'j','Ɉ':'j','ɉ':'j','ʝ':'j','ɟ':'j','ʄ':'j',
'Ḱ':'k','ḱ':'k','Ǩ':'k','ǩ':'k','Ķ':'k','ķ':'k','Ḳ':'k','ḳ':'k','Ḵ':'k','ḵ':'k','Ƙ':'k','ƙ':'k','Ⱪ':'k','ⱪ':'k',
'Ĺ':'l','ĺ':'l','Ľ':'l','ľ':'l','Ļ':'l','ļ':'l','Ḷ':'l','ḷ':'l','Ḹ':'l','ḹ':'l','Ḽ':'l','ḽ':'l','Ḻ':'l','ḻ':'l','Ł':'l','ł':'l','Ł':'l','̣':'l','ł':'l','̣':'l','Ŀ':'l','ŀ':'l','Ƚ':'l','ƚ':'l','Ⱡ':'l','ⱡ':'l','Ɫ':'l','ɫ':'l','ɬ':'l','ɭ':'l','ȴ':'l',
'Ḿ':'m','ḿ':'m','Ṁ':'m','ṁ':'m','Ṃ':'m','ṃ':'m','ɱ':'m',
'Ń':'n','ń':'n','Ǹ':'n','ǹ':'n','Ň':'n','ň':'n','Ñ':'n','ñ':'n','Ṅ':'n','ṅ':'n','ņ':'n','ṇ':'n','Ṋ':'n','ṋ':'n','Ṉ':'n','ṉ':'n','ɲ':'n','Ƞ':'n','ƞ':'n','ɳ':'n','ȵ':'n','̈':'n','n':'n','̈':'n',
'Ó':'o','ó':'o','Ò':'o','ò':'o','Ŏ':'o','ŏ':'o','Ô':'o','ô':'o','Ố':'o','ố':'o','Ồ':'o','ồ':'o','Ỗ':'o','ỗ':'o','Ổ':'o','ổ':'o','Ǒ':'o','ǒ':'o','Ö':'o','ö':'o','Ȫ':'o','ȫ':'o','Ő':'o','ő':'o','Õ':'o','õ':'o','Ṍ':'o','ṍ':'o','Ṏ':'o','ṏ':'o','Ȭ':'o','ȭ':'o','Ȯ':'o','ȯ':'o','Ȱ':'o','ȱ':'o','Ø':'o','ø':'o','Ǿ':'o','ǿ':'o','Ǫ':'o','ǫ':'o','Ǭ':'o','ǭ':'o','Ō':'o','ō':'o','Ṓ':'o','ṓ':'o','Ṑ':'o','ṑ':'o','Ỏ':'o','ỏ':'o','Ȍ':'o','ȍ':'o','Ȏ':'o','ȏ':'o','Ơ':'o','ơ':'o','Ớ':'o','ớ':'o','Ờ':'o','ờ':'o','Ỡ':'o','ỡ':'o','Ở':'o','ở':'o','Ợ':'o','ợ':'o','Ọ':'o','ọ':'o','Ộ':'o','ộ':'o','Ɵ':'o','ɵ':'o',
'Ṕ':'p','ṕ':'p','Ṗ':'p','ṗ':'p','Ᵽ':'p','Ƥ':'p','ƥ':'p','̃':'p','̃':'p',
'ʠ':'q','Ɋ':'q','ɋ':'q',
'Ŕ':'r','ŕ':'r','Ř':'r','ř':'r','Ṙ':'r','ṙ':'r','Ŗ':'r','ŗ':'r','Ȑ':'r','ȑ':'r','Ȓ':'r','ȓ':'r','Ṛ':'r','ṛ':'r','Ṝ':'r','ṝ':'r','Ṟ':'r','ṟ':'r','Ɍ':'r','ɍ':'r','ᵲ':'r','ɼ':'r','Ɽ':'r','ɽ':'r','ɾ':'r','ᵳ':'r',
'ß':'s','Ś':'s','ś':'s','Ṥ':'s','ṥ':'s','Ŝ':'s','ŝ':'s','Š':'s','š':'s','Ṧ':'s','ṧ':'s','Ṡ':'s','ṡ':'s','ẛ':'s','Ş':'s','ş':'s','Ṣ':'s','ṣ':'s','Ṩ':'s','ṩ':'s','Ș':'s','ș':'s','ʂ':'s','̩':'s','s':'s','̩':'s',
'Þ':'t','þ':'t','Ť':'t','ť':'t','̈':'t','ẗ':'t','Ṫ':'t','ṫ':'t','Ţ':'t','ţ':'t','Ṭ':'t','ṭ':'t','Ț':'t','ț':'t','Ṱ':'t','ṱ':'t','Ṯ':'t','ṯ':'t','Ŧ':'t','ŧ':'t','Ⱦ':'t','ⱦ':'t','ᵵ':'t','ƫ':'t','Ƭ':'t','ƭ':'t','Ʈ':'t','ʈ':'t','ȶ':'t',
'Ú':'u','ú':'u','Ù':'u','ù':'u','Ŭ':'u','ŭ':'u','Û':'u','û':'u','Ǔ':'u','ǔ':'u','Ů':'u','ů':'u','Ü':'u','ü':'u','Ǘ':'u','ǘ':'u','Ǜ':'u','ǜ':'u','Ǚ':'u','ǚ':'u','Ǖ':'u','ǖ':'u','Ű':'u','ű':'u','Ũ':'u','ũ':'u','Ṹ':'u','ṹ':'u','Ų':'u','ų':'u','Ū':'u','ū':'u','Ṻ':'u','ṻ':'u','Ủ':'u','ủ':'u','Ȕ':'u','ȕ':'u','Ȗ':'u','ȗ':'u','Ư':'u','ư':'u','Ứ':'u','ứ':'u','Ừ':'u','ừ':'u','Ữ':'u','ữ':'u','Ử':'u','ử':'u','Ự':'u','ự':'u','Ụ':'u','ụ':'u','Ṳ':'u','ṳ':'u','Ṷ':'u','ṷ':'u','Ṵ':'u','ṵ':'u','Ʉ':'u','ʉ':'u',
'Ṽ':'v','ṽ':'v','Ṿ':'v','ṿ':'v','Ʋ':'v','ʋ':'v',
'Ẃ':'w','ẃ':'w','Ẁ':'w','ẁ':'w','Ŵ':'w','ŵ':'w','̊':'w','ẘ':'w','Ẅ':'w','ẅ':'w','Ẇ':'w','ẇ':'w','Ẉ':'w','ẉ':'w',
'Ẍ':'x','ẍ':'x','Ẋ':'x','ẋ':'x',
'Ý':'y','ý':'y','Ỳ':'y','ỳ':'y','Ŷ':'y','ŷ':'y','̊':'y','ẙ':'y','Ÿ':'y','ÿ':'y','Ỹ':'y','ỹ':'y','Ẏ':'y','ẏ':'y','Ȳ':'y','ȳ':'y','Ỷ':'y','ỷ':'y','Ỵ':'y','ỵ':'y','ʏ':'y','Ɏ':'y','ɏ':'y','Ƴ':'y','ƴ':'y',
'Ź':'z','ź':'z','Ẑ':'z','ẑ':'z','Ž':'z','ž':'z','Ż':'z','ż':'z','Ẓ':'z','ẓ':'z','Ẕ':'z','ẕ':'z','Ƶ':'z','ƶ':'z','Ȥ':'z','ȥ':'z','ʐ':'z','ʑ':'z','Ⱬ':'z','ⱬ':'z','Ǯ':'z','ǯ':'z','ƺ':'z',
'€':'E'
};
function accent_fold (s) {
if (!s) { return ''; }
var ret = '';
for (var i=0; i 1){
tinyLang = $(this).data('language');
changeLanguage = true;
}
$(this).tinymce({
script_url : 'sub_pages/tinymce/tinymce.min.js',
language: language,
menubar: false,
plugins: "code, textcolor, colorpicker, table, hr, charmap, image, link, imagetools, macimageeditor, maclinkinserter, media, paste, lists, nonbreaking",
paste_as_text: true,
convert_urls: false,
force_br_newlines : true,
force_p_newlines : false,
forced_root_block : '',
media_live_embeds: true,
toolbar: [
'bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | forecolor backcolor | formatselect fontsizeselect nonbreaking',
'table | subscript superscript | bullist numlist | hr charmap | indent outdent | image media | link unlink | styleselect | undo redo | code'
],
entity_encoding : 'raw',
content_style: "p {margin: 0px;}",
style_formats: [
{
title: 'Obrázok vľavo',
selector: 'img',
styles: {
'float': 'left',
'margin': '0 10px 0 10px'
}
},
{
title: 'Obrázok vpravo',
selector: 'img',
styles: {
'float': 'right',
'margin': '0 0 10px 10px'
}
}
],
imagetools_cors_hosts: ['interrail.eu'],
file_browser_callback: function(field_name, url, type, win){
if(changeLanguage){
changeTinyMCELang(tinyLang);
console.log(tinyLang);
}
myFileBrowser(field_name, url, type, win);
},
link_class_list: [
{title: 'None', value: ''},
{title: 'Lightbox', value: 'lightbox'}
]
});
})
}
}
function check_vat() {
$(".ic_dph_result").html("");
var ic_dph = $("input[name=ic_dph]").val();
var result = "";
$.ajax({
type: "POST",
url: "sub_pages/clients/ajax/check_vat.php",
data: "ic_dph=" + ic_dph,
cache: false,
timeout: 20000,
success: function(data){
if (data == "valid") {
$(".ic_dph_result").html("");
$.ajax({
type: "POST",
url: "sub_pages/clients/ajax/check_vat_echo.php",
cache: false,
timeout: 20000,
success: function(data){
popupok(data);
}
});
} else if (data == "INVALID_INPUT" || data == "invalid") {
$(".ic_dph_result").html("");
} else if (data == "SERVICE_UNAVAILABLE" || data == "MS_UNAVAILABLE" || data == "TIMEOUT" || data == "SERVER_BUSY") {
$(".ic_dph_result").html("");
// api error, pridat do poznamky text ze icdph nebolo skontrolovane
} else {
$(".ic_dph_result").html("");
}
result = data;
}
});
return result;
}
function update_order_product_priorities(dohidebody) {
$("#priorities").val($("#myDiv").sortable("serialize"));
if(dohidebody) $("body").hide(); return true;
}
function client_used_put_client(value) {
$(".loading_bar").show();
$.getScript("sub_pages/orders/client_used_put_client.php?id_client=" + value);
}
function choose_product_lot(id_product_identification, id_product_lot) {
document.getElementsByName("id_product_lot_"+id_product_identification)[0].value = id_product_lot;
$(".product_lot_popup", window.parent.document).remove();
$("#center_inner").fadeTo("slow", "1");
}
function input_focus(inputname, activate) {
if(activate == true) {
if(inputname == "company_name") if(document.getElementsByName(inputname)[0].value == "Spoločnosť") document.getElementsByName(inputname)[0].value = "";
if(inputname == "login") if(document.getElementsByName(inputname)[0].value == "Login") document.getElementsByName(inputname)[0].value = "";
if(inputname == "pswd") if(document.getElementsByName(inputname)[0].value == "Heslo") document.getElementsByName(inputname)[0].value = "";
}
if(activate == false) {
if(inputname == "company_name") if(document.getElementsByName(inputname)[0].value == "") document.getElementsByName(inputname)[0].value = "Spoločnosť";
if(inputname == "login") if(document.getElementsByName(inputname)[0].value == "") document.getElementsByName(inputname)[0].value = "Login";
if(inputname == "pswd") if(document.getElementsByName(inputname)[0].value == "") document.getElementsByName(inputname)[0].value = "Heslo";
}
}
function display_menu(id) {
//alert($('#menu_' + id).css("display"));
if($('#menu_' + id).css("display") == "none") $('#menu_' + id).show(0);
//alert($('#menu_' + id).css("display"));
}
function hide_menu(id) {
//document.getElementById('menu_' + id).style.display = 'none';
if($('#menu_' + id).css("display") == "block") $('#menu_' + id).hide(0);
}
function myopenlink(mylink) {
//alert(mylink);
//$.Ajaxy.go(mylink);
window.location = mylink;
}
function showhidemenu() {
$.ajax({
type: "GET",
url: "sub_pages/system/showhidemenu.php",
data: "",
success: function(msg){
}
});
}
function ask_question(question, true_a, false_a) {
var submitted = 0;
swal({
title: question,
type: "warning",
showCancelButton: true,
cancelButtonText: "Nie",
confirmButtonColor: "#DD6B55",
confirmButtonText: "Áno",
closeOnConfirm: false
}, function(){
if(submitted == 0) window.location = true_a;
submitted = 1;
});
}
function ask_question_false(answer) {
$(".popup_banner").fadeOut("fast");
$(".popup_banner").remove();
if(answer) {
$(".center_inner").fadeTo(0, 1);
//$.Ajaxy.request(answer);
window.location = answer;
} else {
$(".center_inner").fadeTo("fast", 1);
}
}
function ask_question_true(answer) {
$(".popup_banner").fadeOut("fast");
$(".popup_banner").remove();
if(answer) {
$(".center_inner").fadeTo(0, 1);
//$.Ajaxy.request(answer);
window.location = answer;
} else {
$(".center_inner").fadeTo("fast", 1);
}
}
function showhide(name){
//alert(name);
$(".wrapper_" + name).toggleClass("table-clicked");
$("#" + name).slideToggle("fast");
//el=document.getElementById(name).style;
//el.display=(el.display == 'block')?'none':'block';
}
function showhide_web_object(name){
if($("#" + name).is(":visible")) {
$("#" + name).toggle(0);
}
else {
$("#" + name).toggle(0);
$("#" + name).html("");
$.ajax({
type: "GET",
url: "sub_pages/web/web_object_load_inner.php",
data: "id_web_object_sub=" + name,
success: function(msg){
$("#" + name).html(msg);
}
});
}
$(".wrapper_web_object_" + name).toggleClass("table-clicked");
}
function popupmessage(message) {
swal({
title: message,
type: "warning",
showCancelButton: false,
cancelButtonText: "OK",
closeOnConfirm: true
}, function(){
});
//$(".center_inner").fadeTo(0, 0.3);
//$(".center").append("");
//$(".popup_banner").fadeTo("fast", 1);
$(document).keyup(function(e) {
//if(e.keyCode == 13) { $('.banner_submit_true').click(); } // enter
//if(e.keyCode == 32) { $('.banner_submit_true').click(); } // space
if(e.keyCode == 27) { $('.banner_submit_true').click(); } // esc
});
}
function popupok(message) {
$(".center_inner").fadeTo(0, 0.3);
$(".center").append("");
$(".popup_banner").fadeTo("fast", 1);
$(document).keyup(function(e) {
//if(e.keyCode == 13) { $('.banner_submit_true').click(); } // enter
//if(e.keyCode == 32) { $('.banner_submit_true').click(); } // space
if(e.keyCode == 27) { $('.banner_submit_true').click(); } // esc
});
}
function popup_window(name, url, data) {
//alert(content);
$(".center_inner").fadeTo("fast", 0.3);
$(".center").append("");
$.ajax({
type: "GET",
url: url,
data: data,
success: function(msg){
//alert(msg);
$(".popup_window").html(msg);
}
});
$(".popup_window").fadeTo("fast", 1);
}
function close_popup_window() {
$(".center_inner").fadeTo("fast", 1);
$(".popup_window").fadeOut("fast");
$(".popup_window").remove();
}
function returnpage(link, error) {
//alert(link);
//$.Ajaxy.request(link);
$("#myreturnform_wrap").ajaxify();
$("#myreturnform").click();
if(error) {
popupmessage(error);
}
}
function ajaxpage(url, data, result, loading) {
if(typeof loading !== "undefined"){
$("#" + result).html("");
}
$.ajax({
type: "GET",
url: url,
data: data,
success: function(msg){
//alert(msg);
$("#" + result).html(msg);
}
});
}
function load_ares() {
let ico = $("input[name=ico]").val()
if(ico > 0){
$(".load_ares_button").hide();
$(".load_ares_loader").show();
$.ajax({
type: "GET",
url: "https://ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/" + ico,
success: function(res){
$("[name=dic]").val(res.dic);
$("[name=name]").val(res.obchodniJmeno);
$("[name=street]").val(res.sidlo.nazevUlice);
$("[name=city]").val(res.sidlo.nazevObce);
$("[name=zip]").val(res.sidlo.psc);
$(".load_ares_button").show();
$(".load_ares_loader").hide();
}
});
}
}
function checkform() {
var chyba = 0;
$("#priorities").val($("#myDiv").sortable("serialize"));
if(document.getElementsByName("deposit")[0]) {
if(document.getElementsByName("deposit")[0].value == "0") {
if(document.getElementById("my_print_deposit").checked == true) {
popupmessage("Záloha nemôže byť 0!");
//chyba = 1;
return false;
}
}
}
if(document.getElementsByName("d_r_sd")[0]) {
if(document.getElementsByName("d_r_sd")[0].value == "") chyba++;
if(document.getElementsByName("d_r_c")[0].value == "") chyba++;
if(document.getElementsByName("d_r_o")[0].value == "") chyba++;
if(document.getElementsByName("d_r_pd")[0].value == "") chyba++;
if(document.getElementsByName("d_r_v")[0].value == "") chyba++;
if(document.getElementsByName("d_l_sd")[0].value == "") chyba++;
if(document.getElementsByName("d_l_c")[0].value == "") chyba++;
if(document.getElementsByName("d_l_o")[0].value == "") chyba++;
if(document.getElementsByName("d_l_pd")[0].value == "") chyba++;
if(document.getElementsByName("d_l_v")[0].value == "") chyba++;
if(document.getElementsByName("b_r_sd")[0].value == "") chyba++;
if(document.getElementsByName("b_r_c")[0].value == "") chyba++;
if(document.getElementsByName("b_r_o")[0].value == "") chyba++;
if(document.getElementsByName("b_r_pd")[0].value == "") chyba++;
if(document.getElementsByName("b_r_v")[0].value == "") chyba++;
if(document.getElementsByName("b_l_sd")[0].value == "") chyba++;
if(document.getElementsByName("b_l_c")[0].value == "") chyba++;
if(document.getElementsByName("b_l_o")[0].value == "") chyba++;
if(document.getElementsByName("b_l_pd")[0].value == "") chyba++;
if(document.getElementsByName("b_l_v")[0].value == "") chyba++;
}
if(chyba == 20) chyba = 0;
if(chyba != 0) {
alert("Nevyplnili ste všetky položky!");
//return false;
}
if(chyba == 0) {
//malibysmesubmitnut = false;
if($("#checkedform").attr("class") != "ajaxy ajaxy-page ajaxy-has") {
malibysmesubmitnut = true;
}
else return false;
$("#checkedform").addClass("ajaxy ajaxy-page");
//alert($("#checkedform").attr("class"));
$(".center_inner").ajaxify();
if(malibysmesubmitnut == true) $("#checkedform").submit();
}
return false;
}
function change_forma_uhrady() {
document.getElementById("forma_uhrady_1").style.display = "none";
if($('#deposit_forma_uhrady').length > 0){
if($('#deposit_forma_uhrady').val() == 0){
document.getElementById("forma_uhrady_1").style.display = "none";
}else if($('#deposit_forma_uhrady').val() == 1 ){
document.getElementById("forma_uhrady_1").style.display = "block";
}
}else{
if(document.getElementById("forma_uhrady").value == 1 ) {
document.getElementById("forma_uhrady_1").style.display = "block";
}
}
}
function changeformpriradit() {
//alert(document.getElementById("priradit").value);
if(document.getElementById("pobocka")) document.getElementById("pobocka").style.display = "none";
if(document.getElementById("pouzivatel")) document.getElementById("pouzivatel").style.display = "none";
if(document.getElementById("priradit").value == "pobocke") document.getElementById("pobocka").style.display = "block";
if(document.getElementById("priradit").value == "individualne") {
document.getElementById("pouzivatel").style.display = "block";
}
}
function check_all() {
var mojdiv = document.getElementById("lenusers");
var i;
for(i=0; i";
if(document.getElementsByName("vs")[0]) {
$.ajax({
type: "GET",
url: "sub_pages/bond/check_vs.php",
data: "vs=" + document.getElementsByName("vs")[0].value + "&id_order=" + id_order,
success: function(msg){
if(msg == "1") {
document.getElementById("check_vs_result").innerHTML = "VS možno použiť";
}
else {
document.getElementById("check_vs_result").innerHTML = "VS je už zaevidovaný";
}
}
});
}
}
function check_vs_sync(id_order) {
//document.getElementById("check_vs_result").innerHTML = "";
var ret = false;
if(document.getElementsByName("vs")[0]) {
$.ajax({
type: "GET",
url: "sub_pages/bond/check_vs.php",
async: false,
data: "vs=" + document.getElementsByName("vs")[0].value + "&id_order=" + id_order,
success: function(msg){
if(msg == "1") {
//document.getElementById("check_vs_result").innerHTML = "";
ret = false;
}
else {
//document.getElementById("check_vs_result").innerHTML = "";
ret = true;
}
}
});
return ret;
}
}
function get_max_product_grouping() {
$.ajax({
type: "GET",
url: "sub_pages/products/get_max_product_grouping.php",
success: function(msg){
$("#product_grouping").attr("value", msg);
}
});
}
function choose_product_lot_product_move_2() {
$.ajax({
type: "GET",
url: "sub_pages/products/product_lot_load_select.php",
data: "product=" + document.getElementsByName("id_product")[0].value,
success: function(msg){
$("#sarza_space").html(msg);
}
});
}
function product_lot_unstore_add(id_product, kolkospolu) {
if(parseFloat($("#product_lot_max_" + id_product).val()) < kolkospolu) {
$.ajax({
type: "GET",
url: "sub_pages/products/product_lot_load_unstore.php",
data: "product=" + id_product + "&kolko=" + parseFloat($("#product_lot_max_" + id_product).val()),
success: function(msg){
$("#product_lot_space_" + id_product).append(msg);
$("#product_lot_max_" + id_product).val(parseFloat($("#product_lot_max_" + id_product).val())+1);
}
});
}
else alert("Viac položiek už nie je možné pridať!");
}
function remove_upload_file(element_class, element_temp, element){
$("."+element_class).remove();
$(element).parent().remove();
$.ajax({
type: "POST",
url: "sub_pages/system/file_upload_remove.php",
data: {remove_old: element_temp},
async: false,
success: function(data){
//console.log(data);
}
});
}
function order_detail_history(temp_id_order){
$("#order_detail_history_text_"+temp_id_order).remove();
$("#order_detail_history_"+temp_id_order).html("");
$.ajax({
type: "POST",
url: "sub_pages/orders/ajax/index_order_detail_history.php",
data: {id_order: temp_id_order},
async: true,
success: function(data){
$("#order_detail_history_"+temp_id_order).html(data);
}
});
}
function bond_detail_history(temp_id_order){
$("#bond_detail_history_text_"+temp_id_order).remove();
$("#bond_detail_history_"+temp_id_order).html("");
$.ajax({
type: "POST",
url: "sub_pages/bond/ajax/index_bond_detail_history.php",
data: {id_order: temp_id_order},
async: true,
success: function(data){
$("#bond_detail_history_"+temp_id_order).html(data);
}
});
}
function onchange_textarea(selector, element){
var new_val = element.val();
var actual_val = tinymce.get(selector).getContent();
tinymce.get(selector).setContent(actual_val + new_val);
}