jQuery(function() { jQuery("#clock_in").datetimepicker({ format: "Y/m/d g:i:s A", formatTime: "g:i A" }); jQuery("#clock_out").datetimepicker({ format: "Y/m/d g:i:s A", formatTime: "g:i A" }); if (jQuery("#aio_tc_lite_news").length > 0){ jQuery("#aio_tc_lite_news").steps({ headerTag: "h3", bodyTag: "section", transitionEffect: "slideLeft", stepsOrientation: "vertical", autoFocus: true, onFinished: function () { window.location = "?page=aio-tc-lite"; } }); } jQuery("#aio_generate_report").click(function(e) { e.preventDefault(); var nonce = jQuery(this).attr("date-nonce"); var report_action = "generate_report"; jQuery("#aio-reports-results").html('
').show(); jQuery.ajax({ type: "post", dataType: "json", url: timeClockAdminAjax.ajaxurl, data: { action: "aio_time_clock_admin_js", report_action: report_action, aio_pp_start_date: jQuery("#aio_pp_start_date").val(), aio_pp_end_date: jQuery("#aio_pp_end_date").val(), employee: jQuery("#employee").val(), nonce: nonce }, success: function(data) { if (data["response"] == "success") { var shiftRows = data["shifts"]["shift_array"]; jQuery("#aio-reports-results").html(""); var reportHtml = '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ''; var count = 0; shiftRows.forEach(function (item) { count++; var alternate_class = ""; if (isEven(count)) { alternate_class = 'alternate'; } reportHtml += '' + '' + '' + '' + '' + '' + ''; }); reportHtml += '' + '
NameClock InClock OutShift TotalOptions
NameClock InClock OutShift TotalOptions
' + item["last_name"] + ', ' + item["first_name"] + '' + item["employee_clock_in_time"] + '' + item["employee_clock_out_time"] + '' + item["shift_sum"] + '
'; reportHtml += '
' + 'Total Shifts: ' + data["shifts"]["shift_count"] + '
' + 'Total Shift Time: ' + data["shifts"]["shift_total_time"] + '
' + '
' + '
'; jQuery("#aio-reports-results").html(reportHtml); jQuery("#aio-reports-results").show(); } } }); }); }); function editClockTime(type) { if (type == "in") { jQuery("#clock_in").show("fast"); } if (type == "out") { jQuery("#clock_out").show("fast"); } } function editEmployee() { jQuery("#employee_id").show("fast"); } function isEven(number) { if (number % 2 == 0) { return true; } // even else { return false; } // odd }