This commit is contained in:
FabioL 2024-05-17 17:27:14 +02:00
commit 2179e9f30f
2 changed files with 92 additions and 77 deletions

View File

@ -33,38 +33,40 @@ echo '
$start = $_SESSION['period_start'];
$end = $_SESSION['period_end'];
echo '
<div class="card card-warning">
<div class="card-header">
<h4 class="card-title">'.tr('Periodi temporali').'</h4>
<div class="card-tools">
<button class="btn btn-warning btn-sm" onclick="add_calendar()">
<i class="fa fa-plus"></i> '.tr('Aggiungi periodo').'
</button>
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body" id="calendars">
</div>
</div>';
// Fatturato
echo '
<div class="card card-success">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Vendite e acquisti').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<canvas class="card-body" id="fatturato" height="500"></canvas>
<div class="card-body">
<div class="card card-warning collapsed-card">
<div class="card-header">
<h4 class="card-title">'.tr('Periodi temporali').'</h4>
<div class="card-tools">
<button class="btn btn-warning btn-sm" onclick="add_calendar()">
<i class="fa fa-plus"></i> '.tr('Aggiungi periodo').'
</button>
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-plus"></i>
</button>
</div>
</div>
<div class="card-body" id="calendars">
</div>
</div>
<canvas id="fatturato" height="50"></canvas>
</div>
</div>';
// Script per il grafico del fatturato
echo '
<script>
@ -219,7 +221,7 @@ $totale = $dbo->fetchArray('SELECT
echo '
<div class="row">
<div class="col-md-6">
<div class="card card-warning">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('I 20 clienti TOP per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4>
@ -306,7 +308,7 @@ $totale = $dbo->fetchArray('SELECT
echo '
<div class="col-md-6">
<div class="card card-danger">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('I 20 articoli più venduti per il periodo').': '.Translator::dateToLocale($start).' - '.Translator::dateToLocale($end).'</h4>
@ -388,20 +390,23 @@ foreach ($tipi as $tipo) {
}
echo '
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Numero interventi per tipologia').'</h4>
<div class="row">
<div class="col-md-6">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Numero interventi per tipologia').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<canvas id="interventi_n_tipologia"></canvas>
</div>
</div>
</div>
<div class="card-body">
<canvas id="interventi_n_tipologia" height="100"></canvas>
</div>
</div>';
</div>';
// Script for the chart displaying the number of interventions by type
echo '
@ -445,19 +450,22 @@ foreach ($tipi as $tipo) {
}
echo '
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Ore interventi per tipologia').'</h4>
<div class="col-md-6">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Ore interventi per tipologia').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<canvas id="interventi_ore_tipologia"></canvas>
</div>
</div>
</div>
<div class="card-body">
<canvas id="interventi_ore_tipologia" height="100"></canvas>
</div>
</div>';
// Script per il grafico delle ore interventi per tipologia
@ -528,30 +536,33 @@ foreach ($tecnici as $tecnico) {
}
echo '
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Ore di lavoro per tecnico').'</h4>
<div class="row">
<div class="col-md-6">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Ore di lavoro per tecnico').'</h4>
<div class="row">
<div class="col-md-3 float-right">';
<div class="row">
<div class="col-md-3 float-right">';
if ($_SESSION['superselect']['idtipiintervento']) {
echo '
{["type": "select", "multiple": "1", "label": "'.tr('Tipi attività').'", "name": "idtipiintervento[]", "ajax-source": "tipiintervento", "value": "'.implode(',', (array) json_decode($_SESSION['superselect']['idtipiintervento'])).'", "placeholder": "Tutti" ]}';
{["type": "select", "multiple": "1", "label": "'.tr('Tipi attività').'", "name": "idtipiintervento[]", "ajax-source": "tipiintervento", "value": "'.implode(',', (array) json_decode($_SESSION['superselect']['idtipiintervento'])).'", "placeholder": "Tutti" ]}';
}
echo '
</div>
</div>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<canvas id="sessioni"></canvas>
</div>
</div>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<canvas id="sessioni" height="100"></canvas>
</div>
</div>';
</div>';
// Script per il grafico ore interventi per tecnico
echo '
@ -703,19 +714,23 @@ $dataset .= '{
]
},';
echo '
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Nuove anagrafiche').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
<div class="col-md-6">
<div class="card card-info">
<div class="card-header">
<h4 class="card-title">'.tr('Nuove anagrafiche').'</h4>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fa fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<canvas id="n_anagrafiche"></canvas>
</div>
</div>
</div>
<div class="card-body">
<canvas id="n_anagrafiche" height="100"></canvas>
</div>
</div>';
// Script per il grafico dei nuovi clienti per mese

View File

@ -44,8 +44,8 @@ class LineChart extends Stat {
labels.push(date.format("MMMM YYYY"));
});
while (chart.data.badges.length < data.results.length) {
chart.data.badges.push("");
while (chart.data.labels.length < data.results.length) {
chart.data.labels.push("");
}
chart.data.datasets.push({
@ -100,11 +100,11 @@ class LineChart extends Stat {
color = color.substr(0, 7);
chart.data.datasets.splice(dataset_index, 1);
chart.data.badges.splice(dataset_index, 1);
chart.data.labels.splice(dataset_index, 1);
}
while (chart.data.badges.length > max_length) {
chart.data.badges.pop("");
while (chart.data.labels.length > max_length) {
chart.data.labels.pop("");
}
chart.update();