!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=10)}({10:function(t,e,r){t.exports=r("46Be")},"46Be":function(t,e){$("#userId").select2({width:"110%",placeholder:"Select User"});var r=$("#time_range"),n=moment(),o=n.clone().startOf("month"),a=n.clone().endOf("month"),s=$("#userId").val(),d=!1;$(window).on("load",(function(){loadUserWorkReport(o.format("YYYY-MM-D  H:mm:ss"),a.format("YYYY-MM-D  H:mm:ss"),s)})),r.on("apply.daterangepicker",(function(t,e){d=!0,o=e.startDate.format("YYYY-MM-D  H:mm:ss"),a=e.endDate.format("YYYY-MM-D  H:mm:ss"),loadUserWorkReport(o,a,s)})),window.cb=function(t,e){r.find("span").html(t.format("MMM D, YYYY")+" - "+e.format("MMM D, YYYY"))},cb(o,a);var i=moment().startOf("month").subtract(1,"days");r.daterangepicker({startDate:o,endDate:a,opens:"left",showDropdowns:!0,autoUpdateInput:!1,ranges:{Today:[moment(),moment()],"This Week":[moment().startOf("week"),moment().endOf("week")],"Last Week":[moment().startOf("week").subtract(7,"days"),moment().startOf("week").subtract(1,"days")],"This Month":[o,a],"Last Month":[i.clone().startOf("month"),i.clone().endOf("month")]}},cb),$("#userId").on("change",(function(t){t.preventDefault(),s=$("#userId").val();var e=d?o:o.format("YYYY-MM-D  H:mm:ss"),r=d?a:a.format("YYYY-MM-D  H:mm:ss");loadUserWorkReport(e,r,s)})),window.loadUserWorkReport=function(t,e,r){$.ajax({type:"GET",url:userReportUrl,dataType:"json",data:{start_date:t,end_date:e,user_id:r},cache:!1}).done(prepareUserWorkReport)},window.prepareUserWorkReport=function(t){$("#daily-work-report").html("");var e=t.data;if(0===e.totalRecords)return $("#work-report-container").html(""),$("#work-report-container").append('<div align="center" class="no-record">No Records Found</div>'),!0;$("#work-report-container").html(""),$("#work-report-container").append('<canvas id="daily-work-report"></canvas>');var r={labels:e.date,datasets:e.data,total_hrs:e.totalHrs},n=document.getElementById("daily-work-report").getContext("2d");n.canvas.style.height="400px",n.canvas.style.width="100%",window.myBar=new Chart(n,{type:"bar",data:r,options:{title:{display:!1,text:e.label},tooltips:{mode:"index",callbacks:{title:function(t,e){var r=t[0].label;return r+" - "+roundToQuarterHour(e.total_hrs[r])},label:function(t,e){var r=roundToQuarterHour(t.yLabel);if("0min"===r)return"";var n=e.datasets[t.datasetIndex].label||"";return n&&(n+=": "),n+r}}},responsive:!1,maintainAspectRatio:!1,scales:{xAxes:[{stacked:!0}],yAxes:[{stacked:!0,scaleLabel:{display:!0,labelString:"Hours"}}]}}})},window.roundToQuarterHour=function(t){var e=t.toString().split("."),r=parseInt(e[0]),n=Math.floor(60*t)-Math.floor(60*r);return 0===r?n+"min":n>0?r+"hr "+n+"min":r+"hr"},$(document).ready((function(){var t=$(".range_inputs > button.applyBtn");$(document).on("click",".ranges li",(function(){"Custom Range"===$(this).data("range-key")?t.css("display","initial"):t.css("display","none")})),t.css("display","none")}))}});