praiadeseselle/wire/modules/Process/ProcessLogger/ProcessLogger.min.js
2022-03-08 15:55:41 +01:00

1 line
No EOL
2.2 KiB
JavaScript

var ProcessLogger={timer:null,pageNum:1,submitFilters:function(b){if(typeof b=="undefined"){b=false}var a={q:$("#Inputfield_q").val(),date_from:$("#Inputfield_date_from").val(),date_to:$("#Inputfield_date_to").val(),time:0};if(b){a.time=$("#ProcessLogPage").attr("data-time")}ProcessLogger.startSpinner(!b);$.getJSON("./",a,function(c){if(!b||(c.qty>-1&&ProcessLogger.pageNum==1)){$("#ProcessLogEntries").html(c.out).effect("highlight",500)}if(c.note.length>0){if(typeof Notifications!="undefined"){Notifications.message(c.note,"","tree")}$("#ProcessLogHeadline").find(".notes").html("+ "+c.note)}ProcessLogger.setupLogEntries();ProcessLogger.stopSpinner(!b);$("#ProcessLogPage").attr("data-time",c.time)})},setupLogEntries:function(){ProcessLogger.pageNum=parseInt($("#ProcessLogPage").attr("data-page"));if(ProcessLogger.timer){clearTimeout(ProcessLogger.timer)}ProcessLogger.timer=setTimeout("ProcessLogger.submitFilters(true)",5000);if(ProcessLogger.pageNum==1){$(".ProcessLogNew").each(function(){var a=$(this).closest("tr");a.hide().fadeIn("normal",function(){a.effect("highlight",1000)});$(this).removeClass("ProcessLogNew")})}},paginationClick:function(){clearTimeout(ProcessLogger.timer);ProcessLogger.startSpinner(true);$.getJSON($(this).attr("href"),function(a){$("#ProcessLogEntries").html(a.out);ProcessLogger.setupLogEntries();ProcessLogger.stopSpinner(true)});return false},startSpinner:function(a){if(typeof a=="undefined"){a=true}if(a){$("#ProcessLogSpinner").addClass("fa-spin fa-spinner").removeClass("fa-tree")}else{$("#FieldsetTools").find("i.fa-sun-o").addClass("fa-spin")}},stopSpinner:function(a){if(typeof a=="undefined"){a=true}if(a){$("#ProcessLogSpinner").removeClass("fa-spin fa-spinner").addClass("fa-tree")}else{$("#FieldsetTools").find("i.fa-sun-o").removeClass("fa-spin")}},filterChange:function(){clearTimeout(ProcessLogger.timer);ProcessLogger.timer=setTimeout("ProcessLogger.submitFilters(false)",500)},init:function(){$("#Inputfield_q").keyup(ProcessLogger.filterChange);$("#Inputfield_date_to, #Inputfield_date_from").change(ProcessLogger.filterChange);$(document).on("click",".MarkupPagerNav a",ProcessLogger.paginationClick);ProcessLogger.setupLogEntries()}};$(document).ready(function(){ProcessLogger.init()});