function getip() { return "https://bergwerk.berlin"; } function getWidth() { if (self.innerHeight) { return self.innerWidth; } if (document.documentElement && document.documentElement.clientHeight) { return document.documentElement.clientWidth; } if (document.body) { return document.body.clientWidth; } } function fagineum_ticket_client_check_step1($scope) { var error_list = []; $scope.error_relation_adults_children = false; var amount_children1 = $scope.get_ticket_count('0_1')*1; var amount_adults1 = $scope.get_ticket_count('0_3')*1 + $scope.get_ticket_count('0_2')*1; var amount_upgrade1 = $scope.get_ticket_count('0_9')*1 var amount_upgrade2 = $scope.get_ticket_count('0_10')*1 var amount_panel1 = $scope.get_ticket_count("0_1")*1 + $scope.get_ticket_count('0_2')*1 + $scope.get_ticket_count('1_2') + $scope.get_ticket_count('0_3')*1; var amount_panel2 = $scope.get_ticket_count("0_4")*1 + $scope.get_ticket_count("0_5")*1; if (amount_upgrade1 > amount_panel1) { error_list.push("
Achtung! Es dürfen nicht mehr Upgrades ("+amount_upgrade1+") eingetragen werden als Buchungen ("+amount_panel1+")
"); } if (amount_upgrade2 > amount_panel2) { error_list.push("Achtung! Es dürfen nicht mehr Upgrades ("+amount_upgrade2+") eingetragen werden als Buchungen ("+amount_panel2+")
"); } var quote1 = 0; if (amount_adults1 > 0) { quote1 = amount_children1 / amount_adults1; } else { quote1 = 6; } if (amount_children1 > 0 && quote1 > 5) { var missing = amount_children1 / 5 - amount_adults1; if (Math.round(missing) < missing) { missing = Math.round(missing) + 1; } else { missing = Math.round(missing); } var err_text = 'Achtung! Für das Klettern von Kindern im Gipfelstürmer müssen Erwachsene mitklettern. Dabei darf ein Erwachsener maximal 5 Kinder begleiten. '; if (missing === 1) { err_text += 'Es fehlt noch 1 Erwachsener!'; } else { err_text += 'Es fehlen noch ' + missing + ' Erwachsene!'; } err_text += '
'; error_list.push(err_text); } var amount_adults2 = $scope.get_ticket_count('0_5')*1; var amount_children2 = $scope.get_ticket_count('0_4')*1; var quote2 = 0; if (amount_adults2 > 0) { quote2 = amount_children2 / amount_adults2; } else { quote2 = 6; } $scope.error_relation_adults_children2 = false if (amount_children2 > 0 && quote2 > 5) { var missing = amount_children2 / 5 - amount_adults2; if (Math.round(missing) < missing) { missing = Math.round(missing) + 1; } else { missing = Math.round(missing) } var err_text = 'Achtung! Für das Klettern von Kindern im BigJunior müssen Erwachsene mitklettern. Dabei darf ein Erwachsener maximal 5 Kinder begleiten. '; if (missing === 1) { err_text += 'Es fehlt noch 1 Erwachsener!'; } else { err_text += 'Es fehlen noch ' + missing + ' Erwachsene!'; } err_text += '
'; error_list.push(err_text); } if (amount_children2 === 0 && amount_adults2 * 1 > 0) { error_list.push('Achtung! Erwachsene im BigJunior Parcours sind Erwachsene nur als Begleitung zugelassen!
'); } var amount_adults3 = $scope.get_ticket_count('0_7') * 1; var amount_children3 = $scope.get_ticket_count('0_6') * 1; if (amount_children3 === 0 && amount_adults3 * 1 > 0) { error_list.push('Achtung! Erwachsene im KidsXXL-Paket sind nur als Begleitung zugelassen!
'); } if ($scope.ticketservice.event*1 === 1 && (amount_children1 + amount_children2 + amount_children3 + $scope.get_ticket_count('1_2')*1 + $scope.get_ticket_count('0_8')*1) === 0) { error_list.push('Achtung! Für einen Kindergeburtstag muss es mindestens 1 Kind geben!
'); } if ($scope.ticketservice.event*1 === 1 && ($scope.get_count() < 4)) { error_list.push('Achtung! Für einen Kindergeburtstag brauchen wir mindestens 4 Kletternde!
'); } return error_list; } function fagineum_ticket_client_warning_step1($scope) { var count_duration_250 = $scope.get_ticket_count('0_1') + $scope.get_ticket_count('0_2') + $scope.get_ticket_count('1_2') +$scope.get_ticket_count('0_3') + $scope.get_ticket_count('0_6') + $scope.get_ticket_count('0_7') + $scope.get_ticket_count('0_9'); var count_duration_150 = $scope.get_count() - count_duration_250; var warn_list = []; if (count_duration_250 > 0 && count_duration_150 > 0 && $scope.ticketservice.event*1 > 0) { var text = "Mir ist bewußt, dass die gewählten Tickets unterschiedliche Kletterdauer haben und dadurch Wartezeit entstehen, da die Anschlussveranstaltung erst nach der längsten Kletterzeit beginnt!"; if ($scope.ticketservice.warn['0_'+text] !== true) { warn_list.push(text); } } return warn_list; } function fagineum_ticket_client_additional_fields($scope) { var arr = []; if ($scope.ticketservice.event*1 === 1) { arr.push("Alter des Kindes"); } return arr; } function fagineum_has_selbstversorger($scope) { return $scope.ticketservice.equipment['_'+$scope.equipment['equipment'][4].id] !== undefined && $scope.ticketservice.equipment['_'+$scope.equipment['equipment'][4].id] * 1 > 0; } function fagineum_ticket_client_warning_step3($scope) { var warn_list = []; var count_equipment = 0; for (var i=0;i<$scope.equipment['equipment'].length;i++) { if ($scope.ticketservice.equipment['_'+$scope.equipment['equipment'][i].id] !== undefined) { count_equipment += $scope.ticketservice.equipment['_'+$scope.equipment['equipment'][i].id]*1; } } var text_alter_des_kindes = "Alter des Kindes"; var alter = $scope.ticketservice.additional_fields[text_alter_des_kindes]; if ($scope.ticketservice.additional_fields[text_alter_des_kindes] === undefined) { alter = 0; } var val2 = $scope.get_count(); var hasSelbstversorger = fagineum_has_selbstversorger($scope); if (hasSelbstversorger === false && val2 > count_equipment && count_equipment !== 0) { var text = " Achtung Es gibt mehr Kletterer als Menü's! OK?"; if ($scope.ticketservice.warn['3_'+text] !== true) { warn_list.push(text); } } return warn_list; } function fagineum_ticket_client_check_step3($scope) { var error_list = []; var count_equipment = 0; for (var i=0;i<$scope.equipment['equipment'].length;i++) { if ($scope.ticketservice.equipment['_'+$scope.equipment['equipment'][i].id] !== undefined) { count_equipment += $scope.ticketservice.equipment['_'+$scope.equipment['equipment'][i].id]*1; } } var hasSelbstversorger = fagineum_has_selbstversorger($scope); var text_alter_des_kindes = "Alter des Kindes"; var alter = $scope.ticketservice.additional_fields[text_alter_des_kindes]; if ($scope.ticketservice.additional_fields[text_alter_des_kindes] === undefined) { alter = 0; } if (alter === 0) { error_list.push("Achtung Ihr habt kein Alter für das Kind eingegeben!
"); } if (alter > 0 && alter < 3 ) { error_list.push("Achtung Das minimale Alter für Kindergeburtstage ist 3 Jahre!
"); } var val2 = $scope.get_count(); if (count_equipment > 10) { error_list.push("Achtung Mehr als 10 Menü's sind über diesen Buchungsprozess nicht möglich. Kontaktiert uns, wenn eine größere 'Runde' plant ist!
"); } if (hasSelbstversorger === false && count_equipment < 6) { error_list.push("Achtung Für das Feier im Bergwerk.Berlin werden mindestens 6 Menü's benötigt!
"); } return error_list; } function fagineum_ticket_client_custom_note($scope) { var note = ""; if ($scope.get_ticket_count('0_2')*1 > 0) { note = "Reservierung im Gipfelstürmer ist mit " + $scope.get_ticket_count('1_2') + " Erwachsenen Studenten/Schülern."; } var text_alter_des_kindes = "Alter des Kindes"; if ($scope.ticketservice.event*1 === 1) { note += "\nAlter des Kindes: "+$scope.ticketservice.additional_fields[text_alter_des_kindes]; } return note; } function fagineum_get_custom_location_id() { return 1; } function fill_it(until) { var list = []; for (var i = 0; i <= until; i++) { var el = {}; el.id = i * 1; el.el = (i < 10) ? "0" + i : "" + i; list.push(el); } return list; } function get_short_date_string(date) { var tag = date.getDate(); var monat = date.getMonth() + 1; if (("" + tag).length == 1) { tag = "0" + tag; } if (("" + monat).length == 1) { monat = "0" + monat; } return tag + "" + monat; } function add_days(date, day) { var date1 = date.clone(); date1.add(1, day); return date1; } Date.prototype.calc_easter = function () { var year = this.getFullYear(); var a = year % 19; var b = Math.floor(year / 100); var c = year % 100; var d = Math.floor(b / 4); var e = b % 4; var f = Math.floor((b + 8) / 25); var g = Math.floor((b - f + 1) / 3); var h = (19 * a + b - d - g + 15) % 30; var i = Math.floor(c / 4); var k = c % 4; var l = (32 + 2 * e + 2 * i - h - k) % 7; var m = Math.floor((a + 11 * h + 22 * l) / 451); var n0 = (h + l + 7 * m + 114) var n = Math.floor(n0 / 31) - 1; var p = n0 % 31 + 1; var date = new Date(year, n, p); return date; } Date.prototype.is_feiertag = function () { var tag = this.getDate(); var monat = this.getMonth(); var tag1 = tag; var monat1 = monat; if (("" + tag1).length === 1) { tag1 = "0" + tag; } if (("" + monat1).length === 1) { monat1 = "0" + monat1; } feiertage = new Array(); feiertage.push("0101"); //Neujahrstag feiertage.push("0105"); //Tag der Arbeit feiertage.push("0310"); //Tag der Deutschen Einheit feiertage.push("2512"); //Erster Weihnachtstag feiertage.push("2612"); //Zweiter Weihnachtstag var easter = this.calc_easter(); feiertage.push(get_short_date_string(add_days(easter, -2))); //Karfreitag feiertage.push(get_short_date_string(add_days(easter, 1))); //Ostermontag feiertage.push(get_short_date_string(add_days(easter, 39))); //Himmerfahrt feiertage.push(get_short_date_string(add_days(easter, 50))); //Pfingstmonat for (var i = 0; i < feiertage.length; i++) { if (feiertage[i] == (tag1 + "" + monat1)) { return true; } } return false; } Date.prototype.get_day_of_week = function () { if (this.is_feiertag() === true) { return 8; } else { var day_of_week = [7, 1, 2, 3, 4, 5, 6]; return day_of_week[this.getDay()]; } } Date.prototype.is_empty = false; // Provide month names Date.prototype.getMonthName = function () { var month_names = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']; return month_names[this.getMonth()]; } // Provide month abbreviation Date.prototype.getMonthAbbr = function () { var month_abbrs = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec']; return month_abbrs[this.getMonth()]; } // Provide full day of week name Date.prototype.getDayFull = function () { var days_full = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']; return days_full[this.getDay()]; }; // Provide full day of week name Date.prototype.getDayAbbr = function () { var days_abbr = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa']; return days_abbr[this.getDay()]; }; Date.prototype.clone = function () { var date1 = new Date(this.getTime()); date1.is_empty = this.is_empty; return date1; } /** * Add date * @param {type} type 1: add day(s), 2: add weeks(s), 3: add month(s), 4: add year(s) * @param {type} amount: amount to be added, could be negativ = substraction */ Date.prototype.add = function (type, amount) { switch (type * 1) { case 1: var date = this.getDate(); this.setDate(date + amount); break; case 2: var date = this.getDate(); this.setDate(date + amount * 7); break; case 3: this.setMonth(this.getMonth() + amount); break; case 4: this.setFullYear(this.getFullYear() + amount); break; case 5: this.setHours(this.getHours() + amount); break; case 6: this.setMinutes(this.getMinutes() + amount); break; } }; // Provide the day of year 1-365 Date.prototype.getDayOfYear = function () { var onejan = new Date(this.getFullYear(), 0, 1); return Math.ceil((this - onejan) / 86400000); }; // Provide the day suffix (st,nd,rd,th) Date.prototype.getDaySuffix = function () { var d = this.getDate(); var sfx = ["th", "st", "nd", "rd"]; var val = d % 100; return (sfx[(val - 20) % 10] || sfx[val] || sfx[0]); }; // Provide Week of Year Date.prototype.getWeekOfYear = function () { var onejan = new Date(this.getFullYear(), 0, 1); return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7); } // Provide if it is a leap year or not Date.prototype.isLeapYear = function () { var yr = this.getFullYear(); if ((parseInt(yr) % 4) == 0) { if (parseInt(yr) % 100 == 0) { if (parseInt(yr) % 400 != 0) { return false; } if (parseInt(yr) % 400 == 0) { return true; } } if (parseInt(yr) % 100 != 0) { return true; } } if ((parseInt(yr) % 4) != 0) { return false; } }; // Provide Number of Days in a given month Date.prototype.getMonthDayCount = function () { var month_day_counts = [31, this.isLeapYear() ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; return month_day_counts[this.getMonth()]; } // format provided date into this.format format Date.prototype.format = function (dateFormat) { // break apart format string into array of characters dateFormat = dateFormat.split(""); var date = this.getDate(); var month = this.getMonth(); var hours = this.getHours(); var minutes = this.getMinutes(); var seconds = this.getSeconds(); // get all date properties ( based on PHP date object functionality ) var date_props = { d: date < 10 ? '0' + date : date, D: this.getDayAbbr(), j: this.getDate(), l: this.getDayFull(), S: this.getDaySuffix(), w: this.getDay(), z: this.getDayOfYear(), W: this.getWeekOfYear(), F: this.getMonthName(), m: month * 1 + 1 < 10 ? '0' + (month + 1) : month + 1, M: this.getMonthAbbr(), n: month * 1 + 1, t: this.getMonthDayCount(), L: this.isLeapYear() ? '1' : '0', Y: (this.getFullYear() + "").substring(2, 4), y: this.getFullYear(), a: hours > 12 ? 'pm' : 'am', A: hours > 12 ? 'PM' : 'AM', g: hours % 12 > 0 ? hours % 12 : 12, G: hours > 0 ? hours : "12", h: hours % 12 > 0 ? hours % 12 : 12, H: hours < 10 ? '0' + hours : hours, i: minutes < 10 ? '0' + minutes : minutes, s: seconds < 10 ? '0' + seconds : seconds }; // loop through format array of characters and add matching data else add the format character (:,/, etc.) var date_string = ""; for (var i = 0; i < dateFormat.length; i++) { var f = dateFormat[i]; if (f.match(/[a-zA-Z]/g)) { date_string += date_props[f] || date_props[f] == 0 ? date_props[f] : ''; } else { date_string += f; } } return date_string; }; Date.prototype.get_next_date = function (type, format) { var date1 = this.clone(); date1.add(type, 1); return date1.format(format); }; Date.prototype.get_before_date = function (type, format) { var date1 = this.clone(); date1.add(type, -1); return date1.format(format); }; Date.prototype.next = function (type) { this.add(type, 1); }; Date.prototype.before = function (type) { this.add(type, -1); }; Date.prototype.hour = function (newHour) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setHours(newHour * 1); this.is_empty = false; } else { return this.is_empty ? "" : this.getHours() * 1; } }; Date.prototype.minute = function (newMinute) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setMinutes(newMinute); this.is_empty = false; } else { return this.is_empty ? "" : this.getMinutes() * 1; } }; Date.prototype.second = function (newSecond) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setSeconds(newSecond); this.is_empty = false; } else { return this.is_empty ? "" : this.getSeconds() * 1; } }; Date.prototype.day = function (newDay) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setDate(newDay); this.is_empty = false; } else { return this.is_empty ? "" : this.getDate() * 1; } }; Date.prototype.month = function (newMonth) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setMonth(newMonth - 1); this.is_empty = false; } else { return this.is_empty ? "" : this.getMonth() * 1 + 1; } }; Date.prototype.year = function (newYear) { if (this.is_empty === undefined) { this.is_empty = false; } if (arguments.length > 0) { this.setYear(newYear); this.is_empty = false; } else { return this.is_empty ? "" : this.getFullYear() * 1; } }; Date.prototype.getHourList = function () { var list = []; for (var i = 0; i < 24; i++) { list.push(i); } return list; }; Date.prototype.getMinuteList = function () { var list = []; for (var i = 0; i < 60; i++) { list.push(i); } return list; }; Date.prototype.getYearList = function () { var list = []; var date = new Date(); for (var i = 0; i < 40; i++) { list.push(date.getFullYear() * 1 - 20 + i); } return list; }; Date.prototype.getMonthList = function () { var list = []; for (var i = 1; i <= 12; i++) { list.push("" + i); } return list; }; Date.prototype.getDaysList = function () { var list = []; for (var i = 1; i <= this.getMonthDayCount() * 1; i++) { list.push(i); } return list; }; Date.prototype.getEmptyDay = function () { var date1 = this.clone(); date1.setDate(1); var list = []; var t = date1.getDay() * 1 - 1; if (t * 1 < 0) { t = 6; } for (var i = 0; i < t; i++) { list.push(i); } return list; }; Date.prototype.init_empty = function () { this.is_empty = true; }; Date.prototype.init_not_empty = function () { this.is_empty = false; }; function from_sql_to_date(datestring) { var t = datestring.split(/[- :]/); if (t.length <= 3) { t[3] = 0; t[4] = 0; t[5] = 0; } var date1 = new Date(t[0], t[1] - 1, t[2], t[3], t[4], t[5]); date1.is_empty = false; return date1; } ; function time_object(hour_minute) { this.hour = parseInt(hour_minute/100); this.minute = (hour_minute % 100); this.get_value = function() { return this.hour*100 + this.minute*1; } this.print = function() { var hour_val = this.hour; if(this.hour < 10) { hour_val = "0" + this.hour; } var minute_val = this.minute; if(this.minute < 10) { minute_val = "0" + this.minute; } return hour_val+":"+minute_val; } }; 'use strict'; var fagineum_client_ticket_app = angular.module('fagineum_ticket_client', [ 'ngRoute', 'chieffancypants.loadingBar', 'fagineum_client_ticket.startpage', 'fagineum_client_ticket.main_controller', 'ngAnimate', 'ui.bootstrap' ]); fagineum_client_ticket_app.config(function (cfpLoadingBarProvider, $sceProvider) { cfpLoadingBarProvider.includeSpinner = true; $sceProvider.enabled(false); }); fagineum_client_ticket_app.config(['$routeProvider', function ($routeProvider) { $routeProvider.otherwise({redirectTo: '/maincontroller'}); $routeProvider.when('/startpage', { templateUrl: 'fagineum_client/html/startbutton.min.html?v=1', controller: 'startpage_controller' }); $routeProvider.when('/maincontroller', { templateUrl: 'fagineum_client/html/frame.min.html?v=1', controller: 'fagineum_main_controller' }); }]); var fagineum_main_controller_scope = null; var startpage_app = angular.module('fagineum_client_ticket.startpage', ['ngRoute', 'ngAnimate']); startpage_app.controller('startpage_controller', function ($scope, $http, $location, cfpLoadingBar) { $scope.go_step1 = function () { cfpLoadingBar.start(); document.getElementsByTagName("section")[0].style.display = 'none'; if (getWidth() < 450) { document.getElementsByTagName("nav")[0].style.display = 'none'; } $location.path("/maincontroller"); } }); function webservice_get_timeline($scope, $http) { var year = 0; var month = 0; var day = 0; if ($scope.booking_date !== null) { year = $scope.ticketservice.bookingdate.getFullYear(); month = $scope.ticketservice.bookingdate.getMonth() + 1; day = $scope.ticketservice.bookingdate.getDate(); } if (month * 1 < 10) { month = "0" + month; } if (day * 1 < 10) { day = "0" + day; } $http.get(getip() + "/services/timelist.php?booking_date=" + year + "-" + month + "-" + day + "&rand=" + Math.random()).success(function (response) { $scope.error_code = 0; if (response.success === true || response.success == "true") { $scope.timelist = response.data; $scope.is_loading = false; if ($scope.get_timelist_keys().length === 0) { $scope.set_grey = false; } else { $scope.set_grey = true; } } else { $scope.error_code = response.error_code * 1; $scope.is_loading = false; } }); } var check_big_group_counter = 0; function check_big_group(timelist, time, resourcetype_id, tickettype_id, duration, count, offset) { if (count * 1 === 0) { return false; } for (i = 0; i < parseInt(duration / 50); i++) { var current_time = time * 1 + i * 50 + offset * 1; for (var key in timelist[current_time]) { if (key * 1 === resourcetype_id * 1) { for (var key1 in timelist[current_time][key]) { for (j = 0; j < timelist[current_time][key][key1].tickettype_ids.length; j++) { if (timelist[current_time][key][key1].tickettype_ids[j] * 1 === tickettype_id * 1) { if (timelist[current_time][key][key1].type * 1 === 1) { if (i === 0) { if (count * 1 > timelist[current_time][key][key1].count_type_1 * 1) { return true; } } } else { if (count * 1 > timelist[current_time][key][key1].count_type_0 * 1) { return true; } } } } } } } } return false; } function check_booking_state(timelist, time, resourcetype_id, tickettype_id, duration, count, offset) { if (count * 1 === 0) { return 4; } for (i = 0; i < parseInt(duration / 50); i++) { var current_time = time * 1 + i * 50 + offset * 1; if (timelist[current_time] === undefined) { return 1; } for (var key in timelist[current_time]) { if (key * 1 === resourcetype_id * 1) { for (var key1 in timelist[current_time][key]) { for (j = 0; j < timelist[current_time][key][key1].tickettype_ids.length; j++) { if (timelist[current_time][key][key1].tickettype_ids[j] * 1 === tickettype_id * 1) { if (timelist[current_time][key][key1].type * 1 === 1) { if (i === 0) { if (timelist[current_time][key][key1].booking_type_1 * 1 + count * 1 > timelist[current_time][key][key1].count_type_1 * 1) { return 1; } } else { if (timelist[current_time][key][key1].booking_type_0 * 1 + count * 1 > timelist[current_time][key][key1].count_type_0 * 1) { return 1; } } } else { if (timelist[current_time][key][key1].booking_type_0 * 1 + count * 1 > timelist[current_time][key][key1].count_type_0 * 1) { return 1; } } } } } } } } return 3; } function get_to_plus_one_day() { var date = new Date(); date.setDate(date.getDate() + 1); return date; } fagineum_client_ticket_app.factory('fagineum_client_ticket_service', function () { var services = { eventtext: "", //Text für das Event equipment: [], additional_equipment: [], bookingdate: get_to_plus_one_day(), bookingtime: new Date(0, 0, 0, 0, 0, 0, 0), tickets: [], event: "0", warn: [], additional_fields: [], clear: function () { this.tickets = []; this.event = 0; this.warn = []; this.additional_fields = []; this.booking_date = new Date(); this.booking_time = new Date(0, 0, 0, 0, 0, 0, 0); }, tmp_price: [], get_price: function (price_list, tickettype_id, resourcetype_id) { if (this.tmp_price[tickettype_id + "_" + resourcetype_id + "_" + "_" + this.bookingdate.getTime()] !== undefined) { return this.tmp_price[tickettype_id+"_"+resourcetype_id+"_"+this.bookingdate.getTime()]; } for (var i = 0; i < price_list.length; i++) { if (price_list[i].tickettype_id * 1 === tickettype_id * 1 && price_list[i].resourcentype_id * 1 === resourcetype_id * 1) { var beginn = from_sql_to_date(price_list[i].season_beginn); var end = from_sql_to_date(price_list[i].season_end); if (beginn.getTime() <= this.bookingdate.getTime() && this.bookingdate.getTime() <= end.getTime()) { var day_of_weeks = price_list[i].weekday.split(","); for (var j = 0; j < day_of_weeks.length; j++) { if (this.bookingdate.get_day_of_week() * 1 === day_of_weeks[j] * 1) { this.tmp_price[tickettype_id+"_"+resourcetype_id+"_"+this.bookingdate.getTime()] = price_list[i].price * 1; return price_list[i].price * 1; } } } } } return 0.0; }, }; return services; }); fagineum_client_ticket_app.factory('fagineum_client_form_service', function() { var services = { customertyp: "1", has_error: false, error_text: "", salutation: "0", salutation_error: false, organisation: "", organisation_error: false, first_name: "", first_name_error: false, last_name: "", last_name_error: false, street: "", street_error: false, zipcode: "", zipcode_error: false, city: "", city_error: false, telefon: "", telefon_error: false, email: "", email_error: false, email1: "", email1_error: false, check1: false, check1_error: false, check2: false, check2_error: false, kostenpflichtig: false, check_kostenpflichtig: false, init_error : function() { this.has_error = false; this.error_text = ""; this.salutation_error = false; if(this.customertyp*1 !== 2) { this.organisation = ""; } this.organisation_error = false; this.first_name_error= false; this.last_name_error= false; this.street_error = false; this.zipcode_error= false; this.city_error= false; this.telefon_error= false; this.email_error= false; this.email1_error= false; this.email_equals_error = false; this.check1_error= false; this.check2_error= false; this.check_kostenpflichtig = false; }, validateEmail : function(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); }, check_error : function() { this.init_error(); if(this.salutation*1 === 0) { this.salutation_error = true; this.has_error = true; } if(this.customertyp*1 === 2 && this.organisation.length === 0) { this.organisation_error = true; this.has_error = true; } if(this.first_name.length === 0) { this.first_name_error = true; this.has_error = true; } if(this.last_name.length === 0) { this.last_name_error = true; this.has_error = true; } if(this.street.length === 0) { this.street_error = true; this.has_error = true; } if(this.zipcode.length === 0) { this.zipcode_error = true; this.has_error = true; } if(this.city.length === 0) { this.city_error = true; this.has_error = true; } if(this.telefon.length === 0) { this.telefon_error = true; this.has_error = true; } if(this.email.length === 0 || this.validateEmail(this.email) === false) { this.email_error = true; this.has_error = true; } if(this.email1.length === 0 || this.validateEmail(this.email1) === false) { this.email1_error = true; this.has_error = true; } if(this.email.length > 0 && this.email1.length > 0 && this.email != this.email1) { this.email_equals_error = true; this.has_error = true; } if(this.check1 !== true) { this.check1_error = true; this.has_error = true; } if(this.check2 !== true) { this.check2_error = true; this.has_error = true; } return this.has_error; } }; return services; }); function fill_with_zero(str, len) { diff = len - str.length; for (i = 0; i < diff; i++) { str = "0" + str; } return str; } function get_custom_date_str(custom_date, customer_time) { var year = custom_date.getFullYear() + ""; var month = fill_with_zero((custom_date.getMonth() + 1) + "", 2); var day = fill_with_zero(custom_date.getDate() + "", 2); var hour = fill_with_zero(customer_time.getHours() + "", 2); var minute = fill_with_zero(customer_time.getMinutes() + "", 2); return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":00"; } function get_custom_time(custom_time, additional) { var hour = additional / 100; var minutes = additional % 100; custom_time.setHours(custom_time.getHours() + hour); custom_time.setMinutes(custom_time.getMinutes() + minutes / 100 * 60); return custom_time; } function get_beginn_time(date, time, offset) { var custom_time = angular.copy(time); if (offset !== 0) { custom_time = get_custom_time(custom_time, offset); } return get_custom_date_str(date, custom_time); } function get_end_time(date, time, duration, offset) { var custom_time = angular.copy(time); if (offset !== 0) { custom_time = get_custom_time(custom_time, offset); } if (duration !== 0) { custom_time = get_custom_time(custom_time, duration); } return get_custom_date_str(date, custom_time); } get_analytics_item = function(name, sku, category, price, quantity) { return { item_id: sku, item_name: name, item_category: category, price: price, quantity: quantity, affiliation: 'BergwerkClient' }; } add_analytics_item = function (bookingnr, name, sku, category, price, quantity) { /* if (quantity > 0) { ga('ecommerce:addItem', { 'id': bookingnr, // Transaction ID. Required. 'name': name, // Product name. Required. 'sku': sku, // SKU/code. 'category': category, // Category or variation. 'price': price, // Unit price. 'quantity': quantity // Quantity. }); } */ return quantity > 0 ? get_analytics_item(name, sku, category, price, quantity) : undefined; } webservice_get_vticket_resourcetype_id = function($scope) { var resourcetype_id_list = []; for (var i=0;i<$scope.virtual_tickets.length;i++) { var vticket = $scope.virtual_tickets[i]; if (vticket.panel_type === 'single') { if ($scope.ticketservice.tickets['0_'+vticket.id]*1 > 0) { var ticket = $scope.get_ticket_by_id(vticket.ticket_id); var offset = 0; if (ticket.offset !== undefined) { offset = ticket.offset; } if (resourcetype_id_list.indexOf(ticket.resourcetype_id+"_"+ticket.duration+"_"+offset) === -1) { resourcetype_id_list.push(ticket.resourcetype_id+"_"+ticket.duration+"_"+offset); } } } if (vticket.panel_type === 'mix' || vticket.panel_type === 'virtual') { for (var j=0;j Achtung Es fehlt noch \""+$scope.texte['event_' + $scope.ticketservice.event + '_label']+"\"!");
}
if ($scope.error_step3.length > 0 || $scope.warn_step3.length > 0) {
$scope.step = $scope.step * 1 - 1;
}
}
}
if($scope.step*1 === 5) {
if ($scope.formservice.check_error() === true) {
$scope.step = 4;
} else {
if($scope.show_payment_hint === false) {
$scope.step = 4;
$scope.show_payment_hint = true;
}
else {
if($scope.formservice.kostenpflichtig === true) {
webservice_do_booking($scope, $http);
}
else {
$scope.formservice.check_kostenpflichtig = true;
$scope.step = 4;
}
}
}
}
try {
//ga('send', 'pageview', 'booking/step' + $scope.step);
console.log('click');
gtag('event', 'screen_view', {
'app_name': 'fagineum/bookingclient',
'screen_name': 'booking/step' + $scope.step
});
} catch (err) {
console.log(err);
}
}
$scope.back = function () {
if($scope.step*1 === 6) {
$scope.step = 11;
}
else {
$scope.step = $scope.step - 1;
}
}
$scope.close = function () {
$location.path("/");
document.getElementsByTagName("section")[0].style.display = 'block';
document.getElementsByTagName("nav")[0].style.display = 'block';
}
$scope.dateformat = "dd.MM.yyyy";
$scope.dateformat1 = "d.m.Y";
$scope.dateformat2 = "H:i";
$scope.paymentkey = "";
$scope.box_open = false;
$scope.open_box = function () {
$scope.box_open = true;
}
$scope.open_id = 0;
$scope.set_open_id = function (counter) {
$scope.open_id = counter;
$scope.ticketservice.clear();
}
$scope.timelist = [];
$scope.get_free_place = function (counter) {
for (var i = 0; i < $scope.timelist.length; i++) {
if (counter * 1 === $scope.timelist[i].counter * 1) {
var sum = $scope.timelist[i].t4 - $scope.timelist[i].t1 - $scope.timelist[i].t2 - $scope.timelist[i].t3;
if (sum < 0) {
return 0;
} else {
return sum;
}
}
}
return 0;
}
$scope.get_state_color = function (counter) {
switch ($scope.get_state(counter)) {
case 0:
return "";
case 1:
return "red";
case 2:
return "orange";
case 3:
return "green";
}
return "";
}
$scope.range = function(min, max, step) {
step = step || 1;
var input = [];
for (var i = min; i <= max; i += step) {
input.push(i);
}
return input;
};
$scope.booking_group_size_is_to_big = function () {
var tmptimelist = $scope.timelist;
var timelistkeys = $scope.get_timelist_keys();
if (timelistkeys.length === 0) {
return false;
}
var time = timelistkeys[0];
var check = [];
var counter = [];
for (var i=0;i<$scope.panels.length;i++) {
var vticket_list= $scope.get_virtual_tickets($scope.panels[i].id);
for (var j=0;j