PageSourceSearch

https://palling.de/_Resources/Static/Packages/DigiPublica.Platform…/JavaScript/reports.js?bust=d8ff0c3e

js palling.de collected 2026-10-02 20:19:33 UTC 12,397 bytes, 352 lines download raw bytes

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  jQuery(this).closest('.report-container').find('.report-table .report-body tr .display-no').each(function() {
117		if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){
118			jQuery(this).parents('tr').fadeIn();
119      if(jQuery(this).parents('tr').hasClass('filterable')) {
120        // do nothing
121      } else {
122        jQuery(this).parents('tr').addClass('filterable');
123      }
124		} else {
125			jQuery(this).parents('tr').fadeOut();
126      jQuery(this).parents('tr').removeClass('filterable');
127		}
128	});
129});
130
131// -----------------------------------------------------------------------------
132// Filter Moderation with SELECT
133// -----------------------------------------------------------------------------
134
135jQuery(window).load(function() {
136  if(jQuery('body').hasClass("user-backend")) {
137    var filter = jQuery(".mod-filter select").val().toLowerCase();
138    if(filter == "mod-all"){
139      jQuery(".mod-filter select").closest('.units').find('.unit').each(function() {
140        jQuery(this).fadeIn();
141      });
142      jQuery(".mod-filter select").closest('.comments').find('.comment').each(function() {
143        jQuery(this).fadeIn();
144      });
145    } else {
146      jQuery(".mod-filter select").closest('.units').find('.unit').each(function() {
147        if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){
148          jQuery(this).fadeIn();
149        } else {
150          jQuery(this).fadeOut();
151        }
152      });
153      jQuery(".mod-filter select").closest('.comments').find('.comment').each(function() {
154        if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){
155          jQuery(this).fadeIn();
156        } else {
157          jQuery(this).fadeOut();
158        }
159      });
160    }
161  }
162    
163});
164
165jQuery(".mod-filter select").change(function(){
166	var filter = jQuery(this).val().toLowerCase();
167  jQuery(this).closest('.sort-options').find('#keyword-filter').val('');
168	jQuery(this).closest('.sort-options').find('.filter .clear').removeClass('visible');
169  if(filter == "mod-all"){
170    jQuery(this).closest('.units').find('.unit').each(function() {
171      jQuery(this).fadeIn();
172    });
173    jQuery(this).closest('.comments').find('.comment').each(function() {
174      jQuery(this).fadeIn();
175    });
176  } else {
177    jQuery(this).closest('.units').find('.unit').each(function() {
178      if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){
179        jQuery(this).fadeIn();
180      } else {
181        jQuery(this).fadeOut();
182      }
183    });
184    jQuery(this).closest('.comments').find('.comment').each(function() {
185      if(jQuery(this).text().toLowerCase().indexOf(filter) > -1){
186        jQuery(this).fadeIn();
187      } else {
188        jQuery(this).fadeOut();
189      }
190    });
191  }
192});
193
194// -----------------------------------------------------------------------------
195// Filter Reports with INPUT TEXT
196// -----------------------------------------------------------------------------
197
198jQuery(".keyword-filter").keyup(function() {
199  var keyword = jQuery(this).val().toLowerCase();
200
201  jQuery(this).closest('.report-container').find('.report-table .report-body tr.filterable').each(function() {
202    if(jQuery(this).text().toLowerCase().indexOf(keyword) > -1) {
203      jQuery(this).fadeIn();
204    } else {
205      jQuery(this).fadeOut();
206    }
207  });
208	if(jQuery(this).val()) {
209		jQuery(this).closest('.report-keyword-filter').find('.clear').addClass('visible');
210	} else if(jQuery(this).val('')) {
211		jQuery(this).closest('.report-keyword-filter').find('.clear').removeClass('visible');
212	} else {
213		jQuery(this).closest('.report-keyword-filter').find('.clear').removeClass('visible');
214	}
215});
216jQuery('.clear').click(function() {
217	jQuery(this).closest('.report-keyword-filter').find('.keyword-filter').val('');
218	jQuery(this).removeClass('visible');
219	var keyword = jQuery(this).val().toLowerCase();
220  jQuery(this).closest('.report-container').find('.report-table .report-body tr').each(function() {
221    jQuery(this).fadeIn();
222  });
223  localStorage.setItem('keywordFilter','');  
224});
225
226// -----------------------------------------------------------------------------
227// Set member to Workflow
228// ---------------------------------------------------------------------------
229jQuery(".members").change(function(){
230  var userID = $(this).val();
231  var workflowID = jQuery(this).closest('.report-container .filterable').find('.workflowid').val();
232  // alert(userID);
233  // alert(workflowID);
234  jQuery(this).css('color','#34a665');
235
236  jQuery.ajax({
237    type:'POST',
238    url:'https://'+domain+'/account/reports/setmembers',
239    data:{userID:userID,workflowID:workflowID},
240    success:function(data){
241      console.log('Erfolgreich-Members');    
242      if (data == false) {
243       window.location.href = 'https://' + domain + '/account/reports/appointments?upcoming&error&members';
244      // alert ('das geht nicht');
245      }       
246    },
247    error:function(error){
248      console.log('Fehler');     
249    }
250  });
251
252});
253
254
255// -----------------------------------------------------------------------------
256// Send Report Details - Note
257// ---------------------------------------------------------------------------
258jQuery(".sendDetails").click(function(){
259  var userID       = jQuery(this).closest('.report-container .filterable').find('.members').val();
260  var workflowID   = jQuery(this).closest('.report-container .filterable').find('.workflowid').val();
261  var employeeNote = jQuery(this).closest('.report-container .filterable').find('#employeeNote').val();
262//  alert(userID);
263//  alert(workflowID);
264 alert(employeeNote);
265
266  jQuery.ajax({
267    type:'POST',
268    url:'https://'+domain+'/account/reports/details',
269    data:{userID:userID,workflowID:workflowID,employeeNote:employeeNote},
270    success:function(data){
271      console.log('Erfolgreich');
272    },
273    error:function(error){
274      console.log('Fehler');    
275    }
276  });
277
278});
279
280
281// -----------------------------------------------------------------------------
282// Close Appointment - Save the Notice
283// ---------------------------------------------------------------------------
284jQuery(".close-appointment").click(function(){
285  var id = jQuery(this).data('id'); 
286  var notice = jQuery('.report-textarea-'+id).val();
287  $('.report-textarea-send').val(notice);
288});
289
290// -----------------------------------------------------------------------------
291// Confirm Appointment
292// ---------------------------------------------------------------------------
293jQuery(".reportconfirm").click(function(){ 
294  var bookingCode = jQuery(this).val();
295  jQuery.ajax({
296    type:'POST',
297    url:'https://'+domain+'/account/reports/appointments/activatedirect',
298    data:{bookingCode:bookingCode,employeeNoteSend:'notsave'},
299    success:function(data){
300      window.location.href = 'https://'  + domain + '/account/reports/appointments?unconfirmed&success';   
301    },
302    error:function(error){
303      window.location.href = 'https://'  + domain + '/account/reports/appointments?unconfirmed&error';   
304    }
305  });  
306});
307
308// -----------------------------------------------------------------------------
309// Filter Dates in Events
310// -----------------------------------------------------------------------------
311var thdate = jQuery('.table-dates-dc .thdate'), inverse = false;
312
313// Sort Table
314// if(getUrlParameter('event')) {
315//   thdate = jQuery('.table-dates-dc .thdate');
316//   sortTableDate(thdate);
317// }
318thdate.click(function() {  
319  thdate = $(this)
320  sortTableDate(thdate);
321});
322
323function sortTableDate(thdate) {
324  var header = thdate, index = header.index();
325  jQuery('.table-dates-dc th').removeClass('sorted');
326  jQuery(this).addClass('sorted');
327  header.closest('table').find('td').filter(function() {
328//  header.closest('table').find('td').data('last').filter(function() {
329    return $(this).index() === index;
330  }).sortElements(function(a, b){
331    a = $(a).text();
332    b = $(b).text();
333    a = a.toLowerCase();
334    b = b.toLowerCase(); 
335    a = a.replace(":","");
336    b = b.replace(":","");
337   
338    // Sort Date and Time
339    if(a.includes(":") || b.includes(":") ) {
340      n = "";
341      a =  n.concat(a.substring(6,10),a.substring(3,5),a.substring(0,2),a.substring(11,13),a.substring(14,16));
342      b =  n.concat(b.substring(6,10),a.substring(3,5),b.substring(0,2),b.substring(11,13),b.substring(14,16));
343    }
344
345    return (
346      isNaN(a) || isNaN(b) ? a > b : +a > +b
347    ) ? inverse ? -1 : 1 : inverse ? 1 : -1;
348  }, function() {
349    return this.parentNode;
350  });
351  inverse = !inverse;
352}

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.