2019-07-30 16:50:10 +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-07-30 16:50:10 +02:00
include_once __DIR__ . '/../core.php' ;
2021-04-02 15:55:04 +02:00
if ( ! $notes -> isEmpty ()) {
2019-07-30 16:50:10 +02:00
echo '
2019-11-23 06:48:58 +01:00
< div class = " box box-info direct-chat direct-chat-info " >
2019-07-30 16:50:10 +02:00
< div class = " box-header with-border " >
< h3 class = " box-title " > '.tr(' Note interne ').' </ h3 >
</ div >
< div class = " box-body " >
< div class = " direct-chat-messages " style = " height: 50vh " > ' ;
foreach ( $notes as $nota ) {
$utente = $nota -> user ;
$photo = $utente -> photo ;
echo '
< div class = " direct-chat-msg '.( $utente->id == $user->id ? 'right' : '').' " id = " nota_'. $nota->id .' " >
< div class = " direct-chat-info clearfix " >
< span class = " direct-chat-name pull-left " > '.$utente->nome_completo.' </ span >
< span class = " direct-chat-timestamp pull-right " >
'.timestampFormat($nota->created_at).'
</ span >
</ div > ' ;
if ( $photo ) {
echo '
< img class = " direct-chat-img " src = " '. $photo .' " > ' ;
} else {
echo '
2020-09-07 15:04:06 +02:00
2019-07-30 16:50:10 +02:00
< i class = " fa fa-user-circle-o direct-chat-img fa-3x " alt = " '.tr('OpenSTAManager').' " ></ i > ' ;
}
echo '
< div class = " direct-chat-text " >
< div class = " pull-right " > ' ;
if ( ! empty ( $nota -> notification_date )) {
echo '
< span class = " label label-default tip " title = " '.tr('Data di notifica').' " style = " margin-right: 5px " >
< i class = " fa fa-bell " ></ i > '.dateFormat($nota->notification_date).'
</ span >
2020-09-07 15:04:06 +02:00
2021-03-04 15:24:20 +01:00
< button type = " button " class = " btn btn-info btn-xs ask " data - op = " rimuovi-notifica-nota " data - id_nota = " '. $nota->id .' " data - msg = " '.tr('Rimuovere la data di notifica da questa nota?').' " data - backto = " record-edit " data - button = " '.tr('Rimuovi').' " data - class = " btn btn-lg btn-warning " >
2019-07-30 16:50:10 +02:00
< i class = " fa fa-eye " ></ i >
</ button > ' ;
}
if ( $user -> is_admin || $utente -> id == $user -> id ) {
echo '
2021-03-04 15:24:20 +01:00
< button type = " button " class = " btn btn-danger btn-xs ask " data - op = " rimuovi-nota " data - id_nota = " '. $nota->id .' " data - msg = " '.tr('Rimuovere questa nota?').' " data - backto = " record-edit " >
2019-07-30 16:50:10 +02:00
< i class = " fa fa-trash-o " ></ i >
</ button > ' ;
}
echo '
</ div >
'.$nota->content.'
</ div >
</ div > ' ;
}
echo '
</ div >
</ div >
</ div > ' ;
} else {
echo '
2020-07-09 18:50:10 +02:00
< div class = " alert alert-info " >< i class = " fa fa-info-circle " ></ i > < b > '.tr(' Informazione : ').' </ b > '.tr(' Non sono presenti note interne . ').' </ div > ' ;
2019-07-30 16:50:10 +02:00
}
if ( $structure -> permission == 'rw' ) {
echo '
< form action = " " method = " post " >
2021-03-04 15:24:20 +01:00
< input type = " hidden " name = " op " value = " aggiungi-nota " >
2019-07-30 16:50:10 +02:00
< input type = " hidden " name = " backto " value = " record-edit " >
2019-11-23 06:48:58 +01:00
< div class = " row " >
< div class = " col-md-12 " >
{[ " type " : " ckeditor " , " label " : " '.tr('Nuova nota').' " , " name " : " contenuto " , " required " : 1 , " class " : " unblockable " ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " date " , " label " : " '.tr('Data di notifica').' " , " name " : " data_notifica " , " class " : " unblockable " , " help " : " '.tr('Eventuale data di notifica di un promemoria di questa nota.').' " ]}
</ div >
</ div >
2019-07-30 16:50:10 +02:00
<!-- PULSANTI -->
< div class = " row " >
< div class = " col-md-12 text-right " >
2020-10-11 09:46:38 +02:00
< button type = " submit " class = " btn btn-primary " disabled id = " aggiungi_nota " >
2019-07-30 16:50:10 +02:00
< i class = " fa fa-plus " ></ i > '.tr(' Aggiungi ').'
</ button >
</ div >
</ div >
</ form > ' ;
}
2020-07-17 16:03:21 +02:00
echo '
< script >
2020-10-11 09:46:38 +02:00
var contenuto_nota = input ( " contenuto " );
contenuto_nota . on ( " change " , function () {
if ( contenuto_nota . get () === " " ) {
$ ( " #aggiungi_nota " ) . prop ( " disabled " , true );
} else {
$ ( " #aggiungi_nota " ) . prop ( " disabled " , false );
}
});
2020-07-17 16:03:21 +02:00
</ script > ' ;