|
@@ -214,12 +214,12 @@
|
|
|
const ctx = canvas.getContext('2d');
|
|
const ctx = canvas.getContext('2d');
|
|
|
|
|
|
|
|
const incomeGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
const incomeGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
|
- incomeGradient.addColorStop(0, 'rgba(0, 184, 148, 0.8)');
|
|
|
|
|
- incomeGradient.addColorStop(1, 'rgba(0, 184, 148, 0.2)');
|
|
|
|
|
|
|
+ incomeGradient.addColorStop(0, 'rgba(0, 184, 148, 1)');
|
|
|
|
|
+ incomeGradient.addColorStop(1, 'rgba(0, 184, 148, 1)');
|
|
|
|
|
|
|
|
const expenseGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
const expenseGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
|
- expenseGradient.addColorStop(0, 'rgba(255, 107, 107, 0.8)');
|
|
|
|
|
- expenseGradient.addColorStop(1, 'rgba(255, 107, 107, 0.2)');
|
|
|
|
|
|
|
+ expenseGradient.addColorStop(0, 'rgba(255, 107, 107, 1)');
|
|
|
|
|
+ expenseGradient.addColorStop(1, 'rgba(255, 107, 107, 1)');
|
|
|
|
|
|
|
|
this.charts[chartId] = new Chart(ctx, {
|
|
this.charts[chartId] = new Chart(ctx, {
|
|
|
type: 'bar',
|
|
type: 'bar',
|
|
@@ -259,7 +259,7 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
- backgroundColor: 'rgba(255, 255, 255, 0.95)',
|
|
|
|
|
|
|
+ backgroundColor: 'rgba(255, 255, 255,1)',
|
|
|
titleColor: '#212529',
|
|
titleColor: '#212529',
|
|
|
bodyColor: '#495057',
|
|
bodyColor: '#495057',
|
|
|
borderColor: '#e9ecef',
|
|
borderColor: '#e9ecef',
|
|
@@ -400,7 +400,6 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // Create the causals table
|
|
|
|
|
this.updateCausalsTable(causalsData, dataValues, total);
|
|
this.updateCausalsTable(causalsData, dataValues, total);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -458,30 +457,61 @@
|
|
|
gradient.addColorStop(0, 'rgba(59, 91, 219, 0.3)');
|
|
gradient.addColorStop(0, 'rgba(59, 91, 219, 0.3)');
|
|
|
gradient.addColorStop(1, 'rgba(59, 91, 219, 0.05)');
|
|
gradient.addColorStop(1, 'rgba(59, 91, 219, 0.05)');
|
|
|
|
|
|
|
|
- this.charts[chartId] = new Chart(ctx, {
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- data: {
|
|
|
|
|
- labels: membersData.labels,
|
|
|
|
|
- datasets: [{
|
|
|
|
|
- label: 'Membri Tesserati',
|
|
|
|
|
- data: membersData.datasets[0].data,
|
|
|
|
|
- borderColor: '#3b5bdb',
|
|
|
|
|
|
|
+ const processedDatasets = membersData.datasets.map((dataset, index) => {
|
|
|
|
|
+ if (dataset.label === 'Totale Membri Tesserati') {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...dataset,
|
|
|
backgroundColor: gradient,
|
|
backgroundColor: gradient,
|
|
|
|
|
+ borderColor: '#3b5bdb',
|
|
|
borderWidth: 3,
|
|
borderWidth: 3,
|
|
|
- fill: true,
|
|
|
|
|
- tension: 0.4,
|
|
|
|
|
pointBackgroundColor: '#3b5bdb',
|
|
pointBackgroundColor: '#3b5bdb',
|
|
|
pointBorderColor: '#ffffff',
|
|
pointBorderColor: '#ffffff',
|
|
|
pointBorderWidth: 2,
|
|
pointBorderWidth: 2,
|
|
|
pointRadius: 6,
|
|
pointRadius: 6,
|
|
|
- pointHoverRadius: 8
|
|
|
|
|
- }]
|
|
|
|
|
|
|
+ pointHoverRadius: 8,
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ order: 1,
|
|
|
|
|
+ fill: true
|
|
|
|
|
+ };
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ ...dataset,
|
|
|
|
|
+ borderWidth: 2,
|
|
|
|
|
+ pointRadius: 4,
|
|
|
|
|
+ pointHoverRadius: 6,
|
|
|
|
|
+ pointBorderColor: '#ffffff',
|
|
|
|
|
+ pointBorderWidth: 1,
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ order: 2,
|
|
|
|
|
+ fill: false,
|
|
|
|
|
+ backgroundColor: 'transparent'
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ this.charts[chartId] = new Chart(ctx, {
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ data: {
|
|
|
|
|
+ labels: membersData.labels,
|
|
|
|
|
+ datasets: processedDatasets
|
|
|
},
|
|
},
|
|
|
options: {
|
|
options: {
|
|
|
responsive: true,
|
|
responsive: true,
|
|
|
maintainAspectRatio: false,
|
|
maintainAspectRatio: false,
|
|
|
|
|
+ interaction: {
|
|
|
|
|
+ mode: 'index',
|
|
|
|
|
+ intersect: false,
|
|
|
|
|
+ },
|
|
|
plugins: {
|
|
plugins: {
|
|
|
- legend: { display: false },
|
|
|
|
|
|
|
+ legend: {
|
|
|
|
|
+ display: true,
|
|
|
|
|
+ position: 'top',
|
|
|
|
|
+ labels: {
|
|
|
|
|
+ usePointStyle: true,
|
|
|
|
|
+ padding: 15,
|
|
|
|
|
+ font: { weight: '500', size: 12 }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
backgroundColor: 'rgba(255, 255, 255, 0.95)',
|
|
backgroundColor: 'rgba(255, 255, 255, 0.95)',
|
|
|
titleColor: '#212529',
|
|
titleColor: '#212529',
|
|
@@ -490,18 +520,31 @@
|
|
|
borderWidth: 1,
|
|
borderWidth: 1,
|
|
|
cornerRadius: 8,
|
|
cornerRadius: 8,
|
|
|
callbacks: {
|
|
callbacks: {
|
|
|
|
|
+ title: function (context) {
|
|
|
|
|
+ return 'Stagione: ' + context[0].label;
|
|
|
|
|
+ },
|
|
|
label: function (context) {
|
|
label: function (context) {
|
|
|
- return 'Tesserati: ' + context.parsed.y;
|
|
|
|
|
|
|
+ return context.dataset.label + ': ' + context.parsed.y;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
scales: {
|
|
scales: {
|
|
|
- x: { grid: { display: false } },
|
|
|
|
|
|
|
+ x: {
|
|
|
|
|
+ grid: { display: false },
|
|
|
|
|
+ ticks: {
|
|
|
|
|
+ font: { weight: '500' }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
y: {
|
|
y: {
|
|
|
beginAtZero: true,
|
|
beginAtZero: true,
|
|
|
grid: { color: 'rgba(0, 0, 0, 0.05)' },
|
|
grid: { color: 'rgba(0, 0, 0, 0.05)' },
|
|
|
- ticks: { precision: 0 }
|
|
|
|
|
|
|
+ ticks: {
|
|
|
|
|
+ precision: 0,
|
|
|
|
|
+ callback: function (value) {
|
|
|
|
|
+ return Math.floor(value); // Ensure integer values
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
animation: {
|
|
animation: {
|
|
@@ -511,7 +554,6 @@
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
-
|
|
|
|
|
updateMonthlyTable: function (monthlyData) {
|
|
updateMonthlyTable: function (monthlyData) {
|
|
|
const container = document.getElementById('monthly-table');
|
|
const container = document.getElementById('monthly-table');
|
|
|
if (!container) return;
|
|
if (!container) return;
|
|
@@ -604,7 +646,6 @@
|
|
|
const seasonKey = '{{ str_replace('-', '', $seasonFilter) }}';
|
|
const seasonKey = '{{ str_replace('-', '', $seasonFilter) }}';
|
|
|
console.log('Selected course:', selectedCourse, 'for season:', seasonFilter);
|
|
console.log('Selected course:', selectedCourse, 'for season:', seasonFilter);
|
|
|
|
|
|
|
|
- // Add this check at the beginning
|
|
|
|
|
if (!selectedCourse || selectedCourse.trim() === '') {
|
|
if (!selectedCourse || selectedCourse.trim() === '') {
|
|
|
console.log('No course selected, skipping chart creation');
|
|
console.log('No course selected, skipping chart creation');
|
|
|
return;
|
|
return;
|
|
@@ -649,7 +690,7 @@
|
|
|
y: {
|
|
y: {
|
|
|
beginAtZero: true,
|
|
beginAtZero: true,
|
|
|
grid: {
|
|
grid: {
|
|
|
- color: 'rgba(0, 0, 0, 0.1)',
|
|
|
|
|
|
|
+ color: 'rgba(0, 0, 0, 1)',
|
|
|
borderDash: [5, 5]
|
|
borderDash: [5, 5]
|
|
|
},
|
|
},
|
|
|
ticks: {
|
|
ticks: {
|
|
@@ -670,7 +711,7 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
- backgroundColor: 'rgba(255, 255, 255, 0.95)',
|
|
|
|
|
|
|
+ backgroundColor: 'rgba(255, 255, 255, 1)',
|
|
|
titleColor: '#212529',
|
|
titleColor: '#212529',
|
|
|
bodyColor: '#495057',
|
|
bodyColor: '#495057',
|
|
|
borderColor: '#e9ecef',
|
|
borderColor: '#e9ecef',
|
|
@@ -776,14 +817,12 @@
|
|
|
const ctx = canvasElement.getContext('2d');
|
|
const ctx = canvasElement.getContext('2d');
|
|
|
|
|
|
|
|
const earnedGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
const earnedGradient = ctx.createLinearGradient(0, 0, 0, 400);
|
|
|
- earnedGradient.addColorStop(0, 'rgba(16, 185, 129, 0.9)');
|
|
|
|
|
- earnedGradient.addColorStop(1, 'rgba(16, 185, 129, 0.3)');
|
|
|
|
|
|
|
+ earnedGradient.addColorStop(0, 'rgba(16, 185, 129, 1)');
|
|
|
|
|
+ earnedGradient.addColorStop(1, 'rgba(16, 185, 129, 1)');
|
|
|
|
|
|
|
|
const totalData = courseData.datasets.find(d => d.label === 'Pagamenti Attesi')?.data || [];
|
|
const totalData = courseData.datasets.find(d => d.label === 'Pagamenti Attesi')?.data || [];
|
|
|
const earnedData = courseData.datasets.find(d => d.label === 'Pagamenti Effettuati')?.data || [];
|
|
const earnedData = courseData.datasets.find(d => d.label === 'Pagamenti Effettuati')?.data || [];
|
|
|
|
|
|
|
|
- // REMOVED: verticalMissingLinesPlugin completely
|
|
|
|
|
-
|
|
|
|
|
this.charts[chartId] = new Chart(ctx, {
|
|
this.charts[chartId] = new Chart(ctx, {
|
|
|
type: 'bar',
|
|
type: 'bar',
|
|
|
data: {
|
|
data: {
|
|
@@ -881,7 +920,6 @@
|
|
|
usePointStyle: true,
|
|
usePointStyle: true,
|
|
|
padding: 15,
|
|
padding: 15,
|
|
|
font: { weight: '500', size: 12 },
|
|
font: { weight: '500', size: 12 },
|
|
|
- // REMOVED: custom generateLabels function that added red dashed line legend
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
tooltip: {
|
|
tooltip: {
|
|
@@ -981,7 +1019,6 @@
|
|
|
const total = parseFloat(row.total) || 0;
|
|
const total = parseFloat(row.total) || 0;
|
|
|
const delta = Math.max(0, total - earned);
|
|
const delta = Math.max(0, total - earned);
|
|
|
|
|
|
|
|
- // Fix percentage calculation and display logic
|
|
|
|
|
let percentage = 0;
|
|
let percentage = 0;
|
|
|
let percentageDisplay = '—';
|
|
let percentageDisplay = '—';
|
|
|
let percentageClass = 'neutral';
|
|
let percentageClass = 'neutral';
|