netgescon-day0/resources/views/filament/widgets/google-workspace-overview.blade.php

155 lines
9.9 KiB
PHP

<x-filament-widgets::widget>
<x-filament::section>
<x-slot name="heading">Google Workspace</x-slot>
<x-slot name="description">
Stato collegamento, eventi calendario e anteprima rubrica Google.
</x-slot>
<div class="space-y-4">
@if(($showTechnicalBoxes ?? true) === true)
<div class="rounded-lg border border-gray-200 bg-gray-50 p-3 text-sm">
<div class="font-semibold text-gray-800">Account collegato</div>
<div class="text-gray-700">{{ $connectionLabel }}</div>
<div class="mt-2 flex flex-wrap gap-2">
<a href="{{ $this->getCalendarioUrl() }}" class="inline-flex items-center rounded-md bg-primary-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-primary-500">
Apri calendario interno
</a>
<a href="{{ $this->getRubricaUrl() }}" class="inline-flex items-center rounded-md bg-gray-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-gray-600">
Apri rubrica interna
</a>
<button type="button" wire:click="previewImportContactsToRubrica" class="inline-flex items-center rounded-md bg-slate-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-slate-600">
Preview import rubrica
</button>
<button type="button" wire:click="importContactsToRubrica" class="inline-flex items-center rounded-md bg-emerald-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-500">
Importa in Rubrica NetGescon
</button>
<button type="button" wire:click="exportRubricaToGoogle" class="inline-flex items-center rounded-md bg-blue-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-blue-600">
Esporta Rubrica NetGescon su Google
</button>
<button type="button" wire:click="provaSincronizzazioneCalendarioTicket" class="inline-flex items-center rounded-md bg-amber-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-amber-500">
Prova Sync Ticket -> Calendar
</button>
<button type="button" wire:click="sincronizzaCalendarioTicket" class="inline-flex items-center rounded-md bg-emerald-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-emerald-600">
Sincronizza Ticket su Calendar
</button>
<a href="{{ $this->getTicketApertiUrl() }}" class="inline-flex items-center rounded-md bg-rose-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-rose-600">
Ticket Aperti (Filament)
</a>
</div>
</div>
@else
<div class="rounded-lg border border-sky-200 bg-sky-50 p-3 text-sm text-sky-900">
<div class="font-semibold">Scadenzario operativo</div>
<div class="mt-1 text-xs">Calendario collegato: <span class="font-mono">{{ $calendarId }}</span></div>
<div class="mt-2">
<a href="{{ $this->getCalendarioUrl() }}" class="inline-flex items-center rounded-md bg-sky-700 px-3 py-1.5 text-xs font-medium text-white hover:bg-sky-600">Apri calendario interno</a>
</div>
</div>
@endif
@if(filled($errorMessage) && (($showTechnicalBoxes ?? true) === true))
<div class="rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-800">
{{ $errorMessage }}
</div>
@endif
<div class="grid gap-4 lg:grid-cols-2">
<div class="rounded-lg border border-gray-200 p-3">
<div class="mb-2 text-sm font-semibold text-gray-800">
Prossimi eventi ({{ $calendarId }})
</div>
@if(count($calendarEvents) === 0)
<div class="text-sm text-gray-500">Nessun evento trovato nei prossimi giorni.</div>
@else
<div class="space-y-2">
@foreach($calendarEvents as $event)
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2">
<div class="text-sm font-medium text-gray-800">{{ $event['title'] }}</div>
<div class="text-xs text-gray-600">{{ $event['start'] }}</div>
@if(!empty($event['location']))
<div class="text-xs text-gray-500">{{ $event['location'] }}</div>
@endif
</div>
@endforeach
</div>
@endif
</div>
<div class="rounded-lg border border-gray-200 p-3">
<div class="mb-2 text-sm font-semibold text-gray-800">Anteprima rubrica Google</div>
@if(count($contacts) === 0)
<div class="text-sm text-gray-500">Nessun contatto disponibile o permesso non ancora concesso.</div>
@else
<div class="space-y-2">
@foreach($contacts as $contact)
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2">
<div class="text-sm font-medium text-gray-800">{{ $contact['name'] }}</div>
@if(!empty($contact['email']))
<div class="text-xs text-gray-600">{{ $contact['email'] }}</div>
@endif
@if(!empty($contact['phone']))
<div class="text-xs text-gray-500">{{ $contact['phone'] }}</div>
@endif
</div>
@endforeach
</div>
@endif
</div>
@if(($showTechnicalBoxes ?? true) === true)
<div class="rounded-lg border border-gray-200 p-3">
<div class="mb-2 text-sm font-semibold text-gray-800">Import rubrica operativo</div>
<div class="text-xs text-gray-500">Usa `Preview` per controllare cosa entrerebbe in rubrica, poi `Importa` per applicare davvero usando il comando unificato lato Laravel.</div>
<pre class="mt-3 overflow-x-auto rounded-lg bg-slate-900 p-3 text-xs text-slate-100">{{ $rubricaSyncCommandPreview ?: 'php artisan google:sync-rubrica --admin-id=... --max-pages=20 --dry-run' }}</pre>
@if($rubricaSyncLastRunLabel)
<div class="mt-3 text-[11px] font-semibold uppercase tracking-wide text-slate-500">Ultima esecuzione</div>
<div class="mt-1 text-xs text-slate-700">{{ $rubricaSyncLastRunLabel }}</div>
@endif
@if($rubricaSyncLastOutput)
<pre class="mt-3 max-h-72 overflow-auto rounded-lg bg-slate-50 p-3 text-xs text-slate-700">{{ $rubricaSyncLastOutput }}</pre>
@endif
</div>
@endif
<div class="rounded-lg border border-gray-200 p-3">
<div class="mb-2 text-sm font-semibold text-gray-800">Ticket aperti (operativi)</div>
@if(count($openTickets) === 0)
<div class="text-sm text-gray-500">Nessun ticket aperto al momento.</div>
@else
<div class="space-y-2">
@foreach($openTickets as $ticket)
<a href="{{ $this->getTicketGestioneUrl((int) $ticket['id']) }}" class="block rounded-md border border-gray-100 bg-gray-50 px-3 py-2 hover:bg-slate-100">
<div class="text-sm font-medium text-gray-800">#{{ $ticket['id'] }} - {{ $ticket['titolo'] }}</div>
<div class="text-xs text-gray-600">{{ $ticket['stabile'] }}</div>
<div class="text-xs text-gray-500">Stato: {{ $ticket['stato'] }} · Priorita: {{ $ticket['priorita'] }}</div>
</a>
@endforeach
</div>
@endif
</div>
@if(($showTechnicalBoxes ?? true) === true)
<div class="rounded-lg border border-gray-200 p-3 lg:col-span-2">
<div class="mb-2 text-sm font-semibold text-gray-800">Template Cartelle Drive Condominio</div>
<div class="mb-2 text-xs text-gray-500">Struttura base replicabile per ogni stabile, con naming Linux a underscore e modello annuale sotto archivio_per_anno.</div>
@if(count($driveTemplateFolders) === 0)
<div class="text-sm text-gray-500">Template non configurato.</div>
@else
<div class="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
@foreach($driveTemplateFolders as $folder)
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-700">{{ $folder }}</div>
@endforeach
</div>
@endif
</div>
@endif
</div>
</div>
</x-filament::section>
</x-filament-widgets::widget>