1var LiteEvent = /** @class */ (function () { 2 function LiteEvent() { 3 this.handlers = []; 4 } 5 LiteEvent.prototype.on = function (handler) { 6 this.handlers.push(handler); 7 }; 8 LiteEvent.prototype.off = function (handler) { 9 this.handlers = this.handlers.filter(function (h) { return h !== handler; }); 10 }; 11 LiteEvent.prototype.trigger = function (data) { 12 this.handlers.slice(0).forEach(function (h) { return h(data); }); 13 }; 14 return LiteEvent; 15}()); 16/** 17 * Created by pmacko on 08.07.2016. 18 */ 19/// <reference path="../jsrender/jsrender.d.ts" /> 20var BasketNotification = /** @class */ (function () { 21 function BasketNotification() { 22 } 23 BasketNotification.setLoading = function (changeMade) { 24 var ddl = $('.basket-quickview-wrapper'); 25 ddl.html(''); 26 ddl.append($.templates("#basket-items-loading-template").render()); 27 }; 28 BasketNotification.notify = function (changeMade) { 29 var basket = Basket.instance(); 30 var ddl = $('.basket-quickview-wrapper'); 31 ddl.html(''); 32 ddl.append($.templates("#basket-quickview-template").render()); 33 $('.basket-total-price').text(basket.price.toFixed(2)); 34 $('.basket-total-products').text(basket.productsCount); 35 $('.basket-dropdown-items').html($.templates("#basket-items-loading-template").render()); 36 BasketNotification.notifyTopBarBasket(basket, changeMade); 37 $('.basket-item').each(function () { 38 var el = $(this); 39 var key = $(el).find('.product-guid').val(); 40 if (key in basket.items) { 41 var product = basket.items[key]; 42 el.find('.basket-item-total-price').text(product.price.toFixed(2)); 43 } 44 else { 45 el.remove(); 46 } 47 }); 48 }; 49 BasketNotification.notifyTopBarBasket = function (basket, changeMade) { 50 var ddl = $('.basket-dropdown-items'); 51 ddl.html(''); 52 var count = 0; 53 for (var i in basket.items) { 54 count++; 55 var text = $.templates("#basket-item-menu-template").render(basket.items[i]); 56 ddl.append(text); 57 } 58 ddl.append($.templates("#basket-items-footer-template").render()); 59 if (count > 0) { 60 $('.basket-side-dropdown').show(); 61 } 62 else { 63 $('.basket-side-dropdown').hide(); 64 } 65 if (changeMade) { 66 $('.basket-icon').addClass('basket-icon-rotate'); 67 setTimeout(function () { $('.basket-icon').removeClass('basket-icon-rotate'); }, 2000); 68 $(".basket-dropdown > a").trigger('click.bs.dropdown'); 69 } 70 }; 71 return BasketNotification; 72}()); 73/// <reference path="../jsrender/jsrender.d.ts" /> 74/// <reference path="basket.d.ts" /> 75/// <reference path="lite_event.ts" /> 76/// <reference path="basket_notificator.ts" /> 77/// <reference path="../magscriber.d.ts" /> 78var BasketEvents = /** @class */ (function () { 79 function BasketEvents() { 80 } 81 return BasketEvents; 82}()); 83var Basket = /** @class */ (function () { 84 function Basket(events) { 85 this._onLoadingStart = new LiteEvent(); 86 this._onDataReceived = new LiteEvent(); 87 if (events != null) { 88 if (events.onDataReceived != null) { 89 this.onDataReceived.on(events.onDataReceived); 90 } 91 if (events.onLoadingStart != null) { 92 this.onLoadingStart.on(events.onLoadingStart); 93 } 94 } 95 var basket = this; 96 basket._onLoadingStart.trigger(false); 97 $.get(AjaxServices.basket.content, function (data) { 98 basket.data = data; 99 basket._onDataReceived.trigger(false); 100 }); 101 } 102 Basket.instance = function (events) { 103 if (Basket._instance == null) { 104 Basket._instance = new Basket(events); 105 } 106 return Basket._instance; 107 }; 108 Object.defineProperty(Basket.prototype, "onLoadingStart", { 109 get: function () { return this._onLoadingStart; }, 110 enumerable: false, 111 configurable: true 112 });
113 Object.defineProperty(Basket.prototype, "onDataReceived", { 114 get: function () { return this._onDataReceived; }, 115 enumerable: false, 116 configurable: true 117 }); 118 Object.defineProperty(Basket.prototype, "price", { 119 get: function () { 120 return this.data.price; 121 }, 122 enumerable: false, 123 configurable: true 124 }); 125 Object.defineProperty(Basket.prototype, "productsCount", { 126 get: function () { 127 return this.data.amount; 128 }, 129 enumerable: false, 130 configurable: true 131 }); 132 Object.defineProperty(Basket.prototype, "items", { 133 get: function () { 134 return this.data.items; 135 }, 136 enumerable: false, 137 configurable: true 138 }); 139 Basket.prototype.addItem = function (id, class_name, amount, parameters) { 140 var basket = this; 141 basket._onLoadingStart.trigger(true); 142 parameters['product_id'] = id.toString(); 143 parameters['product_class'] = class_name; 144 parameters['amount'] = amount.toString(); 145 $.get(AjaxServices.basket.items.add, parameters, function (data) { 146 basket.data = data; 147 basket._onDataReceived.trigger(true); 148 }); 149 }; 150 Basket.prototype.changeItem = function (id, class_name, amount) { 151 var basket = this; 152 basket._onLoadingStart.trigger(true); 153 $.get(AjaxServices.basket.items.change, { 154 product_id: id, 155 product_class: class_name, 156 amount: amount 157 }, function (data) { 158 basket.data = data; 159 basket._onDataReceived.trigger(true); 160 }); 161 }; 162 Basket.prototype.removeItem = function (id, class_name) { 163 var basket = this; 164 basket._onLoadingStart.trigger(true); 165 $.get(AjaxServices.basket.items.remove, { 166 product_id: id, 167 product_class: class_name 168 }, function (data) { 169 basket.data = data; 170 basket._onDataReceived.trigger(true); 171 }); 172 }; 173 Basket._instance = null; 174 return Basket; 175}()); 176/// <reference path="jquery/jquery.d.ts" /> 177/// <reference path="moment/moment.d.ts" /> 178$(document).ready(function () { 179 $('fieldset legend input').css('cursor', 'pointer'); 180 $('fieldset legend').on('click', 'input[type="radio"]', function () { 181 var this_fieldset = $(this).closest('fieldset'); 182 var parent_el = this_fieldset.parent(); 183 parent_el.find('fieldset').attr('disabled', ''); 184 this_fieldset.removeAttr('disabled'); 185 parent_el.find('fieldset legend input').css('cursor', 'pointer'); 186 parent_el.find('fieldset:disabled .hide-on-disabled').slideUp(500); 187 parent_el.find('fieldset:enabled > .hide-on-disabled').slideDown(500); 188 }).on('click', 'input[type="checkbox"]', function () { 189 var this_input = $(this); 190 var this_fieldset = this_input.closest('fieldset'); 191 var parent_el = this_fieldset.parent(); 192 if (this_input.is(':checked')) { 193 this_fieldset.removeAttr('disabled'); 194 } 195 else { 196 this_fieldset.attr('disabled', ''); 197 } 198 parent_el.find('fieldset:disabled .hide-on-disabled').slideUp(500); 199 parent_el.find('fieldset:enabled .hide-on-disabled').slideDown(500); 200 }); 201 $('fieldset:disabled .hide-on-disabled').hide(); 202 $('.datetimepicker').datetimepicker({ 203 locale: moment.locale('sk'), 204 showTodayButton: true, 205 collapse: true, 206 }); 207 $('.datepicker').datetimepicker({ 208 locale: moment.locale('sk'), 209 showTodayButton: true, 210 collapse: true, 211 format: 'DD.MM.YYYY' 212 }); 213 $('.monthpicker').datetimepicker({ 214 locale: moment.locale('sk'), 215 showTodayButton: true, 216 collapse: true, 217 format: 'MM/YYYY', 218 viewMode: 'months' 219 }); 220 $('.datetimepicker,.datepicker').on('focus', 'input', function () { 221 $(this).parents('.datetimepicker,.datepicker').data("DateTimePicker").show(); 222 }); 223}); 224var dtConfig = dtConfig || null; 225$(document).ready(function () { 226 var dataTables = $('.data-tables'); 227 dataTables.each(function (index, el) { 228 var setup = { 229 language: { 230 url: '//cdn.datatables.net/plug-ins/1.10.10/i18n/Slovak.json' 231 }, 232 columnDefs: [ 233 { 234 targets: 'model-options-header', 235 orderable: false, 236 }, 237 { 238 targets: 'datatables-details-control', 239 orderable: false, 240 } 241 ], 242 order: [], 243 stateSave: true 244 }; 245 if ($(el).data('exportbuttons') == 1 || dtConfig) { 246 var buttons = []; 247 setup.dom = "<'row'<'col-sm-4 col-xs-6'l><'col-sm-4 col-xs-6'B><'col-sm-4 col-xs-12'f>>" + 248 "<'row'<'col-sm-12'tr>>" + 249 "<'row'<'col-sm-5'i><'col-sm-7'p>>"; 250 if ($(el).data('exportbuttons') == 1) { 251 var exportTitle = $(el).data('exporttitle'); 252 exportTitle = exportTitle == null || exportTitle == '' ? 'Export' : exportTitle; 253 buttons.push({ 254 extend: 'pdfHtml5', 255 orientation: 'landscape', 256 title: exportTitle, 257 exportOptions: { 258 columns: ':not(.model-options-header)' 259 } 260 }); 261 buttons.push({ 262 extend: 'excelHtml5', 263 title: exportTitle, 264 exportOptions: { 265 columns: ':not(.model-options-header)' 266 } 267 }); 268 buttons.push({ 269 extend: 'copyHtml5',
270 text: 'KopÃrovaÅ¥', 271 exportOptions: { 272 columns: ':not(.model-options-header)' 273 } 274 }); 275 } 276 if (dtConfig) { 277 buttons = buttons.concat(dtConfig.buttons); 278 } 279 setup.buttons = buttons; 280 } 281 $(el).DataTable(setup); 282 }); 283 dataTables.find(".datatables-details-control i").addClass("fa fa-plus-circle"); 284 dataTables.on('click', 'td.datatables-details-control', function () { 285 var tr = $(this).closest('tr'); 286 var row = $(this).closest('table.data-tables').DataTable().row(tr); 287 if (row.child.isShown()) { 288 // This row is already open - close it 289 row.child.hide(); 290 tr.find(".datatables-details-control i").addClass("fa-plus-circle").removeClass('fa-minus-circle'); 291 } 292 else { 293 // Open this row 294 row.child(tr.find('.additional-data').html()).show(); 295 tr.find(".datatables-details-control i").addClass("fa-minus-circle").removeClass('fa-plus-circle'); 296 } 297 }); 298}); 299/// <reference path="jquery/jquery.d.ts" /> 300$(document).ready(function () { 301 $('[data-toggle="tooltip"]').tooltip({ container: 'body' }); 302}); 303/// <reference path="classes/basket.ts" /> 304$(document).ready(function () { 305 var bi = $('.basket-items-wrapper'); 306 bi.on('click', '.basket-item .basket-item-add', function () { 307 var el = $(this).parents('.product'); 308 var basket = Basket.instance(); 309 basket.addItem(parseInt(el.find('.product-id').val()), el.find('.product-class').val(), parseFloat(el.find('.product-price').val()), {}); 310 }); 311 bi.on('change', '.basket-item .basket-item-amount', function () { 312 var el = $(this).parents('.basket-item'); 313 var basket = Basket.instance(); 314 var productId = parseInt(el.find('.product-id').val()); 315 var productClass = el.find('.product-class').val(); 316 var productClassSearch = productClass.replace('\\', '\\\\'); 317 var amount = 0; 318 el.parents('.basket') 319 .find('.product-id[value=' + productId + ']').parent('.basket-item') 320 .find('.product-class[value=' + productClassSearch + ']') 321 .each(function () { 322 amount += parseFloat($(this).parents('.basket-item').find('.basket-item-amount').val()); 323 }); 324 basket.changeItem(productId, productClass, amount); 325 }); 326 bi.on('click', '.basket-item .basket-item-remove', function () { 327 var el = $(this).parents('.basket-item'); 328 var basket = Basket.instance(); 329 basket.removeItem(parseInt(el.find('.product-id').val()), el.find('.product-class').val()); 330 }); 331}); 332/** 333 * Created by pmacko on 30.10.2016. 334 */ 335/// <reference path="jquery/jquery.d.ts" /> 336/// <reference path="summernote/summernote.d.ts" /> 337$(document).ready(function () { 338 $('.summernote').summernote({ 339 onCreateLink: function (originalLink) { 340 return originalLink; // return original link 341 } 342 }); 343}); 344/// <reference path="jquery/jquery.d.ts" /> 345/// <reference path="bootstrap/bootstrapselect.d.ts" /> 346$(document).ready(function () { 347 $('.selectpicker').selectpicker(); 348}); 349var HtmlHelper = /** @class */ (function () { 350 function HtmlHelper() { 351 } 352 HtmlHelper.icon = function (type, tooltip) { 353 return "<i class='fa fa-" + type + "' " + (tooltip ? " data-toggle='tooltip' title='" + tooltip + "'" : '') + "></i>"; 354 }; 355 HtmlHelper.link = function (content, caller, options) { 356 var html = "<a href='" + caller + "'"; 357 for (var key in options) { 358 html += " " + key + "='" + options[key] + "'"; 359 } 360 html += '>' + content + "</a>"; 361 return html; 362 }; 363 return HtmlHelper; 364}()); 365/** 366 * Created by pmacko on 13.11.2016. 367 */ 368var DataTablesHelper = /** @class */ (function () { 369 function DataTablesHelper() { 370 } 371 DataTablesHelper.createColumnDefinitionFromTable = function (table) { 372 var columnData = []; 373 table.find('thead th').each(function () { 374 var thisEl = $(this); 375 var column = {}; 376 column.data = thisEl.data('column'); 377 var value = thisEl.data('orderable'); 378 if (value !== null && value !== '') { 379 column.orderable = value; 380 } 381 value = thisEl.data('searchable'); 382 if (value !== null && value !== '') { 383 column.searchable = value; 384 } 385 value = thisEl.data('classname'); 386 if (value != null && value != '') { 387 column.className = value; 388 } 389 if (column.data == "_operations") { 390 column.className = (column.className === undefined ? "" : column.className + ",") + "model-options"; 391 } 392 columnData.push(column); 393 }); 394 return columnData; 395 }; 396 return DataTablesHelper; 397}()); 398//libs 399/// <reference path="jquery/jquery.d.ts" /> 400/// <reference path="datatables/datatables.d.ts" /> 401/// <reference path="bootstrap/bootstrap.d.ts" /> 402/// <reference path="bootstrap/bootstrap.v3.datetimepicker.d.ts" /> 403/// <reference path="moment/moment.d.ts" /> 404/// <reference path="js-cookie/js-cookie.d.ts" />
405//internal classes 406/// <reference path="classes/basket.ts" /> 407/// <reference path="classes/basket_notificator.ts" /> 408//init 409/// <reference path="form.ts" /> 410/// <reference path="init.datatables.ts" /> 411/// <reference path="init.tooltip.ts" /> 412/// <reference path="init.basket.ts" /> 413/// <reference path="init.summernote.ts" /> 414/// <reference path="init.bootstrapselect.ts" /> 415/// <reference path="HtmlHelper.ts"/> 416/// <reference path="DataTablesHelper.ts"/> 417$.views.settings.delimiters("<%", "%>"); 418$(document).ready(function () { 419 var events = new BasketEvents(); 420 events.onDataReceived = function (changeMade) { BasketNotification.notify(changeMade); }; 421 events.onLoadingStart = function (changeMade) { BasketNotification.setLoading(changeMade); }; 422 var basket = Basket.instance(events); 423}); 424 425//# sourceMappingURL=../maps/app.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.