|
165 | 165 | } |
166 | 166 |
|
167 | 167 | // Pulsanti di default |
168 | | - echo ' |
| 168 | + echo ' |
169 | 169 |
|
170 | 170 | <div id="pulsanti"> |
171 | 171 | <a class="btn btn-default" id="back" href="'.base_path().'/controller.php?id_module='.$id_module.'"> |
|
192 | 192 | // Successivo |
193 | 193 | $next = $posizioni[$key + 1]['id']; |
194 | 194 |
|
195 | | - |
| 195 | + |
196 | 196 | echo '<span class="d-sm-inline">'; |
197 | | - |
| 197 | + |
198 | 198 |
|
199 | 199 | echo ' |
200 | 200 | <a class="btn btn-default'.($prev ? '' : ' disabled').'" href="'.base_path().'/editor.php?id_module='.$id_module.'&id_record='.$prev.'"> |
|
205 | 205 | </a> |
206 | 206 | </span>'; |
207 | 207 |
|
208 | | - |
| 208 | + |
209 | 209 | echo '<div class="extra-buttons d-sm-inline">'; |
210 | | - |
| 210 | + |
211 | 211 |
|
212 | 212 | // Pulsanti personalizzati |
213 | 213 | $buttons = $structure->filepath('buttons.php'); |
|
244 | 244 | </div> |
245 | 245 | </div> |
246 | 246 | </div> |
247 | | - |
| 247 | +
|
248 | 248 |
|
249 | 249 | <script> |
250 | 250 | $(document).ready(function(){ |
|
381 | 381 | } |
382 | 382 |
|
383 | 383 | echo ' |
384 | | - <div class="timeline">'; |
| 384 | + <div class="card card-outline card-primary mx-auto" style="max-width: 800px;"> |
| 385 | + <div class="card-header"> |
| 386 | + <h5 class="mb-0 text-center"> |
| 387 | + <i class="fa fa-history mr-2"></i> '.tr('Cronologia operazioni').' |
| 388 | + </h5> |
| 389 | + </div> |
| 390 | + <div class="card-body p-3"> |
| 391 | + <div class="timeline timeline-sm">'; |
385 | 392 |
|
386 | 393 | $operations = $dbo->fetchArray('SELECT `zz_operations`.*, `zz_users`.`username` FROM `zz_operations` LEFT JOIN `zz_users` ON `zz_operations`.`id_utente` = `zz_users`.`id` WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record).' ORDER BY `created_at` DESC LIMIT 200'); |
387 | 394 |
|
388 | 395 | if (!empty($operations)) { |
| 396 | + $current_date = null; |
| 397 | + |
389 | 398 | foreach ($operations as $operation) { |
390 | 399 | $description = $operation['op']; |
391 | 400 | $icon = 'pencil-square-o'; |
392 | 401 | $color = 'warning'; |
| 402 | + $date = Carbon::parse($operation['created_at']); |
| 403 | + $formatted_date = $date->format('d/m/Y'); |
| 404 | + |
| 405 | + // Mostra l'intestazione della data se è cambiata |
| 406 | + if ($current_date !== $formatted_date) { |
| 407 | + echo ' |
| 408 | + <div class="time-label"> |
| 409 | + <span class="bg-primary px-2 py-1 small"> |
| 410 | + '.$formatted_date.' |
| 411 | + </span> |
| 412 | + </div>'; |
| 413 | + $current_date = $formatted_date; |
| 414 | + } |
393 | 415 |
|
394 | 416 | switch ($operation['op']) { |
395 | 417 | case 'add': |
396 | 418 | $description = tr('Creazione'); |
397 | | - $icon = 'plus'; |
| 419 | + $icon = 'plus-circle'; |
398 | 420 | $color = 'success'; |
399 | 421 | break; |
400 | 422 |
|
401 | 423 | case 'update': |
402 | 424 | $description = tr('Modifica'); |
403 | | - $icon = 'pencil'; |
| 425 | + $icon = 'edit'; |
404 | 426 | $color = 'info'; |
405 | 427 | break; |
406 | 428 |
|
407 | 429 | case 'delete': |
408 | 430 | $description = tr('Eliminazione'); |
409 | | - $icon = 'times'; |
| 431 | + $icon = 'trash'; |
410 | 432 | $color = 'danger'; |
411 | 433 | break; |
412 | 434 |
|
413 | 435 | case 'copy': |
414 | 436 | $description = tr('Duplicato'); |
415 | | - $icon = 'clone'; |
416 | | - $color = 'info'; |
| 437 | + $icon = 'copy'; |
| 438 | + $color = 'primary'; |
417 | 439 | break; |
418 | 440 | } |
419 | 441 |
|
420 | 442 | echo ' |
421 | 443 | <div> |
422 | | - <i class="fa fa-'.$icon.' bg-'.$color.'"></i> |
423 | | - <div class="timeline-item"> |
424 | | - <span class="time"><i class="fa fa-clock-o"></i> '.Carbon::parse($operation['created_at'])->diffForHumans().'</span> |
425 | | - <h4 class="timeline-header">'.$description.'</h4> |
426 | | - <div class="timeline-body"> |
427 | | - <span class="badge badge-default"><i class="fa fa-user"></i> '.$operation['username'].'</span> |
| 444 | + <i class="fa fa-'.$icon.' bg-'.$color.' small"></i> |
| 445 | + <div class="timeline-item small shadow-sm"> |
| 446 | + <span class="time small"><i class="fa fa-clock-o"></i> '.$date->format('H:i').' ('.$date->diffForHumans().')</span> |
| 447 | + <h5 class="timeline-header no-border mb-0">'.$description.'</h5> |
| 448 | + <div class="timeline-body py-2"> |
| 449 | + <div class="d-flex align-items-center"> |
| 450 | + <div class="mr-3 small"> |
| 451 | + <i class="fa fa-user mr-1 text-'.$color.'"></i> |
| 452 | + <span>'.$operation['username'].'</span> |
| 453 | + </div>'; |
| 454 | + |
| 455 | + if (!empty($operation['options'])) { |
| 456 | + $options = json_decode($operation['options'], true); |
| 457 | + if (!empty($options) && is_array($options)) { |
| 458 | + echo '<div class="text-muted small">'; |
| 459 | + $details = []; |
| 460 | + foreach ($options as $key => $value) { |
| 461 | + if (!is_array($value) && !empty($value)) { |
| 462 | + $details[] = '<span>'.ucfirst($key).': <b>'.$value.'</b></span>'; |
| 463 | + } |
| 464 | + } |
| 465 | + echo implode(' | ', $details); |
| 466 | + echo '</div>'; |
| 467 | + } |
| 468 | + } |
| 469 | + |
| 470 | + echo ' |
| 471 | + </div> |
428 | 472 | </div> |
429 | 473 | </div> |
430 | 474 | </div>'; |
431 | 475 | } |
| 476 | + |
432 | 477 | echo ' |
433 | | - <div> |
434 | | - <i class="fa fa-clock-o bg-gray"></i> |
435 | | - </div>'; |
| 478 | + <div> |
| 479 | + <i class="fa fa-clock-o bg-gray small"></i> |
| 480 | + <div class="timeline-item small shadow-sm"> |
| 481 | + <div class="timeline-body py-2 text-center text-muted small"> |
| 482 | + '.tr('Fine cronologia').' |
| 483 | + </div> |
| 484 | + </div> |
| 485 | + </div>'; |
436 | 486 | } else { |
437 | 487 | echo ' |
438 | | - <div class="alert alert-info"> |
439 | | - <b>'.tr('Informazione:').'</b> '.tr('Nessun log disponibile per questa scheda').'. |
| 488 | + <div class="alert alert-info small text-center"> |
| 489 | + <i class="fa fa-info-circle mr-2"></i> '.tr('Nessun log disponibile per questa scheda').'. |
440 | 490 | </div>'; |
441 | 491 | } |
442 | 492 |
|
443 | 493 | echo ' |
| 494 | + </div> |
| 495 | + </div> |
444 | 496 | </div> |
445 | 497 | </div>'; |
446 | 498 | } |
|
0 commit comments