1/// <reference path="../../Modules/XHR.ts" /> 2// @ts-ignore 3var defer; 4// @ts-ignore 5const currentCulturePrefix = ZepterEcommerceScripts.settings.CurrentCulturePrefix; 6class ShoppingCart { 7 constructor() { 8 var _a, _b; 9 this.itemsCount = 0; 10 this.isMouseOver = false; 11 this.isPopupVisible = false; 12 this.hideDelay = 500; 13 this.animDuration = 200; 14 this.popupEnabled = true; 15 this.eventUpdatecartName = "updatecart"; 16 this.eventUpdatecart = new CustomEvent(this.eventUpdatecartName, { bubbles: true }); 17 this.takeItemsCountFromCartData = false; 18 this.itemsCountElementId = "Header_ShoppingCart_ItemsCount"; 19 this.containerPopupElementId = "Header_ShoppingCart_PopUp"; 20 this.elProcessing = null; 21 this.renderProcessing = () => { 22 // Stwórz element 23 let wrapper = document.createElement("div"); 24 wrapper.setAttribute("class", "V2_TopNavigation_CartPopup_Processing"); 25 // Dodaj ikonkÄ 26 let icon = document.createElement("div"); 27 icon.setAttribute("class", "V2_TopNavigation_CartPopup_Processing_Icon"); 28 icon.innerHTML = '<i class="fas fa-circle-notch"></i>'; 29 wrapper.appendChild(icon); 30 // Return 31 this.elProcessing = wrapper; 32 return wrapper; 33 }; 34 this.showProcessing = () => { 35 this.elProcessing.classList.add("V2_TopNavigation_CartPopup_Processing_Visible"); 36 }; 37 this.hideProcessing = () => { 38 this.elProcessing.classList.remove("V2_TopNavigation_CartPopup_Processing_Visible"); 39 }; 40 this.remarketingAction = (entry, action) => { 41 if (ZepterEcommerceScripts.Remarketing !== undefined) { 42 const productLine = this.createRemarketProductLine(entry); 43 //console.log(productLine); 44 //return; // @ts-ignore 45 // Increase item qty in cart 46 if (action == "increase") { 47 // @ts-ignore 48 ZepterEcommerceScripts.Remarketing.onAddToCart(productLine); 49 } 50 // Decrease item qty in cart 51 else if (action == "decrease") { 52 // @ts-ignore 53 ZepterEcommerceScripts.Remarketing.onRemoveFromCart(productLine); 54 } 55 // Remove item from cart 56 else if (action == "remove") { 57 // @ts-ignore 58 ZepterEcommerceScripts.Remarketing.onRemoveProductLineFromCart(productLine); 59 } 60 } 61 }; 62 // Stwórz element dla akcji remarketingowej 63 // który zawiera dane o produkcie 64 this.createRemarketProductLine = (entry) => { 65 const el = document.createElement("div"); 66 el.dataset.remarketProductid = entry.SKUNumber; 67 el.dataset.remarketItemvalue = entry.UnitPrice.replace(/[^0-9,.]/g, ""); 68 el.dataset.remarketPagetype = "Cart"; 69 el.dataset.remarketPagename = "Cart"; 70 el.dataset.remarketBrand = entry.brand; 71 el.dataset.remarketCategory = entry.category; 72 el.dataset.remarketModel = entry.SKUName; 73 return el; 74 }; 75 let c = this; 76 // Kontener wszyskiego 77 this.container = document.getElementById("Header_ShoppingCart"); 78 // Kontener z blokiem 79 this.containerBlockCart = document.getElementById("Header_ShoppingCart_BlockCart"); 80 // Kontener z iloÅciÄ produktów w koszyku 81 this.itemsCountElement = document.getElementById(this.itemsCountElementId); 82 // Uruchom event nasÅuchujÄ cy zmiany w koszyku 83 var that = this; 84 document.addEventListener(this.eventUpdatecartName, function (ev) { that.onUpdateCart(ev); }); 85 // JeÅli pokazywanie popupa jest zablokowane w settings 86 if (((_a = this.container) === null || _a === void 0 ? void 0 : _a.getAttribute("data-popup-enabled")) != "true") { 87 this.popupEnabled = false; 88 } 89 // Nie twórz popupa na stronie z koszykiem 90 if (document.location.href.match(/Checkout\/ShoppingCart/)) { 91 this.popupEnabled = false;
92 // Zablokuj ikonkÄ koszyka (nieaktywna dla kursora) 93 (_b = this.container) === null || _b === void 0 ? void 0 : _b.classList.add("pointer-events-none"); 94 } 95 // Pobierz iloÅÄ elementów znajdujÄ cych siÄ w koszyku z ikonki koszyka 96 this.itemsCount = this.cartIconGetItemsCount(); 97 // Sklonuj koszyk PC do widoku Mobile na starcie 98 this.clonePCCartToMobileView(); 99 // Nie twórz popupa jeÅli koszyk jest pusty 100 //if (this.itemsCount == 0) { 101 // return 102 //} 103 // JeÅli popup ma byÄ widoczny 104 if (this.popupEnabled == true) { 105 // Kontener popup-a 106 this.containerPopup = document.createElement("div"); 107 this.containerPopup.setAttribute("id", this.containerPopupElementId); 108 this.containerPopup.setAttribute("class", "d-none position-relative"); 109 this.container.appendChild(this.containerPopup); 110 // Inicjuj eventy pokazywania/ukrywania konternera popup-a dla kurs
110ora myszy 111 this.container.onmouseenter = function () { 112 c.showPopup(); 113 }; 114 this.container.onmouseleave = function () { 115 c.hidePopup(); 116 }; 117 // OdÅwież caÅoÅÄ tego widgetu 118 this.refresh(); 119 } 120 } 121 refresh() { 122 // JeÅli popup jest widoczny 123 if (this.popupEnabled == true) { 124 // OdÅwież caÅy front tego widgetu 125 this.xhrGetData().then((response) => this.processingResponseData(response).then(() => this.renderPopup())); 126 } 127 return; 128 } 129 cartIconGetItemsCount() { 130 // Pobranie iloÅci elementów znajdujÄ cych siÄ w koszyku z elementu HTML obok ikonki koszyka 131 let itemsCountElement = document.getElementById(this.itemsCountElementId); 132 // JeÅli nie udaÅo siÄ ustaliÄ elementu HTML z iloÅciÄ 133 if (!itemsCountElement) { 134 // Zawsze zwracaj 0 135 return 0; 136 } 137 else { 138 // ZwrÃ³Ä iloÅÄ elementów w koszyku 139 return parseInt(itemsCountElement.textContent.trim()); 140 } 141 } 142 cartIconUpdateItemsCount() { 143 let c = this; 144 // Aktualizacja iloÅci elementów znajdujÄ cych siÄ w koszyku w elemencie HTML obok ikonki koszyka 145 function updateCartIconCount(count) { 146 if (c.itemsCountElement instanceof HTMLElement && c.containerBlockCart instanceof HTMLElement) { 147 //let itemsCount: number = this.cartData.CartItems.length 148 if (c.itemsCountElement) { 149 c.itemsCountElement.innerText = count.toString(); 150 } 151 // Zaktualizuj stan ikony koszyka (aktywna/nieaktywna) 152 // w zależnoÅci od tego czy koszyk jest pusty czy posiada zawartoÅÄ 153 if (c.containerBlockCart) { 154 if (count > 0) { 155 // Aktywuj ikonÄ koszyka 156 c.containerBlockCart.classList.remove("empty-cart"); 157 } 158 else { 159 // Dezaktywuj ikonÄ koszyka (wygaszona) 160 c.containerBlockCart.classList.add("empty-cart"); 161 } 162 } 163 } 164 } 165 // Pobierz iloÅÄ produktów z danych koszyka pobranych dla popupa (sÄ już w pamiÄci) 166 if (this.takeItemsCountFromCartData == true) { 167 let count = this.cartData.CartTotalUnitsCount; 168 this.takeItemsCountFromCartData = false; 169 updateCartIconCount(count); 170 } 171 // Pobierz iloÅÄ produktów w koszyku z osobnego WebService (osobne zaputanie do API) 172 else { 173 this.xhrGetShoppingCartItemsCount().then((response) => updateCartIconCount(parseInt(response))); 174 } 175 } 176 onUpdateCart(e) { 177 // Zaktualizuj iloÅÄ przy ikonce koszyka 178 this.cartIconUpdateItemsCount(); 179 // Klonuj wersjÄ PC do widoku Mobile 180 this.clonePCCartToMobileView(); 181 } 182 clonePCCartToMobileView() { 183 var containerMobile = document.getElementById("Header_ShoppingCart_Mobile"); 184 if (containerMobile) { 185 containerMobile.innerText = ""; 186 containerMobile.appendChild(this.containerBlockCart.cloneNode(true)); 187 } 188 } 189 async xhrGetShoppingCartItemsCount() { 190 // Pobieranie danych z backendu - iloÅÄ elementów w koszyku 191 let XHR = new Module_XHR(); 192 XHR.CacheDisable(); 193 //XHR.SetParams({}) 194 XHR.SetMethod("POST"); 195 //console.log("xhrGetShoppingCartItemsCount - before"); 196 XHR.SetURL(currentCulturePrefix + "/Checkout/GetShoppingCartItemsCount"); 197 let response = await XHR.Get(); 198 //console.log("xhrGetShoppingCartItemsCount - after"); 199 return response; 200 } 201 async xhrGetData() { 202 // Pobieranie danych z backendu - zawartoÅÄ popupa koszyka 203 let XHR = new Module_XHR(); 204 XHR.CacheDisable(); 205 //XHR.SetParams({}) 206 XHR.SetMethod("POST"); 207 //console.log("xhrGetData - before"); 208 // @ts-ignore 209 XHR.SetURL(currentCulturePrefix + "/Checkout/ShowShoppingCartPopup"); 210 let response = await XHR.Get(); 211 //console.log("xhrGetData - after"); 212 return response; 213 } 214 async xhrItemDecrease(SKUID) { 215 // Komunikacja z backendem - odjÄcie iloÅci produktu w koszyku 216 let XHR = new Module_XHR(); 217 XHR.CacheDisable(); 218 XHR.SetParams({ SKUID: SKUID }); 219 XHR.SetMethod("POST"); 220 //console.log("xhrItemDecrease - before"); 221 // @ts-ignore 222 XHR.SetURL(currentCulturePrefix + "/Checkout/DecreaseItemShoppingCartPopup"); 223 let response = await XHR.Get(); 224 //console.log("xhrItemDecrease - after"); 225 return response; 226 } 227 async xhrItemIncrease(SKUID) { 228 // Komunikacja z backendem - dodanie iloÅci produktu w koszyku 229 let XHR = new Module_XHR(); 230 XHR.CacheDisable(); 231 XHR.SetParams({ SKUID: SKUID }); 232 XHR.SetMethod("POST"); 233 //console.log("xhrItemDecrease - before"); 234 // @ts-ignore 235 XHR.SetURL(currentCulturePrefix + "/Checkout/IncreaseItemShoppingCartPopup"); 236 let response = await XHR.Get(); 237 //console.log("xhrItemDecrease - after"); 238 return response; 239 } 240 async xhrItemRemove(SKUID) { 241 // Komunikacja z backendem - usuniÄcie produktu z koszyka 242 let XHR = new Module_XHR(); 243 XHR.CacheDisable(); 244 XHR.SetParams({ SKUID: SKUID }); 245 XHR.SetMethod("POST"); 246 //console.log("xhrItemRemove - before"); 247 // @ts-ignore 248 XHR.SetURL(currentCulturePrefix + "/Checkout/RemoveItemShoppingCartPopup"); 249 let response = await XHR.Get(); 250 //console.log("xhrItemRemove - after"); 251 return response; 252 } 253 async processingResponseData(response) { 254 // Zmiana pobranych z backendu danych na format JSON 255 this.cartData = JSON.parse(response); 256 return; 257 } 258 showPopup() { 259 // Pokaż popup z listÄ produktów w koszyku 260 this.isMouseOver = true; 261 clearTimeout(this.animTimeout); 262 // Nie wykonuj tej metody jeÅli popup już jest widoczny 263 if (this.isPopupVisible) { 264 return; 265 } 266 // NBie wykonuj tej metody jeÅli brakuje elementu HTML dla popupa 267 if (!this.containerPopup || !this.wrapperPopup) { 268 return; 269 } 270 // Przygotuj popup do pokazania 271 this.containerPopup.classList.remove("d-none"); 272 this.wrapperPopup.style.height = "auto"; 273 let popupHeight = this.wrapperPopup.clientHeight + 2; 274 this.wrapperPopup.classList.add("invisible"); 275 this.wrapperPopup.style.height = "0"; 276 // Uruchom sekwencjÄ pokazywania popupa z lekkim opóźnieneim 277 let c = this; 278 this.animTimeout = window.setTimeout(function () { 279 c.wrapperPopup.classList.remove("invisible"); 280 c.wrapperPopup.style.height = popupHeight + "px"; 281 c.isPopupVisible = true; 282 }, 10); 283 return; 284 } 285 hidePopup() { 286 // Ukryj popup z listÄ produktów w koszyku 287 this.isMouseOver = false; 288 clearTimeout(this.animTimeout); 289 // Nie wykonuj tej metody jeÅli popup jest już ukryty 290 if (this.isPopupVisible == false) { 291 return; 292 } 293 // Uruchom sekwencjÄ ukrywania popupa z lekkim opóźnieneim 294 let c = this; 295 this.animTimeout = window.setTimeout(function () { 296 c.wrapperPopup.style.height = "0"; 297 c.animTimeout = window.setTimeout(function () { 298 c.containerPopup.classList.add("d-none"); 299 c.isPopupVisible = false; 300 }, c.animDuration); 301 }, this.hideDelay); 302 return; 303 } 304 renderPopup() { 305 // WyczyÅÄ popup 306 this.containerPopup.innerHTML = ""; 307 // Nie generuj popupa jeÅli iloÅÄ elementów w koszyku wynosi zero 308 if (this.cartData.CartItems.length == 0) { 309 document.dispatchEvent(this.eventUpdatecart); 310 return; 311 } 312 // Wrapper 313 this.wrapperPopup = document.createElement("div"); 314 this.wrapperPopup.setAttribute("class", "V2_TopNavigation_CartPopup"); 315 this.wrapperPopup.style.transition = "height " + (this.animDuration / 1000) + "s ease-in-out"; 316 this.containerPopup.appendChild(this.wrapperPopup); 317 // Ukryj tooltip przy ikonce z koszykiem 318 this.wrapperPopup.addEventListener("mousemove", () => {
319 window.dispatchEvent(new Event("Zepter_V2_Tooltips_Hide")); 320 }); 321 // Dodaj wygenerowanÄ listÄ produktów 322 this.renderEntries().then((res) => this.wrapperPopup.appendChild(res)); 323 // Dodaj podsumowanie 324 this.renderSummary().then((res) => this.wrapperPopup.appendChild(res)); 325 // Dodaj processing 326 this.wrapperPopup.appendChild(this.renderProcessing()); 327 // Pokaż processing 328 this.showProcessing(); 329 // Ukryj processing 330 window.setTimeout(() => { 331 this.hideProcessing(); 332 }, 500); 333 // Uruchom event updatecart 334 this.takeItemsCountFromCartData = true; 335 document.dispatchEvent(this.eventUpdatecart); 336 return; 337 } 338 refreshPrices() { 339 // @ts-ignore 340 let controller = $("body").attr("data-controller"); 341 if (controller.toLocaleLowerCase() == "product") { 342 // @ts-ignore 343 let category = $("body").attr("data-productpage-category"); 344 // @ts-ignore 345 let subcategory = $("body").attr("data-productpage-subcategory"); 346 // @ts-ignore 347 let skuID = $("body").attr("data-productpage-skuid"); 348 if (category != null && category != '' && category != undefined) { 349 // @ts-ignore 350 $.ajax({
351 method: "POST", 352 // @ts-ignore 353 url: currentCulturePrefix + "/Product/DetailPartial", 354 data: { 355 // @ts-ignore 356 variantOptionID: $('#VariantsDropDownID').val(), 357 skuID: skuID, 358 category: category, 359 subcategory: subcategory 360 }, 361 success: function (data) { 362 // @ts-ignore 363 $('#ProductDetailParitalView').html(data); 364 setTimeout(() => { 365 document.dispatchEvent(new CustomEvent("product_imagegallery_refresh", { bubbles: true })); 366 document.dispatchEvent(new CustomEvent("product_variantselector_refresh", { bubbles: true })); 367 document.dispatchEvent(new CustomEvent("product_tabs_refresh", { bubbles: true })); 368 document.dispatchEvent(new CustomEvent("product_relatedproducts_refresh", { bubbles: true })); 369 document.dispatchEvent(new CustomEvent("product_addtocart_refresh", { bubbles: true })); 370 document.dispatchEvent(new CustomEvent("products_listitems_refresh", { bubbles: true })); 371 document.dispatchEvent(new CustomEvent("commission-calculator-init-all-containers", { bubbles: true })); 372 }, 0); 373 // Piotr dodaÄ na stronie produktu obsÅugÄ ajaxowa buttonów, ale tylko dla produktu, dla powiazanych dziaÅa 374 } 375 }); 376 } 377 } 378 else if (controller.toLocaleLowerCase() == "zepterproducts") { 379 // @ts-ignore 380 $("#ddlProductListSortControl").trigger('change'); 381 } 382 else if (controller.toLocaleLowerCase() == "promotions") { 383 // @ts-ignore 384 $("#ddlPromotionsProductListSortControl").trigger('change'); 385 } 386 else if (controller.toLocaleLowerCase() == "affiliatepromotions") { 387 // @ts-ignore 388 $("#ddlAffiliatePromotionsProductListSortControl").trigger('change'); 389 } 390 else if (controller.toLocaleLowerCase() == "search") { 391 // @ts-ignore 392 $("#ddlSearchProductListSortControl").trigger('change'); 393 } 394 else if (controller.toLocaleLowerCase() == "clearance") { 395 // @ts-ignore 396 $("#ddlClearanceProductListSortControl").trigger('change'); 397 } 398 else if (controller.toLocaleLowerCase() == "home") { 399 // @ts-ignore 400 $.ajax({
401 method: "POST", 402 // @ts-ignore 403 url: currentCulturePrefix + "/Home/IndexPartial", 404 data: {}, 405 success: function (data) { 406 // @ts-ignore 407 $('#home_index_html').html(data); 408 // Piotr strona home odÅwieżenie produktów obrazki i slidera i buttonów ajaxowych 409 document.dispatchEvent(new CustomEvent("products_listitems_refresh", { bubbles: true })); 410 document.dispatchEvent(new CustomEvent("home_sliderwidget_refresh", { bubbles: true })); 411 } 412 }); 413 } 414 return; 415 } 416 async renderEntries() { 417 let c = this; 418 // Stwórz listÄ produktów 419 let entries = document.createElement("div"); 420 entries.setAttribute("class", "V2_TopNavigation_CartPopup_Items"); 421 // Przetrwarzaj listÄ produktów pobranÄ z backendu 422 function addEntry(entry, index) { 423 let isLastEntry = index == c.cartData.CartItems.length - 1; 424 // Row 425 let entryRow = document.createElement("div"); 426 entryRow.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item"); 427 // JeÅli to nie jest ostatni rekord 428 if (isLastEntry) { 429 // Dodaj liniÄ oddzielajÄ cÄ rekordy 430 entryRow.classList.add("V2_TopNavigation_CartPopup_Items_Item_Last"); 431 } 432 entries.appendChild(entryRow); 433 // Cell Remove 434 let entryRemoveCell = document.createElement("div"); 435 entryRemoveCell.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Remove"); 436 entryRemoveCell.onclick = function () { 437 c.showProcessing(); 438 c.xhrItemRemove(entry.SKUID).then(() => { 439 c.remarketingAction(entry, "remove"); 440 c.refresh(); 441 }).then(() => c.refreshPrices()); 442 }; 443 entryRow.appendChild(entryRemoveCell); 444 // Cell Remove - Icon 445 let entryRemoveIcon = document.createElement("i"); 446 entryRemoveIcon.setAttribute("class", "fas fa-times"); 447 entryRemoveCell.appendChild(entryRemoveIcon); 448 // Cell Image 449 let entryImageCell = document.createElement("div"); 450 entryImageCell.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Photo"); 451 entryRow.appendChild(entryImageCell); 452 // Cell Image - Img 453 let entryImageImg = document.createElement("img"); 454 entryImageImg.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Photo_Image"); 455 entryImageImg.setAttribute("src", entry.SKUImage + "?maxsidesize=50&resizemode=force"); 456 entryImageCell.appendChild(entryImageImg); 457 // Cell Data 458 let entryDataCell = document.createElement("div"); 459 entryDataCell.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Data"); 460 entryRow.appendChild(entryDataCell); 461 // Cell Data - Name 462 let entryDataName = document.createElement("a"); 463 entryDataName.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Data_ProductName"); 464 entryDataName.setAttribute("href", entry.URL); 465 entryDataName.innerHTML = entry.SKUName; 466 entryDataCell.appendChild(entryDataName); 467 // Cell Data - SKUID 468 let entryDataSKUNumber = document.createElement("p"); 469 entryDataSKUNumber.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Data_ProductSKUID"); 470 entryDataSKUNumber.innerHTML = entry.SKUNumber; 471 entryDataCell.appendChild(entryDataSKUNumber); 472 // Cell Data - Description 473 let entryDataDescription = document.createElement("p"); 474 entryDataDescription.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_Data_ProductDescription"); 475 entryDataDescription.innerHTML = entry.SKUBasketDescription; 476 entryDataCell.appendChild(entryDataDescription); 477 // Cell Price & Quantity 478 let entryPriceQuantityCell = document.createElement("div"); 479 entryPriceQuantityCell.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions"); 480 entryRow.appendChild(entryPriceQuantityCell); 481 // Cell Price & Quantity - Price 482 let entryPrice = document.createElement("span"); 483 entryPrice.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Price"); 484 entryPrice.textContent = entry.ItemTotalPrice; 485 entryPriceQuantityCell.appendChild(entryPrice); 486 // Cell Price & Quantity - Quantity 487 let entryQuantity = document.createElement("div"); 488 entryQuantity.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Quantity"); 489 entryPriceQuantityCell.appendChild(entryQuantity); 490 // Cell Price & Quantity - Quantity - Minus 491 let entryQuantityMinus = document.createElement("div"); 492 entryQuantityMinus.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Quantity_Icon"); 493 entryQuantityMinus.innerHTML = "<i class=\"fas fa-chevron-left px-1\"></i>"; 494 entryQuantityMinus.onclick = function () { 495 c.showProcessing(); 496 c.xhrItemDecrease(entry.SKUID).then(() => { 497 c.remarketingAction(entry, "decrease"); 498 c.refresh();
499 }).then(() => c.refreshPrices()); 500 }; 501 entryQuantity.appendChild(entryQuantityMinus); 502 // Cell Price & Quantity - Quantity - Value 503 let entryQuantityValue = document.createElement("div"); 504 entryQuantityValue.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Quantity_Value"); 505 entryQuantityValue.innerText = entry.Quantity.toString(); 506 entryQuantity.appendChild(entryQuantityValue); 507 // Cell Price & Quantity - Quantity - Plus 508 let entryQuantityPlus = document.createElement("div"); 509 entryQuantityPlus.setAttribute("class", "V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Quantity_Icon"); 510 entryQuantityPlus.innerHTML = "<i class=\"fas fa-chevron-right px-1\"></i>"; 511 entryQuantityPlus.onclick = function () { 512 c.showProcessing(); 513 c.xhrItemIncrease(entry.SKUID).then(() => { 514 c.remarketingAction(entry, "increase"); 515 c.refresh(); 516 }).then(() => c.refreshPrices()); 517 }; 518 if (entry.Quantity >= entry.MaxQuantity) { 519 entryQuantityPlus.classList.add("V2_TopNavigation_CartPopup_Items_Item_CartFunctions_Quantity_Icon_Disabled"); 520 } 521 entryQuantity.appendChild(entryQuantityPlus); 522 } 523 // Dodaj wiersze na postawie listy pobranej z backendu 524 this.cartData.CartItems.forEach(addEntry); 525 // ZwrÃ³Ä wynik 526 return entries; 527 } 528 async renderSummary() { 529 let c = this; 530 // Stwórz podsumowanie 531 let summary = document.createElement("div"); 532 summary.setAttribute("class", "V2_TopNavigation_CartPopup_Summary"); 533 // Dodaj kwotÄ 534 let totalRow = document.createElement("div"); 535 totalRow.setAttribute("class", "V2_TopNavigation_CartPopup_Summary_Total"); 536 summary.appendChild(totalRow); 537 let totalLabel = document.createElement("div"); 538 totalLabel.setAttribute("class", "V2_TopNavigation_CartPopup_Summary_Total_Label"); 539 totalLabel.innerHTML = this.cartData.CartTotalLabel + ":"; 540 totalRow.appendChild(totalLabel); 541 let totalSum = document.createElement("div"); 542 totalSum.setAttribute("class", "V2_TopNavigation_CartPopup_Summary_Total_Price"); 543 totalSum.innerHTML = this.cartData.CartTotalPrice; 544 totalRow.appendChild(totalSum); 545 // Dodaj przycisk prowadzÄ cy do koszyka 546 let shoplinkRow = document.createElement("div"); 547 shoplinkRow.setAttribute("class", "total d-flex d-flex-row justify-content-end"); 548 summary.appendChild(shoplinkRow); 549 let shoplinkButton = document.createElement("button"); 550 shoplinkButton.setAttribute("class", "btn btn-primary btn-sm line-height-1 tw-bg-zepblue-500"); 551 shoplinkButton.innerHTML = this.cartData.CartButtonText + " <i class=\"fas fa-arrow-right\"></i>"; 552 shoplinkButton.onclick = function () { 553 document.location.href = currentCulturePrefix + "/Checkout/ShoppingCart"; 554 }; 555 shoplinkRow.appendChild(shoplinkButton); 556 // JeÅli aktualnie jest otwarty sklep przedstawiciela 557 if (this.cartData.IsAffiliateSite) { 558 // Dodaj informacjÄ o sklepie dla przedstawiciela 559 let affiliateSiteRow = document.createElement("div"); 560 affiliateSiteRow.setAttribute("class", "affiliate-site-info mt-2 pt-2 border-top d-flex d-flex-row justify-content-end"); 561 summary.appendChild(affiliateSiteRow); 562 let affiliateSiteInfoText = document.createElement("div"); 563 affiliateSiteInfoText.setAttribute("class", "line-height-1 font-size-small"); 564 affiliateSiteInfoText.innerHTML = this.cartData.RedirectToOfficialStoreInfo; 565 affiliateSiteRow.appendChild(affiliateSiteInfoText); 566 } 567 // ZwrÃ³Ä wynik 568 return summary; 569 } 570} 571// Inicjalizuj kontroler Shopping Cart 572var Layout_Header_ShoppingCart; 573window.addEventListener("DOMContentLoaded", function () { 574 Layout_Header_ShoppingCart = new ShoppingCart(); 575}, false); 576//# sourceMappingURL=ShoppingCart.js.map
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.