++ fix: aggiornamento dipendenze e correzione bug
This commit is contained in:
@@ -116,9 +116,16 @@ class Assegna extends Component
|
|||||||
->get()
|
->get()
|
||||||
->sortBy(fn($p) => mb_strtolower($p->cognome . ' ' . $p->nome));
|
->sortBy(fn($p) => mb_strtolower($p->cognome . ' ' . $p->nome));
|
||||||
|
|
||||||
|
// All currently assigned territories with links
|
||||||
|
$assegnazioniAperte = Assegnazione::aperte()
|
||||||
|
->with(['territorio.zona', 'proclamatore'])
|
||||||
|
->get()
|
||||||
|
->sortBy(fn($a) => (int) $a->territorio?->numero);
|
||||||
|
|
||||||
return view('livewire.assegnazioni.assegna', [
|
return view('livewire.assegnazioni.assegna', [
|
||||||
'territoriDisponibili' => $territoriDisponibili,
|
'territoriDisponibili' => $territoriDisponibili,
|
||||||
'proclamatoriAttivi' => $proclamatoriAttivi,
|
'proclamatoriAttivi' => $proclamatoriAttivi,
|
||||||
|
'assegnazioniAperte' => $assegnazioniAperte,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,83 @@ use App\Models\Assegnazione;
|
|||||||
use App\Models\AnnoTeocratico;
|
use App\Models\AnnoTeocratico;
|
||||||
use App\Models\Campagna;
|
use App\Models\Campagna;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
|
||||||
class Home extends Component
|
class Home extends Component
|
||||||
{
|
{
|
||||||
|
public function downloadPdfDaAssegnare()
|
||||||
|
{
|
||||||
|
$this->authorize('territori.assign');
|
||||||
|
|
||||||
|
$settings = Setting::instance();
|
||||||
|
$priorityThreshold = (int) ($settings->giorni_giacenza_prioritari ?? 180);
|
||||||
|
|
||||||
|
$territori = Territorio::inReparto()
|
||||||
|
->with('zona', 'tipologia', 'ultimaAssegnazione')
|
||||||
|
->get()
|
||||||
|
->map(function (Territorio $territorio) use ($priorityThreshold) {
|
||||||
|
$ultima = $territorio->ultimaAssegnazione;
|
||||||
|
if ($ultima && $ultima->returned_at) {
|
||||||
|
$giorniGiacenza = $ultima->returned_at->startOfDay()->diffInDays(today());
|
||||||
|
} elseif (! $ultima) {
|
||||||
|
$giorniGiacenza = $territorio->created_at->startOfDay()->diffInDays(today());
|
||||||
|
} else {
|
||||||
|
$giorniGiacenza = 0;
|
||||||
|
}
|
||||||
|
$territorio->setAttribute('home_giorni_giacenza', $giorniGiacenza);
|
||||||
|
$territorio->setAttribute(
|
||||||
|
'home_is_prioritario',
|
||||||
|
(bool) $territorio->prioritario || $giorniGiacenza > $priorityThreshold
|
||||||
|
);
|
||||||
|
return $territorio;
|
||||||
|
})
|
||||||
|
->sort(function (Territorio $left, Territorio $right) {
|
||||||
|
$p = (int) $right->home_is_prioritario <=> (int) $left->home_is_prioritario;
|
||||||
|
if ($p !== 0) return $p;
|
||||||
|
$g = $right->home_giorni_giacenza <=> $left->home_giorni_giacenza;
|
||||||
|
if ($g !== 0) return $g;
|
||||||
|
return strnatcasecmp((string) $left->numero, (string) $right->numero);
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('pdf.territori-lista', [
|
||||||
|
'titolo' => 'Territori da Assegnare',
|
||||||
|
'congregazione' => $settings->congregazione_nome ?? 'TerManager2',
|
||||||
|
'data' => now()->format('d/m/Y'),
|
||||||
|
'territori' => $territori,
|
||||||
|
'tipo' => 'assegnare',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->streamDownload(
|
||||||
|
fn () => print($pdf->output()),
|
||||||
|
'territori-da-assegnare-' . now()->format('Y-m-d') . '.pdf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function downloadPdfDaRientrare()
|
||||||
|
{
|
||||||
|
$this->authorize('territori.return');
|
||||||
|
|
||||||
|
$settings = Setting::instance();
|
||||||
|
|
||||||
|
$territori = Territorio::daRientrare()
|
||||||
|
->with(['zona', 'assegnazioneCorrente.proclamatore'])
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('pdf.territori-lista', [
|
||||||
|
'titolo' => 'Territori da Rientrare',
|
||||||
|
'congregazione' => $settings->congregazione_nome ?? 'TerManager2',
|
||||||
|
'data' => now()->format('d/m/Y'),
|
||||||
|
'territori' => $territori,
|
||||||
|
'tipo' => 'rientrare',
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response()->streamDownload(
|
||||||
|
fn () => print($pdf->output()),
|
||||||
|
'territori-da-rientrare-' . now()->format('Y-m-d') . '.pdf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$settings = Setting::instance();
|
$settings = Setting::instance();
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ class Registro extends Component
|
|||||||
public string $filtroZona = '';
|
public string $filtroZona = '';
|
||||||
public string $filtroTipologia = '';
|
public string $filtroTipologia = '';
|
||||||
public string $filtroStato = ''; // aperte, chiuse
|
public string $filtroStato = ''; // aperte, chiuse
|
||||||
public string $sortField = 'assigned_at';
|
public string $sortField = 'territorio_numero';
|
||||||
public string $sortDirection = 'desc';
|
public string $sortDirection = 'asc';
|
||||||
|
|
||||||
// ─── Modal create/edit ──────────────────────────────────────
|
// ─── Modal create/edit ──────────────────────────────────────
|
||||||
public bool $showModal = false;
|
public bool $showModal = false;
|
||||||
@@ -149,6 +149,14 @@ class Registro extends Component
|
|||||||
$this->showDeleteConfirm = false;
|
$this->showDeleteConfirm = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
|
{
|
||||||
|
if ($this->filtroAnno === '') {
|
||||||
|
$annoCorrente = AnnoTeocratico::corrente();
|
||||||
|
$this->filtroAnno = (string) $annoCorrente->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$query = Assegnazione::with(['territorio.zona', 'territorio.assegnazioneCorrente', 'proclamatore', 'annoTeocratico', 'campagna']);
|
$query = Assegnazione::with(['territorio.zona', 'territorio.assegnazioneCorrente', 'proclamatore', 'annoTeocratico', 'campagna']);
|
||||||
@@ -171,7 +179,14 @@ class Registro extends Component
|
|||||||
$query->whereHas('territorio', fn($q) => $q->where('tipologia_id', $this->filtroTipologia));
|
$query->whereHas('territorio', fn($q) => $q->where('tipologia_id', $this->filtroTipologia));
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->orderBy($this->sortField, $this->sortDirection);
|
if ($this->sortField === 'territorio_numero') {
|
||||||
|
$dir = $this->sortDirection === 'asc' ? 'ASC' : 'DESC';
|
||||||
|
$query->orderByRaw(
|
||||||
|
"CAST((SELECT numero FROM territori WHERE territori.id = assegnazioni.territorio_id) AS UNSIGNED) $dir"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$query->orderBy($this->sortField, $this->sortDirection);
|
||||||
|
}
|
||||||
|
|
||||||
// In-memory search for encrypted proclamatore fields / territorio numero
|
// In-memory search for encrypted proclamatore fields / territorio numero
|
||||||
if ($this->search !== '') {
|
if ($this->search !== '') {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Models\Setting;
|
|||||||
class SettingsEdit extends Component
|
class SettingsEdit extends Component
|
||||||
{
|
{
|
||||||
public string $congregazione_nome = '';
|
public string $congregazione_nome = '';
|
||||||
|
public string $public_base_url = '';
|
||||||
public int $giorni_giacenza_da_assegnare = 120;
|
public int $giorni_giacenza_da_assegnare = 120;
|
||||||
public int $giorni_giacenza_prioritari = 180;
|
public int $giorni_giacenza_prioritari = 180;
|
||||||
public int $giorni_per_smarrito = 120;
|
public int $giorni_per_smarrito = 120;
|
||||||
@@ -19,6 +20,7 @@ class SettingsEdit extends Component
|
|||||||
{
|
{
|
||||||
$settings = Setting::instance();
|
$settings = Setting::instance();
|
||||||
$this->congregazione_nome = $settings->congregazione_nome ?? '';
|
$this->congregazione_nome = $settings->congregazione_nome ?? '';
|
||||||
|
$this->public_base_url = $settings->public_base_url ?? '';
|
||||||
$this->giorni_giacenza_da_assegnare = $settings->giorni_giacenza_da_assegnare ?? 120;
|
$this->giorni_giacenza_da_assegnare = $settings->giorni_giacenza_da_assegnare ?? 120;
|
||||||
$this->giorni_giacenza_prioritari = $settings->giorni_giacenza_prioritari ?? 180;
|
$this->giorni_giacenza_prioritari = $settings->giorni_giacenza_prioritari ?? 180;
|
||||||
$this->giorni_per_smarrito = $settings->giorni_per_smarrito ?? 120;
|
$this->giorni_per_smarrito = $settings->giorni_per_smarrito ?? 120;
|
||||||
@@ -31,6 +33,7 @@ class SettingsEdit extends Component
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'congregazione_nome' => 'required|string|max:255',
|
'congregazione_nome' => 'required|string|max:255',
|
||||||
|
'public_base_url' => 'nullable|url|max:255',
|
||||||
'giorni_giacenza_da_assegnare' => 'required|integer|min:1|max:730',
|
'giorni_giacenza_da_assegnare' => 'required|integer|min:1|max:730',
|
||||||
'giorni_giacenza_prioritari' => 'required|integer|min:1|max:730',
|
'giorni_giacenza_prioritari' => 'required|integer|min:1|max:730',
|
||||||
'giorni_per_smarrito' => 'required|integer|min:30|max:365',
|
'giorni_per_smarrito' => 'required|integer|min:30|max:365',
|
||||||
@@ -47,6 +50,7 @@ class SettingsEdit extends Component
|
|||||||
$settings = Setting::instance();
|
$settings = Setting::instance();
|
||||||
$settings->update([
|
$settings->update([
|
||||||
'congregazione_nome' => $this->congregazione_nome,
|
'congregazione_nome' => $this->congregazione_nome,
|
||||||
|
'public_base_url' => $this->public_base_url ?: null,
|
||||||
'giorni_giacenza_da_assegnare' => $this->giorni_giacenza_da_assegnare,
|
'giorni_giacenza_da_assegnare' => $this->giorni_giacenza_da_assegnare,
|
||||||
'giorni_giacenza_prioritari' => $this->giorni_giacenza_prioritari,
|
'giorni_giacenza_prioritari' => $this->giorni_giacenza_prioritari,
|
||||||
'giorni_per_smarrito' => $this->giorni_per_smarrito,
|
'giorni_per_smarrito' => $this->giorni_per_smarrito,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Assegnazione extends Model
|
|||||||
|
|
||||||
$months = max(1, (int) Setting::getValue('assignment_link_ttl_hours', 1));
|
$months = max(1, (int) Setting::getValue('assignment_link_ttl_hours', 1));
|
||||||
|
|
||||||
return URL::temporarySignedRoute(
|
$url = URL::temporarySignedRoute(
|
||||||
'assignments.pdf.viewer',
|
'assignments.pdf.viewer',
|
||||||
now()->addMonths($months),
|
now()->addMonths($months),
|
||||||
[
|
[
|
||||||
@@ -113,6 +113,14 @@ class Assegnazione extends Model
|
|||||||
'code' => $this->ensurePdfAccessCode(),
|
'code' => $this->ensurePdfAccessCode(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$publicBase = Setting::getValue('public_base_url');
|
||||||
|
if ($publicBase) {
|
||||||
|
$parsed = parse_url($url);
|
||||||
|
$url = rtrim($publicBase, '/') . ($parsed['path'] ?? '') . (isset($parsed['query']) ? '?' . $parsed['query'] : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Scopes ─────────────────────────────────────────────────
|
// ─── Scopes ─────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class Setting extends Model
|
|||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'congregazione_nome',
|
'congregazione_nome',
|
||||||
|
'public_base_url',
|
||||||
'logo_path',
|
'logo_path',
|
||||||
'giorni_giacenza_da_assegnare',
|
'giorni_giacenza_da_assegnare',
|
||||||
'giorni_giacenza_prioritari',
|
'giorni_giacenza_prioritari',
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->string('public_base_url')->nullable()->after('congregazione_nome');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('settings', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('public_base_url');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"resources/css/app.css": {
|
"resources/css/app.css": {
|
||||||
"file": "assets/app-DtfTB2Uz.css",
|
"file": "assets/app-D-SuF610.css",
|
||||||
"src": "resources/css/app.css",
|
"src": "resources/css/app.css",
|
||||||
"isEntry": true
|
"isEntry": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<p class="text-sm text-gray-500 mt-1">Questa funzione consente un'assegnazione arbitraria, indipendente dalle tre schede della Home.</p>
|
<p class="text-sm text-gray-500 mt-1">Questa funzione consente un'assegnazione arbitraria, indipendente dalle tre schede della Home.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 sm:p-6 max-w-2xl">
|
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4 sm:p-6 max-w-3xl">
|
||||||
<form wire:submit="save" class="space-y-4">
|
<form wire:submit="save" class="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
@if(!$preselectedTerritorioId)
|
@if(!$preselectedTerritorioId)
|
||||||
@@ -74,4 +74,54 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{-- Elenco territori attualmente assegnati con link --}}
|
||||||
|
@if($assegnazioniAperte->count())
|
||||||
|
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden mt-10">
|
||||||
|
<div class="px-5 py-4 border-b flex items-center gap-3" style="background:linear-gradient(135deg,#eef2ff,#e0e7ff);border-color:#c7d2fe">
|
||||||
|
<div class="h-8 w-8 rounded-lg flex items-center justify-center" style="background:#6366f1">
|
||||||
|
<svg class="h-4 w-4 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"/></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 class="text-sm font-semibold" style="color:#3730a3">Territori Assegnati ({{ $assegnazioniAperte->count() }})</h3>
|
||||||
|
<p class="text-xs" style="color:#4f46e5">Per ogni territorio è visibile il link da condividere</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="divide-y divide-gray-100">
|
||||||
|
@foreach($assegnazioniAperte as $a)
|
||||||
|
@php($pdfUrl = $a->temporaryPdfViewerUrl())
|
||||||
|
<div class="px-5 py-4 hover:bg-indigo-50/30 transition-colors">
|
||||||
|
<div class="flex items-center justify-between gap-4">
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<a href="{{ route('territori.show', $a->territorio_id) }}" class="text-indigo-600 hover:underline font-semibold text-sm">N° {{ $a->territorio?->numero }}</a>
|
||||||
|
<span class="text-xs text-gray-400">{{ $a->territorio?->zona?->nome }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-5 text-sm">
|
||||||
|
<span class="text-gray-700">{{ $a->proclamatore?->nome_completo ?? 'N/A' }}</span>
|
||||||
|
<span class="text-gray-400">{{ $a->assigned_at->format('d/m/Y') }}</span>
|
||||||
|
<span class="text-xs font-medium {{ $a->giorni > 120 ? 'text-red-600' : ($a->giorni > 90 ? 'text-amber-600' : 'text-gray-500') }}">{{ $a->giorni }}g</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if($pdfUrl)
|
||||||
|
<div x-data="{ copied: false }" class="mt-2 flex items-center gap-2">
|
||||||
|
<code class="flex-1 min-w-0 text-xs bg-gray-50 border border-gray-200 rounded-md px-3 py-2 text-gray-600 break-all select-all cursor-text" x-on:click="window.getSelection().selectAllChildren($el)">{{ $pdfUrl }}</code>
|
||||||
|
<button type="button"
|
||||||
|
x-on:click="
|
||||||
|
const text = $el.closest('div').querySelector('code').textContent;
|
||||||
|
navigator.clipboard.writeText(text).then(() => { copied = true; setTimeout(() => copied = false, 2000) });
|
||||||
|
"
|
||||||
|
class="flex-none btn-action btn-action-indigo" title="Copia link" style="padding:6px 10px">
|
||||||
|
<svg x-show="!copied" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"/></svg>
|
||||||
|
<svg x-show="copied" x-cloak class="h-4 w-4 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
|
||||||
|
</button>
|
||||||
|
<span x-show="copied" x-cloak class="flex-none text-xs text-green-600 font-medium">Copiato!</span>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<p class="mt-2 text-xs text-gray-300">Nessun PDF disponibile</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -90,6 +90,11 @@
|
|||||||
<h3 class="text-sm font-semibold" style="color:#166534">Da Assegnare</h3>
|
<h3 class="text-sm font-semibold" style="color:#166534">Da Assegnare</h3>
|
||||||
<p class="text-xs" style="color:#15803d">Prima i prioritari, poi i territori con più tempo in reparto</p>
|
<p class="text-xs" style="color:#15803d">Prima i prioritari, poi i territori con più tempo in reparto</p>
|
||||||
</div>
|
</div>
|
||||||
|
@hasanyrole('amministratore|assistente')
|
||||||
|
<button wire:click="downloadPdfDaAssegnare" title="Scarica PDF" class="ml-auto btn-action btn-action-green" style="padding:6px 10px">
|
||||||
|
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
||||||
|
</button>
|
||||||
|
@endhasanyrole
|
||||||
</div>
|
</div>
|
||||||
<ul class="divide-y divide-gray-100">
|
<ul class="divide-y divide-gray-100">
|
||||||
@forelse($territoriDaAssegnare as $t)
|
@forelse($territoriDaAssegnare as $t)
|
||||||
@@ -121,7 +126,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
@if($territoriDaAssegnare->count() >= $homeLimit)
|
@if($territoriDaAssegnare->count() >= $homeLimit)
|
||||||
<div class="px-5 py-3 border-t text-center" style="background:#fafafa">
|
<div class="px-5 py-3 border-t text-center" style="background:#fafafa">
|
||||||
<a href="{{ route('territori.index') }}?filtroStato=in_reparto" class="text-xs font-medium" style="color:#4f46e5">Vedi tutti →</a>
|
<a href="{{ route('territori.index') }}?filterStato=in_reparto" class="text-xs font-medium" style="color:#4f46e5">Vedi tutti →</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@@ -136,6 +141,11 @@
|
|||||||
<h3 class="text-sm font-semibold" style="color:#991b1b">Da Rientrare</h3>
|
<h3 class="text-sm font-semibold" style="color:#991b1b">Da Rientrare</h3>
|
||||||
<p class="text-xs" style="color:#b91c1c">Territori assegnati da più tempo</p>
|
<p class="text-xs" style="color:#b91c1c">Territori assegnati da più tempo</p>
|
||||||
</div>
|
</div>
|
||||||
|
@hasanyrole('amministratore|assistente')
|
||||||
|
<button wire:click="downloadPdfDaRientrare" title="Scarica PDF" class="ml-auto btn-action btn-action-red" style="padding:6px 10px">
|
||||||
|
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
||||||
|
</button>
|
||||||
|
@endhasanyrole
|
||||||
</div>
|
</div>
|
||||||
<ul class="divide-y divide-gray-100">
|
<ul class="divide-y divide-gray-100">
|
||||||
@forelse($daRientrare as $t)
|
@forelse($daRientrare as $t)
|
||||||
@@ -163,7 +173,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
@if($daRientrare->count() >= $homeLimit)
|
@if($daRientrare->count() >= $homeLimit)
|
||||||
<div class="px-5 py-3 border-t text-center" style="background:#fafafa">
|
<div class="px-5 py-3 border-t text-center" style="background:#fafafa">
|
||||||
<a href="{{ route('territori.index') }}?filtroStato=da_rientrare" class="text-xs font-medium" style="color:#4f46e5">Vedi tutti →</a>
|
<a href="{{ route('territori.index') }}?filterStato=da_rientrare" class="text-xs font-medium" style="color:#4f46e5">Vedi tutti →</a>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,7 +45,9 @@
|
|||||||
<table class="min-w-full divide-y divide-gray-200 text-sm table-striped">
|
<table class="min-w-full divide-y divide-gray-200 text-sm table-striped">
|
||||||
<thead style="background:linear-gradient(180deg,#f9fafb,#f3f4f6)">
|
<thead style="background:linear-gradient(180deg,#f9fafb,#f3f4f6)">
|
||||||
<tr>
|
<tr>
|
||||||
<th wire:click="sortBy('territorio_id')" class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase cursor-pointer">Territorio</th>
|
<th wire:click="sortBy('territorio_numero')" class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase cursor-pointer">
|
||||||
|
Territorio @if($sortField==='territorio_numero') <span style="color:#6366f1">{{ $sortDirection==='asc'?'▲':'▼' }}</span> @endif
|
||||||
|
</th>
|
||||||
<th class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Proclamatore</th>
|
<th class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Proclamatore</th>
|
||||||
<th wire:click="sortBy('assigned_at')" class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase cursor-pointer">
|
<th wire:click="sortBy('assigned_at')" class="px-3 py-3 text-left text-xs font-semibold text-gray-600 uppercase cursor-pointer">
|
||||||
Assegnato @if($sortField==='assigned_at') <span style="color:#6366f1">{{ $sortDirection==='asc'?'▲':'▼' }}</span> @endif
|
Assegnato @if($sortField==='assigned_at') <span style="color:#6366f1">{{ $sortDirection==='asc'?'▲':'▼' }}</span> @endif
|
||||||
@@ -99,22 +101,6 @@
|
|||||||
@can('settings.manage')
|
@can('settings.manage')
|
||||||
<td class="px-3 py-2 whitespace-nowrap">
|
<td class="px-3 py-2 whitespace-nowrap">
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
@can('territori.assign')
|
|
||||||
@if($a->territorio?->attivo && !$a->territorio?->assegnazioneCorrente)
|
|
||||||
<a href="{{ route('assegnazioni.assegna', ['territorioId' => $a->territorio_id]) }}"
|
|
||||||
class="btn-action btn-action-green" title="Assegna">
|
|
||||||
<svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
@endcan
|
|
||||||
@can('territori.return')
|
|
||||||
@if(!$a->returned_at)
|
|
||||||
<a href="{{ route('assegnazioni.rientra', ['assegnazione' => $a->id]) }}"
|
|
||||||
class="btn-action btn-action-red" title="Rientra">
|
|
||||||
<svg class="h-3.5 w-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"/></svg>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
@endcan
|
|
||||||
@if($temporaryPdfUrl)
|
@if($temporaryPdfUrl)
|
||||||
<a href="{{ $temporaryPdfUrl }}"
|
<a href="{{ $temporaryPdfUrl }}"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
@@ -28,6 +28,13 @@
|
|||||||
@error('congregazione_nome') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
@error('congregazione_nome') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="public_base_url" class="block text-sm font-medium text-gray-700">URL Pubblico (dominio)</label>
|
||||||
|
<p class="text-xs text-gray-500 mb-1">L'indirizzo con cui l'app è raggiungibile dall'esterno (es. https://territori.miacongregazione.it). Se vuoto, verrà usato l'URL corrente del server.</p>
|
||||||
|
<input wire:model="public_base_url" type="url" id="public_base_url" placeholder="https://esempio.com" class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:ring-indigo-500 focus:border-indigo-500 text-sm">
|
||||||
|
@error('public_base_url') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="giorni_giacenza_da_assegnare" class="block text-sm font-medium text-gray-700">Soglia Da Assegnare (giorni)</label>
|
<label for="giorni_giacenza_da_assegnare" class="block text-sm font-medium text-gray-700">Soglia Da Assegnare (giorni)</label>
|
||||||
<p class="text-xs text-gray-500 mb-1">Dopo quanti giorni dal rientro un territorio compare nella lista "da assegnare".</p>
|
<p class="text-xs text-gray-500 mb-1">Dopo quanti giorni dal rientro un territorio compare nella lista "da assegnare".</p>
|
||||||
|
|||||||
102
resources/views/pdf/territori-lista.blade.php
Normal file
102
resources/views/pdf/territori-lista.blade.php
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>{{ $titolo }}</title>
|
||||||
|
<style>
|
||||||
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||||
|
body { font-family: DejaVu Sans, sans-serif; font-size: 11px; color: #1f2937; padding: 20px; }
|
||||||
|
.header { text-align: center; margin-bottom: 20px; border-bottom: 2px solid #6366f1; padding-bottom: 12px; }
|
||||||
|
.header h1 { font-size: 18px; color: #1e1b4b; margin-bottom: 4px; }
|
||||||
|
.header .sub { font-size: 10px; color: #6b7280; }
|
||||||
|
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
|
||||||
|
th { background: #eef2ff; color: #4338ca; font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; padding: 8px 6px; text-align: left; border-bottom: 2px solid #c7d2fe; }
|
||||||
|
td { padding: 7px 6px; border-bottom: 1px solid #e5e7eb; font-size: 10px; }
|
||||||
|
tr:nth-child(even) td { background: #f9fafb; }
|
||||||
|
.prioritario { background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: bold; }
|
||||||
|
.badge-green { background: #dcfce7; color: #166534; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: bold; }
|
||||||
|
.badge-red { background: #fee2e2; color: #991b1b; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: bold; }
|
||||||
|
.footer { margin-top: 20px; padding-top: 10px; border-top: 1px solid #e5e7eb; text-align: center; font-size: 9px; color: #9ca3af; }
|
||||||
|
.total { margin-top: 12px; text-align: right; font-size: 11px; font-weight: bold; color: #4338ca; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<h1>{{ $titolo }}</h1>
|
||||||
|
<div class="sub">{{ $congregazione }} — {{ $data }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($tipo === 'assegnare')
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:10%">N°</th>
|
||||||
|
<th style="width:20%">Zona</th>
|
||||||
|
<th style="width:20%">Tipologia</th>
|
||||||
|
<th style="width:20%">Giorni in reparto</th>
|
||||||
|
<th style="width:15%">Priorità</th>
|
||||||
|
<th style="width:15%">Note</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($territori as $t)
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight:bold">{{ $t->numero }}</td>
|
||||||
|
<td>{{ $t->zona?->nome ?? '-' }}</td>
|
||||||
|
<td>{{ $t->tipologia?->nome ?? '-' }}</td>
|
||||||
|
<td>{{ $t->home_giorni_giacenza }} gg</td>
|
||||||
|
<td>
|
||||||
|
@if($t->home_is_prioritario)
|
||||||
|
<span class="prioritario">★ Prioritario</span>
|
||||||
|
@else
|
||||||
|
-
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td style="font-size:9px;color:#6b7280">{{ \Illuminate\Support\Str::limit($t->note, 40) }}</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr><td colspan="6" style="text-align:center;color:#9ca3af;padding:20px">Nessun territorio da assegnare</td></tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="total">Totale: {{ $territori->count() }} territori</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if($tipo === 'rientrare')
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:10%">N°</th>
|
||||||
|
<th style="width:20%">Zona</th>
|
||||||
|
<th style="width:25%">Assegnatario</th>
|
||||||
|
<th style="width:15%">Assegnato il</th>
|
||||||
|
<th style="width:15%">Giorni</th>
|
||||||
|
<th style="width:15%">Note</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@forelse($territori as $t)
|
||||||
|
@php($a = $t->assegnazioneCorrente)
|
||||||
|
<tr>
|
||||||
|
<td style="font-weight:bold">{{ $t->numero }}</td>
|
||||||
|
<td>{{ $t->zona?->nome ?? '-' }}</td>
|
||||||
|
<td>{{ $a?->proclamatore?->nome_completo ?? '-' }}</td>
|
||||||
|
<td>{{ $a?->assigned_at?->format('d/m/Y') }}</td>
|
||||||
|
<td>
|
||||||
|
<span class="badge-red">{{ $a?->giorni ?? '-' }} gg</span>
|
||||||
|
</td>
|
||||||
|
<td style="font-size:9px;color:#6b7280">{{ \Illuminate\Support\Str::limit($t->note, 40) }}</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr><td colspan="6" style="text-align:center;color:#9ca3af;padding:20px">Nessun territorio da rientrare</td></tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="total">Totale: {{ $territori->count() }} territori</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="footer">
|
||||||
|
Generato da TerManager2 il {{ $data }}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user