| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/static/dashboard/ |
Upload File : |
$(document).ready(function () {
//Todays leave count department wise chart
if (document.getElementById("overAllLeave")){
var myChart1 = document.getElementById("overAllLeave").getContext("2d");
var overAllLeave = new Chart(myChart1, {
type: "doughnut",
data: {
labels: [],
datasets: [
{
label: "Leave count",
data: [],
backgroundColor: null,
},
],
},
options: {
responsive: true,
maintainAspectRatio: false,
onClick: (e, activeEls) => {
let datasetIndex = activeEls[0].datasetIndex;
let dataIndex = activeEls[0].index;
let datasetLabel = e.chart.data.datasets[datasetIndex].label;
let value = e.chart.data.datasets[datasetIndex].data[dataIndex];
let label = e.chart.data.labels[dataIndex];
params =`?department_name=${label}&overall_leave=${$("#overAllLeaveSelect").val()}`;
window.location.href = "/leave/request-view" + params;
},
},
plugins: [
{
afterRender: (chart) => emptyChart(chart),
},
],
});
}
$.ajax({
type: "GET",
url: "/leave/overall-leave?overall_leave=today",
dataType: "json",
success: function (response) {
if (overAllLeave){
overAllLeave.data.labels = response.labels;
overAllLeave.data.datasets[0].data = response.data;
overAllLeave.data.datasets[0].backgroundColor = null;
overAllLeave.update();
}
},
});
$(document).on("change", "#overAllLeaveSelect", function () {
var selected = $(this).val();
$.ajax({
type: "GET",
url: `/leave/overall-leave?overall_leave=${selected}`,
dataType: "json",
success: function (response) {
overAllLeave.data.labels = response.labels;
overAllLeave.data.datasets[0].data = response.data;
overAllLeave.data.datasets[0].backgroundColor = null;
overAllLeave.update();
},
});
});
//Today leave employees chart
});