[FIX] CHART: 'ischartempty' not defined error
This commit is contained in:
@@ -1,5 +1,21 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
//Hired candididates recruitment wise chart
|
//Hired candididates recruitment wise chart
|
||||||
|
function isChartEmpty(chartData) {
|
||||||
|
if (!chartData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < chartData.length; i++) {
|
||||||
|
|
||||||
|
if (chartData[i]) {
|
||||||
|
const hasNonZeroValues = chartData.some((value) => value !== 0);
|
||||||
|
if (hasNonZeroValues) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/onboarding/hired-candidate-chart",
|
url: "/onboarding/hired-candidate-chart",
|
||||||
|
|||||||
@@ -12,18 +12,19 @@ var objectiveStatusData = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
function isChartEmpty(chartData) {
|
function isChartEmpty(chartData) {
|
||||||
if (!chartData) {
|
if (!chartData) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (let i = 0; i < chartData.length; i++) {
|
for (let i = 0; i < chartData.length; i++) {
|
||||||
if (chartData[i] && chartData[i].data) {
|
|
||||||
const hasNonZeroValues = chartData[i].data.some((value) => value !== 0);
|
if (chartData[i]) {
|
||||||
if (hasNonZeroValues) {
|
const hasNonZeroValues = chartData.some((value) => value !== 0);
|
||||||
return false;
|
if (hasNonZeroValues) {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// chart constructor
|
// chart constructor
|
||||||
@@ -73,7 +74,7 @@ $.ajax({
|
|||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
},
|
},
|
||||||
success: (response) => {
|
success: (response) => {
|
||||||
if (isChartEmpty(response.data)) {
|
if (isChartEmpty(response.objective_value)) {
|
||||||
$("#objectiveChart")
|
$("#objectiveChart")
|
||||||
.parent()
|
.parent()
|
||||||
.html(
|
.html(
|
||||||
@@ -174,7 +175,7 @@ $.ajax({
|
|||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
},
|
},
|
||||||
success: (response) => {
|
success: (response) => {
|
||||||
if (isChartEmpty(response.data)) {
|
if (isChartEmpty(response.key_result_value)) {
|
||||||
$("#keyResultChart")
|
$("#keyResultChart")
|
||||||
.parent()
|
.parent()
|
||||||
.html(
|
.html(
|
||||||
@@ -274,7 +275,7 @@ $.ajax({
|
|||||||
"X-Requested-With": "XMLHttpRequest",
|
"X-Requested-With": "XMLHttpRequest",
|
||||||
},
|
},
|
||||||
success: (response) => {
|
success: (response) => {
|
||||||
if (isChartEmpty(response.data)) {
|
if (isChartEmpty(response.feedback_value)) {
|
||||||
$("#feedbackChart")
|
$("#feedbackChart")
|
||||||
.parent()
|
.parent()
|
||||||
.html(
|
.html(
|
||||||
|
|||||||
Reference in New Issue
Block a user