fix doc
This commit is contained in:
@@ -16,6 +16,13 @@
|
||||
<label>Nome *</label>
|
||||
<input type="text" name="nome_file" class="form-control" value="{{ old('nome_file', $documento->nome_file) }}" required>
|
||||
</div>
|
||||
@if($documento->isLink())
|
||||
<div class="form-group">
|
||||
<label>URL esterno</label>
|
||||
<input type="url" name="url" class="form-control" value="{{ old('url', $documento->url) }}" placeholder="https://esempio.com/documento.pdf">
|
||||
<small class="text-muted">Modifica l'indirizzo web del documento</small>
|
||||
</div>
|
||||
@endif
|
||||
<div class="form-group">
|
||||
<label>Tipologia *</label>
|
||||
<select name="tipologia" class="form-control" required>
|
||||
@@ -72,6 +79,12 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-sm table-borderless">
|
||||
@if($documento->isLink())
|
||||
<tr>
|
||||
<td style="width: 100px;"><strong>URL:</strong></td>
|
||||
<td><a href="{{ $documento->url }}" target="_blank" class="text-truncate d-inline-block" style="max-width: 200px;">{{ $documento->url }}</a></td>
|
||||
</tr>
|
||||
@else
|
||||
<tr>
|
||||
<td style="width: 100px;"><strong>File:</strong></td>
|
||||
<td>{{ $documento->file_path }}</td>
|
||||
@@ -84,6 +97,11 @@
|
||||
<td><strong>Dimensione:</strong></td>
|
||||
<td>{{ $documento->dimensione ? number_format($documento->dimensione / 1024, 1) . ' KB' : '-' }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td><strong>Tipo:</strong></td>
|
||||
<td>@if($documento->isLink()) <span class="badge badge-info">Link esterno</span> @else Upload @endif</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Creato:</strong></td>
|
||||
<td>{{ $documento->created_at->format('d/m/Y H:i') }}</td>
|
||||
@@ -95,7 +113,12 @@
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
@if($documento->file_path)
|
||||
@if($documento->isLink())
|
||||
<hr>
|
||||
<a href="{{ $documento->url }}" target="_blank" class="btn btn-info btn-block">
|
||||
<i class="fas fa-external-link-alt mr-1"></i> Apri link esterno
|
||||
</a>
|
||||
@elseif($documento->file_path)
|
||||
<hr>
|
||||
<a href="/documenti/{{ $documento->id }}/download" class="btn btn-primary btn-block">
|
||||
<i class="fas fa-download mr-1"></i> Scarica
|
||||
|
||||
@@ -234,7 +234,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<a href="/documenti/{{ $documento->id }}/edit">{{ $documento->nome_file }}</a>
|
||||
</h6>
|
||||
<div class="text-center py-2" style="font-size: 2.5rem;">
|
||||
<i class="fas {{ $icon }}"></i>
|
||||
@if($documento->isLink())
|
||||
<i class="fas fa-link text-info"></i>
|
||||
@else
|
||||
<i class="fas {{ $icon }}"></i>
|
||||
@endif
|
||||
</div>
|
||||
<div class="text-center mb-2">
|
||||
<span class="badge badge-{{ $documento->tipologia === 'avatar' ? 'primary' : ($documento->tipologia === 'galleria' ? 'success' : 'secondary') }}">
|
||||
@@ -259,7 +263,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer p-2 text-center">
|
||||
@if($documento->file_path)
|
||||
@if($documento->isLink())
|
||||
<a href="{{ $documento->url }}" target="_blank" class="btn btn-xs btn-info" title="Apri link esterno">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
@elseif($documento->file_path)
|
||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDoc({{ $documento->id }}, '{{ $documento->mime_type }}')" title="Anteprima">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
@@ -271,9 +279,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<a href="/documenti/{{ $documento->id }}/edit" class="btn btn-xs btn-warning" title="Modifica">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@if(!$documento->isLink())
|
||||
<button type="button" class="btn btn-xs btn-secondary" onclick="showMoveModal({{ $documento->id }}, '{{ e($documento->nome_file) }}')" title="Sposta in altra cartella">
|
||||
<i class="fas fa-folder-open"></i>
|
||||
</button>
|
||||
@endif
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="showAssociateModal({{ $documento->id }})" title="Associa a...">
|
||||
<i class="fas fa-link"></i>
|
||||
</button>
|
||||
@@ -383,7 +393,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
</td>
|
||||
@endif
|
||||
<td>
|
||||
<i class="fas {{ $icon }} mr-2"></i>
|
||||
@if($documento->isLink())
|
||||
<i class="fas fa-link text-info mr-2"></i>
|
||||
@else
|
||||
<i class="fas {{ $icon }} mr-2"></i>
|
||||
@endif
|
||||
<span class="font-weight-bold">{{ $documento->nome_file }}</span>
|
||||
<div class="small text-muted">
|
||||
@if($documento->user){{ $documento->user->name }}@endif
|
||||
@@ -460,7 +474,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
</td>
|
||||
<td class="small">{{ $documento->created_at->format('d/m/Y') }}</td>
|
||||
<td>
|
||||
@if($documento->file_path)
|
||||
@if($documento->isLink())
|
||||
<a href="{{ $documento->url }}" target="_blank" class="btn btn-xs btn-info" title="Apri link esterno">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
@elseif($documento->file_path)
|
||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDoc({{ $documento->id }}, '{{ $documento->mime_type }}')" title="Anteprima">
|
||||
<i class="fas fa-eye"></i>
|
||||
</button>
|
||||
@@ -472,9 +490,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<a href="/documenti/{{ $documento->id }}/edit" class="btn btn-xs btn-warning" title="Modifica">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
@if(!$documento->isLink())
|
||||
<button type="button" class="btn btn-xs btn-secondary" onclick="showMoveModal({{ $documento->id }}, '{{ e($documento->nome_file) }}')" title="Sposta in altra cartella">
|
||||
<i class="fas fa-folder-open"></i>
|
||||
</button>
|
||||
@endif
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="showAssociateModal({{ $documento->id }})" title="Associa a...">
|
||||
<i class="fas fa-link"></i>
|
||||
</button>
|
||||
@@ -631,10 +651,28 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
</div>
|
||||
@endif
|
||||
<div class="form-group">
|
||||
<label>Tipo caricamento</label>
|
||||
<div class="btn-group btn-group-toggle d-block" data-toggle="buttons">
|
||||
<label class="btn btn-outline-primary active" id="tipoFileLabel">
|
||||
<input type="radio" name="tipo_caricamento" value="file" checked onchange="toggleTipoCaricamento()">
|
||||
<i class="fas fa-upload mr-1"></i> File
|
||||
</label>
|
||||
<label class="btn btn-outline-info" id="tipoLinkLabel">
|
||||
<input type="radio" name="tipo_caricamento" value="link" onchange="toggleTipoCaricamento()">
|
||||
<i class="fas fa-link mr-1"></i> URL esterno
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="fileUploadGroup">
|
||||
<label>File *</label>
|
||||
<input type="file" name="file" class="form-control" required>
|
||||
<input type="file" name="file" class="form-control" id="fileInput">
|
||||
<small class="text-muted">Max 10MB</small>
|
||||
</div>
|
||||
<div class="form-group" id="urlUploadGroup" style="display:none;">
|
||||
<label>URL esterno *</label>
|
||||
<input type="url" name="url" class="form-control" id="urlInput" placeholder="https://esempio.com/documento.pdf">
|
||||
<small class="text-muted">Inserisci l'indirizzo web del documento</small>
|
||||
</div>
|
||||
<div class="form-group" id="uploadFolderGroup">
|
||||
<label>Cartella</label>
|
||||
<select name="cartella_id" id="uploadCartellaId" class="form-control">
|
||||
@@ -1165,6 +1203,26 @@ function previewDoc(id, mimeType) {
|
||||
$('#previewModal').modal('show');
|
||||
}
|
||||
|
||||
function toggleTipoCaricamento() {
|
||||
var tipo = document.querySelector('input[name="tipo_caricamento"]:checked').value;
|
||||
var fileGroup = document.getElementById('fileUploadGroup');
|
||||
var urlGroup = document.getElementById('urlUploadGroup');
|
||||
var fileInput = document.getElementById('fileInput');
|
||||
var urlInput = document.getElementById('urlInput');
|
||||
|
||||
if (tipo === 'link') {
|
||||
fileGroup.style.display = 'none';
|
||||
urlGroup.style.display = 'block';
|
||||
fileInput.removeAttribute('required');
|
||||
urlInput.setAttribute('required', 'required');
|
||||
} else {
|
||||
fileGroup.style.display = 'block';
|
||||
urlGroup.style.display = 'none';
|
||||
fileInput.setAttribute('required', 'required');
|
||||
urlInput.removeAttribute('required');
|
||||
}
|
||||
}
|
||||
|
||||
function loadUploadTargets() {
|
||||
const visibilita = document.getElementById('uploadVisibilita').value;
|
||||
const group = document.getElementById('uploadTargetGroup');
|
||||
|
||||
@@ -49,38 +49,63 @@
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.download-btn {
|
||||
.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 {
|
||||
.btn-primary {
|
||||
background-color: #007bff;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background-color: #0056b3;
|
||||
color: white;
|
||||
}
|
||||
.btn-info {
|
||||
background-color: #17a2b8;
|
||||
}
|
||||
.btn-info:hover {
|
||||
background-color: #138496;
|
||||
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)) }} ·
|
||||
{{ number_format($documento->dimensione / 1024, 1) }} KB
|
||||
</div>
|
||||
<a href="/documenti/{{ $documento->id }}/download" class="download-btn">
|
||||
⬇️ Scarica File
|
||||
</a>
|
||||
@if($documento->isLink())
|
||||
<div class="fallback-icon">🔗</div>
|
||||
<div class="fallback-title">Documento esterno</div>
|
||||
<div class="fallback-message">
|
||||
Questo è un collegamento a una risorsa esterna.
|
||||
Clicca il pulsante qui sotto per aprirla.
|
||||
</div>
|
||||
<div class="fallback-file-info">
|
||||
<strong>{{ $documento->nome_file }}</strong>
|
||||
URL esterno
|
||||
</div>
|
||||
<a href="{{ $documento->url }}" target="_blank" class="btn btn-info">
|
||||
Apri link esterno
|
||||
</a>
|
||||
@else
|
||||
<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>
|
||||
{{ $documento->file_path ? strtoupper(pathinfo($documento->file_path, PATHINFO_EXTENSION)) : '-' }} ·
|
||||
{{ $documento->dimensione ? number_format($documento->dimensione / 1024, 1) . ' KB' : '-' }}
|
||||
</div>
|
||||
<a href="/documenti/{{ $documento->id }}/download" class="btn btn-primary">
|
||||
Scarica File
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
<label class="custom-control-label" for="doc-{{ $doc->id }}"></label>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ $doc->nome_file }}</td>
|
||||
<td>{{ $doc->nome_file }} @if($doc->isLink()) <span class="badge badge-info"><i class="fas fa-link mr-1"></i>URL</span> @endif</td>
|
||||
<td><span class="badge badge-info">{{ $doc->tipologia ?: $doc->tipo }}</span></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -39,6 +39,14 @@
|
||||
<span class="invalid-feedback">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Anno Fondazione</label>
|
||||
<input type="number" name="anno_fondazione" class="form-control @error('anno_fondazione') is-invalid @enderror"
|
||||
value="{{ old('anno_fondazione') }}" min="1800" max="{{ date('Y') + 1 }}" step="1">
|
||||
@error('anno_fondazione')
|
||||
<span class="invalid-feedback">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Gruppo Padre</label>
|
||||
<select name="parent_id" class="form-control">
|
||||
|
||||
@@ -36,6 +36,14 @@
|
||||
<label>Nome *</label>
|
||||
<input type="text" name="nome" class="form-control" value="{{ old('nome', $gruppo->nome) }}" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Anno Fondazione</label>
|
||||
<input type="number" name="anno_fondazione" class="form-control @error('anno_fondazione') is-invalid @enderror"
|
||||
value="{{ old('anno_fondazione', $gruppo->anno_fondazione) }}" min="1800" max="{{ date('Y') + 1 }}" step="1">
|
||||
@error('anno_fondazione')
|
||||
<span class="invalid-feedback">{{ $message }}</span>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Gruppo Padre</label>
|
||||
<select name="parent_id" class="form-control">
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<h6>Campi:</h6>
|
||||
<ul>
|
||||
<li><code>nome</code> (obbligatorio)</li>
|
||||
<li><code>anno_fondazione</code> (anno, es. 2020)</li>
|
||||
<li><code>descrizione</code></li>
|
||||
<li><code>parent_id</code> (ID del gruppo padre)</li>
|
||||
<li><code>diocesi_id</code> (ID della diocesi)</li>
|
||||
|
||||
@@ -7,6 +7,7 @@ $canWriteGruppi = Auth::user()->canManage('gruppi');
|
||||
$canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
||||
$columnLabels = [
|
||||
'nome' => 'Nome',
|
||||
'anno_fondazione' => 'Anno Fond.',
|
||||
'descrizione' => 'Descrizione',
|
||||
'diocesi' => 'Diocesi',
|
||||
'livello' => 'Livello',
|
||||
@@ -104,6 +105,9 @@ $entityType = $entityType ?? 'gruppi';
|
||||
@if(in_array('nome', $visibleColumns))
|
||||
<th data-sortable="true" data-column="nome" onclick="sortTable('nome')" style="cursor:pointer;">Nome <i class="fas fa-sort float-right text-muted"></i></th>
|
||||
@endif
|
||||
@if(in_array('anno_fondazione', $visibleColumns))
|
||||
<th style="width: 120px;" data-column="anno_fondazione">Anno Fond.</th>
|
||||
@endif
|
||||
@if(in_array('descrizione', $visibleColumns))
|
||||
<th data-sortable="true" data-column="descrizione" onclick="sortTable('descrizione')" style="cursor:pointer;">Descrizione <i class="fas fa-sort float-right text-muted"></i></th>
|
||||
@endif
|
||||
@@ -157,6 +161,9 @@ $entityType = $entityType ?? 'gruppi';
|
||||
</span>
|
||||
</td>
|
||||
@endif
|
||||
@if(in_array('anno_fondazione', $visibleColumns))
|
||||
<td>{{ $gruppo->anno_fondazione ?? '-' }}</td>
|
||||
@endif
|
||||
@if(in_array('descrizione', $visibleColumns))
|
||||
<td>{{ Str::limit($gruppo->descrizione, 50) ?: '-' }}</td>
|
||||
@endif
|
||||
|
||||
@@ -64,6 +64,10 @@ $canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Anno Fondazione:</strong></td>
|
||||
<td>{{ $gruppo->anno_fondazione ?? '-' }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
<label class="custom-control-label" for="doc-{{ $doc->id }}"></label>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ $doc->nome_file }}</td>
|
||||
<td>{{ $doc->nome_file }} @if($doc->isLink()) <span class="badge badge-info"><i class="fas fa-link mr-1"></i>URL</span> @endif</td>
|
||||
<td><span class="badge badge-info">{{ $doc->tipologia ?: $doc->tipo }}</span></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<label class="custom-control-label" for="doc-{{ $doc->id }}"></label>
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ $doc->nome_file }}</td>
|
||||
<td>{{ $doc->nome_file }} @if($doc->isLink()) <span class="badge badge-info"><i class="fas fa-link mr-1"></i>URL</span> @endif</td>
|
||||
<td><span class="badge badge-info">{{ $doc->tipologia ?: $doc->tipo }}</span></td>
|
||||
<td>{{ $doc->created_at->format('d/m/Y') }}</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user