fino a eventi e report prima del tipo di eventi

This commit is contained in:
2026-05-26 11:47:36 +02:00
parent 0bed099d05
commit f088dba4bf
47 changed files with 1733 additions and 6899 deletions
@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anteprima non disponibile</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
background-color: #f4f6f9;
color: #333;
}
.fallback-container {
text-align: center;
padding: 40px;
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
max-width: 400px;
}
.fallback-icon {
font-size: 64px;
color: #6c757d;
margin-bottom: 16px;
}
.fallback-title {
font-size: 18px;
font-weight: 600;
margin-bottom: 8px;
}
.fallback-message {
font-size: 14px;
color: #666;
margin-bottom: 24px;
}
.fallback-file-info {
background: #f8f9fa;
padding: 12px;
border-radius: 4px;
margin-bottom: 24px;
font-size: 13px;
}
.fallback-file-info strong {
display: block;
margin-bottom: 4px;
}
.download-btn {
display: inline-block;
padding: 10px 24px;
background-color: #007bff;
color: white;
text-decoration: none;
border-radius: 4px;
font-weight: 500;
transition: background-color 0.2s;
}
.download-btn:hover {
background-color: #0056b3;
color: white;
}
</style>
</head>
<body>
<div class="fallback-container">
<div class="fallback-icon">📄</div>
<div class="fallback-title">Anteprima non disponibile</div>
<div class="fallback-message">
Questo tipo di file non può essere visualizzato nell'anteprima.
Scarica il file per visualizzarlo con l'applicazione appropriata.
</div>
<div class="fallback-file-info">
<strong>{{ $documento->nome_file }}</strong>
{{ strtoupper(pathinfo($documento->file_path, PATHINFO_EXTENSION)) }} &middot;
{{ number_format($documento->dimensione / 1024, 1) }} KB
</div>
<a href="/documenti/{{ $documento->id }}/download" class="download-btn">
⬇️ Scarica File
</a>
</div>
</body>
</html>
+10
View File
@@ -149,6 +149,16 @@
<option value="12" {{ old('mese_annuale') == '12' ? 'selected' : '' }}>Dicembre</option>
</select>
</div>
<div class="form-group">
<label>Giorno del Mese</label>
<select name="giorno_mese" class="form-control">
<option value="">Seleziona giorno...</option>
@for($d = 1; $d <= 31; $d++)
<option value="{{ $d }}" {{ old('giorno_mese') == $d ? 'selected' : '' }}>{{ $d }}</option>
@endfor
</select>
<small class="form-text text-muted">Se il giorno non esiste nel mese selezionato, verrà usato l'ultimo giorno disponibile</small>
</div>
</div>
<div class="form-group">
+10
View File
@@ -160,6 +160,16 @@
<option value="12" {{ old('mese_annuale', $evento->mese_annuale) == '12' ? 'selected' : '' }}>Dicembre</option>
</select>
</div>
<div class="form-group">
<label>Giorno del Mese</label>
<select name="giorno_mese" class="form-control">
<option value="">Seleziona giorno...</option>
@for($d = 1; $d <= 31; $d++)
<option value="{{ $d }}" {{ old('giorno_mese', $evento->giorno_mese) == $d ? 'selected' : '' }}>{{ $d }}</option>
@endfor
</select>
<small class="form-text text-muted">Se il giorno non esiste nel mese selezionato, verrà usato l'ultimo giorno disponibile</small>
</div>
</div>
<div class="form-group">
+3
View File
@@ -20,6 +20,9 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
<div class="card-header">
<h3 class="card-title">Tutti gli Eventi</h3>
<div class="card-tools">
<a href="/eventi/calendar" class="btn btn-sm btn-outline-primary mr-2">
<i class="fas fa-calendar-alt mr-1"></i> Calendario
</a>
@if($canDeleteEventi)
<div class="btn-group mr-2">
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
+108 -5
View File
@@ -121,6 +121,43 @@ $canDeleteGruppi = Auth::user()->canDelete('gruppi');
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">
<h3 class="card-title"><i class="fas fa-camera mr-2"></i>Avatar</h3>
</div>
<div class="card-body text-center">
@if($gruppo->avatar_url)
<img src="{{ $gruppo->avatar_url }}"
alt="{{ $gruppo->nome }}"
class="img-thumbnail mb-2"
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 50%;">
<br>
<form id="remove-avatar-form" class="d-inline">
<button type="button" class="btn btn-danger btn-sm" onclick="removeAvatar()">
<i class="fas fa-trash mr-1"></i>Rimuovi
</button>
</form>
@else
<div class="bg-secondary d-flex align-items-center justify-content-center mb-3"
style="width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;">
<i class="fas fa-folder fa-4x text-white"></i>
</div>
@endif
<form id="avatar-upload-form" enctype="multipart/form-data">
@csrf
<div class="custom-file mb-2">
<input type="file" class="custom-file-input" id="avatar-input" name="avatar" accept="image/jpeg,image/png,image/gif,image/webp">
<label class="custom-file-label" for="avatar-input">Scegli immagine...</label>
</div>
<button type="button" class="btn btn-primary btn-sm" onclick="uploadAvatar()">
<i class="fas fa-upload mr-1"></i>Carica
</button>
</form>
<div id="avatar-message" class="mt-2"></div>
</div>
</div>
</div>
@php
$incontroEvento = $gruppo->eventi->where('is_incontro_gruppo', true)->first();
@@ -155,6 +192,9 @@ $canDeleteGruppi = Auth::user()->canDelete('gruppi');
<span class="badge badge-info ml-1">Mensile</span>
@elseif($incontroEvento->tipo_recorrenza === 'annuale')
{{ $incontroEvento->mese_annuale_label }}
@if($incontroEvento->giorno_mese)
, giorno {{ $incontroEvento->giorno_mese }}
@endif
<span class="badge badge-info ml-1">Annuale</span>
@elseif($incontroEvento->tipo_recorrenza === 'altro')
{{ $incontroEvento->giorno_settimana_label }}
@@ -503,13 +543,76 @@ function previewDocumento(id, mimeType) {
document.getElementById('previewDownloadBtn').href = downloadUrl;
document.getElementById('previewModalTitle').textContent = 'Anteprima';
if (mimeType && mimeType.startsWith('image/')) {
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
} else {
document.getElementById('previewDownloadBtn').style.display = 'none';
}
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
$('#previewModal').modal('show');
}
document.getElementById('avatar-input').addEventListener('change', function(e) {
if (e.target.files.length > 0) {
var label = e.target.files[0].name;
var next = e.target.nextElementSibling;
if (next && next.classList.contains('custom-file-label')) {
next.textContent = label;
}
}
});
function uploadAvatar() {
var input = document.getElementById('avatar-input');
if (!input.files.length) {
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Seleziona un\'immagine</span>';
return;
}
var formData = new FormData();
formData.append('avatar', input.files[0]);
formData.append('_token', '{{ csrf_token() }}');
document.getElementById('avatar-message').innerHTML = '<span class="text-info"><i class="fas fa-spinner fa-spin"></i> Caricamento...</span>';
fetch('{{ url('/gruppi/' . $gruppo->id . '/avatar') }}', {
method: 'POST',
body: formData,
headers: { 'X-Requested-With': 'XMLHttpRequest' },
})
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar caricato!</span>';
setTimeout(function() { window.location.reload(); }, 1000);
} else {
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
}
})
.catch(error => {
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
});
}
function removeAvatar() {
if (!confirm('Rimuovere l\'avatar?')) return;
fetch('{{ url('/gruppi/' . $gruppo->id . '/avatar') }}', {
method: 'DELETE',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}',
'X-Requested-With': 'XMLHttpRequest',
'Accept': 'application/json',
},
})
.then(response => response.json())
.then(data => {
if (data.success) {
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar rimosso!</span>';
setTimeout(function() { window.location.reload(); }, 1000);
} else {
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
}
})
.catch(error => {
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
});
}
</script>
@endsection
@@ -0,0 +1,399 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stampa Report - {{ $data['title'] ?? 'Report' }}</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 12px;
line-height: 1.4;
color: #333;
background: #f5f5f5;
}
.toolbar {
background: #2c3e50;
color: #fff;
padding: 15px 20px;
display: flex;
align-items: center;
justify-content: space-between;
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.toolbar-left {
display: flex;
align-items: center;
gap: 15px;
}
.toolbar-title {
font-size: 18px;
font-weight: bold;
}
.toolbar-group {
display: flex;
align-items: center;
gap: 8px;
}
.toolbar label {
font-size: 13px;
opacity: 0.9;
}
.toolbar select {
padding: 6px 12px;
border: 1px solid #4a5568;
border-radius: 4px;
background: #4a5568;
color: #fff;
font-size: 13px;
cursor: pointer;
}
.toolbar select:focus {
outline: none;
border-color: #63b3ed;
}
.btn {
padding: 8px 16px;
border: none;
border-radius: 4px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: all 0.2s;
}
.btn-print {
background: #28a745;
color: #fff;
}
.btn-print:hover {
background: #218838;
}
.btn-close {
background: #dc3545;
color: #fff;
}
.btn-close:hover {
background: #c82333;
}
.btn-secondary {
background: #6c757d;
color: #fff;
}
.btn-secondary:hover {
background: #5a6268;
}
.preview-container {
max-width: 210mm;
margin: 20px auto;
background: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 20px;
}
.preview-container.portrait {
width: 210mm;
min-height: 297mm;
}
.preview-container.landscape {
width: 297mm;
min-height: 210mm;
}
.report-header {
text-align: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 2px solid #2c3e50;
}
.report-header h1 {
font-size: 24px;
color: #2c3e50;
margin-bottom: 5px;
}
.report-header .subtitle {
font-size: 14px;
color: #7f8c8d;
}
.report-summary {
background: #e8f4f8;
padding: 12px 15px;
margin-bottom: 20px;
border-left: 4px solid #17a2b8;
font-size: 13px;
}
.report-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 11px;
}
.report-table th,
.report-table td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
.report-table th {
background: #f8f9fa;
font-weight: bold;
color: #2c3e50;
}
.report-table tr:nth-child(even) {
background: #fafafa;
}
.report-table tr:hover {
background: #f0f0f0;
}
.no-data {
text-align: center;
color: #999;
font-style: italic;
padding: 40px 20px;
}
.no-data i {
font-size: 48px;
margin-bottom: 10px;
display: block;
}
.report-footer {
margin-top: 30px;
padding-top: 15px;
border-top: 1px solid #ddd;
text-align: center;
font-size: 10px;
color: #999;
}
.row-count {
font-size: 12px;
color: #666;
margin-top: 10px;
text-align: right;
}
@page {
margin: 15mm;
}
@media print {
@page portrait {
size: portrait;
}
@page landscape {
size: landscape;
}
.toolbar {
display: none !important;
}
body {
background: #fff;
padding: 0;
}
.preview-container {
margin: 0;
box-shadow: none;
padding: 0;
max-width: none;
width: 100%;
}
.preview-container.portrait {
width: auto;
min-height: auto;
}
.preview-container.landscape {
width: auto;
min-height: auto;
}
.report-table {
page-break-inside: auto;
}
.report-table tr {
page-break-inside: avoid;
page-break-after: auto;
}
.report-table thead {
display: table-header-group;
}
.report-table tfoot {
display: table-footer-group;
}
}
</style>
</head>
<body>
<div class="toolbar" id="toolbar">
<div class="toolbar-left">
<span class="toolbar-title">Anteprima di Stampa</span>
<div class="toolbar-group">
<label for="orientation">Orientamento:</label>
<select id="orientation">
<option value="portrait">Verticale (Portrait)</option>
<option value="landscape">Orizzontale (Landscape)</option>
</select>
</div>
<div class="toolbar-group">
<label for="font-size">Dimensione font:</label>
<select id="font-size">
<option value="10">Piccolo (10px)</option>
<option value="11">Normale (11px)</option>
<option value="12" selected>Medio (12px)</option>
<option value="13">Grande (13px)</option>
</select>
</div>
</div>
<div>
<button class="btn btn-secondary" onclick="window.opener ? window.close() : window.location.href='{{ route('report.index') }}'">
Indietro
</button>
<button class="btn btn-print" onclick="printReport()">
Stampa
</button>
</div>
</div>
<div class="preview-container portrait" id="preview-container">
<div class="report-header">
<h1>{{ $data['title'] ?? 'Report' }}</h1>
<div class="subtitle">Generato il {{ now()->format('d/m/Y H:i') }}</div>
</div>
@if(!empty($data['summary']))
<div class="report-summary">
<strong>{{ $data['summary'] }}</strong>
</div>
@endif
@if(!empty($data['headers']) && !empty($data['rows']))
<table class="report-table" id="report-table">
<thead>
<tr>
@foreach($data['headers'] as $header)
<th>{{ $header }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($data['rows'] as $row)
<tr>
@foreach($row as $cell)
<td>{{ is_array($cell) ? json_encode($cell) : $cell }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
<div class="row-count">Totale righe: {{ count($data['rows']) }}</div>
@else
<div class="no-data">
Nessun dato disponibile per questo report.
</div>
@endif
<div class="report-footer">
<p>Report generato automaticamente - Glastree</p>
</div>
</div>
<script>
const orientationSelect = document.getElementById('orientation');
const fontSizeSelect = document.getElementById('font-size');
const previewContainer = document.getElementById('preview-container');
const reportTable = document.getElementById('report-table');
function printReport() {
window.print();
}
orientationSelect.addEventListener('change', function() {
previewContainer.classList.remove('portrait', 'landscape');
previewContainer.classList.add(this.value);
if (this.value === 'landscape') {
document.body.classList.add('landscape-mode');
} else {
document.body.classList.remove('landscape-mode');
}
});
fontSizeSelect.addEventListener('change', function() {
const size = this.value;
document.body.style.fontSize = size + 'px';
if (reportTable) {
reportTable.style.fontSize = (parseInt(size) - 1) + 'px';
}
});
document.addEventListener('DOMContentLoaded', function() {
const savedOrientation = localStorage.getItem('report-print-orientation');
const savedFontSize = localStorage.getItem('report-print-font-size');
if (savedOrientation) {
orientationSelect.value = savedOrientation;
orientationSelect.dispatchEvent(new Event('change'));
}
if (savedFontSize) {
fontSizeSelect.value = savedFontSize;
fontSizeSelect.dispatchEvent(new Event('change'));
}
});
orientationSelect.addEventListener('change', function() {
localStorage.setItem('report-print-orientation', this.value);
});
fontSizeSelect.addEventListener('change', function() {
localStorage.setItem('report-print-font-size', this.value);
});
</script>
</body>
</html>
+3
View File
@@ -11,6 +11,9 @@
<a href="{{ route('report.index') }}" class="btn btn-sm btn-secondary mr-2">
<i class="fas fa-arrow-left mr-1"></i> Torna ai Report
</a>
<a href="{{ route('report.print-preview', ['report' => $reportType, 'custom_id' => $customReport->id ?? null]) }}" class="btn btn-sm btn-info mr-2" target="_blank">
<i class="fas fa-print mr-1"></i> Stampa Report
</a>
<a href="{{ route('report.export', ['report' => $reportType]) }}" class="btn btn-sm btn-success">
<i class="fas fa-file-csv mr-1"></i> Esporta CSV
</a>