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
// Elenco moduli installati
2020-11-27 17:11:18 +01:00
use API\Services ;
2020-11-27 16:49:10 +01:00
use Carbon\Carbon ;
use Models\Cache ;
2019-05-04 02:03:42 +02:00
echo '
< div class = " row " >
< div class = " col-md-12 col-lg-6 " >
< h3 > '.tr(' Moduli installati ').' </ h3 >
< table class = " table table-hover table-bordered table-condensed " >
< tr >
< th > '.tr(' Nome ').' </ th >
2019-05-30 17:26:34 +02:00
< th > '.tr(' Versione ').' </ th >
< th > '.tr(' Stato ').' </ th >
< th > '.tr(' Compatibilità ').' </ th >
< th > '.tr(' Opzioni ').' </ th >
2019-05-04 02:03:42 +02:00
</ tr > ' ;
$modules = Modules :: getHierarchy ();
$osm_version = Update :: getVersion ();
echo submodules ( $modules );
echo '
</ table >
</ div > ' ;
2020-11-27 17:11:18 +01:00
if ( Services :: isEnabled ()) {
2020-11-27 16:49:10 +01:00
// Informazioni su Services
$servizi = Cache :: pool ( 'Informazioni su Services' ) -> content ;
2021-02-18 18:48:44 +01:00
if ( ! empty ( $servizi )) {
2020-12-29 00:39:30 +01:00
// Elaborazione dei servizi in scadenza
$limite_scadenze = ( new Carbon ()) -> addDays ( 60 );
$servizi_in_scadenza = [];
foreach ( $servizi as $servizio ) {
// Gestione per data di scadenza
$scadenza = new Carbon ( $servizio [ 'expiration_at' ]);
if (
( isset ( $servizio [ 'expiration_at' ]) && $scadenza -> lessThan ( $limite_scadenze ))
) {
$servizi_in_scadenza [] = $servizio [ 'name' ] . ' (' . $scadenza -> diffForHumans () . ')' ;
}
// Gestione per crediti
elseif (
( isset ( $servizio [ 'credits' ]) && $servizio [ 'credits' ] < 100 )
) {
$servizi_in_scadenza [] = $servizio [ 'name' ] . ' (' . $servizio [ 'credits' ] . ' crediti)' ;
}
2020-11-27 16:49:10 +01:00
}
2020-12-29 00:39:30 +01:00
echo '
< div class = " col-md-12 col-lg-6 " >
< div class = " box box-info " >
< div class = " box-header " >
< h3 class = " box-title " >
'.tr(' Informazioni su Services ').'
</ h3 >
</ div >
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
2020-12-29 00:39:30 +01:00
if ( empty ( $servizi_in_scadenza )) {
echo '
< p > '.tr(' Nessun servizio in scadenza ').' .</ p > ' ;
} else {
echo '
< p > '.tr(' I seguenti servizi sono in scadenza : ').' </ p >
< ul > ' ;
foreach ( $servizi_in_scadenza as $servizio ) {
echo '
< li > '.$servizio.' </ li > ' ;
}
2020-11-27 16:49:10 +01:00
echo '
2020-12-29 00:39:30 +01:00
</ ul > ' ;
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
2020-12-29 00:39:30 +01:00
< hr >< br >
2020-11-27 17:11:18 +01:00
2020-12-29 00:39:30 +01:00
< h4 > '.tr(' Statistiche su Fatture Elettroniche ').' </ h4 >
2021-02-25 10:56:47 +01:00
< table class = " table table-striped " >
< thead >
< tr >
< th > '.tr(' Anno ').' </ th >
2021-03-27 22:17:51 +01:00
< 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 >
</ th >
< 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 >
</ th >
2021-02-25 10:56:47 +01:00
</ tr >
</ thead >
< 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
</ div >
2020-11-27 16:49:10 +01:00
</ div >
2020-12-29 00:39:30 +01:00
< script >
$ ( document ) . ready ( function (){
$ . ajax ({
url : globals . rootdir + " /actions.php " ,
type : " GET " ,
2021-02-25 10:56:47 +01:00
dataType : " JSON " ,
2020-12-29 00:39:30 +01:00
data : {
id_module : globals . id_module ,
op : " informazioni-fe " ,
},
success : function ( response ) {
$ ( " #fe_numero " ) . html ( response . invoice_number );
$ ( " #fe_spazio " ) . html ( response . size );
2021-02-25 10:56:47 +01:00
if ( response . history . length ) {
for ( let i = 0 ; i < 5 ; i ++ ) {
const data = response . history [ i ];
2021-03-01 16:45:18 +01:00
$ ( " #elenco-fe " ) . append ( ` < tr >
2021-03-01 16:41:52 +01:00
< td > ` + data["year"] + ` </ td >
< td > ` + data["number"] + ` </ td >
< td > ` + data["size"] + ` </ td >
2021-02-25 10:56:47 +01:00
</ tr > ` );
}
}
2020-12-29 00:39:30 +01:00
}
});
2020-11-27 17:11:18 +01:00
});
2020-12-29 00:39:30 +01:00
</ script > ' ;
2021-02-18 18:48:44 +01:00
} else {
2020-12-29 00:39:30 +01:00
echo '
< div class = " col-md-12 col-lg-6 " >< div class = " alert alert-warning alert-dismissible " role = " alert " >< button class = " close " type = " button " data - dismiss = " alert " aria - hidden = " true " >< span aria - hidden = " true " > × </ span >< span class = " sr-only " > '.tr(' Chiudi ').' </ span ></ button >< span >< i class = " fa fa-warning " ></ i > '.tr(' Nessun servizio abilitato o " OSMCloud Services API Token " non valido ').' .</ span ></ div ></ div > ' ;
}
2020-11-27 16:49:10 +01:00
}
2019-05-04 02:03:42 +02:00
// Widgets
echo '
< div class = " col-md-12 col-lg-6 " >
< h3 > '.tr(' Widgets ').' </ h3 >
< table class = " table table-hover table-bordered table-condensed " >
< tr >
< th > '.tr(' Nome ').' </ th >
2019-05-30 17:26:34 +02:00
< th > '.tr(' Posizione ').' </ th >
< th > '.tr(' Stato ').' </ th >
< th > '.tr(' Posizione ').' </ th >
2019-05-04 02:03:42 +02:00
</ tr > ' ;
2019-05-08 18:32:37 +02:00
$widgets = $dbo -> fetchArray ( 'SELECT zz_widgets.id, zz_widgets.name AS widget_name, zz_modules.name AS module_name, zz_widgets.enabled AS enabled, location, help FROM zz_widgets INNER JOIN zz_modules ON zz_widgets.id_module=zz_modules.id ORDER BY `id_module` ASC, `zz_widgets`.`order` ASC' );
2019-05-04 02:03:42 +02:00
$previous = '' ;
foreach ( $widgets as $widget ) {
// Nome modulo come titolo sezione
if ( $widget [ 'module_name' ] != $previous ) {
echo '
< tr >
< th colspan = " 4 " > '.$widget[' module_name '].' </ th >
</ tr > ' ;
}
// STATO
if ( $widget [ 'enabled' ]) {
2019-07-09 11:25:23 +02:00
$stato = '<i class="fa fa-cog fa-spin text-success tip" title="' . tr ( 'Abilitato' ) . '. ' . tr ( 'Clicca per disabilitarlo' ) . '..."></i>' ;
2019-05-04 02:03:42 +02:00
$class = 'success' ;
} else {
2019-07-09 11:25:23 +02:00
$stato = '<i class="fa fa-cog text-warning tip" title="' . tr ( 'Non abilitato' ) . '"></i>' ;
2019-05-04 02:03:42 +02:00
$class = 'warning' ;
}
// Possibilità di disabilitare o abilitare i moduli tranne quello degli aggiornamenti
if ( $widget [ 'enabled' ]) {
2020-09-23 17:53:19 +02:00
$stato = " <a href='javascript:;' onclick= \" if( confirm(' " . tr ( 'Disabilitare questo widget?' ) . " ') ) { $ .post( ' " . base_path () . '/actions.php?id_module=' . $id_module . " ', { op: 'disable_widget', id: ' " . $widget [ 'id' ] . " ' }, function(response) { location.href=' " . base_path () . '/controller.php?id_module=' . $id_module . " '; }); } \" > " . $stato . " </a> \n " ;
2019-05-04 02:03:42 +02:00
} else {
2020-09-23 17:53:19 +02:00
$stato = " <a href='javascript:;' onclick= \" if( confirm(' " . tr ( 'Abilitare questo widget?' ) . " ') ) { $ .post( ' " . base_path () . '/actions.php?id_module=' . $id_module . " ', { op: 'enable_widget', id: ' " . $widget [ 'id' ] . " ' }, function(response) { location.href=' " . base_path () . '/controller.php?id_module=' . $id_module . " '; }); } \" \" > " . $stato . " </a> \n " ;
2019-05-04 02:03:42 +02:00
}
// POSIZIONE
if ( $widget [ 'location' ] == 'controller_top' ) {
$location = tr ( 'Schermata modulo in alto' );
} elseif ( $widget [ 'location' ] == 'controller_right' ) {
$location = tr ( 'Schermata modulo a destra' );
}
if ( $widget [ 'location' ] == 'controller_right' ) {
2019-07-09 11:25:23 +02:00
$posizione = " <i class='fa fa-arrow-up text-warning tip' title= \" " . tr ( 'Clicca per cambiare la posizione...' ) . " \" ></i> <i class='fa fa-arrow-right text-success' ></i> " ;
2020-09-23 17:53:19 +02:00
$posizione = " <a href='javascript:;' onclick= \" if( confirm(' " . tr ( 'Cambiare la posizione di questo widget?' ) . " ') ) { $ .post( ' " . base_path () . '/actions.php?id_module=' . $id_module . " ', { op: 'change_position_widget_top', id: ' " . $widget [ 'id' ] . " ' }, function(response) { location.href=' " . base_path () . '/controller.php?id_module=' . $id_module . " '; }); } \" \" > " . $posizione . " </a> \n " ;
2019-05-04 02:03:42 +02:00
} elseif ( $widget [ 'location' ] == 'controller_top' ) {
2019-07-09 11:25:23 +02:00
$posizione = " <i class='fa fa-arrow-up text-success'></i> <i class='fa fa-arrow-right text-warning tip' title= \" " . tr ( 'Clicca per cambiare la posizione...' ) . '"></i>' ;
2020-09-23 17:53:19 +02:00
$posizione = " <a href='javascript:;' onclick= \" if( confirm(' " . tr ( 'Cambiare la posizione di questo widget?' ) . " ') ) { $ .post( ' " . base_path () . '/actions.php?id_module=' . $id_module . " ', { op: 'change_position_widget_right', id: ' " . $widget [ 'id' ] . " ' }, function(response) { location.href=' " . base_path () . '/controller.php?id_module=' . $id_module . " '; }); } \" \" > " . $posizione . " </a> \n " ;
2019-05-04 02:03:42 +02:00
}
echo '
< tr class = " '. $class .' " >
2019-07-09 11:25:23 +02:00
< td > '.$widget[' widget_name '].((!empty($widget[' help '])) ? ' < i class = " tip fa fa-question-circle-o " title = " '. $widget['help'] .' " </ i > ' : ' ').' </ td >
2019-05-30 17:26:34 +02:00
< td align = " left " >< small > '.$location.' </ small ></ td >
2019-05-04 02:03:42 +02:00
< td align = " center " > '.$stato.' </ td >
< td align = " center " > '.$posizione.' </ td >
</ tr > ' ;
$previous = $widget [ 'module_name' ];
}
echo '
</ table >
</ div >
</ div > ' ;