mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-13 18:10:51 +01:00
Fix potenziale per FullCalendar
This commit is contained in:
parent
fdba6c2611
commit
71c8b1395e
@ -38,7 +38,7 @@ if (!isset($_SESSION['dashboard']['idzone'])) {
|
||||
|
||||
$_SESSION['dashboard']['idzone'] = ["'-1'"];
|
||||
|
||||
//"Nessuna zona" di default
|
||||
// "Nessuna zona" di default
|
||||
$_SESSION['dashboard']['idzone'][] = "'0'";
|
||||
|
||||
for ($i = 0; $i < count($rs); ++$i) {
|
||||
@ -302,44 +302,44 @@ if (!empty($rsp)) {
|
||||
|
||||
<div id="external-events" class="hidden-xs hidden-sm col-md-2">
|
||||
<h4>'.tr('Interventi da pianificare').'</h4>';
|
||||
|
||||
//Controllo per pinanificazioni per mesi precedenti
|
||||
|
||||
// Controllo per pinanificazioni per mesi precedenti
|
||||
$qp_old = "SELECT co_righe_contratti.id, idcontratto, richiesta, DATE_FORMAT( data_richiesta, '%m-%Y') AS mese, data_richiesta, an_anagrafiche.ragione_sociale, 'intervento' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento=co_righe_contratti.idtipointervento) AS tipointervento FROM (co_righe_contratti INNER JOIN co_contratti ON co_righe_contratti.idcontratto=co_contratti.id) INNER JOIN an_anagrafiche ON co_contratti.idanagrafica=an_anagrafiche.idanagrafica WHERE idcontratto IN( SELECT id FROM co_contratti WHERE idstato IN(SELECT id FROM co_staticontratti WHERE pianificabile = 1) ) AND idintervento IS NULL AND DATE_FORMAT( data_richiesta, '%d%m%Y')<DATE_FORMAT( NOW(), '%d%m%Y')
|
||||
UNION SELECT co_ordiniservizio.id, idcontratto, '', data_scadenza, DATE_FORMAT( data_scadenza, '%m-%Y') AS mese, an_anagrafiche.ragione_sociale, 'ordine' AS ref, (SELECT descrizione FROM in_tipiintervento WHERE idtipointervento='ODS') AS tipointervento FROM (co_ordiniservizio INNER JOIN co_contratti ON co_ordiniservizio.idcontratto=co_contratti.id) INNER JOIN an_anagrafiche ON co_contratti.idanagrafica=an_anagrafiche.idanagrafica WHERE idcontratto IN( SELECT id FROM co_contratti WHERE idstato IN(SELECT id FROM co_staticontratti WHERE pianificabile = 1) ) AND idintervento IS NULL AND DATE_FORMAT( data_scadenza, '%d%m%Y')<DATE_FORMAT( NOW(), '%d%m%Y') ORDER BY data_richiesta ASC";
|
||||
$rsp_old = $dbo->fetchArray($qp_old);
|
||||
|
||||
if(sizeof($rsp_old)>0){
|
||||
|
||||
if (sizeof($rsp_old) > 0) {
|
||||
echo '<small class="text-danger"><i class="fa fa-exclamation-triangle"></i> Ci sono alcuni interventi da pianificare scaduti.</small><br>';
|
||||
}
|
||||
|
||||
$mesi = array( 1 => 'Gennaio', 2 => 'Febbraio', 3 => 'Marzo', 4 => 'Aprile', 5 => 'Maggio', 6 => 'Giugno', 7 => 'Luglio', 8 => 'Agosto', 9 => 'Settembre', 10 => 'Ottobre', 11 => 'Novembre', 12 => 'Dicembre' );
|
||||
|
||||
//Creo un array con tutti i mesi che contengono interventi
|
||||
$mesi_interventi = array();
|
||||
for( $i=0; $i<sizeof($rsp); $i++ ){
|
||||
$mese_n = date("m", strtotime($rsp[$i]["data_richiesta"])).date("Y", strtotime($rsp[$i]["data_richiesta"]));
|
||||
$mese_t = $mesi[ intval(date("m", strtotime($rsp[$i]["data_richiesta"]))) ].' '.date("Y", strtotime($rsp[$i]["data_richiesta"]));
|
||||
|
||||
$mesi = [1 => 'Gennaio', 2 => 'Febbraio', 3 => 'Marzo', 4 => 'Aprile', 5 => 'Maggio', 6 => 'Giugno', 7 => 'Luglio', 8 => 'Agosto', 9 => 'Settembre', 10 => 'Ottobre', 11 => 'Novembre', 12 => 'Dicembre'];
|
||||
|
||||
// Creo un array con tutti i mesi che contengono interventi
|
||||
$mesi_interventi = [];
|
||||
for ($i = 0; $i < sizeof($rsp); ++$i) {
|
||||
$mese_n = date('m', strtotime($rsp[$i]['data_richiesta'])).date('Y', strtotime($rsp[$i]['data_richiesta']));
|
||||
$mese_t = $mesi[intval(date('m', strtotime($rsp[$i]['data_richiesta'])))].' '.date('Y', strtotime($rsp[$i]['data_richiesta']));
|
||||
$mesi_interventi[$mese_n] = $mese_t;
|
||||
}
|
||||
|
||||
//Aggiungo anche il mese corrente
|
||||
$mesi_interventi[date("m").date("Y")] = $mesi[intval(date("m"))]." ".date("Y");
|
||||
|
||||
//Rimuovo i mesi doppi
|
||||
array_unique ( $mesi_interventi );
|
||||
|
||||
//Ordino l'array per mese
|
||||
ksort( $mesi_interventi );
|
||||
|
||||
|
||||
// Aggiungo anche il mese corrente
|
||||
$mesi_interventi[date('m').date('Y')] = $mesi[intval(date('m'))].' '.date('Y');
|
||||
|
||||
// Rimuovo i mesi doppi
|
||||
array_unique($mesi_interventi);
|
||||
|
||||
// Ordino l'array per mese
|
||||
ksort($mesi_interventi);
|
||||
|
||||
echo '<br>';
|
||||
echo '<select class="superselect" id="select-intreventi-pianificare">';
|
||||
|
||||
foreach($mesi_interventi as $key => $mese_intervento){
|
||||
foreach ($mesi_interventi as $key => $mese_intervento) {
|
||||
echo '<option value="'.$key.'">'.$mese_intervento.'</option>';
|
||||
}
|
||||
|
||||
|
||||
echo '</select>';
|
||||
|
||||
|
||||
echo '<div id="interventi-pianificare"></div>';
|
||||
|
||||
echo '
|
||||
@ -358,10 +358,10 @@ if ($vista == 'mese') {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$('#select-intreventi-pianificare').change(function(){
|
||||
var mese = $(this).val();
|
||||
$.get( '<?php echo $rootdir ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$.get( '<?php echo $rootdir; ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$('#interventi-pianificare').html(data);
|
||||
$('#external-events .fc-event').each(function() {
|
||||
$(this).draggable({
|
||||
@ -374,7 +374,7 @@ if ($vista == 'mese') {
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
//Seleziono il mese corrente per gli interventi da pianificare
|
||||
// Seleziono il mese corrente per gli interventi da pianificare
|
||||
var date = new Date();
|
||||
var mese;
|
||||
date.setDate(date.getDate() + 20);
|
||||
@ -382,7 +382,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#select-intreventi-pianificare option[value='+mese+']').attr('selected','selected').trigger('change');
|
||||
|
||||
$.get( '<?php echo $rootdir ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$.get( '<?php echo $rootdir; ?>/modules/dashboard/ajaxreq.php', { op: 'load_intreventi', mese: mese }, function(data){
|
||||
$('#interventi-pianificare').html(data);
|
||||
$('#external-events .fc-event').each(function() {
|
||||
$(this).draggable({
|
||||
@ -393,11 +393,11 @@ if ($vista == 'mese') {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Comandi seleziona tutti
|
||||
$('#selectallstati').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { // loop through each checkbox
|
||||
this.checked = true;
|
||||
$.when (session_set_array( 'dashboard,idstatiintervento', this.value, 0 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -412,7 +412,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#selectalltipi').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { // loop through each checkbox
|
||||
this.checked = true;
|
||||
$.when (session_set_array( 'dashboard,idtipiintervento', this.value, 0 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -426,7 +426,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#selectalltecnici').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { // loop through each checkbox
|
||||
this.checked = true;
|
||||
$.when (session_set_array( 'dashboard,idtecnici', this.value, 0 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -439,7 +439,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#selectallzone').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function(i) { // loop through each checkbox
|
||||
this.checked = true;
|
||||
$.when (session_set_array( 'dashboard,idzone', this.value, 0 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -455,7 +455,7 @@ if ($vista == 'mese') {
|
||||
// Comandi deseleziona tutti
|
||||
$('#deselectallstati').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { // loop through each checkbox
|
||||
this.checked = false;
|
||||
$.when (session_set_array( 'dashboard,idstatiintervento', this.value, 1 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -469,7 +469,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#deselectalltipi').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { // loop through each checkbox
|
||||
this.checked = false;
|
||||
$.when (session_set_array( 'dashboard,idtipiintervento', this.value, 1 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -484,7 +484,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#deselectalltecnici').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { // loop through each checkbox
|
||||
this.checked = false;
|
||||
$.when (session_set_array( 'dashboard,idtecnici', this.value, 1 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -498,7 +498,7 @@ if ($vista == 'mese') {
|
||||
|
||||
$('#deselectallzone').click(function(event) {
|
||||
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { //loop through each checkbox
|
||||
$(this).parent().parent().find('li input[type=checkbox]').each(function() { // loop through each checkbox
|
||||
this.checked = false;
|
||||
$.when (session_set_array( 'dashboard,idzone', this.value, 1 )).promise().then(function() {
|
||||
$('#calendar').fullCalendar('refetchEvents');
|
||||
@ -512,25 +512,25 @@ if ($vista == 'mese') {
|
||||
|
||||
// Creazione del calendario
|
||||
create_calendar();
|
||||
|
||||
//Data di default
|
||||
|
||||
// Data di default
|
||||
$('.fc-prev-button, .fc-next-button, .fc-today-button').click(function(){
|
||||
var date_start = $('#calendar').fullCalendar('getView').start.format('YYYY-MM-DD');
|
||||
date_start = moment(date_start);
|
||||
|
||||
|
||||
if('<?php echo $def; ?>'=='month'){
|
||||
if(date_start.date()>1){
|
||||
date_start = moment(date_start).add(1, 'M').startOf('month');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
date_start = date_start.format('YYYY-MM-DD');
|
||||
setCookie('calendar_date_start', date_start, 365);
|
||||
});
|
||||
|
||||
|
||||
calendar_date_start = getCookie('calendar_date_start');
|
||||
$('#calendar').fullCalendar( 'gotoDate', calendar_date_start );
|
||||
|
||||
|
||||
});
|
||||
|
||||
function create_calendar(){
|
||||
@ -682,7 +682,7 @@ if (get_var('Utilizzare i tooltip sul calendario') == '1') {
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$('#calendar').fullCalendar('option', 'contentHeight', 'auto');
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user