pre version 2
This commit is contained in:
@@ -105,40 +105,6 @@
|
||||
</div>
|
||||
|
||||
@include('partials._tag-selector', ['selectedTags' => $selectedTags ?? [], 'label' => 'Etichette'])
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-sm table-borderless">
|
||||
<tr>
|
||||
<td style="width: 100px;"><strong>File:</strong></td>
|
||||
<td>{{ $documento->file_path }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Tipo MIME:</strong></td>
|
||||
<td>{{ $documento->mime_type ?? '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Dimensione:</strong></td>
|
||||
<td>{{ $documento->dimensione ? number_format($documento->dimensione / 1024, 1) . ' KB' : '-' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Creato:</strong></td>
|
||||
<td>{{ $documento->created_at->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@if($documento->user)
|
||||
<tr>
|
||||
<td><strong>Utente:</strong></td>
|
||||
<td>{{ $documento->user->name }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
@if($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
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,6 +18,18 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
{{-- Sidebar cartelle --}}
|
||||
<div class="col-md-3">
|
||||
@@ -133,7 +145,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<form id="massForm" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="_method" id="formMethod" value="POST">
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<div class="p-3 bg-light border-bottom d-flex align-items-center flex-wrap gap-2">
|
||||
<span class="font-weight-bold mr-2">Azioni:</span>
|
||||
<button type="button" class="btn btn-sm btn-danger" onclick="massAction('delete')">
|
||||
@@ -149,7 +161,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<button type="button" class="btn btn-sm btn-secondary" onclick="$('#massMoveModal').modal('show')">
|
||||
<i class="fas fa-folder-open mr-1"></i> Sposta selezionati in...
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-info" onclick="$('#massTagModal').modal('show')">
|
||||
<button type="button" class="btn btn-sm btn-info" onclick="showMassTagModal()">
|
||||
<i class="fas fa-tags mr-1"></i> Tag
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-success" onclick="massDownload()">
|
||||
@@ -186,7 +198,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<i class="fas fa-folder-open"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<button type="button" class="btn btn-xs btn-danger" onclick='deleteFolder({{ $cartella->id }}, {{ json_encode($cartella->nome) }})' title="Elimina">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
@@ -213,13 +225,13 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<div class="col-md-4 col-sm-6 mb-3">
|
||||
<div class="card card-outline card-secondary h-100">
|
||||
<div class="card-body p-3">
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<div class="float-right">
|
||||
<input type="checkbox" name="ids[]" value="{{ $documento->id }}" class="doc-checkbox" onchange="updateCount()">
|
||||
</div>
|
||||
@endif
|
||||
<h6 class="card-title font-weight-bold text-truncate mb-2" title="{{ $documento->nome_file }}">
|
||||
{{ $documento->nome_file }}
|
||||
<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>
|
||||
@@ -268,8 +280,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<button type="button" class="btn btn-xs btn-secondary" onclick="showUpdateModal({{ $documento->id }})" title="Cambia tipo/contesto">
|
||||
<i class="fas fa-tag"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="openSingleTag({{ $documento->id }})" title="Assegna tag">
|
||||
<i class="fas fa-tags"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<button type="button" class="btn btn-xs btn-danger" onclick="deleteDocumento({{ $documento->id }}, '{{ e($documento->nome_file) }}')" title="Elimina">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@@ -299,7 +314,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<table class="table table-bordered table-hover table-striped mb-0" id="documenti-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<th style="width: 40px;" data-column="select">
|
||||
<input type="checkbox" id="selectAll" onchange="toggleAll(this)">
|
||||
</th>
|
||||
@@ -316,7 +331,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<tbody>
|
||||
@foreach($sottoCartelle as $cartella)
|
||||
<tr class="table-warning">
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<td></td>
|
||||
@endif
|
||||
<td>
|
||||
@@ -341,7 +356,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<i class="fas fa-folder-open"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<button type="button" class="btn btn-xs btn-danger" onclick='deleteFolder({{ $cartella->id }}, {{ json_encode($cartella->nome) }})' title="Elimina">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
@@ -362,7 +377,7 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
};
|
||||
@endphp
|
||||
<tr>
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<td>
|
||||
<input type="checkbox" name="ids[]" value="{{ $documento->id }}" class="doc-checkbox" onchange="updateCount()">
|
||||
</td>
|
||||
@@ -466,8 +481,11 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
<button type="button" class="btn btn-xs btn-secondary" onclick="showUpdateModal({{ $documento->id }})" title="Cambia tipo/contesto">
|
||||
<i class="fas fa-tag"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="openSingleTag({{ $documento->id }})" title="Assegna tag">
|
||||
<i class="fas fa-tags"></i>
|
||||
</button>
|
||||
@endif
|
||||
@if($canDeleteDocumenti)
|
||||
@if($canWriteDocumenti)
|
||||
<button type="button" class="btn btn-xs btn-danger" onclick="deleteDocumento({{ $documento->id }}, '{{ e($documento->nome_file) }}')" title="Elimina">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
@@ -635,6 +653,10 @@ $tableColumnsJson = json_encode($tableColumns ?? []);
|
||||
</button>
|
||||
</div>
|
||||
@if($currentRepo)
|
||||
<div class="form-group">
|
||||
<label>Tag (opzionale)</label>
|
||||
@include("partials._tag-selector", ["selectedTags" => [], "label" => "Tag"])
|
||||
</div>
|
||||
<input type="hidden" name="repository_id" value="{{ $currentRepo->id }}">
|
||||
<p class="text-muted small mb-0">Caricamento su repository remoto: <strong>{{ $currentRepo->nome }}</strong></p>
|
||||
@endif
|
||||
@@ -1287,11 +1309,38 @@ document.getElementById('massMoveModal')?.addEventListener('show.bs.modal', func
|
||||
document.getElementById('massMoveCount').textContent = ids.length;
|
||||
});
|
||||
|
||||
document.getElementById('massTagModal')?.addEventListener('show.bs.modal', function() {
|
||||
const ids = getSelectedIds();
|
||||
function showMassTagModal() {
|
||||
var ids = getSelectedIds();
|
||||
|
||||
if (ids.length === 0) {
|
||||
const preSelected = document.querySelector('.doc-checkbox[data-pre-selected="true"]');
|
||||
if (preSelected) {
|
||||
ids = [preSelected.value];
|
||||
preSelected.removeAttribute('data-pre-selected');
|
||||
}
|
||||
}
|
||||
|
||||
if (ids.length === 0) {
|
||||
alert('Seleziona almeno un documento');
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('massTagIds').value = ids.join(',');
|
||||
document.getElementById('massTagCount').textContent = ids.length;
|
||||
});
|
||||
$('#massTagModal').modal('show');
|
||||
}
|
||||
|
||||
function openSingleTag(docId) {
|
||||
document.querySelectorAll('.doc-checkbox').forEach(cb => cb.checked = false);
|
||||
|
||||
let cb = document.querySelector('.doc-checkbox[value="' + docId + '"]');
|
||||
if (cb) {
|
||||
cb.checked = true;
|
||||
cb.dispatchEvent(new Event('change'));
|
||||
}
|
||||
|
||||
showMassTagModal();
|
||||
}
|
||||
|
||||
document.getElementById('massMoveNewFolderBtn')?.addEventListener('click', function() {
|
||||
Swal.fire({
|
||||
|
||||
Reference in New Issue
Block a user