++ fix: use months for assignment PDF link TTL instead of hours
This commit is contained in:
@@ -59,14 +59,14 @@
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<a href="{{ route('territori.show', $t) }}" class="text-sm font-semibold text-gray-900 hover:text-indigo-600">N° {{ $t->numero }}</a>
|
||||
@if($t->is_prioritario)
|
||||
@if($t->home_is_prioritario)
|
||||
<span class="inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-800">Prioritario</span>
|
||||
@endif
|
||||
</div>
|
||||
<p class="text-xs text-gray-500">
|
||||
{{ $t->zona?->nome }} — {{ $t->tipologia?->nome }}
|
||||
@if($t->giorni_giacenza > 0)
|
||||
— in reparto da {{ $t->giorni_giacenza }} giorni
|
||||
@if($t->home_giorni_giacenza > 0)
|
||||
— in reparto da {{ $t->home_giorni_giacenza }} giorni
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
@@ -78,7 +78,7 @@
|
||||
<li class="px-4 py-4 text-sm text-gray-400 text-center">Tutti assegnati</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
@if($territoriDaAssegnare->count() >= 10)
|
||||
@if($territoriDaAssegnare->count() >= $homeLimit)
|
||||
<div class="px-4 py-2 bg-gray-50 border-t text-center">
|
||||
<a href="{{ route('territori.index') }}?filtroStato=in_reparto" class="text-xs text-indigo-600 hover:text-indigo-800">Vedi tutti →</a>
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@
|
||||
<li class="px-4 py-4 text-sm text-gray-400 text-center">Nessun territorio da rientrare</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
@if($daRientrare->count() >= 10)
|
||||
@if($daRientrare->count() >= $homeLimit)
|
||||
<div class="px-4 py-2 bg-gray-50 border-t text-center">
|
||||
<a href="{{ route('territori.index') }}?filtroStato=da_rientrare" class="text-xs text-indigo-600 hover:text-indigo-800">Vedi tutti →</a>
|
||||
</div>
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
@forelse($assegnazioni as $a)
|
||||
<tr class="hover:bg-gray-50">
|
||||
@php($temporaryPdfUrl = !$a->returned_at ? $a->temporaryPdfViewerUrl() : null)
|
||||
<td class="px-3 py-2">
|
||||
<div class="flex items-center gap-2">
|
||||
@if($a->territorio?->thumbnail_path)
|
||||
@@ -98,6 +99,14 @@
|
||||
</td>
|
||||
@can('settings.manage')
|
||||
<td class="px-3 py-2 whitespace-nowrap">
|
||||
@can('territori.assign')
|
||||
@if($a->territorio?->attivo && !$a->territorio?->assegnazioneCorrente)
|
||||
<a href="{{ route('assegnazioni.assegna', ['territorioId' => $a->territorio_id]) }}"
|
||||
class="inline-block text-xs font-medium text-emerald-600 hover:text-emerald-800 mr-3">
|
||||
Assegna
|
||||
</a>
|
||||
@endif
|
||||
@endcan
|
||||
@can('territori.return')
|
||||
@if(!$a->returned_at)
|
||||
<a href="{{ route('assegnazioni.rientra', ['assegnazione' => $a->id]) }}"
|
||||
@@ -106,6 +115,14 @@
|
||||
</a>
|
||||
@endif
|
||||
@endcan
|
||||
@if($temporaryPdfUrl)
|
||||
<a href="{{ $temporaryPdfUrl }}"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="inline-block text-xs font-medium text-indigo-600 hover:text-indigo-800 mr-3">
|
||||
PDF
|
||||
</a>
|
||||
@endif
|
||||
<button wire:click="openEdit({{ $a->id }})"
|
||||
style="background:#e0e7ff;color:#4338ca;border:none;border-radius:6px;padding:4px 10px;font-size:12px;cursor:pointer;margin-right:4px;">
|
||||
Modifica
|
||||
|
||||
@@ -56,6 +56,13 @@
|
||||
@error('home_limit_list') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="assignment_link_ttl_months" class="block text-sm font-medium text-gray-700">Validità link PDF assegnazione (mesi)</label>
|
||||
<p class="text-xs text-gray-500 mb-1">Durata del link temporaneo condivisibile per il PDF dell'assegnazione attiva.</p>
|
||||
<input wire:model="assignment_link_ttl_months" type="number" min="1" max="24" id="assignment_link_ttl_months" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||
@error('assignment_link_ttl_months') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="audit_retention_days" class="block text-sm font-medium text-gray-700">Conservazione Audit (giorni)</label>
|
||||
<p class="text-xs text-gray-500 mb-1">I log più vecchi di questo periodo verranno cancellati automaticamente.</p>
|
||||
|
||||
@@ -128,6 +128,11 @@
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm text-right space-x-1">
|
||||
<a href="{{ route('territori.show', $territorio) }}" class="text-indigo-600 hover:text-indigo-800 text-xs font-medium">Dettaglio</a>
|
||||
@can('territori.assign')
|
||||
@if(!$territorio->assegnazioneCorrente && $territorio->attivo)
|
||||
<a href="{{ route('assegnazioni.assegna', ['territorioId' => $territorio->id]) }}" class="text-emerald-600 hover:text-emerald-800 text-xs font-medium">Assegna</a>
|
||||
@endif
|
||||
@endcan
|
||||
@can('territori.return')
|
||||
@if($territorio->assegnazioneCorrente)
|
||||
<a href="{{ route('assegnazioni.rientra', ['assegnazione' => $territorio->assegnazioneCorrente->id]) }}" class="text-red-600 hover:text-red-800 text-xs font-medium">Rientra</a>
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
<a href="{{ route('territori.index') }}" class="text-sm text-indigo-600 hover:text-indigo-800">← Torna alla lista</a>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
@can('territori.assign')
|
||||
@if(!$territorio->assegnazioneCorrente && $territorio->attivo)
|
||||
<a href="{{ route('assegnazioni.assegna', ['territorioId' => $territorio->id]) }}" class="px-4 py-2 text-sm font-medium text-white bg-emerald-600 rounded-lg hover:bg-emerald-700 transition">Assegna</a>
|
||||
@endif
|
||||
@endcan
|
||||
@can('territori.return')
|
||||
@if($territorio->assegnazioneCorrente)
|
||||
<a href="{{ route('assegnazioni.rientra', ['assegnazione' => $territorio->assegnazioneCorrente->id]) }}" class="px-4 py-2 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700 transition">Rientra</a>
|
||||
@@ -63,6 +68,48 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if($activeAssignment)
|
||||
@php($temporaryPdfUrl = $activeAssignment->temporaryPdfViewerUrl())
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6 mb-6" x-data="{ copied: false }">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between">
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold text-gray-900">Assegnazione attiva</h2>
|
||||
<p class="mt-1 text-sm text-gray-600">
|
||||
{{ $activeAssignment->proclamatore?->nome_completo ?? 'N/A' }}
|
||||
— assegnato il {{ $activeAssignment->assigned_at->format('d/m/Y') }}
|
||||
— {{ $activeAssignment->giorni }} giorni
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
@can('territori.return')
|
||||
<a href="{{ route('assegnazioni.rientra', ['assegnazione' => $activeAssignment->id]) }}" class="inline-flex items-center rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 transition">Rientra</a>
|
||||
@endcan
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($temporaryPdfUrl)
|
||||
<div class="mt-4 rounded-xl border border-indigo-100 bg-indigo-50/70 p-4">
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<div class="text-sm font-medium text-indigo-900">Link PDF temporaneo</div>
|
||||
<div class="mt-1 text-xs text-indigo-700">Valido per {{ $assignmentLinkTtlMonths }} {{ $assignmentLinkTtlMonths === 1 ? 'mese' : 'mesi' }} o fino al rientro del territorio.</div>
|
||||
</div>
|
||||
<a href="{{ $temporaryPdfUrl }}" target="_blank" rel="noopener noreferrer" class="inline-flex items-center justify-center rounded-lg border border-indigo-200 bg-white px-3 py-2 text-sm font-medium text-indigo-700 hover:bg-indigo-100 transition">Apri viewer</a>
|
||||
</div>
|
||||
<div class="mt-3 flex flex-col gap-2 sm:flex-row">
|
||||
<input x-ref="assignmentPdfLink" type="text" readonly value="{{ $temporaryPdfUrl }}" class="block w-full rounded-lg border border-indigo-200 bg-white px-3 py-2 text-sm text-gray-700 focus:border-indigo-500 focus:ring-indigo-500">
|
||||
<button type="button" @click="navigator.clipboard.writeText($refs.assignmentPdfLink.value); copied = true; setTimeout(() => copied = false, 1800);" class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white hover:bg-indigo-700 transition">Copia link</button>
|
||||
</div>
|
||||
<p x-show="copied" x-cloak class="mt-2 text-xs font-medium text-green-700">Link copiato.</p>
|
||||
</div>
|
||||
@elseif($territorio->pdf_path)
|
||||
<div class="mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-800">
|
||||
Il link PDF temporaneo è disponibile solo per assegnazioni attive con PDF associato.
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- PDF viewer --}}
|
||||
@if($territorio->pdf_path)
|
||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 mb-6">
|
||||
|
||||
Reference in New Issue
Block a user