1 2var unishop_CartItemsPlaceholderSelector = '#CartItemsPlaceholder'; 3var unishop_CartSummaryItemsPlaceholderSelector = '#CartSummaryItemsPlaceholder'; 4var unishop_CartItemsPreloaderSelector = '#CartItemsPreloader'; 5var unishop_CartTotalSelector = '#CartTotalPlaceholder'; 6var unishop_CartSummaryTotalSelector = '#CartSummaryTotalPlaceholder'; 7var unishop_ShowFirstPanel = '1'; 8 9var unishop_CartOptionsHFTransportSelector = ''; 10var unishop_CartOptionsHFPaymentSelector = ''; 11var unishop_CartOptionsHFAddressSelector = ''; 12var unishop_CartOptionsHFTicketSelector = ''; 13var unishop_CartOptionsHFNoteSelector = ''; 14 15var unishop_CartTextOk = ''; 16var unishop_CartTextTransport = ''; 17var unishop_CartTextPayment = ''; 18var unishop_CartTextAddress = ''; 19var unishop_CartDhlTransportID = 0; 20 21var unishop_CartGeisTransportID = 0; 22var unishop_CartGeisTransportHFID = ''; 23 24var unishop_CartGlsTransportID = 0; 25var unishop_CartGlsTransportHFID = ''; 26 27var unishop_CartBalikoboxTransportID = 0; 28var unishop_CartBalikoboxTransportHFID = ''; 29 30var unishop_CartPacketaTransportID = 0; 31var unishop_CartPacketaTransportHFID = ''; 32 33var unishop_CartOptionsTransportSelector = '#CartOptionsTransport'; 34var unishop_CartOptionsPaymentSelector = '#CartOptionsPayment'; 35var unishop_CartOptionsAddressSelector = '#CartOptionsAddress'; 36var unishop_CartOptionsAddressAddSelector = '#CartOptionsAddressAdd'; 37var unishop_CartOptionsTicketSelector = '#CartOptionsTicket'; 38var unishop_CartOptionsNoteSelector = '#CartOptionsNote'; 39 40var unishop_CartSummaryTransportSelector = '#CartSummaryTransport'; 41var unishop_CartSummaryPaymentSelector = '#CartSummaryPayment'; 42var unishop_CartSummaryAddressSelector = '#CartSummaryAddress'; 43var unishop_CartSummaryTicketSelector = '#CartSummaryTicket'; 44var unishop_CartSummaryNoteSelector = '#CartSummaryNote'; 45 46function unishop_CartInit() { 47 $('.show-login').click(function () { 48 $('.process-panel-register').hide(); 49 $('.process-panel-login').show(); 50 return false; 51 }); 52 $('.show-register').click(function () { 53 $('.process-panel-register').show(); 54 $('.process-panel-login').hide(); 55 return false; 56 }); 57 $(unishop_CartOptionsAddressAddSelector).dialog({ height: 'auto', width: 400, resizable: false, draggable: false, autoOpen: false, appendTo: "form", modal: true }); 58 $(".options-add-adress").click(function () { unishop_CartOptionsAdressCancel(); $(unishop_CartOptionsAddressAddSelector).dialog('open'); return false; }); 59 unishop_CartFillItems(); 60 unishop_CartFillOptionsAddress(); 61} 62 63function unishop_CartOptionsAdressCancel() { 64 $(unishop_CartOptionsAddressAddSelector).find('input[type=text]').val(''); 65 $(unishop_CartOptionsAddressAddSelector).find('input[type=hidden]').val(''); 66 $(unishop_CartOptionsAddressAddSelector).find('input.req').removeClass('required-highlight'); 67 $(unishop_CartOptionsAddressAddSelector).dialog('close'); 68} 69 70function unishop_CartOptionsNextStep() { 71 if ($(unishop_CartOptionsHFTransportSelector).val() == '') { 72 ViewAlert(unishop_CartTextTransport, unishop_CartTextOk); 73 return; 74 } 75 if ($(unishop_CartOptionsHFPaymentSelector).val() == '') { 76 ViewAlert(unishop_CartTextPayment, unishop_CartTextOk); 77 return; 78 } 79 if ($(unishop_CartOptionsHFAddressSelector).val() == '') { 80 ViewAlert(unishop_CartTextAddress, unishop_CartTextOk); 81 return; 82 } 83 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartBalikoboxTransportID) { 84 if ($('#DivBalikoboxPlaces .place input[type=radio]:checked').length == 0) { 85 ViewAlert('ProsÃm vyberte miesto odberu pre BALÃKOBOX!', unishop_CartTextOk, function () { 86 $('#DDLBalikoboxCity').focus(); 87 }); 88 return; 89 } 90 $(unishop_CartSummaryAddressSelector).html($('#DivBalikoboxPlaces .place input[type=radio]:checked').parent().find('.place-name').html()); 91 $('#' + unishop_CartBalikoboxTransportHFID).val($('#DivBalikoboxPlaces .place input[type=radio]:checked').val() + ', ' + $('#DivBalikoboxPlaces .place input[type=radio]:checked').parent().find('.place-name').html()); 92 } 93 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartGeisTransportID) { 94 if ($('#DivGeisPlaces .place input[type=radio]:checked').length == 0) { 95 ViewAlert('ProsÃm vyberte miesto odberu pre GEISPOINT!', unishop_CartTextOk, function () { 96 $('#DDLGeisRegion').focus(); 97 }); 98 return; 99 } 100 $(unishop_CartSummaryAddressSelector).html($('#DivGeisPlaces .place input[type=radio]:checked').parent().find('.place-name').html() + ', ' + $('#DivGeisPlaces .place input[type=radio]:checked').parent().find('.place-street').html() + ', ' + $('#DDLGeisCity').val()); 101 $('#' + unishop_CartGeisTransportHFID).val($('#DivGeisPlaces .place input[type=radio]:checked').val() + ', ' + $('#DivGeisPlaces .place input[type=radio]:checked').parent().find('.place-name').html() + ', ' + $('#DivGeisPlaces .place input[type=radio]:checked').parent().find('.place-street').html() + ', ' + $('#DDLGeisCity').val()); 102 } 103 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartGlsTransportID) { 104 if ($('#' + unishop_CartGlsTransportHFID).val() == '') { 105 ViewAlert('ProsÃm vyberte odberné miesto GLS ParcelShop.', unishop_CartTextOk); 106 return; 107 } 108 $(unishop_CartSummaryAddressSelector).html($('#' + unishop_CartGlsTransportHFID).val()); 109 } 110 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartDhlTransportID) { 111 if ($('#CartOptionsTransportDHLParcelShop input').val() == '') { 112 ViewAlert('ProsÃm vyberte miesto odberu pre DHL ParcelShop!', unishop_CartTextOk, function () { unishop_CartDHLOpen(); }); 113 return; 114 } 115 $(unishop_CartSummaryAddressSelector).html($('#CartOptionsTransportDHLParcelShop strong').html()); 116 } 117 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartPacketaTransportID) { 118 if ($('#' + unishop_CartPacketaTransportHFID).val() == '') { 119 ViewAlert('ProsÃm vyberte odberné miesto zásielkovne.', unishop_CartTextOk); 120 return; 121 } 122 $(unishop_CartSummaryAddressSelector).html($('#' + unishop_CartPacketaTransportHFID).val()); 123 } 124 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() != unishop_CartDhlTransportID && 125 $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() != unishop_CartGeisTransportID && 126 $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() != unishop_CartGlsTransportID && 127 $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() != unishop_CartBalikoboxTransportID && 128 $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() != unishop_CartPacketaTransportID) { 129 $(unishop_CartSummaryAddressSelector).html($(unishop_CartOptionsAddressSelector).find('input[type=radio]:checked').parent().find('label').html() + '<br />' + ($(unishop_CartOptionsAddressSelector).find('input[type=radio]:checked').parent().find('.info').attr('title') ? $(unishop_CartOptionsAddressSelector).find('input[type=radio]:checked').parent().find('.info').attr('title') : '')); 130 } 131 unishop_CartFillItemsTotal(); 132 $(unishop_CartSummaryTransportSelector).html('<span class="price">' + $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').parent().find('.price').html() + '</span>' + $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').parent().find('label').html() + '<br />' + $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').parent().find('.info').attr('title'));
133 $(unishop_CartSummaryPaymentSelector).html('<span class="price">' + $(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').parent().find('.price').html() + '</span>' + $(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').parent().find('label').html() + '<br />' + $(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').parent().find('.info').attr('title')); 134 $(unishop_CartSummaryTicketSelector).html($(unishop_CartOptionsTicketSelector).val()); 135 $(unishop_CartSummaryNoteSelector).html($(unishop_CartOptionsNoteSelector).val()); 136 $(unishop_CartOptionsHFTicketSelector).val($(unishop_CartOptionsTicketSelector).val()); 137 $(unishop_CartOptionsHFNoteSelector).val($(unishop_CartOptionsNoteSelector).val()); 138 unishop_CartShowPanel(4); 139} 140 141function unishop_CartOptionsAdressSave() { 142 var bReturn = false; 143 $(unishop_CartOptionsAddressAddSelector).find('input.req').each(function () { 144 if ($(this).val() == '') { 145 bReturn = true; 146 } 147 }); 148 if (bReturn) { 149 $(unishop_CartOptionsAddressAddSelector).find('input.req').addClass('required-highlight'); 150 return; 151 } 152 $.ajax({
153 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=addaddress&id=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[type=hidden]').val()) + "&name=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=name]').val()) + "&street=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=street]').val()) + "&city=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=city]').val()) + "&zip=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=zip]').val()) + "&people=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=people]').val()) + "&mobile=" + encodeURIComponent($(unishop_CartOptionsAddressAddSelector).find('input[name=mobile]').val()) + "&ts=" + new Date().getTime(), 154 success: function (html) { 155 unishop_CartFillOptionsAddress(); 156 } 157 }); 158 unishop_CartOptionsAdressCancel(); 159} 160 161function unishop_CartOptionsAdressEdit(id) { 162 $.getJSON("/app_plugins/unishop-cart/ajax-public.aspx?part=addaddressjson&id=" + id + "&ts=" + new Date().getTime(), function (json) { 163 $(unishop_CartOptionsAddressAddSelector).find('input[type=hidden]').val(id); 164 $(unishop_CartOptionsAddressAddSelector).find('input[name=name]').val(json.Nazov); 165 $(unishop_CartOptionsAddressAddSelector).find('input[name=street]').val(json.Ulica); 166 $(unishop_CartOptionsAddressAddSelector).find('input[name=city]').val(json.Mesto); 167 $(unishop_CartOptionsAddressAddSelector).find('input[name=zip]').val(json.Psc); 168 $(unishop_CartOptionsAddressAddSelector).find('input[name=people]').val(json.kontaktna_osoba); 169 $(unishop_CartOptionsAddressAddSelector).find('input[name=mobile]').val(json.telefon); 170 $(unishop_CartOptionsAddressAddSelector).dialog('open'); 171 }); 172} 173 174function unishop_CartFillOptions() { 175 $(unishop_CartOptionsHFTransportSelector).val(''); 176 $(unishop_CartOptionsHFPaymentSelector).val(''); 177 $.ajax({
178 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=getcarttransport&ts=" + new Date().getTime(), 179 success: function (html) { 180 if (html) { 181 $(unishop_CartOptionsTransportSelector).html(html); 182 $(unishop_CartOptionsTransportSelector).find('input[type=radio]').click(function () { 183 unishop_CartFillOptionsRelationClick(this, true); 184 }); 185 } 186 else { $(unishop_CartOptionsTransportSelector).html(''); } 187 } 188 }); 189 $.ajax({ 190 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=getcartpayment&ts=" + new Date().getTime(), 191 success: function (html) { 192 if (html) { 193 $(unishop_CartOptionsPaymentSelector).html(html); 194 $(unishop_CartOptionsPaymentSelector).find('input[type=radio]').click(function () { 195 unishop_CartFillOptionsRelationClick(this, false); 196 }); 197 } 198 else { $(unishop_CartOptionsPaymentSelector).html(''); } 199 } 200 }); 201} 202 203function unishop_CartFillOptionsRelationClick(sender, bTransport) { 204 205 $('#CartOptionsTransportProfile').show(); 206 207 var senderPlaceSelector = (bTransport ? unishop_CartOptionsTransportSelector : unishop_CartOptionsPaymentSelector); 208 var relationPlaceSelector = (!bTransport ? unishop_CartOptionsTransportSelector : unishop_CartOptionsPaymentSelector); 209 $(relationPlaceSelector).find('input[type=radio]').parent().removeClass('disallowed'); 210 if ($(sender).parent().hasClass('disallowed')) { 211 $(senderPlaceSelector).find('input[type=radio]').parent().removeClass('disallowed'); 212 } 213 if ($(sender).attr('data-relation-id').length > 0) { 214 var sAllowed = $(sender).attr('data-relation-id').split(','); 215 if (sAllowed && sAllowed.length > 0) { 216 $(relationPlaceSelector).find('input[type=radio]').parent().addClass('disallowed'); 217 for (var i = 0; i < sAllowed.length; i++) { 218 $(relationPlaceSelector).find('input[value=' + sAllowed[i] + ']').parent().removeClass('disallowed'); 219 } 220 if (bTransport) { 221 $(relationPlaceSelector).find("input[data-relation-id='']").parent().removeClass('disallowed'); 222 } 223 } 224 } 225 else if (bTransport) { 226 $(relationPlaceSelector).find('input[type=radio]').parent().addClass('disallowed'); 227 $(relationPlaceSelector).find("input[data-relation-id='']").parent().removeClass('disallowed'); 228 } 229 if ($(relationPlaceSelector).find('input[type=radio]:checked').parent().hasClass('disallowed')) { 230 $(relationPlaceSelector).find('input[type=radio]:checked').prop('checked', false); 231 } 232 $(unishop_CartOptionsHFTransportSelector).val(''); 233 $(unishop_CartOptionsHFPaymentSelector).val(''); 234 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').length > 0) 235 $(unishop_CartOptionsHFTransportSelector).val($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val()); 236 if ($(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').length > 0) 237 $(unishop_CartOptionsHFPaymentSelector).val($(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').val()); 238 239 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartPacketaTransportID) { 240 $('#CartOptionsTransportProfile').hide(); 241 $('#CartOptionsTransportPacketa').show(); 242 } 243 else { 244 $('#CartOptionsTransportPacketa').hide(); 245 } 246 247 unishop_CartDHLChange(bTransport); 248 unishop_CartGeisPoint(); 249 unishop_CartGlsParcelShop(); 250 unishop_CartBalikobox(); 251} 252 253function unishop_CartFillOptionsAddress() { 254 $.ajax({
255 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=getcartaddress&ts=" + new Date().getTime(), 256 success: function (html) { 257 if (html) { 258 $(unishop_CartOptionsAddressSelector).html(html); 259 $(unishop_CartOptionsHFAddressSelector).val('-1'); 260 $(unishop_CartOptionsAddressSelector).find("input[value='-1']").prop('checked', true); 261 262 $(unishop_CartOptionsAddressSelector).find('input[type=radio]').click(function () { 263 $(unishop_CartOptionsHFAddressSelector).val($(this).val()); 264 }); 265 } 266 else { $(unishop_CartOptionsAddressSelector).html(''); } 267 } 268 }); 269} 270 271function unishop_CartFillItems() { 272 $.ajax({ 273 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=getcartproducts&ts=" + new Date().getTime(), 274 success: function (html) { 275 $(unishop_CartItemsPreloaderSelector).hide(); 276 if (html) { 277 if ($('.plugin-unishop-cart .process-panel:visible').length == 0) 278 unishop_CartShowPanel(unishop_ShowFirstPanel); 279 280 $(unishop_CartItemsPlaceholderSelector).html(html); 281 $(unishop_CartSummaryItemsPlaceholderSelector).html(html); 282 $(unishop_CartSummaryItemsPlaceholderSelector).find('.remove').remove(); 283 $(unishop_CartSummaryItemsPlaceholderSelector).find('.quantity').each(function () { 284 var iQuantity = $(this).find('input').val(); 285 $(this).html(iQuantity); 286 }); 287 $(unishop_CartItemsPlaceholderSelector).find('.add').click(function () { 288 $(this).blur(); 289 $(unishop_CartItemsPreloaderSelector).show(); 290 var oSender = $(this); 291 if ($(oSender).parent().children('input').val() == '' || $(oSender).parent().children('input').val() == '0') { 292 $(oSender).parent().children('input').val('1'); 293 } 294 var iQuantity = $(oSender).parent().children('input').val().replace(',', '.'); 295 if ($(oSender).attr('data-childs').length > 0) { 296 unishop_RemoveFromCart(0, $(this).attr('data-item-id'), function () { 297 unishop_AddToCart(parseInt($(oSender).attr('data-id')), parseFloat(iQuantity), $(oSender).attr('data-childs').split(','), function () { unishop_CartFillItems(); }); 298 }); 299 } 300 else { 301 unishop_AddToCart(parseInt($(oSender).attr('data-id')), parseFloat(iQuantity), null, function () { unishop_CartFillItems(); }); 302 } 303 return false; 304 }); 305 $(unishop_CartItemsPlaceholderSelector).find('.remove a').click(function () { 306 $(this).parent().parent().fadeOut("slow"); 307 $(this).blur(); 308 $(unishop_CartItemsPreloaderSelector).show(); 309 unishop_RemoveFromCart(0, $(this).attr('data-item-id'), function () { unishop_CartFillItems(); }); 310 return false; 311 }); 312 $(unishop_CartItemsPlaceholderSelector).find('.quantity input').keypress(function (event) { 313 if (event.which == 13) { 314 event.preventDefault(); 315 $(this).blur(); 316 $(this).parent().children('.add').click(); 317 } 318 }); 319 unishop_CartFillItemsTotal(); 320 unishop_CartFillOptions(); 321 } 322 else { 323 $(unishop_CartItemsPlaceholderSelector).html(''); 324 $(unishop_CartSummaryItemsPlaceholderSelector).html(''); 325 $(unishop_CartItemsPlaceholderSelector).html(''); 326 unishop_CartShowPanel(0); 327 } 328 } 329 }); 330} 331 332function unishop_CartFillItemsTotal() { 333 var dTransport = $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').length > 0 ? $(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').attr('data-price') : 0, 334 dPayment = $(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').length > 0 ? $(unishop_CartOptionsPaymentSelector).find('input[type=radio]:checked').attr('data-price') : 0, 335 sCoupon = $('#CartOptionsTicket').val(); 336 $.ajax({
337 url: "/app_plugins/unishop-cart/ajax-public.aspx?part=getcarttotal&coupon=" + sCoupon + "&transport=" + dTransport + "&payment=" + dPayment + "&ts=" + new Date().getTime(), 338 success: function (html) { 339 if (html) { 340 $(unishop_CartTotalSelector).html(html); 341 $(unishop_CartSummaryTotalSelector).html(html); 342 } 343 else { 344 $(unishop_CartTotalSelector).html(''); 345 $(unishop_CartSummaryTotalSelector).html(''); 346 } 347 } 348 }); 349} 350 351function unishop_CartShowPanel(i) { 352 $('.plugin-unishop-cart .process span').removeClass('set'); 353 $('.plugin-unishop-cart .process-panel').hide(); 354 $($('.plugin-unishop-cart .process-panel')[i]).show(); 355 $($('.plugin-unishop-cart .process span')[(i > 0 ? i - 1 : i)]).addClass('set'); 356} 357 358function unishop_CartQuantitySet(sender, up) { 359 var iQuantity = 0; 360 try { 361 iQuantity = parseInt($(sender).parent().parent().find('input').val()); 362 if (isNaN(iQuantity)) 363 iQuantity = 0; 364 } catch (err) { iQuantity = 0; } 365 if (up) 366 iQuantity++; 367 else 368 iQuantity--; 369 if (iQuantity <= 0) 370 iQuantity = 1; 371 $(sender).parent().parent().find('input').val(iQuantity); 372 return false; 373}; 374 375 376 377function unishop_CartDHLChange(autoopen) { 378 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartDhlTransportID) { 379 $('#CartOptionsTransportProfile').hide(); 380 $('#CartOptionsTransportDHLParcelShop').show(); 381 if (autoopen) 382 unishop_CartDHLOpen(); 383 } 384 else { 385 $('#CartOptionsTransportDHLParcelShop').hide(); 386 } 387}; 388var unishop_CartDHLOpenWindow = null; 389function unishop_CartDHLOpen() { 390 var sDHLCallbackURL = 'http://' + window.location.host + '/app_external/dhl.aspx?code={0}&address={1}&name={2}'; 391 var sDHLUrl = 'http://www.dhlbalik.sk/Main3.aspx?cls=KTMMap' 392 + '&KTMAddress=' + encodeURIComponent($(unishop_CartOptionsAddressSelector).find('input[value="-1"]').attr('data-address')) 393 + '&ReturnUrl=' + encodeURIComponent(sDHLCallbackURL); 394 unishop_CartDHLOpenWindow = window.open(sDHLUrl, "DHLParacelShop", "width=1000, height=750, scrollbars=yes"); 395}; 396function unishop_CartDHLCallback(code, address, name) { 397 if (code) { 398 $('#CartOptionsTransportDHLParcelShop strong').html('Adresa: ' + address + ', Názov: ' + name); 399 $('#CartOptionsTransportDHLParcelShop input').val('Kód: ' + code + ', Adresa: ' + address + ', Názov: ' + name); 400 } 401}; 402 403 404var unishop_CartBalikoboxInited = false; 405function unishop_CartBalikoboxInit() { 406 if (!unishop_CartBalikoboxInited) { 407 unishop_CartBalikoboxInited = true; 408 409 $.getJSON("/app_files/balikobox.json", function (json) { 410 if (json.length > 0) { 411 412 var lCity = []; 413 $.each(json, function (index, value) { 414 if (lCity.indexOf(value.city) == -1) { 415 lCity.push(value.city); 416 } 417 }); 418 lCity.sort(); 419 420 //Obce 421 if (lCity.length > 0) { 422 $('#DDLBalikoboxCity').html(''); 423 $('#DDLBalikoboxCity').append('<option value="">Vyberte obec...</option>'); 424 $.each(lCity, function (index, value) { 425 $('#DDLBalikoboxCity').append('<option value="' + value + '">' + value + '</option>'); 426 }); 427 $('#DDLBalikoboxCity').show(); 428 } 429 430 //Odberné miesta 431 $('#DDLBalikoboxCity').change(function () { 432 $('#DivBalikoboxPlaces').hide().html(''); 433 if ($('#DDLBalikoboxCity').val() != '') { 434 $('#DivBalikoboxPlaces').show(); 435 $.getJSON("/app_files/balikobox.json", function (json) { 436 if (json.length > 0) { 437 438 var lPlace = []; 439 var sPlaceCity = $('#DDLBalikoboxCity').val(); 440 441 $.each(json, function (index, value) { 442 if (value.city == sPlaceCity) { 443 lPlace.push(value); 444 } 445 }); 446 447 $.each(lPlace, function (index, value) { 448 $('#DivBalikoboxPlaces').append('<div class="place">\ 449 <input type="radio" name="balikobox" value="' + value.zip + '">\ 450 <sp
450an class="place-name">' + value.name + '</span>\ 451 <a href="https://www.google.com/maps?q=' + value.name.replace(new RegExp('"', 'g'), '') + '" target="_blank" class="place-detail">Mapa</a>\ 452 </div>'); 453 }); 454 $('#DivBalikoboxPlaces .place').click(function () { 455 if ($('a:hover').length == 0) { 456 $(this).find('input[type=radio]').prop('checked', true); 457 } 458 }); 459 } 460 }); 461 } 462 }); 463 } 464 }); 465 } 466}; 467function unishop_CartBalikobox() { 468 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartBalikoboxTransportID) { 469 unishop_CartBalikoboxInit(); 470 $('#CartOptionsTransportProfile').hide(); 471 $('#CartOptionsTransportBalikobox').show(); 472 } 473 else { 474 $('#CartOptionsTransportBalikobox').hide(); 475 } 476}; 477 478 479 480 481 482var unishop_CartGeisPointInited = false; 483function unishop_CartGeisPointInit() { 484 if (!unishop_CartGeisPointInited) { 485 unishop_CartGeisPointInited = true; 486 $("#CartOptionsTransportGeisDetail").dialog({ modal: true, appendTo: "form", autoOpen: false, buttons: [{ text: 'Ok', click: function () { $(this).dialog("close"); } }] }); 487 488 //Kraje 489 $.getJSON("/app_plugins/unishop-cart/geis.aspx?part=getregions&ts=" + new Date().getTime(), function (json) { 490 $('#DDLGeisRegion').html(''); 491 $('#DDLGeisRegion').append('<option value="">Vyberte kraj...</option>'); 492 if (json.length > 0) { 493 $.each(json, function (index, value) { 494 $('#DDLGeisRegion').append('<option value="' + value.idRegion + '">' + value.name + '</option>'); 495 }); 496 } 497 }); 498 //Obce 499 $('#DDLGeisRegion').change(function () { 500 $('#DivGeisPlaces').hide().html(''); 501 $('#DDLGeisCity').hide().html(''); 502 $('#DDLGeisCity').append('<option value="">Vyberte obec...</option>'); 503 if ($('#DDLGeisRegion').val() != '') { 504 $('#DDLGeisCity').show(); 505 $.getJSON("/app_plugins/unishop-cart/geis.aspx?part=getcities®ion=" + $('#DDLGeisRegion').val() + "&ts=" + new Date().getTime(), function (json) { 506 if (json.length > 0) { 507 $.each(json, function (index, value) { 508 $('#DDLGeisCity').append('<option value="' + value.city + '">' + value.city + '</option>'); 509 }); 510 } 511 }); 512 } 513 }); 514 //Odberné miesta 515 $('#DDLGeisCity').change(function () { 516 $('#DivGeisPlaces').hide().html(''); 517 if ($('#DDLGeisCity').val() != '') { 518 $('#DivGeisPlaces').show(); 519 $.getJSON("/app_plugins/unishop-cart/geis.aspx?part=searchgp&city=" + $('#DDLGeisCity').val() + "&ts=" + new Date().getTime(), function (json) { 520 if (json.length > 0) { 521 $.each(json, function (index, value) { 522 $('#DivGeisPlaces').append('<div class="place">\ 523 <input type="radio" name="geisplace" value="' + value.idGP + '">\ 524 <span class="place-name">' + value.name + '</span>\ 525 <span class="place-street">' + value.street + '</span>\ 526 <a href="/" data-id="' + value.idGP + '" class="place-detail">INFO</a>\ 527 </div>'); 528 }); 529 $('#DivGeisPlaces .place').click(function () { 530 if ($('a:hover').length == 0) { 531 $(this).find('input[type=radio]').prop('checked', true); 532 } 533 }); 534 $('#DivGeisPlaces .place a').click(function () { 535 $.getJSON("/app_plugins/unishop-cart/geis.aspx?part=getgpdetail&id=" + $(this).attr('data-id') + "&ts=" + new Date().getTime(), function (json) { 536 if (json) { 537 var sHTMLDetail = '<strong>' + json[0].name + '</strong><br />'; 538 sHTMLDetail += json[0].street + '<br />'; 539 sHTMLDetail += json[0].city + '<br />'; 540 sHTMLDetail += 'E-mail: <a href="mailto:' + json[0].email + '">' + json[0].email + '</a><br />'; 541 sHTMLDetail += '<a href="' + decodeURIComponent(json[0].mapUrl) + '" target="_blank" style="text-decoration: underline;
541 color: #330000;">Zobraziť na mape</a><br /><br />'; 542 sHTMLDetail += json[0].openingHours.replace(/;/g, '<br />') + '<br />'; 543 $("#CartOptionsTransportGeisDetail").html(sHTMLDetail).dialog('open'); 544 } 545 }); 546 return false; 547 }); 548 } 549 }); 550 } 551 }); 552 } 553}; 554function unishop_CartGeisPoint() { 555 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartGeisTransportID) { 556 unishop_CartGeisPointInit(); 557 $('#CartOptionsTransportProfile').hide(); 558 $('#CartOptionsTransportGeis').show(); 559 } 560 else { 561 $('#CartOptionsTransportGeis').hide(); 562 } 563}; 564 565 566 567 568 569var unishop_CartGlsParcelShopInited = false; 570var unishop_CartGlsParcelShopMap; 571function unishop_CartGlsParcelShopInit() { 572 if (!unishop_CartGlsParcelShopInited) { 573 unishop_CartGlsParcelShopInited = true; 574 $('#CartGlsMapPopup').dialog({ 575 height: 'auto', width: '100%', resizable: false, draggable: false, autoOpen: false, appendTo: "form", modal: true, create: function () { 576 $(this).parent().css('maxWidth', '1000px'); 577 } 578 }); 579 unishop_CartGlsParcelShopMap = new GLSPSMap(); 580 unishop_CartGlsParcelShopMap.init('SK', 'glsmapcanvas', 'Kpt. Jána Nálepku 88, 934 01 Levice, SK', 0); 581 google.maps.event.trigger(unishop_CartGlsParcelShopMap, 'resize'); 582 } 583} 584function unishop_CartGlsParcelShopOpen() { 585 $('#CartGlsMapPopup').dialog('open'); 586} 587function glsPSMap_OnSelected_Handler(data) { 588 console.log(data); 589 590 var place = data.name + ', ' + data.address + ', ' + data.city + ' ' + data.zipcode + ' (' + data.pclshopid + ')'; 591 592 $('#CartGlsSelected').html(place).attr('title', place); 593 $('#' + unishop_CartGlsTransportHFID).val(place); 594 $('#CartGlsMapPopup').dialog('close'); 595 596} 597function unishop_CartGlsParcelShop() { 598 if ($(unishop_CartOptionsTransportSelector).find('input[type=radio]:checked').val() == unishop_CartGlsTransportID) { 599 unishop_CartGlsParcelShopInit(); 600 $('#CartOptionsTransportProfile').hide(); 601 $('#CartOptionsTransportGls').show(); 602 } 603 else { 604 $('#CartOptionsTransportGls').hide(); 605 } 606}; 607 608 609
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.