2019-05-04 02:03:42 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2020-11-27 17:11:18 +01:00
|
|
|
use API\Services;
|
2020-11-27 16:49:10 +01:00
|
|
|
use Carbon\Carbon;
|
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
// Informazioni sui servizi attivi
|
2019-05-04 02:03:42 +02:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
<div class="row">';
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
$limite_scadenze = (new Carbon())->addDays(60);
|
2020-11-27 17:11:18 +01:00
|
|
|
if (Services::isEnabled()) {
|
2021-09-03 20:14:30 +02:00
|
|
|
echo '
|
|
|
|
<!-- Informazioni sui Servizi attivi -->
|
|
|
|
<div class="col-md-12 col-lg-6">
|
|
|
|
<div class="box box-success">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">
|
|
|
|
'.tr('Servizi attivi').'
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box-body">';
|
|
|
|
|
2021-09-24 12:26:34 +02:00
|
|
|
$servizi = Services::getServiziAttivi()->flatten(1);
|
2021-09-03 20:14:30 +02:00
|
|
|
if (!$servizi->isEmpty()) {
|
|
|
|
echo '
|
|
|
|
<table class="table table-striped table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Tipo').'</th>
|
|
|
|
<th>'.tr('Nome').'</th>
|
|
|
|
<th>'.tr('Scadenza').'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2020-11-27 16:49:10 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<tbody>';
|
2020-12-29 00:39:30 +01:00
|
|
|
foreach ($servizi as $servizio) {
|
2021-09-03 20:14:30 +02:00
|
|
|
$scadenza = Carbon::parse($servizio['data_conclusione']);
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<tr class="'.($scadenza->lessThan($limite_scadenze) ? 'info' : '').'">
|
|
|
|
<td>'.$servizio['sottocategoria'].'</td>
|
|
|
|
<td>'.$servizio['codice'].' - '.$servizio['nome'].'</td>
|
|
|
|
<td>'.dateFormat($scadenza).' ('.$scadenza->diffForHumans().')</td>
|
|
|
|
</tr>';
|
2020-11-27 16:49:10 +01:00
|
|
|
}
|
|
|
|
|
2020-12-29 00:39:30 +01:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<div class="alert alert-warning" role="alert">
|
|
|
|
<i class="fa fa-warning"></i> '.tr('Nessun servizio abilitato al momento').'.
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Informazioni sulle Risorse API -->
|
|
|
|
<div class="col-md-12 col-lg-6">
|
|
|
|
<div class="box box-info">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">
|
|
|
|
'.tr('Risorse Services').'
|
|
|
|
</h3>
|
2020-11-27 16:49:10 +01:00
|
|
|
</div>
|
|
|
|
|
2020-12-29 00:39:30 +01:00
|
|
|
<div class="box-body">';
|
2020-11-27 16:49:10 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
// Elaborazione delle risorse API in scadenza
|
2021-09-24 12:26:34 +02:00
|
|
|
$risorse_attive = Services::getRisorseAttive();
|
|
|
|
if (!$risorse_attive->isEmpty()) {
|
|
|
|
$risorse_in_scadenza = Services::getRisorseInScadenza($limite_scadenze);
|
2021-09-03 20:14:30 +02:00
|
|
|
if (!$risorse_in_scadenza->isEmpty()) {
|
2020-12-29 00:39:30 +01:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
<p>'.tr('Le seguenti risorse sono in scadenza:').'</p>
|
|
|
|
<table class="table table-striped table-hover">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Nome').'</th>
|
|
|
|
<th>'.tr('Crediti').'</th>
|
|
|
|
<th>'.tr('Scadenza').'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
foreach ($risorse_in_scadenza as $servizio) {
|
2021-09-24 12:26:34 +02:00
|
|
|
$scadenza = Carbon::parse($servizio['expiration_at']);
|
|
|
|
|
2020-12-29 00:39:30 +01:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
<tr>
|
2021-09-24 12:26:34 +02:00
|
|
|
<td>'.$servizio['name'].'</td>
|
|
|
|
<td>'.$servizio['credits'].'</td>
|
2021-09-03 20:14:30 +02:00
|
|
|
<td>'.dateFormat($scadenza).' ('.$scadenza->diffForHumans().')</td>
|
|
|
|
</tr>';
|
2020-12-29 00:39:30 +01:00
|
|
|
}
|
2021-09-03 20:14:30 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
2020-11-27 16:49:10 +01:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
<p>'.tr('Nessuna risorsa in scadenza').'.</p>';
|
2020-11-27 16:49:10 +01:00
|
|
|
}
|
|
|
|
|
2020-12-29 00:39:30 +01:00
|
|
|
echo '
|
2020-11-27 17:11:18 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<hr><br>
|
2020-11-27 17:11:18 +01:00
|
|
|
|
2021-09-17 17:18:17 +02:00
|
|
|
<div class="alert alert-warning hidden" role="alert" id="spazio-fe">
|
|
|
|
<i class="fa fa-warning"></i> '.tr('Spazio per Fatture Elettroniche in esaurimento: _NUM_/_TOT_', [
|
|
|
|
'_NUM_' => '<span id="spazio-fe-occupato"></span>',
|
|
|
|
'_TOT_' => '<span id="spazio-fe-totale"></span>',
|
|
|
|
]).'. '.tr("Contatta l'assistenza per maggiori informazioni").'.
|
|
|
|
</div>
|
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<h4>'.tr('Statistiche su Fatture Elettroniche').'</h4>
|
|
|
|
<table class="table table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Anno').'</th>
|
|
|
|
<th>
|
|
|
|
'.tr('Documenti archiviati').'
|
2021-03-29 10:07:45 +02:00
|
|
|
<span class="tip" title="'.tr('Fatture attive e relative ricevute, fatture passive').'.">
|
2021-03-27 22:17:51 +01:00
|
|
|
<i class="fa fa-question-circle-o"></i>
|
|
|
|
</span>
|
2021-09-03 20:14:30 +02:00
|
|
|
</th>
|
2021-03-27 22:17:51 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<th>
|
|
|
|
'.tr('Totale spazio occupato').'
|
2021-03-29 10:07:45 +02:00
|
|
|
<span class="tip" title="'.tr('Fatture attive con eventuali allegati e ricevute, fatture passive con eventuali allegati').'.">
|
2021-03-27 22:17:51 +01:00
|
|
|
<i class="fa fa-question-circle-o"></i>
|
|
|
|
</span>
|
2021-09-03 20:14:30 +02:00
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2021-02-25 10:56:47 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<tbody id="elenco-fe">
|
|
|
|
<tr class="info">
|
|
|
|
<td>'.tr('Totale').'</td>
|
|
|
|
<td id="fe_numero"></td>
|
|
|
|
<td id="fe_spazio"></td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-12-29 00:39:30 +01:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<script>
|
|
|
|
$(document).ready(function (){
|
|
|
|
aggiornaStatisticheFE();
|
2020-12-29 00:39:30 +01:00
|
|
|
});
|
2021-09-03 20:14:30 +02:00
|
|
|
</script>';
|
2021-02-18 18:48:44 +01:00
|
|
|
} else {
|
2020-12-29 00:39:30 +01:00
|
|
|
echo '
|
2021-09-03 20:14:30 +02:00
|
|
|
<div class="alert alert-warning" role="alert">
|
|
|
|
<i class="fa fa-warning"></i> '.tr('Nessuna risorsa Services abilitata').'.
|
|
|
|
</div>';
|
2020-12-29 00:39:30 +01:00
|
|
|
}
|
2021-09-03 20:14:30 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
} else {
|
|
|
|
echo '
|
|
|
|
<div class="col-md-12 col-lg-6">
|
|
|
|
<div class="alert alert-warning" role="alert">
|
|
|
|
<i class="fa fa-warning"></i> '.tr("Configurazione per l'accesso Services non completata correttamente").'. '.tr('Per abilitare i servizi, compilare l\'impostazione "OSMCloud Services API Token"').'.
|
|
|
|
</div>
|
|
|
|
</div>';
|
2020-11-27 16:49:10 +01:00
|
|
|
}
|
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
echo '
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 col-lg-6">
|
|
|
|
<div class="box box-info">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">
|
|
|
|
'.tr('Moduli disponibili').'
|
|
|
|
</h3>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box-body" id="moduli">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
2019-05-04 02:03:42 +02:00
|
|
|
// Widgets
|
|
|
|
echo '
|
|
|
|
<div class="col-md-12 col-lg-6">
|
2021-09-03 20:14:30 +02:00
|
|
|
<div class="box box-info">
|
|
|
|
<div class="box-header">
|
|
|
|
<h3 class="box-title">
|
|
|
|
'.tr('Widget disponibili').'
|
|
|
|
</h3>
|
|
|
|
</div>
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<div class="box-body" id="widget">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
<script>
|
|
|
|
function aggiornaStatisticheFE(){
|
|
|
|
$.ajax({
|
|
|
|
url: globals.rootdir + "/actions.php",
|
|
|
|
type: "GET",
|
|
|
|
dataType: "JSON",
|
|
|
|
data: {
|
|
|
|
id_module: globals.id_module,
|
|
|
|
op: "informazioni-fe",
|
|
|
|
},
|
|
|
|
success: function (response) {
|
|
|
|
$("#fe_numero").html(response.invoice_number);
|
2021-09-17 17:18:17 +02:00
|
|
|
$("#fe_spazio").html(response.spazio_occupato);
|
|
|
|
|
|
|
|
// Informazioni sullo spazio occupato
|
|
|
|
$("#spazio-fe-occupato").html(response.spazio_occupato);
|
|
|
|
$("#spazio-fe-totale").html(response.spazio_totale);
|
|
|
|
if (response.avviso_spazio) {
|
|
|
|
$("#spazio-fe").removeClass("hidden");
|
|
|
|
}
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
if (response.history.length) {
|
|
|
|
for (let i = 0; i < response.history.length; i++) {
|
|
|
|
const data = response.history[i];
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
$("#elenco-fe").append(`<tr>
|
|
|
|
<td>` + data["year"] + `</td>
|
|
|
|
<td>` + data["number"] + `</td>
|
|
|
|
<td>` + data["size"] + `</td>
|
|
|
|
</tr>`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-05-04 02:03:42 +02:00
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
function caricaElencoModuli() {
|
|
|
|
let container = $("#moduli");
|
|
|
|
|
|
|
|
localLoading(container, true);
|
|
|
|
return $.get("'.$structure->fileurl('elenco-moduli.php').'?id_module='.$id_module.'", function(data) {
|
|
|
|
container.html(data);
|
|
|
|
localLoading(container, false);
|
|
|
|
|
|
|
|
init();
|
|
|
|
});
|
2019-05-04 02:03:42 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 20:14:30 +02:00
|
|
|
function caricaElencoWidget() {
|
|
|
|
let container = $("#widget");
|
|
|
|
|
|
|
|
localLoading(container, true);
|
|
|
|
return $.get("'.$structure->fileurl('elenco-widget.php').'?id_module='.$id_module.'", function(data) {
|
|
|
|
container.html(data);
|
|
|
|
localLoading(container, false);
|
|
|
|
|
|
|
|
init();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
caricaElencoModuli();
|
|
|
|
caricaElencoWidget();
|
|
|
|
|
|
|
|
init();
|
|
|
|
});
|
|
|
|
</script>';
|