1// ----------------------------------------------------------------------------- 2// Sortable Tables 3// ----------------------------------------------------------------------------- 4domain =window.location.hostname; 5 6 7jQuery.fn.sortElements = (function(){ 8 var sort = [].sort; 9 return function(comparator, getSortable) { 10 getSortable = getSortable || function() { 11 return this; 12 }; 13 var placements = this.map(function() { 14 var sortElement = getSortable.call(this), 15 parentNode = sortElement.parentNode, 16 nextSibling = parentNode.insertBefore( 17 document.createTextNode(''), sortElement.nextSibling 18 ); 19 return function() { 20 if (parentNode === this) { 21 throw new Error( 22 "You can't sort elements if any one is a descendant of another." 23 ); 24 } 25 // Insert before flag: 26 parentNode.insertBefore(this, nextSibling); 27 // Remove flag: 28 parentNode.removeChild(nextSibling); 29 }; 30 }); 31 return sort.call(this, comparator).each(function(i) { 32 placements[i].call(getSortable.call(this)); 33 }); 34 }; 35})(); 36 37var th = jQuery('.report-table th'), inverse = false; 38 39// Sort Table 40if(getUrlParameter('requirements') || getUrlParameter('timewindow') || getUrlParameter('resources') || getUrlParameter('specialtimes')) { 41 th = jQuery('.report-table th:first-of-type'); 42 sortTable(th); 43} 44 45th.click(function() { 46 th = $(this) 47 sortTable(th); 48}); 49 50function sortTable(th) { 51 var header = th, index = header.index(); 52 jQuery('.report-table th').removeClass('sorted'); 53 jQuery(this).addClass('sorted'); 54 header.closest('table').find('td').filter(function() { 55 return $(this).index() === index; 56 }).sortElements(function(a, b){ 57 a = $(a).text(); 58 b = $(b).text(); 59 a = a.toLowerCase(); 60 b = b.toLowerCase(); 61 a = a.replace(":",""); 62 b = b.replace(":",""); 63 64 // Sort Date and Time 65 if(a.includes(":") || b.includes(":") ) { 66 n = ""; 67 a = n.concat(a.substring(6,10),a.substring(3,5),a.substring(0,2),a.substring(11,13),a.substring(14,16)); 68 b = n.concat(b.substring(6,10),a.substring(3,5),b.substring(0,2),b.substring(11,13),b.substring(14,16)); 69 } 70 71 return ( 72 isNaN(a) || isNaN(b) ? a > b : +a > +b 73 ) ? inverse ? -1 : 1 : inverse ? 1 : -1; 74 }, function() { 75 return this.parentNode; 76 }); 77 inverse = !inverse; 78} 79 80 81// ----------------------------------------------------------------------------- 82// Show/Hide Filter Options 83// ----------------------------------------------------------------------------- 84 85jQuery('.report-filter-toggle').click(function() { 86 jQuery(this).closest('.report-filter').find('.report-filter-content').slideToggle(); 87}); 88jQuery('.report-filter-clear').click(function() { 89 jQuery(this).closest('.report-container').find('.report-table .report-body tr').each(function() { 90 jQuery(this).fadeIn(); 91 if(jQuery(this).hasClass('filterable')) { 92 // do nothing 93 } else { 94 jQuery(this).addClass('filterable'); 95 } 96 }); 97 jQuery(this).closest('.report-filter').find('.keyword-filter').val(''); 98 jQuery(this).closest('.report-filter').find('.report-keyword-filter .clear').removeClass('visible'); 99 jQuery(this).closest('.report-filter').find('select').each(function() { 100 jQuery(this).prop('selectedIndex', 0); 101 }); 102}); 103 104// ----------------------------------------------------------------------------- 105// Filter Reports with SELECT 106// ----------------------------------------------------------------------------- 107 108jQuery(".report-filter select").change(function(){ 109 //jQuery(this).closest('.report-keyword-filter').find('.keyword-filter').val(''); 110 var filter = jQuery(this).val().toLowerCase(); 111 jQuery(".report-filter select").not(this).each(function() { 112 jQuery(this).prop('selectedIndex', 0); 113 }); 114 jQuery(this).closest('.report-filter-content').find('.keyword-filter').val(''); 115 jQuery(this).closest('.report-filter-content').find('.report-keyword-filter .clear').removeClass('visible'); 116 if(jQuery(this).hasClass('push-status-filter')) { 117 jQuery(this).closest('.report-container').find('.report-table .report-body tr').each(function() { 118 if(jQuery(this).find('td:nth-child(3)').text().toLowerCase().indexOf(filter) > -1){ 119 jQuery(this).fadeIn(); 120 if(jQuery(this).hasClass('filterable')) { 121 // do nothing 122 } else { 123 jQuery(this).addClass('filterable'); 124 } 125 } else { 126 jQuery(this).fadeOut(); 127 jQuery(this).removeClass('filterable'); 128 } 129 }); 130 } else { 131 jQuery(this).closest('.report-container').find('.report-table .report-body tr').each(function() { 132 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 133 jQuery(this).fadeIn(); 134 if(jQuery(this).hasClass('filterable')) { 135 // do nothing 136 } else { 137 jQuery(this).addClass('filterable'); 138 } 139 } else { 140 jQuery(this).fadeOut(); 141 jQuery(this).removeClass('filterable'); 142 } 143 }); 144 } 145 146}); 147 148// ----------------------------------------------------------------------------- 149// Filter Moderation with SELECT 150// ----------------------------------------------------------------------------- 151 152jQuery(window).load(function() { 153 if(jQuery('body').hasClass("user-backend")) { 154 if(jQuery(".mod-filter").length > 0) { 155 var filter = jQuery(".mod-filter select").val().toLowerCase(); 156 if(filter == "mod-all"){ 157 jQuery(".mod-filter select").closest('.units').find('.unit').each(function() { 158 jQuery(this).fadeIn(); 159 }); 160 jQuery(".mod-filter select").closest('.comments').find('.comment').each(function() { 161 jQuery(this).fadeIn(); 162 }); 163 } else { 164 jQuery(".mod-filter select").closest('.units').find('.unit').each(function() { 165 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 166 jQuery(this).fadeIn(); 167 } else { 168 jQuery(this).fadeOut(); 169 } 170 }); 171 jQuery(".mod-filter select").closest('.comments').find('.comment').each(function() { 172 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 173 jQuery(this).fadeIn(); 174 } else { 175 jQuery(this).fadeOut(); 176 } 177 }); 178 } 179 } 180 181 } 182 183}); 184 185jQuery(".mod-filter select").change(function(){ 186 var filter = jQuery(this).val().toLowerCase(); 187 jQuery(this).closest('.sort-options').find('#keyword-filter').val(''); 188 jQuery(this).closest('.sort-options').find('.filter .clear').removeClass('visible'); 189 if(filter == "mod-all"){ 190 jQuery(this).closest('.units').find('.unit').each(function() { 191 jQuery(this).fadeIn(); 192 }); 193 jQuery(this).closest('.comments').find('.comment').each(function() { 194 jQuery(this).fadeIn(); 195 }); 196 } else { 197 jQuery(this).closest('.units').find('.unit').each(function() { 198 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 199 jQuery(this).fadeIn(); 200 } else { 201 jQuery(this).fadeOut(); 202 } 203 }); 204 jQuery(this).closest('.comments').find('.comment').each(function() { 205 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 206 jQuery(this).fadeIn(); 207 } else { 208 jQuery(this).fadeOut(); 209 } 210 }); 211 } 212}); 213 214// ----------------------------------------------------------------------------- 215// Filter Print-Moderation with Tenant-SELECT 216// ----------------------------------------------------------------------------- 217 218jQuery(window).load(function() { 219 if(jQuery('body').hasClass("user-backend")) { 220 if(jQuery("#tenant-select-moderation").length > 0) { 221 var filter = jQuery("#tenant-select-moderation").val(); 222 if(filter == "Alle"){ 223 jQuery("#tenant-select-moderation").closest('.content').find('.message-card').each(function() { 224 jQuery(this).fadeIn(); 225 }); 226 } else { 227 jQuery("#tenant-select-moderation").closest('.content').find('.message-card').each(function() { 228 if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){ 229 jQuery(this).fadeIn(); 230 } else { 231 jQuery(this).fadeOut(); 232 } 233 }); 234 } 235 } 236 237 } 238 239}); 240 241// ----------------------------------------------------------------------------- 242// Filter Reports with INPUT TEXT 243// ----------------------------------------------------------------------------- 244 245jQuery(".keyword-filter").keyup(function() { 246 var keyword = jQuery(this).val().toLowerCase(); 247 248 jQuery(this).closest('.report-container').find('.report-table .report-body tr.filterable').each(function() { 249 if(jQuery(this).text().toLowerCase().indexOf(keyword) > -1) { 250 jQuery(this).fadeIn(); 251 } else { 252 jQuery(this).fadeOut(); 253 } 254 }); 255 if(jQuery(this).val()) { 256 jQuery(this).closest('.report-keyword-filter').find('.clear').addClass('visible'); 257 } else if(jQuery(this).val('')) { 258 jQuery(this).closest('.report-keyword-filter').find('.clear').removeClass('visible'); 259 } else { 260 jQuery(this).closest('.report-keyword-filter').find('.clear').removeClass('visible'); 261 } 262}); 263jQuery('.clear').click(function() { 264 jQuery(this).closest('.report-keyword-filter').find('.keyword-filter').val(''); 265 jQuery(this).removeClass('visible'); 266 var keyword = jQuery(this).val().toLowerCase(); 267 jQuery(this).closest('.report-container').find('.report-table .report-body tr').each(function() { 268 jQuery(this).fadeIn(); 269 }); 270 localStorage.setItem('keywordFilter',''); 271}); 272 273// ----------------------------------------------------------------------------- 274// Set member to Workflow 275// --------------------------------------------------------------------------- 276jQuery(".members").change(function(){ 277 var userID = $(this).val(); 278 var workflowID = jQuery(this).closest('.report-container .filterable').find('.workflowid').val(); 279 // alert(userID); 280 // alert(workflowID); 281 jQuery(this).css('color','#34a665'); 282 283 jQuery.ajax({ 284 type:'POST', 285 url:'https://'+domain+'/account/reports/setmembers', 286 data:{userID:userID,workflowID:workflowID}, 287 success:function(data){ 288 console.log('Erfolgreich-Members'); 289 if (data == false) { 290 window.location.href = 'https://' + domain + '/account/reports/appointments?upcoming&error&members'; 291 // alert ('das geht nicht'); 292 } 293 }, 294 error:function(error){ 295 console.log('Fehler'); 296 } 297 }); 298 299}); 300 301 302// ----------------------------------------------------------------------------- 303// Send Report Details - Note 304// --------------------------------------------------------------------------- 305jQuery(".sendDetails").click(function(){ 306 var userID = jQuery(this).closest('.report-container .filterable').find('.members').val(); 307 var workflowID = jQuery(this).closest('.report-container .filterable').find('.workflowid').val(); 308 var employeeNote = jQuery(this).closest('.report-container .filterable').find('#employeeNote').val(); 309// alert(userID); 310// alert(workflowID); 311 alert(employeeNote); 312 313 jQuery.ajax({ 314 type:'POST', 315 url:'https://'+domain+'/account/reports/details', 316 data:{userID:userID,workflowID:workflowID,employeeNote:employeeNote}, 317 success:function(data){ 318 console.log('Erfolgreich'); 319 }, 320 error:function(error){ 321 console.log('Fehler'); 322 } 323 }); 324 325}); 326 327 328// ----------------------------------------------------------------------------- 329// Close Appointment - Save the Notice 330// --------------------------------------------------------------------------- 331jQuery(".close-appointment").click(function(){ 332 var id = jQuery(this).data('id'); 333 var notice = jQuery('.report-textarea-'+id).val(); 334 $('.report-textarea-send').val(notice); 335}); 336 337// ----------------------------------------------------------------------------- 338// Confirm Appointment 339// ---------------------------------------------------------------------------
340jQuery(".reportconfirm").click(function(){ 341 var bookingCode = jQuery(this).val(); 342 jQuery.ajax({ 343 type:'POST', 344 url:'https://'+domain+'/account/reports/appointments/activatedirect', 345 data:{bookingCode:bookingCode,employeeNoteSend:'notsave'}, 346 success:function(data){ 347 window.location.href = 'https://' + domain + '/account/reports/appointments?unconfirmed&success'; 348 }, 349 error:function(error){ 350 window.location.href = 'https://' + domain + '/account/reports/appointments?unconfirmed&error'; 351 } 352 }); 353}); 354 355// ----------------------------------------------------------------------------- 356// Filter Dates in Events 357// ----------------------------------------------------------------------------- 358var thdate = jQuery('.table-dates-dc .thdate'), inverse = false; 359 360// Sort Table 361// if(getUrlParameter('event')) { 362// thdate = jQuery('.table-dates-dc .thdate'); 363// sortTableDate(thdate); 364// } 365thdate.click(function() { 366 thdate = $(this) 367 sortTableDate(thdate); 368}); 369 370function sortTableDate(thdate) { 371 var header = thdate, index = header.index(); 372 jQuery('.table-dates-dc th').removeClass('sorted'); 373 jQuery(this).addClass('sorted'); 374 header.closest('table').find('td').filter(function() { 375// header.closest('table').find('td').data('last').filter(function() { 376 return $(this).index() === index; 377 }).sortElements(function(a, b){ 378 a = $(a).text(); 379 b = $(b).text(); 380 a = a.toLowerCase(); 381 b = b.toLowerCase(); 382 a = a.replace(":",""); 383 b = b.replace(":",""); 384 385 // Sort Date and Time 386 if(a.includes(":") || b.includes(":") ) { 387 n = ""; 388 a = n.concat(a.substring(6,10),a.substring(3,5),a.substring(0,2),a.substring(11,13),a.substring(14,16)); 389 b = n.concat(b.substring(6,10),a.substring(3,5),b.substring(0,2),b.substring(11,13),b.substring(14,16)); 390 } 391 392 return ( 393 isNaN(a) || isNaN(b) ? a > b : +a > +b 394 ) ? inverse ? -1 : 1 : inverse ? 1 : -1; 395 }, function() { 396 return this.parentNode; 397 }); 398 inverse = !inverse; 399}
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.