1 2/* ----------------------------------------------------------------------------- 3 FORMULARE 4----------------------------------------------------------------------------- */ 5 domain =window.location.hostname; 6 teamleaderChange = false; 7 8jQuery (".removeDisabled").click(function(){ 9 jQuery('#firstname').removeAttr('disabled'); 10 jQuery('#lastname').removeAttr('disabled'); 11 jQuery('#street').removeAttr('disabled'); 12 jQuery('#zip').removeAttr('disabled'); 13 jQuery('#city').removeAttr('disabled'); 14 jQuery('#roleRequest').removeAttr('disabled'); 15 jQuery('#roleAssigned').removeAttr('disabled'); 16 jQuery('#stationRequest').removeAttr('disabled'); 17 jQuery('#stationAssigned').removeAttr('disabled'); 18}); 19 20jQuery(".modal-btn.delete-config").click(function(){ 21 configID = jQuery(this).val(); 22 23 if(jQuery(this).hasClass('activity')) { 24 configType = 'activity'; 25 } 26 if(jQuery(this).hasClass('resource')) { // is ok 27 configType = 'resources'; 28 } 29 if(jQuery(this).hasClass('contexts')) { 30 configType = 'contexts'; 31 } 32 if(jQuery(this).hasClass('specialtimes')) { 33 configType = 'specialtimes'; 34 } 35 if(jQuery(this).hasClass('requirements')) { 36 configType = 'requirements'; 37 } 38 39 40 jQuery.ajax({ 41 type:'POST', 42 url:'https://' + domain + '/account/configuration/delete', 43 data: {configID:configID,configType:configType}, 44 success:function(data){ 45 if(data == false) { 46 window.location.href = 'https://' + domain + '/account/login'; 47 } 48 jQuery('body').addClass('modal-open'); 49 50 jQuery(".modal.configdelete.modal-"+configID).show(); 51 52 jQuery('.modal-close').click(function() { 53 jQuery(this).closest('.modal').hide(); 54 jQuery('body').removeClass('modal-open'); 55 }); 56 jQuery('.cancel').click(function() { 57 jQuery(this).closest('.modal').hide(); 58 jQuery('body').removeClass('modal-open'); 59 }); 60 }, 61 error:function(error){ 62 console.log(error); 63 } 64 }); 65 66}); 67 68 69// ----------------------------------------------------------------------------- 70// AJAX CALL CONFIG-MODAL DETAIL ----------------------------------------------- 71// ----------------------------------------------------------------------------- 72jQuery('.modal-btn.config, .modal-btn-name').click(function() { 73 configID = jQuery(this).val(); 74 75 if(jQuery(this).hasClass('modal-btn-name')) { 76 configID = jQuery(this).attr('value'); 77 } 78 79 if(jQuery(this).hasClass('activity')) { 80 configType = 'activity'; 81 } 82 if(jQuery(this).hasClass('resource')) { // is ok 83 configType = 'resources'; 84 } 85 if(jQuery(this).hasClass('contexts')) { 86 configType = 'contexts'; 87 } 88 if(jQuery(this).hasClass('specialtimes')) { 89 configType = 'specialtimes'; 90 } 91 if(jQuery(this).hasClass('requirements')) { 92 configType = 'requirements'; 93 } 94 95 jQuery.ajax({ 96 type:'POST', 97 url:'https://' + domain + '/account/configuration/getdetails', 98 data: {configID:configID,configType:configType}, 99 success:function(data){ 100 if(data == false) { 101 window.location.href = 'https://' + domain + '/account/login'; 102 } 103 jQuery('body').addClass('modal-open'); 104 jQuery(".modal.config").show(); 105 jQuery('.modal.config .modal-box').html(data); 106 jQuery('.modal-close').click(function() { 107 jQuery(this).closest('.modal').hide(); 108 jQuery('body').removeClass('modal-open'); 109 }); 110 jQuery('.cancel').click(function() { 111 jQuery(this).closest('.modal').hide(); 112 jQuery('body').removeClass('modal-open'); 113 }); 114 115 // ----------------------------------------------------------------------------- 116 // checkConfig : Check must-input-fields - not activ - 117 // ------------------------------------------------------------------------------ 118 jQuery('.checkConfig').click(function() { 119 var checkFields = jQuery('#requiredString').val(); 120 var requestArray = checkFields.split('*'); 121 for (let element of requestArray) { 122 if (element !=="") { 123 var checkValue = jQuery('#'+ element).val(); 124 if (checkValue == "") { 125 // alert ('Bitte füllen Sie die Mussfelder aus'); 126 // jQuery('#'+ element).focus(); 127 // return false;
128 } 129 } 130 } 131 132 var checkSequentialBooking = jQuery('.sequentialBooking').val(); 133 if (typeof checkSequentialBooking !== 'undefined') { 134 if (jQuery('#contextID').val() == "" ) { 135 // alert ('Zeitregel muss angegeben werden'); 136 // jQuery('#contextID').focus(); 137 // return false; 138 } 139 /*if (checkSequentialBooking == 1) { 140 var select = jQuery.find('[class="select-members"]'); 141 var num = select.length; 142 for (let i=0; i<num; i++) { 143 if (select[i].value !== '') { 144 alert ('Es handelt sich hier um eine Veranstaltung, hier sind keine Angaben der Mitarbeiter notwendig'); 145 return true; 146 } 147 } 148 }*/ 149 } 150 151 return true; 152 }); 153 154 155 // ----------------------------------------------------------------------------- 156 // check-date : Check start and end date 157 // ------------------------------------------------------------------------------ 158 jQuery( '.check-date').focusout(function(event) { 159 check = checkDate(jQuery(this),event); 160 return check; 161 }); 162 163 164 // ----------------------------------------------------------------------------- 165 // check-time : Check start and end time 166 // ------------------------------------------------------------------------------ 167 jQuery( '.check-time').focusout(function(event) { 168 var startTime = jQuery(this).find("input[class='start-time']").val() ; 169 var endTime = jQuery(this).find("input[class='end-time']").val(); 170 var day = jQuery(this).find("select[class='check-weekday']").val(); 171 startTime = startTime.replace(":",""); 172 endTime = endTime.replace(":",""); 173 if (endTime == "") {return true}; 174 if (startTime > endTime) { 175 alert ('Die Endzeit darf nicht vor der Startzeit liegen'); 176 event.stopPropagation(); 177 event.stopImmediatePropagation(); 178 return false 179 } 180 if (day == "") { 181 alert ('Geben Sie bitte einen Wochentag an oder löschen sie diese Zeile'); 182 // jQuery(this).find("select[class='check-weekday']").focus(); 183 event.stopPropagation(); 184 event.stopImmediatePropagation(); 185 return false 186 } 187 return true; 188 }); 189 190 // ----------------------------------------------------------------------------- 191 // addRessourceMembers : add Row Ressource with optin all Members 192 // Function 193 // del-row : delete Row Details 194 // ------------------------------------------------------------------------------ 195 jQuery('#addRessourceMembers').click(function() { 196 var idtable = '#' + 'showMembers'; 197 var option = jQuery('.select-members').data('option'); 198 199 var timestamp = getTimestamp(); 200 var name = '0_'+'members_'+timestamp; 201 var nameradio = '0_'+'radio_'+timestamp; 202 var id = 0; 203 204 var idvalue = '<input name="'+name+'_id" type ="hidden" value ="NULL" />' ; 205 var tr; 206 tr = jQuery('<tr /> ') 207 .addClass('changeMember'); 208 td1 = jQuery('<td /> ') 209 .appendTo(tr); 210 select = jQuery('<select />') 211 .attr({'name':name,'id':id}) 212 .addClass('select-members') 213 .append(option) 214 .appendTo(td1); 215 td2 = jQuery('<td />') 216 .addClass('teamleader-member-null') 217 .appendTo(tr); 218 radio1 = jQuery('<input />') 219 .attr({'type':'radio','name':nameradio}) 220 .val(1) 221 .appendTo(td2); 222 label1 = jQuery('<label />') 223 .text(' Teamleiter ') 224 .appendTo(td2); 225 radio2 = jQuery('<input />') 226 .attr({'type':'radio','name':nameradio,'checked':'checked'}) 227 .val(0) 228 .appendTo(td2); 229 label2 = jQuery('<label />') 230 .text(' Mitarbeiter ') 231 .appendTo(td2); 232 td6 = jQuery('<td />') 233 .addClass('del-row ') 234 .appendTo(tr); 235 span = jQuery('<span />') 236 .addClass('icon-minus del-button') 237 // .text(' - ') 238 .appendTo(td6); 239 jQuery(idtable).append(tr); 240 svg = jQuery(setIcon('minus')).appendTo(span); 241 242 //Function 243 jQuery('.del-row').click(function() { 244 jQuery( this ).closest( "tr" ).remove(); 245 }); 246 //Function changeMember 247 jQuery('.changeMember').on("change", function(event) { 248 jQuery(this).find('.teamleader-member-null').removeClass('teamleader-member-null'); 249 250 var optionSelected = jQuery("option:selected", this).val(); 251 if (optionSelected == '') { jQuery(this).find('td').addClass('teamleader-member-null');} 252 253 jQuery('.select-members').on("change", function(event) { 254 var isDirty = !this.options[this.selectedIndex].defaultSelected; 255 teamleaderChange = true; 256 }); 257 if (teamleaderChange == true) { 258 jQuery(this).find('input[value="1"]').prop('checked', false); 259 jQuery(this).find('input[value="0"]').prop('checked', true); 260 } 261 teamleaderChange = false; 262 event.stopPropagation(); 263 event.stopImmediatePropagation(); 264 }); 265 266 }); 267 268 269 // ----------------------------------------------------------------------------- 270 // change Members (teamleaderChange -> Globale Variable) 271 // - td teamleader display 272 // - change Name to NULL td is display:none 273 // - change Name checked is teamleader 0 274 // ------------------------------------------------------------------------------ 275 jQuery('.changeMember').on("change", function(event) { 276 jQuery(this).find('.teamleader-member-null').removeClass('teamleader-member-null'); 277 278 var optionSelected = jQuery("option:selected", this).val(); 279 if (optionSelected == '') { jQuery(this).find('td').addClass('teamleader-member-null');} 280 281 jQuery('.select-members').on("change", function(event) { 282 var isDirty = !this.options[this.selectedIndex].defaultSelected; 283 if (isDirty) 284 { } 285 else { } 286 teamleaderChange = true; 287 }); 288 289 if (teamleaderChange == true) { 290 jQuery(this).find('input[value="1"]').prop('checked', false); 291 jQuery(this).find('input[value="0"]').prop('checked', true); 292 } 293 teamleaderChange = false; 294 event.stopPropagation(); 295 event.stopImmediatePropagation(); 296 }); 297 298 299 // ----------------------------------------------------------------------------- 300 // addRequirements : add Row Requirements with optin all Requirements 301 // Function 302 // del-row : delete Row Details 303 // ------------------------------------------------------------------------------ 304 jQuery('#addRequirements').click(function() { 305 var idtable = '#' + 'showRequirements'; 306 var option = jQuery('.select-requirements').data('option'); 307 308 var timestamp = getTimestamp(); 309 var name = '0_'+'requirements'+timestamp; 310 var id = 0; 311 312 var idvalue = '<input name="'+name+'_id" type ="hidden" value ="NULL" />' ; 313 var tr; 314 tr = jQuery('<tr /> '); 315 td1 = jQuery('<td /> ') 316 .appendTo(tr); 317 select = jQuery('<select />') 318 .attr({'name':name,'id':id}) 319 .append(option) 320 .appendTo(td1); 321 td6 = jQuery('<td />') 322 .addClass('del-row ') 323 .appendTo(tr); 324 span = jQuery('<span />') 325 .addClass('icon-minus del-button') 326 // .text(' - ') 327 .appendTo(td6); 328 jQuery(idtable).append(tr); 329 svg = jQuery(setIcon('minus')).appendTo(span); 330 331 //Function 332 jQuery('.del-row').click(function() { 333 jQuery( this ).closest( "tr" ).remove(); 334 }); 335 }); 336 337 // ----------------------------------------------------------------------------- 338 // addVariations : add new Variation with start/enddate and details 339 // Function 340 // addZeitraum : add new Baserule with start/enddate and details 341 // timewindowSelect : create tr (mo-so) and start/endtime
342 // show-details-variations: Click and show Details 343 // add-day : add Row Details day (mo-so) and start/endtime 344 // del-row : delete Row Details (mo-so) 345 // del-variations : delete this Variation (Base+Details) 346 // check-date : Check Start - End Date 347 // check-time : Check Start - End Time 348 // ------------------------------------------------------------------------------ 349 jQuery('#addVariations').click(function(event) { 350 var iddiv = '#' + jQuery('.pos-add-variations').data('idbase'); 351 var idvalue = jQuery('.pos-add-variations-id').last().data('idvalue'); 352 var idnew = idvalue + 1; 353 var iddetail = idnew + '_detailvariations'; 354 var idbase = idnew + '_base'; 355 356 // ----------------- Table Base Rules 357 var table; 358 var idname = idnew +'_' 359 table = jQuery('<table /> ') 360 .attr('id',iddetail) 361 .data({ 'idtable':iddetail,'idname':idname }) 362 .addClass('table-variation') 363 .css({"display": "table"}); 364 365 // Base Rules tr1 td1 => Standard Time Rules 366 tr1 = jQuery('<tr /> ') 367 .appendTo(table); 368 td1 = jQuery('<td colspan="4"/> ') 369 .text(' Standard Zeitregeln') 370 .appendTo(tr1); 371 span = jQuery('<span class="add-day add-button" /> ') 372 .data({'idtable':iddetail}) 373 .addClass('icon-plus add-day') 374 // .text('+') 375 .appendTo(td1); 376 svg = jQuery(setIcon('plus')).appendTo(span); 377 378 table.append('<tr><th></th> <th>Tag</th><th>Beginn</th><th>Ende</th></tr> ') 379 380 // Table Base Rules Standard Time Rules tr => Day Start, Endtime 381 tr = timewindowSelect(idnew+'_'); 382 jQuery(table).append(tr); 383 384 var divbase; 385 divbase = jQuery('<div />') 386 .addClass('flex-container width-100 check-date') 387 .attr('id',idbase) 388 .data ({'idbase':idbase}); 389 divbase.append( '<div><input type ="hidden" name ='+idnew+'_idbase" value ="NULL"/></div> '); 390 divbase.append( '<div class="pos-add-variations-id " data-idvalue='+idnew+'><input class="start-date" type ="date" name ="'+idnew+'_startdate" required /></div>' ); 391 divbase.append( '<div> - </div>' ); 392 divbase.append( '<div><input class="end-date" type ="date" name ="'+idnew+'_enddate" required /></div>' ); 393 divbase.append( '<div><span data-id ='+iddetail+' class="details-button show-details-variations" > Details </span></div>' ) ; 394 divbase.append( '<div><span data-del='+iddetail+' data-idvar='+idbase+' class="details-button del-variations" > Löschen </span></div>' ) ; 395 396 // ------------ Build Display 397 jQuery(iddiv).append(divbase); 398 jQuery(iddiv) 399 .css({"display": "block"}) ; 400 jQuery(iddiv).append(table); 401 event.stopPropagation(); 402 event.stopImmediatePropagation(); 403 404 // ------------ ADD Functions 405 jQuery('.del-row').click(function() { 406 jQuery( this ).closest( "tr" ).remove(); 407 }); 408 409 jQuery('.show-details-variations').click(function(event) { 410 var idtable = '#' + jQuery(this).data('id'); 411 jQuery(idtable).toggle('slow'); 412 event.stopPropagation(); 413 event.stopImmediatePropagation(); 414 }); 415 416 jQuery('.add-day').click(function(event) { 417 var idtable = '#' + jQuery(this).closest( "table" ).data( "idtable" ); 418 var idname = jQuery(this).closest( "table" ).data( "idname" ); //1_ 419 tr = timewindowSelect(idname); 420 jQuery(idtable).append(tr); 421 422 event.stopPropagation(); 423 event.stopImmediatePropagation(); 424 425 jQuery('.del-row').click(function() { 426 jQuery( this ).closest( "tr" ).remove(); 427 }); 428 429 jQuery( '.check-time').focusout(function(event) { 430 var startTime = jQuery(this).find("input[class='start-time']").val() ; 431 var endTime = jQuery(this).find("input[class='end-time']").val(); 432 var day = jQuery(this).find("select[class='check-weekday']").val(); 433 startTime = startTime.replace(":",""); 434 endTime = endTime.replace(":",""); 435 if (endTime == "") {return true}; 436 if (startTime > endTime) { 437 alert ('Die Endzeit darf nicht vor der Startzeit liegen'); 438 event.stopPropagation(); 439 event.stopImmediatePropagation(); 440 return false 441 } 442 if (day == "") { 443 alert ('Geben Sie bitte einen Wochentag an oder löschen sie diese Zeile'); 444 // jQuery(this).find("select[class='check-weekday']").focus(); 445 event.stopPropagation(); 446 event.stopImmediatePropagation(); 447 return false 448 } 449 return true; 450 }); 451 }); 452 453 jQuery('.del-variations').click(function() { 454 var data = {}; 455 data['id'] = '#' + jQuery( this ).closest( "span" ).data( "del" ); 456 data['idvar'] = '#' + jQuery( this ).closest( "span" ).data( "idvar" ); 457 jQuery(data['idvar']).closest( "div" ).remove(); 458 jQuery(data['id']).closest( "table" ).remove(); 459 }); 460 461 462 jQuery( '.check-date').focusout(function(event) { 463 check = checkDate(jQuery(this),event); 464 return check; 465 }); 466 467 jQuery( '.check-time').focusout(function(event) { 468 var startTime = jQuery(this).find("input[class='start-time']").val() ; 469 var endTime = jQuery(this).find("input[class='end-time']").val(); 470 var day = jQuery(this).find("select[class='check-weekday']").val(); 471 startTime = startTime.replace(":",""); 472 endTime = endTime.replace(":",""); 473 if (endTime == "") {return true}; 474 if (startTime > endTime) { 475 alert ('Die Endzeit darf nicht vor der Startzeit liegen'); 476 event.stopPropagation(); 477 event.stopImmediatePropagation(); 478 return false 479 } 480 if (day == "") { 481 alert ('Geben Sie bitte einen Wochentag an oder löschen sie diese Zeile'); 482 // jQuery(this).find("select[class='check-weekday']").focus(); 483 event.stopPropagation(); 484 event.stopImmediatePropagation(); 485 return false 486 } 487 return true; 488 }); 489 490 }); 491 // -- end AddZeitraum 492 493 // -----------------------------------------------------------------------------
494 // show-details-variations: Show and Close Context - Details 495 // ------------------------------------------------------------------------------ 496 jQuery('.show-details-variations').click(function(event) { 497 var idtable = '#' + jQuery(this).data('id'); 498 jQuery(idtable).toggle('slow'); 499 event.stopPropagation(); 500 event.stopImmediatePropagation(); 501 }); 502 503 // ----------------------------------------------------------------------------- 504 // add-day: Show and Close Context - Details 505 // Function 506 // timewindowSelect : create tr (mo-so) and start/endtime 507 // del-row : delete Row Details (mo-so) 508 // check-time : Check Start - End Time 509 // ------------------------------------------------------------------------------ 510 jQuery('.add-day').click(function(event) { 511 var idtable = '#' + jQuery(this).closest( "table" ).data( "idtable" ); //1_detailvariations 512 var idname = jQuery(this).closest( "table" ).data( "idname" ); //1_ 513 tr = timewindowSelect(idname); 514 jQuery(idtable).append(tr); 515 event.stopPropagation(); 516 event.stopImmediatePropagation(); 517 518 // Function 519 jQuery('.del-row').click(function() { 520 jQuery( this ).closest( "tr" ).remove(); 521 }); 522 jQuery( '.check-time').focusout(function(event) { 523 var startTime = jQuery(this).find("input[class='start-time']").val() ; 524 var endTime = jQuery(this).find("input[class='end-time']").val(); 525 var day = jQuery(this).find("select[class='check-weekday']").val(); 526 startTime = startTime.replace(":",""); 527 endTime = endTime.replace(":",""); 528 if (endTime == "") {return true}; 529 if (startTime > endTime) { 530 alert ('Die Endzeit darf nicht vor der Startzeit liegen'); 531 event.stopPropagation(); 532 event.stopImmediatePropagation(); 533 return false 534 } 535 if (day == "") { 536 alert ('Geben Sie bitte einen Wochentag an oder löschen sie diese Zeile'); 537 //jQuery(this).find("select[class='check-weekday']").focus(); 538 event.stopPropagation(); 539 event.stopImmediatePropagation(); 540 return false 541 } 542 return true; 543 }); 544 545 }); 546 547 // ----------------------------------------------------------------------------- 548 // del-row : delete Row Details (mo-so) 549 // ------------------------------------------------------------------------------ 550 jQuery('.del-row').click(function() { 551 jQuery( this ).closest( "tr" ).remove(); 552 }) ; 553 554 // ----------------------------------------------------------------------------- 555 // del-variations : delete this Variation (Base+Details) 556 // ------------------------------------------------------------------------------ 557 jQuery('.del-variations').click(function() { 558 var data = {}; 559 data['id'] = '#' + jQuery( this ).closest( "span" ).data( "del" ); 560 data['idvar'] = '#' + jQuery( this ).closest( "span" ).data( "idvar" ); 561 jQuery(data['idvar']).closest( "div" ).remove(); 562 jQuery(data['id']).closest( "table" ).remove(); 563 }); 564 565 // ----------------------------------------------------------------------------- 566 // addAbcTes : add new Absences for Contexts / Timewindow 567 // Function 568 // inputDateTime : create tr Startdate Starttime Endedate Endtime 569 // del-row : delete Row Details (mo-so) 570 // check-date : Check Start - End Date 571 // ------------------------------------------------------------------------------ 572 jQuery('#addAbsences').click(function() { 573 var idtable = '#' + 'showAbsences'; 574 tr = inputDateTime("absences"); 575 jQuery(idtable).append(tr); 576 577 //-- Function 578 jQuery('.del-row').click(function() { 579 jQuery( this ).closest( "tr" ).remove(); 580 }); 581 582 jQuery( '.check-date').focusout(function(event) { 583 check = checkDate(jQuery(this),event); 584 return check; 585 }); 586 }); 587 588 // ----------------------------------------------------------------------------- 589 // addAbsences : add new Presences for Contexts / Timewindow 590 // Function 591 // inputDateTime : create tr Startdate Starttime Endedate Endtime 592 // del-row : delete one Row Details (mo-so) 593 // check-date : Check Start - End Date 594 // ------------------------------------------------------------------------------ 595 jQuery('#addPresences').click(function() { 596 var idtable = '#' + 'showPresences'; 597 tr = inputDateTime("presences"); 598 jQuery(idtable).append(tr); 599 //-- Function 600 jQuery('.del-row').click(function() { 601 jQuery( this ).closest( "tr" ).remove(); 602 }); 603 jQuery( '.check-date').focusout(function(event) { 604 check = checkDate(jQuery(this),event); 605 return check; 606 }); 607 }); 608 609 // ----------------------------------------------------------------------------- 610 // inputDateTime : create tr Startdate Starttime Endedate Endtime 611 // Function 612 // getTimestamp : get Timestamp to build id 613 // ------------------------------------------------------------------------------ 614 function inputDateTime(action){ 615 var timestamp = getTimestamp(); 616 var name = '0_'+action+timestamp; 617 618 var idvalue = '<input name="'+name+'_id" type ="hidden" value ="NULL" />' ; 619 var datetimeDateStart = '<input class="start-date" name="'+name+'_startDate" type ="date" value ="" required />' ; 620 var datetimeTimeStart = '<input name="'+name+'_startTime" type ="time" value ="" required step="300" />' ; 621 var datetimeDateEnd = '<input class="end-date" name="'+name+'_endDate" type ="date" value ="" required />' ; 622 var datetimeTimeEnd = '<input name="'+name+'_endTime" type ="time" value ="" required step="300"/>' ; 623 tr = jQuery('<tr /> ') 624 .addClass('check-date ') ; 625 626 td0 = jQuery('<td /> ') 627 .append(idvalue ) 628 .appendTo(tr); 629 td1 = jQuery('<td /> ') 630 .append(datetimeDateStart) 631 .appendTo(tr); 632 td2 = jQuery('<td /> ') 633 .append(datetimeTimeStart) 634 .appendTo(tr); 635 td3 = jQuery('<td /> ') 636 .append(' - ') 637 .appendTo(tr); 638 td4 = jQuery('<td /> ') 639 .append(datetimeDateEnd) 640 .appendTo(tr); 641 td5 = jQuery('<td /> ') 642 .append(datetimeTimeEnd) 643 .appendTo(tr); 644 td6 = jQuery('<td />') 645 .addClass('del-row ') 646 .appendTo(tr); 647 span = jQuery('<span />') 648 .addClass('icon-minus del-button') 649 // .text(' - ') 650 .appendTo(td6); 651 svg = jQuery(setIcon('minus')).appendTo(span); 652 return (tr); 653 } 654 655 // ----------------------------------------------------------------------------- 656 // timewindowSelect : create tr (mo-so) and start/endtime 657 // ------------------------------------------------------------------------------ 658 function timewindowSelect(idname){ 659 var timestamp = getTimestamp(); 660 var name = idname+timestamp; 661 var tr; 662 var idvalue = '<input type ="hidden" name ="'+name+'idday" value ="NULL"/>' ; 663 var dayvalue = '<select class="check-weekday" name="'+name+'weekday" id="" required >'+ 664 '<option value=""></option>'+ 665 '<option value="Monday">Montag</option>'+ 666 '<option value="Tuesday">Dienstag</option>'+ 667 '<option value="Wednesday">Mittwoch</option>'+ 668 '<option value="Thursday">Donnerstag</option>'+ 669 '<option value="Friday">Freitag</option>'+ 670 '<option value="Saturday">Samstag</option>'+ 671 '<option value="Sunday">Sonntag</option>'+ 672 '</select>'; 673 var timevalueStart = '<input class="start-time" type ="time" name ="'+name+'startTime" id ="" required step="300" />' ; 674 var timevalueEnd = '<input class="end-time" type ="time" name ="'+name+'endTime" id ="" required step="300" />' ; 675 var capacityOverride = '<input class="capacityOverride" type ="hidden" name ="'+name+'capacityOverride" id ="" min=1 />' ; 676 677 tr = jQuery('<tr />') 678 .addClass ('check-time'); 679 tr.append('<td>' + idvalue + '</td>'); 680 tr.append('<td>' + dayvalue + '</td>'); 681 tr.append('<td>' + timevalueStart + '</td>'); 682 tr.append('<td>' + timevalueEnd + '</td>'); 683 tr.append('<td>' + capacityOverride + '</td>'); 684 td = jQuery('<td />') 685 .addClass('del-row ') 686 .appendTo(tr); 687 span = jQuery('<span />') 688 .addClass('icon-minus del-button') 689 // .text(' - ') 690 .appendTo(td); 691 svg = jQuery(setIcon('minus')).appendTo(span); 692 693 return (tr); 694 } 695 696 // ----------------------------------------------------------------------------- 697 // getTimestamp : get Timestamp 698 // ------------------------------------------------------------------------------ 699 function getTimestamp() { 700 var date = new Date(); 701 var timestamp = date.getHours() + '-' + date.getMinutes() + '-' + date.getSeconds()+date.getMilliseconds(); 702 return(timestamp); 703 } 704 705 // ----------------------------------------------------------------------------- 706 // set Members for Ab- or Presences 707 // ------------------------------------------------------------------------------ 708 jQuery('.presence').click(function() { 709 var sences = jQuery(this).val(); 710 var text = setMemberText(sences); 711 jQuery("#label_capacity").text(text); 712 }); 713 jQuery('.label_Anwesenheit-Zeit').click(function() { 714 $('input[name="presence"][value="1"]').prop('checked', true);
715 $('input[name="presence"][value="0"]').prop('checked', false); 716 var text = setMemberText(1); 717 jQuery("#label_capacity").text(text); 718 }); 719 jQuery('.label_Abwesenheit-Zeit').click(function() { 720 $('input[name="presence"][value="0"]').prop('checked', true); 721 $('input[name="presence"][value="1"]').prop('checked', false); 722 var text = setMemberText(0); 723 jQuery("#label_capacity").text(text); 724 }); 725 726 // ----------------------------------------------------------------------------- 727 // check allcontext if any is checked 728 // ------------------------------------------------------------------------------ 729 jQuery(".allcontexts input").click(function(){ 730 jQuery(":checkbox").on("change", function() { 731 if (jQuery('.allcontexts input:checked').length == 0) { 732 // jQuery('.allresources input').css({"display": "inline"}); 733 jQuery('.allresources input').removeAttr('disabled'); 734 } 735 else { 736 jQuery('.allresources input').attr('checked',false); 737 // jQuery('.allresources input').css({"display": "none"}); 738 jQuery('.allresources input').attr('disabled', 'disabled'); 739 jQuery('#label_capacity').css({"display": "none"}); 740 jQuery('#capacity').css({"display": "none"}); 741 } 742 }); 743 }); 744 // ----------------------------------------------------------------------------- 745 // check allresources if any is checked 746 // ------------------------------------------------------------------------------ 747 jQuery(".allresources input").click(function(event){ 748 jQuery(":checkbox").on("change", function(event) { 749 if (jQuery('.allresources input:checked').length == 0) { 750 jQuery('.allcontexts input').removeAttr('disabled'); 751 jQuery('#label_capacity').css({"display": "none"}); 752 jQuery('#capacity').css({"display": "none"}); 753 jQuery('#capacity').val(1) ; 754 } 755 else { 756 jQuery('.allcontexts input').attr('checked',false); 757 jQuery('.allcontexts input').attr('disabled', 'disabled'); 758 var text = setMemberText(jQuery('.presence:checked').val()); 759 jQuery("#label_capacity").text(text); 760 jQuery('#label_capacity').css({"display": "inline"}); 761 jQuery('#capacity').css({"display": "inline"}); 762 } 763 }); 764 }); 765 766 // ----------------------------------------------------------------------------- 767 // check capacity 768 // ------------------------------------------------------------------------------ 769 jQuery(".allresources input").click(function(event){ 770 var capacity = jQuery('#capacity').val(); 771 if (capacity == 0 ) { 772 alert ("die Kapizität muss positiv sein"); 773 event.stopImmediatePropagation(); 774 event.stopPropagation(); 775 } 776 }); 777 778 // ----------------------------------------------------------------------------- 779 // Set Members Resources Text 780 // ------------------------------------------------------------------------------ 781 function setMemberText(sences) { 782 if (sences == 1) { 783 var textbold = "erhöht" ; 784 jQuery('#label_capacity').removeClass("specialtimes_ab"); 785 jQuery('#label_capacity').addClass("specialtimes_an"); 786 } 787 else { 788 var textbold ="verringert"; 789 jQuery('#label_capacity').removeClass("specialtimes_an"); 790 jQuery('#label_capacity').addClass("specialtimes_ab"); 791 } 792 var text ="Ressource " + textbold + " sich um x-Mitarbeiter"; 793 jQuery(text).css('font-weight','bold'); 794 return(text); 795 } 796 797 // ----------------------------------------------------------------------------- 798 // durationAllDay == true => no display from Timefields 799 // ("duration","postProcessingTime","durationForMultiBooking","slotTime") 800 // durationAllDay = 1/true => all Day 801 // ------------------------------------------------------------------------------ 802 jQuery(".durationAllDay").click(function(event) { 803 var allday = jQuery(this).val(); 804 805 if (allday == 1) { 806 jQuery('#duration').val(0); 807 jQuery('#duration').css({"display": "none"}); 808 jQuery('#label_duration').css({"display": "none"}); 809 jQuery('#postProcessingTime').val(0); 810 jQuery('#postProcessingTime').css({"display": "none"}); 811 jQuery('#label_postProcessingTime').css({"display": "none"}); 812 jQuery('#durationForMultiBooking').val(0); 813 jQuery('#durationForMultiBooking').css({"display": "none"}); 814 jQuery('#label_durationForMultiBooking').css({"display": "none"}); 815 jQuery('#slotTime').val(0); 816 jQuery('#slotTime').css({"display": "none"}); 817 jQuery('#label_slotTime').css({"display": "none"}); 818 jQuery('#duration').attr({"min": "0"}); 819 jQuery('#slotTime').attr({"min": "0"}); 820 } 821 else { 822 jQuery('#duration').css({"display": "block"}); 823 jQuery('#label_duration').css({"display": "block"}); 824 jQuery('#postProcessingTime').css({"display": "block"}); 825 jQuery('#label_postProcessingTime').css({"display": "block"}); 826 jQuery('#durationForMultiBooking').css({"display": "block"}); 827 jQuery('#label_durationForMultiBooking').css({"display": "block"}); 828 jQuery('#slotTime').css({"display": "block"}); 829 jQuery('#label_slotTime').css({"display": "block"}); 830 jQuery('#duration').attr({"min": "5","step":"5"}); 831 jQuery('#slotTime').attr({"min": "5","step":"5"}); 832 } 833 }); 834 835 // ----------------------------------------------------------------------------- 836 // Change Ressource in Activities option:selected').data 837 // ------------------------------------------------------------------------------ 838 jQuery("#resources").on("change", function(event) { 839 var multibooking = jQuery('#resources option:selected').data('multibooking'); 840 if (multibooking == true) { 841 jQuery('#durationForMultiBooking').removeAttr('readonly'); 842 } 843 else { 844 jQuery('#durationForMultiBooking').val(0); 845 jQuery('#durationForMultiBooking').attr('readonly','true'); 846 } 847 }); 848 849 // ----------------------------------------------------------------------------- 850 // allways checked 851 // to-do-name 852 // durationAllDay = 1/true => all Day => display only durationAllDay 853 // ------------------------------------------------------------------------------ 854 if (configType == 'specialtimes') { 855 if (jQuery('.allresources input:checked').length == 0 ) { 856 jQuery('#label_capacity').css({"display": "none"}); 857 jQuery('#capacity').css({"display": "none"}); 858 } 859 else { 860 var text = setMemberText(jQuery('.presence:checked').val()); 861 jQuery("#label_capacity").text(text); 862 } 863 } 864 865 jQuery(document).ready(function() { 866 if( jQuery('.durationAllDay:checked').val() == 1) { 867 jQuery('#duration').css({"display": "none"}); 868 jQuery('#label_duration').css({"display": "none"}); 869 jQuery('#postProcessingTime').css({"display": "none"}); 870 jQuery('#label_postProcessingTime').css({"display": "none"}); 871 jQuery('#durationForMultiBooking').css({"display": "none"}); 872 jQuery('#label_durationForMultiBooking').css({"display": "none"}); 873 jQuery('#slotTime').css({"display": "none"}); 874 jQuery('#label_slotTime').css({"display": "none"}); 875 } 876 }); 877 878 }, 879 error:function(error){ 880 console.log(error); 881 } 882 }); 883}); 884 885 886 887 888 889// ----------------------------------------------------------------------------- 890// DATACONTAINER 891// ------------------------------------------------------------------------------ 892
893// ----------------------------------------------------------------------------- 894// changeAttributeName 895// AttributeName changed to Text: StringValue disabled and clear, show language 896// AttributeName changed to Date/1: StringValue input type= date, language disabled 897// AttributeName changed to X: StringValue input type=text, language disabled 898// ------------------------------------------------------------------------------ 899jQuery(".changeAttributeName").on("change", function(event) { 900 var attributeid = jQuery(this).val(); 901 var attributeName = jQuery(this).attr("name"); 902 var idName = attributeName.split("-"); 903 var idNr = idName[0]; 904 var attributeValue = jQuery(this).data("value"); 905 var check = true; 906 907 if (attributeValue != '' && check == true) { 908 alert('Sie dürfen kein bestehendes Attribute wechseln - Bitte löschen Sie das komplette Attribut und erfassen Sie ein Neues '); 909 $('#'+attributeName+' option[value="'+attributeValue+'"]').css('color','red'); 910 911 $('#'+attributeName+' option:selected').each(function(){ 912 $('#'+attributeName+' option:selected').removeAttr('selected'); 913 }); 914 $('#'+attributeName+' option[value='+attributeValue+']').attr('selected','selected'); 915 $('#'+attributeName+' option[value='+attributeValue+']').prop('selected',true); 916 } 917 else { 918 setNewAttribute(idNr,attributeName); 919 } 920 event.stopPropagation(); 921 event.stopImmediatePropagation(); 922}); 923 924// ----------------------------------------------------------------------------- 925// setNewAttribute 926// idNr : Nummer of the object 927// attributeName 928// type : LONG_TEXT (DE,EN,FR), GROUP 929// ------------------------------------------------------------------------------ 930function setNewAttribute(idNr,attributeName){ 931 var idStringValueAttribute = '#' + idNr +'-attribute-stringValue'; 932 var idStringValueDefault = '#' + idNr +'-default-stringValue'; 933 var child = $('#'+attributeName+' option:selected').data('child'); 934 var possible = $('#'+attributeName+' option:selected').data('possible'); 935 936 if (typeof child !== 'undefined') { 937 var child = child.substr(0, child.length - 1); 938 } 939 var type = $('#'+attributeName+' option:selected').data('type'); 940 jQuery('#' + idNr +'-pos-add-new ' +'div' ).closest(".flex-data-container-attribute").remove(); 941 942 switch(type) { 943 case 'GROUP': 944 //remove old attributes 945 jQuery(idStringValueDefault).css('display','none'); 946 jQuery(idStringValueDefault).val(''); 947 jQuery('#' + idNr + '-emptyrow' ).closest("br").remove(); 948 949 lastgroup = jQuery('#label_' + idNr +'-attribute-attributeValues').text(); 950 if (lastgroup == "") { 951 jQuery('#label_' + idNr +'-default-stringValue').text('Attribute'); 952 } 953 jQuery('#label_' + idNr +'-attribute-attributeValues').text('Attribute'); 954 955 var iddel = idNr +'-attribute-attributeName'; 956 var appendDiv = jQuery('#' + idNr +'-pos-add-new').closest("div"); 957 jQuery('.' + idNr + '-attribute-attributeValues' ).closest("div").remove(); 958 959 //1. div FlexiBox 960 var valuesString = jQuery('<div />') 961 .addClass('flex-data-container-attribute') 962 .addClass(iddel) 963 .appendTo(appendDiv); 964 965 var optionArray = child.split(','); 966 var countBlock = Math.round(optionArray.length / 1); 967 var i = 0; 968 969 for(let childelement of optionArray) { 970 var optionElemente = childelement.split('-'); 971 var id = optionElemente[0]; 972 var childid = optionElemente[0]; 973 var text = optionElemente[1]; 974 var type = optionElemente[2]; 975 var typeUntranslated = optionElemente[3]; 976 // if (text == '') {text = 'undefined';} 977 if (text != '') { 978 //2.START Flexibox to div Flexibox 979 if (i == 0) { 980 var flexdiv = jQuery('<div />') 981 .val(optionElemente[1]) 982 .appendTo(valuesString); 983 } 984 //3. radiobox to Flexibox 985 var radioString = jQuery('<input />') 986 .attr({'type':'checkbox','name':idNr+'-attributeValues-id-'+id}) 987 .val(id) 988 .appendTo(flexdiv); 989 //4. label to Flexibox 990 var label = jQuery('<label />') 991 .val(text) 992 .text(' '+text) 993 .appendTo(flexdiv); 994 //5. DATE to Flexibox 995 if (type == 'DATE') { 996 var radioString = jQuery('<input />') 997 .attr({'type':'date','name':id+'-attribute-stringValue'}) 998 .val('') 999 .appendTo(flexdiv); 1000 } 1001 //5. Text to Flexibox 1002 if (type == 'UNTRANSLATED' || typeUntranslated == 'UNTRANSLATED' ) { 1003 var radioString = jQuery('<input />') 1004 .attr({'type':'text','name':id+'-attribute-stringValue'}) 1005 .val('') 1006 .appendTo(flexdiv); 1007 } 1008 //5. LINK to Flexibox 1009 if (type == 'LINK' || typeUntranslated == 'link' ) { 1010 var linkString = jQuery('<input />') 1011 .attr({'type':'text','name':id+'-attribute-linktext','placeholder': 'Link Text'}) 1012 .addClass('attr-link-text') 1013 .val('') 1014 .appendTo(flexdiv); 1015 var linkString = jQuery('<input />') 1016 .attr({'type':'url','name':id+'-attribute-linkurl','placeholder': 'Link Adresse/URL'}) 1017 .addClass('attr-link-href') 1018 .val('') 1019 .appendTo(flexdiv); 1020 } 1021 //5.BOOLEAN to Flexibox 1022 if (type == 'BOOLEAN' || typeUntranslated == 'BOOLEAN' ) { 1023 var radioString = jQuery('<input />') 1024 .attr({'type':'hidden','name':id+'-attribute-stringValue'}) 1025 .val('true') 1026 .appendTo(flexdiv); 1027 } 1028 //5. Text to Flexibox 1029 if (type == 'INTEGER' || typeUntranslated == 'INTEGER' ) { 1030 var radioString = jQuery('<input />') 1031 .attr({'type':'number','name':id+'-attribute-stringValue'}) 1032 .val('') 1033 .appendTo(flexdiv); 1034 } 1035 //6. Row to Flexibox 1036 var row = jQuery('<br />').appendTo(flexdiv); 1037 //5. textarea + Row to Flexibox 1038 if (type == 'LONG_TEXT' || type == 'SHORT_TEXT' ) { 1039 divlabel = jQuery('<div class="floatLeft div-form-label" style="clear:both;" />') 1040 .appendTo(flexdiv); 1041 maxlength = (type == 'SHORT_TEXT' ) ? '400' : ''; 1042 1043 divinput = jQuery('<div />') 1044 .appendTo(flexdiv); 1045 inputValue = jQuery('<textarea />') 1046 .attr({'id':id+'-language-text','name':id+'-language-text','maxlength':maxlength}) 1047 .val('') 1048 .appendTo(divinput); 1049 } 1050 //7.possibleValues 1051 var possibleArray = possible.split(','); 1052 for(let possible of possibleArray) { 1053 var optionElemente = possible.split('-'); 1054 var parentid = optionElemente[0]; 1055 var idpos = optionElemente[1]; 1056 var text = optionElemente[2]; 1057 var multivalue = optionElemente[3]; 1058 if (possible != '' && parentid == childid) { 1059 possible = jQuery('<div/>') 1060 // .attr({'id':id+'-possible','name':id+'-possible'}) 1061 .css({"margin-left": "30px"}) 1062 .val(text) 1063 .appendTo(flexdiv); 1064 if (multivalue == 0) { 1065 var radioString = jQuery('<input />') 1066 .attr({'type':'radio','name':idNr+'-attributeValues-id-'+id+'-possible-radio'}) 1067 .val(idpos) 1068 .appendTo(possible); 1069 } 1070 else { 1071 var radioString = jQuery('<input />') 1072 .attr({'type':'checkbox','name':idNr+'-attributeValues-id-'+id+'-possible-'+idpos}) 1073 .val(idpos) 1074 .appendTo(possible); 1075 } 1076 var label = jQuery('<label />') 1077 .attr({'id':'label_'+idpos+'-possible','name':'label_'+idpos+'-possible'}) 1078 .val(text) 1079 .text(' '+text) 1080 .appendTo(possible); 1081 } 1082 //-end possibleValues 1083 } 1084 } 1085 var i = i + 1; 1086 //End Flexibox 1087 if (countBlock == i) { var i = 0; } 1088 } 1089 jQuery(idStringValueAttribute).attr('type','text'); 1090 // end Group 1091 break; 1092 1093 default: 1094 //Remove old attribute 1095 jQuery('#label_' + idNr +'-attribute-attributeValues').text(''); 1096 jQuery('#label_' + idNr +'-attribute-attributeValues').css('display','none'); 1097 jQuery('.' + idNr + '-attribute-attributeValues' ).closest("div").remove(); 1098 jQuery('#' + idNr + '-emptyrow' ).closest("br").remove(); 1099 //set new attribute
1100 jQuery(idStringValueDefault).css('display','block'); 1101 jQuery('#label_' + idNr +'-default-stringValue').css('display','block'); 1102 jQuery('#label_' + idNr +'-default-stringValue').text('stringValue'); 1103 jQuery(idStringValueDefault).attr('type','text'); 1104 if (type == 'DATE') {jQuery(idStringValueDefault).attr('type','date'); } 1105 if (type == 'UNTRANSLATED') {jQuery(idStringValueDefault).attr('type','text'); } 1106 if (type == 'INTEGER') {jQuery(idStringValueDefault).attr('type','number'); } 1107 if (type == 'BOOLEAN') {jQuery(idStringValueDefault).attr('type','hidden'); } 1108 // empty row 1109 var appendDiv = jQuery('#' + idNr +'-pos-add-new').closest("div"); 1110 var valuesString = jQuery('<br>') 1111 .attr({'id':idNr+'-emptyrow'}) 1112 .appendTo(appendDiv); 1113 break; 1114 1115 } 1116} 1117 1118// ----------------------------------------------------------------------------- 1119// filterCategories 1120// Filtering of the Datacontainer list witch categories 1121// ------------------------------------------------------------------------------ 1122jQuery("#categories-filter option").click(function(){ 1123 var categorieId = jQuery(this).attr("id"); 1124 var context = jQuery("#categories-filter").data("context"); 1125 1126 if (typeof categorieId === 'undefined') { 1127 var categorieFilter = ''; 1128 } 1129 else { 1130 var categorieFilter = '&categorie='+categorieId; 1131 } 1132 window.location.href = 'https://' + domain + '/account/dataobjects?context=' + context+ categorieFilter; 1133}); 1134 1135 1136// ----------------------------------------------------------------------------- 1137// del Attribute 1138// ------------------------------------------------------------------------------ 1139jQuery('.del-button-attribute').click(function(event) { 1140 var idattr = jQuery(this).data('idattr'); 1141 var dataoption = jQuery('#'+idattr+'-attribute-attributeName').data('option'); 1142 if (typeof dataoption === 'undefined') { 1143 jQuery('#'+'del-add-attribute-id-'+idattr).remove(); 1144 } 1145 else { 1146 jQuery('#'+idattr+'-attribute-attributeId').val('NULL'); 1147 jQuery('#'+idattr+'-attribute-attributeName').val(''); 1148 jQuery('#label_' + idattr +'-attribute-attributeValues').css('display','none'); 1149 jQuery('#label_' + idattr +'-attribute-attributeValues').text(''); 1150 jQuery('.'+idattr+'-attribute-attributeValues').remove(); 1151 jQuery('#'+idattr+'-pos-add-new').remove(); 1152 jQuery('#'+idattr+'-attribute-attributeName'+' option').removeAttr('selected'); 1153 //--------------------------------------------- 1154 jQuery('#'+idattr+'-stringValue').val(''); 1155 jQuery(this).closest( "span" ).remove(); 1156 jQuery('#'+'label_'+idattr+'-attribute-attributeId').css('display','none'); 1157 jQuery('#'+idattr+'-attribute-attributeId').css('display','none'); 1158 jQuery('#'+'label_'+idattr+'-attribute-attributeName').css('display','none'); 1159 jQuery('#'+idattr+'-attribute-attributeName').css('display','none'); 1160 1161 jQuery('#'+'label_'+idattr+'-stringValue').css('display','none'); 1162 jQuery('#'+idattr+'-stringValue').css('display','none'); 1163 } 1164 event.stopPropagation(); 1165 event.stopImmediatePropagation(); 1166}); 1167 1168 1169// ----------------------------------------------------------------------------- 1170// Add new Attribute 1171// ------------------------------------------------------------------------------ 1172jQuery("#addAttribute").click(function(event){ 1173 1174 var iddiv = '#' + jQuery('.pos-add-attribute').data('idattr'); 1175 var idvalue = jQuery('.pos-add-attribute-id').last().data('idvalue'); 1176 var option = jQuery('.changeAttributeName').data('option'); 1177 var idnew = idvalue + 1; 1178 var typelanguage = 'hidden'; 1179 1180 jQuery(iddiv) 1181 .css({"display": "block"}) ; 1182 1183 //del total div 1184 var totaldel = jQuery('<div />') 1185 .attr('id','del-add-attribute-id-'+idnew) 1186 .appendTo(iddiv); 1187 1188 // Attribute-ID 1189 divlabel = jQuery('<br/><div class="floatLeft div-form-label" style="clear:both;" />') 1190 .addClass('pos-add-attribute-id') 1191 .data('idvalue',idnew ) 1192 .appendTo(totaldel); 1193 labelID = jQuery('<label><span></span></label> ') 1194 .attr('id','label_'+idnew+'-attribute-attributeId') 1195 .appendTo(divlabel); 1196 divinput = jQuery('<div />') 1197 .appendTo(totaldel);
1198 inputID = jQuery('<input type="hidden" value="0" />') 1199 .attr({'id':idnew+'-attribute-attributeId','name':idnew+'-attribute-attributeId'}) 1200 .appendTo(divinput); 1201 1202 // Attribute-Name 1203 divlabel = jQuery('<div class="floatLeft div-form-label" style="clear:both;" />') 1204 .appendTo(totaldel); 1205 labelName = jQuery('<label><span>Gruppe</span></label> ') 1206 .attr('id','label_'+idnew+'-attribute-attributeName') 1207 .appendTo(divlabel); 1208 divinput = jQuery('<div />') 1209 .appendTo(totaldel); 1210 select = jQuery('<select />') 1211 .attr({'id':idnew+'-attribute-attributeName','name':idnew+'-attribute-attributeName'}) 1212 .addClass('changeAttributeName') 1213 .append(option) 1214 .appendTo(divinput) 1215 .focus(); 1216 spanDel = jQuery('<span /> ') 1217 .attr({'data-idattr':idnew}) 1218 .addClass('del-button-attribute icon-minus') 1219 // .text('-') 1220 .appendTo(divinput); 1221 svg = jQuery(setIcon('minus')).appendTo(spanDel); 1222 1223 jQuery('#'+idnew+'-attribute-attributeName option').attr('selected',false); 1224 1225 // Attribute-stringValue 1226 divlabel = jQuery('<div class="floatLeft div-form-label" style="clear:both;" />') 1227 .appendTo(totaldel); 1228 labelValue = jQuery('<label><span>stringValue </span></label> ') 1229 .attr('id','label_'+idnew+'-default-stringValue') 1230 .appendTo(divlabel); 1231 divinput = jQuery('<div />') 1232 .attr({'id':idnew+'-pos-add-new'}) 1233 .appendTo(totaldel); 1234 inputValue = jQuery('<input type="text" value="" />') 1235 .addClass('') 1236 .attr({'id':idnew+'-default-stringValue','name':idnew+'-default-stringValue'}) 1237 .appendTo(divinput); 1238 1239 event.stopPropagation(); 1240 event.stopImmediatePropagation(); 1241 1242 //----------- FUNCTIONS --------------- 1243 jQuery('.del-button-attribute').click(function(event) { 1244 var idattr = jQuery(this).data('idattr'); 1245 jQuery('#'+'del-add-attribute-id-'+idattr).remove(); 1246 event.stopPropagation(); 1247 event.stopImmediatePropagation(); 1248 }); 1249 1250 jQuery(".changeAttributeName").on("change", function(event) { 1251 var attributeid = jQuery(this).val(); 1252 var attributeName = jQuery(this).attr("name"); 1253 var idName = attributeName.split("-"); 1254 var idNr = idName[0]; 1255 1256 setNewAttribute(idNr,attributeName); 1257 1258 event.stopPropagation(); 1259 event.stopImmediatePropagation(); 1260 }); 1261 1262 //----------- END FUNCTIONS --------------- 1263 1264}); 1265 1266 1267// ----------------------------------------------------------------------------- 1268// Change the Language 1269// ------------------------------------------------------------------------------ 1270 1271//var originForm = jQuery('#formbib-forms').not('.data-container-language-switch').serialize(); 1272 1273if ($("#selection-language").length) { 1274 var originForm = $($('#formbib-forms')[0].elements).not('#selection-language').serialize(); 1275 var originLang = $('#selection-language').val(); 1276} 1277 1278 1279jQuery('#selection-language').on("change", function() { 1280 1281 var changedForm = $($('#formbib-forms')[0].elements).not('#selection-language').serialize(); 1282 1283 var id = jQuery("#id").val(); 1284 var context = jQuery("#context").val(); 1285 var lang = jQuery("#selection-language").val(); 1286 1287 if(changedForm !== originForm) { 1288 $('.change-message').show(); 1289 $('.change-message button').click(function() { 1290 window.location.href = 'https://' + domain + '/account/dataobjects/edit?id='+id+'&context='+context+'&lang='+lang; 1291 }); 1292 $('.change-message .cancel').click(function() { 1293 $('#selection-language').val(originLang); 1294 $('.change-message').hide(); 1295 }); 1296 } else { 1297 window.location.href = 'https://' + domain + '/account/dataobjects/edit?id='+id+'&context='+context+'&lang='+lang; 1298 } 1299 1300}); 1301 1302// ----------------------------------------------------------------------------- 1303// AddTag 1304// ------------------------------------------------------------------------------ 1305jQuery("#addTags").click(function(){ 1306 var idtable = '#' + 'showTags'; 1307 var option = jQuery('.select-tags').data('option'); 1308 var timestamp = getTimestamp(); 1309 var name = timestamp + '-tags'; 1310 var namelist = 'tagslist'; 1311 1312 var tr; 1313 tr = jQuery('<tr /> '); 1314 td1 = jQuery('<td /> ') 1315 .appendTo(tr); 1316 input = jQuery('<input />') 1317 .attr({'name':name, 'list':namelist}) 1318 .appendTo(td1); 1319 select = jQuery('<datalist />') 1320 .attr({'id':namelist}) 1321 .append(option) 1322 .appendTo(td1); 1323 td6 = jQuery('<td />') 1324 .addClass('del-row-tag') 1325 .appendTo(tr); 1326 span = jQuery('<span />') 1327 .addClass('del-button icon-minus') 1328 // .text(' - ') 1329 .appendTo(td6); 1330 svg = jQuery(setIcon('minus')).appendTo(span); 1331 1332 jQuery(idtable).append(tr); 1333 1334 //Function 1335 jQuery('.del-row-tag').click(function() { 1336 jQuery( this ).closest( "tr" ).remove(); 1337 }); 1338}); 1339 1340// ----------------------------------------------------------------------------- 1341// ChangeCategories 1342// ------------------------------------------------------------------------------ 1343jQuery("#changeCategories").click(function(){ 1344 jQuery('[name*=category-]').addClass('categorieChangeLabel'); 1345 jQuery('[name*=categorychange-]' ).css('display','inline'); 1346}); 1347// ----------------------------------------------------------------------------- 1348// getTimestamp : get Timestamp 1349// ------------------------------------------------------------------------------ 1350function getTimestamp() { 1351 var date = new Date(); 1352 var timestamp = date.getHours() + '-' + date.getMinutes() + '-' + date.getSeconds()+date.getMilliseconds(); 1353 return(timestamp); 1354} 1355 1356// ----------------------------------------------------------------------------- 1357// del-row : delete Row Details (mo-so) 1358// ------------------------------------------------------------------------------ 1359jQuery('.del-row-tag').click(function() { 1360 jQuery( this ).closest( "tr" ).remove(); 1361}) ; 1362 1363// ----------------------------------------------------------------------------- 1364// Delete Datacontainer 1365// ------------------------------------------------------------------------------
1366jQuery(".modal-btn.delete-datacontainer").click(function(){ 1367 datacontainerID = jQuery(this).val(); 1368 1369 jQuery.ajax({ 1370 type:'POST', 1371 url:'https://' + domain + '/account/dataobjects/delete', 1372 data: {datacontainerID:datacontainerID}, 1373 success:function(data){ 1374 if(data == false) { 1375 window.location.href = 'https://' + domain + '/account/login'; 1376 } 1377 jQuery('body').addClass('modal-open'); 1378 //modal datacontainerdelete modal-608 1379 jQuery(".modal.datacontainerdelete.modal-"+datacontainerID).show(); 1380 1381 jQuery('.modal-close').click(function() { 1382 jQuery(this).closest('.modal').hide(); 1383 jQuery('body').removeClass('modal-open'); 1384 }); 1385 jQuery('.cancel').click(function() { 1386 jQuery(this).closest('.modal').hide(); 1387 jQuery('body').removeClass('modal-open'); 1388 }); 1389 }, 1390 error:function(error){ 1391 alert('Fehler beim Löschen eine GDC Objektes'); 1392 alert(error); 1393 console.log(error); 1394 } 1395 }); 1396}); 1397 1398// ----------------------------------------------------------------------------- 1399// Delete Categorie 1400// ------------------------------------------------------------------------------
1401jQuery(".modal-btn.delete-categorie").click(function(){ 1402 categorieId = jQuery(this).val(); 1403 1404 jQuery.ajax({ 1405 type:'POST', 1406 url:'https://' + domain + '/account/dataobjects/categories/delete', 1407 data: {categorieId:categorieId}, 1408 success:function(data){ 1409 if(data == false) { 1410 window.location.href = 'https://' + domain + '/account/login'; 1411 } 1412 jQuery('body').addClass('modal-open'); 1413 jQuery(".modal.datacontainerdelete.modal-"+categorieId).show(); 1414 1415 jQuery('.modal-close').click(function() { 1416 jQuery(this).closest('.modal').hide(); 1417 jQuery('body').removeClass('modal-open'); 1418 }); 1419 jQuery('.cancel').click(function() { 1420 jQuery(this).closest('.modal').hide(); 1421 jQuery('body').removeClass('modal-open'); 1422 }); 1423 }, 1424 error:function(error){ 1425 alert('errorCategorie'); 1426 console.log(error); 1427 } 1428 }); 1429}); 1430 1431// ----------------------------------------------------------------------------- 1432// show Attribute 1433// ------------------------------------------------------------------------------ 1434jQuery('.label_Gruppe').click(function(event) { 1435 jQuery(".label_Attribute").toggle('slow'); 1436 jQuery(".panel").toggle('slow'); 1437// jQuery(this).next().find('[class="panel"]').toggle('slow'); 1438 event.stopPropagation(); 1439 event.stopImmediatePropagation(); 1440}); 1441 1442// ----------------------------------------------------------------------------- 1443// delete Contact 1444// ------------------------------------------------------------------------------ 1445jQuery('.del-contact').click(function(event) { 1446 var id = jQuery(this).data('id'); 1447 var elements = id + '-contact'; 1448 jQuery('[name^='+elements+'-type]').css('display','none'); 1449 jQuery('[id^='+elements+']').remove(); 1450 jQuery(this).remove(); 1451}); 1452jQuery('.del-contact-members').click(function(event) { 1453 var id = jQuery(this).data('id'); 1454 var elements = id + '-contact-idrow-members'; 1455 jQuery('#'+elements).remove(); 1456 jQuery('#'+elements+'-details').remove(); 1457 jQuery(this).remove(); 1458}); 1459jQuery('.del-contact-govChairman').click(function(event) { 1460 var id = jQuery(this).data('id'); 1461 var elements = id + '-contact-idrow-govChairman'; 1462 jQuery('#'+elements).remove(); 1463 jQuery('#'+elements+'-details').remove(); 1464 jQuery(this).remove(); 1465}); 1466jQuery('.del-contact-govViceChairman').click(function(event) { 1467 var id = jQuery(this).data('id'); 1468 var elements = id + '-contact-idrow-govViceChairman'; 1469 jQuery('#'+elements).remove(); 1470 jQuery('#'+elements+'-details').remove(); 1471 jQuery(this).remove(); 1472}); 1473 1474// ----------------------------------------------------------------------------- 1475// add Contact - no active 1476// ------------------------------------------------------------------------------ 1477jQuery('#add-contact').click(function(event) { 1478 jQuery('[id^=0-contact]').css('display','block'); 1479 jQuery('[name^=0-contact]').css('display','block'); 1480}); 1481 1482// ----------------------------------------------------------------------------- 1483// change Contact 1484// ------------------------------------------------------------------------------ 1485jQuery('.select-contact').on("change", function(event) { 1486 var id = jQuery(this).val(); 1487 jQuery('input[id^=0-contact]').val(' '); 1488 jQuery('input[id^=0-contact]').text('test'); 1489 jQuery('input[id^=0-contact]').removeAttr('readonly'); 1490 1491 if (id != 0) { 1492 var contact = jQuery("option:selected", this).data('option'); 1493 var optionArray = contact.split(','); 1494 var changeable = 1; 1495 1496 for(let element of optionArray) { 1497 var optionElemente = element.split('='); 1498 var key = optionElemente[0]; 1499 var value = optionElemente[1]; 1500 jQuery('#0-contact-'+key).val(value); 1501 if (key == "changeable" ) { 1502 if (value == '') { 1503 var changeable = 0; 1504 jQuery('#0-contact-'+key).val('nein'); 1505 } 1506 else { 1507 jQuery('#0-contact-'+key).val('ja'); 1508 } 1509 } 1510 } 1511 1512 for(let element of optionArray) { 1513 var optionElemente = element.split('='); 1514 var key = optionElemente[0]; 1515 if (changeable == 0) { 1516 jQuery('#0-contact-'+key).attr('readonly','true'); 1517 } 1518 } 1519 } 1520}); 1521 1522// ----------------------------------------------------------------------------- 1523// delete Dates 1524// ------------------------------------------------------------------------------ 1525jQuery('.del-dates-dc').click(function(event) { 1526 var id = jQuery(this).data('id'); 1527 jQuery('.'+id+'del-row-dates').remove(); 1528 jQuery('.'+id+'-details-dates').remove(); 1529 jQuery(this).remove(); 1530}); 1531// ----------------------------------------------------------------------------- 1532// copy Dates 1533// ------------------------------------------------------------------------------ 1534jQuery('.copy-dates-dc').click(function(event) { 1535 var id = jQuery(this).data('id'); 1536 var copy = copyDatesDC(id); 1537}); 1538function copyDatesDC(id) { 1539 var checked = jQuery('#'+id+'-dates-defaultDuration').prop('checked') ; 1540 1541 jQuery("#add-dates").trigger("click"); 1542 var idlast = jQuery('.add-row-dates').last().data('last'); 1543 1544 jQuery('#'+idlast+'-dates-startDate').val(jQuery('#'+id+'-dates-startDate').val()); 1545 jQuery('#'+idlast+'-dates-endDate').val(jQuery('#'+id+'-dates-endDate').val()); 1546 jQuery('#'+idlast+'-dates-startTime').val(jQuery('#'+id+'-dates-startTime').val()); 1547 jQuery('#'+idlast+'-dates-endTime').val(jQuery('#'+id+'-dates-endTime').val()); 1548 jQuery('#'+idlast+'-dates-bookingUrl').val(jQuery('#'+id+'-dates-bookingUrl').val()); 1549 jQuery('#'+idlast+'-dates-information').val(jQuery('#'+id+'-dates-information').val()); 1550 1551 if (checked == false) { 1552 jQuery('#'+idlast+'-dates-defaultDuration.openEnd-no').trigger("click"); 1553 } else { 1554 jQuery('#'+idlast+'-dates-defaultDuration.openEnd-yes').trigger("click"); 1555 jQuery('#'+idlast+'-dates-endTime').val(); 1556 } 1557 return(true); 1558} 1559 1560// ----------------------------------------------------------------------------- 1561// checkConfig : Check must-input-fields 1562// ------------------------------------------------------------------------------ 1563jQuery('.checkDatacontainer').click(function() {
1564 //jQuery('input:invalid').css('background-color','#ffdddd'); 1565 const inpObj = jQuery('input:invalid'); 1566 1567 // find Error Field Name and Register Name 1568 var inputfield = jQuery('input:invalid').attr('name'); 1569 var registerName = jQuery('#'+inputfield).parents(".tabcontent").attr('id'); 1570 if(typeof registerName == 'undefined') { 1571 var registerName = jQuery('.'+inputfield).parents(".tabcontent").attr('id'); 1572 } 1573 1574 // Set Register Name active 1575 if(typeof registerName != 'undefined') { 1576 jQuery('.tabcontent').css({"display": "none"}); 1577 jQuery('.tablinks').removeClass('active'); 1578 jQuery('#'+registerName+'.tabcontent').css({"display": "block"}); 1579 jQuery(this).addClass('active'); 1580 if (registerName == "address") { 1581 jQuery('.domap-backend').css({"display": "block"}); 1582 } 1583 else { 1584 jQuery('.domap-backend').css({"display": "none"}); 1585 } 1586 } 1587 1588 // Message 1589 if (inpObj.length > 0) { 1590 alert("Sie haben in einen Register eine ungültige oder fehlende Eingabe betätigt. Bitte überprüfen Sie Ihre Eingaben.\n\nYou have made an invalid or missing entry in a register. Please check your entries."); 1591 } 1592}); 1593 1594// ----------------------------------------------------------------------------- 1595// check-date : Check start and end date 1596// ------------------------------------------------------------------------------ 1597jQuery( '.check-date').focusout(function(event) { 1598 check = checkDate(jQuery(this),event); 1599 return check; 1600}); 1601 1602// ----------------------------------------------------------------------------- 1603// check-time : Check start and end time 1604// ------------------------------------------------------------------------------ 1605jQuery( '.check-time-event').on("change", function(event) { 1606 var name= jQuery(this).find("input[class='start-time']").attr('name'); 1607 var idName = name.split("-"); 1608 var idNr = idName[0]; 1609 1610 var startDate = new Date(jQuery("#"+idNr+"-dates-startDate").val()) ; 1611 var endDate = new Date(jQuery("#"+idNr+"-dates-endDate").val()); 1612 days = (endDate.getTime() - startDate.getTime())/1000/60/60/24; 1613 if (days > 0) {days = days*24*60;} 1614 1615 var startTime = jQuery(this).find("input[class='start-time']").val() ; 1616 var endTime = jQuery(this).find("input[class='end-time']").val(); 1617 startTime = startTime.replace(":",""); 1618 endTime = endTime.replace(":",""); 1619 if (endTime == "") {return true}; 1620/* if (startTime > endTime ) { 1621 alert ('Die Endzeit darf nicht vor der Startzeit liegen'); 1622 jQuery(this).find("input[class='end-time']").focus(); 1623 event.stopPropagation(); 1624 event.stopImmediatePropagation(); 1625 return false 1626 }*/ 1627 var id = jQuery(this).data('id'); 1628 var openEnd = jQuery('.'+id+'-dates-defaultDuration').prop('checked') ; 1629 1630 start = startTime.substr(0, 2)*60+startTime.substr(2, 2)*1; 1631 end = endTime.substr(0, 2)*60+endTime.substr(2, 2)*1; 1632 1633 if(start == end){ 1634 time = 24*60 ; 1635 } else if(start > end){ 1636 time = (24*60)+end-start; 1637 } else { 1638 time = end-start; 1639 } 1640 time = time + days; 1641 1642 if(openEnd == true ) { 1643 time = null; 1644 alert('Termin ist Open End - Dauer wird daher nicht gesetzt.'); 1645 } 1646 1647 jQuery(this).find("input[class='duration']").val(time); 1648 event.stopPropagation(); 1649 event.stopImmediatePropagation(); 1650 return true; 1651}); 1652 1653// ----------------------------------------------------------------------------- 1654// openEnd-yes -> dates-duration is null 1655// ------------------------------------------------------ 1656jQuery( '.openEnd-yes').click(function(event) { 1657 var name= jQuery(this).attr('name'); 1658 var idName = name.split("-"); 1659 var idNr = idName[0]; 1660 time = null; 1661 jQuery('#'+idNr+'-dates-duration').val(time); 1662 jQuery('#'+idNr+'-dates-endDate').val(time); 1663 jQuery('#'+idNr+'-dates-endTime').val(time); 1664 jQuery('#'+idNr+'-dates-endDate').attr('disabled',true); 1665 jQuery('#'+idNr+'-dates-endTime').attr('disabled',true); 1666 jQuery('#'+idNr+'-dates-startTime').removeAttr('required'); 1667}); 1668// ----------------------------------------------------------------------------- 1669// openEnd-no 1670// ------------------------------------------------------ 1671jQuery( '.openEnd-no').click(function(event) { 1672 var name= jQuery(this).attr('name'); 1673 var idName = name.split("-"); 1674 var idNr = idName[0]; 1675 time = null; 1676 jQuery('#'+idNr+'-dates-endDate').removeAttr('disabled'); 1677 jQuery('#'+idNr+'-dates-endTime').removeAttr('disabled'); 1678 1679 var defaultDuration = jQuery('#defaultDuration').val() ; 1680 if (defaultDuration =="" || defaultDuration == null ) {defaultDuration = 5;} 1681 jQuery('#'+idNr+'-dates-duration').val(defaultDuration); 1682 jQuery('#'+idNr+'-dates-startTime').attr('required','required'); 1683}); 1684 1685// ----------------------------------------------------------------------------- 1686// show Details Dates 1687// ------------------------------------------------------
1688jQuery('.show-details-dates').click(function(event) { 1689 var idtr = '.' + jQuery(this).data('id'); 1690 if (jQuery(this).hasClass('sortedDates')) { 1691 alert('Nach einer Sortierung des Datums können keine Details mehr angezeigt werden. Nachdem Speichern sind diese wieder anzeigbar.') 1692 } else { 1693 jQuery(this).toggleClass("click-details"); 1694 jQuery(idtr).toggle('slow'); 1695 } 1696 event.stopPropagation(); 1697 event.stopImmediatePropagation(); 1698}); 1699 1700// ----------------------------------------------------------------------------- 1701// add Dates 1702// ------------------------------------------------------------------------------ 1703jQuery('#add-dates').click(function(event) { 1704 var table = jQuery('.table-dates-dc'); 1705 var ilast = jQuery('.add-row-dates').last().data('last'); 1706 if(typeof ilast == 'undefined') {ilast = 0;} 1707 var inew = ilast + 1000000; 1708 var defaultDuration = jQuery('#defaultDuration').val() ; 1709 if (jQuery('#defaultDuration-openEnd:checked').val() == 1) { 1710 disabled = true; 1711 } else { 1712 if (defaultDuration =="" || defaultDuration == null ) {defaultDuration = 5;} // add new object 1713 disabled = false; 1714 } 1715 1716 tr = jQuery('<tr class="'+inew+'del-row-dates add-row-dates" data-id="0" data-last="'+inew+'"/>') 1717 .data({'id':'0', 'last':inew}) 1718 .appendTo(table); 1719 1720 td = jQuery('<td />') 1721 .appendTo(tr); 1722 id = jQuery('<input />') 1723 .attr({'name':inew+'-dates-id','id':inew+'-dates-id','type':'hidden'}) 1724 .val('0') 1725 .appendTo(td); 1726 div = jQuery('<div />') 1727 .appendTo(td); 1728 span = jQuery('<span data-id="'+inew+'-details-dates"'+' />') 1729 .addClass('details-button show-details-dates') 1730 .text('Details') 1731 .appendTo(div); 1732 1733 1734 td = jQuery('<td />') 1735 .addClass('check-date') 1736 .appendTo(tr); 1737 td1 = jQuery('<input />') 1738 .attr({'name':inew+'-dates-startDate','id':inew+'-dates-startDate','type':'date','required':'required'}) 1739 .addClass('start-date') 1740 .appendTo(td) 1741 .focus(); 1742 span = jQuery('<span />') 1743 .text(' - ') 1744 .appendTo(td); 1745 td2 = jQuery('<input />') 1746 .attr({'name':inew+'-dates-endDate','id':inew+'-dates-endDate','type':'date','disabled':disabled}) 1747 .addClass('end-date') 1748 .appendTo(td); 1749 1750 td = jQuery('<td />') 1751 .addClass('check-time-event') 1752 .appendTo(tr); 1753 td1 = jQuery('<input />') 1754 .attr({'name':inew+'-dates-startTime','id':inew+'-dates-startTime','type':'time','required':'required'}) 1755 .addClass('start-time') 1756 .appendTo(td); 1757 span = jQuery('<span />') 1758 .text(' - ') 1759 .appendTo(td); 1760 td2 = jQuery('<input />') 1761 .attr({'name':inew+'-dates-endTime','id':inew+'-dates-endTime','type':'time','disabled':disabled}) 1762 .addClass('end-time') 1763 .val(0) 1764 .appendTo(td); 1765 td2 = jQuery('<input />') 1766 .attr({'name':inew+'-dates-duration','id':inew+'-dates-duration','type':'hidden','readonly':true}) /* number-text */ 1767 .addClass('duration') 1768 .val(defaultDuration) 1769 .appendTo(td); 1770 1771 td = jQuery('<td />') 1772 .appendTo(tr); 1773 var checked = (jQuery('#defaultDuration-openEnd:checked').val() == 1) ? true:false; 1774 radio1 = jQuery('<input />') 1775 .attr({'name':inew+'-dates-defaultDuration','id':inew+'-dates-defaultDuration','type':'radio','checked':checked}) 1776 .val('1') 1777 .addClass('openEnd-yes') 1778 .appendTo(td); 1779 label1 = jQuery('<label />') 1780 .text('ja') 1781 .appendTo(td); 1782 var checked = (jQuery('#defaultDuration-openEnd:checked').val() != 1) ? true:false; 1783 radio2 = jQuery('<input />') 1784 .attr({'name':inew+'-dates-defaultDuration','id':inew+'-dates-defaultDuration','class':inew+'-dates-defaultDuration','type':'radio','checked':checked}) 1785 .val('0') 1786 .addClass('openEnd-no') 1787 .appendTo(td); 1788 label2 = jQuery('<label />') 1789 .text('nein') 1790 .appendTo(td); 1791 1792 td = jQuery('<td />') 1793 .appendTo(tr); 1794 radio1 = jQuery('<input />') 1795 .attr({'name':inew+'-dates-soldOut','id':inew+'-dates-soldOut','type':'radio'}) 1796 .val('1') 1797 .appendTo(td); 1798 label1 = jQuery('<label />') 1799 .text('ja') 1800 .appendTo(td); 1801 radio2 = jQuery('<input />') 1802 .attr({'name':inew+'-dates-soldOut','id':inew+'-dates-soldOut','type':'radio','checked':'checked'}) 1803 .val('0') 1804 .appendTo(td); 1805 label2 = jQuery('<label />') 1806 .text('nein') 1807 .appendTo(td); 1808 1809 td = jQuery('<td />') 1810 .appendTo(tr); 1811 radio1 = jQuery('<input />') 1812 .attr({'name':inew+'-dates-cancelled','id':inew+'-dates-cancelled','type':'radio'}) 1813 .val('1') 1814 .appendTo(td); 1815 label1 = jQuery('<label />') 1816 .text('ja') 1817 .appendTo(td); 1818 radio2 = jQuery('<input />') 1819 .attr({'name':inew+'-dates-cancelled','id':inew+'-dates-cancelled','type':'radio','checked':'checked'}) 1820 .val('0') 1821 .appendTo(td); 1822 label2 = jQuery('<label />') 1823 .text('nein') 1824 .appendTo(td); 1825 1826 1827 1828 1829 td = jQuery('<td />') 1830 .appendTo(tr); 1831 number1 = jQuery('<input />') 1832 .attr({'name':inew+'-dates-capacity','id':inew+'-dates-capacity','type':'number'}) 1833 .val('0') 1834 .appendTo(td) 1835 text1 = jQuery(td).append(' / 0'); 1836 1837 1838 1839 1840 1841 td = jQuery('<td />') 1842 .appendTo(tr); 1843 span = jQuery('<span />') 1844 .addClass('icon-copy-no copy-dates-dc ') 1845 .data('id',inew) 1846 .appendTo(td); 1847// svg = jQuery(setIcon('copy')).appendTo(span); 1848 1849 td = jQuery('<td />') 1850 .appendTo(tr); 1851 span = jQuery('<span />') 1852 .addClass('icon-minus del-button-dc-no del-dates-dc') 1853 .data('id',inew) 1854 // .text(' - ') 1855 .appendTo(td); 1856 svg = jQuery(setIcon('minus')).appendTo(span); 1857 1858 tr = jQuery('<tr />')
1859 .addClass('tr-show-details-dates '+ inew+'-details-dates') 1860 .data({'id':0, 'last':inew}) 1861 .appendTo(table); 1862 td0 = jQuery('<td />') 1863 .appendTo(tr); 1864 td = jQuery('<td />') 1865 .text('Buchungslink') 1866 .appendTo(tr); 1867 br = jQuery('<br />') 1868 .appendTo(td); 1869 td1 = jQuery('<input />') 1870 .attr({'name':inew+'-dates-bookingUrl','id':inew+'-dates-bookingUrl','type':'url'}) 1871 .appendTo(td); 1872 td2 = jQuery('<td />') 1873 .text('Informationen') 1874 .appendTo(tr); 1875 br = jQuery('<br />') 1876 .appendTo(td2); 1877 td1 = jQuery('<input />') 1878 .attr({'name':inew+'-dates-information','id':inew+'-dates-information','type':'text'}) 1879 .appendTo(td2); 1880 td3 = jQuery('<td colspan=4/>') 1881 .appendTo(tr); 1882 1883 //Rental remove attr requerid defaultDuration-openEnd == false -> openEnd = true 1884 if (jQuery('#defaultDuration-openEnd:checked').val() == 1 || typeof jQuery('#defaultDuration-openEnd:checked').val() == 'undefined') { 1885 jQuery('#'+inew+'-dates-startTime').removeAttr('required'); 1886 } 1887 1888 //Functions 1889 jQuery( '.check-time-event').on("change", function(event) { 1890 var name= jQuery(this).find("input[class='start-time']").attr('name'); 1891 var idName = name.split("-"); 1892 var idNr = idName[0]; 1893 1894 var startDate = new Date(jQuery("#"+idNr+"-dates-startDate").val()) ; 1895 var endDate = new Date(jQuery("#"+idNr+"-dates-endDate").val()); 1896 days = (endDate.getTime() - startDate.getTime())/1000/60/60/24; 1897 if (days > 0) {days = days*24*60;} 1898 1899 var startTime = jQuery(this).find("input[class='start-time']").val() ; 1900 var endTime = jQuery(this).find("input[class='end-time']").val(); 1901 startTime = startTime.replace(":",""); 1902 endTime = endTime.replace(":",""); 1903 if (endTime == "") {return true}; 1904 1905 start = startTime.substr(0, 2)*60+startTime.substr(2, 2)*1; ; 1906 end = endTime.substr(0, 2)*60+endTime.substr(2, 2)*1; 1907 1908 if(start == end){ 1909 time = 24*60 ; 1910 } else if(start > end){ 1911 time = (24*60)+end-start; 1912 } else { 1913 time = end-start; 1914 } 1915 time = time + days; 1916 1917 var openEnd = jQuery('.'+idNr+'-dates-defaultDuration').prop('checked') ; //the second radio no= true 1918 if(openEnd == false ) { 1919 time = null; 1920 alert('Termin ist Open End - Dauer wird daher nicht gesetzt.'); 1921 } 1922 1923 jQuery(this).find("input[class='duration']").val(time); 1924 event.stopPropagation(); 1925 event.stopImmediatePropagation(); 1926 return true; 1927 }); 1928 jQuery( '.openEnd-yes').click(function(event) { 1929 var name= jQuery(this).attr('name'); 1930 var idName = name.split("-"); 1931 var idNr = idName[0]; 1932 time = null; 1933 jQuery('#'+idNr+'-dates-duration').val(time); 1934 jQuery('#'+idNr+'-dates-endDate').val(time); 1935 jQuery('#'+idNr+'-dates-endTime').val(time) 1936 jQuery('#'+idNr+'-dates-endDate').attr('disabled',true); 1937 jQuery('#'+idNr+'-dates-endTime').attr('disabled',true); 1938 jQuery('#'+idNr+'-dates-startTime').removeAttr('required'); 1939 }); 1940 jQuery( '.openEnd-no').click(function(event) { 1941 var name= jQuery(this).attr('name'); 1942 var idName = name.split("-"); 1943 var idNr = idName[0]; 1944 time = null; 1945 jQuery('#'+idNr+'-dates-endDate').removeAttr('disabled'); 1946 jQuery('#'+idNr+'-dates-endTime').removeAttr('disabled'); 1947 1948 var defaultDuration = jQuery('#defaultDuration').val() ; 1949 if (defaultDuration =="" || defaultDuration == null ) {defaultDuration = 5;} 1950 jQuery('#'+idNr+'-dates-duration').val(defaultDuration); 1951 jQuery('#'+idNr+'-dates-startTime').attr('required','required'); 1952 }); 1953 jQuery( '.check-date').focusout(function(event) { 1954 check = checkDate(jQuery(this),event); 1955 return check; 1956 }); 1957 jQuery('.show-details-dates').click(function(event) { 1958 var idtr = '.' + jQuery(this).data('id');
1959 jQuery(this).toggleClass("click-details"); 1960 jQuery(idtr).toggle('slow'); 1961 event.stopPropagation(); 1962 event.stopImmediatePropagation(); 1963 }); 1964 jQuery('.del-dates-dc').click(function(event) { 1965 var id = jQuery(this).data('id'); 1966 jQuery('.'+id+'del-row-dates').remove(); 1967 jQuery('.'+id+'-details-dates').remove(); 1968 jQuery(this).remove(); 1969 event.stopPropagation(); 1970 event.stopImmediatePropagation(); 1971 }); 1972 // jQuery('.copy-dates-dc').click(function(event) { 1973 // var id = jQuery(this).data('id'); 1974 // var copy = copyDatesDC(id); 1975 // }); 1976 //End Functions 1977}); 1978 1979 1980//------------------------------------------------------- 1981// Change div 1982//------------------------------------------------------ 1983$('.up').on('click', function(e) { 1984 var wrapper = $(this).closest('li') 1985 wrapper.insertBefore(wrapper.prev()) 1986}) 1987$('.down').on('click', function(e) { 1988 var wrapper = $(this).closest('li') 1989 wrapper.insertAfter(wrapper.next()) 1990}) 1991//------------------------------------------------------- 1992// Change defaultDuration in Base Register 1993//------------------------------------------------------ 1994jQuery('.defaultDuration-openEnd').on('click', function(e) { 1995 var openEnd = jQuery(this).val(); 1996 if (openEnd == true) { 1997 jQuery('.defaultDuration-stdmin').val('') ; 1998 jQuery('.defaultDuration').val('') ; 1999 jQuery('.defaultDuration-stdmin').attr('readonly',true); 2000 } else { 2001 jQuery('.defaultDuration-stdmin').removeAttr('readonly'); 2002 } 2003}); 2004//------------------------------------------------------- 2005// Change defaultDuration in Base Register 2006//------------------------------------------------------ 2007jQuery('.defaultDuration-stdmin').on('change', function(e) { 2008 std = jQuery('#defaultDuration-h').val() * 60; 2009 min = jQuery('#defaultDuration-m').val() ; 2010 duration = parseFloat(std) + parseFloat(min); 2011 jQuery('.defaultDuration').val(duration); 2012}); 2013 2014//------------------------------------------------------- 2015// show Details Event 2016// ------------------------------------------------------ 2017jQuery('.show-details-event').click(function(event) { 2018 var idtr = '.' + jQuery(this).data('id'); 2019 jQuery(idtr).toggle('slow'); 2020 event.stopPropagation(); 2021 event.stopImmediatePropagation(); 2022}); 2023// ----------------------------------------------------------------------------- 2024// delete Event / POI 2025// ------------------------------------------------------------------------------ 2026jQuery('.del-event-dc').click(function(event) { 2027 var id = jQuery(this).data('id'); 2028 jQuery('.'+id+'del-row-events').remove(); 2029 jQuery('.'+id+'-details-event').remove(); 2030 jQuery(this).remove(); 2031}); 2032jQuery('.del-poi-dc').click(function(event) { 2033 var id = jQuery(this).data('id'); 2034 jQuery('#'+id+'-poi-del-row').remove(); 2035 jQuery('.'+id+'-poi-del-row').remove(); 2036 jQuery(this).remove(); 2037}); 2038// ----------------------------------------------------------------------------- 2039// delete Article Parent 2040// ------------------------------------------------------------------------------ 2041jQuery('.del-article-parent').click(function(event) { 2042 var id = jQuery(this).data('id'); 2043 var element = 'parent-'; 2044 var confirmText = 'Hauptartikel'; 2045 2046 if (jQuery('#'+element+'name').val() == '') { 2047 alert('Es wurde noch kein '+confirmText+' definiert'); 2048 } else { 2049 var ok = confirm('Wollen Sie diesen '+confirmText+' wirklich entfernen?'); 2050 if (ok == true) { 2051 jQuery('#'+element+'id').val('') ; 2052 jQuery('#'+element+'name').val('') ; 2053 jQuery('[id*='+element+'shortDescription]').remove(); 2054 jQuery('[id*='+element+'price]').remove(); 2055 jQuery('[id*='+element+'mainPrice]').remove(); 2056 jQuery('[data-register="contacts"]').removeClass('display-no'); 2057 jQuery('[data-register="categoriesmenu"]').removeClass('display-no'); 2058 } 2059 } 2060}); 2061// ----------------------------------------------------------------------------- 2062// delete Organisation 2063// ------------------------------------------------------------------------------ 2064jQuery('.del-organisation-dc').click(function(event) { 2065 var id = jQuery(this).data('id'); 2066 var elements = id + '-organisation';
2067 jQuery('[id^='+elements+']').remove(); 2068 jQuery('[class^='+elements+']').remove(); 2069 jQuery(this).remove(); 2070}); 2071// ----------------------------------------------------------------------------- 2072// delete Service 2073// ------------------------------------------------------------------------------ 2074jQuery('.del-service-dc').click(function(event) { 2075 var id = jQuery(this).data('id'); 2076 var elements = id + '-service'; 2077 jQuery('[id^='+elements+']').remove(); 2078 jQuery('[class^='+elements+']').remove(); 2079 jQuery(this).remove(); 2080}); 2081// ----------------------------------------------------------------------------- 2082// add Event 2083// ------------------------------------------------------------------------------ 2084jQuery('#add-events').unbind().click(function(event) { 2085 openSearchPopup('Relevanted-Events'); 2086 //search function run automatically 2087 nameInput = ''; 2088 searchEvents(nameInput); 2089 2090 //Button Add new Contact display none 2091 jQuery('.modal-footer .new-contact').css('display','none'); 2092}); 2093 2094function searchEvents(nameInput) { 2095 var categorieInput = jQuery("#categories-filter-off option:selected").attr('id'); 2096 var tagsInput = ''; 2097 2098 jQuery.ajax({ 2099 type:'POST', 2100 url:'https://' + domain + '/account/dataobjects/relevantedevents', 2101 data: {tags:tagsInput,categorie:categorieInput,context:'Event',name:nameInput}, 2102 success:function(data){ 2103 if(data == false) { 2104 window.location.href = 'https://' + domain + '/account/login'; 2105 } 2106 loadingSearchPopup('stoploading'); 2107 2108 jQuery(".result-search").text('') ; 2109 // jQuery(".sendPoiEvent").show(); 2110 jQuery(".result-search").show(); 2111 var iddiv = '.result-search'; 2112 jQuery(iddiv).append(data); 2113 2114 onOffSearch(); 2115 2116 jQuery('.sendPoiEvent').unbind().click(function(event) { 2117 setResultTable(); 2118 closeAndClearSearch(jQuery(this).closest('.modal')); 2119 }); 2120 2121 jQuery('.selection-by-click').unbind().click(function(event) { 2122 var idClicked = jQuery(this).data('id'); 2123 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", true); 2124 setResultTable(); 2125 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", false); 2126 if (jQuery('.close-dialog').data('status') == true) { 2127 closeAndClearSearch(jQuery(this).closest('.modal')); 2128 } 2129 }); 2130 2131 function setResultTable() { 2132 //send all checked Event 2133 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2134 var id = jQuery(this).data('id'); 2135 var idThisEvent = jQuery('#id').val(); 2136 var vglid = jQuery('#'+id+'-relatedEvents-id').val(); 2137 var name = jQuery(this).data('name'); 2138 var idtable = '#' + 'table-event-dc'; 2139 var tr; 2140 if (vglid != id && vglid != idThisEvent) { 2141 tr = jQuery('<tr /> ') 2142 .attr('data-id',id) 2143 .addClass(id+'del-row-events') ; 2144 td2 = jQuery('<td /> ') 2145 .appendTo(tr); 2146 input = jQuery('<input value="'+id+'" /> ') 2147 .attr({'type':'number-text','id':id+'-relatedEvents-id','name':id+'-relatedEvents-id','readonly':'readonly'}) 2148 .val(id) 2149 .text(id) 2150 .appendTo(td2); 2151 td3 = jQuery('<td /> ') 2152 .text(name) 2153 .appendTo(tr); 2154 td4 = jQuery('<td /> ') 2155 .appendTo(tr); 2156 td1 = jQuery('<td /> ') 2157 .addClass('del-icon-right') 2158 .appendTo(tr); 2159 span = jQuery('<span /> ') 2160 .addClass('icon-minus del-button-dc-no del-event-dc') 2161 .attr('data-id',id) 2162 // .text(' - ') 2163 .appendTo(td1); 2164 svg = jQuery(setIcon('minus')).appendTo(span); 2165 jQuery(idtable).append(tr); 2166 } 2167 else { 2168 if (vglid == idThisEvent) { 2169 alert('Dieses Event ist gleich des aktiven Events.'); 2170 } else { 2171 alert('Dieses Event: ' + id +' '+name+' wurde bereits ausgewählt.'); 2172 } 2173 } 2174 }); 2175 //Functions 2176 jQuery('.del-event-dc').click(function(event) { 2177 var id = jQuery(this).data('id'); 2178 jQuery('.'+id+'del-row-events').remove(); 2179 jQuery(this).remove(); 2180 }); 2181 } 2182 }, 2183 error:function(error){ 2184 console.log(error); 2185 alert('Fehler beim Hinzufügen von Events'); 2186 } 2187 }); 2188} 2189// ----------------------------------------------------------------------------- 2190// add / change POI to Event 2191// ------------------------------------------------------------------------------ 2192jQuery('#set-poi-to-event-locationPoi,#set-poi-to-event-organizerPoi,#set-poi-to-event-pub2poi,#set-article-to-art-parent').unbind().click(function(event) { 2193 id = jQuery(this).attr('id'); 2194 idSplit = id.split("-"); //not var declaration !! 2195 idName = ''; 2196 idName = '#'+idSplit[4]+'-id'; 2197 lastid = jQuery(idName).val(); 2198 lastfields = idSplit[4]; 2199 clickName = idSplit[1]; 2200 jQuery('.a-close-dialog').addClass('display-no'); 2201 2202 if (clickName == 'article') { 2203 searchcontext = 'Article'; 2204 openSearchPopup('Auswahl - Artikel'); 2205 } else { 2206 searchcontext = 'POI'; 2207 openSearchPopup('Auswahl - POI'); 2208 } 2209 2210 //Button Add new Contact display none
2211 jQuery('.modal-footer .new-contact').css('display','none'); 2212 2213 //search function run automatically 2214 nameInput = ''; 2215 searchSingle(searchcontext,nameInput,idName,lastid,lastfields); 2216/* 2217 jQuery('.report-filter-search.events').off().click(function(event) { 2218 var nameInput = jQuery("#name-filter-off").val(); 2219 searchSingle(searchcontext,nameInput,idName,lastid,lastfields); 2220 }); */ 2221}); 2222 2223function searchSingle(searchcontext,nameInput,idName,lastid,lastfields) { 2224 var categorieInput = jQuery("#categories-filter-off-poi option:selected").attr('id'); 2225 var tagsInput = ''; 2226 2227 jQuery.ajax({ 2228 type:'POST', 2229 url:'https://' + domain + '/account/dataobjects/relevantedevents', 2230 data: {tags:tagsInput,categorie:categorieInput,context:searchcontext ,name:nameInput}, 2231 success:function(data){ 2232 if(data == false) { 2233 window.location.href = 'https://' + domain + '/account/login'; 2234 } 2235 loadingSearchPopup('stoploading'); 2236 2237 jQuery(".result-search").text('') ; 2238 // jQuery(".sendPoiEvent").show(); 2239 jQuery(".result-search").show(); 2240 var iddiv = '.result-search'; 2241 jQuery(iddiv).append(data); 2242 2243 onOffSearch(); 2244 2245 jQuery('.sendPoiEvent').unbind().click(function(event) { 2246 jQuery(this).closest('.modal').hide(); 2247 setResultSingle(); 2248 closeAndClearSearch(jQuery(this).closest('.modal')); 2249 jQuery('.sendPoiEvent').removeAttr("onclick"); 2250 }); 2251 2252 jQuery('.selection-by-click').unbind().click(function(event) { 2253 var idClicked = jQuery(this).data('id'); 2254 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", true); 2255 setResultSingle(); 2256 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", false); 2257 closeAndClearSearch(jQuery(this).closest('.modal')); 2258 jQuery('.sendPoiEvent').removeAttr("onclick"); 2259 jQuery('.a-close-dialog').removeClass('display-no'); 2260 }); 2261 2262 function setResultSingle() { 2263 //send Poi Nr on Event 2264 count = jQuery('.checkbox-search-poievent input:checked').length; 2265 if (count == 1) { 2266 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2267 idchecked = jQuery(this).data('id'); 2268 name = jQuery(this).data('name'); 2269 jQuery(idName).val(idchecked); 2270 jQuery('#'+lastfields+'-name').val(name); 2271 if (lastid != idchecked) { 2272 jQuery('#'+lastfields+'-country').val('') ; 2273 jQuery('#'+lastfields+'-postCode').val('') ; 2274 jQuery('#'+lastfields+'-city').val('') ; 2275 jQuery('#'+lastfields+'-houseNumber').val('') ; 2276 jQuery('#'+lastfields+'-street').val('') ; 2277 jQuery('#'+lastfields+'-gps').val('') ; 2278 jQuery('#'+lastfields+'-shortDescription').remove(); 2279 jQuery('#'+lastfields+'-price').remove(); 2280 } 2281 if (jQuery('#context').val() == 'Article' || jQuery('#context').val() == 'article' ) { 2282 jQuery('[data-register="contacts"]').addClass('display-no'); 2283 jQuery('[data-register="categoriesmenu"]').addClass('display-no'); 2284 } 2285 }); 2286 } else { 2287 alert ('Nur eine Auswahl ist möglich.'); 2288 } 2289 //Functions not need 2290 jQuery('.del-event-dc').click(function(event) { 2291 var id = jQuery(this).data('id'); 2292 jQuery('.'+id+'del-row-events').remove(); 2293 jQuery(this).remove(); 2294 }); 2295 } 2296 2297 }, 2298 error:function(error){ 2299 console.log(error); 2300 alert('Fehler beim Hinzufügen oder Ãndern eines POI zu einen Event '); 2301 } 2302 }); 2303 2304 event.stopPropagation(); 2305 event.stopImmediatePropagation(); 2306} 2307 2308// ----------------------------------------------------------------------------- 2309// add / change Contact to Event or POI 2310// ------------------------------------------------------------------------------ 2311jQuery('#add-contact-to, #add-contact-to-members, #add-contact-to-govChairman, #add-contact-to-govViceChairman').unbind().click(function(event) { 2312 2313 id = jQuery(this).attr('id'); 2314 idSplit = id.split("-"); 2315 clickName = idSplit[3]; 2316 2317 var title = 'Auswahl - Kontakte'; 2318 var nameInput = ''; 2319 openSearchPopup(title); 2320 2321 //add Button to add a new contact
2322 jQuery(".modal-footer .new-contact").removeAttr("style"); 2323 2324 //search function run automatically 2325 searchContacts(nameInput,clickName); 2326 2327 //search glasses 2328 jQuery('.report-filter-search.events').off().click(function(event) { 2329 divnotice = ''; 2330 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2331 var id = jQuery(this).data('id'); 2332 var firstName = jQuery('.'+id+'-search-contact-firstname').text(); 2333 var lastName = jQuery('.'+id+'-search-contact-lastname').text(); 2334 var email = jQuery('.'+id+'-search-contact-email').text(); 2335 var website = jQuery('.'+id+'-search-contact-website').text(); 2336 var resultsearch = '#result-search'; 2337 divnotice = divnotice + '<div class="notice" id='+id+' data-firstName="'+firstName+'" data-lastName="'+lastName+'" ></div>'; 2338 }); 2339 2340 // var nameInput = jQuery("#name-filter-off").val(); 2341 // searchContacts(nameInput,clickName); 2342 }); 2343}); 2344function searchContacts(nameInput,clickName) { 2345 context = 'Contact'; 2346 jQuery.ajax({ 2347 type:'POST', 2348 url:'https://' + domain + '/account/dataobjects/searchcontacts', 2349 data: {context:context,name:nameInput}, 2350 success:function(data){ 2351 if(data == false) { 2352 window.location.href = 'https://' + domain + '/account/login'; 2353 } 2354 loadingSearchPopup('stoploading'); 2355 2356 jQuery(".result-search").text('') ; 2357 // jQuery(".sendPoiEvent").show(); only per click 2358 jQuery(".result-search").show(); 2359 var iddiv = '.result-search'; 2360 jQuery(iddiv).append(data); 2361 2362 onOffSearch(); 2363 2364 jQuery('.sendPoiEvent').unbind().click(function(event) { 2365 setResultTable(clickName); 2366 closeAndClearSearch(jQuery(this).closest('.modal')); 2367 delContact(); 2368 }); 2369 2370 jQuery('.selection-by-click').unbind().click(function(event) { 2371 var idClicked = jQuery(this).data('id'); 2372 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", true); 2373 setResultTable(clickName); 2374 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", false); 2375 delContact(); 2376 if (jQuery('.close-dialog').data('status') == true) { 2377 closeAndClearSearch(jQuery(this).closest('.modal')); 2378 } 2379 }); 2380 2381 function setResultTable(clickName) { 2382 var addinfo = govClass = ''; 2383 var gremiumInfo = false; 2384 var idlasttr = jQuery('.table-contact-dc tr').length; 2385 2386 if (clickName == 'members' || clickName == 'govChairman' || clickName == 'govViceChairman' ) { 2387 var addinfo = '-'+ clickName; 2388 // var govClass = 'display-no'; 2389 var gremiumInfo = true; 2390 var idlasttr = jQuery('.table-contact-dc'+addinfo+' tr').length; 2391 } 2392 var idtable = '.' + 'table-contact-dc'+addinfo; 2393 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2394 var id = jQuery(this).data('id') ; 2395 // var vglid = jQuery('#'+id+'-contact-id'+addinfo).val(); 2396 var vglid ='noaktive'; 2397 var firstName = jQuery('.'+id+'-search-contact-firstname').text(); 2398 var lastName = jQuery('.'+id+'-search-contact-lastname').text(); 2399 var email = jQuery('.'+id+'-search-contact-email').text(); 2400 var website = jQuery('.'+id+'-search-contact-website').text(); 2401 2402 //set New Id 2403 var idNew = idlasttr.toString() + jQuery(this).data('id') ; 2404 if (vglid != id) { //noaktive 2405 tr = jQuery('<tr id="'+idNew+'-contact-idrow'+addinfo+'" class="ui-sortable-handle"/> '); 2406 td1 = jQuery('<td /> '); 2407 input = jQuery('<input type="number-text" readonly/> ') 2408 .attr({'id':idNew+'-contact-id'+addinfo,'name':idNew+'-contact-id'+addinfo}) 2409 .val(id) 2410 .appendTo(td1); 2411 jQuery(tr).append(td1); 2412 td2 = jQuery('<td /> ').text(firstName+', '+lastName).appendTo(tr); 2413 td3 = jQuery('<td /> ').text(email).appendTo(tr); 2414 td4 = jQuery('<td /> ').text('').appendTo(tr); 2415 td4 = jQuery('<td /> ').text(website).appendTo(tr); 2416 // var type = jQuery('#add-contact-to').data('type'); 2417 var type = jQuery('.add-contact-to').data('type'); 2418 2419 option = jQuery('.'+ type + '-contact-type').data('option'); 2420 option = option.replace('selected', ''); 2421 2422 td5 = jQuery('<td /> ').addClass(govClass).appendTo(tr); 2423 if (gremiumInfo == true) { 2424 td5.append( '<span data-id='+idNew+' data-contact="'+clickName+'" class="details-button show-detail
2424s-contact" > Details </span>' ) ; 2425 trdetails = jQuery('<tr id="'+idNew+'-contact-idrow'+addinfo+'-details"/> ') 2426 .addClass('tr-show-details-contact'); 2427 tdd1 = jQuery('<td /> ').text('Info').appendTo(trdetails); 2428 tdd2 = jQuery('<td colspan=6 /> ').appendTo(trdetails); 2429 input = jQuery('<input type="text" /> ') 2430 .attr({'id':idNew+'-contact-connectionInfo'+addinfo,'name':idNew+'-contact-connectionInfo'+addinfo}) 2431 .appendTo(tdd2); 2432 } else { 2433 select = jQuery('<select /> ') 2434 .attr({'name':idNew+'-contact-type'}) 2435 .append(option) 2436 .appendTo(td5); 2437 } 2438 td6 = jQuery('<td /> ').addClass('del-icon-right').appendTo(tr); 2439 span = jQuery('<span /> ') 2440 .addClass('icon-minus del-contact'+addinfo) 2441 .attr({'data-id':idNew,'data-contact':clickName}) 2442 .appendTo(td6); 2443 svg = jQuery(setIcon('minus')).appendTo(span); 2444 jQuery(idtable).append(tr); 2445 if (gremiumInfo == true) { jQuery(idtable).append(trdetails); } 2446 } 2447 else { 2448 alert('Dieser Kontakt: ' + id + ' wurde bereits ausgewählt.') 2449 } 2450 }); 2451 } 2452 2453 function delContact() { 2454 jQuery('.del-contact').unbind().click(function(event) { 2455 var id = jQuery(this).data('id'); 2456 var elements = id + '-contact'; 2457 jQuery('[id^='+elements+']').remove(); 2458 jQuery('[class^='+elements+']').remove(); 2459 jQuery(this).remove(); 2460 }); 2461 jQuery('.del-contact-members').click(function(event) { 2462 var id = jQuery(this).data('id'); 2463 var elements = id + '-contact-idrow-members'; 2464 jQuery('#'+elements).remove(); 2465 jQuery('#'+elements+'-details').remove(); 2466 jQuery(this).remove(); 2467 }); 2468 jQuery('.del-contact-govChairman').click(function(event) { 2469 var id = jQuery(this).data('id'); 2470 var elements = id + '-contact-idrow-govChairman'; 2471 jQuery('#'+elements).remove(); 2472 jQuery('#'+elements+'-details').remove(); 2473 jQuery(this).remove(); 2474 }); 2475 jQuery('.del-contact-govViceChairman').click(function(event) { 2476 var id = jQuery(this).data('id'); 2477 var elements = id + '-contact-idrow-govViceChairman'; 2478 jQuery('#'+elements).remove(); 2479 jQuery('#'+elements+'-details').remove(); 2480 jQuery(this).remove(); 2481 }); 2482 jQuery('.show-details-contact').click(function(event) { 2483 var idtable = '#'+jQuery(this).data('id')+'-contact-idrow-'+jQuery(this).data('contact')+'-details'; 2484 jQuery(idtable).toggle('slow'); 2485 event.stopPropagation(); 2486 event.stopImmediatePropagation(); 2487 }); 2488 } 2489 }, 2490 error:function(error){ 2491 console.log(error); 2492 alert('Fehler beim Hinzufügen oder Ãndern eines Kontaktes zu einen Event oder POI'); 2493 } 2494 }); 2495} 2496// ----------------------------------------------------------------------------- 2497// show-details-contact: Show and Close Context - Details 2498// ------------------------------------------------------------------------------ 2499jQuery('.show-details-contact').click(function(event) { 2500 var idtable = '#'+jQuery(this).data('id')+'-contact-idrow-'+jQuery(this).data('contact')+'-details'; 2501 jQuery(idtable).toggle('slow'); 2502 event.stopPropagation(); 2503 event.stopImmediatePropagation(); 2504}); 2505 2506// --------------------------------------------------------------------------------------------- 2507// add / change Organisation 2508// open search window -> search function run automatically 2509// off==unbind 2510// 1. report-filter-search.events (search lupe) => searchOrganisations 2511// 2. Input Field name-filter-off key enter => openSearchPopup -> isEnterClick -> searchOrganisations 2512// Function searchOrganisations => call the Action searchorganisations 2513// --------------------------------------------------------------------------------------------- 2514jQuery('#add-organisation-to, #add-parent-to, #add-children-to, #add-service-to, #add-poi-to ').off().click(function(event) { 2515 id = jQuery(this).attr('id'); 2516 idSplit = id.split("-"); 2517 tableName = '#table-'+idSplit[1]+'-dc'; 2518 addName = '#add-'+idSplit[1]+'-to'; 2519 clickName = idSplit[1]; 2520 2521 if (clickName == 'poi') { 2522 searchcontext = 'POI'; 2523 openSearchPopup('Auswahl - POI'); 2524 } else if (clickName == 'service') { 2525 searchcontext = 'Service'; 2526 openSearchPopup('Auswahl - Service'); 2527 } else { 2528 searchcontext = 'Organisation'; 2529 openSearchPopup('Auswahl - Organisationen'); 2530 } 2531 2532 //Button Add new Contact display none
2533 jQuery('.modal-footer .new-contact').css('display','none'); 2534 2535 //search function run automatically 2536 nameInput = ''; 2537 searchOrganisations(searchcontext,nameInput); 2538 2539 /* jQuery('.report-filter-search.events').off().click(function(event) { 2540 var nameInput = jQuery("#name-filter-off").val(); 2541 searchOrganisations(searchcontext,nameInput); 2542 }); */ 2543}); 2544function searchOrganisations(searchcontext,nameInput) { 2545 jQuery.ajax({ 2546 type:'POST', 2547 url:'https://' + domain + '/account/dataobjects/searchorganisations', 2548 data: {context:searchcontext,name:nameInput}, 2549 success:function(data){ 2550 if(data == false) { 2551 window.location.href = 'https://' + domain + '/account/login'; 2552 } 2553 loadingSearchPopup('stoploading'); 2554 2555 jQuery(".result-search").text('') ; 2556 // jQuery(".sendPoiEvent").show(); only per click 2557 jQuery(".result-search").show(); 2558 var iddiv = '.result-search'; 2559 jQuery(iddiv).append(data); 2560 2561 onOffSearch(); 2562 2563 jQuery('.sendPoiEvent').unbind().click(function(event) { 2564 setResultTable(clickName); 2565 closeAndClearSearch(jQuery(this).closest('.modal')); 2566 }); 2567 2568 jQuery('.selection-by-click').unbind().click(function(event) { 2569 var idClicked = jQuery(this).data('id'); 2570 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", true); 2571 setResultTable(clickName); 2572 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", false); 2573 if (clickName == 'parent') { 2574 closeAndClearSearch(jQuery(this).closest('.modal')); 2575 } 2576 if (jQuery('.close-dialog').data('status') == true) { 2577 closeAndClearSearch(jQuery(this).closest('.modal')); 2578 } 2579 }); 2580 2581 function setResultTable(clickName) { 2582 2583 // jQuery('.sendPoiEvent').unbind().click(function(event) { 2584 fehler = ''; 2585 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2586 var id = jQuery(this).data('id'); 2587 var objectid = jQuery('[name="id"]').val(); 2588 if (objectid == id) { 2589 fehler = 'Die Auswahl darf nicht gleich dem bearbeitenden Objektes sein! '; 2590 alert(fehler); 2591 } 2592 if (clickName == 'children') { 2593 if ( jQuery('[name*='+id+'-parent-id]').val() == id) { 2594 fehler = 'Untere Ebene darf nicht gleich der Oberne Ebene sein '; 2595 alert(fehler); 2596 } 2597 } 2598 }); 2599 2600 if (clickName == 'parent') { jQuery('.del-row-parent').remove();} 2601 2602 var idlasttr = jQuery('.table-event-dc tr').length; 2603 2604 count = jQuery('.checkbox-search-poievent input:checked').length; 2605 if ((count > 1 && clickName == 'parent') || fehler != '') { 2606 if (fehler == '') { alert ('Nur eine Auswahl ist möglich.'); } 2607 } else { 2608 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 2609 var id = jQuery(this).data('id'); 2610 // var vglid = jQuery('#'+id+'-'+clickName+'-id').val(); 2611 var vglid = 'noactive'; 2612 var name = jQuery(this).data('name'); 2613 var idtable = tableName; 2614 var tr; 2615 //set New Id 2616 var idNew = idlasttr.toString() + jQuery(this).data('id') ; 2617 2618 if (vglid != id) { //no active 2619 tr = jQuery('<tr /> ') 2620 .attr('data-id',idNew) 2621 .addClass(idNew+'-'+clickName+'-del-row del-row-'+clickName) ; 2622 2623 td2 = jQuery('<td /> ') 2624 .appendTo(tr); 2625 input = jQuery('<input value="'+id+'" /> ') 2626 .attr({'type':'number-text','id':idNew+'-'+clickName+'-id','name':idNew+'-'+clickName+'-id','readonly': true}) 2627 .val(id) 2628 .text(id) 2629 .appendTo(td2); 2630 td3 = jQuery('<td /> ') 2631 .text(name) 2632 .appendTo(tr); 2633 if (clickName != 'parent' && clickName != 'children' ) { 2634 var type = jQuery(addName).data('type'); 2635 var onlyOneType = jQuery('.'+'del-row-'+ clickName ).data('onlyonetype'); 2636 if (clickName == 'organisation' || onlyOneType == 1 ) {var showOption = 'display-no';} else { showOption = '';} 2637 option = jQuery('.'+ type + '-contact-type').data('option'); 2638 td31 = jQuery('<td /> ') 2639 .addClass(showOption) 2640 .appendTo(tr); 2641 select = jQuery('<select /> ') 2642 .attr({'name':idNew+'-'+clickName+'-type'}) 2643 .append(option) 2644 .appendTo(td31); 2645 td4 = jQuery('<td /> ') 2646 .appendTo(tr); 2647 } 2648 else { 2649 td31 = jQuery('<td /> ').addClass('display-no').appendTo(tr); 2650 td4 = jQuery('<td /> ').appendTo(tr); 2651 } 2652 td1 = jQuery('<td /> ') 2653 .addClass('del-icon-right') 2654 .appendTo(tr); 2655 span = jQuery('<span /> ')
2656 .addClass('del-button-dc-no icon-minus del-'+clickName+'-dc') 2657 .attr('data-id',idNew) 2658 // .text(' - ') 2659 .appendTo(td1); 2660 svg = jQuery(setIcon('minus')).appendTo(span); 2661 jQuery(idtable).append(tr); 2662 } 2663 else { 2664 alert('Diese Organisation: ' + id + ' wurde bereits ausgewählt.') //no active 2665 } 2666 }); 2667 2668 } // end 2669 //Functions 2670 jQuery('.del-'+clickName+'-dc').click(function(event) { 2671 var id = jQuery(this).data('id'); 2672 var elements = id + '-'+clickName; 2673 jQuery('[id^='+elements+']').remove(); 2674 jQuery('[class^='+elements+']').remove(); 2675 jQuery(this).remove(); 2676 }); 2677 2678 }// }); 2679 }, 2680 error:function(error){ 2681 console.log(error); 2682 alert('Fehler beim Hinzufügen oder Ãndern einer Organisation '); 2683 } 2684 }); 2685} 2686// ----------------------------------------------------------------------------- 2687// delete Organisation / POI 2688// ------------------------------------------------------------------------------ 2689jQuery('.del-organisation-dc').click(function(event) { 2690 var id = jQuery(this).data('id'); 2691 var elements = id + '-organisation'; 2692 jQuery('[name^='+elements+'-type]').css('display','none'); 2693 jQuery('[id^='+elements+']').remove(); 2694 jQuery(this).remove(); 2695}); 2696jQuery('.del-parent-dc').click(function(event) { 2697 var id = jQuery(this).data('id'); 2698 var elements = id + '-parent'; 2699 jQuery('[id^='+elements+']').remove(); 2700 jQuery('[class^='+elements+']').remove(); 2701 jQuery(this).remove(); 2702}); 2703jQuery('.del-children-dc').click(function(event) { 2704 var id = jQuery(this).data('id'); 2705 var elements = id + '-children'; 2706 jQuery('[id^='+elements+']').remove(); 2707 jQuery('[class^='+elements+']').remove(); 2708 jQuery(this).remove(); 2709}); 2710 2711jQuery('.del-poi-to-event-organizerPoi, .del-poi-to-event-locationPoi').click(function(event) { 2712 var event = jQuery(this).attr('class'); 2713 if (event.includes('del-poi-to-event-organizerPoi')) { 2714 var element = 'organizerPoi-'; 2715 var confirmText = 'Veranstalter'; 2716 } else { 2717 var element = 'locationPoi-'; 2718 var confirmText = 'Veranstaltungsort'; 2719 } 2720 if (jQuery('#'+element+'name').val() == '') { 2721 alert('Es wurde noch kein '+confirmText+' definiert'); 2722 } else { 2723 var ok = confirm('Wollen Sie diesen '+confirmText+' wirklich entfernen?'); 2724 if (ok == true) { 2725 jQuery('#'+element+'name').val('') ; 2726 jQuery('[id*='+element+'id]').remove(); 2727 jQuery('[id*='+element+'country]').remove(); 2728 jQuery('[id*='+element+'postCode]').remove(); 2729 jQuery('[id*='+element+'city]').remove(); 2730 jQuery('[id*='+element+'houseNumber]').remove(); 2731 jQuery('[id*='+element+'street]').remove(); 2732 } 2733 } 2734}); 2735 2736// ------------------------------------------------------------------------------------------------------------------------- 2737// openSearchPopup / onOffSearch / Search isEnterClick=Start Search / Popup Loadding and waiting / closeAndClearSearch) 2738// ------------------------------------------------------------------------------------------------------------------------- 2739function openSearchPopup(title) { 2740 jQuery('body').addClass('modal-open'); 2741 setCloseStatus(true); 2742 2743 loadingSearchPopup('start'); 2744 jQuery(".modal.relevanted-events").show(); 2745 jQuery('.modal-close').click(function() { 2746 jQuery(this).closest('.modal').hide(); 2747 jQuery('body').removeClass('modal-open'); 2748 }); 2749 jQuery('.cancel').click(function() { 2750 jQuery(this).closest('.modal').hide(); 2751 jQuery('body').removeClass('modal-open'); 2752 }); 2753 //Clear Search Input 2754 jQuery('.report-filter-clear.poievent, .modal-close, .cancel').click(function(event) { 2755 jQuery(".sendPoiEvent").css({"display": "none"}) ; 2756 jQuery(".result-search").css({"display": "none"}) ; 2757 jQuery('#categories-filter-off option:selected').removeAttr('selected'); 2758 jQuery(".keyword-filter").val('') ; 2759 jQuery(".result-search").text('') ; 2760 localStorage.setItem('keywordFilter',''); 2761 localStorage.setItem('categoriesFilter',''); 2762 }); 2763 //POI Categorie off Event Categorie on -> switch to Contact Search 2764 jQuery('.h4-search-poievent').text(title); 2765 jQuery('.filter-poi').css({"display": "none"}) ; 2766 jQuery('.filter-event').css({"display": "none"}) ; 2767 2768 // key enter in field name-filter-off 2769 isEnterClick(); 2770} 2771function onOffSearch() { 2772 jQuery('.toggleEvents').click(function(event) { 2773 var item = jQuery(this).val(); 2774 if(item == "on") { 2775 jQuery(this).val('off'); 2776 jQuery(this).removeClass('on'); 2777 jQuery(this).addClass('off'); 2778 } else { 2779 jQuery(this).val('on'); 2780 jQuery(this).removeClass('off'); 2781 jQuery(this).addClass('on'); 2782 } 2783 }); 2784} 2785function isEnterClick() { 2786 jQuery("#name-filter-off").keydown(e => { 2787 if (e.which === 13) { 2788 jQuery(".report-filter-search.events").triggerHandler("click"); 2789 e.preventDefault(); 2790 } 2791 }); 2792} 2793function loadingSearchPopup(action) { 2794 if (action == 'start') {
2795 jQuery('.modal-box').prepend('<div class="app-loading"><span class="loader"><span class="loader-inner"></span></span></div>'); 2796 } 2797 else { 2798 jQuery('.modal-box .app-loading').fadeOut(500,function(){ 2799 jQuery(this).remove(); 2800 }); 2801 } 2802} 2803function closeAndClearSearch(thiswindow) { 2804 jQuery('body').removeClass('modal-open'); 2805 jQuery('#tags-filter-off option:selected').removeAttr('selected'); 2806 jQuery('#categories-filter-off option:selected').removeAttr('selected'); 2807 jQuery(".keyword-filter").val('') ; 2808 jQuery(".result-search").text('') ; 2809 localStorage.setItem('keywordFilter',''); 2810 localStorage.setItem('categoriesFilter',''); 2811 thiswindow.hide(); 2812} 2813 2814// ----------------------------------------------------------------------------- 2815// Open and Close Register 2816// ------------------------------------------------------------------------------ 2817jQuery('.openRegister').click(function() { 2818 var registerName = jQuery(this).data('register'); 2819 jQuery('.tabcontent').css({"display": "none"}); 2820 jQuery('.tablinks').removeClass('active'); 2821 jQuery('#'+registerName+'.tabcontent').css({"display": "block"}); 2822 jQuery(this).addClass('active'); 2823 if (registerName == "others" || registerName == "view") { 2824 jQuery('.sendButton').css({"display": "none"}); 2825 jQuery('.cancel').css({"display": "none"}); 2826 } 2827 else { 2828 jQuery('.sendButton').css({"display": "block"}); 2829 jQuery('.cancel').css({"display": "block"}); 2830 } 2831 if (registerName == "address") { 2832 jQuery('.domap-backend').css({"display": "block"}); 2833 } 2834 else { 2835 jQuery('.domap-backend').css({"display": "none"}); 2836 } 2837 2838 // Bei Klick speichert den Register Namen in localStorage 2839 localStorage.setItem('registerName',registerName); 2840}); 2841 2842// ----------------------------------------------------------------------------- 2843// Set plus or minus icon 2844// ------------------------------------------------------------------------------ 2845function setIcon(icon) { 2846 svgString = ''; 2847 if (icon == 'plus') { svgString = "<svg><use xlink:href='#fas-fa-plus'></use></svg> "; } 2848 if (icon == 'minus') { svgString = "<svg><use xlink:href='#fas-fa-times'></use></svg> "; } 2849 if (icon == 'copy') { svgString = "<svg><use xlink:href='#fas-fa-copy'></use></svg> "; } 2850 return (svgString); 2851} 2852 2853// ----------------------------------------------------------------------------- 2854// Close Search Dialog 2855// ------------------------------------------------------------------------------ 2856jQuery('.close-dialog').click(function() { 2857 var dialogStatus = jQuery('.close-dialog').data('status') ; 2858 if (dialogStatus == true) { 2859 jQuery('.close-dialog').data('status',false); 2860 jQuery('.close-dialog').text('Dialog nach hinzufügen schlieÃen'); 2861 jQuery('.close-dialog').addClass('noclose'); 2862 } 2863 if (dialogStatus == false) { 2864 jQuery('.close-dialog').data('status',true); 2865 jQuery('.close-dialog').text('Dialog nach hinzufügen nicht schlieÃen'); 2866 jQuery('.close-dialog').removeClass('noclose'); 2867 } 2868}); 2869function setCloseStatus(status) { 2870 jQuery('.close-dialog').data('status',status); 2871 if (status == true) { 2872 jQuery('.close-dialog').text('Dialog nach hinzufügen nicht schlieÃen'); 2873 jQuery('.close-dialog').removeClass('noclose'); 2874 } 2875 if (status == false) { 2876 jQuery('.close-dialog').text('Dialog nach hinzufügen schlieÃen'); 2877 jQuery('.close-dialog').addClass('noclose'); 2878 } 2879} 2880 2881$(document).ready(function(){ 2882 var url = document.URL; 2883 2884 // get localStorage Filter and last Register 2885 var registerName = localStorage.getItem('registerName'); 2886 var keywordFilter = localStorage.getItem('keywordFilter'); 2887 var categoriesFilter = localStorage.getItem('categoriesFilter'); 2888 2889 if (url.indexOf('dataobjects/edit') > 0 && url.indexOf('success') > 0 && typeof registerName !== 'undefined') { 2890 jQuery('[data-register="'+registerName+'"]').click(); 2891 } else { 2892 if (url.indexOf('dataobjects/edit') > 0) { 2893 jQuery('[data-register="basic"]').click(); 2894 } 2895 if (url.indexOf('copy') > 0) { 2896 jQuery('#name').focus(); 2897 } 2898 if (url.indexOf('id') < 0) { 2899 jQuery('#name').focus(); 2900 } 2901 jQuery("#defaultOpen").click(); 2902 if (jQuery("#context").val() == 'Contact' || jQuery("#context").val() == 'contact' ) { 2903 jQuery('[data-register="contacts"]').click(); 2904 } 2905 if (jQuery("#context").val() == 'Service' || jQuery("#context").val() == 'Organisation' || 2906 jQuery("#context").val() == 'service' || jQuery("#context").val() == 'organisation' ) { 2907 jQuery('[data-register="basic"]').click(); 2908 } 2909 if (jQuery("#context").val() == 'Article' || jQuery("#context").val() == 'article' ) { 2910 if ((jQuery('#parent-id').val() != '') && (typeof jQuery('#parent-id').val() !== 'undefined')) { 2911 jQuery('[data-register="contacts"]').addClass('display-no'); 2912 jQuery('[data-register="categoriesmenu"]').addClass('display-no'); 2913 } 2914 } 2915 if (url.indexOf('dataobjects/edit') > 0) { 2916 jQuery('[data-register="basic"]').click(); 2917 } 2918 if (url.indexOf('rentaldel') > 0) { 2919 jQuery('[data-register="rentals"]').click(); 2920 } 2921 if (registerName == "goToPoi") { 2922 jQuery('[data-register="rentals"]').click(); 2923 } 2924 // set localStorage Filter to Filter report.js Order: 1. categories-filter-off 2. keyword-filter 2925 if (url.indexOf('dataobjects?context') > 0 ) { 2926 jQuery('#categories-filter-off').find("option[id="+categoriesFilter+"]").attr('selected','selected'); 2927 jQuery('#categories-filter-off').change(); 2928 jQuery('.keyword-filter').val(keywordFilter); 2929 jQuery('.keyword-filter').keyup(); 2930 } 2931 } 2932 2933 jQuery("#view input").attr({'id':+'_view','name':''}) ; 2934 jQuery("#view select").attr({'id':+'_view','name':''}) ; 2935 jQuery("#view div").attr({'id':+'_view','name':''}) ; 2936 jQuery("#view span").attr({'id':+'_view','name':''}) ; 2937 2938 //Event Frontend make one Dates Row 2939 if (jQuery("#contextFrontend").val() == 'EventFrontend') { 2940 jQuery("#add-dates").trigger("click"); 2941 jQuery("#firstname").focus(); 2942 jQuery(document).scrollTop( $("#header").offset().top ); 2943 jQuery(".name .div-data-container-header").text('VERANSTALTUNGSNAME'); 2944 jQuery(".name .div-data-container-header").text(jQuery(".name .div-data-container-header").text()+' *'); 2945 jQuery("#locationInfo").attr('required','required'); 2946 jQuery("#set-poi-to-event-locationPoi").before(' *'); 2947 jQuery(".table-dates-dc th:nth-child(2)").text(jQuery(".table-dates-dc th:nth-child(2)").text() + ' *'); 2948 jQuery(".table-dates-dc th:nth-child(3)").text(jQuery(".table-dates-dc th:nth-child(3)").text() + ' *'); 2949 2950 if (url.indexOf('success') > 0) { 2951 jQuery('.data-container-eventforms').addClass('display-no'); 2952 } 2953 } 2954}); 2955 2956// ----------------------------------------------------------------------------- 2957// Open and Close STEP Register 2958// ------------------------------------------------------------------------------ 2959currentTab = 0; // Current tab is set to be the first tab (0) 2960showTab(currentTab); // Display the current tab 2961 2962function showTab(n) { 2963 // This function will display the specified tab of the form... 2964 var registerName = jQuery('.step:eq('+n+')').data('register'); 2965 jQuery('#'+registerName+'.tabcontent').css({"display": "block"}); 2966 //... and fix the Previous/Next buttons: 2967 if (n == 0) { 2968 jQuery("#prevBtn").css({"display": "none"}) ; 2969 } else { 2970 jQuery("#prevBtn").css({"display": "inline"}) ; 2971 } 2972 if (n == (jQuery('.step').length - 1)) { 2973 jQuery("#nextBtn") 2974 .text( "Speichern") 2975 .attr({'name':'sendButtonStepRegister'}) 2976 .addClass('checkDatacontainer') 2977 .css({"display": "none"}) ; 2978 } else { 2979 jQuery("#nextBtn").css({"display": "inline"}) ; 2980 jQuery("#nextBtn").text( "Nächstes"); 2981 } 2982 //... and run a function that will display the correct step indicator: 2983 fixStepIndicator(n) 2984} 2985 2986function nextPrev(n) { 2987 var registerName = jQuery('.step:eq('+n+')').data('register'); 2988 if (registerName == "others" || registerName == "view") { 2989 jQuery('.sendButton').css({"display": "none"}); 2990 jQuery('.cancel').css({"display": "none"}); 2991 } 2992 else { 2993 jQuery('.sendButton').css({"display": "block"}); 2994 jQuery('.cancel').css({"display": "block"}); 2995 } 2996 if (registerName == "address") { 2997 jQuery('.domap-backend').css({"display": "block"}); 2998 } 2999 else { 3000 jQuery('.domap-backend').css({"display": "none"}); 3001 } 3002 // step tab plus 1: 3003 currentTab = currentTab + n; 3004 // Exit the function if any field in the current tab is invali
3004d: 3005 if (n == 1 && !checkDatacontainerValid()) return false; 3006 // if you have reached the end of the form... 3007 if (currentTab >= jQuery('.step').length) { 3008 jQuery("#regForm").submit(); 3009 return false; 3010 } 3011 // Otherwise, display the correct tab: 3012 showTab(currentTab); 3013} 3014 3015 3016function checkDatacontainerValid() { 3017 jQuery('input:invalid').css('background-color','#ffdddd'); 3018 const inpObj = jQuery('input:invalid'); 3019 if (inpObj.length > 0) { 3020 alert("Sie haben in einen Register eine ungültige oder fehlende Eingabe betätigt. Bitte überprüfen Sie Ihre Eingaben.\n\nYou have made an invalid or missing entry in a register. Please check your entries."); 3021 return false; 3022 } 3023 return true; 3024} 3025 3026function validateForm() { 3027 // This function deals with validation of the form fields 3028 var x, y, i, valid = true; 3029 x = jQuery(".tabcontent"); 3030/* 3031 var registerName = jQuery('.step:eq('+n+')').data('register'); 3032 jQuery('#'+registerName+'.tabcontent').css({"display": "block"}); 3033 3034 const inpObj = jQuery('input:invalid'); 3035 if (inpObj.length > 0) {*/ 3036 3037 y = x[currentTab].getElementsByTagName("input"); 3038 // A loop that checks every input field in the current tab: 3039 for (i = 0; i < y.length; i++) { alert(y[i]); 3040 // If a field is empty... 3041 if (y[i].value == "") { 3042 // add an "invalid" class to the field: 3043 y[i].className += " invalid"; 3044 // and set the current valid status to false 3045 valid = false; 3046 } 3047 } 3048 // If the valid status is true, mark the step as finished and valid: 3049 if (valid) {alert('hiervalid1'); 3050 document.getElementsByClassName("step")[currentTab].className += " finish"; 3051 } 3052 return valid; // return the valid status 3053} 3054 3055function fixStepIndicator(n) { 3056 // This function removes the "active" class of all steps... 3057 jQuery('.tabcontent').css({"display": "none"}); 3058 jQuery('.tablinks').removeClass('active'); 3059 //This Step -> Tabcontent to display 3060 var registerName = jQuery('.step:eq('+n+')').data('register'); 3061 jQuery('#'+registerName+'.tabcontent').css({"display": "block"}); 3062 jQuery('.tablinks.'+registerName).addClass('active'); 3063 jQuery(".step").removeClass('active'); 3064 jQuery('.step:eq('+n+')').addClass('active'); 3065} 3066 3067//=============================================================================== 3068// C A T E G O R I E S 3069//=============================================================================== 3070jQuery(document).ready(function() { 3071 3072 /* ----------------------------------------------------------------------------- 3073 Categories Report - List - Toggle 3074 ----------------------------------------------------------------------------- */ 3075 jQuery(".listreport > i").each(function() { 3076 jQuery(this).addClass("opened"); 3077 }); 3078 3079 jQuery(".listreport").each(function() { 3080 jQuery(this).parent().parent().find("i").toggleClass("opened"); 3081 }); 3082 3083 jQuery(".listreport > i").click(function() { 3084 var id = '.' + jQuery(this).data('id') + '-child'; 3085 var iddown = '.' + jQuery(this).data('id') + '-childdown'; 3086 3087 var opened = jQuery(this).attr("class"); 3088 if (opened.indexOf("opened") > 0) { 3089 jQuery(iddown).css('display','none'); 3090 jQuery(id + ' i').removeClass("opened"); 3091 jQuery(iddown + ' i').removeClass("opened"); 3092 } 3093 jQuery(id).slideToggle("fast","swing"); 3094 jQuery(this).parent().siblings().children().next('i').removeClass("opened"); 3095 jQuery(this).toggleClass("opened"); 3096 return false; 3097 }); 3098 3099 /* ----------------------------------------------------------------------------- 3100 Select Categories 3101 ----------------------------------------------------------------------------- */ 3102 /* jQuery(".parent-categorie").click(function(event) { 3103 jQuery(".children-lastchild-categorie").click(function(event) { 3104 checkCategorie(this,event,'childrenlast'); 3105 }); 3106 jQuery(".children-categorie").click(function(event) { 3107 checkCategorie(this,event,'children'); 3108 }); 3109 jQuery(".child-categorie").click(function(event) { 3110 checkCategorie(this,event,'child'); 3111 }); 3112 checkCategorie(this,event,'parent'); 3113 }); */ 3114 3115 /* jQuery(".children-categorie").click(function(event) { 3116 checkCategorie(this,event,'children'); 3117 }); 3118 3119 jQuery(".children-lastchild-categorie").click(function(event) { 3120 checkCategorie(this,event,'childrenlast'); 3121 }); 3122 3123 jQuery(".children-fifthchild-categorie").click(function(event) { 3124 checkCategorie(this,event,'childrenfifth'); 3125 }); 3126 3127 jQuery(".child-categorie").click(function(event) { 3128 checkCategorie(this,event,'child'); 3129 }); */ 3130 3131 /* function checkCategorie(thisElement,event,step) { 3132 switch(step) { 3133 case 'childrenfifth': 3134 //var isFlexBox = jQuery(thisElement).find('div[class="flex-data-container flex-lastchild"]');
3135 //var isLastChild = jQuery(isFlexBox).find('input:first').val(); 3136 //if (typeof isLastChild !== 'undefined') { } 3137 var isChecked = jQuery(thisElement).find('input:first:checked').val(); 3138 if (typeof isChecked !== 'undefined') { 3139 jQuery(thisElement).parent().find('input').prop('checked', true); 3140 } else { 3141 jQuery(thisElement).parent().find('input').prop('checked', false); 3142 } 3143 break; 3144 case 'childrenlast': 3145 //var isFlexBox = jQuery(thisElement).find('div[class="flex-data-container flex-lastchild"]'); 3146 //var isLastChild = jQuery(isFlexBox).find('input:first').val(); 3147 //if (typeof isLastChild !== 'undefined') { } 3148 var isChecked = jQuery(thisElement).find('input:first:checked').val(); 3149 if (typeof isChecked !== 'undefined') { 3150 jQuery(thisElement).parent().find('input').prop('checked', true); 3151 } else { 3152 jQuery(thisElement).parent().find('input').prop('checked', false); 3153 } 3154 break; 3155 case 'children': 3156 break; 3157 case 'child': 3158 case 'parent': 3159 var isChecked = jQuery(thisElement).find('input:first:checked').val(); 3160 if (typeof isChecked !== 'undefined') { 3161 jQuery(thisElement).find('input').prop('checked', true); 3162 } else { 3163 jQuery(thisElement).find('input').prop('checked', false); 3164 } 3165 break; 3166 default: 3167 break; 3168 } 3169 event.stopPropagation(); 3170 event.stopImmediatePropagation(); 3171 } */ 3172}) 3173 3174// ----------------------------------------------------------------------------- 3175// add Rentals 3176// ------------------------------------------------------------------------------ 3177jQuery('#add-rental').click(function(event) { 3178 var configID = jQuery(this).data('poiid'); 3179 jQuery.ajax({ 3180 type:'POST', 3181 url:'https://' + domain + '/account/dataobjects/edit?id=0&context=rental', 3182 data: {configID:configID}, 3183 success:function(data){ 3184 if(data == false) { 3185 window.location.href = 'https://' + domain + '/account/login'; 3186 } 3187 else { 3188 window.location.href = 'https://' + domain + '/account/dataobjects/edit?poiid='+configID+'&id=0&context=rental'; 3189 } 3190 }, 3191 error:function(error){ 3192 alert('Fehler beim Hinzufügen einens Vermieterobjektes'); 3193 console.log(error); 3194 } 3195 }); 3196}); 3197// ----------------------------------------------------------------------------- 3198// edit Rentals 3199// ------------------------------------------------------------------------------ 3200jQuery('.edit-rental').click(function(event) { 3201 var rentalID = jQuery(this).data('id'); 3202 var poiID = jQuery(this).data('poiid'); 3203 jQuery.ajax({ 3204 type:'POST', 3205 url:'https://' + domain + '/account/dataobjects/edit?poiid='+poiID+'&id='+rentalID+'&context=rental', 3206 data: {configID:rentalID}, 3207 success:function(data){ 3208 if(data == false) { 3209 window.location.href = 'https://' + domain + '/account/login'; 3210 } 3211 else { 3212 window.location.href = 'https://' + domain + '/account/dataobjects/edit?poiid='+poiID+'&id='+rentalID+'&context=rental'; 3213 } 3214 }, 3215 error:function(error){ 3216 alert('Fehler beim Ãndern einens Vermieterobjektes oder fehlende Berechtigung'); 3217 console.log(error); 3218 } 3219 }); 3220}); 3221// ----------------------------------------------------------------------------- 3222// del Rentals 3223// ------------------------------------------------------------------------------ 3224jQuery('.del-rental.delete-datacontainer').click(function(event) { 3225 var datacontainerID = jQuery(this).data('id'); 3226 3227 jQuery.ajax({ 3228 type:'POST', 3229 url:'https://' + domain + '/account/dataobjects/delete', 3230 data: {datacontainerID:datacontainerID}, 3231 success:function(data){ 3232 if(data == false) { 3233 window.location.href = 'https://' + domain + '/account/login'; 3234 } 3235 jQuery('body').addClass('modal-open'); 3236 jQuery(".modal.datacontainerdelete.modal-"+datacontainerID).show(); 3237 jQuery('[data-register="rental"]').click(); 3238 3239 jQuery('.modal-close').click(function() { 3240 jQuery(this).closest('.modal').hide(); 3241 jQuery('body').removeClass('modal-open'); 3242 }); 3243 jQuery('.cancel').click(function() { 3244 jQuery(this).closest('.modal').hide(); 3245 jQuery('body').removeClass('modal-open'); 3246 }); 3247 }, 3248 error:function(error){ 3249 alert('Fehler beim Löschen eines Vermieterobjektes'); 3250 console.log(error); 3251 } 3252 }); 3253}); 3254// ----------------------------------------------------------------------------- 3255// del Rentals
3256// ------------------------------------------------------------------------------ 3257jQuery('.goToPoi').click(function() { 3258 // Speichert den Register Namen in localStorage 3259 localStorage.setItem('registerName','goToPoi'); 3260}); 3261 3262 3263//=============================================================================== 3264// F U N C T I O N S 3265//=============================================================================== 3266// ----------------------------------------------------------------------------- 3267// check-date : Check start and end date 3268// ------------------------------------------------------------------------------ 3269function checkDate(thisElement,event) { 3270 var startDate = new Date(thisElement.find("input[class='start-date']").val() ); 3271 var endDate = new Date(thisElement.find("input[class='end-date']").val()); 3272 if (startDate > endDate) { 3273 thisElement.find("input[class='end-date']").focus(); 3274 alert ('Das Enddatum kann nicht vor dem Startdatum liegen.'); 3275 event.stopPropagation(); 3276 event.stopImmediatePropagation(); 3277 thisElement.unbind('focusout'); 3278 return false; 3279 } 3280 if (thisElement.find("input[class='end-date']").val() == '') { 3281 thisElement.find("input[class='end-date']").val(thisElement.find("input[class='start-date']").val()); 3282 } 3283 return true; 3284} 3285 3286// ----------------------------------------------------------------------------- 3287// checkEventForm 3288// ------------------------------------------------------------------------------ 3289jQuery('.checkEventForm').click(function(event) { 3290 3291 jQuery('input').css('border-color','#e4e4e4'); 3292 jQuery('textarea').css('border-color','#e4e4e4'); 3293 3294 const inpObj = jQuery('.data-container-eventforms input:invalid'); 3295 const textareaObj = jQuery('.data-container-eventforms textarea:invalid'); 3296 // var invalidfield = $('.data-container-eventforms input:invalid').first().attr('name'); 3297 3298 if (inpObj.length > 0 || textareaObj.length > 0) { 3299 alert("Fehlerhafte oder fehlende Angaben."); 3300 jQuery('input:invalid').css('border-color','red'); 3301 jQuery('textarea:invalid').css('border-color','red'); 3302 $('input').filter(':invalid').first().focus(); 3303 // jQuery('input[name="'+invalidfield+'"]').first().focus(); 3304 return false; 3305 } 3306 3307 var startDate = jQuery('.start-date').val() ; 3308 3309 if (startDate == '' || typeof startDate == 'undefined') { 3310 alert("Es muss ein Termin angegeben werden."); 3311 jQuery('.start-date').focus(); 3312 event.stopPropagation(); 3313 event.stopImmediatePropagation(); 3314 return false; 3315 } 3316 check = checkDate(jQuery(this),event); 3317 3318 if (check == false) {return check;} 3319 var dsgvo = jQuery('#dsgvo:checked').val() ; 3320 if (dsgvo !== 'on' && typeof dsgvo == 'undefined') { 3321 alert("Sie müssen die Datenschutzerklärung anklicken."); 3322 jQuery('#dsgvo').focus(); 3323 event.stopPropagation(); 3324 event.stopImmediatePropagation(); 3325 return false; 3326 } 3327 //jQuery(this).find('input[value="1"]').prop('checked', false); 3328 return check; 3329}); 3330 3331// ----------------------------------------------------------------------------- 3332// GDC send and goto last Register 3333// ------------------------------------------------------------------------------ 3334jQuery('.sendClose').click(function() { 3335 history.back(1); 3336}); 3337 3338// ----------------------------------------------------------------------------- 3339// Set localStorage Filter Funktion 3340// ------------------------------------------------------------------------------ 3341// set Filter to localStorage 3342jQuery('.keyword-filter').focusout(function(event) { 3343 var keywordFilter = jQuery(this).val(); 3344 localStorage.setItem('keywordFilter',keywordFilter); 3345}); 3346jQuery('#categories-filter-off').click(function(event) { 3347 var categoriesFilter = jQuery("#categories-filter-off option:selected").attr('id'); 3348 localStorage.setItem('categoriesFilter',categoriesFilter); 3349}); 3350// clear Filter to localStorage 3351jQuery('.report-filter-clear').click(function() { 3352 localStorage.setItem('keywordFilter',''); 3353 localStorage.setItem('categoriesFilter',''); 3354}); 3355// ----------------------------------------------------------------------------- 3356// Save and Close 3357// ------------------------------------------------------------------------------ 3358jQuery('.sendCloseButton').click(function() { 3359 var action = jQuery('#formbib-forms').attr('action'); 3360 var actionandClose = action + "?close"; 3361 jQuery('#formbib-forms').attr('action',actionandClose); 3362}); 3363// ----------------------------------------------------------------------------- 3364// clear localStorage change navigation-item 3365// ------------------------------------------------------------------------------ 3366jQuery('.navigation-item').click(function() { 3367 localStorage.setItem('keywordFilter',''); 3368 localStorage.setItem('categoriesFilter',''); 3369}); 3370 3371// ----------------------------------------------------------------------------- 3372// show ID in Report 3373// ----------------------------------------------------------------------------- 3374jQuery('#list-id').dblclick(function(event) { 3375 jQuery('.dataobject-table').toggleClass("dataobject-table-show-id"); 3376 event.stopPropagation(); 3377 event.stopImmediatePropagation(); 3378}); 3379 3380// ----------------------------------------------------------------------------- 3381// Remove all image and iframe from GDC longDescription 3382// ----------------------------------------------------------------------------- 3383jQuery(".checkDatacontainer").click(function(){ 3384 longDescription = jQuery("#longDescription" ).val(); 3385 3386 while (longDescription.lastIndexOf("<iframe") > 0 ) { 3387 iframestart = longDescription.lastIndexOf("<iframe"); 3388 iframeend = longDescription.lastIndexOf("</iframe>")+9; 3389 iframe = longDescription.substr(iframestart,iframeend-iframestart); 3390 longDescription = longDescription.replace(iframe,""); 3391 } 3392 while (longDescription.lastIndexOf("<iframe") > 0 ) { 3393 iframestart = longDescription.lastIndexOf("<iframe"); 3394 iframeend = longDescription.lastIndexOf("iframe>")+10; 3395 iframe = longDescription.substr(iframestart,iframeend-iframestart); 3396 longDescription = longDescription.replace(iframe,""); 3397 } 3398 while (longDescription.lastIndexOf("<img") > 0) { 3399 imgstart = longDescription.lastIndexOf("<img"); 3400 imgend = longDescription.indexOf(">",imgstart)+1; 3401 imgsource = longDescription.substr(imgstart,imgend-imgstart); 3402 longDescription = longDescription.replace(imgsource,""); 3403 } 3404 while (longDescription.lastIndexOf("<img") > 0) { 3405 imgstart = longDescription.lastIndexOf("<img"); 3406 imgend = longDescription.indexOf(">",imgstart)+4; 3407 3408 if (longDescription.indexOf(">",imgstart) < 0) {imgend = imgstart+7;} 3409 imgsource = longDescription.substr(imgstart,imgend-imgstart); 3410 longDescription = longDescription.replace(imgsource,""); 3411 } 3412 jQuery("#longDescription" ).val(longDescription); 3413}); 3414 3415//=============================================================================== 3416// M E T E R S 3417//=============================================================================== 3418// ----------------------------------------------------------------------------- 3419// Meters Details 3420//----------------------------------------------------------------------------
3421jQuery('.modal-btn-name-meters').click(function() { 3422 meterID = jQuery(this).attr("value"); 3423 3424 jQuery.ajax({ 3425 type:'POST', 3426 url:'https://' + domain + '/account/meters/metersDetails', 3427 data: {meterID:meterID}, 3428 success:function(data){ 3429 if(data == false) { 3430 window.location.href = 'https://' + domain + '/account/login'; 3431 } 3432 jQuery('body').addClass('modal-open'); 3433 jQuery(".modal.meters").show(); 3434 jQuery('.modal.meters .modal-box').html(data); 3435 jQuery('#value-0').focus(); 3436 3437 jQuery('.modal-close').click(function() { 3438 jQuery(this).closest('.modal').hide(); 3439 jQuery('body').removeClass('modal-open'); 3440 }); 3441 3442 jQuery('.cancel').click(function() { 3443 jQuery(this).closest('.modal').hide(); 3444 jQuery('body').removeClass('modal-open'); 3445 }); 3446 }, 3447 error:function(error){ 3448 alert('Fehler'); 3449 console.log(error); 3450 } 3451 }); 3452}); 3453 3454//=============================================================================== 3455// Meters / GDC CSV File 3456//=============================================================================== 3457jQuery('.report-csv').click(function() { 3458 var csvFileName = jQuery(this).data('file'); 3459 3460 // Variable to store the final csv data 3461 var titles = []; 3462 var data = []; 3463 3464 // Get each row data 3465 $('.report-table th').each(function() { 3466 titles.push($(this).text()); 3467 }); 3468 3469 // Get the actual data, this will contain all the data, in 1 array 3470 $('.report-table td').each(function() { 3471 data.push($(this).text()); 3472 }); 3473 3474 // Convert our data to CSV string 3475 var CSVString = prepCSVRow(titles, titles.length, ''); 3476 CSVString = prepCSVRow(data, titles.length, CSVString); 3477 3478 // Make CSV downloadable 3479 var downloadLink = document.createElement("a"); 3480 var blob = new Blob(["\ufeff", CSVString]); 3481 var url = URL.createObjectURL(blob); 3482 downloadLink.href = url; 3483 downloadLink.download = csvFileName +".csv"; 3484 3485 // Actually download CSV 3486 document.body.appendChild(downloadLink); 3487 downloadLink.click(); 3488 document.body.removeChild(downloadLink); 3489}); 3490 3491function prepCSVRow(arr, columnCount, initial) { 3492 var row = ''; // this will hold data 3493 var delimeter = ';'; // data slice separator, in excel it's `;`, in usual CSv it's `,` 3494 var newLine = '\r\n'; // newline separator for CSV row 3495 3496 /* 3497 * Convert [1,2,3,4] into [[1,2], [3,4]] while count is 2 3498 * @param _arr {Array} - the actual array to split 3499 * @param _count {Number} - the amount to split 3500 * return {Array} - splitted array 3501 */ 3502 function splitArray(_arr, _count) { 3503 var splitted = []; 3504 var result = []; 3505 _arr.forEach(function(item, idx) { 3506 if ((idx + 1) % _count === 0) { 3507 splitted.push(item); 3508 result.push(splitted); 3509 splitted = []; 3510 } else { 3511 splitted.push(item); 3512 } 3513 }); 3514 return result; 3515 } 3516 3517 var plainArr = splitArray(arr, columnCount); 3518 // don't know how to explain this 3519 // you just have to like follow the code 3520 // and you understand, it's pretty simple 3521 // it converts `['a', 'b', 'c']` to `a,b,c` string 3522 plainArr.forEach(function(arrItem) { 3523 arrItem.forEach(function(item, idx) { 3524 row += item + ((idx + 1) === arrItem.length ? '' : delimeter); 3525 }); 3526 row += newLine; 3527 }); 3528 return initial + row; 3529} 3530 3531 3532//=============================================================================== 3533// G D C S I N G L E U S E R 3534//=============================================================================== 3535// ----------------------------------------------------------------------------- 3536// Add GDC Single User authenticity 3537// ------------------------------------------------------------------------------ 3538jQuery('#add-contact-to-singleuser').unbind().click(function(event) { 3539 id = jQuery(this).attr('id'); 3540 context = jQuery(this).data('type'); 3541 idSplit = id.split("-"); 3542 clickName = idSplit[3]; 3543 3544 var title = 'Auswahl - Einzelberechtigte' ; 3545 openSearchPopup(title); 3546 3547 //search function run automatically 3548 searchSingles(context); 3549 3550 //Button Add new Contact display none
3551 jQuery('.modal-footer .new-contact').css('display','none'); 3552 3553 //search glasses 3554 jQuery('.report-filter-search.events').off().click(function(event) { 3555 divnotice = ''; 3556 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 3557 var id = jQuery(this).data('id'); 3558 var firstName = jQuery('.'+id+'-search-contact-firstname').text(); 3559 var lastName = jQuery('.'+id+'-search-contact-lastname').text(); 3560 divnotice = divnotice + '<div class="notice" id='+id+' data-firstName="'+firstName+'" data-lastName="'+lastName+'" ></div>'; 3561 }); 3562 }); 3563}); 3564 3565function searchSingles(context) { 3566 jQuery.ajax({ 3567 type:'POST', 3568 url:'https://' + domain + '/account/dataobjects/single/list', 3569 data: {context:context}, 3570 success:function(data){ 3571 if(data == false) { 3572 window.location.href = 'https://' + domain + '/account/login'; 3573 } 3574 loadingSearchPopup('stoploading'); 3575 3576 jQuery(".result-search").text('') ; 3577 jQuery(".result-search").show(); 3578 var iddiv = '.result-search'; 3579 jQuery(iddiv).append(data); 3580 3581 onOffSearch(); 3582 3583 jQuery('.sendPoiEvent').unbind().click(function(event) { 3584 setResultSingleTable(); 3585 closeAndClearSearch(jQuery(this).closest('.modal')); 3586 delSingleUserFunction(); 3587 }); 3588 3589 jQuery('.selection-by-click').unbind().click(function(event) { 3590 var idClicked = jQuery(this).data('id'); 3591 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", true); 3592 setResultSingleTable(); 3593 jQuery('.checkbox-search-poievent[data-id='+idClicked+'] input').attr("checked", false); 3594 delSingleUserFunction(); 3595 if (jQuery('.close-dialog').data('status') == true) { 3596 closeAndClearSearch(jQuery(this).closest('.modal')); 3597 } 3598 }); 3599 3600 function setResultSingleTable() { 3601 var idlasttr = jQuery('.table-contact-dc-singleuser tr').length; 3602 var idtable = '.' + 'table-contact-dc-singleuser'; 3603 idexist = false; 3604 3605 jQuery('.checkbox-search-poievent input:checked').each(function( ) { 3606 var id = jQuery(this).data('id') ; 3607 var existid = $('[name*="singleuser-id"]').map(function(){ 3608 if ( $(this).val() == id) { 3609 idexist = true; 3610 } 3611 return $(this).val(); 3612 }).get(); 3613 3614 var firstName = jQuery('.'+id+'-search-single-firstname').text(); 3615 var lastName = jQuery('.'+id+'-search-single-lastname').text(); 3616 var arcId = jQuery('.'+id+'-search-single-arcId').text(); 3617 3618 //set New Id 3619 var idNew = idlasttr.toString() + jQuery(this).data('id') ; 3620 if (!idexist) { //noaktive 3621 tr = jQuery('<tr id="'+idNew+'-singleuser-idrow"/> '); 3622 td1 = jQuery('<td /> '); 3623 input = jQuery('<input type="number-text" readonly/> ') 3624 .attr({'id':idNew+'-singleuser-id-new','name':idNew+'-singleuser-id-new'}) 3625 .val(id) 3626 .appendTo(td1); 3627 jQuery(tr).append(td1); 3628 td2 = jQuery('<td /> ').text(firstName+', '+lastName).appendTo(tr); 3629 td3 = jQuery('<td class="display-no" /> ').text(arcId).appendTo(tr); 3630 3631 td6 = jQuery('<td /> ').addClass('del-icon-right').appendTo(tr); 3632 span = jQuery('<span /> ') 3633 .addClass('icon-minus del-singleuser') 3634 .attr({'data-id':idNew}) 3635 .appendTo(td6); 3636 svg = jQuery(setIcon('minus')).appendTo(span); 3637 jQuery(idtable).append(tr); 3638 } 3639 else { 3640 alert('Dieser Benutzer: ' + id + ' wurde bereits ausgewählt.') 3641 } 3642 }); 3643 } 3644 function delSingleUserFunction() { 3645 jQuery('.del-singleuser').click(function(event) { 3646 var id = jQuery(this).data('id'); 3647 var delid = jQuery(this).data('delid'); 3648 removeSingleuserFromObject(id,delid); 3649 event.stopPropagation(); 3650 event.stopImmediatePropagation() 3651 }); 3652 } 3653 }, 3654 error:function(error){ 3655 console.log(error); 3656 alert('Fehler beim Hinzufügen oder ändern eines Kontaktes zu einen Event oder POI'); 3657 } 3658 }); 3659} 3660 3661// ----------------------------------------------------------------------------- 3662// removeSingleuserFromObject 3663// ------------------------------------------------------------------------------ 3664function removeSingleuserFromObject(id,delid) { 3665 var elements = id + '-singleuser-idrow'; 3666 var singleUserId = jQuery('#'+id + '-singleuser-id').val(); 3667 var singleUserIdNew = false;
3668 3669 if (typeof singleUserId == 'undefined') { 3670 var singleUserId = jQuery('#'+id + '-singleuser-id-new').val(); 3671 var singleUserIdNew = true; 3672 } 3673 3674 var name = jQuery('#'+elements + ' td:nth-child(2)').text(); 3675 var ok = confirm("Wollen Sie diese neue Einzelberechtigung wirklich entfernen?\n\n"+ singleUserId + " " + name); 3676 3677 if (ok == true) { 3678 if (singleUserIdNew == true) { 3679 jQuery('#'+elements).remove(); 3680 } else { 3681 jQuery.ajax({ 3682 type:'POST', 3683 url:'https://' + domain + '/account/dataobjects/single/delete', 3684 data: {delid:delid}, 3685 success:function(data){ 3686 if(data == false) { 3687 window.location.href = 'https://' + domain + '/account/login'; 3688 } 3689 jQuery('#'+elements).remove(); 3690 }, 3691 error:function(error){ 3692 alert(delid); 3693 alert('Fehler beim Löschen eines Einzelberechtigten'); 3694 return(false); 3695 } 3696 }); 3697 } 3698 3699 } 3700}; 3701jQuery('.del-singleuser').click(function(event) { 3702 var id = jQuery(this).data('id'); 3703 var delid = jQuery(this).data('delid'); 3704 removeSingleuserFromObject(id,delid); 3705 event.stopPropagation(); 3706 event.stopImmediatePropagation() 3707}); 3708 3709//=============================================================================== 3710// App Configuration Backend 3711//=============================================================================== 3712// ----------------------------------------------------------------------------- 3713// send or draft or tempate a app push 3714// ------------------------------------------------------------------------------ 3715jQuery('.app-draft.draft').click(function(event) { 3716 jQuery('#push-draft').val('draft'); 3717 event.stopPropagation(); 3718 event.stopImmediatePropagation() 3719}); 3720jQuery('.app-template.draft').click(function(event) { 3721 jQuery('#push-draft').val('template'); 3722 event.stopPropagation(); 3723 event.stopImmediatePropagation() 3724}); 3725jQuery('.app-small-form .sendButton').click(function(event) { 3726 jQuery('#push-draft').val(''); 3727 event.stopPropagation(); 3728 event.stopImmediatePropagation() 3729}); 3730// ----------------------------------------------------------------------------- 3731// Delete Topic 3732// ------------------------------------------------------------------------------
3733jQuery(".modal-btn.delete-topic, .modal-btn.delete-push").click(function(){ 3734 id = jQuery(this).val(); 3735 action = jQuery(this).data('action'); 3736 url = 'https://' + domain + '/account/app/'; 3737 url = (action == "push") ? url + 'push/delete' : url + 'topic/delete'; 3738 showModal = (action == "push") ? ".modal.pushdelete.modal-"+id : ".modal.topicdelete.modal-"+id ; 3739 3740 jQuery.ajax({ 3741 type:'POST', 3742 url:url, 3743 data: {id:id}, 3744 success:function(data){ 3745 if(data == false) { 3746 window.location.href = 'https://' + domain + '/account/login'; 3747 } 3748 jQuery('body').addClass('modal-open'); 3749 jQuery(showModal).show(); 3750 3751 jQuery('.modal-close').click(function() { 3752 jQuery(this).closest('.modal').hide(); 3753 jQuery('body').removeClass('modal-open'); 3754 }); 3755 jQuery('.cancel').click(function() { 3756 jQuery(this).closest('.modal').hide(); 3757 jQuery('body').removeClass('modal-open'); 3758 }); 3759 }, 3760 error:function(error){ 3761 alert('Fehler beim Löschen'); 3762 console.log(error); 3763 } 3764 }); 3765}); 3766// ----------------------------------------------------------------------------- 3767// Topics Details 3768//---------------------------------------------------------------------------- 3769jQuery('.modal-btn-name-topic').click(function() { 3770 topicID = jQuery(this).attr("value"); 3771 3772 jQuery.ajax({ 3773 type:'POST', 3774 url:'https://' + domain + '/account/app/topic/edit', 3775 data: {topicID:topicID}, 3776 success:function(data){ 3777 if(data == false) { 3778 window.location.href = 'https://' + domain + '/account/login'; 3779 } 3780 jQuery('body').addClass('modal-open'); 3781 jQuery(".modal.topic").show(); 3782 jQuery('.modal.topic .modal-box').html(data); 3783 3784 jQuery('.modal-close').click(function() { 3785 jQuery(this).closest('.modal').hide(); 3786 jQuery('body').removeClass('modal-open'); 3787 }); 3788 3789 jQuery('.cancel').click(function() { 3790 jQuery(this).closest('.modal').hide(); 3791 jQuery('body').removeClass('modal-open'); 3792 }); 3793 }, 3794 error:function(error){ 3795 alert('Fehler'); 3796 console.log(error); 3797 } 3798 }); 3799}); 3800
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.