fino a eventi e report prima del tipo di eventi
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
{"version":2,"defects":{"Tests\\Feature\\ExampleTest::test_the_application_returns_a_successful_response":7,"Tests\\Feature\\CalendarEventsTest::test_generate_settimanale_events_produces_weekly_occurrences":7},"times":{"Tests\\Unit\\ExampleTest::test_that_true_is_true":0,"Tests\\Feature\\ExampleTest::test_the_application_returns_a_successful_response":0.111,"Tests\\Feature\\CalendarEventsTest::test_find_first_sunday_of_june_2026":0.015,"Tests\\Feature\\CalendarEventsTest::test_find_second_saturday_of_june_2026":0.001,"Tests\\Feature\\CalendarEventsTest::test_find_fifth_sunday_returns_null_when_not_in_month":0.001,"Tests\\Feature\\CalendarEventsTest::test_generate_mensile_events_for_all_months":0.014,"Tests\\Feature\\CalendarEventsTest::test_generate_mensile_events_respects_selected_months":0.002,"Tests\\Feature\\CalendarEventsTest::test_generate_annuale_events_produces_correct_dates":0.002,"Tests\\Feature\\CalendarEventsTest::test_generate_settimanale_events_produces_weekly_occurrences":0.004}}
|
||||||
@@ -21,6 +21,7 @@ Laravel 13 / PHP 8.4 project for parish management (Glastree). Full codebase exi
|
|||||||
|
|
||||||
### ⚠️ IN COMPLETAMENTO
|
### ⚠️ IN COMPLETAMENTO
|
||||||
- Sistema Email: funziona al 95%, SMTP potrebbe necessitare credenziali corrette
|
- Sistema Email: funziona al 95%, SMTP potrebbe necessitare credenziali corrette
|
||||||
|
- Nuova implementazione: avatar gruppi, event types, email sync logging
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -489,3 +490,30 @@ php artisan route:list --name=email
|
|||||||
- `app/Http/Controllers/ReportController.php`: righe 389-397 e 532, corretto nome colonna
|
- `app/Http/Controllers/ReportController.php`: righe 389-397 e 532, corretto nome colonna
|
||||||
|
|
||||||
(Last updated: 25 Maggio 2026 - Fix report eventi_calendario, colonna data)
|
(Last updated: 25 Maggio 2026 - Fix report eventi_calendario, colonna data)
|
||||||
|
|
||||||
|
### 25 Maggio 2026 - Fix Gruppi Table Hierarchy
|
||||||
|
- **Problema**: La visualizzazione a tabella dei gruppi non mostrava correttamente la gerarchia padre-figlio
|
||||||
|
- **Soluzione**:
|
||||||
|
- Aggiunto metodo `sortGruppiHierarchically()` in `GruppoController` per ordinare i gruppi in modo gerarchico
|
||||||
|
- La tabella ora mostra prima i gruppi root, poi i loro figli in ordine annidato
|
||||||
|
- Aggiunta eager loading `avatar` per supportare il futuro avatar dei gruppi
|
||||||
|
- **Files modificati**:
|
||||||
|
- `app/Http/Controllers/GruppoController.php`: aggiunto `sortGruppiHierarchically()`, `addChildrenRecursive()`, aggiunto 'avatar' a eager loading
|
||||||
|
|
||||||
|
### 25 Maggio 2026 - Group Avatar Support
|
||||||
|
- **Funzionalità**: I gruppi ora possono avere un avatar/logo come gli individui
|
||||||
|
- **Implementazione**:
|
||||||
|
- Aggiunto metodo `avatar()` in `Gruppo.php` (relazione HasOne a Documento con tipologia 'avatar')
|
||||||
|
- Aggiunto accessor `getAvatarUrlAttribute()` per ottenere l'URL dell'avatar
|
||||||
|
- Eager loading `avatar` aggiunto in `GruppoController@index()`
|
||||||
|
- View `gruppi/index.blade.php` aggiornata per mostrare l'avatar nella tabella
|
||||||
|
- View `gruppi/show.blade.php` aggiornata per mostrare l'avatar del gruppo
|
||||||
|
- View `gruppi/create.blade.php` e `edit.blade.php` aggiornate per permettere upload avatar
|
||||||
|
- **Files modificati**:
|
||||||
|
- `app/Models/Gruppo.php`: aggiunto `avatar()`, `getAvatarUrlAttribute()`
|
||||||
|
- `app/Http/Controllers/GruppoController.php`: aggiunto eager loading `avatar`
|
||||||
|
- `resources/views/gruppi/index.blade.php`: colonna avatar nella tabella
|
||||||
|
- `resources/views/gruppi/show.blade.php`: avatar nella header card
|
||||||
|
- `resources/views/gruppi/create.blade.php` e `edit.blade.php`: upload avatar
|
||||||
|
|
||||||
|
(Last updated: 25 Maggio 2026 - Fix gruppi hierarchy, group avatar support)
|
||||||
|
|||||||
@@ -192,11 +192,19 @@ class DocumentoController extends Controller
|
|||||||
$fullPath = Storage::disk('local')->path($documento->file_path);
|
$fullPath = Storage::disk('local')->path($documento->file_path);
|
||||||
$mimeType = $documento->mime_type;
|
$mimeType = $documento->mime_type;
|
||||||
|
|
||||||
if (str_starts_with($mimeType, 'image/')) {
|
$previewableMimeTypes = [
|
||||||
|
'image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/svg+xml',
|
||||||
|
'application/pdf',
|
||||||
|
'text/plain', 'text/html', 'text/csv',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (in_array($mimeType, $previewableMimeTypes)) {
|
||||||
return response()->file($fullPath, ['Content-Type' => $mimeType]);
|
return response()->file($fullPath, ['Content-Type' => $mimeType]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->file($fullPath, ['Content-Type' => $mimeType]);
|
return response()->view('documenti.preview-fallback', [
|
||||||
|
'documento' => $documento,
|
||||||
|
])->header('X-Preview-Fallback', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($documento)
|
public function destroy($documento)
|
||||||
|
|||||||
@@ -342,8 +342,11 @@ class EmailController extends Controller
|
|||||||
|
|
||||||
public function syncEmails()
|
public function syncEmails()
|
||||||
{
|
{
|
||||||
|
\Illuminate\Support\Facades\Log::info('Email sync started');
|
||||||
|
|
||||||
$settings = EmailSetting::getActive();
|
$settings = EmailSetting::getActive();
|
||||||
if (!$settings) {
|
if (!$settings) {
|
||||||
|
\Illuminate\Support\Facades\Log::warning('Email sync aborted: no active email configuration');
|
||||||
throw new \Exception('Nessuna configurazione email attiva');
|
throw new \Exception('Nessuna configurazione email attiva');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,6 +354,8 @@ class EmailController extends Controller
|
|||||||
|
|
||||||
$mailbox = $this->connectImap($settings);
|
$mailbox = $this->connectImap($settings);
|
||||||
|
|
||||||
|
\Illuminate\Support\Facades\Log::info('IMAP connection established', ['host' => $settings->imap_host]);
|
||||||
|
|
||||||
$folderMappings = [
|
$folderMappings = [
|
||||||
'INBOX' => 'inbox',
|
'INBOX' => 'inbox',
|
||||||
'Sent' => 'sent',
|
'Sent' => 'sent',
|
||||||
@@ -362,11 +367,19 @@ class EmailController extends Controller
|
|||||||
'[Gmail]/Trash' => 'trash',
|
'[Gmail]/Trash' => 'trash',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$totalProcessed = 0;
|
||||||
|
$totalNew = 0;
|
||||||
|
|
||||||
foreach (array_keys($folderMappings) as $imapFolderName) {
|
foreach (array_keys($folderMappings) as $imapFolderName) {
|
||||||
try {
|
try {
|
||||||
$folder = $mailbox->folders()->find($imapFolderName);
|
$folder = $mailbox->folders()->find($imapFolderName);
|
||||||
if (!$folder) continue;
|
if (!$folder) {
|
||||||
|
\Illuminate\Support\Facades\Log::debug('IMAP folder not found', ['folder' => $imapFolderName]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
\Illuminate\Support\Facades\Log::info('Processing IMAP folder', ['folder' => $imapFolderName]);
|
||||||
|
|
||||||
$messages = $folder->messages()
|
$messages = $folder->messages()
|
||||||
->withHeaders()
|
->withHeaders()
|
||||||
->withBody()
|
->withBody()
|
||||||
@@ -374,14 +387,31 @@ class EmailController extends Controller
|
|||||||
->limit(100)
|
->limit(100)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
\Illuminate\Support\Facades\Log::info('Messages fetched from folder', ['folder' => $imapFolderName, 'count' => count($messages)]);
|
||||||
|
|
||||||
foreach ($messages as $imapMessage) {
|
foreach ($messages as $imapMessage) {
|
||||||
|
$totalProcessed++;
|
||||||
|
$messageId = $imapMessage->messageId() ?? uniqid('msg_');
|
||||||
|
$existing = EmailMessage::where('message_id', $messageId)->first();
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->processImapMessage($imapMessage, $imapFolderName);
|
$this->processImapMessage($imapMessage, $imapFolderName);
|
||||||
|
$totalNew++;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
\Illuminate\Support\Facades\Log::error('Error processing IMAP folder', ['folder' => $imapFolderName, 'error' => $e->getMessage()]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\Illuminate\Support\Facades\Log::info('Email sync completed', [
|
||||||
|
'processed' => $totalProcessed,
|
||||||
|
'new' => $totalNew,
|
||||||
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,14 +67,15 @@ class EventoController extends Controller
|
|||||||
'giorno_settimana' => 'nullable|integer|min:0|max:6',
|
'giorno_settimana' => 'nullable|integer|min:0|max:6',
|
||||||
'giorno_mese' => 'nullable|integer|min:1|max:31',
|
'giorno_mese' => 'nullable|integer|min:1|max:31',
|
||||||
'occorrenza_mese' => 'nullable|string|max:10',
|
'occorrenza_mese' => 'nullable|string|max:10',
|
||||||
'mesi_recorrenza' => 'nullable|string',
|
'mesi_recorrenza' => 'nullable|array',
|
||||||
|
'mesi_recorrenza.*' => 'integer|min:1|max:12',
|
||||||
'mese_annuale' => 'nullable|integer|min:1|max:12',
|
'mese_annuale' => 'nullable|integer|min:1|max:12',
|
||||||
'ora_inizio' => 'nullable|date_format:H:i',
|
'ora_inizio' => 'nullable|date_format:H:i',
|
||||||
'data_specifica' => 'nullable|date',
|
'data_specifica' => 'nullable|date',
|
||||||
'durata_minuti' => 'nullable|integer|min:1',
|
'durata_minuti' => 'nullable|integer|min:1',
|
||||||
'descrizione' => 'nullable|string',
|
'descrizione' => 'nullable|string',
|
||||||
'note' => 'nullable|string',
|
'note' => 'nullable|string',
|
||||||
'is_incontro_gruppo' => 'nullable|boolean',
|
'is_incontro_gruppo' => 'nullable',
|
||||||
'gruppi' => 'nullable|array',
|
'gruppi' => 'nullable|array',
|
||||||
'gruppi.*' => 'exists:gruppi,id',
|
'gruppi.*' => 'exists:gruppi,id',
|
||||||
'responsabili' => 'nullable|array',
|
'responsabili' => 'nullable|array',
|
||||||
@@ -144,14 +145,15 @@ class EventoController extends Controller
|
|||||||
'giorno_settimana' => 'nullable|integer|min:0|max:6',
|
'giorno_settimana' => 'nullable|integer|min:0|max:6',
|
||||||
'giorno_mese' => 'nullable|integer|min:1|max:31',
|
'giorno_mese' => 'nullable|integer|min:1|max:31',
|
||||||
'occorrenza_mese' => 'nullable|string|max:10',
|
'occorrenza_mese' => 'nullable|string|max:10',
|
||||||
'mesi_recorrenza' => 'nullable|string',
|
'mesi_recorrenza' => 'nullable|array',
|
||||||
|
'mesi_recorrenza.*' => 'integer|min:1|max:12',
|
||||||
'mese_annuale' => 'nullable|integer|min:1|max:12',
|
'mese_annuale' => 'nullable|integer|min:1|max:12',
|
||||||
'ora_inizio' => 'nullable|date_format:H:i',
|
'ora_inizio' => 'nullable|date_format:H:i',
|
||||||
'data_specifica' => 'nullable|date',
|
'data_specifica' => 'nullable|date',
|
||||||
'durata_minuti' => 'nullable|integer|min:1',
|
'durata_minuti' => 'nullable|integer|min:1',
|
||||||
'descrizione' => 'nullable|string',
|
'descrizione' => 'nullable|string',
|
||||||
'note' => 'nullable|string',
|
'note' => 'nullable|string',
|
||||||
'is_incontro_gruppo' => 'nullable|boolean',
|
'is_incontro_gruppo' => 'nullable',
|
||||||
'gruppi' => 'nullable|array',
|
'gruppi' => 'nullable|array',
|
||||||
'gruppi.*' => 'exists:gruppi,id',
|
'gruppi.*' => 'exists:gruppi,id',
|
||||||
'responsabili' => 'nullable|array',
|
'responsabili' => 'nullable|array',
|
||||||
@@ -237,40 +239,168 @@ class EventoController extends Controller
|
|||||||
foreach ($eventi as $evento) {
|
foreach ($eventi as $evento) {
|
||||||
if ($evento->tipo_recorrenza === 'singolo' || $evento->tipo_recorrenza === null) {
|
if ($evento->tipo_recorrenza === 'singolo' || $evento->tipo_recorrenza === null) {
|
||||||
if ($evento->data_specifica) {
|
if ($evento->data_specifica) {
|
||||||
$events[] = [
|
$events[] = $this->buildCalendarEvent($evento, $evento->data_specifica);
|
||||||
'id' => $evento->id,
|
|
||||||
'title' => $evento->nome_evento,
|
|
||||||
'start' => $evento->data_specifica->format('Y-m-d') . ($evento->ora_inizio ? 'T' . $evento->ora_inizio->format('H:i') : ''),
|
|
||||||
'url' => $baseUrl . '/eventi/' . $evento->id,
|
|
||||||
'backgroundColor' => $this->getEventoColor($evento),
|
|
||||||
'borderColor' => $this->getEventoColor($evento),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
} elseif ($evento->tipo_recorrenza === 'settimanale' && $evento->giorno_settimana !== null) {
|
} elseif ($evento->tipo_recorrenza === 'settimanale' && $evento->giorno_settimana !== null) {
|
||||||
$startDate = \Carbon\Carbon::parse($start);
|
$events = array_merge($events, $this->generateSettimanaleEvents($evento, $start, $end, $baseUrl));
|
||||||
$endDate = \Carbon\Carbon::parse($end);
|
} elseif ($evento->tipo_recorrenza === 'mensile' && $evento->occorrenza_mese) {
|
||||||
|
$events = array_merge($events, $this->generateMensileEvents($evento, $start, $end, $baseUrl));
|
||||||
$current = $startDate->copy();
|
} elseif ($evento->tipo_recorrenza === 'annuale' && $evento->mese_annuale) {
|
||||||
while ($current <= $endDate) {
|
$events = array_merge($events, $this->generateAnnualeEvents($evento, $start, $end, $baseUrl));
|
||||||
$nextOccurrence = $current->copy()->next($evento->giorno_settimana);
|
} elseif ($evento->tipo_recorrenza === 'altro' && $evento->giorno_settimana !== null) {
|
||||||
if ($nextOccurrence >= $startDate && $nextOccurrence <= $endDate) {
|
$events = array_merge($events, $this->generateAltroEvents($evento, $start, $end, $baseUrl));
|
||||||
$events[] = [
|
|
||||||
'id' => $evento->id . '_' . $nextOccurrence->format('Ymd'),
|
|
||||||
'title' => $evento->nome_evento,
|
|
||||||
'start' => $nextOccurrence->format('Y-m-d') . ($evento->ora_inizio ? 'T' . $evento->ora_inizio->format('H:i') : ''),
|
|
||||||
'url' => $baseUrl . '/eventi/' . $evento->id,
|
|
||||||
'backgroundColor' => $this->getEventoColor($evento),
|
|
||||||
'borderColor' => $this->getEventoColor($evento),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$current->addWeek();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json($events);
|
return response()->json($events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function buildCalendarEvent(Evento $evento, $date, ?string $baseUrl = null): array
|
||||||
|
{
|
||||||
|
if ($date instanceof \Carbon\Carbon) {
|
||||||
|
$carbon = $date;
|
||||||
|
} elseif (is_string($date)) {
|
||||||
|
$carbon = \Carbon\Carbon::parse($date);
|
||||||
|
} else {
|
||||||
|
$carbon = $date;
|
||||||
|
}
|
||||||
|
|
||||||
|
$baseUrl = $baseUrl ?? request()->getSchemeAndHttpHost();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => $evento->id . '_' . $carbon->format('Ymd'),
|
||||||
|
'title' => $evento->nome_evento,
|
||||||
|
'start' => $carbon->format('Y-m-d') . ($evento->ora_inizio ? 'T' . $evento->ora_inizio->format('H:i') : ''),
|
||||||
|
'url' => $baseUrl . '/eventi/' . $evento->id,
|
||||||
|
'backgroundColor' => $this->getEventoColor($evento),
|
||||||
|
'borderColor' => $this->getEventoColor($evento),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateSettimanaleEvents(Evento $evento, $start, $end, $baseUrl): array
|
||||||
|
{
|
||||||
|
$startDate = \Carbon\Carbon::parse($start);
|
||||||
|
$endDate = \Carbon\Carbon::parse($end);
|
||||||
|
$events = [];
|
||||||
|
|
||||||
|
$current = $startDate->copy()->startOfWeek();
|
||||||
|
$targetDay = $evento->giorno_settimana;
|
||||||
|
|
||||||
|
while ($current <= $endDate) {
|
||||||
|
$dayOfWeek = (int) $current->format('w');
|
||||||
|
if ($dayOfWeek === $targetDay && $current >= $startDate && $current <= $endDate) {
|
||||||
|
$events[] = $this->buildCalendarEvent($evento, $current->copy(), $baseUrl);
|
||||||
|
}
|
||||||
|
$current->addDay();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateMensileEvents(Evento $evento, $start, $end, $baseUrl): array
|
||||||
|
{
|
||||||
|
$startDate = \Carbon\Carbon::parse($start);
|
||||||
|
$endDate = \Carbon\Carbon::parse($end);
|
||||||
|
$events = [];
|
||||||
|
|
||||||
|
$parts = explode(',', $evento->occorrenza_mese);
|
||||||
|
if (count($parts) !== 2) {
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
$occorrenza = (int) $parts[0];
|
||||||
|
$giornoSettimana = (int) $parts[1];
|
||||||
|
|
||||||
|
$mesiSelezionati = [];
|
||||||
|
if ($evento->mesi_recorrenza) {
|
||||||
|
$mesiSelezionati = array_map('intval', explode(',', $evento->mesi_recorrenza));
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentMonth = $startDate->copy()->startOfMonth();
|
||||||
|
$endMonth = $endDate->copy()->startOfMonth();
|
||||||
|
|
||||||
|
while ($currentMonth <= $endMonth) {
|
||||||
|
$monthNumber = (int) $currentMonth->format('n');
|
||||||
|
|
||||||
|
if (empty($mesiSelezionati) || in_array($monthNumber, $mesiSelezionati)) {
|
||||||
|
$occurrenceDate = $this->findNthWeekdayOfMonth($currentMonth, $occorrenza, $giornoSettimana);
|
||||||
|
|
||||||
|
if ($occurrenceDate && $occurrenceDate >= $startDate && $occurrenceDate <= $endDate) {
|
||||||
|
$events[] = $this->buildCalendarEvent($evento, $occurrenceDate, $baseUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentMonth->addMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function findNthWeekdayOfMonth(\Carbon\Carbon $month, int $occurrence, int $targetDayOfWeek): ?\Carbon\Carbon
|
||||||
|
{
|
||||||
|
$firstOfMonth = $month->copy()->startOfMonth();
|
||||||
|
$firstDayOfWeek = (int) $firstOfMonth->format('w');
|
||||||
|
|
||||||
|
$daysUntilTarget = ($targetDayOfWeek - $firstDayOfWeek + 7) % 7;
|
||||||
|
$firstOccurrence = $firstOfMonth->copy()->addDays($daysUntilTarget);
|
||||||
|
|
||||||
|
$targetDate = $firstOccurrence->copy()->addWeeks($occurrence - 1);
|
||||||
|
|
||||||
|
if ((int) $targetDate->format('n') !== (int) $month->format('n')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $targetDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateAnnualeEvents(Evento $evento, $start, $end, $baseUrl): array
|
||||||
|
{
|
||||||
|
$startDate = \Carbon\Carbon::parse($start);
|
||||||
|
$endDate = \Carbon\Carbon::parse($end);
|
||||||
|
$events = [];
|
||||||
|
|
||||||
|
$year = $startDate->year;
|
||||||
|
$endYear = $endDate->year;
|
||||||
|
|
||||||
|
while ($year <= $endYear + 1) {
|
||||||
|
$day = $evento->giorno_mese ?? 1;
|
||||||
|
$eventDate = \Carbon\Carbon::create($year, $evento->mese_annuale, $day);
|
||||||
|
|
||||||
|
$daysInMonth = $eventDate->daysInMonth;
|
||||||
|
if ($evento->giorno_mese && $evento->giorno_mese > $daysInMonth) {
|
||||||
|
$eventDate = $eventDate->endOfMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($eventDate >= $startDate && $eventDate <= $endDate) {
|
||||||
|
$events[] = $this->buildCalendarEvent($evento, $eventDate, $baseUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
$year++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function generateAltroEvents(Evento $evento, $start, $end, $baseUrl): array
|
||||||
|
{
|
||||||
|
$startDate = \Carbon\Carbon::parse($start);
|
||||||
|
$endDate = \Carbon\Carbon::parse($end);
|
||||||
|
$events = [];
|
||||||
|
|
||||||
|
$current = $startDate->copy()->startOfWeek();
|
||||||
|
$targetDay = $evento->giorno_settimana;
|
||||||
|
|
||||||
|
while ($current <= $endDate) {
|
||||||
|
$dayOfWeek = (int) $current->format('w');
|
||||||
|
if ($dayOfWeek === $targetDay && $current >= $startDate && $current <= $endDate) {
|
||||||
|
$events[] = $this->buildCalendarEvent($evento, $current->copy(), $baseUrl);
|
||||||
|
}
|
||||||
|
$current->addDay();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
private function getEventoColor(Evento $evento): string
|
private function getEventoColor(Evento $evento): string
|
||||||
{
|
{
|
||||||
$colors = [
|
$colors = [
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Documento;
|
||||||
|
use App\Models\Gruppo;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class GruppoAvatarController extends Controller
|
||||||
|
{
|
||||||
|
public function store(Request $request, Gruppo $gruppo)
|
||||||
|
{
|
||||||
|
$this->authorizeWrite('gruppi');
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'avatar' => 'required|image|mimes:jpeg,png,gif,webp|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$existing = $gruppo->avatar;
|
||||||
|
if ($existing) {
|
||||||
|
if ($existing->file_path && Storage::disk('local')->exists($existing->file_path)) {
|
||||||
|
Storage::disk('local')->delete($existing->file_path);
|
||||||
|
}
|
||||||
|
$existing->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $request->file('avatar');
|
||||||
|
$path = $file->store('avatars/gruppi', 'local');
|
||||||
|
|
||||||
|
$documento = Documento::create([
|
||||||
|
'user_id' => auth()->id(),
|
||||||
|
'nome_file' => $file->getClientOriginalName(),
|
||||||
|
'file_path' => $path,
|
||||||
|
'tipologia' => 'avatar',
|
||||||
|
'visibilita' => 'gruppo',
|
||||||
|
'visibilita_target_id' => $gruppo->id,
|
||||||
|
'visibilita_target_type' => Gruppo::class,
|
||||||
|
'mime_type' => $file->getMimeType(),
|
||||||
|
'dimensione' => $file->getSize(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$gruppo->avatar()->save($documento);
|
||||||
|
|
||||||
|
return response()->json(['success' => true, 'avatar_url' => $documento->file_path]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Gruppo $gruppo)
|
||||||
|
{
|
||||||
|
$this->authorizeRead('gruppi');
|
||||||
|
|
||||||
|
$avatar = $gruppo->avatar;
|
||||||
|
if (!$avatar || !$avatar->file_path || !Storage::disk('local')->exists($avatar->file_path)) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fullPath = Storage::disk('local')->path($avatar->file_path);
|
||||||
|
return response()->file($fullPath, ['Content-Type' => $avatar->mime_type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Gruppo $gruppo)
|
||||||
|
{
|
||||||
|
$this->authorizeWrite('gruppi');
|
||||||
|
|
||||||
|
$avatar = $gruppo->avatar;
|
||||||
|
if ($avatar) {
|
||||||
|
if ($avatar->file_path && Storage::disk('local')->exists($avatar->file_path)) {
|
||||||
|
Storage::disk('local')->delete($avatar->file_path);
|
||||||
|
}
|
||||||
|
$avatar->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['success' => true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Gruppo;
|
use App\Models\Gruppo;
|
||||||
@@ -30,111 +32,7 @@ class GruppoController extends Controller
|
|||||||
$visibleColumns = $defaultVisible;
|
$visibleColumns = $defaultVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
$allGruppi = Gruppo::with(['diocesi', 'parent', 'children', 'individui'])
|
$allGruppi = Gruppo::with(['diocesi', 'parent', 'children', 'individui', 'avatar'])
|
||||||
->orderBy('nome')
|
|
||||||
->get()
|
|
||||||
->map(function ($gruppo) {
|
|
||||||
$depth = 0;
|
|
||||||
$parent = $gruppo->parent;
|
|
||||||
while ($parent) {
|
|
||||||
$depth++;
|
|
||||||
$parent = $parent->parent;
|
|
||||||
}
|
|
||||||
$gruppo->depth = $depth;
|
|
||||||
return $gruppo;
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($viewMode === 'table') {
|
|
||||||
$gruppi = $this->sortGruppiHierarchically($allGruppi);
|
|
||||||
} else {
|
|
||||||
$gruppi = $allGruppi;
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('gruppi.index', compact(
|
|
||||||
'gruppi',
|
|
||||||
'allColumns',
|
|
||||||
'visibleColumns',
|
|
||||||
'viewMode',
|
|
||||||
'vista'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function sortGruppiHierarchically($gruppi)
|
|
||||||
{
|
|
||||||
$rootGroups = $gruppi->filter(fn($g) => $g->parent_id === null)->sortBy('nome');
|
|
||||||
$sorted = collect();
|
|
||||||
|
|
||||||
foreach ($rootGroups as $root) {
|
|
||||||
$sorted->push($root);
|
|
||||||
$this->addChildrenRecursive($root, $gruppi, $sorted);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function addChildrenRecursive($parent, $allGruppi, &$sorted)
|
|
||||||
{
|
|
||||||
$children = $allGruppi->filter(fn($g) => $g->parent_id === $parent->id)->sortBy('nome');
|
|
||||||
|
|
||||||
foreach ($children as $child) {
|
|
||||||
$sorted->push($child);
|
|
||||||
$this->addChildrenRecursive($child, $allGruppi, $sorted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$allGruppi = Gruppo::with(['diocesi', 'parent', 'children', 'individui'])
|
|
||||||
->orderBy('nome')
|
|
||||||
->get()
|
|
||||||
->map(function ($gruppo) {
|
|
||||||
$depth = 0;
|
|
||||||
$parent = $gruppo->parent;
|
|
||||||
while ($parent) {
|
|
||||||
$depth++;
|
|
||||||
$parent = $parent->parent;
|
|
||||||
}
|
|
||||||
$gruppo->depth = $depth;
|
|
||||||
return $gruppo;
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($viewMode === 'table') {
|
|
||||||
$gruppi = $this->sortGruppiHierarchically($allGruppi);
|
|
||||||
} else {
|
|
||||||
$gruppi = $allGruppi;
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('gruppi.index', compact(
|
|
||||||
'gruppi',
|
|
||||||
'allColumns',
|
|
||||||
'visibleColumns',
|
|
||||||
'viewMode',
|
|
||||||
'vista'
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function sortGruppiHierarchically($gruppi)
|
|
||||||
{
|
|
||||||
$rootGroups = $gruppi->filter(fn($g) => $g->parent_id === null)->sortBy('nome');
|
|
||||||
$sorted = collect();
|
|
||||||
|
|
||||||
foreach ($rootGroups as $root) {
|
|
||||||
$sorted->push($root);
|
|
||||||
$this->addChildrenRecursive($root, $gruppi, $sorted);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sorted;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function addChildrenRecursive($parent, $allGruppi, &$sorted)
|
|
||||||
{
|
|
||||||
$children = $allGruppi->filter(fn($g) => $g->parent_id === $parent->id)->sortBy('nome');
|
|
||||||
|
|
||||||
foreach ($children as $child) {
|
|
||||||
$sorted->push($child);
|
|
||||||
$this->addChildrenRecursive($child, $allGruppi, $sorted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$allGruppi = Gruppo::with(['diocesi', 'parent', 'children', 'individui'])
|
|
||||||
->orderBy('nome')
|
->orderBy('nome')
|
||||||
->get()
|
->get()
|
||||||
->map(function ($gruppo) {
|
->map(function ($gruppo) {
|
||||||
@@ -233,31 +131,31 @@ class GruppoController extends Controller
|
|||||||
return redirect('/gruppi/' . $gruppo->id)->with('success', 'Gruppo creato con successo.');
|
return redirect('/gruppi/' . $gruppo->id)->with('success', 'Gruppo creato con successo.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show($gruppo)
|
public function show($id)
|
||||||
{
|
{
|
||||||
$this->authorizeRead('gruppi');
|
$this->authorizeRead('gruppi');
|
||||||
$gruppo = Gruppo::with(['parent', 'children', 'diocesi', 'individui.contatti', 'individui.documenti', 'individui' => function ($q) {
|
$gruppo = Gruppo::with(['parent', 'children', 'diocesi', 'individui.contatti', 'individui.documenti', 'individui' => function ($q) {
|
||||||
$q->withPivot('ruolo_ids', 'ruolo_nel_gruppo', 'data_adesione');
|
$q->withPivot('ruolo_ids', 'ruolo_nel_gruppo', 'data_adesione');
|
||||||
}, 'eventi' => function ($q) {
|
}, 'avatar', 'eventi' => function ($q) {
|
||||||
$q->where('is_incontro_gruppo', true);
|
$q->where('is_incontro_gruppo', true);
|
||||||
}, 'eventi.responsabili.contatti'])->findOrFail($gruppo);
|
}, 'eventi.responsabili.contatti'])->findOrFail($id);
|
||||||
return view('gruppi.show', compact('gruppo'));
|
return view('gruppi.show', compact('gruppo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($gruppo)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$this->authorizeWrite('gruppi');
|
$this->authorizeWrite('gruppi');
|
||||||
$gruppo = Gruppo::with(['individui.contatti', 'individui.documenti'])->findOrFail($gruppo);
|
$gruppo = Gruppo::with(['individui.contatti', 'individui.documenti', 'avatar'])->findOrFail($id);
|
||||||
$diocesi = Diocesi::orderBy('nome')->get();
|
$diocesi = Diocesi::orderBy('nome')->get();
|
||||||
$gruppi = Gruppo::where('id', '!=', $gruppo->id)->orderBy('nome')->get();
|
$gruppi = Gruppo::where('id', '!=', $gruppo->id)->orderBy('nome')->get();
|
||||||
$membri = $gruppo->individui()->withPivot('ruolo_ids', 'ruolo_nel_gruppo', 'data_adesione')->orderBy('cognome')->orderBy('nome')->get();
|
$membri = $gruppo->individui()->withPivot('ruolo_ids', 'ruolo_nel_gruppo', 'data_adesione')->orderBy('cognome')->orderBy('nome')->get();
|
||||||
return view('gruppi.edit', compact('gruppo', 'diocesi', 'gruppi', 'membri'));
|
return view('gruppi.edit', compact('gruppo', 'diocesi', 'gruppi', 'membri'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, $gruppo)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
$this->authorizeWrite('gruppi');
|
$this->authorizeWrite('gruppi');
|
||||||
$gruppo = Gruppo::findOrFail($gruppo);
|
$gruppo = Gruppo::findOrFail($id);
|
||||||
$data = $request->validate([
|
$data = $request->validate([
|
||||||
'nome' => 'required|string|max:255',
|
'nome' => 'required|string|max:255',
|
||||||
'descrizione' => 'nullable|string',
|
'descrizione' => 'nullable|string',
|
||||||
@@ -295,10 +193,10 @@ class GruppoController extends Controller
|
|||||||
return redirect('/gruppi/' . $gruppo->id)->with('success', 'Gruppo aggiornato.');
|
return redirect('/gruppi/' . $gruppo->id)->with('success', 'Gruppo aggiornato.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function destroy($gruppo)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
$this->authorizeDelete('gruppi');
|
$this->authorizeDelete('gruppi');
|
||||||
$gruppo = Gruppo::with('children', 'individui')->findOrFail($gruppo);
|
$gruppo = Gruppo::with('children', 'individui')->findOrFail($id);
|
||||||
|
|
||||||
$hasChildren = $gruppo->children()->count() > 0;
|
$hasChildren = $gruppo->children()->count() > 0;
|
||||||
$isSuperAdmin = auth()->user()->isSuperAdmin();
|
$isSuperAdmin = auth()->user()->isSuperAdmin();
|
||||||
@@ -393,13 +291,13 @@ class GruppoController extends Controller
|
|||||||
return response()->json(['success' => true, 'vista_id' => $vista->id]);
|
return response()->json(['success' => true, 'vista_id' => $vista->id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteVista($vista)
|
public function deleteVista($id)
|
||||||
{
|
{
|
||||||
$vista = \App\Models\VistaReport::where('user_id', auth()->id())
|
$vista = \App\Models\VistaReport::where('user_id', auth()->id())
|
||||||
->where('id', $vista)
|
->where('id', $id)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
$vista->delete();
|
$vista->delete();
|
||||||
|
|
||||||
return redirect()->route('gruppi.index')->with('success', 'Vista eliminata.');
|
return redirect()->route('gruppi.index')->with('success', 'Vista eliminata.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,47 @@ class ReportController extends Controller
|
|||||||
return redirect()->route('report.index')->with('success', 'Report personalizzato eliminato.');
|
return redirect()->route('report.index')->with('success', 'Report personalizzato eliminato.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function printPreview(Request $request)
|
||||||
|
{
|
||||||
|
if (!auth()->user()->canAccess('report')) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$reportType = $request->input('report');
|
||||||
|
$customReportId = $request->input('custom_id');
|
||||||
|
|
||||||
|
if ($customReportId) {
|
||||||
|
$report = \App\Models\ReportCustom::findOrFail($customReportId);
|
||||||
|
if ($report->user_id !== auth()->id()) {
|
||||||
|
abort(403);
|
||||||
|
}
|
||||||
|
$data = $this->runCustomReport($report);
|
||||||
|
return view('report.print-preview', compact('reportType', 'data', 'report'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = match ($reportType) {
|
||||||
|
'individui_per_genere' => $this->reportIndividuiPerGenere(),
|
||||||
|
'individui_per_eta' => $this->reportIndividuiPerEta(),
|
||||||
|
'gruppi_gerarchia' => $this->reportGruppiGerarchia(),
|
||||||
|
'gruppi_membri' => $this->reportGruppiMembri(),
|
||||||
|
'eventi_calendario' => $this->reportEventiCalendario(),
|
||||||
|
'documenti_per_tipo' => $this->reportDocumentiPerTipo(),
|
||||||
|
'contatti_per_tipo' => $this->reportContattiPerTipo(),
|
||||||
|
'mailing_list_dettaglio' => $this->reportMailingListDettaglio(),
|
||||||
|
'individui_senza_contatti' => $this->reportIndividuiSenzaContatti(),
|
||||||
|
'individui_senza_gruppo' => $this->reportIndividuiSenzaGruppo(),
|
||||||
|
'eventi_per_gruppo' => $this->reportEventiPerGruppo(),
|
||||||
|
'documenti_orfani' => $this->reportDocumentiOrfani(),
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!$data) {
|
||||||
|
return redirect()->route('report.index')->with('error', 'Report non trovato.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('report.print-preview', compact('reportType', 'data'));
|
||||||
|
}
|
||||||
|
|
||||||
public function exportCSV(Request $request)
|
public function exportCSV(Request $request)
|
||||||
{
|
{
|
||||||
if (!auth()->user()->canAccess('report')) {
|
if (!auth()->user()->canAccess('report')) {
|
||||||
|
|||||||
+25
-3
@@ -127,7 +127,15 @@ class Evento extends Model
|
|||||||
|
|
||||||
public function getOccorrenzeMensiliList(): array
|
public function getOccorrenzeMensiliList(): array
|
||||||
{
|
{
|
||||||
$giorni = ['Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato', 'Domenica'];
|
$giorni = [
|
||||||
|
0 => 'Domenica',
|
||||||
|
1 => 'Lunedì',
|
||||||
|
2 => 'Martedì',
|
||||||
|
3 => 'Mercoledì',
|
||||||
|
4 => 'Giovedì',
|
||||||
|
5 => 'Venerdì',
|
||||||
|
6 => 'Sabato',
|
||||||
|
];
|
||||||
$list = [];
|
$list = [];
|
||||||
for ($occ = 1; $occ <= 4; $occ++) {
|
for ($occ = 1; $occ <= 4; $occ++) {
|
||||||
foreach ($giorni as $idx => $giorno) {
|
foreach ($giorni as $idx => $giorno) {
|
||||||
@@ -153,7 +161,15 @@ class Evento extends Model
|
|||||||
$occorrenza = (int) $parts[0];
|
$occorrenza = (int) $parts[0];
|
||||||
$giorno = (int) $parts[1];
|
$giorno = (int) $parts[1];
|
||||||
|
|
||||||
$giorni = ['Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato', 'Domenica'];
|
$giorni = [
|
||||||
|
0 => 'Domenica',
|
||||||
|
1 => 'Lunedì',
|
||||||
|
2 => 'Martedì',
|
||||||
|
3 => 'Mercoledì',
|
||||||
|
4 => 'Giovedì',
|
||||||
|
5 => 'Venerdì',
|
||||||
|
6 => 'Sabato',
|
||||||
|
];
|
||||||
|
|
||||||
return $occorrenza . '° ' . ($giorni[$giorno] ?? '-');
|
return $occorrenza . '° ' . ($giorni[$giorno] ?? '-');
|
||||||
}
|
}
|
||||||
@@ -199,7 +215,13 @@ class Evento extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mesiLabels = $this->getMesiList();
|
$mesiLabels = $this->getMesiList();
|
||||||
return $mesiLabels[$this->mese_annuale]['label'] ?? '-';
|
$label = $mesiLabels[$this->mese_annuale]['label'] ?? '-';
|
||||||
|
|
||||||
|
if ($this->giorno_mese) {
|
||||||
|
$label .= ' (giorno ' . $this->giorno_mese . ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPeriodicitaLabelAttribute(): string
|
public function getPeriodicitaLabelAttribute(): string
|
||||||
|
|||||||
+36
-12
@@ -5,6 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Gruppo extends Model
|
class Gruppo extends Model
|
||||||
@@ -48,24 +49,47 @@ class Gruppo extends Model
|
|||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function avatar(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(Documento::class, 'visibilita_target_id')
|
||||||
|
->where('tipologia', 'avatar')
|
||||||
|
->where('visibilita_target_type', self::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAvatarUrlAttribute(): ?string
|
||||||
|
{
|
||||||
|
if ($this->avatar && $this->avatar->file_path) {
|
||||||
|
return url('/gruppi/' . $this->id . '/avatar-file');
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResponsabili()
|
||||||
|
{
|
||||||
|
if (empty($this->responsabile_ids)) {
|
||||||
|
return collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
$ids = is_array($this->responsabile_ids)
|
||||||
|
? $this->responsabile_ids
|
||||||
|
: json_decode($this->responsabile_ids, true);
|
||||||
|
|
||||||
|
if (empty($ids)) {
|
||||||
|
return collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Individuo::whereIn('id', $ids)->get();
|
||||||
|
}
|
||||||
|
|
||||||
public function getResponsabiliIds(): array
|
public function getResponsabiliIds(): array
|
||||||
{
|
{
|
||||||
if (empty($this->responsabile_ids)) {
|
if (empty($this->responsabile_ids)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (is_array($this->responsabile_ids)) {
|
|
||||||
return $this->responsabile_ids;
|
|
||||||
}
|
|
||||||
return json_decode($this->responsabile_ids, true) ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getResponsabili(): \Illuminate\Database\Eloquent\Collection
|
return is_array($this->responsabile_ids)
|
||||||
{
|
? $this->responsabile_ids
|
||||||
$ids = $this->getResponsabiliIds();
|
: json_decode($this->responsabile_ids, true) ?? [];
|
||||||
if (empty($ids)) {
|
|
||||||
return new \Illuminate\Database\Eloquent\Collection();
|
|
||||||
}
|
|
||||||
return Individuo::whereIn('id', $ids)->get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function eventi(): BelongsToMany
|
public function eventi(): BelongsToMany
|
||||||
|
|||||||
@@ -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('eventi', function (Blueprint $table) {
|
||||||
|
$table->string('occorrenza_mese', 10)->nullable()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('eventi', function (Blueprint $table) {
|
||||||
|
$table->unsignedTinyInteger('occorrenza_mese')->nullable()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Anteprima non disponibile</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
background-color: #f4f6f9;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.fallback-container {
|
||||||
|
text-align: center;
|
||||||
|
padding: 40px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
.fallback-icon {
|
||||||
|
font-size: 64px;
|
||||||
|
color: #6c757d;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.fallback-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.fallback-message {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
.fallback-file-info {
|
||||||
|
background: #f8f9fa;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.fallback-file-info strong {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.download-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 {
|
||||||
|
background-color: #0056b3;
|
||||||
|
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>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -149,6 +149,16 @@
|
|||||||
<option value="12" {{ old('mese_annuale') == '12' ? 'selected' : '' }}>Dicembre</option>
|
<option value="12" {{ old('mese_annuale') == '12' ? 'selected' : '' }}>Dicembre</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Giorno del Mese</label>
|
||||||
|
<select name="giorno_mese" class="form-control">
|
||||||
|
<option value="">Seleziona giorno...</option>
|
||||||
|
@for($d = 1; $d <= 31; $d++)
|
||||||
|
<option value="{{ $d }}" {{ old('giorno_mese') == $d ? 'selected' : '' }}>{{ $d }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<small class="form-text text-muted">Se il giorno non esiste nel mese selezionato, verrà usato l'ultimo giorno disponibile</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -160,6 +160,16 @@
|
|||||||
<option value="12" {{ old('mese_annuale', $evento->mese_annuale) == '12' ? 'selected' : '' }}>Dicembre</option>
|
<option value="12" {{ old('mese_annuale', $evento->mese_annuale) == '12' ? 'selected' : '' }}>Dicembre</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Giorno del Mese</label>
|
||||||
|
<select name="giorno_mese" class="form-control">
|
||||||
|
<option value="">Seleziona giorno...</option>
|
||||||
|
@for($d = 1; $d <= 31; $d++)
|
||||||
|
<option value="{{ $d }}" {{ old('giorno_mese', $evento->giorno_mese) == $d ? 'selected' : '' }}>{{ $d }}</option>
|
||||||
|
@endfor
|
||||||
|
</select>
|
||||||
|
<small class="form-text text-muted">Se il giorno non esiste nel mese selezionato, verrà usato l'ultimo giorno disponibile</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Tutti gli Eventi</h3>
|
<h3 class="card-title">Tutti gli Eventi</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
|
<a href="/eventi/calendar" class="btn btn-sm btn-outline-primary mr-2">
|
||||||
|
<i class="fas fa-calendar-alt mr-1"></i> Calendario
|
||||||
|
</a>
|
||||||
@if($canDeleteEventi)
|
@if($canDeleteEventi)
|
||||||
<div class="btn-group mr-2">
|
<div class="btn-group mr-2">
|
||||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
||||||
|
|||||||
@@ -121,6 +121,43 @@ $canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><i class="fas fa-camera mr-2"></i>Avatar</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body text-center">
|
||||||
|
@if($gruppo->avatar_url)
|
||||||
|
<img src="{{ $gruppo->avatar_url }}"
|
||||||
|
alt="{{ $gruppo->nome }}"
|
||||||
|
class="img-thumbnail mb-2"
|
||||||
|
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 50%;">
|
||||||
|
<br>
|
||||||
|
<form id="remove-avatar-form" class="d-inline">
|
||||||
|
<button type="button" class="btn btn-danger btn-sm" onclick="removeAvatar()">
|
||||||
|
<i class="fas fa-trash mr-1"></i>Rimuovi
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
<div class="bg-secondary d-flex align-items-center justify-content-center mb-3"
|
||||||
|
style="width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;">
|
||||||
|
<i class="fas fa-folder fa-4x text-white"></i>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<form id="avatar-upload-form" enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
<div class="custom-file mb-2">
|
||||||
|
<input type="file" class="custom-file-input" id="avatar-input" name="avatar" accept="image/jpeg,image/png,image/gif,image/webp">
|
||||||
|
<label class="custom-file-label" for="avatar-input">Scegli immagine...</label>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-primary btn-sm" onclick="uploadAvatar()">
|
||||||
|
<i class="fas fa-upload mr-1"></i>Carica
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
<div id="avatar-message" class="mt-2"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$incontroEvento = $gruppo->eventi->where('is_incontro_gruppo', true)->first();
|
$incontroEvento = $gruppo->eventi->where('is_incontro_gruppo', true)->first();
|
||||||
@@ -155,6 +192,9 @@ $canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
|||||||
<span class="badge badge-info ml-1">Mensile</span>
|
<span class="badge badge-info ml-1">Mensile</span>
|
||||||
@elseif($incontroEvento->tipo_recorrenza === 'annuale')
|
@elseif($incontroEvento->tipo_recorrenza === 'annuale')
|
||||||
{{ $incontroEvento->mese_annuale_label }}
|
{{ $incontroEvento->mese_annuale_label }}
|
||||||
|
@if($incontroEvento->giorno_mese)
|
||||||
|
, giorno {{ $incontroEvento->giorno_mese }}
|
||||||
|
@endif
|
||||||
<span class="badge badge-info ml-1">Annuale</span>
|
<span class="badge badge-info ml-1">Annuale</span>
|
||||||
@elseif($incontroEvento->tipo_recorrenza === 'altro')
|
@elseif($incontroEvento->tipo_recorrenza === 'altro')
|
||||||
{{ $incontroEvento->giorno_settimana_label }}
|
{{ $incontroEvento->giorno_settimana_label }}
|
||||||
@@ -503,13 +543,76 @@ function previewDocumento(id, mimeType) {
|
|||||||
document.getElementById('previewDownloadBtn').href = downloadUrl;
|
document.getElementById('previewDownloadBtn').href = downloadUrl;
|
||||||
document.getElementById('previewModalTitle').textContent = 'Anteprima';
|
document.getElementById('previewModalTitle').textContent = 'Anteprima';
|
||||||
|
|
||||||
if (mimeType && mimeType.startsWith('image/')) {
|
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
|
|
||||||
} else {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#previewModal').modal('show');
|
$('#previewModal').modal('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('avatar-input').addEventListener('change', function(e) {
|
||||||
|
if (e.target.files.length > 0) {
|
||||||
|
var label = e.target.files[0].name;
|
||||||
|
var next = e.target.nextElementSibling;
|
||||||
|
if (next && next.classList.contains('custom-file-label')) {
|
||||||
|
next.textContent = label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function uploadAvatar() {
|
||||||
|
var input = document.getElementById('avatar-input');
|
||||||
|
if (!input.files.length) {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Seleziona un\'immagine</span>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var formData = new FormData();
|
||||||
|
formData.append('avatar', input.files[0]);
|
||||||
|
formData.append('_token', '{{ csrf_token() }}');
|
||||||
|
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-info"><i class="fas fa-spinner fa-spin"></i> Caricamento...</span>';
|
||||||
|
|
||||||
|
fetch('{{ url('/gruppi/' . $gruppo->id . '/avatar') }}', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar caricato!</span>';
|
||||||
|
setTimeout(function() { window.location.reload(); }, 1000);
|
||||||
|
} else {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAvatar() {
|
||||||
|
if (!confirm('Rimuovere l\'avatar?')) return;
|
||||||
|
|
||||||
|
fetch('{{ url('/gruppi/' . $gruppo->id . '/avatar') }}', {
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
'X-CSRF-TOKEN': '{{ csrf_token() }}',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.success) {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar rimosso!</span>';
|
||||||
|
setTimeout(function() { window.location.reload(); }, 1000);
|
||||||
|
} else {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|||||||
@@ -0,0 +1,399 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Stampa Report - {{ $data['title'] ?? 'Report' }}</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #333;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
background: #2c3e50;
|
||||||
|
color: #fff;
|
||||||
|
padding: 15px 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar label {
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar select {
|
||||||
|
padding: 6px 12px;
|
||||||
|
border: 1px solid #4a5568;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #4a5568;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #63b3ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print {
|
||||||
|
background: #28a745;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print:hover {
|
||||||
|
background: #218838;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close {
|
||||||
|
background: #dc3545;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close:hover {
|
||||||
|
background: #c82333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #6c757d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #5a6268;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container {
|
||||||
|
max-width: 210mm;
|
||||||
|
margin: 20px auto;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.portrait {
|
||||||
|
width: 210mm;
|
||||||
|
min-height: 297mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.landscape {
|
||||||
|
width: 297mm;
|
||||||
|
min-height: 210mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
border-bottom: 2px solid #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #2c3e50;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header .subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #7f8c8d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-summary {
|
||||||
|
background: #e8f4f8;
|
||||||
|
padding: 12px 15px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-left: 4px solid #17a2b8;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th,
|
||||||
|
.report-table td {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th {
|
||||||
|
background: #f8f9fa;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr:nth-child(even) {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr:hover {
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data {
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
font-style: italic;
|
||||||
|
padding: 40px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data i {
|
||||||
|
font-size: 48px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-footer {
|
||||||
|
margin-top: 30px;
|
||||||
|
padding-top: 15px;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-count {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-top: 10px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
margin: 15mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
@page portrait {
|
||||||
|
size: portrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page landscape {
|
||||||
|
size: landscape;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #fff;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container {
|
||||||
|
margin: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0;
|
||||||
|
max-width: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.portrait {
|
||||||
|
width: auto;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.landscape {
|
||||||
|
width: auto;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table {
|
||||||
|
page-break-inside: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr {
|
||||||
|
page-break-inside: avoid;
|
||||||
|
page-break-after: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table thead {
|
||||||
|
display: table-header-group;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tfoot {
|
||||||
|
display: table-footer-group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="toolbar" id="toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<span class="toolbar-title">Anteprima di Stampa</span>
|
||||||
|
<div class="toolbar-group">
|
||||||
|
<label for="orientation">Orientamento:</label>
|
||||||
|
<select id="orientation">
|
||||||
|
<option value="portrait">Verticale (Portrait)</option>
|
||||||
|
<option value="landscape">Orizzontale (Landscape)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="toolbar-group">
|
||||||
|
<label for="font-size">Dimensione font:</label>
|
||||||
|
<select id="font-size">
|
||||||
|
<option value="10">Piccolo (10px)</option>
|
||||||
|
<option value="11">Normale (11px)</option>
|
||||||
|
<option value="12" selected>Medio (12px)</option>
|
||||||
|
<option value="13">Grande (13px)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button class="btn btn-secondary" onclick="window.opener ? window.close() : window.location.href='{{ route('report.index') }}'">
|
||||||
|
Indietro
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-print" onclick="printReport()">
|
||||||
|
Stampa
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="preview-container portrait" id="preview-container">
|
||||||
|
<div class="report-header">
|
||||||
|
<h1>{{ $data['title'] ?? 'Report' }}</h1>
|
||||||
|
<div class="subtitle">Generato il {{ now()->format('d/m/Y H:i') }}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if(!empty($data['summary']))
|
||||||
|
<div class="report-summary">
|
||||||
|
<strong>{{ $data['summary'] }}</strong>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(!empty($data['headers']) && !empty($data['rows']))
|
||||||
|
<table class="report-table" id="report-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
@foreach($data['headers'] as $header)
|
||||||
|
<th>{{ $header }}</th>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($data['rows'] as $row)
|
||||||
|
<tr>
|
||||||
|
@foreach($row as $cell)
|
||||||
|
<td>{{ is_array($cell) ? json_encode($cell) : $cell }}</td>
|
||||||
|
@endforeach
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="row-count">Totale righe: {{ count($data['rows']) }}</div>
|
||||||
|
@else
|
||||||
|
<div class="no-data">
|
||||||
|
Nessun dato disponibile per questo report.
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="report-footer">
|
||||||
|
<p>Report generato automaticamente - Glastree</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const orientationSelect = document.getElementById('orientation');
|
||||||
|
const fontSizeSelect = document.getElementById('font-size');
|
||||||
|
const previewContainer = document.getElementById('preview-container');
|
||||||
|
const reportTable = document.getElementById('report-table');
|
||||||
|
|
||||||
|
function printReport() {
|
||||||
|
window.print();
|
||||||
|
}
|
||||||
|
|
||||||
|
orientationSelect.addEventListener('change', function() {
|
||||||
|
previewContainer.classList.remove('portrait', 'landscape');
|
||||||
|
previewContainer.classList.add(this.value);
|
||||||
|
|
||||||
|
if (this.value === 'landscape') {
|
||||||
|
document.body.classList.add('landscape-mode');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('landscape-mode');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fontSizeSelect.addEventListener('change', function() {
|
||||||
|
const size = this.value;
|
||||||
|
document.body.style.fontSize = size + 'px';
|
||||||
|
if (reportTable) {
|
||||||
|
reportTable.style.fontSize = (parseInt(size) - 1) + 'px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const savedOrientation = localStorage.getItem('report-print-orientation');
|
||||||
|
const savedFontSize = localStorage.getItem('report-print-font-size');
|
||||||
|
|
||||||
|
if (savedOrientation) {
|
||||||
|
orientationSelect.value = savedOrientation;
|
||||||
|
orientationSelect.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedFontSize) {
|
||||||
|
fontSizeSelect.value = savedFontSize;
|
||||||
|
fontSizeSelect.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
orientationSelect.addEventListener('change', function() {
|
||||||
|
localStorage.setItem('report-print-orientation', this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
fontSizeSelect.addEventListener('change', function() {
|
||||||
|
localStorage.setItem('report-print-font-size', this.value);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -11,6 +11,9 @@
|
|||||||
<a href="{{ route('report.index') }}" class="btn btn-sm btn-secondary mr-2">
|
<a href="{{ route('report.index') }}" class="btn btn-sm btn-secondary mr-2">
|
||||||
<i class="fas fa-arrow-left mr-1"></i> Torna ai Report
|
<i class="fas fa-arrow-left mr-1"></i> Torna ai Report
|
||||||
</a>
|
</a>
|
||||||
|
<a href="{{ route('report.print-preview', ['report' => $reportType, 'custom_id' => $customReport->id ?? null]) }}" class="btn btn-sm btn-info mr-2" target="_blank">
|
||||||
|
<i class="fas fa-print mr-1"></i> Stampa Report
|
||||||
|
</a>
|
||||||
<a href="{{ route('report.export', ['report' => $reportType]) }}" class="btn btn-sm btn-success">
|
<a href="{{ route('report.export', ['report' => $reportType]) }}" class="btn btn-sm btn-success">
|
||||||
<i class="fas fa-file-csv mr-1"></i> Esporta CSV
|
<i class="fas fa-file-csv mr-1"></i> Esporta CSV
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
+9
-5
@@ -1,8 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Support\Facades\Schedule;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Schedule::call(function () {
|
||||||
$this->comment(Inspiring::quote());
|
try {
|
||||||
})->purpose('Display an inspiring quote');
|
$emailController = new \App\Http\Controllers\EmailController();
|
||||||
|
$emailController->syncEmails();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Illuminate\Support\Facades\Log::error('Scheduled email sync failed', ['error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
})->name('email:sync')->everyFifteenMinutes()->withoutOverlapping();
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ Route::delete('gruppi/{gruppo}/membri/{individuo}', [GruppoMembroController::cla
|
|||||||
Route::get('gruppi/all', [GruppoController::class, 'allGruppi'])->middleware('auth');
|
Route::get('gruppi/all', [GruppoController::class, 'allGruppi'])->middleware('auth');
|
||||||
Route::get('gruppi/{gruppo}/individui-email', [GruppoController::class, 'individuiEmail'])->middleware('auth');
|
Route::get('gruppi/{gruppo}/individui-email', [GruppoController::class, 'individuiEmail'])->middleware('auth');
|
||||||
|
|
||||||
|
Route::post('gruppi/{gruppo}/avatar', [\App\Http\Controllers\GruppoAvatarController::class, 'store'])->middleware('auth');
|
||||||
|
Route::get('gruppi/{gruppo}/avatar-file', [\App\Http\Controllers\GruppoAvatarController::class, 'show'])->middleware('auth');
|
||||||
|
Route::delete('gruppi/{gruppo}/avatar', [\App\Http\Controllers\GruppoAvatarController::class, 'destroy'])->middleware('auth');
|
||||||
|
|
||||||
Route::resource('gruppi', GruppoController::class)->middleware('auth');
|
Route::resource('gruppi', GruppoController::class)->middleware('auth');
|
||||||
Route::get('eventi/calendar', [EventoController::class, 'calendar'])->name('eventi.calendar')->middleware('auth');
|
Route::get('eventi/calendar', [EventoController::class, 'calendar'])->name('eventi.calendar')->middleware('auth');
|
||||||
Route::get('eventi/calendar/events', [EventoController::class, 'calendarEvents'])->name('eventi.calendar.events')->middleware('auth');
|
Route::get('eventi/calendar/events', [EventoController::class, 'calendarEvents'])->name('eventi.calendar.events')->middleware('auth');
|
||||||
@@ -118,6 +122,7 @@ Route::delete('viste/{vistaReport}', [VistaReportController::class, 'destroy'])-
|
|||||||
|
|
||||||
Route::get('report', [ReportController::class, 'index'])->name('report.index')->middleware('auth');
|
Route::get('report', [ReportController::class, 'index'])->name('report.index')->middleware('auth');
|
||||||
Route::get('report/run', [ReportController::class, 'run'])->name('report.run')->middleware('auth');
|
Route::get('report/run', [ReportController::class, 'run'])->name('report.run')->middleware('auth');
|
||||||
|
Route::get('report/print-preview', [ReportController::class, 'printPreview'])->name('report.print-preview')->middleware('auth');
|
||||||
Route::get('report/export', [ReportController::class, 'exportCSV'])->name('report.export')->middleware('auth');
|
Route::get('report/export', [ReportController::class, 'exportCSV'])->name('report.export')->middleware('auth');
|
||||||
Route::get('report/custom/{id}', [ReportController::class, 'runCustom'])->name('report.run-custom')->middleware('auth');
|
Route::get('report/custom/{id}', [ReportController::class, 'runCustom'])->name('report.run-custom')->middleware('auth');
|
||||||
Route::post('report/custom', [ReportController::class, 'storeCustom'])->name('report.store-custom')->middleware('auth');
|
Route::post('report/custom', [ReportController::class, 'storeCustom'])->name('report.store-custom')->middleware('auth');
|
||||||
|
|||||||
@@ -10,6 +10,9 @@
|
|||||||
<a href="<?php echo e(route('report.index')); ?>" class="btn btn-sm btn-secondary mr-2">
|
<a href="<?php echo e(route('report.index')); ?>" class="btn btn-sm btn-secondary mr-2">
|
||||||
<i class="fas fa-arrow-left mr-1"></i> Torna ai Report
|
<i class="fas fa-arrow-left mr-1"></i> Torna ai Report
|
||||||
</a>
|
</a>
|
||||||
|
<a href="<?php echo e(route('report.print-preview', ['report' => $reportType, 'custom_id' => $customReport->id ?? null])); ?>" class="btn btn-sm btn-info mr-2" target="_blank">
|
||||||
|
<i class="fas fa-print mr-1"></i> Stampa Report
|
||||||
|
</a>
|
||||||
<a href="<?php echo e(route('report.export', ['report' => $reportType])); ?>" class="btn btn-sm btn-success">
|
<a href="<?php echo e(route('report.export', ['report' => $reportType])); ?>" class="btn btn-sm btn-success">
|
||||||
<i class="fas fa-file-csv mr-1"></i> Esporta CSV
|
<i class="fas fa-file-csv mr-1"></i> Esporta CSV
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,720 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Modifica Individuo'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Modifica Individuo'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<form action="/individui/<?php echo e($individuo->id); ?>" method="POST" id="main-form">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<?php echo method_field('PUT'); ?>
|
|
||||||
<input type="hidden" name="individuo_id" value="<?php echo e($individuo->id); ?>">
|
|
||||||
<input type="hidden" name="_avatar_token" value="<?php echo e(csrf_token()); ?>">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-user mr-2"></i>Dati Anagrafici</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Codice ID</label>
|
|
||||||
<input type="text" class="form-control" value="<?php echo e($individuo->codice_id); ?>" disabled>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Cognome *</label>
|
|
||||||
<input type="text" name="cognome" class="form-control" value="<?php echo e($individuo->cognome); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome" class="form-control" value="<?php echo e($individuo->nome); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Data di nascita</label>
|
|
||||||
<input type="date" name="data_nascita" class="form-control" value="<?php echo e($individuo->data_nascita?->format('Y-m-d')); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Genere</label>
|
|
||||||
<select name="genere" class="form-control">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="M" <?php echo e($individuo->genere === 'M' ? 'selected' : ''); ?>>Maschio</option>
|
|
||||||
<option value="F" <?php echo e($individuo->genere === 'F' ? 'selected' : ''); ?>>Femmina</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-secondary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-camera mr-2"></i>Avatar</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body text-center">
|
|
||||||
<?php if($individuo->avatar): ?>
|
|
||||||
<img src="/individui/<?php echo e($individuo->id); ?>/avatar"
|
|
||||||
alt="Avatar"
|
|
||||||
class="img-thumbnail mb-2"
|
|
||||||
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 50%;">
|
|
||||||
<br>
|
|
||||||
<button type="button" class="btn btn-danger btn-sm" onclick="deleteAvatar()">
|
|
||||||
<i class="fas fa-trash mr-1"></i>Rimuovi
|
|
||||||
</button>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="bg-secondary d-flex align-items-center justify-content-center mb-3"
|
|
||||||
style="width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;">
|
|
||||||
<i class="fas fa-user fa-4x text-white"></i>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="custom-file mb-2">
|
|
||||||
<input type="file" class="custom-file-input" id="avatar-input" name="avatar" accept="image/jpeg,image/png,image/gif">
|
|
||||||
<label class="custom-file-label" for="avatar-input">Scegli immagine...</label>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm" onclick="uploadAvatar()">
|
|
||||||
<i class="fas fa-upload mr-1"></i>Carica Avatar
|
|
||||||
</button>
|
|
||||||
<div id="avatar-message" class="mt-2"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-map-marker-alt mr-2"></i>Residenza</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Indirizzo</label>
|
|
||||||
<input type="text" name="indirizzo" class="form-control" value="<?php echo e($individuo->indirizzo); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>CAP</label>
|
|
||||||
<input type="text" name="cap" class="form-control" value="<?php echo e($individuo->cap); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Città</label>
|
|
||||||
<input type="text" name="città" class="form-control" value="<?php echo e($individuo->città); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label>Provincia</label>
|
|
||||||
<input type="text" name="sigla_provincia" class="form-control" maxlength="2" value="<?php echo e($individuo->sigla_provincia); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-id-card mr-2"></i>Documento di identità</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tipo documento</label>
|
|
||||||
<select name="tipo_documento" class="form-control">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="carta_identita" <?php echo e($individuo->tipo_documento === 'carta_identita' ? 'selected' : ''); ?>>Carta d'Identità</option>
|
|
||||||
<option value="patente" <?php echo e($individuo->tipo_documento === 'patente' ? 'selected' : ''); ?>>Patente</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Numero documento</label>
|
|
||||||
<input type="text" name="numero_documento" class="form-control" value="<?php echo e($individuo->numero_documento); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Scadenza documento</label>
|
|
||||||
<input type="date" name="scadenza_documento" class="form-control" value="<?php echo e($individuo->scadenza_documento?->format('Y-m-d')); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-sticky-note mr-2"></i>Note</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group mb-0">
|
|
||||||
<textarea name="note" class="form-control" rows="4"><?php echo e($individuo->note); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-address-book mr-2"></i>Contatti</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="aggiungiRigaContatto()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<table class="table table-bordered mb-0" id="contatti-table">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%;">Tipo</th>
|
|
||||||
<th style="width: 30%;">Valore</th>
|
|
||||||
<th style="width: 20%;">Etichetta</th>
|
|
||||||
<th style="width: 10%;">Primario</th>
|
|
||||||
<th style="width: 50px;"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="contatti-tbody">
|
|
||||||
<?php $__currentLoopData = $individuo->contatti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contatto): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<select name="contatti[<?php echo e($loop->index); ?>][tipo]" class="form-control">
|
|
||||||
<option value="telefono" <?php echo e($contatto->tipo === 'telefono' ? 'selected' : ''); ?>>Telefono</option>
|
|
||||||
<option value="cellulare" <?php echo e($contatto->tipo === 'cellulare' ? 'selected' : ''); ?>>Cellulare</option>
|
|
||||||
<option value="email" <?php echo e($contatto->tipo === 'email' ? 'selected' : ''); ?>>Email</option>
|
|
||||||
<option value="fax" <?php echo e($contatto->tipo === 'fax' ? 'selected' : ''); ?>>Fax</option>
|
|
||||||
<option value="web" <?php echo e($contatto->tipo === 'web' ? 'selected' : ''); ?>>Web</option>
|
|
||||||
<option value="telegram" <?php echo e($contatto->tipo === 'telegram' ? 'selected' : ''); ?>>Telegram</option>
|
|
||||||
<option value="whatsapp" <?php echo e($contatto->tipo === 'whatsapp' ? 'selected' : ''); ?>>WhatsApp</option>
|
|
||||||
<option value="altro" <?php echo e($contatto->tipo === 'altro' ? 'selected' : ''); ?>>Altro</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td><input type="text" name="contatti[<?php echo e($loop->index); ?>][valore]" class="form-control" value="<?php echo e($contatto->valore); ?>"></td>
|
|
||||||
<td><input type="text" name="contatti[<?php echo e($loop->index); ?>][etichetta]" class="form-control" value="<?php echo e($contatto->etichetta); ?>"></td>
|
|
||||||
<td class="text-center"><input type="checkbox" name="contatti[<?php echo e($loop->index); ?>][is_primary]" value="1" <?php echo e($contatto->is_primary ? 'checked' : ''); ?>></td>
|
|
||||||
<td><button type="button" class="btn btn-danger btn-xs" onclick="this.closest('tr').remove()"><i class="fas fa-trash"></i></button></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php if($individuo->contatti->isEmpty()): ?>
|
|
||||||
<div id="no-contatti-msg" class="text-center text-muted py-4">
|
|
||||||
<p class="mb-0">Nessun contatto. Clicca su "Aggiungi" per aggiungerne uno.</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder mr-2"></i>Gruppi</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showGruppoForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
|
|
||||||
<?php if($individuo->gruppi->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Diocesi</th>
|
|
||||||
<th style="width: 130px;">Ruolo</th>
|
|
||||||
<th style="width: 110px;">Data Adesione</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $individuo->gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gruppo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr id="gruppo-row-<?php echo e($gruppo->id); ?>">
|
|
||||||
<td>
|
|
||||||
<i class="fas fa-folder text-warning mr-1"></i>
|
|
||||||
<a href="/gruppi/<?php echo e($gruppo->id); ?>"><?php echo e($gruppo->nome); ?></a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($gruppo->diocesi?->nome ?: '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php $ruoliIndividuo = $individuo->getRuoliForGruppo($gruppo->id) ?>
|
|
||||||
<?php if($ruoliIndividuo->count() > 0): ?>
|
|
||||||
<?php $__currentLoopData = $ruoliIndividuo; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<span class="badge badge-info mr-1"><?php echo e($ruolo->nome); ?></span>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
-
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($gruppo->pivot->data_adesione ? \Carbon\Carbon::parse($gruppo->pivot->data_adesione)->format('d/m/Y') : '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-xs btn-warning" onclick="editGruppoInline(<?php echo e($gruppo->id); ?>)" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</button>
|
|
||||||
<form action="/individui/<?php echo e($individuo->id); ?>/gruppi/<?php echo e($gruppo->id); ?>" method="POST" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Rimuovere da questo gruppo?')" title="Rimuovi">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="gruppo-edit-<?php echo e($gruppo->id); ?>" style="display:none;">
|
|
||||||
<td colspan="5">
|
|
||||||
<form action="/individui/<?php echo e($individuo->id); ?>/gruppi/<?php echo e($gruppo->id); ?>" method="POST" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" class="form-control form-control-sm" value="<?php echo e($gruppo->nome); ?>" disabled>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="ruolo_ids[]" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $selectedRuoliIds = $individuo->getRuoloIdsForGruppo($gruppo->id) ?>
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>" <?php echo e(in_array($ruolo->id, $selectedRuoliIds) ? 'selected' : ''); ?>><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="date" name="data_adesione" class="form-control form-control-sm" value="<?php echo e($gruppo->pivot->data_adesione); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-check mr-1"></i>Salva</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="cancelEditGruppo(<?php echo e($gruppo->id); ?>)"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-users fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun gruppo associato</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-file mr-2"></i>Documenti</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showDocumentoForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<div id="documento-add-form" style="display:none;" class="p-3 bg-light border-bottom">
|
|
||||||
<form action="/documenti" method="POST" enctype="multipart/form-data" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="_redirect" value="<?php echo e(url()->current()); ?>">
|
|
||||||
<input type="hidden" name="visibilita" value="individuo">
|
|
||||||
<input type="hidden" name="visibilita_target_id" value="<?php echo e($individuo->id); ?>">
|
|
||||||
<input type="hidden" name="visibilita_target_type" value="App\Models\Individuo">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="nome_file" class="form-control form-control-sm" placeholder="Nome documento" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="tipologia" class="form-control form-control-sm" required>
|
|
||||||
<option value="">Tipologia...</option>
|
|
||||||
<option value="documento">Documento</option>
|
|
||||||
<option value="avatar">Avatar</option>
|
|
||||||
<option value="galleria">Galleria</option>
|
|
||||||
<option value="statuto">Statuto</option>
|
|
||||||
<option value="altro">Altro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="file" name="file" class="form-control form-control-sm" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-upload mr-1"></i>Carica</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="hideDocumentoForm()"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php if($individuo->documenti->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th style="width: 120px;">Tipologia</th>
|
|
||||||
<th style="width: 80px;">Dimensione</th>
|
|
||||||
<th style="width: 130px;">Data Upload</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $individuo->documenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" onclick="event.preventDefault(); previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>');">
|
|
||||||
<i class="fas fa-file text-secondary mr-1"></i>
|
|
||||||
<?php echo e($documento->nome_file); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e(ucfirst(str_replace('_', ' ', $documento->tipologia))); ?></td>
|
|
||||||
<td><?php echo e(number_format($documento->dimensione / 1024, 1)); ?> KB</td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>')" title="Anteprima">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="/documenti/<?php echo e($documento->id); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo documento?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-file fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun documento</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3 mb-4">
|
|
||||||
<button type="button" class="btn btn-success btn-lg" id="save-all-btn" onclick="submitMainForm()">
|
|
||||||
<i class="fas fa-save mr-2"></i> Salva Tutte le Modifiche
|
|
||||||
</button>
|
|
||||||
<a href="/individui/<?php echo e($individuo->id); ?>" class="btn btn-secondary btn-lg ml-2">
|
|
||||||
<i class="fas fa-times mr-1"></i> Annulla
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="card mt-3" id="gruppo-add-card" style="display:none; background-color: #fff3cd; border-color: #ffc107;">
|
|
||||||
<div class="card-header bg-warning">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder-plus mr-2"></i>Aggiungi a Gruppo</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<select id="new-gruppo-id" class="form-control form-control-sm">
|
|
||||||
<option value="">Seleziona gruppo...</option>
|
|
||||||
<?php $__currentLoopData = \App\Models\Gruppo::orderBy('nome')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php if(!$individuo->gruppi->contains($g->id)): ?>
|
|
||||||
<option value="<?php echo e($g->id); ?>"><?php echo e($g->full_path); ?></option>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select id="new-gruppo-ruolo" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>"><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<small class="text-muted">Ctrl+click per selezionare più ruoli</small>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="date" id="new-gruppo-data" class="form-control form-control-sm">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="button" class="btn btn-success btn-sm" onclick="submitGruppoForm()">
|
|
||||||
<i class="fas fa-check mr-1"></i> Associa
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-secondary btn-sm" onclick="hideGruppoForm()">
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" role="document" style="max-width: 90vw;">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-file mr-2"></i><span id="previewModalTitle">Anteprima</span></h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body text-center p-0" style="min-height: 400px;">
|
|
||||||
<iframe id="previewFrame" src="" style="width: 100%; height: 70vh; border: none;"></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="previewDownloadBtn" href="#" class="btn btn-primary" download>
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
console.log('All form fields:');
|
|
||||||
var form = document.getElementById('main-form');
|
|
||||||
var fields = form.querySelectorAll('input, textarea, select');
|
|
||||||
fields.forEach(function(f) {
|
|
||||||
console.log(f.name + ' [' + f.type + ']: value="' + f.value.substring(0,30) + '" disabled=' + f.disabled);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Debug note field specifically
|
|
||||||
var noteField = form.querySelector('[name="note"]');
|
|
||||||
console.log('Note field found:', !!noteField);
|
|
||||||
if (noteField) {
|
|
||||||
console.log('Note value:', noteField.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
var saveBtn = document.getElementById('save-btn');
|
|
||||||
if (saveBtn) {
|
|
||||||
saveBtn.addEventListener('click', function() {
|
|
||||||
console.log('=== SAVE CLICKED ===');
|
|
||||||
var note = form.querySelector('[name="note"]');
|
|
||||||
console.log('Note at save time:', note ? note.value : 'NOT FOUND');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
form.addEventListener('submit', function(e) {
|
|
||||||
console.log('=== FORM SUBMIT ===');
|
|
||||||
var note = form.querySelector('[name="note"]');
|
|
||||||
console.log('Note at submit:', note ? note.value : 'NOT FOUND');
|
|
||||||
|
|
||||||
var contattiFields = form.querySelectorAll('[name^="contatti"]');
|
|
||||||
console.log('Contatti fields count:', contattiFields.length);
|
|
||||||
contattiFields.forEach(function(f, i) {
|
|
||||||
console.log('Contatto field ' + i + ':', f.name, '=', f.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
var formData = new FormData(form);
|
|
||||||
console.log('FormData contatti:', formData.getAll('contatti'));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function submitMainForm() {
|
|
||||||
var form = document.getElementById('main-form');
|
|
||||||
console.log('=== DEBUG SUBMIT ===');
|
|
||||||
|
|
||||||
var contattiFields = form.querySelectorAll('[name^="contatti"]');
|
|
||||||
console.log('Contatti fields found:', contattiFields.length);
|
|
||||||
contattiFields.forEach(function(f, i) {
|
|
||||||
console.log('Field ' + i + ': name=' + f.name + ', value=' + f.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
form.action = '/individui/<?php echo e($individuo->id); ?>';
|
|
||||||
var methodInput = form.querySelector('input[name="_method"]');
|
|
||||||
if (!methodInput) {
|
|
||||||
var m = document.createElement('input');
|
|
||||||
m.type = 'hidden';
|
|
||||||
m.name = '_method';
|
|
||||||
m.value = 'PUT';
|
|
||||||
form.appendChild(m);
|
|
||||||
}
|
|
||||||
var csrfInput = form.querySelector('input[name="_token"]');
|
|
||||||
if (!csrfInput) {
|
|
||||||
var c = document.createElement('input');
|
|
||||||
c.type = 'hidden';
|
|
||||||
c.name = '_token';
|
|
||||||
c.value = '<?php echo e(csrf_token()); ?>';
|
|
||||||
form.appendChild(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
var formData = new FormData(form);
|
|
||||||
console.log('FormData contatti keys:');
|
|
||||||
for (var pair of formData.entries()) {
|
|
||||||
if (pair[0].startsWith('contatti')) {
|
|
||||||
console.log(' ' + pair[0] + ' = ' + pair[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
let contattoIndex = <?php echo e($individuo->contatti->count()); ?>;
|
|
||||||
|
|
||||||
function aggiungiRigaContatto() {
|
|
||||||
const tbody = document.getElementById('contatti-tbody');
|
|
||||||
const noMsg = document.getElementById('no-contatti-msg');
|
|
||||||
if (noMsg) noMsg.style.display = 'none';
|
|
||||||
|
|
||||||
const row = document.createElement('tr');
|
|
||||||
row.innerHTML = `
|
|
||||||
<td>
|
|
||||||
<select name="contatti[${contattoIndex}][tipo]" class="form-control">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="telefono">Telefono</option>
|
|
||||||
<option value="cellulare">Cellulare</option>
|
|
||||||
<option value="email">Email</option>
|
|
||||||
<option value="fax">Fax</option>
|
|
||||||
<option value="web">Web</option>
|
|
||||||
<option value="telegram">Telegram</option>
|
|
||||||
<option value="whatsapp">WhatsApp</option>
|
|
||||||
<option value="altro">Altro</option>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td><input type="text" name="contatti[${contattoIndex}][valore]" class="form-control" placeholder="Valore"></td>
|
|
||||||
<td><input type="text" name="contatti[${contattoIndex}][etichetta]" class="form-control" placeholder="Etichetta"></td>
|
|
||||||
<td class="text-center"><input type="checkbox" name="contatti[${contattoIndex}][is_primary]" value="1"></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-success btn-xs" title="Salva" onclick="submitMainForm()">
|
|
||||||
<i class="fas fa-save"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-danger btn-xs" title="Elimina" onclick="this.closest('tr').remove()">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tbody.appendChild(row);
|
|
||||||
contattoIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showGruppoForm() {
|
|
||||||
var card = document.getElementById('gruppo-add-card');
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'block';
|
|
||||||
card.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideGruppoForm() {
|
|
||||||
var card = document.getElementById('gruppo-add-card');
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitGruppoForm() {
|
|
||||||
var gruppoId = document.getElementById('new-gruppo-id').value;
|
|
||||||
var ruoloSelect = document.getElementById('new-gruppo-ruolo');
|
|
||||||
var dataAdesione = document.getElementById('new-gruppo-data').value;
|
|
||||||
|
|
||||||
if (!gruppoId) {
|
|
||||||
alert('Seleziona un gruppo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formData = new URLSearchParams();
|
|
||||||
formData.append('gruppo_id', gruppoId);
|
|
||||||
|
|
||||||
var selectedRuoli = Array.from(ruoloSelect.selectedOptions).map(opt => opt.value).filter(v => v);
|
|
||||||
selectedRuoli.forEach(function(ruoloId) {
|
|
||||||
formData.append('ruolo_ids[]', ruoloId);
|
|
||||||
});
|
|
||||||
|
|
||||||
formData.append('data_adesione', dataAdesione);
|
|
||||||
|
|
||||||
fetch('/individui/<?php echo e($individuo->id); ?>/gruppi', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
},
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => { throw new Error(text); });
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
hideGruppoForm();
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.error || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function editGruppoInline(id) {
|
|
||||||
document.getElementById('gruppo-row-' + id).style.display = 'none';
|
|
||||||
document.getElementById('gruppo-edit-' + id).style.display = 'table-row';
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEditGruppo(id) {
|
|
||||||
document.getElementById('gruppo-row-' + id).style.display = 'table-row';
|
|
||||||
document.getElementById('gruppo-edit-' + id).style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewDocumento(id, mimeType) {
|
|
||||||
var previewUrl = '/documenti/' + id + '/preview';
|
|
||||||
var downloadUrl = '/documenti/' + id + '/download';
|
|
||||||
|
|
||||||
document.getElementById('previewFrame').src = previewUrl;
|
|
||||||
document.getElementById('previewDownloadBtn').href = downloadUrl;
|
|
||||||
document.getElementById('previewModalTitle').textContent = 'Anteprima';
|
|
||||||
|
|
||||||
if (mimeType && mimeType.startsWith('image/')) {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
|
|
||||||
} else {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#previewModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('avatar-input').addEventListener('change', function(e) {
|
|
||||||
var fileName = e.target.files[0]?.name || 'Scegli file...';
|
|
||||||
e.target.nextElementSibling.textContent = fileName;
|
|
||||||
});
|
|
||||||
|
|
||||||
function uploadAvatar() {
|
|
||||||
var input = document.getElementById('avatar-input');
|
|
||||||
if (!input.files[0]) {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Seleziona un\'immagine</span>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append('avatar', input.files[0]);
|
|
||||||
formData.append('_token', '<?php echo e(csrf_token()); ?>');
|
|
||||||
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-info"><i class="fas fa-spinner fa-spin"></i> Caricamento...</span>';
|
|
||||||
|
|
||||||
fetch('/individui/<?php echo e($individuo->id); ?>/avatar', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar caricato!</span>';
|
|
||||||
setTimeout(function() { window.location.reload(); }, 500);
|
|
||||||
} else {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteAvatar() {
|
|
||||||
if (!confirm('Rimuovere l\'avatar?')) return;
|
|
||||||
|
|
||||||
fetch('/individui/<?php echo e($individuo->id); ?>/avatar', {
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.message || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/individui/edit.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
<?php
|
|
||||||
$children = $gruppo->children()->with(['diocesi', 'individui'])->orderBy('nome')->get();
|
|
||||||
$hasChildren = $children->count() > 0;
|
|
||||||
$canWriteGruppi = Auth::user()->canManage('gruppi');
|
|
||||||
$responsabili = $gruppo->getResponsabili();
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class="tree-item" style="margin-left: <?php echo e($gruppo->depth ?? 0); ?>px;">
|
|
||||||
<div class="tree-label">
|
|
||||||
<?php if($hasChildren): ?>
|
|
||||||
<span class="tree-toggle" onclick="toggleItem(<?php echo e($gruppo->id); ?>)">
|
|
||||||
<i id="icon-<?php echo e($gruppo->id); ?>" class="fas fa-chevron-right text-muted"></i>
|
|
||||||
</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span style="width: 22px; display: inline-block;"></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
<i class="fas fa-<?php echo e($hasChildren ? 'folder' : 'folder-open'); ?> text-<?php echo e($gruppo->depth == 0 ? 'warning' : 'secondary'); ?> mr-1"></i>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $gruppo->id)); ?>" class="<?php echo e(($gruppo->depth ?? 0) == 0 ? 'font-weight-bold' : ''); ?>">
|
|
||||||
<?php echo e($gruppo->nome); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<span class="badge badge-<?php echo e(($gruppo->depth ?? 0) == 0 ? 'primary' : 'secondary'); ?> badge-level"><?php echo e($gruppo->depth ?? 0); ?></span>
|
|
||||||
<small class="text-muted ml-2">
|
|
||||||
<?php echo e($gruppo->diocesi?->nome ?? ''); ?>
|
|
||||||
|
|
||||||
<?php if($responsabili->count() > 0): ?>
|
|
||||||
· <i class="fas fa-user text-info"></i> <?php echo e($responsabili->pluck('cognome')->implode(', ')); ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
</small>
|
|
||||||
<span class="ml-auto">
|
|
||||||
<?php if($gruppo->individui_count > 0): ?>
|
|
||||||
<span class="badge badge-info"><?php echo e($gruppo->individui_count); ?> membri</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($hasChildren): ?>
|
|
||||||
<span class="badge badge-warning"><?php echo e($children->count()); ?> figli</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</span>
|
|
||||||
<span class="ml-2">
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $gruppo->id)); ?>" class="btn btn-xs btn-info" title="Visualizza">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(url('/gruppi/' . $gruppo->id . '/edit')); ?>" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php
|
|
||||||
$isParent = $hasChildren;
|
|
||||||
$isSuperAdmin = Auth::user()->isSuperAdmin();
|
|
||||||
$canDelete = !$isParent || $isSuperAdmin;
|
|
||||||
?>
|
|
||||||
<?php if($canDelete): ?>
|
|
||||||
<form action="<?php echo e(url('/gruppi/' . $gruppo->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Confermi l\'eliminazione? Verranno eliminati anche tutti i sottogruppi.')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php else: ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger disabled" title="Solo il superamministratore può eliminare gruppi con sottogruppi">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if($hasChildren): ?>
|
|
||||||
<div id="group-<?php echo e($gruppo->id); ?>" class="tree-children" style="display: none;">
|
|
||||||
<?php $__currentLoopData = $children; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php echo $__env->make('gruppi.partials.tree-item', ['gruppo' => $child], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?><?php /**PATH /var/www/html/glastree/resources/views/gruppi/partials/tree-item.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="it">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Stampa Report - <?php echo e($data['title'] ?? 'Report'); ?></title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #333;
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
background: #2c3e50;
|
||||||
|
color: #fff;
|
||||||
|
padding: 15px 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-title {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar label {
|
||||||
|
font-size: 13px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar select {
|
||||||
|
padding: 6px 12px;
|
||||||
|
border: 1px solid #4a5568;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #4a5568;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #63b3ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print {
|
||||||
|
background: #28a745;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-print:hover {
|
||||||
|
background: #218838;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close {
|
||||||
|
background: #dc3545;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-close:hover {
|
||||||
|
background: #c82333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #6c757d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #5a6268;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container {
|
||||||
|
max-width: 210mm;
|
||||||
|
margin: 20px auto;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.portrait {
|
||||||
|
width: 210mm;
|
||||||
|
min-height: 297mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.landscape {
|
||||||
|
width: 297mm;
|
||||||
|
min-height: 210mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
border-bottom: 2px solid #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header h1 {
|
||||||
|
font-size: 24px;
|
||||||
|
color: #2c3e50;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-header .subtitle {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #7f8c8d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-summary {
|
||||||
|
background: #e8f4f8;
|
||||||
|
padding: 12px 15px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-left: 4px solid #17a2b8;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th,
|
||||||
|
.report-table td {
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table th {
|
||||||
|
background: #f8f9fa;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #2c3e50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr:nth-child(even) {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr:hover {
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data {
|
||||||
|
text-align: center;
|
||||||
|
color: #999;
|
||||||
|
font-style: italic;
|
||||||
|
padding: 40px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-data i {
|
||||||
|
font-size: 48px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-footer {
|
||||||
|
margin-top: 30px;
|
||||||
|
padding-top: 15px;
|
||||||
|
border-top: 1px solid #ddd;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 10px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-count {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-top: 10px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page {
|
||||||
|
margin: 15mm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
@page portrait {
|
||||||
|
size: portrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
@page landscape {
|
||||||
|
size: landscape;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #fff;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container {
|
||||||
|
margin: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
padding: 0;
|
||||||
|
max-width: none;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.portrait {
|
||||||
|
width: auto;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-container.landscape {
|
||||||
|
width: auto;
|
||||||
|
min-height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table {
|
||||||
|
page-break-inside: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tr {
|
||||||
|
page-break-inside: avoid;
|
||||||
|
page-break-after: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table thead {
|
||||||
|
display: table-header-group;
|
||||||
|
}
|
||||||
|
|
||||||
|
.report-table tfoot {
|
||||||
|
display: table-footer-group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="toolbar" id="toolbar">
|
||||||
|
<div class="toolbar-left">
|
||||||
|
<span class="toolbar-title">Anteprima di Stampa</span>
|
||||||
|
<div class="toolbar-group">
|
||||||
|
<label for="orientation">Orientamento:</label>
|
||||||
|
<select id="orientation">
|
||||||
|
<option value="portrait">Verticale (Portrait)</option>
|
||||||
|
<option value="landscape">Orizzontale (Landscape)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="toolbar-group">
|
||||||
|
<label for="font-size">Dimensione font:</label>
|
||||||
|
<select id="font-size">
|
||||||
|
<option value="10">Piccolo (10px)</option>
|
||||||
|
<option value="11">Normale (11px)</option>
|
||||||
|
<option value="12" selected>Medio (12px)</option>
|
||||||
|
<option value="13">Grande (13px)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button class="btn btn-secondary" onclick="window.opener ? window.close() : window.location.href='<?php echo e(route('report.index')); ?>'">
|
||||||
|
Indietro
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-print" onclick="printReport()">
|
||||||
|
Stampa
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="preview-container portrait" id="preview-container">
|
||||||
|
<div class="report-header">
|
||||||
|
<h1><?php echo e($data['title'] ?? 'Report'); ?></h1>
|
||||||
|
<div class="subtitle">Generato il <?php echo e(now()->format('d/m/Y H:i')); ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if(!empty($data['summary'])): ?>
|
||||||
|
<div class="report-summary">
|
||||||
|
<strong><?php echo e($data['summary']); ?></strong>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if(!empty($data['headers']) && !empty($data['rows'])): ?>
|
||||||
|
<table class="report-table" id="report-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<?php $__currentLoopData = $data['headers']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $header): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<th><?php echo e($header); ?></th>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php $__currentLoopData = $data['rows']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<tr>
|
||||||
|
<?php $__currentLoopData = $row; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cell): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<td><?php echo e(is_array($cell) ? json_encode($cell) : $cell); ?></td>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="row-count">Totale righe: <?php echo e(count($data['rows'])); ?></div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="no-data">
|
||||||
|
Nessun dato disponibile per questo report.
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="report-footer">
|
||||||
|
<p>Report generato automaticamente - Glastree</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const orientationSelect = document.getElementById('orientation');
|
||||||
|
const fontSizeSelect = document.getElementById('font-size');
|
||||||
|
const previewContainer = document.getElementById('preview-container');
|
||||||
|
const reportTable = document.getElementById('report-table');
|
||||||
|
|
||||||
|
function printReport() {
|
||||||
|
window.print();
|
||||||
|
}
|
||||||
|
|
||||||
|
orientationSelect.addEventListener('change', function() {
|
||||||
|
previewContainer.classList.remove('portrait', 'landscape');
|
||||||
|
previewContainer.classList.add(this.value);
|
||||||
|
|
||||||
|
if (this.value === 'landscape') {
|
||||||
|
document.body.classList.add('landscape-mode');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('landscape-mode');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fontSizeSelect.addEventListener('change', function() {
|
||||||
|
const size = this.value;
|
||||||
|
document.body.style.fontSize = size + 'px';
|
||||||
|
if (reportTable) {
|
||||||
|
reportTable.style.fontSize = (parseInt(size) - 1) + 'px';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const savedOrientation = localStorage.getItem('report-print-orientation');
|
||||||
|
const savedFontSize = localStorage.getItem('report-print-font-size');
|
||||||
|
|
||||||
|
if (savedOrientation) {
|
||||||
|
orientationSelect.value = savedOrientation;
|
||||||
|
orientationSelect.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savedFontSize) {
|
||||||
|
fontSizeSelect.value = savedFontSize;
|
||||||
|
fontSizeSelect.dispatchEvent(new Event('change'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
orientationSelect.addEventListener('change', function() {
|
||||||
|
localStorage.setItem('report-print-orientation', this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
fontSizeSelect.addEventListener('change', function() {
|
||||||
|
localStorage.setItem('report-print-font-size', this.value);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php /**PATH /var/www/html/glastree/resources/views/report/print-preview.blade.php ENDPATH**/ ?>
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Modifica Documento'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Modifica Documento'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<form action="/documenti/<?php echo e($documento->id); ?>" method="POST">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-file mr-2"></i>Dati Documento</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome_file" class="form-control" value="<?php echo e(old('nome_file', $documento->nome_file)); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tipologia *</label>
|
|
||||||
<select name="tipologia" class="form-control" required>
|
|
||||||
<?php $__currentLoopData = $tipologie; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tip): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($tip->nome); ?>" <?php echo e($documento->tipologia === $tip->nome ? 'selected' : ''); ?>><?php echo e($tip->descrizione ?? ucfirst($tip->nome)); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Contesto *</label>
|
|
||||||
<select name="contesto_tipo" id="contesto_tipo" class="form-control" onchange="aggiornaTarget()">
|
|
||||||
<option value="">Seleziona tipo...</option>
|
|
||||||
<option value="individuo" <?php echo e($documento->visibilita === 'individuo' ? 'selected' : ''); ?>>Individuo</option>
|
|
||||||
<option value="gruppo" <?php echo e($documento->visibilita === 'gruppo' ? 'selected' : ''); ?>>Gruppo</option>
|
|
||||||
<option value="evento" <?php echo e($documento->visibilita === 'evento' ? 'selected' : ''); ?>>Evento</option>
|
|
||||||
<option value="mailing" <?php echo e($documento->visibilita === 'mailing' ? 'selected' : ''); ?>>Mailing List</option>
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="visibilita" id="visibilita" value="<?php echo e($documento->visibilita); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="target_container" style="<?php echo e(in_array($documento->visibilita, ['individuo', 'gruppo', 'evento', 'mailing']) ? '' : 'display:none;'); ?>">
|
|
||||||
<label>Riferimento *</label>
|
|
||||||
<select name="visibilita_target_id" id="visibilita_target_id" class="form-control">
|
|
||||||
<?php if($documento->visibilita === 'individuo'): ?>
|
|
||||||
<?php $__currentLoopData = $individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ind): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ind->id); ?>" <?php echo e($documento->visibilita_target_id == $ind->id ? 'selected' : ''); ?>><?php echo e($ind->cognome); ?> <?php echo e($ind->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php elseif($documento->visibilita === 'gruppo'): ?>
|
|
||||||
<?php $__currentLoopData = $gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $grp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($grp->id); ?>" <?php echo e($documento->visibilita_target_id == $grp->id ? 'selected' : ''); ?>><?php echo e($grp->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php elseif($documento->visibilita === 'evento'): ?>
|
|
||||||
<?php $__currentLoopData = $eventi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $evt): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($evt->id); ?>" <?php echo e($documento->visibilita_target_id == $evt->id ? 'selected' : ''); ?>><?php echo e($evt->nome_evento); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php elseif($documento->visibilita === 'mailing'): ?>
|
|
||||||
<?php $__currentLoopData = $mailingLists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ml): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ml->id); ?>" <?php echo e($documento->visibilita_target_id == $ml->id ? 'selected' : ''); ?>><?php echo e($ml->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="visibilita_target_type" id="visibilita_target_type" value="">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Note</label>
|
|
||||||
<textarea name="note" class="form-control" rows="3"><?php echo e(old('note', $documento->note)); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-info-circle mr-2"></i>Informazioni</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-sm table-borderless">
|
|
||||||
<tr>
|
|
||||||
<td style="width: 100px;"><strong>File:</strong></td>
|
|
||||||
<td><?php echo e($documento->file_path); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Tipo MIME:</strong></td>
|
|
||||||
<td><?php echo e($documento->mime_type ?? '-'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Dimensione:</strong></td>
|
|
||||||
<td><?php echo e($documento->dimensione ? number_format($documento->dimensione / 1024, 1) . ' KB' : '-'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Creato:</strong></td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y H:i')); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php if($documento->user): ?>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Utente:</strong></td>
|
|
||||||
<td><?php echo e($documento->user->name); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</table>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<hr>
|
|
||||||
<a href="/documenti/<?php echo e($documento->id); ?>/download" class="btn btn-primary btn-block">
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
<button type="submit" class="btn btn-success">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Modifiche
|
|
||||||
</button>
|
|
||||||
<a href="/documenti" class="btn btn-secondary">
|
|
||||||
<i class="fas fa-arrow-left mr-1"></i> Torna all'elenco
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function aggiornaTarget() {
|
|
||||||
var tipo = document.getElementById('contesto_tipo').value;
|
|
||||||
var container = document.getElementById('target_container');
|
|
||||||
var targetSelect = document.getElementById('visibilita_target_id');
|
|
||||||
var visibilita = document.getElementById('visibilita');
|
|
||||||
var targetType = document.getElementById('visibilita_target_type');
|
|
||||||
|
|
||||||
visibilita.value = tipo;
|
|
||||||
targetType.value = '';
|
|
||||||
|
|
||||||
if (tipo) {
|
|
||||||
container.style.display = 'block';
|
|
||||||
targetSelect.innerHTML = '<option value="">Caricamento...</option>';
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open('GET', '/documenti/options?tipo=' + tipo, true);
|
|
||||||
xhr.onload = function() {
|
|
||||||
if (xhr.status === 200) {
|
|
||||||
targetSelect.innerHTML = '<option value="">Seleziona...</option>' + xhr.responseText;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
xhr.send();
|
|
||||||
} else {
|
|
||||||
container.style.display = 'none';
|
|
||||||
targetSelect.innerHTML = '<option value="">Seleziona prima il tipo...</option>';
|
|
||||||
targetSelect.value = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/documenti/edit.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -159,6 +159,16 @@
|
|||||||
<option value="12" <?php echo e(old('mese_annuale', $evento->mese_annuale) == '12' ? 'selected' : ''); ?>>Dicembre</option>
|
<option value="12" <?php echo e(old('mese_annuale', $evento->mese_annuale) == '12' ? 'selected' : ''); ?>>Dicembre</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Giorno del Mese</label>
|
||||||
|
<select name="giorno_mese" class="form-control">
|
||||||
|
<option value="">Seleziona giorno...</option>
|
||||||
|
<?php for($d = 1; $d <= 31; $d++): ?>
|
||||||
|
<option value="<?php echo e($d); ?>" <?php echo e(old('giorno_mese', $evento->giorno_mese) == $d ? 'selected' : ''); ?>><?php echo e($d); ?></option>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</select>
|
||||||
|
<small class="form-text text-muted">Se il giorno non esiste nel mese selezionato, verrà usato l'ultimo giorno disponibile</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
@@ -1,350 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Email - ' . ucfirst($folder)); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Email'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$currentFolder = $folders->firstWhere('type', $folder);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-envelope mr-2"></i>Email</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<div class="btn-group mr-2">
|
|
||||||
<?php $__currentLoopData = $folders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $f): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<a href="<?php echo e(route('email.index', $f->type)); ?>"
|
|
||||||
class="btn btn-xs <?php echo e($folder === $f->type ? 'btn-primary' : 'btn-default'); ?>">
|
|
||||||
<i class="fas <?php echo e($f->icon); ?>"></i>
|
|
||||||
<?php echo e($f->name); ?>
|
|
||||||
|
|
||||||
<?php if($f->type === 'inbox' && $messages->where('is_read', false)->count() > 0): ?>
|
|
||||||
<span class="badge badge-light"><?php echo e($messages->where('is_read', false)->count()); ?></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</a>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
<a href="<?php echo e(route('email.compose')); ?>" class="btn btn-success btn-xs">
|
|
||||||
<i class="fas fa-plus"></i> Nuova Email
|
|
||||||
</a>
|
|
||||||
<button class="btn btn-primary btn-xs" onclick="syncEmails()" id="syncBtn">
|
|
||||||
<i class="fas fa-sync"></i> Ricevi/Invia
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<div class="card-header pb-0">
|
|
||||||
<div class="row align-items-center">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-inline">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="selectAll" onchange="toggleAll(this)">
|
|
||||||
<label class="custom-control-label" for="selectAll">Seleziona tutto</label>
|
|
||||||
</div>
|
|
||||||
<span class="ml-3 text-muted" id="selectedCount">0 selezionati</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="input-group input-group-sm float-right" style="width: 220px;">
|
|
||||||
<select class="form-control" id="bulkAction">
|
|
||||||
<option value="">Azioni di massa...</option>
|
|
||||||
<?php if($folder !== 'trash'): ?>
|
|
||||||
<option value="mark_read">Marca come letto</option>
|
|
||||||
<option value="mark_unread">Marca come non letto</option>
|
|
||||||
<option value="star">Aggiungi a preferiti</option>
|
|
||||||
<option value="unstar">Rimuovi da preferiti</option>
|
|
||||||
<option value="move_trash">Sposta nel cestino</option>
|
|
||||||
<?php else: ?>
|
|
||||||
<option value="empty_trash">Svuota cestino</option>
|
|
||||||
<?php endif; ?>
|
|
||||||
</select>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-secondary" type="button" onclick="executeBulkAction()">Applica</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-hover table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="width: 30px;"></th>
|
|
||||||
<th style="width: 30px;"></th>
|
|
||||||
<th style="width: 150px;">
|
|
||||||
<?php $sort = request('sort'); $dir = request('direction'); ?>
|
|
||||||
<?php if($folder === 'sent' || $folder === 'inviate'): ?>
|
|
||||||
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'to_email', 'direction' => $sort === 'to_email' && $dir === 'asc' ? 'desc' : 'asc'])); ?>" class="text-dark text-decoration-none">
|
|
||||||
Destinatario <?php echo $sort === 'to_email' ? ($dir === 'asc' ? '▲' : '▼') : ''; ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php else: ?>
|
|
||||||
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'from_email', 'direction' => $sort === 'from_email' && $dir === 'asc' ? 'desc' : 'asc'])); ?>" class="text-dark text-decoration-none">
|
|
||||||
Mittente <?php echo $sort === 'from_email' ? ($dir === 'asc' ? '▲' : '▼') : ''; ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</th>
|
|
||||||
<th>
|
|
||||||
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'subject', 'direction' => $sort === 'subject' && $dir === 'asc' ? 'desc' : 'asc'])); ?>" class="text-dark text-decoration-none">
|
|
||||||
Oggetto <?php echo $sort === 'subject' ? ($dir === 'asc' ? '▲' : '▼') : ''; ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
<th style="width: 120px;">
|
|
||||||
<a href="<?php echo e(request()->fullUrlWithQuery(['sort' => 'received_at', 'direction' => $sort === 'received_at' && $dir === 'asc' ? 'desc' : 'asc'])); ?>" class="text-dark text-decoration-none">
|
|
||||||
Data <?php echo $sort === 'received_at' ? ($dir === 'asc' ? '▲' : '▼') : ''; ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__empty_1 = true; $__currentLoopData = $messages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $message): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
||||||
<tr class="<?php echo e($message->is_read ? '' : 'font-weight-bold'); ?>">
|
|
||||||
<td style="width: 30px;" onclick="event.stopPropagation()">
|
|
||||||
<input type="checkbox" class="email-checkbox" value="<?php echo e($message->id); ?>" onchange="updateCount()">
|
|
||||||
</td>
|
|
||||||
<td style="width: 30px;" onclick="event.stopPropagation(); window.location='<?php echo e(route('email.show', [$folder, $message->id])); ?>'">
|
|
||||||
<?php if($message->is_starred): ?>
|
|
||||||
<i class="fas fa-star text-warning"></i>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td onclick="window.location='<?php echo e(route('email.show', [$folder, $message->id])); ?>'">
|
|
||||||
<?php echo e($message->is_sent ? 'A: ' . $message->to_email : ($message->from_name ?: $message->from_email)); ?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td onclick="window.location='<?php echo e(route('email.show', [$folder, $message->id])); ?>'">
|
|
||||||
<?php echo e($message->subject ?? '(senza oggetto)'); ?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if($message->received_at): ?>
|
|
||||||
<?php echo e($message->received_at->format('d/m/Y')); ?>
|
|
||||||
|
|
||||||
<?php elseif($message->sent_at): ?>
|
|
||||||
<?php echo e($message->sent_at->format('d/m/Y')); ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5" class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-inbox fa-2x mb-2"></i>
|
|
||||||
<p>Nessuna email</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-footer">
|
|
||||||
<?php echo e($messages->withQueryString()->links('vendor.pagination.simple-bootstrap-4')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startPush('styles'); ?>
|
|
||||||
<style>
|
|
||||||
/* Bootstrap 4 Pagination override */
|
|
||||||
.pagination {
|
|
||||||
display: flex !important;
|
|
||||||
padding-left: 0;
|
|
||||||
list-style: none;
|
|
||||||
border-radius: 0.25rem;
|
|
||||||
margin: 0;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-item {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-link {
|
|
||||||
position: relative;
|
|
||||||
display: block;
|
|
||||||
padding: 0.5rem 0.75rem;
|
|
||||||
margin-left: -1px;
|
|
||||||
line-height: 1.25;
|
|
||||||
color: #007bff;
|
|
||||||
background-color: #fff;
|
|
||||||
border: 1px solid #dee2e6;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-item.active .page-link {
|
|
||||||
z-index: 3;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #007bff;
|
|
||||||
border-color: #007bff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-item.disabled .page-link {
|
|
||||||
color: #6c757d;
|
|
||||||
pointer-events: none;
|
|
||||||
background-color: #fff;
|
|
||||||
border-color: #dee2e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-link:hover {
|
|
||||||
color: #0056b3;
|
|
||||||
background-color: #e9ecef;
|
|
||||||
border-color: #dee2e6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Icons as text characters */
|
|
||||||
.pagination .page-link::before,
|
|
||||||
.pagination .page-link::after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<?php $__env->stopPush(); ?>
|
|
||||||
|
|
||||||
<?php if($syncInterval > 0 && $folder === 'inbox'): ?>
|
|
||||||
<?php $__env->startPush('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
let syncInterval = <?php echo e($syncInterval * 60 * 1000); ?>;
|
|
||||||
let syncTimeout;
|
|
||||||
|
|
||||||
function autoSync() {
|
|
||||||
fetch('<?php echo e(url('email/sync/quick')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
}).then(() => {
|
|
||||||
console.log('Auto sync completed');
|
|
||||||
}).catch(() => {
|
|
||||||
console.log('Auto sync failed');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function startAutoSync() {
|
|
||||||
if (syncInterval > 0) {
|
|
||||||
syncTimeout = setInterval(autoSync, syncInterval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function stopAutoSync() {
|
|
||||||
if (syncTimeout) {
|
|
||||||
clearInterval(syncTimeout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
startAutoSync();
|
|
||||||
|
|
||||||
document.addEventListener('visibilitychange', function() {
|
|
||||||
if (document.hidden) {
|
|
||||||
stopAutoSync();
|
|
||||||
} else {
|
|
||||||
startAutoSync();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopPush(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function toggleAll(checkbox) {
|
|
||||||
const checkboxes = document.querySelectorAll('.email-checkbox');
|
|
||||||
checkboxes.forEach(function(cb) {
|
|
||||||
cb.checked = checkbox.checked;
|
|
||||||
});
|
|
||||||
updateCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCount() {
|
|
||||||
const checkboxes = document.querySelectorAll('.email-checkbox:checked');
|
|
||||||
document.getElementById('selectedCount').textContent = checkboxes.length + ' selezionati';
|
|
||||||
}
|
|
||||||
|
|
||||||
function executeBulkAction() {
|
|
||||||
const select = document.getElementById('bulkAction');
|
|
||||||
const action = select.value;
|
|
||||||
if (!action) {
|
|
||||||
alert('Seleziona un\'azione');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === 'empty_trash') {
|
|
||||||
if (!confirm('Sei sicuro di voler svuotare il cestino? Questa azione non è reversibile.')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkboxes = document.querySelectorAll('.email-checkbox:checked');
|
|
||||||
if (action !== 'empty_trash' && checkboxes.length === 0) {
|
|
||||||
alert('Seleziona almeno una email');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let ids = [];
|
|
||||||
if (action !== 'empty_trash') {
|
|
||||||
ids = Array.from(checkboxes).map(function(cb) {
|
|
||||||
return cb.value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch('<?php echo e(route('email.bulk')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ ids: ids, action: action })
|
|
||||||
}).then(function(response) {
|
|
||||||
return response.json();
|
|
||||||
}).then(function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
// Reset checkboxes before reload to avoid ghost selection
|
|
||||||
document.querySelectorAll('.email-checkbox').forEach(function(cb) {
|
|
||||||
cb.checked = false;
|
|
||||||
});
|
|
||||||
document.getElementById('selectAll').checked = false;
|
|
||||||
updateCount();
|
|
||||||
window.location.href = window.location.href;
|
|
||||||
} else {
|
|
||||||
alert(data.message || 'Errore');
|
|
||||||
}
|
|
||||||
}).catch(function() {
|
|
||||||
alert('Errore');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function syncEmails() {
|
|
||||||
const btn = document.getElementById('syncBtn');
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Sincronizzazione...';
|
|
||||||
|
|
||||||
fetch('<?php echo e(url('email/sync/quick')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
}).then(function(response) {
|
|
||||||
return response.json();
|
|
||||||
}).then(function(data) {
|
|
||||||
if (data.success) {
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.message || 'Errore durante la sincronizzazione');
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.innerHTML = '<i class="fas fa-sync"></i> Ricevi/Invia';
|
|
||||||
}
|
|
||||||
}).catch(function(error) {
|
|
||||||
alert('Errore di connessione');
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.innerHTML = '<i class="fas fa-sync"></i> Ricevi/Invia';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/email/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,438 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Gruppi'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Elenco Gruppi'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$canWriteGruppi = Auth::user()->canManage('gruppi');
|
|
||||||
$canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
|
||||||
$columnLabels = [
|
|
||||||
'nome' => 'Nome',
|
|
||||||
'descrizione' => 'Descrizione',
|
|
||||||
'diocesi' => 'Diocesi',
|
|
||||||
'livello' => 'Livello',
|
|
||||||
'padre' => 'Gruppo Padre',
|
|
||||||
'membri' => 'Membri',
|
|
||||||
'responsabili' => 'Responsabili',
|
|
||||||
'indirizzo' => 'Indirizzo',
|
|
||||||
'citta' => 'Città',
|
|
||||||
'telefono' => 'Telefono',
|
|
||||||
'email' => 'Email',
|
|
||||||
];
|
|
||||||
$vistaDefaultJson = $vista ? $vista->toJson() : 'null';
|
|
||||||
$allColumnsJson = json_encode($allColumns);
|
|
||||||
$visibleColumnsJson = json_encode($visibleColumns);
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
|
|
||||||
<?php if(session('success')): ?>
|
|
||||||
<div class="alert alert-success alert-dismissible">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<?php echo e(session('success')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if(session('error')): ?>
|
|
||||||
<div class="alert alert-danger alert-dismissible">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<?php echo e(session('error')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-sitemap mr-2"></i>Elenco Gruppi</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<div class="btn-group mr-2">
|
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary <?php echo e($viewMode === 'table' ? 'active' : ''); ?>" onclick="switchView('table')" id="btn-table-view">
|
|
||||||
<i class="fas fa-table mr-1"></i> Tabella
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary <?php echo e($viewMode === 'tree' ? 'active' : ''); ?>" onclick="switchView('tree')" id="btn-tree-view">
|
|
||||||
<i class="fas fa-sitemap mr-1"></i> Albero
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm mr-1" onclick="showSaveVistaModal()">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Vista
|
|
||||||
</button>
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(route('gruppi.create')); ?>" class="btn btn-success btn-sm">
|
|
||||||
<i class="fas fa-plus"></i> Nuovo Gruppo
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if($viewMode === 'table'): ?>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0" id="gruppi-table">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<?php if(in_array('nome', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" onclick="sortTable('nome')" style="cursor:pointer;">Nome <i class="fas fa-sort float-right text-muted"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('descrizione', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" onclick="sortTable('descrizione')" style="cursor:pointer;">Descrizione <i class="fas fa-sort float-right text-muted"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('diocesi', $visibleColumns)): ?>
|
|
||||||
<th>Diocesi</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('livello', $visibleColumns)): ?>
|
|
||||||
<th style="width: 80px;">Livello</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('padre', $visibleColumns)): ?>
|
|
||||||
<th>Gruppo Padre</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('membri', $visibleColumns)): ?>
|
|
||||||
<th style="width: 100px;">Membri</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('responsabili', $visibleColumns)): ?>
|
|
||||||
<th>Responsabili</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('indirizzo', $visibleColumns)): ?>
|
|
||||||
<th>Indirizzo</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('citta', $visibleColumns)): ?>
|
|
||||||
<th>Città</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('telefono', $visibleColumns)): ?>
|
|
||||||
<th>Telefono</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('email', $visibleColumns)): ?>
|
|
||||||
<th>Email</th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<th style="width: 120px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="table-body">
|
|
||||||
<?php $__currentLoopData = $gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gruppo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr data-id="<?php echo e($gruppo->id); ?>">
|
|
||||||
<?php if(in_array('nome', $visibleColumns)): ?>
|
|
||||||
<td>
|
|
||||||
<span style="padding-left: <?php echo e(($gruppo->depth ?? 0) * 20); ?>px;">
|
|
||||||
<i class="fas fa-<?php echo e($gruppo->children->count() > 0 ? 'folder' : 'folder-open'); ?> text-<?php echo e(($gruppo->depth ?? 0) == 0 ? 'warning' : 'secondary'); ?> mr-1"></i>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $gruppo->id)); ?>"><?php echo e($gruppo->nome); ?></a>
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('descrizione', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e(Str::limit($gruppo->descrizione, 50) ?: '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('diocesi', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($gruppo->diocesi?->nome ?? '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('livello', $visibleColumns)): ?>
|
|
||||||
<td><span class="badge badge-<?php echo e(($gruppo->depth ?? 0) == 0 ? 'primary' : 'secondary'); ?>"><?php echo e($gruppo->depth ?? 0); ?></span></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('padre', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($gruppo->parent?->nome ?? '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('membri', $visibleColumns)): ?>
|
|
||||||
<td><span class="badge badge-info"><?php echo e($gruppo->individui->count()); ?></span></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('responsabili', $visibleColumns)): ?>
|
|
||||||
<td>
|
|
||||||
<?php $resp = $gruppo->getResponsabili() ?>
|
|
||||||
<?php if($resp->count() > 0): ?>
|
|
||||||
<?php echo e($resp->pluck('cognome')->implode(', ')); ?>
|
|
||||||
|
|
||||||
<?php else: ?>
|
|
||||||
-
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('indirizzo', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($gruppo->indirizzo_incontro ?: '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('citta', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($gruppo->città_incontro ?: '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('telefono', $visibleColumns)): ?>
|
|
||||||
<td>-</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('email', $visibleColumns)): ?>
|
|
||||||
<td>-</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $gruppo->id)); ?>" class="btn btn-xs btn-info" title="Visualizza">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(url('/gruppi/' . $gruppo->id . '/edit')); ?>" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canDeleteGruppi): ?>
|
|
||||||
<form action="<?php echo e(url('/gruppi/' . $gruppo->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Confermi l\'eliminazione?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<div class="tree-view" style="padding: 15px;">
|
|
||||||
<?php $rootGruppi = $gruppi->filter(fn($g) => $g->parent_id === null) ?>
|
|
||||||
<?php $__empty_1 = true; $__currentLoopData = $rootGruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gruppo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
||||||
<?php echo $__env->make('gruppi.partials.tree-item', ['gruppo' => $gruppo, 'isRoot' => true], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-folder-open fa-2x mb-2"></i>
|
|
||||||
<p>Nessun gruppo presente.
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(route('gruppi.create')); ?>">Crea il primo gruppo</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="saveVistaModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-save mr-2"></i>Salva Vista</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome Vista *</label>
|
|
||||||
<input type="text" id="vista-nome" class="form-control" placeholder="Es. Elenco gruppi attivi">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Colonne visibili</label>
|
|
||||||
<div class="row" id="colonne-checkboxes">
|
|
||||||
<?php $__currentLoopData = $allColumns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $col): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<div class="col-md-4 mb-2">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input col-checkbox" id="col-<?php echo e($col); ?>" value="<?php echo e($col); ?>" <?php echo e(in_array($col, $visibleColumns) ? 'checked' : ''); ?>>
|
|
||||||
<label class="custom-control-label" for="col-<?php echo e($col); ?>"><?php echo e($columnLabels[$col] ?? $col); ?></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="vista-default">
|
|
||||||
<label class="custom-control-label" for="vista-default">Imposta come vista predefinita</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-primary" onclick="saveVista()">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="vistaListModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-bookmark mr-2"></i>Viste Salvate</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<?php
|
|
||||||
$visteSalvate = \App\Models\VistaReport::where('user_id', Auth::id())
|
|
||||||
->where('tipo', 'gruppi')
|
|
||||||
->orderBy('is_default', 'desc')
|
|
||||||
->orderBy('nome')
|
|
||||||
->get();
|
|
||||||
?>
|
|
||||||
<?php if($visteSalvate->count() > 0): ?>
|
|
||||||
<div class="list-group">
|
|
||||||
<?php $__currentLoopData = $visteSalvate; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $v): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<div class="list-group-item d-flex justify-content-between align-items-center">
|
|
||||||
<div>
|
|
||||||
<a href="?vista_id=<?php echo e($v->id); ?>"><?php echo e($v->nome); ?></a>
|
|
||||||
<?php if($v->is_default): ?>
|
|
||||||
<span class="badge badge-success ml-1">Predefinita</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<form action="<?php echo e(route('gruppi.delete-vista', $v->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questa vista?')">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
<?php else: ?>
|
|
||||||
<p class="text-muted text-center">Nessuna vista salvata</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function switchView(mode) {
|
|
||||||
window.location.href = '?view=' + mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleItem(id) {
|
|
||||||
const el = document.getElementById('group-' + id);
|
|
||||||
const icon = document.getElementById('icon-' + id);
|
|
||||||
if (el.style.display === 'none') {
|
|
||||||
el.style.display = 'block';
|
|
||||||
icon.classList.remove('fa-chevron-right');
|
|
||||||
icon.classList.add('fa-chevron-down');
|
|
||||||
} else {
|
|
||||||
el.style.display = 'none';
|
|
||||||
icon.classList.remove('fa-chevron-down');
|
|
||||||
icon.classList.add('fa-chevron-right');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleAllGroups() {
|
|
||||||
const collapsed = document.querySelectorAll('.tree-children[style*="display: none"]').length > 0;
|
|
||||||
document.querySelectorAll('.tree-children').forEach(el => {
|
|
||||||
el.style.display = collapsed ? 'block' : 'none';
|
|
||||||
});
|
|
||||||
document.querySelectorAll('.tree-toggle i').forEach(icon => {
|
|
||||||
if (collapsed) {
|
|
||||||
icon.classList.remove('fa-chevron-right');
|
|
||||||
icon.classList.add('fa-chevron-down');
|
|
||||||
} else {
|
|
||||||
icon.classList.remove('fa-chevron-down');
|
|
||||||
icon.classList.add('fa-chevron-right');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let sortDirection = {};
|
|
||||||
|
|
||||||
function sortTable(column) {
|
|
||||||
const tbody = document.getElementById('table-body');
|
|
||||||
const rows = Array.from(tbody.querySelectorAll('tr'));
|
|
||||||
|
|
||||||
sortDirection[column] = sortDirection[column] === 'asc' ? 'desc' : 'asc';
|
|
||||||
const dir = sortDirection[column];
|
|
||||||
|
|
||||||
rows.sort(function(a, b) {
|
|
||||||
const cellA = a.querySelector(`td:nth-child(${getColumnIndex(column)})`)?.textContent.trim() || '';
|
|
||||||
const cellB = b.querySelector(`td:nth-child(${getColumnIndex(column)})`)?.textContent.trim() || '';
|
|
||||||
|
|
||||||
if (dir === 'asc') {
|
|
||||||
return cellA.localeCompare(cellB, 'it');
|
|
||||||
}
|
|
||||||
return cellB.localeCompare(cellA, 'it');
|
|
||||||
});
|
|
||||||
|
|
||||||
rows.forEach(row => tbody.appendChild(row));
|
|
||||||
|
|
||||||
document.querySelectorAll('th i.fa-sort').forEach(icon => {
|
|
||||||
icon.className = 'fas fa-sort float-right text-muted';
|
|
||||||
});
|
|
||||||
const th = document.querySelector(`th[data-sortable][onclick="sortTable('${column}')"] i`);
|
|
||||||
if (th) {
|
|
||||||
th.className = `fas fa-sort-${dir === 'asc' ? 'up' : 'down'} float-right`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getColumnIndex(column) {
|
|
||||||
const th = document.querySelector(`th[onclick="sortTable('${column}')"]`);
|
|
||||||
if (th) {
|
|
||||||
return Array.from(th.parentNode.children).indexOf(th) + 1;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showSaveVistaModal() {
|
|
||||||
document.getElementById('vista-nome').value = '';
|
|
||||||
document.getElementById('vista-default').checked = false;
|
|
||||||
$('#saveVistaModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveVista() {
|
|
||||||
const nome = document.getElementById('vista-nome').value.trim();
|
|
||||||
if (!nome) {
|
|
||||||
alert('Inserisci un nome per la vista');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const colonneVisibili = Array.from(document.querySelectorAll('.col-checkbox:checked')).map(cb => cb.value);
|
|
||||||
const isDefault = document.getElementById('vista-default').checked;
|
|
||||||
|
|
||||||
fetch('/gruppi/save-vista', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
nome: nome,
|
|
||||||
colonne_visibili: colonneVisibili,
|
|
||||||
is_default: isDefault,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
$('#saveVistaModal').modal('hide');
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert('Errore nel salvataggio della vista');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
.tree-item { margin-bottom: 5px; }
|
|
||||||
.tree-children {
|
|
||||||
margin-left: 25px;
|
|
||||||
border-left: 1px dashed #dee2e6;
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
.tree-toggle {
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 3px 8px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
.tree-toggle:hover {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
}
|
|
||||||
.tree-label {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
|
||||||
}
|
|
||||||
.badge-level {
|
|
||||||
font-size: 0.7em;
|
|
||||||
padding: 2px 5px;
|
|
||||||
}
|
|
||||||
.btn-group .btn.active {
|
|
||||||
background-color: #007bff;
|
|
||||||
color: white;
|
|
||||||
border-color: #007bff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/gruppi/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="it">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title><?php echo $__env->yieldContent('title', 'Admin'); ?> - Glastree</title>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
||||||
<?php echo $__env->yieldContent('styles'); ?>
|
|
||||||
</head>
|
|
||||||
<body class="hold-transition sidebar-mini layout-fixed">
|
|
||||||
<div class="wrapper">
|
|
||||||
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
|
|
||||||
<ul class="navbar-nav">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fas fa-bars"></i></a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<ul class="navbar-nav ml-auto">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" href="<?php echo e(route('dashboard')); ?>">
|
|
||||||
<i class="fas fa-home"></i> Torna al Sito
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item dropdown">
|
|
||||||
<a class="nav-link" data-toggle="dropdown" href="#">
|
|
||||||
<i class="fas fa-user"></i> <?php echo e(Auth::user()->name); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
|
||||||
<form method="POST" action="<?php echo e(route('logout')); ?>">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<button type="submit" class="dropdown-item">
|
|
||||||
<i class="fas fa-sign-out-alt mr-2"></i> Esci
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<aside class="main-sidebar sidebar-dark-primary elevation-4">
|
|
||||||
<a href="<?php echo e(route('dashboard')); ?>" class="brand-link">
|
|
||||||
<i class="fas fa-shield-alt brand-image ml-3 mr-2"></i>
|
|
||||||
<span class="brand-text font-weight-light">Admin</span>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<div class="sidebar">
|
|
||||||
<nav class="mt-2">
|
|
||||||
<ul class="nav nav-pills nav-sidebar flex-column">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/utenti" class="nav-link <?php echo e(request()->is('admin/utenti*') ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon fas fa-users"></i>
|
|
||||||
<p>Utenti</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/ruoli" class="nav-link <?php echo e(request()->is('admin/ruoli*') ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon fas fa-user-tag"></i>
|
|
||||||
<p>Ruoli</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a href="/admin/activity-logs" class="nav-link <?php echo e(request()->is('admin/activity-logs*') ? 'active' : ''); ?>">
|
|
||||||
<i class="nav-icon fas fa-history"></i>
|
|
||||||
<p>Log Attività</p>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
|
|
||||||
<div class="content-wrapper">
|
|
||||||
<div class="content-header">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row mb-2">
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<h1 class="m-0"><?php echo $__env->yieldContent('page_title', 'Admin'); ?></h1>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<ol class="breadcrumb float-sm-right">
|
|
||||||
<li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></li>
|
|
||||||
<?php echo $__env->yieldContent('breadcrumbs'); ?>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="content">
|
|
||||||
<div class="container-fluid">
|
|
||||||
<?php if(session('success')): ?>
|
|
||||||
<div class="alert alert-success"><?php echo e(session('success')); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(session('error')): ?>
|
|
||||||
<div class="alert alert-danger"><?php echo e(session('error')); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $__env->yieldContent('content'); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<footer class="main-footer">
|
|
||||||
<strong><?php echo e(\App\Models\AppSetting::getFooterText()); ?></strong>
|
|
||||||
<?php if(\App\Models\AppSetting::shouldShowVersion() && \App\Models\AppSetting::getAppVersion()): ?>
|
|
||||||
<span class="ml-2">v<?php echo e(\App\Models\AppSetting::getAppVersion()); ?></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/js/adminlte.min.js"></script>
|
|
||||||
<?php echo $__env->yieldContent('scripts'); ?>
|
|
||||||
</body>
|
|
||||||
</html><?php /**PATH /var/www/html/glastree/resources/views/admin/layout.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Importa Individui'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Importa Individui da CSV'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-upload mr-2"></i>Carica file CSV</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form action="<?php echo e(route('individui.import.store')); ?>" method="POST" enctype="multipart/form-data">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="file">Seleziona file CSV *</label>
|
|
||||||
<input type="file" name="file" id="file" class="form-control" accept=".csv,.txt" required>
|
|
||||||
<small class="form-text text-muted">
|
|
||||||
Il file deve essere in formato CSV con separatore virgola.
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-upload mr-1"></i> Importa
|
|
||||||
</button>
|
|
||||||
<a href="<?php echo e(route('individui.index')); ?>" class="btn btn-secondary ml-2">
|
|
||||||
Annulla
|
|
||||||
</a>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header bg-info">
|
|
||||||
<h3 class="card-title text-white"><i class="fas fa-download mr-2"></i>Template</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p>Scarica il template CSV per l'importazione:</p>
|
|
||||||
<a href="<?php echo e(route('individui.template')); ?>" class="btn btn-success btn-block">
|
|
||||||
<i class="fas fa-file-csv mr-1"></i> Scarica Template
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-info-circle mr-2"></i>Formato CSV</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<h6>Campi obbligatori:</h6>
|
|
||||||
<ul>
|
|
||||||
<li><code>cognome</code></li>
|
|
||||||
<li><code>nome</code></li>
|
|
||||||
</ul>
|
|
||||||
<h6>Campi opzionali:</h6>
|
|
||||||
<ul>
|
|
||||||
<li><code>data_nascita</code> (formato YYYY-MM-DD)</li>
|
|
||||||
<li><code>indirizzo</code></li>
|
|
||||||
<li><code>cap</code></li>
|
|
||||||
<li><code>città</code></li>
|
|
||||||
<li><code>sigla_provincia</code> (2 lettere)</li>
|
|
||||||
<li><code>genere</code> (M o F)</li>
|
|
||||||
<li><code>tipo_documento</code> (carta_identita, patente)</li>
|
|
||||||
<li><code>numero_documento</code></li>
|
|
||||||
<li><code>scadenza_documento</code> (YYYY-MM-DD)</li>
|
|
||||||
<li><code>note</code></li>
|
|
||||||
</ul>
|
|
||||||
<h6>Contatti (fino a 2):</h6>
|
|
||||||
<ul>
|
|
||||||
<li><code>contatto_1_tipo</code> (email, telefono, cellulare)</li>
|
|
||||||
<li><code>contatto_1_valore</code></li>
|
|
||||||
<li><code>contatto_1_etichetta</code> (personale, lavoro)</li>
|
|
||||||
<li><code>contatto_2_*</code> (secondo contatto)</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/individui/import.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,674 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Dettaglio Individuo'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Dettaglio Individuo'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('breadcrumbs'); ?>
|
|
||||||
<li class="breadcrumb-item"><a href="<?php echo e(route('individui.index')); ?>">Individui</a></li>
|
|
||||||
<li class="breadcrumb-item active"><?php echo e($individuo->nome_completo); ?></li>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-success">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-user mr-2"></i><?php echo e($individuo->nome_completo); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p><strong>Codice:</strong> <span class="badge badge-secondary"><?php echo e($individuo->codice_id); ?></span></p>
|
|
||||||
<p><strong>Data di nascita:</strong> <?php echo e($individuo->data_nascita?->format('d/m/Y') ?: '-'); ?></p>
|
|
||||||
<p><strong>Genere:</strong> <?php echo e($individuo->genere === 'M' ? 'Maschio' : ($individuo->genere === 'F' ? 'Femmina' : '-')); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-secondary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-camera mr-2"></i>Avatar</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body text-center">
|
|
||||||
<?php if($individuo->avatar): ?>
|
|
||||||
<img src="<?php echo e(url('/individui/' . $individuo->id . '/avatar')); ?>"
|
|
||||||
alt="Avatar"
|
|
||||||
class="img-thumbnail mb-2"
|
|
||||||
style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 50%;">
|
|
||||||
<br>
|
|
||||||
<button type="button" class="btn btn-danger btn-sm" onclick="deleteAvatar()">
|
|
||||||
<i class="fas fa-trash mr-1"></i>Rimuovi
|
|
||||||
</button>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="bg-secondary d-flex align-items-center justify-content-center mb-3"
|
|
||||||
style="width: 120px; height: 120px; margin: 0 auto; border-radius: 50%;">
|
|
||||||
<i class="fas fa-user fa-4x text-white"></i>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form id="avatar-upload-form" enctype="multipart/form-data">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="custom-file mb-2">
|
|
||||||
<input type="file" class="custom-file-input" id="avatar-input" name="avatar" accept="image/jpeg,image/png,image/gif">
|
|
||||||
<label class="custom-file-label" for="avatar-input">Scegli immagine...</label>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm" onclick="uploadAvatar()">
|
|
||||||
<i class="fas fa-upload mr-1"></i>Carica
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<div id="avatar-message" class="mt-2"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-map-marker-alt mr-2"></i>Residenza</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p><strong>Indirizzo:</strong> <?php echo e($individuo->indirizzo ?: '-'); ?></p>
|
|
||||||
<p><strong>CAP:</strong> <?php echo e($individuo->cap ?: '-'); ?></p>
|
|
||||||
<p><strong>Città:</strong> <?php echo e($individuo->città ?: '-'); ?></p>
|
|
||||||
<p><strong>Provincia:</strong> <?php echo e($individuo->sigla_provincia ?: '-'); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-id-card mr-2"></i>Documento di identità</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p><strong>Tipo:</strong> <?php echo e($individuo->tipo_documento ? ucfirst(str_replace('_', ' ', $individuo->tipo_documento)) : '-'); ?></p>
|
|
||||||
<p><strong>Numero:</strong> <?php echo e($individuo->numero_documento ?: '-'); ?></p>
|
|
||||||
<p><strong>Scadenza:</strong> <?php echo e($individuo->scadenza_documento?->format('d/m/Y') ?: '-'); ?></p>
|
|
||||||
<?php if($individuo->hasDocumentoScaduto()): ?>
|
|
||||||
<p><span class="badge badge-danger"><i class="fas fa-exclamation-triangle mr-1"></i> Documento scaduto da <?php echo e($individuo->giorni_scadenza_documento); ?> giorni</span></p>
|
|
||||||
<?php elseif($individuo->hasDocumentoScadeEntroGiorni(30)): ?>
|
|
||||||
<p><span class="badge badge-warning"><i class="fas fa-exclamation-circle mr-1"></i> Scade tra <?php echo e($individuo->giorni_scadenza_documento); ?> giorni</span></p>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if($individuo->note): ?>
|
|
||||||
<div class="row mt-3">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-sticky-note mr-2"></i>Note</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p class="mb-0"><?php echo nl2br(e($individuo->note)); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-address-book mr-2"></i>Contatti</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($individuo->contatti->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 20%;">Tipo</th>
|
|
||||||
<th style="width: 30%;">Valore</th>
|
|
||||||
<th style="width: 20%;">Etichetta</th>
|
|
||||||
<th style="width: 10%;">Primario</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $individuo->contatti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contatto): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php
|
|
||||||
$protocols = ['http://', 'https://', 'ftp://', 'ssh://', 'sftp://', 'telnet://'];
|
|
||||||
$isUrl = false;
|
|
||||||
if (in_array($contatto->tipo, ['web', 'telegram'])) {
|
|
||||||
foreach ($protocols as $p) {
|
|
||||||
if (str_starts_with(strtolower($contatto->valore), $p)) {
|
|
||||||
$isUrl = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<tr id="contatto-row-<?php echo e($contatto->id); ?>">
|
|
||||||
<td><span class="text-capitalize"><?php echo e($contatto->tipo); ?></span></td>
|
|
||||||
<td>
|
|
||||||
<?php if($contatto->tipo === 'email'): ?>
|
|
||||||
<a href="mailto:<?php echo e($contatto->valore); ?>"><?php echo e($contatto->valore); ?></a>
|
|
||||||
<?php elseif(in_array($contatto->tipo, ['telefono', 'cellulare', 'whatsapp'])): ?>
|
|
||||||
<a href="tel:<?php echo e($contatto->valore); ?>"><?php echo e($contatto->valore); ?></a>
|
|
||||||
<?php elseif($isUrl): ?>
|
|
||||||
<a href="<?php echo e($contatto->valore); ?>" target="_blank"><?php echo e($contatto->valore); ?></a>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo e($contatto->valore); ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($contatto->etichetta ?: '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($contatto->is_primary): ?>
|
|
||||||
<span class="badge badge-success"><i class="fas fa-check mr-1"></i> Sì</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">No</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-xs btn-warning" onclick="editContattoInline(<?php echo e($contatto->id); ?>)" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</button>
|
|
||||||
<form action="<?php echo e(url('/contatti/' . $contatto->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<input type="hidden" name="_redirect" value="<?php echo e(url('/individui/' . $individuo->id)); ?>">
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo contatto?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="contatto-edit-<?php echo e($contatto->id); ?>" style="display:none;">
|
|
||||||
<td colspan="5">
|
|
||||||
<form action="<?php echo e(url('/contatti/' . $contatto->id)); ?>" method="POST" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<input type="hidden" name="_redirect" value="<?php echo e(url('/individui/' . $individuo->id)); ?>">
|
|
||||||
<input type="hidden" name="individuo_id" value="<?php echo e($individuo->id); ?>">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="tipo" class="form-control form-control-sm" required>
|
|
||||||
<option value="telefono" <?php echo e($contatto->tipo === 'telefono' ? 'selected' : ''); ?>>Telefono</option>
|
|
||||||
<option value="cellulare" <?php echo e($contatto->tipo === 'cellulare' ? 'selected' : ''); ?>>Cellulare</option>
|
|
||||||
<option value="email" <?php echo e($contatto->tipo === 'email' ? 'selected' : ''); ?>>Email</option>
|
|
||||||
<option value="fax" <?php echo e($contatto->tipo === 'fax' ? 'selected' : ''); ?>>Fax</option>
|
|
||||||
<option value="web" <?php echo e($contatto->tipo === 'web' ? 'selected' : ''); ?>>Web</option>
|
|
||||||
<option value="telegram" <?php echo e($contatto->tipo === 'telegram' ? 'selected' : ''); ?>>Telegram</option>
|
|
||||||
<option value="whatsapp" <?php echo e($contatto->tipo === 'whatsapp' ? 'selected' : ''); ?>>WhatsApp</option>
|
|
||||||
<option value="altro" <?php echo e($contatto->tipo === 'altro' ? 'selected' : ''); ?>>Altro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" name="valore" class="form-control form-control-sm" value="<?php echo e($contatto->valore); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" name="etichetta" class="form-control form-control-sm" value="<?php echo e($contatto->etichetta); ?>" placeholder="Etichetta">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1 text-center">
|
|
||||||
<input type="checkbox" name="is_primary" value="1" <?php echo e($contatto->is_primary ? 'checked' : ''); ?>>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-check mr-1"></i>Salva</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="cancelEditContatto(<?php echo e($contatto->id); ?>)"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-address-book fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun contatto</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder mr-2"></i>Gruppi</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showGruppoForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
|
|
||||||
<?php if($individuo->gruppi->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Diocesi</th>
|
|
||||||
<th>Responsabile</th>
|
|
||||||
<th style="width: 130px;">Ruolo</th>
|
|
||||||
<th style="width: 110px;">Data Adesione</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $individuo->gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gruppo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr id="gruppo-row-<?php echo e($gruppo->id); ?>">
|
|
||||||
<td>
|
|
||||||
<i class="fas fa-folder text-warning mr-1"></i>
|
|
||||||
<a href="<?php echo e(url('/gruppi/' . $gruppo->id)); ?>"><?php echo e($gruppo->nome); ?></a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($gruppo->diocesi?->nome ?: '-'); ?></td>
|
|
||||||
<td><?php echo e($gruppo->getResponsabili()->isNotEmpty() ? $gruppo->getResponsabili()->first()->nome_completo : '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
$ruoloIds = $gruppo->pivot->ruolo_ids ? json_decode($gruppo->pivot->ruolo_ids, true) : [];
|
|
||||||
$ruoli = \App\Models\Ruolo::findByIds($ruoloIds);
|
|
||||||
?>
|
|
||||||
<?php if($ruoli->count() > 0): ?>
|
|
||||||
<?php $__currentLoopData = $ruoli; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<span class="badge badge-info mr-1"><?php echo e($ruolo->nome); ?></span>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($gruppo->pivot->data_adesione ? \Carbon\Carbon::parse($gruppo->pivot->data_adesione)->format('d/m/Y') : '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-xs btn-warning" onclick="editGruppoInline(<?php echo e($gruppo->id); ?>)" title="Modifica ruolo">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger" onclick="deleteGruppo(<?php echo e($gruppo->id); ?>)" title="Rimuovi">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="gruppo-edit-<?php echo e($gruppo->id); ?>" style="display:none;">
|
|
||||||
<td colspan="6">
|
|
||||||
<form action="<?php echo e(url('/individui/' . $individuo->id . '/gruppi/' . $gruppo->id)); ?>" method="POST" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" class="form-control form-control-sm" value="<?php echo e($gruppo->nome); ?>" disabled>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="ruolo_ids[]" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $selectedRuoliIds = $gruppo->pivot->ruolo_ids ? json_decode($gruppo->pivot->ruolo_ids, true) : [] ?>
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>" <?php echo e(in_array($ruolo->id, $selectedRuoliIds) ? 'selected' : ''); ?>><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="date" name="data_adesione" class="form-control form-control-sm" value="<?php echo e($gruppo->pivot->data_adesione); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-check mr-1"></i>Salva</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="cancelEditGruppo(<?php echo e($gruppo->id); ?>)"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-users fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun gruppo associato</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3" id="gruppo-add-card" style="display:none; background-color: #fff3cd; border-color: #ffc107;">
|
|
||||||
<div class="card-header bg-warning">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder-plus mr-2"></i>Aggiungi a Gruppo</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<select id="new-gruppo-id" class="form-control form-control-sm">
|
|
||||||
<option value="">Seleziona gruppo...</option>
|
|
||||||
<?php $__currentLoopData = \App\Models\Gruppo::orderBy('nome')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php if(!$individuo->gruppi->contains($g->id)): ?>
|
|
||||||
<option value="<?php echo e($g->id); ?>"><?php echo e($g->full_path); ?></option>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select id="new-gruppo-ruolo" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>"><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<small class="text-muted">Ctrl+click per selezionare più ruoli</small>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="date" id="new-gruppo-data" class="form-control form-control-sm">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="button" class="btn btn-success btn-sm" onclick="submitGruppoForm()">
|
|
||||||
<i class="fas fa-check mr-1"></i> Associa
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-secondary btn-sm" onclick="hideGruppoForm()">
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-file mr-2"></i>Documenti</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showDocumentoForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<div id="documento-add-form" style="display:none;" class="p-3 bg-light border-bottom">
|
|
||||||
<form action="/documenti" method="POST" enctype="multipart/form-data" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="visibilita" value="individuo">
|
|
||||||
<input type="hidden" name="visibilita_target_id" value="<?php echo e($individuo->id); ?>">
|
|
||||||
<input type="hidden" name="visibilita_target_type" value="App\Models\Individuo">
|
|
||||||
<input type="hidden" name="redirect_to" value="<?php echo e(url('/individui/' . $individuo->id)); ?>">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="nome_file" class="form-control form-control-sm" placeholder="Nome documento" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="tipologia" class="form-control form-control-sm" required>
|
|
||||||
<option value="">Tipologia...</option>
|
|
||||||
<option value="documento">Documento</option>
|
|
||||||
<option value="avatar">Avatar</option>
|
|
||||||
<option value="galleria">Galleria</option>
|
|
||||||
<option value="statuto">Statuto</option>
|
|
||||||
<option value="altro">Altro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="file" name="file" class="form-control form-control-sm" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-upload mr-1"></i>Carica</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="hideDocumentoForm()"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<?php if($individuo->documenti->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th style="width: 120px;">Tipologia</th>
|
|
||||||
<th style="width: 80px;">Dimensione</th>
|
|
||||||
<th style="width: 130px;">Data Upload</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $individuo->documenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" onclick="event.preventDefault(); previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>');">
|
|
||||||
<i class="fas fa-file text-secondary mr-1"></i>
|
|
||||||
<?php echo e($documento->nome_file); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e(ucfirst(str_replace('_', ' ', $documento->tipologia))); ?></td>
|
|
||||||
<td><?php echo e(number_format($documento->dimensione / 1024, 1)); ?> KB</td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>')" title="Anteprima">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="<?php echo e(url('/documenti/' . $documento->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<input type="hidden" name="_redirect" value="<?php echo e(url('/individui/' . $individuo->id)); ?>">
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo documento?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-file fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun documento</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
<a href="<?php echo e(url('/individui/' . $individuo->id . '/edit')); ?>" class="btn btn-warning">
|
|
||||||
<i class="fas fa-edit mr-1"></i> Modifica
|
|
||||||
</a>
|
|
||||||
<form action="<?php echo e(url('/individui/' . $individuo->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-danger" onclick="return confirm('Confermi l\'eliminazione di <?php echo e($individuo->nome_completo); ?>?')">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<a href="<?php echo e(route('individui.index')); ?>" class="btn btn-secondary">
|
|
||||||
<i class="fas fa-arrow-left mr-1"></i> Torna all'elenco
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" role="document" style="max-width: 90vw;">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-file mr-2"></i><span id="previewModalTitle">Anteprima</span></h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body text-center p-0" style="min-height: 400px;">
|
|
||||||
<iframe id="previewFrame" src="" style="width: 100%; height: 70vh; border: none;"></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="previewDownloadBtn" href="#" class="btn btn-primary" download>
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function editContattoInline(id) {
|
|
||||||
document.getElementById('contatto-row-' + id).style.display = 'none';
|
|
||||||
document.getElementById('contatto-edit-' + id).style.display = 'table-row';
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEditContatto(id) {
|
|
||||||
document.getElementById('contatto-row-' + id).style.display = 'table-row';
|
|
||||||
document.getElementById('contatto-edit-' + id).style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function showGruppoForm() {
|
|
||||||
var card = document.getElementById('gruppo-add-card');
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'block';
|
|
||||||
card.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideGruppoForm() {
|
|
||||||
var card = document.getElementById('gruppo-add-card');
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitGruppoForm() {
|
|
||||||
var gruppoId = document.getElementById('new-gruppo-id').value;
|
|
||||||
var ruoloSelect = document.getElementById('new-gruppo-ruolo');
|
|
||||||
var dataAdesione = document.getElementById('new-gruppo-data').value;
|
|
||||||
|
|
||||||
if (!gruppoId) {
|
|
||||||
alert('Seleziona un gruppo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formData = new URLSearchParams();
|
|
||||||
formData.append('gruppo_id', gruppoId);
|
|
||||||
|
|
||||||
var selectedRuoli = Array.from(ruoloSelect.selectedOptions).map(opt => opt.value).filter(v => v);
|
|
||||||
selectedRuoli.forEach(function(ruoloId) {
|
|
||||||
formData.append('ruolo_ids[]', ruoloId);
|
|
||||||
});
|
|
||||||
|
|
||||||
formData.append('data_adesione', dataAdesione);
|
|
||||||
|
|
||||||
fetch('<?php echo e(url('/individui/' . $individuo->id . '/gruppi')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
},
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => { throw new Error(text); });
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
hideGruppoForm();
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.error || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function editGruppoInline(id) {
|
|
||||||
document.getElementById('gruppo-row-' + id).style.display = 'none';
|
|
||||||
document.getElementById('gruppo-edit-' + id).style.display = 'table-row';
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEditGruppo(id) {
|
|
||||||
document.getElementById('gruppo-row-' + id).style.display = 'table-row';
|
|
||||||
document.getElementById('gruppo-edit-' + id).style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteGruppo(gruppoId) {
|
|
||||||
if (!confirm('Rimuovere da questo gruppo?')) return;
|
|
||||||
|
|
||||||
fetch('<?php echo e(url('/individui/' . $individuo->id . '/gruppi')); ?>/' + gruppoId, {
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => { throw new Error(text); });
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.error || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewDocumento(id, mimeType) {
|
|
||||||
var previewUrl = '/documenti/' + id + '/preview';
|
|
||||||
var downloadUrl = '/documenti/' + id + '/download';
|
|
||||||
|
|
||||||
document.getElementById('previewFrame').src = previewUrl;
|
|
||||||
document.getElementById('previewDownloadBtn').href = downloadUrl;
|
|
||||||
document.getElementById('previewModalTitle').textContent = 'Anteprima';
|
|
||||||
|
|
||||||
if (mimeType && mimeType.startsWith('image/')) {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
|
|
||||||
} else {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#previewModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('avatar-input').addEventListener('change', function(e) {
|
|
||||||
var fileName = e.target.files[0]?.name || 'Scegli file...';
|
|
||||||
e.target.nextElementSibling.textContent = fileName;
|
|
||||||
});
|
|
||||||
|
|
||||||
function uploadAvatar() {
|
|
||||||
var input = document.getElementById('avatar-input');
|
|
||||||
if (!input.files[0]) {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Seleziona un\'immagine</span>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var formData = new FormData();
|
|
||||||
formData.append('avatar', input.files[0]);
|
|
||||||
formData.append('_token', '<?php echo e(csrf_token()); ?>');
|
|
||||||
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-info"><i class="fas fa-spinner fa-spin"></i> Caricamento...</span>';
|
|
||||||
|
|
||||||
fetch('<?php echo e(url('/individui/' . $individuo->id . '/avatar')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-success">Avatar caricato!</span>';
|
|
||||||
setTimeout(function() { window.location.reload(); }, 500);
|
|
||||||
} else {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">' + (data.message || 'Errore') + '</span>';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
document.getElementById('avatar-message').innerHTML = '<span class="text-danger">Errore: ' + error + '</span>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteAvatar() {
|
|
||||||
if (!confirm('Rimuovere l\'avatar?')) return;
|
|
||||||
|
|
||||||
fetch('<?php echo e(url('/individui/' . $individuo->id . '/avatar')); ?>', {
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.message || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/individui/show.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,631 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Documenti'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Gestione Documenti'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$canWriteDocumenti = Auth::user()->canManage('documenti');
|
|
||||||
$canDeleteDocumenti = Auth::user()->canDelete('documenti');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="card card-primary card-outline">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-file mr-2"></i>Elenco Documenti
|
|
||||||
</h3>
|
|
||||||
<?php if($canWriteDocumenti): ?>
|
|
||||||
<button type="button" class="btn btn-sm btn-success float-right" onclick="$('#uploadModal').modal('show')">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Nuovo Documento
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<form id="massForm" method="POST">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="_method" id="formMethod" value="POST">
|
|
||||||
<?php if($canDeleteDocumenti): ?>
|
|
||||||
<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 di massa:</span>
|
|
||||||
<button type="button" class="btn btn-sm btn-danger" onclick="massAction('delete')">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina selezionati
|
|
||||||
</button>
|
|
||||||
<?php if($canWriteDocumenti): ?>
|
|
||||||
<button type="button" class="btn btn-sm btn-warning" onclick="$('#associateModal').modal('show')">
|
|
||||||
<i class="fas fa-link mr-1"></i> Associa a...
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-sm btn-info" onclick="$('#updateModal').modal('show')">
|
|
||||||
<i class="fas fa-edit mr-1"></i> Cambia tipo/contesto
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<span class="ml-auto text-muted small" id="selectedCount">0 selezionati</span>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 40px;">
|
|
||||||
<?php if($canDeleteDocumenti): ?>
|
|
||||||
<input type="checkbox" id="selectAll" onchange="toggleAll(this)">
|
|
||||||
<?php endif; ?>
|
|
||||||
</th>
|
|
||||||
<th style="width: 200px;">Nome</th>
|
|
||||||
<th style="width: 180px;">Nome File</th>
|
|
||||||
<th style="width: 100px;">Tipologia</th>
|
|
||||||
<th style="width: 100px;">Visibilità</th>
|
|
||||||
<th>Riferimento</th>
|
|
||||||
<th style="width: 130px;">Data Inserimento</th>
|
|
||||||
<th style="width: 120px;">Inserito da</th>
|
|
||||||
<th style="width: 130px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__empty_1 = true; $__currentLoopData = $documenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<?php if($canDeleteDocumenti): ?>
|
|
||||||
<input type="checkbox" name="ids[]" value="<?php echo e($documento->id); ?>" class="doc-checkbox" onchange="updateCount()">
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<i class="fas fa-file text-secondary mr-1"></i>
|
|
||||||
<?php echo e($documento->nome_file); ?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td class="small text-muted"><?php echo e($documento->file_path); ?></td>
|
|
||||||
<td>
|
|
||||||
<span class="badge badge-<?php echo e($documento->tipologia === 'avatar' ? 'primary' : ($documento->tipologia === 'galleria' ? 'success' : 'secondary')); ?>">
|
|
||||||
<?php echo e(ucfirst($documento->tipologia)); ?>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php switch($documento->visibilita):
|
|
||||||
case ('individuo'): ?>
|
|
||||||
<span class="badge badge-info">Individuo</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('gruppo'): ?>
|
|
||||||
<span class="badge badge-success">Gruppo</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('evento'): ?>
|
|
||||||
<span class="badge badge-warning">Evento</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('pubblico'): ?>
|
|
||||||
<span class="badge badge-light">Pubblico</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('associazione'): ?>
|
|
||||||
<span class="badge badge-dark">Associazione</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('federazione'): ?>
|
|
||||||
<span class="badge badge-purple">Federazione</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php default: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endswitch; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->target): ?>
|
|
||||||
<?php if($documento->target instanceof \App\Models\Individuo): ?>
|
|
||||||
<a href="/individui/<?php echo e($documento->target->id); ?>">
|
|
||||||
<i class="fas fa-user text-info mr-1"></i>
|
|
||||||
<?php echo e($documento->target->cognome); ?> <?php echo e($documento->target->nome); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php elseif($documento->target instanceof \App\Models\Gruppo): ?>
|
|
||||||
<a href="/gruppi/<?php echo e($documento->target->id); ?>">
|
|
||||||
<i class="fas fa-folder text-warning mr-1"></i>
|
|
||||||
<?php echo e($documento->target->nome); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php elseif($documento->target instanceof \App\Models\Evento): ?>
|
|
||||||
<a href="/eventi/<?php echo e($documento->target->id); ?>">
|
|
||||||
<i class="fas fa-calendar text-primary mr-1"></i>
|
|
||||||
<?php echo e($documento->target->nome_evento); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y H:i')); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->user): ?>
|
|
||||||
<?php echo e($documento->user->name); ?>
|
|
||||||
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDoc(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>')" title="Anteprima">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canWriteDocumenti): ?>
|
|
||||||
<a href="/documenti/<?php echo e($documento->id); ?>/edit" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canDeleteDocumenti): ?>
|
|
||||||
<form action="/documenti/<?php echo e($documento->id); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger" onclick="deleteDocumento(<?php echo e($documento->id); ?>, '<?php echo e(e($documento->nome_file)); ?>')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="9" class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-file fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun documento presente</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="p-3 border-top">
|
|
||||||
<?php echo e($documenti->links()); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="associateModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-link mr-2"></i>Associa a</h5>
|
|
||||||
<button type="button" class="close" onclick="$('#associateModal').modal('hide')">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form id="associateForm" method="POST" action="/documenti/mass-associate">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tipo collegamento</label>
|
|
||||||
<select name="target_type" class="form-control" required onchange="loadTargets(this.value)">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="individuo">Individuo</option>
|
|
||||||
<option value="gruppo">Gruppo</option>
|
|
||||||
<option value="evento">Evento</option>
|
|
||||||
<option value="mailing">Mailing List</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Riferimento</label>
|
|
||||||
<select name="target_id" class="form-control" required id="targetSelect">
|
|
||||||
<option value="">Seleziona prima il tipo...</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="ids" id="associateIds">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="$('#associateModal').modal('hide')">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-primary" onclick="submitAssociate()">Associa</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-edit mr-2"></i>Cambia tipo/contesto</h5>
|
|
||||||
<button type="button" class="close" onclick="$('#updateModal').modal('hide')">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<form id="updateForm" method="POST" action="/documenti/mass-update">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nuova tipologia</label>
|
|
||||||
<select name="tipologia" class="form-control">
|
|
||||||
<option value="">Non modificare</option>
|
|
||||||
<?php $__currentLoopData = $tipologie; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tip): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($tip->nome); ?>"><?php echo e($tip->descrizione ?? ucfirst($tip->nome)); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nuovo contesto</label>
|
|
||||||
<select name="visibilita" class="form-control">
|
|
||||||
<option value="">Non modificare</option>
|
|
||||||
<option value="pubblico">Pubblico</option>
|
|
||||||
<option value="individuo">Individuo</option>
|
|
||||||
<option value="gruppo">Gruppo</option>
|
|
||||||
<option value="evento">Evento</option>
|
|
||||||
<option value="associazione">Associazione</option>
|
|
||||||
<option value="federazione">Federazione</option>
|
|
||||||
<option value="mailing">Mailing List</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="ids" id="updateIds">
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="$('#updateModal').modal('hide')">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-primary" onclick="submitUpdate()">Aggiorna</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" style="max-width: 90vw;">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-eye mr-2"></i>Anteprima</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body p-0" style="min-height: 400px;">
|
|
||||||
<iframe id="previewFrame" src="" style="width: 100%; height: 70vh; border: none;"></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="previewDownloadBtn" href="#" class="btn btn-primary" download>
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-upload mr-2"></i>Carica Nuovo Documento</h5>
|
|
||||||
<button type="button" class="close" onclick="$('#uploadModal').modal('hide')">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<form action="/documenti" method="POST" enctype="multipart/form-data">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome_file" class="form-control" placeholder="Nome del documento" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tipologia *</label>
|
|
||||||
<select name="tipologia" class="form-control" required>
|
|
||||||
<?php $__currentLoopData = $tipologie; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $tip): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($tip->nome); ?>"><?php echo e($tip->descrizione ?? ucfirst($tip->nome)); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Visibilità *</label>
|
|
||||||
<select name="visibilita" class="form-control" required id="uploadVisibilita" onchange="loadUploadTargets()">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="pubblico">Pubblico</option>
|
|
||||||
<option value="individuo">Individuo</option>
|
|
||||||
<option value="gruppo">Gruppo</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group" id="uploadTargetGroup" style="display:none;">
|
|
||||||
<label>Riferimento</label>
|
|
||||||
<select name="visibilita_target_id" class="form-control" id="uploadTargetId">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
</select>
|
|
||||||
<input type="hidden" name="visibilita_target_type" id="uploadTargetType">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>File *</label>
|
|
||||||
<input type="file" name="file" class="form-control" required>
|
|
||||||
<small class="text-muted">Max 10MB</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="$('#uploadModal').modal('hide')">Annulla</button>
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-upload mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="deleteConfirmModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-danger text-white">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-exclamation-triangle mr-2"></i>Conferma Eliminazione</h5>
|
|
||||||
<button type="button" class="close text-white" onclick="$('#deleteConfirmModal').modal('hide')">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p id="deleteConfirmMessage"></p>
|
|
||||||
<div id="deleteConfirmLinks" class="mt-3"></div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="$('#deleteConfirmModal').modal('hide')">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina comunque
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="massDeleteConfirmModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-danger text-white">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-exclamation-triangle mr-2"></i>Conferma Eliminazione Multipla</h5>
|
|
||||||
<button type="button" class="close text-white" onclick="$('#massDeleteConfirmModal').modal('hide')">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Stai per eliminare <strong id="massDeleteCount">0</strong> documenti.</p>
|
|
||||||
<div id="massDeleteLinks" class="mt-3"></div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" onclick="$('#massDeleteConfirmModal').modal('hide')">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-danger" id="confirmMassDeleteBtn">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina comunque
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
const individui = <?php echo json_encode($individui->map(fn($i) => ['id' => $i->id, 'label' => $i->cognome . ' ' . $i->nome]), 512) ?>;
|
|
||||||
const gruppi = <?php echo json_encode($gruppi->map(fn($g) => ['id' => $g->id, 'label' => $g->nome]), 512) ?>;
|
|
||||||
const eventi = <?php echo json_encode($eventi->map(fn($e) => ['id' => $e->id, 'label' => $e->nome_evento]), 512) ?>;
|
|
||||||
const mailingLists = <?php echo json_encode($mailingLists ?? [], 15, 512) ?>;
|
|
||||||
|
|
||||||
function toggleAll(source) {
|
|
||||||
document.querySelectorAll('.doc-checkbox').forEach(cb => cb.checked = source.checked);
|
|
||||||
updateCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateCount() {
|
|
||||||
const count = document.querySelectorAll('.doc-checkbox:checked').length;
|
|
||||||
document.getElementById('selectedCount').textContent = count + ' selezionati';
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedIds() {
|
|
||||||
return Array.from(document.querySelectorAll('.doc-checkbox:checked')).map(cb => cb.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
let pendingMassDeleteIds = [];
|
|
||||||
|
|
||||||
function massAction(action) {
|
|
||||||
const ids = getSelectedIds();
|
|
||||||
if (ids.length === 0) {
|
|
||||||
alert('Seleziona almeno un documento');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === 'delete') {
|
|
||||||
fetch('/documenti/check-links', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ ids: ids })
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
pendingMassDeleteIds = ids;
|
|
||||||
document.getElementById('massDeleteCount').textContent = ids.length;
|
|
||||||
|
|
||||||
if (data.linked_count > 0) {
|
|
||||||
let linksHtml = '<div class="alert alert-warning mb-0"><p><strong>Attenzione:</strong> ' + data.linked_count + ' documento(i) sono collegati a elementi nel database:</p><ul class="mb-0">';
|
|
||||||
data.links.forEach(function(link) {
|
|
||||||
if (link.url) {
|
|
||||||
linksHtml += '<li><a href="' + link.url + '" target="_blank">' + link.name + '</a></li>';
|
|
||||||
} else {
|
|
||||||
linksHtml += '<li>' + link.name + '</li>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
linksHtml += '</ul></div>';
|
|
||||||
document.getElementById('massDeleteLinks').innerHTML = linksHtml;
|
|
||||||
} else {
|
|
||||||
document.getElementById('massDeleteLinks').innerHTML = '<div class="alert alert-info mb-0">Nessun documento risulta collegato.</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('confirmMassDeleteBtn').onclick = function() { performMassDelete(); };
|
|
||||||
$('#massDeleteConfirmModal').modal('show');
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore controllo collegamenti: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function performMassDelete() {
|
|
||||||
const ids = pendingMassDeleteIds;
|
|
||||||
$('#massDeleteConfirmModal').modal('hide');
|
|
||||||
|
|
||||||
fetch('/documenti/mass-destroy', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: 'ids=' + ids.join(',')
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (response.redirected) {
|
|
||||||
window.location.href = response.url;
|
|
||||||
} else {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteDocumento(id, nomeFile) {
|
|
||||||
fetch('/documenti/' + id + '/check-links', {
|
|
||||||
method: 'GET',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.has_links) {
|
|
||||||
let linksHtml = '<div class="alert alert-warning mb-0"><p class="mb-2"><strong>Attenzione:</strong> Questo documento è collegato a:</p><ul class="mb-0">';
|
|
||||||
data.links.forEach(function(link) {
|
|
||||||
if (link.url) {
|
|
||||||
linksHtml += '<li><a href="' + link.url + '" target="_blank">' + link.name + '</a></li>';
|
|
||||||
} else {
|
|
||||||
linksHtml += '<li>' + link.name + '</li>';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
linksHtml += '</ul></div>';
|
|
||||||
document.getElementById('deleteConfirmLinks').innerHTML = linksHtml;
|
|
||||||
document.getElementById('deleteConfirmMessage').textContent = 'Eliminare il documento "' + nomeFile + '"?';
|
|
||||||
document.getElementById('confirmDeleteBtn').onclick = function() { performDelete(id); };
|
|
||||||
$('#deleteConfirmModal').modal('show');
|
|
||||||
} else {
|
|
||||||
if (confirm('Eliminare il documento "' + nomeFile + '"?')) {
|
|
||||||
performDelete(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function performDelete(id) {
|
|
||||||
fetch('/documenti/' + id, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
},
|
|
||||||
body: '_method=DELETE'
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (response.redirected) {
|
|
||||||
window.location.href = response.url;
|
|
||||||
} else {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewDoc(id, mimeType) {
|
|
||||||
document.getElementById('previewFrame').src = '/documenti/' + id + '/preview';
|
|
||||||
document.getElementById('previewDownloadBtn').href = '/documenti/' + id + '/download';
|
|
||||||
$('#previewModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadUploadTargets() {
|
|
||||||
const visibilita = document.getElementById('uploadVisibilita').value;
|
|
||||||
const group = document.getElementById('uploadTargetGroup');
|
|
||||||
const select = document.getElementById('uploadTargetId');
|
|
||||||
const type = document.getElementById('uploadTargetType');
|
|
||||||
|
|
||||||
if (visibilita === 'pubblico') {
|
|
||||||
group.style.display = 'none';
|
|
||||||
select.innerHTML = '<option value="">Seleziona...</option>';
|
|
||||||
type.value = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
group.style.display = 'block';
|
|
||||||
let data = [];
|
|
||||||
if (visibilita === 'individuo') {
|
|
||||||
data = individui;
|
|
||||||
type.value = 'individuo';
|
|
||||||
} else if (visibilita === 'gruppo') {
|
|
||||||
data = gruppi;
|
|
||||||
type.value = 'gruppo';
|
|
||||||
}
|
|
||||||
|
|
||||||
select.innerHTML = '<option value="">Seleziona...</option>';
|
|
||||||
data.forEach(item => {
|
|
||||||
const opt = document.createElement('option');
|
|
||||||
opt.value = item.id;
|
|
||||||
opt.textContent = item.label;
|
|
||||||
select.appendChild(opt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadTargets(type) {
|
|
||||||
const select = document.getElementById('targetSelect');
|
|
||||||
select.innerHTML = '<option value="">Caricamento...</option>';
|
|
||||||
|
|
||||||
let data = [];
|
|
||||||
if (type === 'individuo') data = individui;
|
|
||||||
else if (type === 'gruppo') data = gruppi;
|
|
||||||
else if (type === 'evento') data = eventi;
|
|
||||||
else if (type === 'mailing') data = mailingLists;
|
|
||||||
|
|
||||||
select.innerHTML = '<option value="">Seleziona...</option>';
|
|
||||||
data.forEach(item => {
|
|
||||||
const opt = document.createElement('option');
|
|
||||||
opt.value = item.id;
|
|
||||||
opt.textContent = item.label;
|
|
||||||
select.appendChild(opt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitAssociate() {
|
|
||||||
const ids = getSelectedIds();
|
|
||||||
if (ids.length === 0) {
|
|
||||||
alert('Seleziona almeno un documento');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const targetType = document.querySelector('#associateForm select[name="target_type"]').value;
|
|
||||||
const targetId = document.getElementById('targetSelect').value;
|
|
||||||
if (!targetType || !targetId) {
|
|
||||||
alert('Seleziona tipo e riferimento');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
document.getElementById('associateIds').value = ids.join(',');
|
|
||||||
document.getElementById('associateForm').submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitUpdate() {
|
|
||||||
const ids = getSelectedIds();
|
|
||||||
console.log('Selected IDs:', ids);
|
|
||||||
if (ids.length === 0) {
|
|
||||||
alert('Seleziona almeno un documento');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const tipologia = document.querySelector('#updateForm select[name="tipologia"]').value;
|
|
||||||
const visibilita = document.querySelector('#updateForm select[name="visibilita"]').value;
|
|
||||||
console.log('Tipologia:', tipologia, 'Visibilita:', visibilita);
|
|
||||||
if (!tipologia && !visibilita) {
|
|
||||||
alert('Seleziona almeno una tipologia o un contesto da modificare');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
document.getElementById('updateIds').value = ids.join(',');
|
|
||||||
console.log('Form submitting with IDs:', document.getElementById('updateIds').value);
|
|
||||||
document.getElementById('updateForm').submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/documenti/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,444 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Impostazioni Email'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Configurazione Email'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('breadcrumbs'); ?>
|
|
||||||
<li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Dashboard</a></li>
|
|
||||||
<li class="breadcrumb-item"><a href="/impostazioni">Impostazioni</a></li>
|
|
||||||
<li class="breadcrumb-item active">Email Settings</li>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="card card-secondary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Sezioni</h3>
|
|
||||||
</div>
|
|
||||||
<div class="list-group list-group-flush">
|
|
||||||
<a href="#imap" class="list-group-item list-group-item-action active" data-toggle="tab">
|
|
||||||
<i class="nav-icon fas fa-server"></i> Server IMAP
|
|
||||||
</a>
|
|
||||||
<a href="#smtp" class="list-group-item list-group-item-action" data-toggle="tab">
|
|
||||||
<i class="nav-icon fas fa-paper-plane"></i> Server SMTP (Invio)
|
|
||||||
</a>
|
|
||||||
<a href="#account" class="list-group-item list-group-item-action" data-toggle="tab">
|
|
||||||
<i class="nav-icon fas fa-user"></i> Account
|
|
||||||
</a>
|
|
||||||
<a href="#sync" class="list-group-item list-group-item-action" data-toggle="tab">
|
|
||||||
<i class="nav-icon fas fa-sync"></i> Sincronizzazione
|
|
||||||
</a>
|
|
||||||
<a href="#signature" class="list-group-item list-group-item-action" data-toggle="tab">
|
|
||||||
<i class="nav-icon fas fa-signature"></i> Firma
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<form method="POST" action="<?php echo e(route('impostazioni.email.save')); ?>">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="id" value="<?php echo e($settings->id ?? 1); ?>">
|
|
||||||
|
|
||||||
<div class="tab-content">
|
|
||||||
<div class="tab-pane active" id="imap">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Configurazione Server IMAP</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if(session('success')): ?>
|
|
||||||
<div class="alert alert-success"><?php echo e(session('success')); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(session('error')): ?>
|
|
||||||
<div class="alert alert-danger"><?php echo e(session('error')); ?></div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imap_host">Host IMAP</label>
|
|
||||||
<input type="text" name="imap_host" id="imap_host" class="form-control"
|
|
||||||
value="<?php echo e($settings->imap_host ?? 'imap.gmail.com'); ?>"
|
|
||||||
placeholder="es. imap.gmail.com">
|
|
||||||
<small class="text-muted">Gmail: imap.gmail.com | Outlook: outlook.office365.com</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imap_port">Porta</label>
|
|
||||||
<input type="number" name="imap_port" id="imap_port" class="form-control"
|
|
||||||
value="<?php echo e($settings->imap_port ?? 993); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imap_encryption">Crittografia</label>
|
|
||||||
<select name="imap_encryption" id="imap_encryption" class="form-control">
|
|
||||||
<option value="ssl" <?php echo e(($settings->imap_encryption ?? 'ssl') == 'ssl' ? 'selected' : ''); ?>>SSL</option>
|
|
||||||
<option value="tls" <?php echo e(($settings->imap_encryption ?? '') == 'tls' ? 'selected' : ''); ?>>TLS</option>
|
|
||||||
<option value="none" <?php echo e(($settings->imap_encryption ?? '') == 'none' ? 'selected' : ''); ?>>Nessuna</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane" id="smtp">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Configurazione Server SMTP (per invio email)</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<i class="fas fa-info-circle"></i>
|
|
||||||
<strong>Nota:</strong> Per inviare email devi configurare il server SMTP.
|
|
||||||
Per Gmail, usa <code>smtp.gmail.com</code> sulla porta <code>587</code> con TLS
|
|
||||||
e genera una <a href="https://support.google.com/accounts/answer/185833" target="_blank">App Password</a>.
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="smtp_host">Host SMTP</label>
|
|
||||||
<input type="text" name="smtp_host" id="smtp_host" class="form-control"
|
|
||||||
value="<?php echo e($settings->smtp_host ?? 'smtp.gmail.com'); ?>"
|
|
||||||
placeholder="es. smtp.gmail.com">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="smtp_port">Porta</label>
|
|
||||||
<input type="number" name="smtp_port" id="smtp_port" class="form-control"
|
|
||||||
value="<?php echo e($settings->smtp_port ?? 587); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="smtp_encryption">Crittografia</label>
|
|
||||||
<select name="smtp_encryption" id="smtp_encryption" class="form-control">
|
|
||||||
<option value="tls" <?php echo e(($settings->smtp_encryption ?? 'tls') == 'tls' ? 'selected' : ''); ?>>TLS</option>
|
|
||||||
<option value="ssl" <?php echo e(($settings->smtp_encryption ?? '') == 'ssl' ? 'selected' : ''); ?>>SSL</option>
|
|
||||||
<option value="none" <?php echo e(($settings->smtp_encryption ?? '') == 'none' ? 'selected' : ''); ?>>Nessuna</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="smtp_username">Username SMTP</label>
|
|
||||||
<input type="text" name="smtp_username" id="smtp_username" class="form-control"
|
|
||||||
value="<?php echo e($settings->smtp_username ?? ''); ?>"
|
|
||||||
placeholder="lascia vuoto per usare l'account IMAP">
|
|
||||||
<small class="text-muted">Generalmente uguale all'account email</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="smtp_password">Password SMTP / App Password</label>
|
|
||||||
<input type="password" name="smtp_password" id="smtp_password" class="form-control"
|
|
||||||
placeholder="<?php echo e($settings->smtp_password ? '••••••••' : ''); ?>">
|
|
||||||
<small class="text-muted">Lascia vuoto per usare la password IMAP</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane" id="account">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Credenziali Account</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imap_username">Username/Email</label>
|
|
||||||
<input type="text" name="imap_username" id="imap_username" class="form-control"
|
|
||||||
value="<?php echo e($settings->imap_username ?? ''); ?>"
|
|
||||||
placeholder="es. tuo@gmail.com">
|
|
||||||
<small class="text-muted">Per Gmail usa l'indirizzo completo</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="imap_password">Password / App Password</label>
|
|
||||||
<input type="password" name="imap_password" id="imap_password" class="form-control"
|
|
||||||
placeholder="">
|
|
||||||
<small class="text-muted">
|
|
||||||
<a href="https://support.google.com/accounts/answer/185833" target="_blank">
|
|
||||||
Per Gmail: genera una App Password
|
|
||||||
</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email_address">Email Indirizzo</label>
|
|
||||||
<input type="email" name="email_address" id="email_address" class="form-control"
|
|
||||||
value="<?php echo e($settings->email_address ?? ''); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email_name">Nome Visualizzato</label>
|
|
||||||
<input type="text" name="email_name" id="email_name" class="form-control"
|
|
||||||
value="<?php echo e($settings->email_name ?? ''); ?>"
|
|
||||||
placeholder="es. Nome Cognome">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="reply_to">Email Risposta (Reply-To)</label>
|
|
||||||
<input type="email" name="reply_to" id="reply_to" class="form-control"
|
|
||||||
value="<?php echo e($settings->reply_to ?? ''); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane" id="sync">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Sincronizzazione</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="sync_interval_minutes">Intervallo Sync (minuti)</label>
|
|
||||||
<select name="sync_interval_minutes" id="sync_interval_minutes" class="form-control">
|
|
||||||
<option value="1" <?php echo e(($settings->sync_interval_minutes ?? 5) == 1 ? 'selected' : ''); ?>>1 minuto</option>
|
|
||||||
<option value="5" <?php echo e(($settings->sync_interval_minutes ?? 5) == 5 ? 'selected' : ''); ?>>5 minuti</option>
|
|
||||||
<option value="15" <?php echo e(($settings->sync_interval_minutes ?? 5) == 15 ? 'selected' : ''); ?>>15 minuti</option>
|
|
||||||
<option value="30" <?php echo e(($settings->sync_interval_minutes ?? 5) == 30 ? 'selected' : ''); ?>>30 minuti</option>
|
|
||||||
<option value="60" <?php echo e(($settings->sync_interval_minutes ?? 5) == 60 ? 'selected' : ''); ?>>1 ora</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Stato Connessione</label>
|
|
||||||
<div class="mt-2">
|
|
||||||
<?php if($settings->last_sync_at): ?>
|
|
||||||
<span class="badge badge-success">
|
|
||||||
<i class="fas fa-check-circle"></i> Ultimo sync: <?php echo e($settings->last_sync_at->format('d/m/Y H:i')); ?>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="badge badge-secondary">
|
|
||||||
<i class="fas fa-clock"></i> Mai sincronizzato
|
|
||||||
</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="is_active"
|
|
||||||
name="is_active" value="1" <?php echo e(($settings->is_active ?? false) ? 'checked' : ''); ?>>
|
|
||||||
<label class="custom-control-label" for="is_active">Account Email Attivo</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane" id="signature">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Firma Email</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="signature_enabled"
|
|
||||||
name="signature_enabled" value="1" <?php echo e(($settings->signature_enabled ?? true) ? 'checked' : ''); ?>>
|
|
||||||
<label class="custom-control-label" for="signature_enabled">Attiva firma automatica</label>
|
|
||||||
</div>
|
|
||||||
<small class="text-muted">Quando attivo, la firma verrà aggiunta in fondo a ogni email inviata</small>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="signature">Testo Firma (formato HTML)</label>
|
|
||||||
<div id="signature-editor" style="height: 200px;"></div>
|
|
||||||
<input type="hidden" name="signature" id="signature_input" value="<?php echo e($settings->signature ?? ''); ?>">
|
|
||||||
<small class="text-muted">Usa il riquadro sopra per comporre la tua firma. HTML supportato.</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-footer">
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Impostazioni
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-info ml-2" onclick="testConnection()">
|
|
||||||
<i class="fas fa-plug mr-1"></i> Test Connessione IMAP
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-success ml-2" onclick="testSmtp()">
|
|
||||||
<i class="fas fa-paper-plane mr-1"></i> Test Invio Email (SMTP)
|
|
||||||
</button>
|
|
||||||
<a href="<?php echo e(route('impostazioni.email.sync')); ?>" class="btn btn-warning ml-2">
|
|
||||||
<i class="fas fa-sync mr-1"></i> Sincronizza Ora
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function testConnection() {
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo e(route('impostazioni.email.test')); ?>',
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>' },
|
|
||||||
success: function(response) {
|
|
||||||
if (response.success) {
|
|
||||||
alert('✅ ' + response.message);
|
|
||||||
} else {
|
|
||||||
alert('❌ ' + response.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert('❌ Errore nella richiesta');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function testSmtp() {
|
|
||||||
var email = prompt('Inserisci l\'indirizzo email a cui inviare il test:');
|
|
||||||
if (!email) return;
|
|
||||||
|
|
||||||
if (!email.includes('@')) {
|
|
||||||
alert('⚠️ Indirizzo email non valido');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var btn = event.target;
|
|
||||||
btn.disabled = true;
|
|
||||||
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> Invio...';
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo e(route('impostazioni.email.testSmtp')); ?>',
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>' },
|
|
||||||
data: { email: email },
|
|
||||||
timeout: 30000,
|
|
||||||
success: function(response) {
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.innerHTML = '<i class="fas fa-paper-plane mr-1"></i> Test Invio Email (SMTP)';
|
|
||||||
if (response.success) {
|
|
||||||
alert('✅ ' + response.message);
|
|
||||||
} else {
|
|
||||||
alert('❌ ' + response.message);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
btn.disabled = false;
|
|
||||||
btn.innerHTML = '<i class="fas fa-paper-plane mr-1"></i> Test Invio Email (SMTP)';
|
|
||||||
if (xhr.responseJSON && xhr.responseJSON.message) {
|
|
||||||
alert('❌ ' + xhr.responseJSON.message);
|
|
||||||
} else {
|
|
||||||
alert('❌ Errore: ' + status + ' - ' + error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createEditor() {
|
|
||||||
var container = document.querySelector('#signature-editor');
|
|
||||||
if (!container || container.querySelector('.ql-toolbar')) return;
|
|
||||||
|
|
||||||
var quill = new Quill('#signature-editor', {
|
|
||||||
theme: 'snow',
|
|
||||||
modules: {
|
|
||||||
toolbar: [
|
|
||||||
['bold', 'italic', 'underline'],
|
|
||||||
[{ 'color': [] }, { 'background': [] }],
|
|
||||||
[{ 'header': 1 }, { 'header': 2 }, { 'header': 3 }],
|
|
||||||
[{ 'align': [] }],
|
|
||||||
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
|
||||||
['link', 'image'],
|
|
||||||
['clean', 'code']
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var signatureInput = document.getElementById('signature_input');
|
|
||||||
var isEditingHtml = false;
|
|
||||||
|
|
||||||
quill.getModule('toolbar').addHandler('code', function() {
|
|
||||||
if (!isEditingHtml) {
|
|
||||||
var textarea = document.createElement('textarea');
|
|
||||||
textarea.className = 'ql-editor';
|
|
||||||
textarea.style.cssText = 'font-family: monospace; min-height: 150px; width: 100%;';
|
|
||||||
textarea.value = signatureInput.value;
|
|
||||||
quill.root.innerHTML = '';
|
|
||||||
quill.root.appendChild(textarea);
|
|
||||||
textarea.focus();
|
|
||||||
isEditingHtml = true;
|
|
||||||
} else {
|
|
||||||
var textarea = quill.root.querySelector('textarea');
|
|
||||||
if (textarea) {
|
|
||||||
signatureInput.value = textarea.value;
|
|
||||||
quill.root.innerHTML = textarea.value;
|
|
||||||
}
|
|
||||||
isEditingHtml = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (signatureInput.value) {
|
|
||||||
quill.root.innerHTML = signatureInput.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
quill.on('text-change', function() {
|
|
||||||
if (!isEditingHtml) {
|
|
||||||
signatureInput.value = quill.root.innerHTML;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initSignatureEditor() {
|
|
||||||
if (document.querySelector('#signature-editor .ql-toolbar')) return;
|
|
||||||
|
|
||||||
if (typeof Quill === 'undefined') {
|
|
||||||
var script = document.createElement('script');
|
|
||||||
script.src = 'https://cdn.quilljs.com/1.3.7/quill.min.js';
|
|
||||||
script.onload = createEditor;
|
|
||||||
document.head.appendChild(script);
|
|
||||||
|
|
||||||
var link = document.createElement('link');
|
|
||||||
link.rel = 'stylesheet';
|
|
||||||
link.href = 'https://cdn.quilljs.com/1.3.7/quill.snow.css';
|
|
||||||
document.head.appendChild(link);
|
|
||||||
} else {
|
|
||||||
createEditor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
|
|
||||||
if ($(e.target).attr('href') === '#signature') {
|
|
||||||
setTimeout(initSignatureEditor, 100);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if ($('#signature').hasClass('active')) {
|
|
||||||
initSignatureEditor();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/admin/email-settings/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Log Attività'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Log Attività'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('breadcrumbs'); ?>
|
|
||||||
<li class="breadcrumb-item active">Admin</li>
|
|
||||||
<li class="breadcrumb-item active">Log Attività</li>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Attività di Sistema</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form method="GET" class="mb-3">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="user_id" class="form-control">
|
|
||||||
<option value="">Tutti gli utenti</option>
|
|
||||||
<?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($u->id); ?>" <?php echo e(request('user_id') == $u->id ? 'selected' : ''); ?>><?php echo e($u->name); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="module" class="form-control">
|
|
||||||
<option value="">Tutti i moduli</option>
|
|
||||||
<?php $__currentLoopData = $modules; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($module); ?>" <?php echo e(request('module') == $module ? 'selected' : ''); ?>><?php echo e($module); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<select name="action" class="form-control">
|
|
||||||
<option value="">Tutte le azioni</option>
|
|
||||||
<option value="create" <?php echo e(request('action') == 'create' ? 'selected' : ''); ?>>Create</option>
|
|
||||||
<option value="update" <?php echo e(request('action') == 'update' ? 'selected' : ''); ?>>Update</option>
|
|
||||||
<option value="delete" <?php echo e(request('action') == 'delete' ? 'selected' : ''); ?>>Delete</option>
|
|
||||||
<option value="login" <?php echo e(request('action') == 'login' ? 'selected' : ''); ?>>Login</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="date" name="from" class="form-control" value="<?php echo e(request('from')); ?>" placeholder="Da">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="date" name="to" class="form-control" value="<?php echo e(request('to')); ?>" placeholder="A">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-primary">Filtra</button>
|
|
||||||
<a href="/admin/activity-logs" class="btn btn-secondary">Reset</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Data/Ora</th>
|
|
||||||
<th>Utente</th>
|
|
||||||
<th>Azione</th>
|
|
||||||
<th>Modulo</th>
|
|
||||||
<th>Descrizione</th>
|
|
||||||
<th>IP</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__empty_1 = true; $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
|
|
||||||
<tr>
|
|
||||||
<td><small><?php echo e($log->created_at->format('d/m/Y H:i:s')); ?></small></td>
|
|
||||||
<td><?php echo e($log->user->name ?? 'Sistema'); ?></td>
|
|
||||||
<td>
|
|
||||||
<span class="badge badge-<?php echo e($log->action == 'delete' ? 'danger' : ($log->action == 'create' ? 'success' : ($log->action == 'login' ? 'info' : 'warning'))); ?>">
|
|
||||||
<?php echo e($log->action); ?>
|
|
||||||
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($log->module); ?></td>
|
|
||||||
<td><?php echo e($log->description); ?></td>
|
|
||||||
<td><small><?php echo e($log->ip_address); ?></small></td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="6" class="text-center">Nessun log presente</td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<?php echo e($logs->links()); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/admin/activity-logs/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,165 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Nuova Email'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Composizione Email'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-edit mr-2"></i>Nuova Email</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form method="POST" action="<?php echo e(route('email.send')); ?>" id="emailForm">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Destinatari *</label>
|
|
||||||
<div class="mb-2">
|
|
||||||
<select name="destinatario_tipo" id="destinatario_tipo" class="form-control" onchange="toggleDestinatari()">
|
|
||||||
<option value="manuale">Email Manuale</option>
|
|
||||||
<option value="individui">Singoli Individui</option>
|
|
||||||
<option value="gruppo">Membri di un Gruppo</option>
|
|
||||||
<option value="mailing_list">Mailing List</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="manual-input" class="destinatari-section">
|
|
||||||
<input type="text" name="to" id="to_manual" class="form-control"
|
|
||||||
placeholder="destinatario@email.it" value="<?php echo e($prefill['to'] ?? ''); ?>">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="individui-input" class="destinatari-section" style="display: none;">
|
|
||||||
<select name="individui[]" id="individui-select" class="form-control" multiple size="5">
|
|
||||||
<?php $__currentLoopData = $individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ind): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ind->id); ?>"><?php echo e($ind->cognito); ?> <?php echo e($ind->nome); ?> (<?php echo e($ind->email_primaria ?? 'senza email'); ?>)</option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<small class="text-muted">Tieni premuto Ctrl per selezionare più individui</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="gruppo-input" class="destinatari-section" style="display: none;">
|
|
||||||
<select name="gruppo_id" id="gruppo-select" class="form-control mb-2" onchange="loadGruppiContatti()">
|
|
||||||
<option value="">Seleziona gruppo...</option>
|
|
||||||
<?php $__currentLoopData = $gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $gruppo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($gruppo->id); ?>"><?php echo e($gruppo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<div id="gruppo-contatti" class="border rounded p-2" style="max-height: 150px; overflow-y: auto;">
|
|
||||||
<em class="text-muted">Seleziona un gruppo per vedere i contatti</em>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="mailing-list-input" class="destinatari-section" style="display: none;">
|
|
||||||
<select name="mailing_list_id" id="mailing-list-select" class="form-control">
|
|
||||||
<option value="">Seleziona mailing list...</option>
|
|
||||||
<?php $__currentLoopData = $mailingLists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $list): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($list->id); ?>"><?php echo e($list->nome); ?> (<?php echo e($list->contatti->count()); ?> contatti)</option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="subject">Oggetto *</label>
|
|
||||||
<input type="text" name="subject" id="subject" class="form-control"
|
|
||||||
value="<?php echo e($prefill['subject'] ?? ''); ?>" required>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="body">Messaggio *</label>
|
|
||||||
<textarea name="body" id="body" class="form-control" rows="15" required><?php echo e($prefill['body'] ?? ''); ?></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Allegati</label>
|
|
||||||
<div class="border rounded p-3 bg-light">
|
|
||||||
<label class="btn btn-sm btn-success mb-0">
|
|
||||||
<i class="fas fa-upload mr-1"></i> Carica file
|
|
||||||
<input type="file" name="allegati[]" multiple class="d-none">
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-paper-plane mr-1"></i> Invia
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-secondary ml-2" onclick="saveDraft()">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Bozze
|
|
||||||
</button>
|
|
||||||
<a href="<?php echo e(route('email.index')); ?>" class="btn btn-default ml-2">
|
|
||||||
Annulla
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function toggleDestinatari() {
|
|
||||||
const tipo = document.getElementById('destinatario_tipo').value;
|
|
||||||
|
|
||||||
document.querySelectorAll('.destinatari-section').forEach(el => el.style.display = 'none');
|
|
||||||
|
|
||||||
if (tipo === 'manuale') {
|
|
||||||
document.getElementById('manual-input').style.display = 'block';
|
|
||||||
} else if (tipo === 'individui') {
|
|
||||||
document.getElementById('individui-input').style.display = 'block';
|
|
||||||
} else if (tipo === 'gruppo') {
|
|
||||||
document.getElementById('gruppo-input').style.display = 'block';
|
|
||||||
} else if (tipo === 'mailing_list') {
|
|
||||||
document.getElementById('mailing-list-input').style.display = 'block';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadGruppiContatti() {
|
|
||||||
const gruppoId = document.getElementById('gruppo-select').value;
|
|
||||||
const container = document.getElementById('gruppo-contatti');
|
|
||||||
|
|
||||||
if (!gruppoId) {
|
|
||||||
container.innerHTML = '<em class="text-muted">Seleziona un gruppo per vedere i contatti</em>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch('/gruppi/' + gruppoId + '/individui-email')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
if (data.length === 0) {
|
|
||||||
container.innerHTML = '<em class="text-muted">Nessun contatto email nel gruppo</em>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let html = '';
|
|
||||||
data.forEach(ind => {
|
|
||||||
if (ind.email) {
|
|
||||||
html += `<div class="form-check">
|
|
||||||
<input class="form-check-input" type="checkbox" name="gruppo_emails[]" value="${ind.email}" id="email-${ind.id}">
|
|
||||||
<label class="form-check-label" for="email-${ind.id}">${ind.cogname} ${ind.nome} - ${ind.email}</label>
|
|
||||||
</div>`;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
container.innerHTML = html || '<em class="text-muted">Nessun contatto email nel gruppo</em>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveDraft() {
|
|
||||||
const form = document.getElementById('emailForm');
|
|
||||||
const formData = new FormData(form);
|
|
||||||
|
|
||||||
fetch('<?php echo e(route('email.draft')); ?>', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>' },
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
alert('Bozza salvata!');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/email/compose.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Mailing Lists'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Mailing Lists'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$canWriteMailing = Auth::user()->canManage('mailing');
|
|
||||||
$canDeleteMailing = Auth::user()->canDelete('mailing');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
|
|
||||||
<?php if(session('success')): ?>
|
|
||||||
<div class="alert alert-success alert-dismissible">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<?php echo e(session('success')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-list mr-2"></i>Elenco Mailing Lists</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<?php if($canDeleteMailing): ?>
|
|
||||||
<div class="btn-group mr-2">
|
|
||||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina Selezionati
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canWriteMailing): ?>
|
|
||||||
<a href="<?php echo e(route('mailing-liste.create')); ?>" class="btn btn-success btn-sm">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Nuova Lista
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($mailingLists->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 40px;">
|
|
||||||
<?php if($canDeleteMailing): ?>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="select-all" onchange="toggleSelectAll(this)">
|
|
||||||
<label class="custom-control-label" for="select-all"></label>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</th>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Descrizione</th>
|
|
||||||
<th style="width: 100px;">Contatti</th>
|
|
||||||
<th style="width: 100px;">Stato</th>
|
|
||||||
<th style="width: 130px;">Creata il</th>
|
|
||||||
<th style="width: 100px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $mailingLists; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lista): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr data-id="<?php echo e($lista->id); ?>">
|
|
||||||
<td>
|
|
||||||
<?php if($canDeleteMailing): ?>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input row-checkbox" id="row-checkbox-<?php echo e($lista->id); ?>" value="<?php echo e($lista->id); ?>">
|
|
||||||
<label class="custom-control-label" for="row-checkbox-<?php echo e($lista->id); ?>"></label>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('mailing-liste.show', $lista->id)); ?>"><?php echo e($lista->nome); ?></a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($lista->descrizione ?: '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<span class="badge badge-info"><?php echo e($lista->contatti->count()); ?></span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if($lista->attiva): ?>
|
|
||||||
<span class="badge badge-success">Attiva</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="badge badge-secondary">Disattiva</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($lista->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('mailing-liste.show', $lista->id)); ?>" class="btn btn-xs btn-info" title="Visualizza">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
<?php if($canWriteMailing): ?>
|
|
||||||
<a href="<?php echo e(route('mailing-liste.edit', $lista->id)); ?>" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<form action="<?php echo e(route('mailing-liste.destroy', $lista->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questa lista?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-list fa-3x mb-3"></i>
|
|
||||||
<p>Nessuna mailing list</p>
|
|
||||||
<?php if($canWriteMailing): ?>
|
|
||||||
<a href="<?php echo e(route('mailing-liste.create')); ?>" class="btn btn-success">Crea la prima lista</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
|
|
||||||
<?php if($canDeleteMailing): ?>
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-danger">
|
|
||||||
<h5 class="modal-title text-white"><i class="fas fa-trash-alt mr-2"></i>Conferma Eliminazione</h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Stai per eliminare <strong id="delete-count">0</strong> mailing list selezionate.</p>
|
|
||||||
<p class="text-muted small">Verranno eliminati anche tutti i contatti associati.</p>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-danger" onclick="confirmDelete()">Elimina</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function toggleSelectAll(source) {
|
|
||||||
document.querySelectorAll('.row-checkbox').forEach(cb => cb.checked = source.checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedIds() {
|
|
||||||
return Array.from(document.querySelectorAll('.row-checkbox:checked')).map(cb => cb.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteSelected() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno una mailing list');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('delete-count').textContent = selectedIds.length;
|
|
||||||
|
|
||||||
document.querySelector('#deleteModal .btn-danger').onclick = function() {
|
|
||||||
const form = document.createElement('form');
|
|
||||||
form.method = 'POST';
|
|
||||||
form.action = '/mailing-liste/mass-elimina';
|
|
||||||
|
|
||||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '<?php echo e(csrf_token()); ?>';
|
|
||||||
|
|
||||||
let html = `<input type="hidden" name="_token" value="${csrfToken}">`;
|
|
||||||
selectedIds.forEach(function(id) {
|
|
||||||
html += `<input type="hidden" name="ids[]" value="${id}">`;
|
|
||||||
});
|
|
||||||
|
|
||||||
form.innerHTML = html;
|
|
||||||
document.body.appendChild(form);
|
|
||||||
form.submit();
|
|
||||||
};
|
|
||||||
|
|
||||||
$('#deleteModal').modal('show');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/mailing-liste/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,260 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Nuovo Gruppo'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Nuovo Gruppo'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<form action="/gruppi" method="POST">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder mr-2"></i>Dati Gruppo</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome" class="form-control <?php $__errorArgs = ['nome'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>" value="<?php echo e(old('nome')); ?>" required>
|
|
||||||
<?php $__errorArgs = ['nome'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?>
|
|
||||||
<span class="invalid-feedback"><?php echo e($message); ?></span>
|
|
||||||
<?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gruppo Padre</label>
|
|
||||||
<select name="parent_id" class="form-control">
|
|
||||||
<option value="">Nessuno (gruppo radice)</option>
|
|
||||||
<?php $__currentLoopData = $allGruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($g->id); ?>" <?php echo e(old('parent_id') == $g->id || ($selectedParent && $selectedParent->id == $g->id) ? 'selected' : ''); ?>>
|
|
||||||
<?php echo e($g->full_path); ?>
|
|
||||||
|
|
||||||
</option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<?php if($selectedParent): ?>
|
|
||||||
<small class="form-text text-muted">
|
|
||||||
Verrà creato come sottogruppo di: <strong><?php echo e($selectedParent->nome); ?></strong>
|
|
||||||
</small>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Diocesi</label>
|
|
||||||
<select name="diocesi_id" class="form-control">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<?php $__currentLoopData = $diocesi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($d->id); ?>" <?php echo e(old('diocesi_id') == $d->id ? 'selected' : ''); ?>><?php echo e($d->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Responsabili</label>
|
|
||||||
<select name="responsabile_ids[]" class="form-control" multiple size="4" id="responsabile-select">
|
|
||||||
<option value="">-- Nessuno --</option>
|
|
||||||
</select>
|
|
||||||
<small class="text-muted">Ctrl+click per selezionare più responsabili</small>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Descrizione</label>
|
|
||||||
<textarea name="descrizione" class="form-control" rows="3"><?php echo e(old('descrizione')); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-map-marker-alt mr-2"></i>Luogo Incontro</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Indirizzo</label>
|
|
||||||
<input type="text" name="indirizzo_incontro" class="form-control" value="<?php echo e(old('indirizzo_incontro')); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>CAP</label>
|
|
||||||
<input type="text" name="cap_incontro" class="form-control" value="<?php echo e(old('cap_incontro')); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Città</label>
|
|
||||||
<input type="text" name="città_incontro" class="form-control" value="<?php echo e(old('città_incontro')); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label>Provincia</label>
|
|
||||||
<input type="text" name="sigla_provincia_incontro" class="form-control" maxlength="2" value="<?php echo e(old('sigla_provincia_incontro')); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group mb-0">
|
|
||||||
<label>URL Mappa</label>
|
|
||||||
<input type="url" name="mappa_posizione" class="form-control" value="<?php echo e(old('mappa_posizione')); ?>" placeholder="https://...">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-users mr-2"></i>Membri</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="aggiungiMembro()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi Membro
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<table class="table table-bordered mb-0" id="membri-table">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 30%;">Individuo</th>
|
|
||||||
<th>Codice</th>
|
|
||||||
<th>Contatti</th>
|
|
||||||
<th style="width: 20%;">Ruolo</th>
|
|
||||||
<th style="width: 100px;">Data Adesione</th>
|
|
||||||
<th style="width: 50px;"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="membri-tbody">
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<div id="no-membri-msg" class="text-center text-muted py-4">
|
|
||||||
<p class="mb-0">Nessun membro aggiunto. Clicca su "Aggiungi Membro" per iniziare.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
<button type="submit" class="btn btn-success">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva
|
|
||||||
</button>
|
|
||||||
<a href="/gruppi" class="btn btn-secondary">
|
|
||||||
<i class="fas fa-times mr-1"></i> Annulla
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
let membriIndex = 0;
|
|
||||||
const membriResponsabiliMap = new Map();
|
|
||||||
|
|
||||||
function aggiungiMembro() {
|
|
||||||
const tbody = document.getElementById('membri-tbody');
|
|
||||||
const noMsg = document.getElementById('no-membri-msg');
|
|
||||||
if (noMsg) noMsg.style.display = 'none';
|
|
||||||
|
|
||||||
const row = document.createElement('tr');
|
|
||||||
row.innerHTML = `
|
|
||||||
<td>
|
|
||||||
<select name="individui[${membriIndex}][individuo_id]" class="form-control" onchange="updateMembroInfo(this); updateResponsabiliFromMembri();" required>
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<?php $__currentLoopData = $individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($i->id); ?>" data-codice="<?php echo e($i->codice_id); ?>" data-email="<?php echo e($i->email_primaria); ?>" data-telefono="<?php echo e($i->telefono_primario); ?>">
|
|
||||||
<?php echo e($i->cognome); ?> <?php echo e($i->nome); ?>
|
|
||||||
|
|
||||||
</option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</td>
|
|
||||||
<td><span class="text-muted membro-codice">-</span></td>
|
|
||||||
<td><small class="text-muted membro-contatti">-</small></td>
|
|
||||||
<td><input type="text" name="individui[${membriIndex}][ruolo_nel_gruppo]" class="form-control" placeholder="Es. Membro"></td>
|
|
||||||
<td><input type="date" name="individui[${membriIndex}][data_adesione]" class="form-control"></td>
|
|
||||||
<td><button type="button" class="btn btn-danger btn-xs" onclick="rimuoviMembro(this); updateResponsabiliFromMembri();"><i class="fas fa-trash"></i></button></td>
|
|
||||||
`;
|
|
||||||
tbody.appendChild(row);
|
|
||||||
membriIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateMembroInfo(select) {
|
|
||||||
const row = select.closest('tr');
|
|
||||||
const option = select.options[select.selectedIndex];
|
|
||||||
const codice = option.dataset.codice || '-';
|
|
||||||
const email = option.dataset.email || '';
|
|
||||||
const telefono = option.dataset.telefono || '';
|
|
||||||
|
|
||||||
row.querySelector('.membro-codice').textContent = codice;
|
|
||||||
|
|
||||||
let contatti = [];
|
|
||||||
if (email) contatti.push('<span class="text-primary">'+email+'</span>');
|
|
||||||
if (telefono) contatti.push('<span class="text-success">'+telefono+'</span>');
|
|
||||||
row.querySelector('.membro-contatti').innerHTML = contatti.length ? contatti.join(' | ') : '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
function rimuoviMembro(btn) {
|
|
||||||
const row = btn.closest('tr');
|
|
||||||
row.remove();
|
|
||||||
if (document.getElementById('membri-tbody').children.length === 0) {
|
|
||||||
document.getElementById('no-membri-msg').style.display = 'block';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateResponsabiliFromMembri() {
|
|
||||||
const respSelect = document.getElementById('responsabile-select');
|
|
||||||
const currentSelected = Array.from(respSelect.selectedOptions).map(o => o.value);
|
|
||||||
const tbody = document.getElementById('membri-tbody');
|
|
||||||
const rows = tbody.querySelectorAll('tr');
|
|
||||||
|
|
||||||
const membroIds = new Set();
|
|
||||||
const membroNames = new Map();
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const select = row.querySelector('select[name*="individuo_id"]');
|
|
||||||
if (select && select.value) {
|
|
||||||
membroIds.add(select.value);
|
|
||||||
const option = select.options[select.selectedIndex];
|
|
||||||
membroNames.set(select.value, option.text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
respSelect.innerHTML = '';
|
|
||||||
|
|
||||||
if (membroIds.size === 0) {
|
|
||||||
const opt = document.createElement('option');
|
|
||||||
opt.value = '';
|
|
||||||
opt.textContent = '-- Aggiungi prima dei membri --';
|
|
||||||
opt.disabled = true;
|
|
||||||
respSelect.appendChild(opt);
|
|
||||||
} else {
|
|
||||||
membroIds.forEach(id => {
|
|
||||||
const opt = document.createElement('option');
|
|
||||||
opt.value = id;
|
|
||||||
opt.textContent = membroNames.get(id);
|
|
||||||
if (currentSelected.includes(id)) opt.selected = true;
|
|
||||||
respSelect.appendChild(opt);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const respSelect = document.getElementById('responsabile-select');
|
|
||||||
const individuiList = <?php echo json_encode($individui->map(fn($i) => ['id' => $i->id, 'text' => $i->cognome . ' ' . $i->nome]), 512) ?>;
|
|
||||||
const initialResponsabili = <?php echo json_encode(old('responsabile_ids', []), 512) ?>;
|
|
||||||
|
|
||||||
const optPlaceholder = document.createElement('option');
|
|
||||||
optPlaceholder.value = '';
|
|
||||||
optPlaceholder.textContent = '-- Aggiungi prima dei membri --';
|
|
||||||
optPlaceholder.disabled = true;
|
|
||||||
respSelect.appendChild(optPlaceholder);
|
|
||||||
|
|
||||||
initialResponsabili.forEach(id => {
|
|
||||||
const match = individuiList.find(i => i.id == id);
|
|
||||||
if (match) {
|
|
||||||
const opt = document.createElement('option');
|
|
||||||
opt.value = match.id;
|
|
||||||
opt.textContent = match.text;
|
|
||||||
opt.selected = true;
|
|
||||||
respSelect.appendChild(opt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/gruppi/create.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Calendario Eventi'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Calendario Eventi'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-calendar-alt mr-2"></i>Calendario Eventi
|
|
||||||
</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<a href="<?php echo e(route('eventi.index')); ?>" class="btn btn-secondary btn-sm">
|
|
||||||
<i class="fas fa-list mr-1"></i> Elenco Eventi
|
|
||||||
</a>
|
|
||||||
<a href="<?php echo e(route('eventi.create')); ?>" class="btn btn-success btn-sm">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Nuovo Evento
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div id="calendar"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('styles'); ?>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.10/index.global.min.css">
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@6.1.10/index.global.min.js"></script>
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
var calendarEl = document.getElementById('calendar');
|
|
||||||
|
|
||||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
||||||
initialView: 'dayGridMonth',
|
|
||||||
locale: 'it',
|
|
||||||
headerToolbar: {
|
|
||||||
left: 'prev,next today',
|
|
||||||
center: 'title',
|
|
||||||
right: 'dayGridMonth,timeGridWeek,listWeek'
|
|
||||||
},
|
|
||||||
buttonText: {
|
|
||||||
today: 'Oggi',
|
|
||||||
month: 'Mese',
|
|
||||||
week: 'Settimana',
|
|
||||||
list: 'Lista'
|
|
||||||
},
|
|
||||||
eventSources: [
|
|
||||||
{
|
|
||||||
url: '/eventi/calendar/events',
|
|
||||||
method: 'GET',
|
|
||||||
extraParams: function() {
|
|
||||||
return {
|
|
||||||
_token: document.querySelector('meta[name="csrf-token"]')?.content || ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
startParam: 'start',
|
|
||||||
endParam: 'end',
|
|
||||||
success: function(response) {
|
|
||||||
console.log('Eventi caricati:', response.length, response);
|
|
||||||
},
|
|
||||||
failure: function(error) {
|
|
||||||
console.error('Errore:', error);
|
|
||||||
console.log('XHR:', error.xhr);
|
|
||||||
alert('Errore nel caricamento degli eventi. Controlla la console per dettagli.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
eventClick: function(info) {
|
|
||||||
info.jsEvent.preventDefault();
|
|
||||||
window.location.href = info.event.url;
|
|
||||||
},
|
|
||||||
eventDisplay: 'block',
|
|
||||||
displayEventTime: true,
|
|
||||||
displayEventEnd: true,
|
|
||||||
nowIndicator: true,
|
|
||||||
height: 'auto',
|
|
||||||
expandRows: true,
|
|
||||||
stickyHeaderDates: true,
|
|
||||||
dayMaxEvents: true,
|
|
||||||
eventTimeFormat: {
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit',
|
|
||||||
hour12: false
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
calendar.render();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/eventi/calendar.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Dashboard'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Dashboard'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-lg-3 col-6">
|
|
||||||
<div class="small-box bg-info">
|
|
||||||
<div class="inner">
|
|
||||||
<h3><?php echo e($stats['individui']); ?></h3>
|
|
||||||
<p>Individui</p>
|
|
||||||
</div>
|
|
||||||
<div class="icon">
|
|
||||||
<i class="fas fa-users"></i>
|
|
||||||
</div>
|
|
||||||
<a href="<?php echo e(route('individui.index')); ?>" class="small-box-footer">Visualizza <i class="fas fa-arrow-circle-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-3 col-6">
|
|
||||||
<div class="small-box bg-success">
|
|
||||||
<div class="inner">
|
|
||||||
<h3><?php echo e($stats['gruppi']); ?></h3>
|
|
||||||
<p>Gruppi</p>
|
|
||||||
</div>
|
|
||||||
<div class="icon">
|
|
||||||
<i class="fas fa-folder"></i>
|
|
||||||
</div>
|
|
||||||
<a href="<?php echo e(route('gruppi.index')); ?>" class="small-box-footer">Visualizza <i class="fas fa-arrow-circle-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-lg-3 col-6">
|
|
||||||
<div class="small-box bg-warning">
|
|
||||||
<div class="inner">
|
|
||||||
<h3><?php echo e($stats['notifiche']); ?></h3>
|
|
||||||
<p>Notifiche</p>
|
|
||||||
</div>
|
|
||||||
<div class="icon">
|
|
||||||
<i class="fas fa-bell"></i>
|
|
||||||
</div>
|
|
||||||
<a href="#" class="small-box-footer">Visualizza <i class="fas fa-arrow-circle-right"></i></a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-bell"></i> Ultime Notifiche</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php if($notifiche->count() > 0): ?>
|
|
||||||
<ul class="todo-list" data-widget="todo-list">
|
|
||||||
<?php $__currentLoopData = $notifiche; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $notifica): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<li>
|
|
||||||
<span class="text"><?php echo e($notifica->titolo); ?></span>
|
|
||||||
<small class="badge badge-info"><i class="far fa-clock"></i> <?php echo e($notifica->created_at->diffForHumans()); ?></small>
|
|
||||||
</li>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</ul>
|
|
||||||
<?php else: ?>
|
|
||||||
<p class="text-muted">Nessuna notifica</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-info-circle"></i> Benvenuto</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<?php
|
|
||||||
$appName = \App\Models\AppSetting::getAppName() ?? 'Glastree';
|
|
||||||
$orgName = \App\Models\AppSetting::getOrgName();
|
|
||||||
$welcome = \App\Models\AppSetting::getDashboardWelcome();
|
|
||||||
?>
|
|
||||||
<?php if($welcome): ?>
|
|
||||||
<p><?php echo nl2br(e($welcome)); ?></p>
|
|
||||||
<?php else: ?>
|
|
||||||
<p>Benvenuto in <strong><?php echo e(e($appName)); ?></strong><?php echo e($orgName ? ', ' . e($orgName) : ''); ?>.</p>
|
|
||||||
<?php endif; ?>
|
|
||||||
<p>Dal menu laterale puoi navigare tra le sezioni:</p>
|
|
||||||
<ul>
|
|
||||||
<li><strong>Individui</strong>: Gestione delle persone registrate</li>
|
|
||||||
<li><strong>Gruppi</strong>: Gestione della struttura organizzativa</li>
|
|
||||||
<li><strong>Documenti</strong>: Archivio documentale</li>
|
|
||||||
<li><strong>Eventi</strong>: Calendario eventi</li>
|
|
||||||
<li><strong>Mailing</strong>: Comunicazioni email</li>
|
|
||||||
</ul>
|
|
||||||
<?php if(Auth::user()->is_admin): ?>
|
|
||||||
<div class="alert alert-success mt-3">
|
|
||||||
<i class="fas fa-crown"></i> <strong>Amministratore</strong>: Hai accesso completo al sistema.
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/home/dashboard.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -20,6 +20,9 @@ $canDeleteEventi = Auth::user()->canDelete('eventi');
|
|||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title">Tutti gli Eventi</h3>
|
<h3 class="card-title">Tutti gli Eventi</h3>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
|
<a href="/eventi/calendar" class="btn btn-sm btn-outline-primary mr-2">
|
||||||
|
<i class="fas fa-calendar-alt mr-1"></i> Calendario
|
||||||
|
</a>
|
||||||
<?php if($canDeleteEventi): ?>
|
<?php if($canDeleteEventi): ?>
|
||||||
<div class="btn-group mr-2">
|
<div class="btn-group mr-2">
|
||||||
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
<button type="button" class="btn btn-sm btn-danger" onclick="deleteSelected()">
|
||||||
|
|||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?php $__env->startSection('title', $mailingList->nome); ?>
|
||||||
|
<?php $__env->startSection('page_title', $mailingList->nome); ?>
|
||||||
|
|
||||||
|
<?php $__env->startSection('content'); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><i class="fas fa-info-circle mr-2"></i>Dettagli Lista</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<dl class="row">
|
||||||
|
<dt class="col-sm-4">Nome</dt>
|
||||||
|
<dd class="col-sm-8"><?php echo e($mailingList->nome); ?></dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-4">Descrizione</dt>
|
||||||
|
<dd class="col-sm-8"><?php echo e($mailingList->descrizione ?: '-'); ?></dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-4">Stato</dt>
|
||||||
|
<dd class="col-sm-8">
|
||||||
|
<?php if($mailingList->attiva): ?>
|
||||||
|
<span class="badge badge-success">Attiva</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="badge badge-secondary">Disattiva</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-4">Creata</dt>
|
||||||
|
<dd class="col-sm-8"><?php echo e($mailingList->created_at ? $mailingList->created_at->format('d/m/Y H:i') : '-'); ?></dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-4">Creato da</dt>
|
||||||
|
<dd class="col-sm-8"><?php echo e($mailingList->user?->name ?: '-'); ?></dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-4">Contatti</dt>
|
||||||
|
<dd class="col-sm-8">
|
||||||
|
<span class="badge badge-info"><?php echo e($mailingList->contatti->count()); ?></span>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<a href="<?php echo e(route('mailing-liste.edit', $mailingList->id)); ?>" class="btn btn-warning btn-sm">
|
||||||
|
<i class="fas fa-edit mr-1"></i> Modifica
|
||||||
|
</a>
|
||||||
|
<form action="<?php echo e(route('mailing-liste.destroy', $mailingList->id)); ?>" method="POST" class="d-inline">
|
||||||
|
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Eliminare questa lista?')">
|
||||||
|
<i class="fas fa-trash mr-1"></i> Elimina
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<h3 class="card-title"><i class="fas fa-users mr-2"></i>Contatti (<?php echo e($mailingList->contatti->count()); ?>)</h3>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-0">
|
||||||
|
<?php if($mailingList->contatti->count() > 0): ?>
|
||||||
|
<table class="table table-bordered table-hover mb-0">
|
||||||
|
<thead class="thead-light">
|
||||||
|
<tr>
|
||||||
|
<th>Codice</th>
|
||||||
|
<th>Nome</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Stato</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php $__currentLoopData = $mailingList->contatti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $contact): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
<?php if($contact->individuo): ?>
|
||||||
|
<tr>
|
||||||
|
<td><span class="badge badge-secondary"><?php echo e($contact->individuo->codice_id); ?></span></td>
|
||||||
|
<td><?php echo e($contact->individuo->cognome); ?> <?php echo e($contact->individuo->nome); ?></td>
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
$email = $contact->individuo->contatti->where('tipo', 'email')->first()?->valore;
|
||||||
|
?>
|
||||||
|
<?php echo e($email ?: '-'); ?>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if($contact->opt_in): ?>
|
||||||
|
<span class="badge badge-success">Iscritto</span>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="badge badge-danger">Disiscritto</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="text-center text-muted py-4">
|
||||||
|
<p>Nessun contatto in questa lista</p>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php $__env->stopSection(); ?>
|
||||||
|
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/mailing-liste/show.blade.php ENDPATH**/ ?>
|
||||||
@@ -1,922 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Individui'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Elenco Individui'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$columnLabels = [
|
|
||||||
'codice' => 'Codice',
|
|
||||||
'cognome' => 'Cognome',
|
|
||||||
'nome' => 'Nome',
|
|
||||||
'email' => 'Email',
|
|
||||||
'telefono' => 'Telefono',
|
|
||||||
];
|
|
||||||
$vistaDefaultJson = $vista ? $vista->toJson() : 'null';
|
|
||||||
$allColumnsJson = json_encode($allColumns);
|
|
||||||
$visibleColumnsJson = json_encode($visibleColumns);
|
|
||||||
$canWriteIndividui = Auth::user()->canManage('individui');
|
|
||||||
$canDeleteIndividui = Auth::user()->canDelete('individui');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-users mr-2"></i>Lista Individui</h3>
|
|
||||||
<div class="card-tools">
|
|
||||||
<button type="button" class="btn btn-info btn-sm mr-1" onclick="toggleSearchPanel()">
|
|
||||||
<i class="fas fa-search mr-1"></i> Ricerca/Filtri
|
|
||||||
</button>
|
|
||||||
<div class="btn-group mr-1">
|
|
||||||
<button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown">
|
|
||||||
<i class="fas fa-cog mr-1"></i> Azioni
|
|
||||||
</button>
|
|
||||||
<div class="dropdown-menu">
|
|
||||||
<a class="dropdown-item" href="#" onclick="exportCSV(); return false;">
|
|
||||||
<i class="fas fa-file-csv mr-2"></i>Esporta Tutti CSV
|
|
||||||
</a>
|
|
||||||
<a class="dropdown-item" href="#" onclick="exportSelectedCSV(); return false;">
|
|
||||||
<i class="fas fa-file-csv mr-2"></i>Esporta Selezionati CSV
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item" href="#" onclick="printSelected(); return false;">
|
|
||||||
<i class="fas fa-print mr-2"></i>Stampa Selezionati
|
|
||||||
</a>
|
|
||||||
<a class="dropdown-item" href="#" onclick="emailSelected(); return false;">
|
|
||||||
<i class="fas fa-envelope mr-2"></i>Email Selezionati
|
|
||||||
</a>
|
|
||||||
<?php if($canWriteIndividui): ?>
|
|
||||||
<a class="dropdown-item" href="#" onclick="showCreateMailingListModal(); return false;">
|
|
||||||
<i class="fas fa-list mr-2"></i>Crea Mailing List
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-divider"></div>
|
|
||||||
<a class="dropdown-item text-danger" href="#" onclick="deleteSelected(); return false;">
|
|
||||||
<i class="fas fa-trash mr-2"></i>Elimina Selezionati
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<button type="button" class="btn btn-primary btn-sm" onclick="showSaveVistaModal()">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Vista
|
|
||||||
</button>
|
|
||||||
<?php if($canWriteIndividui): ?>
|
|
||||||
<a href="<?php echo e(route('individui.import')); ?>" class="btn btn-warning btn-sm ml-2">
|
|
||||||
<i class="fas fa-file-import mr-1"></i> Importa
|
|
||||||
</a>
|
|
||||||
<a href="/individui/create" class="btn btn-success btn-sm ml-2">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Nuovo
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="search-panel" class="p-3 bg-light border-bottom" style="display: none;">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="form-group mb-2">
|
|
||||||
<label class="small font-weight-bold">Cerca</label>
|
|
||||||
<input type="text" id="global-search" class="form-control form-control-sm" placeholder="Cerca in tutte le colonne..." oninput="applyGlobalSearch(this.value)">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<div class="form-group mb-2">
|
|
||||||
<label class="small font-weight-bold">Colonna</label>
|
|
||||||
<select id="filter-column" class="form-control form-control-sm">
|
|
||||||
<option value="">Tutte le colonne</option>
|
|
||||||
<?php $__currentLoopData = $allColumns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $col): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($col['key']); ?>"><?php echo e($col['label']); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="form-group mb-2">
|
|
||||||
<label class="small font-weight-bold">Operatore</label>
|
|
||||||
<select id="filter-operator" class="form-control form-control-sm">
|
|
||||||
<option value="contains">Contiene</option>
|
|
||||||
<option value="equals">Uguale a</option>
|
|
||||||
<option value="starts">Inizia con</option>
|
|
||||||
<option value="ends">Finisce con</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<div class="form-group mb-2">
|
|
||||||
<label class="small font-weight-bold">Valore</label>
|
|
||||||
<input type="text" id="filter-value" class="form-control form-control-sm" placeholder="Valore filtro">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<label class="small"> </label>
|
|
||||||
<div>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="applyColumnFilter()">
|
|
||||||
<i class="fas fa-filter"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="clearFilters()">
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-2">
|
|
||||||
<small class="text-muted">
|
|
||||||
<i class="fas fa-info-circle mr-1"></i>
|
|
||||||
Ordina cliccando sulle intestazioni delle colonne
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($individui->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0" id="individui-table">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 40px;">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="select-all" onchange="toggleSelectAll(this)">
|
|
||||||
<label class="custom-control-label" for="select-all"></label>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<?php if(in_array('codice', $visibleColumns)): ?>
|
|
||||||
<th style="width: 100px;" data-sortable="true" data-column="codice" onclick="sortTable('codice')">Codice <i class="fas fa-sort float-right"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('cognome', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" data-column="cognome" onclick="sortTable('cognome')">Cognome <i class="fas fa-sort float-right"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('nome', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" data-column="nome" onclick="sortTable('nome')">Nome <i class="fas fa-sort float-right"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('email', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" data-column="email" onclick="sortTable('email')">Email <i class="fas fa-sort float-right"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('telefono', $visibleColumns)): ?>
|
|
||||||
<th data-sortable="true" data-column="telefono" onclick="sortTable('telefono')">Telefono <i class="fas fa-sort float-right"></i></th>
|
|
||||||
<?php endif; ?>
|
|
||||||
<th style="width: 120px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="table-body">
|
|
||||||
<?php $__currentLoopData = $individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ind): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr data-id="<?php echo e($ind->id); ?>">
|
|
||||||
<td>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input row-checkbox" id="select-<?php echo e($ind->id); ?>" value="<?php echo e($ind->id); ?>">
|
|
||||||
<label class="custom-control-label" for="select-<?php echo e($ind->id); ?>"></label>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<?php if(in_array('codice', $visibleColumns)): ?>
|
|
||||||
<td><span class="badge badge-secondary"><?php echo e($ind->codice_id); ?></span></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('cognome', $visibleColumns)): ?>
|
|
||||||
<td class="font-weight-bold">
|
|
||||||
<a href="<?php echo e(url('/individui/' . $ind->id . '/edit')); ?>"><?php echo e($ind->cognome); ?></a>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('nome', $visibleColumns)): ?>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(url('/individui/' . $ind->id . '/edit')); ?>"><?php echo e($ind->nome); ?></a>
|
|
||||||
</td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('email', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($ind->getEmailPrimariaAttribute() ?: '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(in_array('telefono', $visibleColumns)): ?>
|
|
||||||
<td><?php echo e($ind->getTelefonoPrimarioAttribute() ?: '-'); ?></td>
|
|
||||||
<?php endif; ?>
|
|
||||||
<td>
|
|
||||||
<?php if($canWriteIndividui): ?>
|
|
||||||
<a href="<?php echo e(url('/individui/' . $ind->id . '/edit')); ?>" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canDeleteIndividui): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger" onclick="showDeleteModal(<?php echo e($ind->id); ?>, '<?php echo e($ind->cognome); ?> <?php echo e($ind->nome); ?>')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="printIndividuo(<?php echo e($ind->id); ?>)" title="Stampa">
|
|
||||||
<i class="fas fa-print"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="exportIndividuoCSV(<?php echo e($ind->id); ?>)" title="Esporta CSV">
|
|
||||||
<i class="fas fa-download"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-info" onclick="sendEmail(<?php echo e($ind->id); ?>)" title="Invia Email">
|
|
||||||
<i class="fas fa-envelope"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-dark" onclick="generateReport(<?php echo e($ind->id); ?>)" title="Genera Report">
|
|
||||||
<i class="fas fa-chart-bar"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-5">
|
|
||||||
<i class="fas fa-users fa-3x mb-3"></i>
|
|
||||||
<p>Nessun individuo presente</p>
|
|
||||||
<?php if($canWriteIndividui): ?>
|
|
||||||
<a href="/individui/create" class="btn btn-success">Crea il primo individuo</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php if($individui->count() > 0): ?>
|
|
||||||
<div class="card-footer">
|
|
||||||
<?php echo e($individui->links()); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="saveVistaModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-save mr-2"></i>Salva Vista</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome Vista *</label>
|
|
||||||
<input type="text" id="vista-nome" class="form-control" placeholder="Es. Elenco soci attivi">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Colonne visibili</label>
|
|
||||||
<div class="row" id="colonne-checkboxes">
|
|
||||||
<?php $__currentLoopData = $allColumns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $col): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input col-visibile" id="col-vis-<?php echo e($col['key']); ?>" value="<?php echo e($col['key']); ?>" <?php echo e(in_array($col['key'], $visibleColumns) ? 'checked' : ''); ?>>
|
|
||||||
<label class="custom-control-label" for="col-vis-<?php echo e($col['key']); ?>"><?php echo e($col['label']); ?></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="vista-default" value="true">
|
|
||||||
<label class="custom-control-label" for="vista-default">Imposta come vista predefinita</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-primary" onclick="saveVista()">Salva</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="colonneModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-columns mr-2"></i>Colonne Visibili</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="row">
|
|
||||||
<?php $__currentLoopData = $allColumns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $col): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input col-toggle" id="col-toggle-<?php echo e($col['key']); ?>" value="<?php echo e($col['key']); ?>" <?php echo e(in_array($col['key'], $visibleColumns) ? 'checked' : ''); ?> onchange="toggleColumn('<?php echo e($col['key']); ?>', this.checked)">
|
|
||||||
<label class="custom-control-label" for="col-toggle-<?php echo e($col['key']); ?>"><?php echo e($col['label']); ?></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog">
|
|
||||||
<?php if($canDeleteIndividui): ?>
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-danger">
|
|
||||||
<h5 class="modal-title text-white"><i class="fas fa-trash-alt mr-2"></i>Conferma Eliminazione</h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<p>Stai per eliminare l'individuo: <strong id="delete-individuo-name"></strong></p>
|
|
||||||
<p class="text-muted">Seleziona gli elementi collegati da eliminare:</p>
|
|
||||||
<div class="ml-3">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="delete-contatti" checked>
|
|
||||||
<label class="custom-control-label" for="delete-contatti">Contatti (<span id="count-contatti">0</span>)</label>
|
|
||||||
</div>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="delete-gruppi">
|
|
||||||
<label class="custom-control-label" for="delete-gruppi">Gruppi (<span id="count-gruppi">0</span>) - solo scollegamento</label>
|
|
||||||
</div>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="delete-documenti" checked>
|
|
||||||
<label class="custom-control-label" for="delete-documenti">Documenti (<span id="count-documenti">0</span>)</label>
|
|
||||||
</div>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="delete-eventi">
|
|
||||||
<label class="custom-control-label" for="delete-eventi">Eventi (<span id="count-eventi">0</span>) - solo scollegamento</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="alert alert-warning mt-3 mb-0">
|
|
||||||
<small><i class="fas fa-info-circle mr-1"></i>Se non selezionato, l'elemento verrà scollegato ma non eliminato.</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-danger" id="confirm-delete-btn" onclick="confirmDelete()">Elimina</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="createMailingListModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-info">
|
|
||||||
<h5 class="modal-title text-white"><i class="fas fa-list mr-2"></i>Crea Mailing List</h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome Lista *</label>
|
|
||||||
<input type="text" id="ml-nome" class="form-control" placeholder="Es. Newsletter Maggio 2026">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Descrizione</label>
|
|
||||||
<textarea id="ml-descrizione" class="form-control" rows="2" placeholder="Descrizione opzionale"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Contatti inclusi (<span id="ml-count">0</span>)</label>
|
|
||||||
<div class="table-responsive" style="max-height: 300px; overflow-y: auto;">
|
|
||||||
<table class="table table-bordered table-sm" id="ml-contatti-table">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 40px;">
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input" id="ml-select-all" onchange="toggleMlSelectAll(this)">
|
|
||||||
<label class="custom-control-label" for="ml-select-all"></label>
|
|
||||||
</div>
|
|
||||||
</th>
|
|
||||||
<th>Codice</th>
|
|
||||||
<th>Cognome</th>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Email</th>
|
|
||||||
<th style="width: 50px;"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody id="ml-contatti-tbody">
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="button" class="btn btn-success" onclick="createMailingList()">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Lista
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
let currentSort = { column: null, direction: 'asc' };
|
|
||||||
let columnVisibility = <?php echo json_encode(array_column($allColumns, 'key')); ?>;
|
|
||||||
|
|
||||||
function toggleSearchPanel() {
|
|
||||||
const panel = document.getElementById('search-panel');
|
|
||||||
panel.style.display = panel.style.display === 'none' ? 'block' : 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyGlobalSearch(value) {
|
|
||||||
const rows = document.querySelectorAll('#table-body tr');
|
|
||||||
const searchTerm = value.toLowerCase();
|
|
||||||
rows.forEach(row => {
|
|
||||||
const text = row.textContent.toLowerCase();
|
|
||||||
row.style.display = text.includes(searchTerm) ? '' : 'none';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyColumnFilter() {
|
|
||||||
const col = document.getElementById('filter-column').value;
|
|
||||||
const op = document.getElementById('filter-operator').value;
|
|
||||||
const val = document.getElementById('filter-value').value.toLowerCase();
|
|
||||||
|
|
||||||
if (!col || !val) return;
|
|
||||||
|
|
||||||
const rows = document.querySelectorAll('#table-body tr');
|
|
||||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, azioni: 6 }[col];
|
|
||||||
|
|
||||||
rows.forEach(row => {
|
|
||||||
const cells = row.querySelectorAll('td');
|
|
||||||
const cellText = cells[colIndex]?.textContent.toLowerCase() || '';
|
|
||||||
let matches = false;
|
|
||||||
|
|
||||||
switch(op) {
|
|
||||||
case 'contains': matches = cellText.includes(val); break;
|
|
||||||
case 'equals': matches = cellText === val; break;
|
|
||||||
case 'starts': matches = cellText.startsWith(val); break;
|
|
||||||
case 'ends': matches = cellText.endsWith(val); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
row.style.display = matches ? '' : 'none';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearFilters() {
|
|
||||||
document.getElementById('global-search').value = '';
|
|
||||||
document.getElementById('filter-column').value = '';
|
|
||||||
document.getElementById('filter-value').value = '';
|
|
||||||
document.querySelectorAll('#table-body tr').forEach(row => row.style.display = '');
|
|
||||||
}
|
|
||||||
|
|
||||||
function sortTable(column) {
|
|
||||||
if (currentSort.column === column) {
|
|
||||||
currentSort.direction = currentSort.direction === 'asc' ? 'desc' : 'asc';
|
|
||||||
} else {
|
|
||||||
currentSort = { column: column, direction: 'asc' };
|
|
||||||
}
|
|
||||||
|
|
||||||
const colIndex = { codice: 0, cognome: 1, nome: 2, email: 3, telefono: 4, azioni: 5 }[column];
|
|
||||||
const tbody = document.getElementById('table-body');
|
|
||||||
const rows = Array.from(tbody.querySelectorAll('tr'));
|
|
||||||
|
|
||||||
rows.sort((a, b) => {
|
|
||||||
const aVal = a.querySelectorAll('td')[colIndex]?.textContent.trim() || '';
|
|
||||||
const bVal = b.querySelectorAll('td')[colIndex]?.textContent.trim() || '';
|
|
||||||
const cmp = aVal.localeCompare(bVal, undefined, { numeric: true });
|
|
||||||
return currentSort.direction === 'asc' ? cmp : -cmp;
|
|
||||||
});
|
|
||||||
|
|
||||||
rows.forEach(row => tbody.appendChild(row));
|
|
||||||
|
|
||||||
document.querySelectorAll('th[data-sortable]').forEach(th => {
|
|
||||||
const icon = th.querySelector('i');
|
|
||||||
if (th.dataset.column === column) {
|
|
||||||
icon.className = currentSort.direction === 'asc' ? 'fas fa-sort-up float-right' : 'fas fa-sort-down float-right';
|
|
||||||
} else {
|
|
||||||
icon.className = 'fas fa-sort float-right';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleColumn(column, visible) {
|
|
||||||
const colIndex = { codice: 1, cognome: 2, nome: 3, email: 4, telefono: 5, azioni: 6 }[column];
|
|
||||||
const ths = document.querySelectorAll('#individui-table thead th');
|
|
||||||
const rows = document.querySelectorAll('#table-body tr');
|
|
||||||
|
|
||||||
if (visible) {
|
|
||||||
ths[colIndex].style.display = '';
|
|
||||||
rows.forEach(row => {
|
|
||||||
row.querySelectorAll('td')[colIndex].style.display = '';
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
ths[colIndex].style.display = 'none';
|
|
||||||
rows.forEach(row => {
|
|
||||||
row.querySelectorAll('td')[colIndex].style.display = 'none';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function saveVista() {
|
|
||||||
let nome = document.getElementById('vista-nome').value.trim();
|
|
||||||
if (!nome) {
|
|
||||||
const now = new Date();
|
|
||||||
nome = 'Vista ' + now.toLocaleDateString('it-IT') + ' ' + now.toLocaleTimeString('it-IT', { hour: '2-digit', minute: '2-digit' });
|
|
||||||
}
|
|
||||||
|
|
||||||
const colonneVisibili = Array.from(document.querySelectorAll('#colonne-checkboxes input:checked')).map(i => i.value);
|
|
||||||
const isDefault = document.getElementById('vista-default').checked;
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
nome: nome,
|
|
||||||
tipo: 'individui',
|
|
||||||
colonne_visibili: colonneVisibili,
|
|
||||||
colonne_ordinamento: currentSort.column ? [[currentSort.column, currentSort.direction]] : [],
|
|
||||||
ricerca: document.getElementById('global-search').value,
|
|
||||||
is_default: isDefault
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('/viste', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
alert('Vista salvata!');
|
|
||||||
$('#saveVistaModal').modal('hide');
|
|
||||||
} else {
|
|
||||||
alert('Errore salvataggio');
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
alert('Errore: ' + e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleSelectAll(source) {
|
|
||||||
const checkboxes = document.querySelectorAll('.row-checkbox');
|
|
||||||
checkboxes.forEach(cb => {
|
|
||||||
cb.checked = source.checked;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportCSV() {
|
|
||||||
window.location.href = '/individui/export';
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportSelectedCSV() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
selectedIds.forEach(function(id) {
|
|
||||||
params.append('ids[]', id);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.location.href = '/individui/export?' + params.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
let deleteIndividuoId = null;
|
|
||||||
|
|
||||||
async function showDeleteModal(id, nome) {
|
|
||||||
deleteIndividuoId = id;
|
|
||||||
document.getElementById('delete-individuo-name').textContent = nome;
|
|
||||||
|
|
||||||
document.getElementById('count-contatti').textContent = '...';
|
|
||||||
document.getElementById('count-gruppi').textContent = '...';
|
|
||||||
document.getElementById('count-documenti').textContent = '...';
|
|
||||||
document.getElementById('count-eventi').textContent = '...';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(`/individui/${id}/collegati`);
|
|
||||||
const data = await response.json();
|
|
||||||
document.getElementById('count-contatti').textContent = data.contatti;
|
|
||||||
document.getElementById('count-gruppi').textContent = data.gruppi;
|
|
||||||
document.getElementById('count-documenti').textContent = data.documenti;
|
|
||||||
document.getElementById('count-eventi').textContent = data.eventi;
|
|
||||||
} catch(e) {
|
|
||||||
console.error('Errore recupero dati:', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#deleteModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
function confirmDelete() {
|
|
||||||
const eliminaContatti = document.getElementById('delete-contatti').checked;
|
|
||||||
const eliminaDocumenti = document.getElementById('delete-documenti').checked;
|
|
||||||
|
|
||||||
const form = document.createElement('form');
|
|
||||||
form.method = 'POST';
|
|
||||||
form.action = `/individui/${deleteIndividuoId}/elimina`;
|
|
||||||
|
|
||||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '<?php echo e(csrf_token()); ?>';
|
|
||||||
form.innerHTML = `
|
|
||||||
<input type="hidden" name="_token" value="${csrfToken}">
|
|
||||||
<input type="hidden" name="elimina_contatti" value="${eliminaContatti}">
|
|
||||||
<input type="hidden" name="elimina_documenti" value="${eliminaDocumenti}">
|
|
||||||
`;
|
|
||||||
|
|
||||||
document.body.appendChild(form);
|
|
||||||
form.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
function printIndividuo(id) {
|
|
||||||
window.open('/individui/' + id + '/report', '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportIndividuoCSV(id) {
|
|
||||||
const row = document.querySelector(`tr[data-id="${id}"]`);
|
|
||||||
if (!row) return;
|
|
||||||
|
|
||||||
const cells = Array.from(row.querySelectorAll('td'));
|
|
||||||
const data = {
|
|
||||||
codice: cells[1].textContent.trim(),
|
|
||||||
cognome: cells[2].textContent.trim(),
|
|
||||||
nome: cells[3].textContent.trim(),
|
|
||||||
email: cells[4].textContent.trim(),
|
|
||||||
telefono: cells[5].textContent.trim()
|
|
||||||
};
|
|
||||||
|
|
||||||
const csv = `Codice,Cognome,Nome,Email,Telefono\n"${data.codice}","${data.cognome}","${data.nome}","${data.email}","${data.telefono}"`;
|
|
||||||
const blob = new Blob([csv], { type: 'text/csv' });
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = `individuo_${data.codice}.csv`;
|
|
||||||
a.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendEmail(id) {
|
|
||||||
window.location.href = `/mailing/nuovo?individui=${id}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateReport(id) {
|
|
||||||
window.open('/individui/' + id + '/report', '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSelectedIds() {
|
|
||||||
return Array.from(document.querySelectorAll('.row-checkbox:checked')).map(cb => cb.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function exportSelectedCSV() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rows = [];
|
|
||||||
rows.push('Codice,Cognome,Nome,Email,Telefono');
|
|
||||||
|
|
||||||
document.querySelectorAll('#table-body tr').forEach(row => {
|
|
||||||
const checkbox = row.querySelector('.row-checkbox');
|
|
||||||
if (checkbox && checkbox.checked) {
|
|
||||||
const cells = Array.from(row.querySelectorAll('td'));
|
|
||||||
const codice = cells[1].textContent.trim();
|
|
||||||
const cognome = cells[2].textContent.trim();
|
|
||||||
const nome = cells[3].textContent.trim();
|
|
||||||
const email = cells[4].textContent.trim();
|
|
||||||
const telefono = cells[5].textContent.trim();
|
|
||||||
rows.push(`"${codice}","${cognome}","${nome}","${email}","${telefono}"`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const blob = new Blob([rows.join('\n')], { type: 'text/csv' });
|
|
||||||
const url = URL.createObjectURL(blob);
|
|
||||||
const a = document.createElement('a');
|
|
||||||
a.href = url;
|
|
||||||
a.download = `individui_selezionati_${new Date().toISOString().slice(0,10)}.csv`;
|
|
||||||
a.click();
|
|
||||||
}
|
|
||||||
|
|
||||||
function printSelected() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.open(`/individui/report/stampa?ids=${selectedIds.join(',')}`, '_blank');
|
|
||||||
}
|
|
||||||
|
|
||||||
function emailSelected() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.location.href = `/mailing/nuovo?individui=${selectedIds.join(',')}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteSelected() {
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
if (selectedIds.length === 0) {
|
|
||||||
alert('Seleziona almeno un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('delete-individuo-name').textContent = selectedIds.length + ' individui selezionati';
|
|
||||||
document.getElementById('count-contatti').textContent = '...';
|
|
||||||
document.getElementById('count-gruppi').textContent = '...';
|
|
||||||
document.getElementById('count-documenti').textContent = '...';
|
|
||||||
document.getElementById('count-eventi').textContent = '...';
|
|
||||||
|
|
||||||
document.getElementById('confirm-delete-btn').onclick = function() {
|
|
||||||
const eliminaContatti = document.getElementById('delete-contatti').checked;
|
|
||||||
const eliminaDocumenti = document.getElementById('delete-documenti').checked;
|
|
||||||
|
|
||||||
const form = document.createElement('form');
|
|
||||||
form.method = 'POST';
|
|
||||||
form.action = '/individui/mass-elimina';
|
|
||||||
|
|
||||||
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content || '<?php echo e(csrf_token()); ?>';
|
|
||||||
|
|
||||||
let html = `<input type="hidden" name="_token" value="${csrfToken}">`;
|
|
||||||
html += `<input type="hidden" name="elimina_contatti" value="${eliminaContatti}">`;
|
|
||||||
html += `<input type="hidden" name="elimina_documenti" value="${eliminaDocumenti}">`;
|
|
||||||
|
|
||||||
selectedIds.forEach(function(id) {
|
|
||||||
html += `<input type="hidden" name="ids[]" value="${id}">`;
|
|
||||||
});
|
|
||||||
|
|
||||||
form.innerHTML = html;
|
|
||||||
document.body.appendChild(form);
|
|
||||||
form.submit();
|
|
||||||
};
|
|
||||||
|
|
||||||
$('#deleteModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
const csrfToken = document.querySelector('meta[name="csrf-token"]');
|
|
||||||
if (!csrfToken) {
|
|
||||||
const meta = document.createElement('meta');
|
|
||||||
meta.name = 'csrf-token';
|
|
||||||
meta.content = '<?php echo e(csrf_token()); ?>';
|
|
||||||
document.head.appendChild(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
const visibleCols = <?php echo $visibleColumnsJson; ?>;
|
|
||||||
const allCols = <?php echo $allColumnsJson; ?>;
|
|
||||||
|
|
||||||
allCols.forEach(function(col) {
|
|
||||||
const visibile = visibleCols.includes(col.key);
|
|
||||||
const saveCheckbox = document.querySelector(`#col-vis-${col.key}`);
|
|
||||||
const toggleCheckbox = document.querySelector(`#col-toggle-${col.key}`);
|
|
||||||
if (saveCheckbox) saveCheckbox.checked = visibile;
|
|
||||||
if (toggleCheckbox) toggleCheckbox.checked = visibile;
|
|
||||||
});
|
|
||||||
|
|
||||||
const vistaDefault = <?php echo $vistaDefaultJson; ?>;
|
|
||||||
if (vistaDefault && vistaDefault.ricerca) {
|
|
||||||
document.getElementById('global-search').value = vistaDefault.ricerca;
|
|
||||||
applyGlobalSearch(vistaDefault.ricerca);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function showCreateMailingListModal() {
|
|
||||||
document.getElementById('ml-nome').value = '';
|
|
||||||
document.getElementById('ml-descrizione').value = '';
|
|
||||||
document.getElementById('ml-contatti-tbody').innerHTML = '';
|
|
||||||
document.getElementById('ml-count').textContent = '0';
|
|
||||||
|
|
||||||
const selectedIds = getSelectedIds();
|
|
||||||
console.log('Selected IDs:', selectedIds);
|
|
||||||
if (selectedIds.length > 0) {
|
|
||||||
const url = '/individui/email-list?ids=' + selectedIds.join(',');
|
|
||||||
console.log('Fetching URL:', url);
|
|
||||||
fetch(url, {
|
|
||||||
credentials: 'include',
|
|
||||||
headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
console.log('Response status:', response.status);
|
|
||||||
console.log('Response type:', response.headers.get('content-type'));
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => {
|
|
||||||
console.log('Full error response:', text.substring(0, 500));
|
|
||||||
const contentType = response.headers.get('content-type');
|
|
||||||
if (contentType && contentType.includes('application/json')) {
|
|
||||||
const json = JSON.parse(text);
|
|
||||||
throw new Error(json.message || 'Errore HTTP ' + response.status);
|
|
||||||
} else {
|
|
||||||
throw new Error('Server returned HTML (status ' + response.status + ') - probabilmente sessione scaduta. Ricarica la pagina.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
console.log('Data:', data);
|
|
||||||
updateMlTable(data);
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
console.error('Error:', err);
|
|
||||||
alert('Errore caricamento contatti: ' + err.message + '\nURL: ' + url);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('Seleziona almeno un individuo dalla tabella');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#createMailingListModal').modal('show');
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateMlTable(data) {
|
|
||||||
const tbody = document.getElementById('ml-contatti-tbody');
|
|
||||||
const existingIds = new Set();
|
|
||||||
|
|
||||||
document.querySelectorAll('.ml-row-checkbox').forEach(function(cb) {
|
|
||||||
existingIds.add(parseInt(cb.value));
|
|
||||||
});
|
|
||||||
|
|
||||||
data.forEach(function(item) {
|
|
||||||
if (existingIds.has(item.id)) return;
|
|
||||||
|
|
||||||
const tr = document.createElement('tr');
|
|
||||||
const checked = item.email_count === 1 ? 'checked' : '';
|
|
||||||
tr.innerHTML = `
|
|
||||||
<td>
|
|
||||||
<div class="custom-control custom-checkbox">
|
|
||||||
<input type="checkbox" class="custom-control-input ml-row-checkbox" id="ml-${item.id}" value="${item.id}" data-email="${item.email || ''}" ${checked}>
|
|
||||||
<label class="custom-control-label" for="ml-${item.id}"></label>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td><span class="badge badge-secondary">${item.codice_id}</span></td>
|
|
||||||
<td>${item.cognome}</td>
|
|
||||||
<td>${item.nome}</td>
|
|
||||||
<td>
|
|
||||||
${item.email_count === 1 ? (item.email || '-') :
|
|
||||||
'<select class="form-control form-control-sm" onchange="updateMlCheckboxEmail(' + item.id + ', this.value)">' +
|
|
||||||
'<option value="">Seleziona email...</option>' +
|
|
||||||
(item.emails || []).map(function(e) { return '<option value="' + e + '">' + e + '</option>'; }).join('') +
|
|
||||||
'</select>'}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger" onclick="this.closest('tr').remove(); updateMlCount();">
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
`;
|
|
||||||
tbody.appendChild(tr);
|
|
||||||
});
|
|
||||||
|
|
||||||
updateMlCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateMlCount() {
|
|
||||||
document.getElementById('ml-count').textContent = document.querySelectorAll('.ml-row-checkbox').length;
|
|
||||||
}
|
|
||||||
|
|
||||||
function toggleMlSelectAll(source) {
|
|
||||||
document.querySelectorAll('.ml-row-checkbox').forEach(function(cb) {
|
|
||||||
cb.checked = source.checked;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateMlCheckboxEmail(id, email) {
|
|
||||||
const checkbox = document.getElementById('ml-' + id);
|
|
||||||
if (checkbox) {
|
|
||||||
checkbox.dataset.email = email;
|
|
||||||
checkbox.checked = email !== '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function createMailingList() {
|
|
||||||
const nome = document.getElementById('ml-nome').value.trim();
|
|
||||||
if (!nome) {
|
|
||||||
alert('Inserisci un nome per la lista');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const selected = [];
|
|
||||||
document.querySelectorAll('.ml-row-checkbox:checked').forEach(function(cb) {
|
|
||||||
if (cb.dataset.email) {
|
|
||||||
selected.push({
|
|
||||||
individuo_id: parseInt(cb.value),
|
|
||||||
email: cb.dataset.email
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (selected.length === 0) {
|
|
||||||
alert('Seleziona almeno un contatto con email');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = {
|
|
||||||
nome: nome,
|
|
||||||
descrizione: document.getElementById('ml-descrizione').value.trim(),
|
|
||||||
contatti: selected
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('/mailing-liste/create-from-individui', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content || ''
|
|
||||||
},
|
|
||||||
body: JSON.stringify(data)
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
alert('Mailing list creata con successo!');
|
|
||||||
$('#createMailingListModal').modal('hide');
|
|
||||||
} else {
|
|
||||||
alert('Errore nella creazione della lista');
|
|
||||||
}
|
|
||||||
} catch(e) {
|
|
||||||
alert('Errore: ' + e.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/individui/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
<?php
|
|
||||||
use App\Models\AppSetting;
|
|
||||||
$appLogo = AppSetting::getLogoUrl();
|
|
||||||
$appName = AppSetting::getAppName() ?? 'Glastree';
|
|
||||||
$appOrgName = AppSetting::getOrgName() ?? '';
|
|
||||||
?>
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="it">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>Accedi - <?php echo e(e($appName)); ?></title>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
||||||
</head>
|
|
||||||
<body class="hold-transition login-page">
|
|
||||||
<div class="login-box">
|
|
||||||
<div class="login-logo">
|
|
||||||
<a href="/">
|
|
||||||
<?php if($appLogo): ?>
|
|
||||||
<img src="<?php echo e($appLogo); ?>" alt="Logo" style="max-height: 80px; max-width: 200px;">
|
|
||||||
<?php else: ?>
|
|
||||||
<i class="fas fa-tree text-success"></i> <b><?php echo e(e($appName)); ?></b>
|
|
||||||
<?php endif; ?>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php if($appOrgName): ?>
|
|
||||||
<div class="text-center mb-3">
|
|
||||||
<small class="text-muted"><?php echo e(e($appOrgName)); ?></small>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-body login-card-body">
|
|
||||||
<p class="login-box-msg">Accedi per continuare</p>
|
|
||||||
<form action="<?php echo e(route('login')); ?>" method="POST">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<div class="input-group mb-3">
|
|
||||||
<input type="email" name="email" class="form-control <?php $__errorArgs = ['email'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>" placeholder="Email" required>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<div class="input-group-text">
|
|
||||||
<span class="fas fa-envelope"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__errorArgs = ['email'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?>
|
|
||||||
<span class="invalid-feedback"><?php echo e($message); ?></span>
|
|
||||||
<?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>
|
|
||||||
</div>
|
|
||||||
<div class="input-group mb-3">
|
|
||||||
<input type="password" name="password" class="form-control <?php $__errorArgs = ['password'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>" placeholder="Password" required>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<div class="input-group-text">
|
|
||||||
<span class="fas fa-lock"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__errorArgs = ['password'];
|
|
||||||
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
|
|
||||||
if ($__bag->has($__errorArgs[0])) :
|
|
||||||
if (isset($message)) { $__messageOriginal = $message; }
|
|
||||||
$message = $__bag->first($__errorArgs[0]); ?>
|
|
||||||
<span class="invalid-feedback"><?php echo e($message); ?></span>
|
|
||||||
<?php unset($message);
|
|
||||||
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
|
|
||||||
endif;
|
|
||||||
unset($__errorArgs, $__bag); ?>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-8">
|
|
||||||
<div class="icheck-primary">
|
|
||||||
<input type="checkbox" id="remember">
|
|
||||||
<label for="remember">Ricordami</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-4">
|
|
||||||
<button type="submit" class="btn btn-success btn-block">Accedi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
<p class="mb-0 text-center mt-3">
|
|
||||||
<a href="<?php echo e(route('register')); ?>" class="text-center">Non hai un account? Registrati</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
||||||
</body>
|
|
||||||
</html><?php /**PATH /var/www/html/glastree/resources/views/auth/login.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,529 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Dettaglio Gruppo'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Dettaglio Gruppo'); ?>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$canWriteGruppi = Auth::user()->canManage('gruppi');
|
|
||||||
$canDeleteGruppi = Auth::user()->canDelete('gruppi');
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('breadcrumbs'); ?>
|
|
||||||
<li class="breadcrumb-item"><a href="<?php echo e(route('gruppi.index')); ?>">Gruppi</a></li>
|
|
||||||
<li class="breadcrumb-item active"><?php echo e($gruppo->nome); ?></li>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php if(session('success')): ?>
|
|
||||||
<div class="alert alert-success alert-dismissible">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<?php echo e(session('success')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if(session('error')): ?>
|
|
||||||
<div class="alert alert-danger alert-dismissible">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<?php echo e(session('error')); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card card-success">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-folder text-warning mr-2"></i>
|
|
||||||
<?php echo e($gruppo->nome); ?>
|
|
||||||
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-sm table-borderless">
|
|
||||||
<tr>
|
|
||||||
<td style="width: 130px;"><strong>Path:</strong></td>
|
|
||||||
<td class="text-muted small"><?php echo e($gruppo->full_path); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Gruppo Padre:</strong></td>
|
|
||||||
<td>
|
|
||||||
<?php if($gruppo->parent): ?>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $gruppo->parent->id)); ?>"><?php echo e($gruppo->parent->nome); ?></a>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="badge badge-success">Gruppo radice</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Diocesi:</strong></td>
|
|
||||||
<td><?php echo e($gruppo->diocesi?->nome ?? '-'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Responsabili:</strong></td>
|
|
||||||
<td>
|
|
||||||
<?php $responsabili = $gruppo->getResponsabili() ?>
|
|
||||||
<?php if($responsabili->count() > 0): ?>
|
|
||||||
<?php $__currentLoopData = $responsabili; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $resp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<a href="<?php echo e(route('individui.show', $resp->id)); ?>">
|
|
||||||
<i class="fas fa-user text-info mr-1"></i>
|
|
||||||
<?php echo e($resp->nome_completo); ?>
|
|
||||||
|
|
||||||
</a><br>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-map-marker-alt mr-2"></i>Luogo Incontro</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-sm table-borderless mb-0">
|
|
||||||
<tr>
|
|
||||||
<td style="width: 100px;"><strong>Indirizzo:</strong></td>
|
|
||||||
<td><?php echo e($gruppo->indirizzo_incontro ?: '-'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>CAP:</strong></td>
|
|
||||||
<td><?php echo e($gruppo->cap_incontro ?: '-'); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Città:</strong></td>
|
|
||||||
<td><?php echo e($gruppo->città_incontro ?: '-'); ?> <?php echo e($gruppo->sigla_provincia_incontro ? "({$gruppo->sigla_provincia_incontro})" : ''); ?></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<?php if($gruppo->mappa_posizione): ?>
|
|
||||||
<a href="<?php echo e($gruppo->mappa_posizione); ?>" target="_blank" class="btn btn-sm btn-outline-primary mt-2">
|
|
||||||
<i class="fas fa-external-link-alt mr-1"></i> Visualizza su mappa
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-chart-pie mr-2"></i>Statistiche</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="row text-center">
|
|
||||||
<div class="col-6">
|
|
||||||
<div class="border-right">
|
|
||||||
<h2 class="mb-0 text-primary"><?php echo e($gruppo->individui->count()); ?></h2>
|
|
||||||
<small class="text-muted">Membri</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-6">
|
|
||||||
<h2 class="mb-0 text-warning"><?php echo e($gruppo->children->count()); ?></h2>
|
|
||||||
<small class="text-muted">Sottogruppi</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
$incontroEvento = $gruppo->eventi->where('is_incontro_gruppo', true)->first();
|
|
||||||
?>
|
|
||||||
<?php if($incontroEvento): ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<div class="card card-success">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-calendar-check mr-2"></i>
|
|
||||||
Giorno di Incontro
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<table class="table table-sm table-borderless mb-0">
|
|
||||||
<tr>
|
|
||||||
<td style="width: 100px;"><strong>Evento:</strong></td>
|
|
||||||
<td><?php echo e($incontroEvento->nome_evento); ?></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Quando:</strong></td>
|
|
||||||
<td>
|
|
||||||
<?php if($incontroEvento->tipo_recorrenza === 'settimanale'): ?>
|
|
||||||
<?php echo e($incontroEvento->giorno_settimana_label); ?>
|
|
||||||
|
|
||||||
<span class="badge badge-info ml-1">Settimanale</span>
|
|
||||||
<?php elseif($incontroEvento->tipo_recorrenza === 'mensile'): ?>
|
|
||||||
<?php echo e($incontroEvento->occorrenza_mensile_label); ?>
|
|
||||||
|
|
||||||
<?php if($incontroEvento->mesi_recorrenza): ?>
|
|
||||||
<small class="text-muted">(<?php echo e($incontroEvento->mesi_recorrenza_label); ?>)</small>
|
|
||||||
<?php endif; ?>
|
|
||||||
<span class="badge badge-info ml-1">Mensile</span>
|
|
||||||
<?php elseif($incontroEvento->tipo_recorrenza === 'annuale'): ?>
|
|
||||||
<?php echo e($incontroEvento->mese_annuale_label); ?>
|
|
||||||
|
|
||||||
<span class="badge badge-info ml-1">Annuale</span>
|
|
||||||
<?php elseif($incontroEvento->tipo_recorrenza === 'altro'): ?>
|
|
||||||
<?php echo e($incontroEvento->giorno_settimana_label); ?>
|
|
||||||
|
|
||||||
<span class="badge badge-info ml-1">Altro</span>
|
|
||||||
<?php else: ?>
|
|
||||||
<?php echo e($incontroEvento->data_specifica?->format('d/m/Y') ?: '-'); ?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php if($incontroEvento->ora_inizio): ?>
|
|
||||||
<tr>
|
|
||||||
<td><strong>Ora:</strong></td>
|
|
||||||
<td>ore <?php echo e($incontroEvento->ora_inizio->format('H:i')); ?></td>
|
|
||||||
</tr>
|
|
||||||
<?php endif; ?>
|
|
||||||
</table>
|
|
||||||
<?php if($incontroEvento->responsabili->count() > 0): ?>
|
|
||||||
<hr>
|
|
||||||
<small class="text-muted"><strong>Responsabili:</strong></small>
|
|
||||||
<?php $__currentLoopData = $incontroEvento->responsabili; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $resp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<div class="mt-1">
|
|
||||||
<i class="fas fa-user text-info mr-1"></i>
|
|
||||||
<a href="/individui/<?php echo e($resp->id); ?>"><?php echo e($resp->cognome); ?> <?php echo e($resp->nome); ?></a>
|
|
||||||
<?php if($resp->telefono_primario): ?>
|
|
||||||
<br><small class="text-success ml-3"><?php echo e($resp->telefono_primario); ?></small>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
<div class="mt-2">
|
|
||||||
<a href="/eventi/<?php echo e($incontroEvento->id); ?>" class="btn btn-xs btn-outline-primary">
|
|
||||||
<i class="fas fa-eye mr-1"></i> Vedi evento
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if($gruppo->descrizione): ?>
|
|
||||||
<div class="row mt-3">
|
|
||||||
<div class="col-md-8">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-align-left mr-2"></i>Descrizione</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<p class="mb-0"><?php echo nl2br(e($gruppo->descrizione)); ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-users mr-2"></i>Membri (<?php echo e($gruppo->individui->count()); ?>)
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($gruppo->individui->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 100px;">Codice</th>
|
|
||||||
<th>Nome Completo</th>
|
|
||||||
<th>Email</th>
|
|
||||||
<th>Telefono</th>
|
|
||||||
<th style="width: 150px;">Ruolo</th>
|
|
||||||
<th style="width: 110px;">Data Adesione</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $gruppo->individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $individuo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td><span class="badge badge-secondary"><?php echo e($individuo->codice_id); ?></span></td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('individui.show', $individuo->id)); ?>">
|
|
||||||
<i class="fas fa-user text-info mr-1"></i>
|
|
||||||
<?php echo e($individuo->cognome); ?> <?php echo e($individuo->nome); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($individuo->email_primaria ?? '-'); ?></td>
|
|
||||||
<td><?php echo e($individuo->telefono_primario ?? '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
$ruoloIds = $individuo->pivot->ruolo_ids ? json_decode($individuo->pivot->ruolo_ids, true) : [];
|
|
||||||
$ruoli = \App\Models\Ruolo::findByIds($ruoloIds);
|
|
||||||
?>
|
|
||||||
<?php if($ruoli->count() > 0): ?>
|
|
||||||
<?php $__currentLoopData = $ruoli; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<span class="badge badge-info mr-1"><?php echo e($ruolo->nome); ?></span>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php if($individuo->pivot->data_adesione): ?>
|
|
||||||
<?php echo e(\Carbon\Carbon::parse($individuo->pivot->data_adesione)->format('d/m/Y')); ?>
|
|
||||||
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('individui.show', $individuo->id)); ?>" class="btn btn-xs btn-info" title="Visualizza">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-users fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun membro</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-file mr-2"></i>Documenti (<?php echo e($gruppo->documenti->count()); ?>)
|
|
||||||
</h3>
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary float-right" data-toggle="modal" data-target="#uploadDocumentoModal">
|
|
||||||
<i class="fas fa-upload mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($gruppo->documenti->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th style="width: 120px;">Tipologia</th>
|
|
||||||
<th style="width: 80px;">Dimensione</th>
|
|
||||||
<th style="width: 130px;">Data Upload</th>
|
|
||||||
<th style="width: 100px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $gruppo->documenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" onclick="event.preventDefault(); previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>');">
|
|
||||||
<i class="fas fa-file text-secondary mr-1"></i>
|
|
||||||
<?php echo e($documento->nome_file); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e(ucfirst(str_replace('_', ' ', $documento->tipologia))); ?></td>
|
|
||||||
<td><?php echo e(number_format($documento->dimensione / 1024, 1)); ?> KB</td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<a href="<?php echo e(url('/documenti/' . $documento->id . '/download')); ?>" class="btn btn-xs btn-primary" title="Scarica">
|
|
||||||
<i class="fas fa-download"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-file fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun documento</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">
|
|
||||||
<i class="fas fa-sitemap mr-2"></i>Sottogruppi (<?php echo e($gruppo->children->count()); ?>)
|
|
||||||
</h3>
|
|
||||||
<a href="<?php echo e(route('gruppi.create', ['parent_id' => $gruppo->id])); ?>" class="btn btn-xs btn-success float-right">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi Sottogruppo
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<?php if($gruppo->children->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Diocesi</th>
|
|
||||||
<th>Responsabile</th>
|
|
||||||
<th style="text-align: center;">Membri</th>
|
|
||||||
<th style="width: 100px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $gruppo->children->sortBy('nome'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $child->id)); ?>">
|
|
||||||
<i class="fas fa-folder-open text-warning mr-1"></i>
|
|
||||||
<?php echo e($child->nome); ?>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($child->diocesi?->nome ?? '-'); ?></td>
|
|
||||||
<td><?php echo e($child->getResponsabili()->isNotEmpty() ? $child->getResponsabili()->first()->nome_completo : '-'); ?></td>
|
|
||||||
<td class="text-center">
|
|
||||||
<?php if($child->individui()->count() > 0): ?>
|
|
||||||
<span class="badge badge-info"><?php echo e($child->individui()->count()); ?></span>
|
|
||||||
<?php else: ?>
|
|
||||||
<span class="text-muted">-</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(route('gruppi.show', $child->id)); ?>" class="btn btn-xs btn-info" title="Visualizza">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</a>
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(route('gruppi.edit', $child->id)); ?>" class="btn btn-xs btn-warning" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canDeleteGruppi): ?>
|
|
||||||
<form action="<?php echo e(route('gruppi.destroy', $child->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare <?php echo e($child->nome); ?>?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-folder-open fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun sottogruppo</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
<?php if($canWriteGruppi): ?>
|
|
||||||
<a href="<?php echo e(url('/gruppi/' . $gruppo->id . '/edit')); ?>" class="btn btn-warning">
|
|
||||||
<i class="fas fa-edit mr-1"></i> Modifica
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($canDeleteGruppi): ?>
|
|
||||||
<form action="<?php echo e(url('/gruppi/' . $gruppo->id)); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-danger" onclick="return confirm('Confermi l\'eliminazione di <?php echo e($gruppo->nome); ?>? Verranno eliminati anche tutti i sottogruppi.')">
|
|
||||||
<i class="fas fa-trash mr-1"></i> Elimina
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
<a href="<?php echo e(route('gruppi.index')); ?>" class="btn btn-secondary">
|
|
||||||
<i class="fas fa-arrow-left mr-1"></i> Torna all'elenco
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="uploadDocumentoModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header bg-primary text-white">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-upload mr-2"></i>Carica Documento</h5>
|
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
|
||||||
<span>×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<form action="/documenti" method="POST" enctype="multipart/form-data">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="visibilita" value="gruppo">
|
|
||||||
<input type="hidden" name="visibilita_target_id" value="<?php echo e($gruppo->id); ?>">
|
|
||||||
<input type="hidden" name="visibilita_target_type" value="App\Models\Gruppo">
|
|
||||||
<input type="hidden" name="_redirect" value="<?php echo e(url()->current()); ?>">
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome_file" class="form-control" placeholder="Nome del documento" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Tipologia *</label>
|
|
||||||
<select name="tipologia" class="form-control" required>
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<option value="documento">Documento</option>
|
|
||||||
<option value="statuto">Statuto</option>
|
|
||||||
<option value="avatar">Avatar</option>
|
|
||||||
<option value="galleria">Galleria</option>
|
|
||||||
<option value="altro">Altro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>File *</label>
|
|
||||||
<input type="file" name="file" class="form-control" required>
|
|
||||||
<small class="text-muted">Max 10MB</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annulla</button>
|
|
||||||
<button type="submit" class="btn btn-primary">
|
|
||||||
<i class="fas fa-upload mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" role="document" style="max-width: 90vw;">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-file mr-2"></i><span id="previewModalTitle">Anteprima</span></h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body text-center p-0" style="min-height: 400px;">
|
|
||||||
<iframe id="previewFrame" src="" style="width: 100%; height: 70vh; border: none;"></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="previewDownloadBtn" href="#" class="btn btn-primary" download>
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function previewDocumento(id, mimeType) {
|
|
||||||
var previewUrl = '/documenti/' + id + '/preview';
|
|
||||||
var downloadUrl = '/documenti/' + id + '/download';
|
|
||||||
|
|
||||||
document.getElementById('previewFrame').src = previewUrl;
|
|
||||||
document.getElementById('previewDownloadBtn').href = downloadUrl;
|
|
||||||
document.getElementById('previewModalTitle').textContent = 'Anteprima';
|
|
||||||
|
|
||||||
if (mimeType && mimeType.startsWith('image/')) {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'inline-block';
|
|
||||||
} else {
|
|
||||||
document.getElementById('previewDownloadBtn').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#previewModal').modal('show');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/gruppi/show.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Gestione Utenti'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Gestione Utenti'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('breadcrumbs'); ?>
|
|
||||||
<li class="breadcrumb-item active">Admin</li>
|
|
||||||
<li class="breadcrumb-item active">Utenti</li>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title">Utenti Registrati</h3>
|
|
||||||
<a href="/admin/utenti/create" class="btn btn-success btn-sm float-right">
|
|
||||||
<i class="fas fa-plus"></i> Nuovo Utente
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<form method="GET" class="mb-3">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" name="search" class="form-control" placeholder="Cerca nome o email..." value="<?php echo e(request('search')); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="status" class="form-control">
|
|
||||||
<option value="">Tutti gli stati</option>
|
|
||||||
<option value="active" <?php echo e(request('status') == 'active' ? 'selected' : ''); ?>>Attivo</option>
|
|
||||||
<option value="suspended" <?php echo e(request('status') == 'suspended' ? 'selected' : ''); ?>>Sospeso</option>
|
|
||||||
<option value="pending" <?php echo e(request('status') == 'pending' ? 'selected' : ''); ?>>In attesa</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-primary">Filtra</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<table class="table table-bordered table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th>Email</th>
|
|
||||||
<th>Stato</th>
|
|
||||||
<th>Permessi</th>
|
|
||||||
<th>Creato</th>
|
|
||||||
<th style="width: 150px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $utenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $utente): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<strong><?php echo e($utente->name); ?></strong>
|
|
||||||
<?php if($utente->isSuperAdmin()): ?>
|
|
||||||
<span class="badge badge-danger ml-1">Admin</span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($utente->email); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php switch($utente->status):
|
|
||||||
case ('active'): ?>
|
|
||||||
<span class="badge badge-success">Attivo</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('suspended'): ?>
|
|
||||||
<span class="badge badge-secondary">Sospeso</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php case ('pending'): ?>
|
|
||||||
<span class="badge badge-warning">In attesa</span>
|
|
||||||
<?php break; ?>
|
|
||||||
<?php endswitch; ?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php $summary = $utente->getPermissionsSummary(); ?>
|
|
||||||
<small>
|
|
||||||
<?php $__currentLoopData = $summary; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $module => $level): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php if($level !== 'Nessuno'): ?>
|
|
||||||
<span class="text-<?php echo e($level === 'Completo' ? 'success' : 'info'); ?>"><?php echo e(ucfirst($module)); ?>: <?php echo e($level); ?></span><br>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</small>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($utente->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<a href="<?php echo e(url('/admin/utenti/' . $utente->id . '/edit')); ?>" class="btn btn-xs btn-warning">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<?php if($utente->id !== auth()->id()): ?>
|
|
||||||
<form method="POST" action="<?php echo e(url('/admin/utenti/' . $utente->id)); ?>" style="display: inline;">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo utente?')">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<?php echo e($utenti->links()); ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/admin/utenti/index.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -1,480 +0,0 @@
|
|||||||
<?php $__env->startSection('title', 'Modifica Gruppo'); ?>
|
|
||||||
<?php $__env->startSection('page_title', 'Modifica Gruppo'); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('content'); ?>
|
|
||||||
<form action="/gruppi/<?php echo e($gruppo->id); ?>" method="POST">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card card-primary">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-folder mr-2"></i>Dati Gruppo</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Nome *</label>
|
|
||||||
<input type="text" name="nome" class="form-control" value="<?php echo e(old('nome', $gruppo->nome)); ?>" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Gruppo Padre</label>
|
|
||||||
<select name="parent_id" class="form-control">
|
|
||||||
<option value="">Nessuno (gruppo radice)</option>
|
|
||||||
<?php $__currentLoopData = $gruppi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $g): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php if($g->id !== $gruppo->id): ?>
|
|
||||||
<option value="<?php echo e($g->id); ?>" <?php echo e(old('parent_id', $gruppo->parent_id) == $g->id ? 'selected' : ''); ?>>
|
|
||||||
<?php echo e($g->full_path); ?>
|
|
||||||
|
|
||||||
</option>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Diocesi</label>
|
|
||||||
<select name="diocesi_id" class="form-control">
|
|
||||||
<option value="">Seleziona...</option>
|
|
||||||
<?php $__currentLoopData = $diocesi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($d->id); ?>" <?php echo e(old('diocesi_id', $gruppo->diocesi_id) == $d->id ? 'selected' : ''); ?>><?php echo e($d->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Responsabili (solo membri)</label>
|
|
||||||
<select name="responsabile_ids[]" class="form-control" multiple size="4">
|
|
||||||
<?php $__currentLoopData = $membri; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($m->id); ?>" <?php echo e(in_array($m->id, old('responsabile_ids', $gruppo->getResponsabiliIds() ?? [])) ? 'selected' : ''); ?>>
|
|
||||||
<?php echo e($m->cognome); ?> <?php echo e($m->nome); ?>
|
|
||||||
|
|
||||||
</option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<?php if($membri->isEmpty()): ?>
|
|
||||||
<small class="text-muted">Prima aggiungi dei membri al gruppo</small>
|
|
||||||
<?php else: ?>
|
|
||||||
<small class="text-muted">Ctrl+click per selezionare più responsabili</small>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Descrizione</label>
|
|
||||||
<textarea name="descrizione" class="form-control" rows="3"><?php echo e(old('descrizione', $gruppo->descrizione)); ?></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header"><h3 class="card-title"><i class="fas fa-map-marker-alt mr-2"></i>Luogo Incontro</h3></div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Indirizzo</label>
|
|
||||||
<input type="text" name="indirizzo_incontro" class="form-control" value="<?php echo e(old('indirizzo_incontro', $gruppo->indirizzo_incontro)); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
|
||||||
<div class="form-group col-md-4">
|
|
||||||
<label>CAP</label>
|
|
||||||
<input type="text" name="cap_incontro" class="form-control" value="<?php echo e(old('cap_incontro', $gruppo->cap_incontro)); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-5">
|
|
||||||
<label>Città</label>
|
|
||||||
<input type="text" name="città_incontro" class="form-control" value="<?php echo e(old('città_incontro', $gruppo->città_incontro)); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label>Provincia</label>
|
|
||||||
<input type="text" name="sigla_provincia_incontro" class="form-control" maxlength="2" value="<?php echo e(old('sigla_provincia_incontro', $gruppo->sigla_provincia_incontro)); ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group mb-0">
|
|
||||||
<label>URL Mappa</label>
|
|
||||||
<input type="url" name="mappa_posizione" class="form-control" value="<?php echo e(old('mappa_posizione', $gruppo->mappa_posizione)); ?>" placeholder="https://...">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-users mr-2"></i>Membri</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showMembroForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Aggiungi
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
|
|
||||||
<?php if($gruppo->individui->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 25%;">Individuo</th>
|
|
||||||
<th style="width: 80px;">Codice</th>
|
|
||||||
<th style="width: 25%;">Contatti</th>
|
|
||||||
<th style="width: 130px;">Ruolo</th>
|
|
||||||
<th style="width: 110px;">Data Adesione</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $gruppo->individui; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $membro): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr id="membro-row-<?php echo e($membro->id); ?>">
|
|
||||||
<td>
|
|
||||||
<i class="fas fa-user text-primary mr-1"></i>
|
|
||||||
<a href="/individui/<?php echo e($membro->id); ?>"><?php echo e($membro->cognome); ?> <?php echo e($membro->nome); ?></a>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($membro->codice_id); ?></td>
|
|
||||||
<td>
|
|
||||||
<small>
|
|
||||||
<?php if($membro->email_primaria): ?>
|
|
||||||
<span class="text-primary"><?php echo e($membro->email_primaria); ?></span><br>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if($membro->telefono_primario): ?>
|
|
||||||
<span class="text-success"><?php echo e($membro->telefono_primario); ?></span>
|
|
||||||
<?php endif; ?>
|
|
||||||
</small>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php $ruoliMembro = $membro->getRuoliForGruppo($gruppo->id) ?>
|
|
||||||
<?php if($ruoliMembro->count() > 0): ?>
|
|
||||||
<?php $__currentLoopData = $ruoliMembro; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<span class="badge badge-info mr-1"><?php echo e($ruolo->nome); ?></span>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php else: ?>
|
|
||||||
-
|
|
||||||
<?php endif; ?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo e($membro->pivot->data_adesione ? \Carbon\Carbon::parse($membro->pivot->data_adesione)->format('d/m/Y') : '-'); ?></td>
|
|
||||||
<td>
|
|
||||||
<button type="button" class="btn btn-xs btn-warning" onclick="editMembroInline(<?php echo e($membro->id); ?>)" title="Modifica">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-danger" onclick="deleteMembro(<?php echo e($membro->id); ?>)" title="Rimuovi">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr id="membro-edit-<?php echo e($membro->id); ?>" style="display:none;">
|
|
||||||
<td colspan="6">
|
|
||||||
<form action="/gruppi/<?php echo e($gruppo->id); ?>/membri/<?php echo e($membro->id); ?>" method="POST" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="text" class="form-control form-control-sm" value="<?php echo e($membro->cognome); ?> <?php echo e($membro->nome); ?>" disabled>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="text" class="form-control form-control-sm" value="<?php echo e($membro->codice_id); ?>" disabled>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="ruolo_ids[]" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<?php $selected = in_array($ruolo->id, $membro->getRuoloIdsForGruppo($gruppo->id)) ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>" <?php echo e($selected ? 'selected' : ''); ?>><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<input type="date" name="data_adesione" class="form-control form-control-sm" value="<?php echo e($membro->pivot->data_adesione); ?>">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-1">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-check"></i></button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="cancelEditMembro(<?php echo e($membro->id); ?>)"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-users fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun membro associato</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-3">
|
|
||||||
<div class="card-header">
|
|
||||||
<h3 class="card-title"><i class="fas fa-file mr-2"></i>Documenti</h3>
|
|
||||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="showDocumentoForm()">
|
|
||||||
<i class="fas fa-plus mr-1"></i> Carica
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="card-body p-0">
|
|
||||||
<div id="documento-add-form" style="display:none;" class="p-3 bg-light border-bottom">
|
|
||||||
<form action="/documenti" method="POST" enctype="multipart/form-data" class="mb-0">
|
|
||||||
<?php echo csrf_field(); ?>
|
|
||||||
<input type="hidden" name="visibilita" value="gruppo">
|
|
||||||
<input type="hidden" name="visibilita_target_id" value="<?php echo e($gruppo->id); ?>">
|
|
||||||
<input type="hidden" name="visibilita_target_type" value="App\Models\Gruppo">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="text" name="nome_file" class="form-control form-control-sm" placeholder="Nome documento" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select name="tipologia" class="form-control form-control-sm" required>
|
|
||||||
<option value="">Tipologia...</option>
|
|
||||||
<option value="documento">Documento</option>
|
|
||||||
<option value="statuto">Statuto</option>
|
|
||||||
<option value="avatar">Avatar</option>
|
|
||||||
<option value="galleria">Galleria</option>
|
|
||||||
<option value="altro">Altro</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input type="file" name="file" class="form-control form-control-sm" required>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="submit" class="btn btn-xs btn-success"><i class="fas fa-upload mr-1"></i>Carica</button>
|
|
||||||
<button type="button" class="btn btn-xs btn-secondary" onclick="hideDocumentoForm()"><i class="fas fa-times"></i></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if($gruppo->documenti && $gruppo->documenti->count() > 0): ?>
|
|
||||||
<table class="table table-bordered table-hover table-striped mb-0">
|
|
||||||
<thead class="thead-light">
|
|
||||||
<tr>
|
|
||||||
<th>Nome</th>
|
|
||||||
<th style="width: 120px;">Tipologia</th>
|
|
||||||
<th style="width: 80px;">Dimensione</th>
|
|
||||||
<th style="width: 130px;">Data Upload</th>
|
|
||||||
<th style="width: 80px;">Azioni</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<?php $__currentLoopData = $gruppo->documenti; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $documento): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<i class="fas fa-file text-secondary mr-1"></i>
|
|
||||||
<?php echo e($documento->nome_file); ?>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
<td><?php echo e(ucfirst(str_replace('_', ' ', $documento->tipologia))); ?></td>
|
|
||||||
<td><?php echo e(number_format($documento->dimensione / 1024, 1)); ?> KB</td>
|
|
||||||
<td><?php echo e($documento->created_at->format('d/m/Y')); ?></td>
|
|
||||||
<td>
|
|
||||||
<?php if($documento->file_path): ?>
|
|
||||||
<button type="button" class="btn btn-xs btn-primary" onclick="previewDocumento(<?php echo e($documento->id); ?>, '<?php echo e($documento->mime_type); ?>')" title="Anteprima">
|
|
||||||
<i class="fas fa-eye"></i>
|
|
||||||
</button>
|
|
||||||
<?php endif; ?>
|
|
||||||
<form action="/documenti/<?php echo e($documento->id); ?>" method="POST" class="d-inline">
|
|
||||||
<?php echo csrf_field(); ?> <?php echo method_field('DELETE'); ?>
|
|
||||||
<button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('Eliminare questo documento?')" title="Elimina">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<?php else: ?>
|
|
||||||
<div class="text-center text-muted py-4">
|
|
||||||
<i class="fas fa-file fa-2x mb-2"></i>
|
|
||||||
<p class="mb-0">Nessun documento</p>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
<button type="submit" class="btn btn-success">
|
|
||||||
<i class="fas fa-save mr-1"></i> Salva Modifiche
|
|
||||||
</button>
|
|
||||||
<a href="/gruppi/<?php echo e($gruppo->id); ?>" class="btn btn-secondary">
|
|
||||||
<i class="fas fa-times mr-1"></i> Annulla
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="card mt-3" id="membro-card" style="display:none; background-color: #fff3cd; border-color: #ffc107;">
|
|
||||||
<div class="card-header bg-warning">
|
|
||||||
<h3 class="card-title"><i class="fas fa-user-plus mr-2"></i>Aggiungi Membro</h3>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div id="membro-form-container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-4">
|
|
||||||
<select id="new-membro-individuo" class="form-control form-control-sm">
|
|
||||||
<option value="">Seleziona individuo...</option>
|
|
||||||
<?php $__currentLoopData = \App\Models\Individuo::whereNotIn('id', $membri->pluck('id'))->orderBy('cognome')->orderBy('nome')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($i->id); ?>"><?php echo e($i->cognome); ?> <?php echo e($i->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<select id="new-membro-ruolo" class="form-control form-control-sm" multiple size="3">
|
|
||||||
<?php $__currentLoopData = \App\Models\Ruolo::attive(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ruolo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
<option value="<?php echo e($ruolo->id); ?>"><?php echo e($ruolo->nome); ?></option>
|
|
||||||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
|
|
||||||
</select>
|
|
||||||
<small class="text-muted">Ctrl+click per selezionare più ruoli</small>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<input type="date" id="new-membro-data" class="form-control form-control-sm">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="button" class="btn btn-success btn-sm" onclick="submitMembroForm()">
|
|
||||||
<i class="fas fa-check mr-1"></i> Associa
|
|
||||||
</button>
|
|
||||||
<button type="button" class="btn btn-secondary btn-sm" onclick="hideMembroForm()">
|
|
||||||
<i class="fas fa-times"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal fade" id="previewModal" tabindex="-1" role="dialog">
|
|
||||||
<div class="modal-dialog modal-lg" role="document" style="max-width: 90vw;">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-file mr-2"></i><span id="previewModalTitle">Anteprima</span></h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body text-center p-0" style="min-height: 400px;">
|
|
||||||
<iframe id="previewFrame" src="" style="width: 100%; height: 70vh; border: none;"></iframe>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a id="previewDownloadBtn" href="#" class="btn btn-primary" download>
|
|
||||||
<i class="fas fa-download mr-1"></i> Scarica
|
|
||||||
</a>
|
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Chiudi</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
|
|
||||||
<?php $__env->startSection('scripts'); ?>
|
|
||||||
<script>
|
|
||||||
function showMembroForm() {
|
|
||||||
console.log('showMembroForm called');
|
|
||||||
var card = document.getElementById('membro-card');
|
|
||||||
console.log('Card element:', card);
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'block';
|
|
||||||
card.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
||||||
console.log('Card shown');
|
|
||||||
} else {
|
|
||||||
console.error('Card not found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideMembroForm() {
|
|
||||||
var card = document.getElementById('membro-card');
|
|
||||||
if (card) {
|
|
||||||
card.style.display = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitMembroForm() {
|
|
||||||
var individuoId = document.getElementById('new-membro-individuo').value;
|
|
||||||
var ruoloSelect = document.getElementById('new-membro-ruolo');
|
|
||||||
var dataAdesione = document.getElementById('new-membro-data').value;
|
|
||||||
|
|
||||||
if (!individuoId) {
|
|
||||||
alert('Seleziona un individuo');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.getElementById('new-membro-individuo').removeAttribute('required');
|
|
||||||
|
|
||||||
var formData = new URLSearchParams();
|
|
||||||
formData.append('individuo_id', individuoId);
|
|
||||||
|
|
||||||
var selectedRuoli = Array.from(ruoloSelect.selectedOptions).map(opt => opt.value).filter(v => v);
|
|
||||||
selectedRuoli.forEach(function(ruoloId) {
|
|
||||||
formData.append('ruolo_ids[]', ruoloId);
|
|
||||||
});
|
|
||||||
|
|
||||||
formData.append('data_adesione', dataAdesione);
|
|
||||||
|
|
||||||
fetch('/gruppi/<?php echo e($gruppo->id); ?>/membri', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
},
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => { throw new Error(text); });
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
hideMembroForm();
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.error || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function editMembroInline(id) {
|
|
||||||
document.getElementById('membro-row-' + id).style.display = 'none';
|
|
||||||
document.getElementById('membro-edit-' + id).style.display = 'table-row';
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEditMembro(id) {
|
|
||||||
document.getElementById('membro-row-' + id).style.display = 'table-row';
|
|
||||||
document.getElementById('membro-edit-' + id).style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteMembro(individuoId) {
|
|
||||||
if (!confirm('Rimuovere questo membro dal gruppo?')) return;
|
|
||||||
|
|
||||||
fetch('/gruppi/<?php echo e($gruppo->id); ?>/membri/' + individuoId, {
|
|
||||||
method: 'DELETE',
|
|
||||||
headers: {
|
|
||||||
'X-CSRF-TOKEN': '<?php echo e(csrf_token()); ?>',
|
|
||||||
'Accept': 'application/json'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) {
|
|
||||||
return response.text().then(text => { throw new Error(text); });
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
if (data.success) {
|
|
||||||
window.location.reload();
|
|
||||||
} else {
|
|
||||||
alert(data.error || 'Errore');
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
alert('Errore: ' + error.message);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'block';
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideDocumentoForm() {
|
|
||||||
document.getElementById('documento-add-form').style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function previewDocumento(id, mimeType) {
|
|
||||||
document.getElementById('previewFrame').src = '/documenti/' + id + '/preview';
|
|
||||||
document.getElementById('previewDownloadBtn').href = '/documenti/' + id + '/download';
|
|
||||||
$('#previewModal').modal('show');
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<?php $__env->stopSection(); ?>
|
|
||||||
<?php echo $__env->make('layouts.adminlte', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/glastree/resources/views/gruppi/edit.blade.php ENDPATH**/ ?>
|
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature;
|
||||||
|
|
||||||
|
use App\Http\Controllers\EventoController;
|
||||||
|
use App\Models\Evento;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class CalendarEventsTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_find_first_sunday_of_june_2026(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
$june2026 = \Carbon\Carbon::create(2026, 6, 1);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'findNthWeekdayOfMonth');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$result = $method->invoke($controller, $june2026, 1, 0);
|
||||||
|
|
||||||
|
$this->assertNotNull($result);
|
||||||
|
$this->assertEquals('2026-06-07', $result->format('Y-m-d'));
|
||||||
|
$this->assertEquals('Sunday', $result->format('l'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_find_second_saturday_of_june_2026(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
$june2026 = \Carbon\Carbon::create(2026, 6, 1);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'findNthWeekdayOfMonth');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$result = $method->invoke($controller, $june2026, 2, 6);
|
||||||
|
|
||||||
|
$this->assertNotNull($result);
|
||||||
|
$this->assertEquals('2026-06-13', $result->format('Y-m-d'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_find_fifth_sunday_returns_null_when_not_in_month(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
$june2026 = \Carbon\Carbon::create(2026, 6, 1);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'findNthWeekdayOfMonth');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$result = $method->invoke($controller, $june2026, 5, 0);
|
||||||
|
|
||||||
|
$this->assertNull($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_generate_mensile_events_for_all_months(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
|
||||||
|
$evento = Evento::make([
|
||||||
|
'nome_evento' => 'Test Mensile',
|
||||||
|
'tipo_recorrenza' => 'mensile',
|
||||||
|
'occorrenza_mese' => '1,0',
|
||||||
|
'mesi_recorrenza' => '1,2,3,4,5,6,7,8,9,10,11,12',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'generateMensileEvents');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$events = $method->invoke($controller, $evento, '2026-06-01', '2026-08-31', 'http://test.local');
|
||||||
|
|
||||||
|
$this->assertCount(3, $events);
|
||||||
|
$this->assertStringContainsString('2026-06-07', $events[0]['start']);
|
||||||
|
$this->assertStringContainsString('2026-07-05', $events[1]['start']);
|
||||||
|
$this->assertStringContainsString('2026-08-02', $events[2]['start']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_generate_mensile_events_respects_selected_months(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
|
||||||
|
$evento = Evento::make([
|
||||||
|
'nome_evento' => 'Test Mensile',
|
||||||
|
'tipo_recorrenza' => 'mensile',
|
||||||
|
'occorrenza_mese' => '1,6',
|
||||||
|
'mesi_recorrenza' => '1,6',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'generateMensileEvents');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$events = $method->invoke($controller, $evento, '2026-01-01', '2026-12-31', 'http://test.local');
|
||||||
|
|
||||||
|
$this->assertCount(2, $events);
|
||||||
|
$this->assertStringContainsString('2026-01-03', $events[0]['start']);
|
||||||
|
$this->assertStringContainsString('2026-06-06', $events[1]['start']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_generate_annuale_events_produces_correct_dates(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
|
||||||
|
$evento = Evento::make([
|
||||||
|
'nome_evento' => 'Test Annuale',
|
||||||
|
'tipo_recorrenza' => 'annuale',
|
||||||
|
'mese_annuale' => 6,
|
||||||
|
'giorno_mese' => 15,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'generateAnnualeEvents');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$events = $method->invoke($controller, $evento, '2026-01-01', '2027-12-31', 'http://test.local');
|
||||||
|
|
||||||
|
$this->assertCount(2, $events);
|
||||||
|
$this->assertStringContainsString('2026-06-15', $events[0]['start']);
|
||||||
|
$this->assertStringContainsString('2027-06-15', $events[1]['start']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_generate_settimanale_events_produces_weekly_occurrences(): void
|
||||||
|
{
|
||||||
|
$controller = app(EventoController::class);
|
||||||
|
|
||||||
|
$evento = Evento::make([
|
||||||
|
'nome_evento' => 'Test Settimanale',
|
||||||
|
'tipo_recorrenza' => 'settimanale',
|
||||||
|
'giorno_settimana' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$method = new \ReflectionMethod($controller, 'generateSettimanaleEvents');
|
||||||
|
$method->setAccessible(true);
|
||||||
|
|
||||||
|
$events = $method->invoke($controller, $evento, '2026-06-01', '2026-06-30', 'http://test.local');
|
||||||
|
|
||||||
|
$this->assertCount(5, $events);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user