1"use strict"; 2 3function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } 4 5function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 6 7function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } 8 9function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } 10 11function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 12 13function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } 14 15function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } 16 17function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 18 19function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 20 21function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 22 23function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } 24 25var CoEventBilling = function () { 26 function CoEventBilling() { 27 var eventId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 28 var mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 29 var dbData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 30 31 _classCallCheck(this, CoEventBilling); 32 33 this.eventId = typeof eventId === 'undefined' || eventId === null ? 0 : eventId; 34 this.typeId = 0; 35 this.body = ''; 36 this.header = ''; 37 this.display = ''; 38 this.mode = typeof mode === 'undefined' || mode === null ? 0 : mode; 39 this.ticketData = typeof dbData === 'undefined' || dbData === null ? [] : typeof dbData.ticketData !== 'undefined' ? _typeof(dbData.ticketData) === 'object' && !Array.isArray(dbData.ticketData) ? [dbData] : dbData.ticketData : []; 40 this.numTickets = 0; 41 this.showActive = 0; 42 this.showCost = 0; 43 this.locked = 0; 44 this.deletedTypeIds = []; 45 } 46 47 _createClass(CoEventBilling, [{ 48 key: "addTicketType", 49 value: function addTicketType() { 50 var self = this; 51 var types = document.querySelectorAll('.ticket-group-input'); 52 var box = document.querySelector('#ticket-box'); 53 var ele = self.buildTicketInput(null, types.length); 54 box.append(ele); 55 } 56 }, { 57 key: "bindEvents", 58 value: function bindEvents() { 59 var self = this; 60 $('.ticket-debug-button').on('click', function () { 61 self.getTicketTypeValues(); 62 }); 63 $('.ticket-add-button').on('click', function () { 64 self.addTicketType(); 65 }); 66 $('.enable_billing').on('switchChange.bootstrapSwitch', function (e, state) { 67 self.toggleGroupInputCost(); 68 }).bootstrapSwitch(); 69 var box = document.querySelector('#ticket-box'); 70 71 if (box !== null) { 72 box.addEventListener('co-group-input-delete', function (e) { 73 var typeId = parseInt(e.target.getAttribute('data-typeid')); 74 75 if (typeId > 0) { 76 self.deletedTypeIds.push(typeId); 77 } 78 }); 79 } 80 } 81 }, { 82 key: "buildTicketInput", 83 value: function buildTicketInput(ticket, idx) { 84 if (typeof idx === 'undefined') idx = 0; 85 var self = this; 86 var tindex = idx; 87 var dindex = (tindex + 1).toString(); 88 var cgi = document.createElement('co-group-input'); 89 var costValue = ticket !== null ? typeof ticket.amount !== 'undefined' ? parseFloat(ticket.amount).toFixed(2) : '' : ''; 90 var isActive = ticket !== null ? typeof ticket.active !== 'undefined' ? ticket.active : 0 : 0; 91 var typeValue = ticket !== null ? typeof ticket.name !== 'undefined' ? ticket.name : '' : ''; 92 var maxValue = ticket !== null ? typeof ticket.max !== 'undefined' ? ticket.max : 0 : 0; 93 var typeId = ticket !== null ? typeof ticket.typeId !== 'undefined' ? parseInt(ticket.typeId) : 0 : 0; 94 var registered = ticket !== null && typeof ticket.registeredCount !== 'undefined' ? parseInt(ticket.registeredCount) : null; 95 var canDelete = self.locked > 0 ? typeId === 0 || typeId > 0 && registered === 0 : true; 96 var readOnly = self.locked === 1; 97 var disabled = self.locked === 1; 98 var inputs = [{ 99 'label': 'TYPE', 100 'value': typeValue, 101 'valueName': 'type', 102 'options': 'null', 103 'type': 'text', 104 'disabled': false, 105 'readOnly': false, 106 'id': 'registration_type_' + dindex, 107 'size': 'col-lg-4 col-md-4 col-sm-4 col-xs-4' 108 }, { 109 'label': 'MAX QTY', 110 'value': maxValue, 111 'valueName': 'qty', 112 'options': 'null', 113 'type': 'text', 114 'disabled': false, 115 'readOnly': false, 116 'id': 'registration_type_qty_' + dindex, 117 'size': 'col-tiny' 118 }]; 119 inputs.push({ 120 'label': 'COST', 121 'icon': '$', 122 'value': costValue, 123 'valueName': 'cost', 124 'options': 'null', 125 'type': 'text', 126 'disabled': disabled, 127 'readOnly': readOnly, 128 'visible': self.showCost, 129 'id': 'registration_type_cost_' + dindex, 130 'size': 'col-tiny' 131 }); 132 133 if (self.showActive) { 134 inputs.push({ 135 'label': 'ACTIVE', 136 'value': isActive, 137 'valueName': 'active', 138 'options': 'single', 139 'type': 'checkbox', 140 'disabled': disabled, 141 'readOnly': readOnly, 142 'id': 'registration_type_active_' + dindex, 143 'size': 'col-tiny' 144 }); 145 } 146 147 cgi.classList.add('ticket-group-input'); 148 cgi.setAttribute('icon', 'am-profile'); 149 cgi.setAttribute('include-labels', tindex === 0 ? '1' : '0'); 150 cgi.setAttribute('allow-delete', canDelete ? '1' : '0'); 151 cgi.setAttribute('edit-popup', '0'); 152 cgi.setAttribute('debug', '0'); 153 cgi.setAttribute('data-id', 'ticketIndex-' + dindex); 154 cgi.setAttribute('data-typeid', typeId); 155 cgi.setAttribute('data-inputs', JSON.stringify(inputs)); 156 return cgi; 157 } 158 }, { 159 key: "buildTicketList", 160 value: function buildTicketList() { 161 var list = []; 162 var self = this; 163 164 if (self.ticketData.length > 0) { 165 self.ticketData.forEach(function (ticket, idx) { 166 list.push(self.buildTicketInput(ticket, idx)); 167 }); 168 } else { 169 list.push(self.buildTicketInput(null, 0)); 170 } 171 172 var box = document.querySelector('#ticket-box'); 173 list.forEach(function (l) { 174 box.append(l); 175 }); 176 } 177 }, { 178 key: "getTicketTypeValues", 179 value: function getTicketTypeValues() { 180 var ret = []; 181 var self = this; 182 var types = document.querySelectorAll('.ticket-group-input'); 183 184 if (types.length > 0) {
185 types.forEach(function (type) { 186 var tid = type.getAttribute('data-typeid'); 187 var t = type.get('type'); 188 var q = type.get('qty'); 189 var c = type.get('cost'); 190 var a = type.get('active'); 191 192 if (!self.showActive) { 193 a = 1; 194 } 195 196 if (!self.showCost) { 197 c = 0.00; 198 } 199 200 var o = { 201 'active': a, 202 'cost': c, 203 'qty': q, 204 'type': t 205 }; 206 207 if (tid > 0) { 208 o.typeid = tid; 209 } 210 211 ret.push(o); 212 console.log('Group Input Data: ', o); 213 }); 214 } 215 216 return ret; 217 } 218 }, { 219 key: "getDeletedTypeIds", 220 value: function getDeletedTypeIds() { 221 return this.deletedTypeIds; 222 } 223 }, { 224 key: "toggleGroupInputCost", 225 value: function toggleGroupInputCost() { 226 var self = this; 227 var costInputs = document.querySelectorAll('[v-name=\'cost\']'); 228 self.showCost = !self.showCost; 229 230 if (costInputs.length > 0) { 231 costInputs.forEach(function (i) { 232 i.style.display = self.showCost ? '' : 'none'; 233 }); 234 } 235 } 236 }, { 237 key: "init", 238 value: function init(eventId, showCost, showActive) { 239 var locked = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; 240 var templateId = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; 241 var self = this; 242 var params = { 243 eventid: eventId 244 }; 245 246 if (templateId > 0) { 247 params = { 248 eventid: templateId 249 }; 250 } 251 252 if (typeof eventId !== 'undefined' && templateId === 0) self.eventId = eventId; 253 if (typeof showCost !== 'undefined') self.showCost = showCost; 254 if (typeof showActive !== 'undefined') self.showActive = showActive; 255 if (typeof locked !== 'undefined') self.locked = locked; 256 return new Promise(function (resolve, reject) { 257 $.get('/ajax/fetch/get_event_ticket_data', params, function (data) { 258 try { 259 data = JSON.parse(data); 260 261 if (_typeof(data) === 'object') { 262 if (data.type == 'success') { 263 self.ticketData = typeof data.ticketData === 'undefined' ? [] : data.ticketData; 264 self.numTickets = self.ticketData.length; 265 self.buildTicketList(); 266 } else { 267 self.Utils.showAlert(data); 268 } 269 } 270 271 self.bindEvents(); 272 resolve(1); 273 } catch (err) { 274 resolve(0); 275 } 276 277 ; 278 }); 279 }); 280 } 281 }, { 282 key: "deleteData", 283 value: function deleteData(type) { 284 var self = this; 285 var delfetch = null; 286 287 if (self.typeId > 0) { 288 var delData = new FormData(); 289 delData.append('id', self.typeId); 290 291 if (self.mode === 0) { 292 $.post('/ajax/fetch/delete_ticket_type', { 293 id: self.typeId 294 }, function (data) { 295 try { 296 if ((typeof deldata === "undefined" ? "undefined" : _typeof(deldata)) === 'object') { 297 if (deldata.type == 'success') { 298 closeDialog(true); 299 self.Utils.showAlert(deldata); 300 self.updateTable(); 301 } 302 } 303 304 return 1; 305 } catch (err) { 306 return 0; 307 } 308 309 ; 310 }); 311 } 312 } else { 313 if (typeof type !== 'undefined') { 314 self.ticketData.forEach(function (td, i) { 315 if (td.type === type) { 316 delete self.ticketData[i]; 317 self.updateTable(); 318 } 319 }); 320 } 321 } 322 323 return 1; 324 } 325 }, { 326 key: "saveData", 327 value: function saveData() { 328 var self = this; 329 330 if (self.ticketData.length > 0) { 331 if (self.mode === 0) { 332 return new Promise(function (resolve, reject) { 333 $.post('/ajax/fetch/update_ticket_type', { 334 eventId: self.eventId, 335 data: JSON.stringify(self.ticketData) 336 }, function (data) { 337 resolve(data); 338 }); 339 }); 340 } 341 } 342 343 return Promise.resolve({ 344 type: 'error', 345 message: 'failed to save registration type data', 346 title: 'Error!' 347 }); 348 } 349 }]); 350 351 return CoEventBilling; 352}(); 353 354var EventBillingDropdown = function (_CoEventBilling) { 355 _inherits(EventBillingDropdown, _CoEventBilling); 356 357 var _super = _createSuper(EventBillingDropdown); 358 359 function EventBillingDropdown(eventId, mode, dbData) { 360 var _this; 361 362 var enableCost = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
363 var simple = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 364 var controlPanel = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; 365 366 _classCallCheck(this, EventBillingDropdown); 367 368 _this = _super.call(this, eventId, mode, dbData); 369 _this.$element = ''; 370 _this.simple = simple; 371 _this.enableCost = enableCost; 372 _this.isControl = controlPanel; 373 return _this; 374 } 375 376 _createClass(EventBillingDropdown, [{ 377 key: "dropdown", 378 get: function get() { 379 var row = $("<div />").addClass("row amf-row"); 380 var field = $("<div />").addClass('col-sm-8 field'); 381 var label = $("<label for='ticket-dd' class='control-label'></label>").text("Registration").append("<span class='required-field'></span></label>"); 382 383 if (this.$element.length === 0) { 384 this.buildDropdown(); 385 } 386 387 if (this.simple) { 388 row = $('<div />').addClass('form-pair'); 389 row.append(label).append(this.$element); 390 return row; 391 } else { 392 label.addClass('col-sm-4'); 393 } 394 395 field.append(this.$element); 396 row.append(label).append(field); 397 return row; 398 } 399 }, { 400 key: "buildDropdown", 401 value: function buildDropdown() { 402 var $dd = $('<select/>'); 403 $dd.prop('id', 'ticket-dd'); 404 var self = this; 405 406 try { 407 console.log('td: ', self.ticketData); 408 409 if (self.ticketData.length > 0) { 410 $dd.empty(); 411 $dd.append("<option value=''>Select a registration type</option>"); 412 $dd.addClass("am-input form-control"); 413 self.ticketData.forEach(function (ticket, idx) { 414 var $opt = $('<option />'); 415 var amount = 0.00; 416 var optText = ''; 417 418 if (parseInt(ticket.active)) { 419 if (!ticket.available && !self.isControl) { 420 $opt.prop('disabled', true); 421 $opt.text('SOLD OUT'); 422 } 423 424 $opt.attr('data-available', ticket.available); 425 426 if (self.enableCost) { 427 amount = parseFloat(ticket.amount); 428 optText = ticket.name + ' - $' + (amount > 0 ? amount.toFixed(2) : '0.00'); 429 $opt.text(optText); 430 $opt.val(ticket.typeId).attr('data-cost', amount.toFixed(2)).attr('data-typeid', ticket.typeId); 431 } else { 432 amount = 0.00; 433 optText = ticket.name; 434 $opt.text(optText); 435 $opt.val(ticket.typeId).attr('data-cost', amount.toFixed(2)).attr('data-typeid', ticket.typeId); 436 } 437 438 if (self.isControl && typeof ticket.available !== 'undefined' && !ticket.available) { 439 $opt.text(optText + ' (FULL)'); 440 } 441 442 $dd.append($opt); 443 } 444 }); 445 } else { 446 $dd.append("<option value='-1'>No tickets available for event.</option>"); 447 } 448 449 this.$element = $dd; 450 } catch (err) { 451 console.log('error: ', err); 452 this.$element = ''; 453 } 454 } 455 }]); 456 457 return EventBillingDropdown; 458}(CoEventBilling); 459 460var EventBillingInfo = function (_CoEventBilling2) { 461 _inherits(EventBillingInfo, _CoEventBilling2); 462 463 var _super2 = _createSuper(EventBillingInfo); 464 465 function EventBillingInfo(eventId, mode, dbData) { 466 var _this2; 467 468 _classCallCheck(this, EventBillingInfo); 469 470 _this2 = _super2.call(this, eventId, mode, dbData); 471 _this2.text = ''; 472 return _this2; 473 } 474 475 _createClass(EventBillingInfo, [{ 476 key: "info", 477 get: function get() { 478 if (this.text.length === 0) { 479 this.buildInfo(); 480 } 481 482 return this.text; 483 } 484 }, { 485 key: "buildInfo", 486 value: function buildInfo() { 487 var self = this; 488 self.text = $('<span class="fa-stack ticket-symbol" style="font-size:12px"><i class="fa fa-circle fa-stack-2x" style="color: #2bafbe"></i><i class="fa fa-usd fa-stack-1x fa-inverse"></i></span> Paid Registration '); 489 } 490 }]); 491 492 return EventBillingInfo; 493}(CoEventBilling); 494 495var EventBillingMultipleSelector = function (_CoEventBilling3) { 496 _inherits(EventBillingMultipleSelector, _CoEventBilling3); 497 498 var _super3 = _createSuper(EventBillingMultipleSelector); 499 500 function EventBillingMultipleSelector(eventId, mode, dbData) { 501 var _this3; 502 503 var enableCost = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
504 var seatLimit = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; 505 var patronView = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; 506 var ticketsBooked = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : []; 507 var mainTicketType = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null; 508 509 _classCallCheck(this, EventBillingMultipleSelector); 510 511 _this3 = _super3.call(this, eventId, mode, dbData); 512 _this3.enableCost = enableCost; 513 _this3.seatLimit = parseInt(seatLimit); 514 _this3.viewmode = patronView; 515 _this3.options = []; 516 _this3.selected = []; 517 _this3.ticketQty = []; 518 _this3.types = []; 519 _this3.$element = ''; 520 _this3.ticketsBooked = ticketsBooked; 521 _this3.mainTicketType = mainTicketType; 522 return _this3; 523 } 524 525 _createClass(EventBillingMultipleSelector, [{ 526 key: "selector", 527 get: function get() { 528 var row = $("<div />").addClass("row amf-row"); 529 var field = $("<div />").addClass('col-sm-12'); 530 var labelRow = $("<div class='col-sm-12'><h5>Choose registration type <span class='required-field'></span></h5></div>"); 531 532 if (this.$element.length === 0) { 533 this.$element = this.buildList(); 534 this.$element.data({ 535 'regType': this 536 }); 537 } 538 539 field.append(this.$element); 540 row.append(labelRow).append(field); 541 return row; 542 } 543 }, { 544 key: "buildQtyDropdown", 545 value: function buildQtyDropdown(min, max) { 546 var qtyDD = $('<select class="list-ticket-qty-dd"/>'); 547 548 if (max > self.seatLimit && self.seatLimit > 0) { 549 max = self.seatLimit; 550 } 551 552 for (var q = min; q <= max; q++) { 553 var opt = $('<option />'); 554 opt.text(q).val(q); 555 qtyDD.append(opt); 556 } 557 558 return qtyDD; 559 } 560 }, { 561 key: "buildList", 562 value: function buildList() { 563 var self = this; 564 565 if (self.ticketData.length > 0) { 566 var listGroup = $('<div class="list-group ticket-list" />'); 567 var listItem = $('<div class="list-group-item ticket-list-item" />'); 568 var listItemContent = $('<div class="list-group-item-text ticket-item-content" />'); 569 var itemSelected = false; 570 self.ticketData.forEach(function (ticket, idx) { 571 var tempItem = listItem.clone(); 572 var tempContent = listItemContent.clone(); 573 var tempTitle = $('<div class="list-ticket-title" />'); 574 var tempCost = $('<div class="list-ticket-cost" />'); 575 var tempQty = $('<div class="list-ticket-qty" />'); 576 var tempQtyDD = null; 577 var amount = 0.00; 578 var available = parseInt(ticket.available); 579 var ticketTypeInt = Number(ticket.typeId); 580 var ticketsBooked = self.ticketsBooked && Boolean(self.ticketsBooked[ticketTypeInt]) ? self.ticketsBooked[ticketTypeInt] : 0; 581 582 if (parseInt(ticket.active)) { 583 var minTicketNum = ticketTypeInt == self.mainTicketType ? 1 : 0; 584 585 if (available <= ticketsBooked) { 586 tempCost.text('FULL'); 587 tempQtyDD = self.buildQtyDropdown(Math.max(minTicketNum, ticketsBooked - 100), ticketsBooked); 588 } else { 589 tempQtyDD = self.buildQtyDropdown(Math.max(minTicketNum, ticketsBooked - 100), available); 590 591 if (!itemSelected) { 592 window.tempQtyDD = tempQtyDD; 593 tempQtyDD.val(0); 594 itemSelected = true; 595 } 596 597 if (self.enableCost) { 598 amount = parseFloat(ticket.amount); 599 tempCost.text('$' + (amount > 0 ? amount.toFixed(2) : '0.00')); 600 } else { 601 amount = 0.00; 602 tempCost.text(''); 603 } 604 } 605 606 tempTitle.text(ticket.name); 607 tempQtyDD.attr('data-cost', amount.toFixed(2)).attr('data-typeid', ticket.typeId).attr('data-limit', self.seatLimit).attr('data-type', ticket.name).attr('data-left', ticket.available); 608 609 if (tempQtyDD !== null) { 610 tempQty.append(tempQtyDD); 611 } else {
612 tempQty.text('n/a'); 613 } 614 615 tempContent.append(tempTitle).append(tempCost).append(tempQty); 616 tempItem.append(tempContent); 617 listGroup.append(tempItem); 618 } 619 }); 620 return listGroup; 621 } 622 623 return false; 624 } 625 }, { 626 key: "hasSelection", 627 value: function hasSelection() { 628 if (this.$element) { 629 var $dd = this.$element.find('select.list-ticket-qty-dd'); 630 var sum = 0; 631 632 for (var i = 0; i < $dd.length; i++) { 633 var $el = $($dd[i]); 634 sum += parseInt($el.val()); 635 } 636 637 return sum > 0; 638 } 639 640 return false; 641 } 642 }, { 643 key: "highlightFields", 644 value: function highlightFields() { 645 if (this.$element) { 646 var $dd = this.$element.find('select.list-ticket-qty-dd'); 647 $dd.each(function (ix, el) { 648 $(el).addClass("hightlight-field").delay(6000).queue(function () { 649 $(this).removeClass("hightlight-field").dequeue(); 650 }); 651 }); 652 } 653 } 654 }, { 655 key: "updateList", 656 value: function updateList(ticketData, ticketsBooked) { 657 this.ticketData = ticketData; 658 this.ticketsBooked = ticketsBooked; 659 $('.list-ticket-qty-dd').each(function () { 660 var ticketId = Number($(this).attr('data-typeid')); 661 var isFull = $(this).attr('data-left') == ticketsBooked[ticketId]; 662 $(this).parent().siblings('.list-ticket-cost').text(isFull ? 'FULL' : ''); 663 }); 664 } 665 }]); 666 667 return EventBillingMultipleSelector; 668}(CoEventBilling); 669 670var EventBillingPaymentForm = function () { 671 function EventBillingPaymentForm() { 672 var offline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { 673 off: false, 674 txt: '' 675 }; 676 var showOffline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 677 678 _classCallCheck(this, EventBillingPaymentForm); 679 680 this.$form = ''; 681 this.paymentData = { 682 firstName: '', 683 lastName: '', 684 cardNumber: '', 685 expiration: '', 686 cvc: '', 687 total: 0.00, 688 type: '' 689 }; 690 this.offline = offline.off; 691 this.offlineText = offline.txt; 692 var error = $('<div class="amnp-spacer"><div class="amnp-error-message"></div></div>'); 693 var offlineInput = '<label class="btn btn-default">' + '<input type="radio" name="options" value="offline" autocomplete="off">Pay In Person</label>'; 694 var payType = showOffline ? $('<div class="amnp-payment-toggle">' + '<label class="col-sm-4 control-label">Payment type' + '</label>' + '<div class="col-sm-8 field">' + '<div class="btn-group" data-toggle="buttons">' + '<label class="btn btn-default active">' + '<input type="radio" name="options" value="card" autocomplete="off" checked>Card</label>' + offlineInput + '</div>' + '</div>' + '<div class="col-sm-4">' + '</div>' + '<div class="col-sm-8 am-form-desc">' + '</div>' + '</div>') : $('<div class="amnp-payment-toggle"></div>'); 695 var offType = $('<div class="amnp-payment-toggle"></div>'); 696 var offlineForm = $('<div class="amnp-offline-form"></div>').html(this.offlineText).css('text-align', 'center'); 697 this.offlineForm = [{ 698 label: '', 699 html: offType, 700 type: 'content-block', 701 id: 'paymentTypeBlock' 702 }, { 703 label: '', 704 html: offlineForm, 705 type: 'content-block', 706 id: 'offlineMessageBlock' 707 }], this.paymentForm = [{ 708 label: '', 709 html: error, 710 type: 'content-block', 711 id: 'errorDetails', 712 hide: true, 713 "class": 'payform-field' 714 }, { 715 label: '', 716 html: payType, 717 type: 'content-block', 718 id: 'paymentTypeBlock' 719 }, { 720 label: 'First Name', 721 type: 'text', 722 id: 'firstName', 723 required: true, 724 "class": 'payform-field' 725 }, { 726 label: 'Last Name', 727 type: 'text', 728 id: 'lastName', 729 required: true, 730 "class": 'payform-field' 731 }, { 732 label: 'Card Number', 733 type: 'ccard', 734 id: 'cardNumber', 735 required: true, 736 "class": 'payform-field', 737 placeholder: '1234 5678 9012 3456' 738 }, {
739 label: 'Expiration', 740 type: 'expiration', 741 id: 'expiration', 742 required: true, 743 "class": 'payform-field', 744 placeholder: 'MM / YYYY' 745 }, { 746 label: 'CVC', 747 type: 'cvc', 748 id: 'cvc', 749 required: true, 750 "class": 'payform-field', 751 placeholder: '000' 752 }]; 753 } 754 755 _createClass(EventBillingPaymentForm, [{ 756 key: "form", 757 get: function get() { 758 if (!this.offline) { 759 return this.buildForm(); 760 } 761 762 return this.buildOffline(); 763 } 764 }, { 765 key: "buildForm", 766 value: function buildForm() { 767 var formFrame = $('<div />'); 768 this.$form = new FormMaker('PayPalForm', '', this.paymentForm, null, null, null, false, false, true, true, true, false, true).form; 769 formFrame.addClass('amnp-card-form').append(this.$form); 770 return formFrame; 771 } 772 }, { 773 key: "buildOffline", 774 value: function buildOffline() { 775 var formFrame = $('<div />'); 776 this.$form = new FormMaker('OfflinePayForm', '', this.offlineForm, null, null, null, false, false, true, true, true, false, true).form; 777 formFrame.addClass('amnp-card-form').append(this.$form); 778 return formFrame; 779 } 780 }]); 781 782 return EventBillingPaymentForm; 783}(); 784 785var EventBillingSubscriptions = function () { 786 function EventBillingSubscriptions() { 787 var _this4 = this; 788 789 var dateId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 790 var recurringId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 791 var eventInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 792 var eventList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; 793 794 _classCallCheck(this, EventBillingSubscriptions); 795 796 this.$form = ''; 797 this.formEvents = []; 798 this.patronName = ''; 799 this.patronEmail = ''; 800 this.slotsNeeded = 1; 801 this.dateId = dateId; 802 this.recurringId = recurringId; 803 this.utils = new CoUtils(); 804 this.eventInfo = eventInfo; 805 this.eventList = eventList; 806 807 if (Object.keys(this.eventInfo).length === 0) { 808 return false; 809 } 810 811 var eventDescription = '<p>' + ' <strong>' + this.eventInfo.title + '</strong>' + ' <br>' + this.eventInfo.datestring + ' <br><i class="fa fa-map-marker"></i> ' + this.eventInfo.location + ' <br><br>We\'re sorry this event is currently full, but we can notify you by email if any spaces become available.' + '</p>'; 812 var interestedForm = $('<div class="amnp-interested-form"></div>').css('text-align', 'center').html(eventDescription); 813 this.interestedForm = [{ 814 label: '', 815 html: interestedForm, 816 type: 'content-block', 817 id: 'interestedHeader', 818 "class": '' 819 }, { 820 label: 'Email', 821 type: 'email', 822 id: 'patronEmail', 823 required: true, 824 "class": 'billing-sub-field' 825 }]; 826 var data = { 827 patronEmail: '', 828 eventId: this.dateId, 829 recurringId: this.recurringId 830 }; 831 this.formEvents = [{ 832 type: 'click', 833 func: function func(e) { 834 $('.Event_Full-dialog').on('hidden.bs.modal', function (eh) { 835 $(eh.target).remove(); 836 }).modal('hide'); 837 }, 838 selector: '.close-brochure-popup' 839 }]; 840 this.formEvents.push({ 841 type: 'click', 842 func: function func(e) { 843 var spinner = $('<i class="fa fa-spinner fa-spin email-spinner"></i>'); 844 $(e.target).append(" ").append(spinner).prop('disabled', true); 845 var email = $('#patronEmail', _this4.$form).val(); 846 847 if (email === '') { 848 alert('An email is required'); 849 return; 850 } else { 851 data.patronEmail = email; 852 data.action = 'subscribe'; 853 } 854 855 $.post("/interested", data, function (d) { 856 $(".email-spinner").remove(); 857 $(e.target).prop('disabled', false); 858 interestedForm.modal('hide'); 859 860 if (d === 'subscribed') { 861 alert("You have successfully subscribed to this event."); 862 } 863 864 if (d === 'failed') { 865 alert("Something went wrong when attempting to save your subscription. Please try again."); 866 } 867 }); 868 }, 869 selector: '#sendEmail' 870 }); 871 } 872 873 _createClass(EventBillingSubscriptions, [{ 874 key: "subscriptionForm", 875 get: function get() { 876 return this.buildForm(); 877 } 878 }, { 879 key: "buildForm", 880 value: function buildForm() { 881 this.$form = new FormMaker('Event Full', 'Sign up to be notified', this.interestedForm, null, this.formEvents, "interested-form", true, false, false, false, false, true, false).form; 882 return this.$form; 883 } 884 }]); 885 886 return EventBillingSubscriptions; 887}(); 888 889var EventBillingTicketList = function () { 890 function EventBillingTicketList() { 891 var tickets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 892 var recurringMod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; 893 var wholeOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
894 var showCost = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; 895 var currencySymbol = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'USD'; 896 897 _classCallCheck(this, EventBillingTicketList); 898 899 this.ticketTypes = []; 900 this.tickets = tickets; 901 this.ticketTotal = 0.00; 902 this.ticketMod = recurringMod; 903 this.wholeOnly = wholeOnly; 904 this.showCost = showCost; 905 this.currencySymbol = currencySymbol; 906 } 907 908 _createClass(EventBillingTicketList, [{ 909 key: "list", 910 get: function get() { 911 if (this.tickets.length === 0) return ''; 912 return this.buildList(); 913 } 914 }, { 915 key: "buildList", 916 value: function buildList() { 917 var $frame = $('<div class="amnp-ticket-details"/>'); 918 var $bookingSummary = $('<div class="amnp-booking-summary col-md-12"></div>'); 919 this.sumTickets(); 920 921 for (var k in this.ticketTypes) { 922 var type = this.ticketTypes[k]; 923 var $bookingSummaryCost = $('<div class="amnp-booking-summary-total amnp-booking-summary-noborder"></div>').appendTo($bookingSummary); 924 $('<div class="amnp-booking-summary-booking-ticket amnp-booking-summary-border"></div>').text(type.name).appendTo($bookingSummaryCost); 925 $('<div class="amnp-booking-summary-booking-qty amnp-booking-summary-border"></div>').text('qty: ' + type.qty).appendTo($bookingSummaryCost); 926 927 if (this.showCost) { 928 $('<div class="amnp-booking-summary-booking-cost amnp-booking-summary-border">' + this.currencySymbol + '' + parseFloat(type.cost).toFixed(2) + '</div>').appendTo($bookingSummaryCost); 929 this.ticketTotal += parseFloat(type.cost); 930 } else { 931 $('<div class="amnp-booking-summary-booking-cost amnp-booking-summary-border"> </div>').appendTo($bookingSummaryCost); 932 } 933 } 934 935 ; 936 937 if (this.showCost) { 938 var $bookingSummaryTotal = $('<div class="amnp-booking-summary-total amnp-booking-summary-noborder"></div>').appendTo($bookingSummary); 939 $('<div class="amnp-booking-summary-booking-subtotal amnp-booking-summary-border">sub total</div>').appendTo($bookingSummaryTotal); 940 $('<div class="amnp-booking-summary-booking-total-cost amnp-booking-summary-border">' + this.currencySymbol + '' + parseFloat(this.ticketTotal).toFixed(2) + '</div>').appendTo($bookingSummaryTotal); 941 } 942 943 if (this.ticketMod > 1 && !this.wholeOnly) { 944 var $bookingSummaryAddOn = $('<div class="amnp-booking-summary-total amnp-booking-summary-noborder"></div>').appendTo($bookingSummary); 945 $('<div class="amnp-booking-summary-booking-subtotal amnp-booking-summary-border">x' + this.ticketMod + ' dates</div>').appendTo($bookingSummaryAddOn); 946 $('<div class="amnp-booking-summary-booking-total-cost amnp-booking-summary-border">' + this.currencySymbol + '' + (parseFloat(this.ticketTotal).toFixed(2) * this.ticketMod).toFixed(2) + '</div>').appendTo($bookingSummaryAddOn); 947 } 948 949 $bookingSummary.appendTo($frame); 950 return $frame; 951 } 952 }, { 953 key: "sumTickets", 954 value: function sumTickets() { 955 var _this5 = this; 956 957 this.tickets.forEach(function (ticket) { 958 if (typeof _this5.ticketTypes[ticket.type] === 'undefined') { 959 _this5.ticketTypes[ticket.type] = { 960 qty: 0, 961 name: ticket.name, 962 cost: 0, 963 isGuest: ticket.id.indexOf('g-') >= 0 964 }; 965 } 966 967 _this5.ticketTypes[ticket.type].qty++; 968 _this5.ticketTypes[ticket.type].cost += parseFloat(ticket.cost); 969 }); 970 } 971 }]); 972 973 return EventBillingTicketList; 974}();
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.