|
|
@@ -1,163 +1,190 @@
|
|
|
<div class="col card--ui" id="card--dashboard">
|
|
|
|
|
|
- @if(!$add && !$update)
|
|
|
-
|
|
|
- <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
|
|
|
- <div class="title--section_name d-flex align-items-center justify-content-between">
|
|
|
- <i class="ico--ui title_section utenti me-2"></i>
|
|
|
- <h2 class="primary">@if(!$add && !$update)Email Templates @else Inserimento/modifica template Email @endif</h2>
|
|
|
- </div>
|
|
|
+ <header id="title--section" style="display:none !important" class="d-flex align-items-center justify-content-between">
|
|
|
+ <div class="title--section_name d-flex align-items-center justify-content-between">
|
|
|
+ <i class="ico--ui title_section utenti me-2"></i>
|
|
|
+ <h2 class="primary">Emails</h2>
|
|
|
+ </div>
|
|
|
|
|
|
- @if(!$add && !$update)
|
|
|
- <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;">
|
|
|
- <div class="btn--ui entrata d-flex justify-items-between">
|
|
|
- <a href="#" wire:click="add()" style="color:white">Aggiungi</a>
|
|
|
- </div>
|
|
|
+ @if(!$showForm)
|
|
|
+ <div class="title--section_addButton" wire:click="add()" style="cursor: pointer;" wire:ignore>
|
|
|
+ <div class="btn--ui entrata d-flex justify-items-between">
|
|
|
+ <a href="#" style="color:white;">Aggiungi</a>
|
|
|
</div>
|
|
|
- @endif
|
|
|
-
|
|
|
- </header>
|
|
|
-
|
|
|
- <a class="btn--ui lightGrey" href="/settings?type=comunicazioni"><i class="fa-solid fa-arrow-left"></i></a><br>
|
|
|
+ </div>
|
|
|
+ @endif
|
|
|
+ </header>
|
|
|
|
|
|
- <section id="resume-table">
|
|
|
- <div class="compare--chart_wrapper d-none"></div>
|
|
|
+ <a class="btn--ui lightGrey" @if(!$showForm) href="/settings?type=comunicazioni" @else href="/mail_comunications" @endif><i class="fa-solid fa-arrow-left"></i></a><br/><br/>
|
|
|
|
|
|
+ {{-- LISTA MESSAGGI --}}
|
|
|
+ <section id="resume-table" @if($showForm) style="display:none" @endif>
|
|
|
+ <div wire:ignore>
|
|
|
<table class="table tablesaw tableHead tablesaw-stack" id="tablesaw-350" width="100%">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th scope="col">Oggetto</th>
|
|
|
- <th scope="col">Messaggio</th>
|
|
|
- <th scope="col">Parole</th>
|
|
|
- <th scope="col">Data Creazione</th>
|
|
|
- <th scope="col">...</th>
|
|
|
+ <th>ID</th>
|
|
|
+ <th>Oggetto</th>
|
|
|
+ <th># Attachments</th>
|
|
|
+ <th># Destinatari</th>
|
|
|
+ <th>Stato</th>
|
|
|
+ <th>Programmata per</th>
|
|
|
+ <th>Data invio</th>
|
|
|
+ <th>Data creazione</th>
|
|
|
+ <th>...</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody id="checkall-target">
|
|
|
@foreach($records as $record)
|
|
|
- <tr>
|
|
|
- <td>
|
|
|
- <strong>{{$record->name}}</strong>
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- {{ Str::limit(strip_tags($record->content), 80) }}
|
|
|
- </td>
|
|
|
- <td>
|
|
|
- @php
|
|
|
- $wordCount = str_word_count(strip_tags($record->content));
|
|
|
- $badgeClass = $wordCount > 500 ? 'bg-warning' : 'bg-info';
|
|
|
- @endphp
|
|
|
- <span class="badge {{ $badgeClass }}">{{ $wordCount }} parole</span>
|
|
|
- </td>
|
|
|
- <td>{{ $record->created_at->format('d/m/Y H:i') }}</td>
|
|
|
- <td>
|
|
|
- <button type="button" class="btn" wire:click="sendTemplate({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Invia Email"><i class="fa-solid fa-envelope"></i></button>
|
|
|
- <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="bottom" data-bs-content="Modifica"><i class="fa-regular fa-pen-to-square"></i></button>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
+ @php
|
|
|
+ $state = $record->status;
|
|
|
+
|
|
|
+ if (!$state) {
|
|
|
+ if (($record->recipients_sent_count ?? 0) > 0 && ($record->recipients_failed_count ?? 0) > 0) {
|
|
|
+ $state = 'partial';
|
|
|
+ } elseif (($record->recipients_sent_count ?? 0) > 0) {
|
|
|
+ $state = 'sent';
|
|
|
+ } elseif (!empty($record->schedule_at)) {
|
|
|
+ $state = 'scheduled';
|
|
|
+ } else {
|
|
|
+ $state = 'draft';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $badgeMap = [
|
|
|
+ 'draft' => 'secondary',
|
|
|
+ 'processing' => 'info',
|
|
|
+ 'scheduled' => 'primary',
|
|
|
+ 'partial' => 'warning',
|
|
|
+ 'sent' => 'success',
|
|
|
+ 'failed' => 'danger',
|
|
|
+ ];
|
|
|
+ @endphp
|
|
|
+ <tr id="row_email_{{ $record->id }}">
|
|
|
+ <td>{{ $record->id }}</td>
|
|
|
+ <td><strong>{{ $record->subject }}</strong></td>
|
|
|
+ <td style="padding-right: 20px">{{ $record->attachments_count ?? $record->attachments()->count() }}</td>
|
|
|
+ <td style="padding-right: 20px">{{ $record->recipients_count ?? $record->recipients()->count() }}</td>
|
|
|
+ <td><span class="badge bg-{{$badgeMap[$state]}}">{{ $record->status }}</span></td>
|
|
|
+ <td>
|
|
|
+ @if(!empty($record->schedule_at))
|
|
|
+ {{ optional($record->schedule_at)->setTimezone('Europe/Rome')->format('d/m/Y H:i') }}
|
|
|
+ @endif
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ @if(!empty($record->sent_at))
|
|
|
+ {{ optional($record->sent_at)->setTimezone('Europe/Rome')->format('d/m/Y H:i') }}
|
|
|
+ @endif
|
|
|
+ </td>
|
|
|
+ <td>{{ optional($record->created_at)->setTimezone('Europe/Rome')->format('d/m/Y H:i') }}</td>
|
|
|
+ <td class="d-flex gap-2">
|
|
|
+ <button type="button" class="btn" wire:click="edit({{ $record->id }})" data-bs-toggle="tooltip" data-bs-trigger="hover focus" data-bs-placement="bottom" title="Modifica">
|
|
|
+ <i class="fa-regular fa-pen-to-square"></i>
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn" wire:click="duplicate({{ $record->id }})" data-bs-toggle="tooltip" data-bs-trigger="hover focus" data-bs-placement="bottom" title="Duplica">
|
|
|
+ <i class="fa-solid fa-copy"></i>
|
|
|
+ </button>
|
|
|
+
|
|
|
+ @if(in_array($record->status, ['draft','failed']))
|
|
|
+ <button type="button" class="btn text-danger"
|
|
|
+ onclick="if (confirm('Eliminare definitivamente questa email?')) { Livewire.find('{{ $this->id }}').call('deleteMessage', {{ $record->id }}); }"
|
|
|
+ data-bs-toggle="tooltip" title="Elimina">
|
|
|
+ <i class="fa-solid fa-trash"></i>
|
|
|
+ </button>
|
|
|
+ @endif
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
@endforeach
|
|
|
</tbody>
|
|
|
</table>
|
|
|
- </section>
|
|
|
-
|
|
|
- @else
|
|
|
-
|
|
|
- <a class="btn--ui lightGrey" href="/email_comunications"><i class="fa-solid fa-arrow-left"></i></a><br>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
|
|
|
+ {{-- FORM MESSAGGIO --}}
|
|
|
+ <section wire:key="email-form" @if(!$showForm) style="display:none" @endif>
|
|
|
<div class="container">
|
|
|
|
|
|
- @if (session()->has('error'))
|
|
|
- <div class="alert alert-danger" role="alert">
|
|
|
- {{ session()->get('error') }}
|
|
|
- </div>
|
|
|
+ @if ($error)
|
|
|
+ <div class="alert alert-danger" role="alert">{{ $error }}</div>
|
|
|
+ @endif
|
|
|
+ @if ($success)
|
|
|
+ <div class="alert alert-success" role="alert">{{ $success }}</div>
|
|
|
@endif
|
|
|
|
|
|
<div class="row">
|
|
|
<div class="col">
|
|
|
|
|
|
- <form action="">
|
|
|
-
|
|
|
- @if ($add)
|
|
|
- {{-- <div class="row mb-4">
|
|
|
- <div class="col">
|
|
|
- <label class="form-label">Destinatari</label>
|
|
|
- <div class="mb-2">
|
|
|
- <button type="button" class="btn btn-outline-primary btn-sm" onclick="selectAllUsers()">
|
|
|
- <i class="fas fa-users me-1"></i>Seleziona Tutti
|
|
|
- </button>
|
|
|
- <button type="button" class="btn btn-outline-secondary btn-sm ms-2" onclick="deselectAllUsers()">
|
|
|
- <i class="fas fa-times me-1"></i>Deseleziona Tutti
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- <div style="max-height: 200px; overflow-y: auto; border: 1px solid #dee2e6; border-radius: 0.375rem; padding: 10px;">
|
|
|
- @foreach($users as $user)
|
|
|
- <div class="form-check mb-1">
|
|
|
- <input class="form-check-input" type="checkbox" value="{{ $user->id }}" wire:model="selectedRecipients" id="recipient_{{ $user->id }}">
|
|
|
- <label class="form-check-label" for="recipient_{{ $user->id }}">
|
|
|
- <strong>{{ $user->name }}</strong>
|
|
|
- @if($user->email)
|
|
|
- <small class="text-muted">({{ $user->email }})</small>
|
|
|
- @else
|
|
|
- <small class="text-danger">(no email)</small>
|
|
|
- @endif
|
|
|
- </label>
|
|
|
+ <form>
|
|
|
+
|
|
|
+ {{-- Destinatari (selezionati) --}}
|
|
|
+ <div class="row mb-5">
|
|
|
+ <div class="col-12 mb-2">
|
|
|
+ <h4>Destinatari</h4>
|
|
|
+ <div class="recipients">
|
|
|
+ @if (empty($recipients))
|
|
|
+ <span>Nessun destinatario selezionato</span>
|
|
|
+ @else
|
|
|
+ @foreach ($recipients as $r)
|
|
|
+ @php
|
|
|
+ $fullName = trim(($r['last_name'] ?? '').' '.($r['first_name'] ?? ''));
|
|
|
+ @endphp
|
|
|
+ <div class="recipient">
|
|
|
+ <span class="recipient-name">{{ $fullName !== '' ? $fullName : '—' }}</span>
|
|
|
+ <span class="recipient-email">({{ $r['email_address'] }})</span>
|
|
|
</div>
|
|
|
@endforeach
|
|
|
- </div>
|
|
|
- <div class="form-text">
|
|
|
- <small class="text-muted">Selezionati: <span id="selectedCount">{{ count($selectedRecipients) }}</span> utenti</small>
|
|
|
- </div>
|
|
|
- @error('selectedRecipients')
|
|
|
- <div class="text-danger">{{ $message }}</div>
|
|
|
- @enderror
|
|
|
+ @endif
|
|
|
</div>
|
|
|
- </div> --}}
|
|
|
-
|
|
|
- <div class="row mb-4">
|
|
|
+ @error('recipients') <div class="invalid-feedback d-block">{{ $message }}</div> @enderror
|
|
|
+ </div>
|
|
|
+ <div class="col"></div>
|
|
|
+ <div class="col-auto">
|
|
|
+ <a style="cursor:pointer" class="addRecipients btn--ui"><i class="fa-solid fa-plus"></i></a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="col-xs-12">
|
|
|
- <div class="showFilter" style="display: none">
|
|
|
- <hr size="1">
|
|
|
- <div class="row g-3">
|
|
|
- <div class="col-md-3">
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Età</b>
|
|
|
- </div>
|
|
|
- <div class="col-12">
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-3"><label class="form-check-label ms-2" >Da</label></div>
|
|
|
- <div class="col-9"><input class="form-control " type="number" name="txtFromYear"></div>
|
|
|
- </div>
|
|
|
+ {{-- FILTRI + TABELLA DESTINATARI --}}
|
|
|
+ <div class="row mb-5" wire:ignore id="addRecipientsRow" style="display: none">
|
|
|
+ <div class="col-xs-12">
|
|
|
+ <div class="showFilter" style="display: none">
|
|
|
+ <hr size="1">
|
|
|
+ <div class="row g-3">
|
|
|
+ <div class="col-md-3">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12 mb-2"><b>Età</b></div>
|
|
|
+ <div class="col-12">
|
|
|
+ <div class="row mb-2">
|
|
|
+ <div class="col-3"><label class="form-check-label ms-2">Da</label></div>
|
|
|
+ <div class="col-9"><input class="form-control" type="number" name="txtFromYear"></div>
|
|
|
</div>
|
|
|
- <div class="col-12">
|
|
|
- <div class="row">
|
|
|
- <div class="col-3"><label class="form-check-label ms-2" >A</label></div>
|
|
|
- <div class="col-9"><input class="form-control " type="number" name="txtToYear"></div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-12">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-3"><label class="form-check-label ms-2">A</label></div>
|
|
|
+ <div class="col-9"><input class="form-control" type="number" name="txtToYear"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="col-md-3">
|
|
|
- <div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Tipologia di tesseramento</b>
|
|
|
- </div>
|
|
|
- <div class="col-12">
|
|
|
- <select name="filterCards" class="form-select filterCards">
|
|
|
- <option value="">Tutte
|
|
|
- @foreach(getCards() as $card)
|
|
|
- <option value="{{$card->id}}">{{$card->name}}
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {{-- Altri filtri come da tua UI esistente --}}
|
|
|
+ <div class="col-md-3">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12 mb-2"><b>Tipologia di tesseramento</b></div>
|
|
|
+ <div class="col-12">
|
|
|
+ <select name="filterCards" class="form-select filterCards">
|
|
|
+ <option value="">Tutte
|
|
|
+ @foreach(getCards() as $card)
|
|
|
+ <option value="{{$card->id}}">{{$card->name}}
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="col-md-3">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Stato tesseramento</b>
|
|
|
- </div>
|
|
|
+ <div class="col-md-12 mb-2"><b>Stato tesseramento</b></div>
|
|
|
<div class="col-12">
|
|
|
<select name="filterStatus" class="form-select filterStatus" multiple="multiple">
|
|
|
<option value="2">Attivo
|
|
|
@@ -169,9 +196,7 @@
|
|
|
</div>
|
|
|
<div class="col-md-3">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Gruppo di appartenenza</b>
|
|
|
- </div>
|
|
|
+ <div class="col-md-12 mb-2"><b>Gruppo di appartenenza</b></div>
|
|
|
<div class="col-12">
|
|
|
<select name="filterCategories" class="form-select filterCategories" multiple="multiple">
|
|
|
<option value="">Tutte</option>
|
|
|
@@ -186,9 +211,7 @@
|
|
|
</div>
|
|
|
<div class="col-md-3">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Anno di nascita</b>
|
|
|
- </div>
|
|
|
+ <div class="col-md-12 mb-2"><b>Anno di nascita</b></div>
|
|
|
<div class="col-12">
|
|
|
<div class="row mb-2">
|
|
|
<div class="col-3"><label class="form-check-label ms-2" >Da</label></div>
|
|
|
@@ -205,9 +228,22 @@
|
|
|
</div>
|
|
|
<div class="col-md-3">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Scadenza certificato medico</b>
|
|
|
+ <div class="col-md-12 mb-2"><b>Corso</b></div>
|
|
|
+ <div class="col-12">
|
|
|
+ <select name="filterCourses" class="form-select filterCourses" multiple="multiple">
|
|
|
+ <option value="">Tutti</option>
|
|
|
+ @foreach($courses as $course)
|
|
|
+ <option value="{{ $course['id'] }}">
|
|
|
+ {!! str_repeat('• ', $course['indentation'] ?? 0) !!}{{ $course['name'] }}
|
|
|
+ </option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-3">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12 mb-2"><b>Scadenza certificato medico</b></div>
|
|
|
<div class="col-12">
|
|
|
<select name="filterScadenza" class="form-select filterScadenza" multiple="multiple">
|
|
|
<option value="1">Scaduti
|
|
|
@@ -220,9 +256,7 @@
|
|
|
</div>
|
|
|
<div class="col-md-3">
|
|
|
<div class="row">
|
|
|
- <div class="col-md-12" style="margin-bottom:10px;">
|
|
|
- <b>Tipologia certificato medico</b>
|
|
|
- </div>
|
|
|
+ <div class="col-md-12 mb-2"><b>Tipologia certificato medico</b></div>
|
|
|
<div class="col-12">
|
|
|
<select name="filterCertificateType" class="form-select filterCertificateType" multiple="multiple">
|
|
|
<option value="">Tutti
|
|
|
@@ -233,47 +267,45 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+ </div>
|
|
|
+ <div class="row g-3">
|
|
|
+ <div class="col-md-12" style="text-align:right">
|
|
|
+ <button class="btn--ui lightGrey" onclick="resetFilters(event)">Reset</button>
|
|
|
+ <button class="btn--ui" onclick="event.preventDefault();loadDataTable()">FILTRA</button>
|
|
|
</div>
|
|
|
- <div class="row g-3">
|
|
|
- <div class="col-md-12" style="text-align:right">
|
|
|
- <button class="btn--ui lightGrey" onclick="resetFilters(event)">Reset</button>
|
|
|
- <button class="btn--ui" onclick="loadDataTable(event)">FILTRA</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <hr size="1">
|
|
|
</div>
|
|
|
+ <hr size="1">
|
|
|
</div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="col-xs-12">
|
|
|
- <table id="recipients-table" class="table tablesaw tableHead tablesaw-stack">
|
|
|
- <thead>
|
|
|
- <tr>
|
|
|
- <th>Cognome</th>
|
|
|
- <th>Nome</th>
|
|
|
- {{-- <th>Email</th> --}}
|
|
|
- <th>Telefono</th>
|
|
|
- <th>Età</th>
|
|
|
- <th>Anno</th>
|
|
|
- <th>Stato</th>
|
|
|
- <th>Certificato</th>
|
|
|
- {{-- <th>Gruppi di interesse</th>
|
|
|
- <th>Corsi</th>
|
|
|
- <th>Certificato</th>
|
|
|
- <th>Tesseramento</th>
|
|
|
- <th>Rresidenza</th> --}}
|
|
|
- </tr>
|
|
|
- </thead>
|
|
|
- <tbody></tbody>
|
|
|
- </table>
|
|
|
- </div>
|
|
|
+ <div class="col-xs-12">
|
|
|
+ <table id="recipients-table" class="table tablesaw tableHead tablesaw-stack w-100">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th></th>
|
|
|
+ <th>Cognome</th>
|
|
|
+ <th>Nome</th>
|
|
|
+ <th>Email</th>
|
|
|
+ <th>Telefono</th>
|
|
|
+ <th>Età</th>
|
|
|
+ <th>Anno</th>
|
|
|
+ <th>Stato</th>
|
|
|
+ <th>Certificato</th>
|
|
|
+ <th>Gruppi</th>
|
|
|
+ {{-- <th>Corsi</th> --}}
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody></tbody>
|
|
|
+ </table>
|
|
|
</div>
|
|
|
- @endif
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="row mb-4">
|
|
|
+ {{-- Oggetto --}}
|
|
|
+ <div class="row mb-5">
|
|
|
<div class="col">
|
|
|
<div class="form--item">
|
|
|
- <label for="subject" class="form-label">Oggetto</label>
|
|
|
- <input type="text" class="form-control @error('subject') is-invalid @enderror" id="subject" wire:model="subject" placeholder="Inserisci l'oggetto del template">
|
|
|
+ <h4>Oggetto</h4>
|
|
|
+ <input type="text" class="form-control @error('subject') is-invalid @enderror" id="subject" wire:model.defer="subject" placeholder="Oggetto email" @if($locked) disabled @endif>
|
|
|
@error('subject')
|
|
|
<div class="invalid-feedback">{{ $message }}</div>
|
|
|
@enderror
|
|
|
@@ -281,74 +313,129 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="row mb-4">
|
|
|
+ {{-- Messaggio (CKEditor → content_html) --}}
|
|
|
+ <div class="row mb-5">
|
|
|
<div class="col">
|
|
|
<div wire:ignore class="form--item">
|
|
|
- <label for="message" class="form-label">Messaggio</label>
|
|
|
- {{-- @if(false)
|
|
|
- <textarea class="form-control @error('message') is-invalid @enderror" id="message" wire:model="message" rows="10" placeholder="Inserisci il contenuto del messaggio (supporta HTML)"></textarea>
|
|
|
- <div class="form-text">
|
|
|
- <small class="text-muted">Puoi utilizzare HTML per formattare il messaggio. Parole: <span class="fw-bold">{{ str_word_count(strip_tags($message)) }}</span></small>
|
|
|
- </div>
|
|
|
- @endif --}}
|
|
|
- {{-- <div class="editor-container editor-container_classic-editor editor-container_include-style editor-container_include-block-toolbar" id="editor-container">
|
|
|
- <div class="editor-container__editor">
|
|
|
- <div id="editor"></div>
|
|
|
- </div>
|
|
|
- </div> --}}
|
|
|
- <textarea wire:model="message" class="form-control required" name="message" id="message"></textarea>
|
|
|
- @error('message')
|
|
|
- <div class="invalid-feedback">{{ $message }}</div>
|
|
|
+ <h4>Messaggio</h4>
|
|
|
+ <textarea class="form-control" id="message"></textarea>
|
|
|
+ @error('content_html')
|
|
|
+ <div class="invalid-feedback d-block">{{ $message }}</div>
|
|
|
@enderror
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- @if($add)
|
|
|
- <div class="row mb-4">
|
|
|
- <div class="col">
|
|
|
- <label class="form-label">Opzioni di Invio</label>
|
|
|
- <div class="d-flex gap-2 comunication-send-options">
|
|
|
- <label class="form-check" for="sendNow">
|
|
|
- <input class="form-check-input" type="radio" name="sendOption" id="sendNow" wire:model="sendNow" value="1">
|
|
|
- <i class="fas fa-envelope me-2"></i>
|
|
|
- <span>Invia Immediatamente</span>
|
|
|
- </label>
|
|
|
- <label class="form-check" for="scheduleFor">
|
|
|
- <input class="form-check-input" type="radio" name="sendOption" id="scheduleFor" wire:model="sendNow" value="0">
|
|
|
- <i class="fas fa-clock me-2"></i>
|
|
|
- <span>Programma per dopo</span>
|
|
|
- </label>
|
|
|
- </div>
|
|
|
+ {{-- Allegati --}}
|
|
|
+ <div class="row mb-5">
|
|
|
+ <div class="col">
|
|
|
+ <div class="form--item">
|
|
|
+ <h4>Allegati</h4>
|
|
|
+ <input type="file" class="form-control @error('newAttachments.*') is-invalid @enderror" wire:model="newAttachments" multiple @if($locked) disabled @endif>
|
|
|
+ <small class="text-muted d-block mt-1">Formati: pdf, docx, jpg, png</small>
|
|
|
+ @error('newAttachments.*')
|
|
|
+ <div class="invalid-feedback d-block">{{ $message }}</div>
|
|
|
+ @enderror
|
|
|
+
|
|
|
+ @if(!empty($existingAttachments))
|
|
|
+ <ul class="list-group mt-2">
|
|
|
+ @foreach($existingAttachments as $att)
|
|
|
+ <li class="list-group-item d-flex justify-content-between align-items-center gap-3">
|
|
|
+ <div class="d-flex align-items-center gap-3 text-truncate" style="min-width:0">
|
|
|
+ @if(!empty($att['img']) && !empty($att['url']))
|
|
|
+ <img src="{{ $att['url'] }}" alt="" style="width:40px;height:40px;object-fit:cover;border-radius:6px;border:1px solid #eee">
|
|
|
+ @else
|
|
|
+ <i class="fa-regular fa-file" style="font-size:20px;width:40px;text-align:center"></i>
|
|
|
+ @endif
|
|
|
+
|
|
|
+ <div class="text-truncate d-flex ">
|
|
|
+ @if(!empty($att['url']))
|
|
|
+ <a href="{{ $att['url'] }}" target="_blank" class="text-decoration-none text-truncate d-inline-block" style="max-width:420px">
|
|
|
+ {{ $att['name'] }}
|
|
|
+ </a>
|
|
|
+ @else
|
|
|
+ <span class="text-truncate d-inline-block" style="max-width:420px">{{ $att['name'] }}</span>
|
|
|
+ @endif
|
|
|
+ @if(!empty($att['size']))
|
|
|
+ <small class="text-muted ms-2">({{ $att['size'] }})</small>
|
|
|
+ @endif
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ @unless($locked)
|
|
|
+ <button type="button"
|
|
|
+ class="btn btn-sm btn-outline-danger"
|
|
|
+ wire:click="removeExistingAttachment({{ (int)$att['id'] }})"
|
|
|
+ title="Rimuovi">
|
|
|
+ <i class="fa-solid fa-trash"></i>
|
|
|
+ </button>
|
|
|
+ @endunless
|
|
|
+ </li>
|
|
|
+ @endforeach
|
|
|
+ </ul>
|
|
|
+ @endif
|
|
|
+
|
|
|
+ {{-- File appena selezionati (non salvati) --}}
|
|
|
+ @if(is_array($newAttachments) && count($newAttachments))
|
|
|
+ <ul class="list-group mt-2">
|
|
|
+ @foreach($newAttachments as $idx => $tmp)
|
|
|
+ <li class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
+ <div class="text-truncate d-flex ">
|
|
|
+ <i class="fa-regular fa-file me-2"></i>
|
|
|
+ {{ $tmp->getClientOriginalName() }}
|
|
|
+ <small class="text-muted ms-2">({{ number_format($tmp->getSize()/1024,1) }} KB) — non ancora salvato</small>
|
|
|
+ </div>
|
|
|
+ <button type="button" class="btn btn-sm btn-outline-danger" wire:click="removeNewAttachment({{ $idx }})">
|
|
|
+ <i class="fa-solid fa-xmark"></i>
|
|
|
+ </button>
|
|
|
+ </li>
|
|
|
+ @endforeach
|
|
|
+ </ul>
|
|
|
+ @endif
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
|
|
|
- @if(!$sendNow)
|
|
|
- <div class="row mb-4">
|
|
|
- <div class="col-md-6">
|
|
|
- <label for="scheduledDateTime" class="form-label">Data e Ora di Invio</label>
|
|
|
- <input type="datetime-local" class="form-control @error('scheduledDateTime') is-invalid @enderror" id="scheduledDateTime" wire:model="scheduledDateTime">
|
|
|
- @error('scheduledDateTime')
|
|
|
- <div class="invalid-feedback">{{ $message }}</div>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
+ {{-- Opzioni invio --}}
|
|
|
+ <div class="row mb-5">
|
|
|
+ <div class="col">
|
|
|
+ <h4>Opzioni di Invio</h4>
|
|
|
+ <div class="d-flex gap-3 comunication-send-options">
|
|
|
+ <label class="form-check">
|
|
|
+ <input class="form-check-input" type="radio" wire:model="mode" value="now">
|
|
|
+ <i class="fas fa-envelope me-2"></i> <span>Invia subito</span>
|
|
|
+ </label>
|
|
|
+ <label class="form-check">
|
|
|
+ <input class="form-check-input" type="radio" wire:model="mode" value="schedule">
|
|
|
+ <i class="fas fa-clock me-2"></i> <span>Programma</span>
|
|
|
+ </label>
|
|
|
</div>
|
|
|
- @endif
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ @if(!$locked && $mode === 'schedule')
|
|
|
+ <div class="row mb-5">
|
|
|
+ <div class="col-md-6">
|
|
|
+ <label for="scheduledDateTime" class="form-label">Data e Ora di Invio</label>
|
|
|
+ <input type="datetime-local" class="form-control @error('schedule_at') is-invalid @enderror" id="scheduledDateTime" wire:model="schedule_at">
|
|
|
+ @error('schedule_at') <div class="invalid-feedback">{{ $message }}</div> @enderror
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
@endif
|
|
|
|
|
|
- <div class="form--item mt-5">
|
|
|
- <button type="button" class="btn--ui lightGrey" wire:click="cancel()">Annulla</button>
|
|
|
- @if($add)
|
|
|
- <button type="submit" class="btn--ui" wire:click.prevent="store()">
|
|
|
- @if($sendNow)
|
|
|
- Salva e Invia
|
|
|
- @else
|
|
|
- Salva e Programma
|
|
|
- @endif
|
|
|
- </button>
|
|
|
- @endif
|
|
|
- @if($update)
|
|
|
- <button type="submit" class="btn--ui" wire:click.prevent="update()">Salva</button>
|
|
|
+ <div class="form--item mt-5 mb-5 d-flex gap-2">
|
|
|
+ @if(!$locked)
|
|
|
+ <a class="btn--ui lightGrey" href="/mail_comunications">Annulla</a>
|
|
|
+ <button type="button" class="btn--ui" onclick="submitEmail('draft')" style="margin-right: auto">Salva bozza</button>
|
|
|
+ @if($mode==='now')
|
|
|
+ <button type="button" class="btn--ui" onclick="submitEmail('send')">Invia ora</button>
|
|
|
+ @else
|
|
|
+ <button type="button" class="btn--ui" onclick="submitEmail('schedule')">Salva & Programma</button>
|
|
|
+ @endif
|
|
|
+ @else
|
|
|
+ <a class="btn--ui lightGrey" href="/mail_comunications">Torna indietro</a>
|
|
|
@endif
|
|
|
</div>
|
|
|
|
|
|
@@ -356,20 +443,19 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- @endif
|
|
|
+ </section>
|
|
|
</div>
|
|
|
|
|
|
@if (session()->has('success'))
|
|
|
<div class="alert alert-success alert-dismissible fade show mt-3" role="alert">
|
|
|
- {{ session()->get('success') }}
|
|
|
+ {{ session('success') }}
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
|
</div>
|
|
|
@endif
|
|
|
|
|
|
@if (session()->has('error'))
|
|
|
<div class="alert alert-danger alert-dismissible fade show mt-3" role="alert">
|
|
|
- {{ session()->get('error') }}
|
|
|
+ {{ session('error') }}
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
|
</div>
|
|
|
@endif
|
|
|
@@ -389,26 +475,42 @@
|
|
|
|
|
|
@push('scripts')
|
|
|
<script type="text/javascript">
|
|
|
+ document.addEventListener('livewire:load', () => {
|
|
|
+ if (!$.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
+ loadArchiveDataTable();
|
|
|
+ }
|
|
|
|
|
|
- $(document).ready(function() {
|
|
|
- loadDataTable();
|
|
|
- loadArchiveDataTable();
|
|
|
+ window.addEventListener('email-deleted', (e) => {
|
|
|
+ const id = e.detail?.id;
|
|
|
+ const table = $('#tablesaw-350');
|
|
|
+ if (!id || !$.fn.DataTable.isDataTable(table)) return;
|
|
|
+
|
|
|
+ const dt = table.DataTable();
|
|
|
+ const rowEl = document.getElementById('row_email_' + id);
|
|
|
+ if (rowEl) {
|
|
|
+ dt.row(rowEl).remove().draw(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
- Livewire.on('load-data-table', () => {
|
|
|
- loadDataTable();
|
|
|
- loadArchiveDataTable();
|
|
|
+
|
|
|
+
|
|
|
+ window.addEventListener('init-recipients-table', (e) => {
|
|
|
+ const selected = e.detail?.selected || [];
|
|
|
+ loadDataTable(selected);
|
|
|
});
|
|
|
|
|
|
function loadArchiveDataTable(){
|
|
|
- if ($.fn.DataTable.isDataTable('#tablesaw-350')) {
|
|
|
- $('#tablesaw-350').DataTable().destroy();
|
|
|
+ let table = $('#tablesaw-350').DataTable();
|
|
|
+ if ( $.fn.DataTable.isDataTable('#tablesaw-350') ) {
|
|
|
+ table.destroy();
|
|
|
}
|
|
|
|
|
|
$('#tablesaw-350').DataTable({
|
|
|
thead: {
|
|
|
- 'th': {'background-color': 'blue'}
|
|
|
+ 'th': {'background-color': 'blue'}
|
|
|
},
|
|
|
+ order: [[7, 'desc']],
|
|
|
layout: {
|
|
|
topStart : null,
|
|
|
topEnd : null,
|
|
|
@@ -419,23 +521,23 @@
|
|
|
text: 'ESPORTA',
|
|
|
buttons: [
|
|
|
{
|
|
|
- extend: 'excelHtml5',
|
|
|
- title: 'Templates Email',
|
|
|
+ extend: 'excelHtml5',
|
|
|
+ title: 'Email',
|
|
|
exportOptions: {
|
|
|
columns: ":not(':last')"
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
extend: 'pdfHtml5',
|
|
|
- title: 'Templates Email',
|
|
|
- exportOptions: {
|
|
|
- columns: ":not(':last')"
|
|
|
- }
|
|
|
- },
|
|
|
+ title: 'Email',
|
|
|
+ exportOptions: {
|
|
|
+ columns: ":not(':last')"
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
extend: 'print',
|
|
|
text: 'Stampa',
|
|
|
- title: 'Templates Email',
|
|
|
+ title: 'Email',
|
|
|
exportOptions: {
|
|
|
columns: ":not(':last')"
|
|
|
}
|
|
|
@@ -453,38 +555,36 @@
|
|
|
top1C :'search',
|
|
|
},
|
|
|
pagingType: 'numbers',
|
|
|
- "language": {
|
|
|
+ language: {
|
|
|
"url": "/assets/js/Italian.json"
|
|
|
},
|
|
|
- "fnInitComplete": function (oSettings, json) {
|
|
|
+ fnInitComplete: function (oSettings, json) {
|
|
|
var html = ' <a href="#" class="addData btn--ui"><i class="fa-solid fa-plus"></i></a>';
|
|
|
$(".dt-search").append(html);
|
|
|
}
|
|
|
});
|
|
|
- $('#tablesaw-350 thead tr th').addClass('col');
|
|
|
- $('#tablesaw-350 thead tr th').css("background-color", "#f6f8fa");
|
|
|
|
|
|
- $(document).ready(function() {
|
|
|
- $(document).on("click",".addData",function() {
|
|
|
- $(".title--section_addButton").trigger("click")
|
|
|
- });
|
|
|
+ $('#tablesaw-350 thead tr th').addClass('col').css("background-color", "#f6f8fa");
|
|
|
+
|
|
|
+ $(document).on("click",".addData",function() {
|
|
|
+ @this.add();
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
- $(document).ready(function() {
|
|
|
- $(document).on("click",".showHideFilter",function() {
|
|
|
- $(".showFilter").toggle();
|
|
|
-
|
|
|
- $('.filterCards').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
|
|
|
- $('.filterStatus').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
|
|
|
- $('.filterScadenza').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
|
|
|
- $('.filterCertificateType').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
|
|
|
- $('.filterCategories').select2({"language": {"noResults": function(){return "Nessun risultato";}}});
|
|
|
+
|
|
|
+ $(document).on("click",".showHideFilter",function() {
|
|
|
+ $(".showFilter").toggle();
|
|
|
+ $('.filterCards,.filterStatus,.filterScadenza,.filterCertificateType,.filterCategories,.filterCourses').each(function(){
|
|
|
+ $(this).select2({
|
|
|
+ language: { noResults: ()=>"Nessun risultato" }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- function resetFilters(event)
|
|
|
- {
|
|
|
+ $(document).on("click", ".addRecipients", function() {
|
|
|
+ $("#addRecipientsRow").toggle();
|
|
|
+ });
|
|
|
+
|
|
|
+ window.resetFilters = function(event){
|
|
|
if (event) event.preventDefault();
|
|
|
|
|
|
$('.filterCards').val('').trigger('change');
|
|
|
@@ -492,6 +592,7 @@
|
|
|
$('.filterScadenza').val('-1').trigger('change');
|
|
|
$('.filterCertificateType').val('-1').trigger('change');
|
|
|
$('.filterCategories').val('-1').trigger('change');
|
|
|
+ $('.filterCourses').val('-1').trigger('change');
|
|
|
|
|
|
|
|
|
$('input[name="txtFromYear"]').val('');
|
|
|
@@ -502,60 +603,59 @@
|
|
|
loadDataTable();
|
|
|
}
|
|
|
|
|
|
- function loadDataTable(event = null) {
|
|
|
- if (event) event.preventDefault();
|
|
|
+ function loadDataTable(preselected = []) {
|
|
|
+ const selectedIds = new Set((preselected || []).map(x => parseInt(x, 10)).filter(Boolean));
|
|
|
|
|
|
if ($.fn.DataTable.isDataTable('#recipients-table')) {
|
|
|
$('#recipients-table').DataTable().destroy();
|
|
|
}
|
|
|
|
|
|
var fromYear = $('input[name="txtFromYear"]').val();
|
|
|
- localStorage.setItem("fromYearMember", fromYear);
|
|
|
-
|
|
|
var toYear = $('input[name="txtToYear"]').val();
|
|
|
- localStorage.setItem("toYearMember", toYear);
|
|
|
-
|
|
|
var fromYearYear = $('input[name="txtFromYearYear"]').val();
|
|
|
- localStorage.setItem("fromYearYearMember", fromYearYear);
|
|
|
-
|
|
|
var toYearYear = $('input[name="txtToYearYear"]').val();
|
|
|
- localStorage.setItem("toYearYearMember", toYearYear);
|
|
|
-
|
|
|
var filterCards = $('.filterCards').val();
|
|
|
- localStorage.setItem("filterCardsMember", filterCards);
|
|
|
-
|
|
|
var filterStatus = $('.filterStatus').val();
|
|
|
- localStorage.setItem("filterStatusMember", filterStatus);
|
|
|
-
|
|
|
var filterScadenza = $('.filterScadenza').val();
|
|
|
- localStorage.setItem("filterScadenzaMember", filterScadenza);
|
|
|
-
|
|
|
var filterCertificateType = $('.filterCertificateType').val();
|
|
|
- localStorage.setItem("filterCertificateTypeMember", filterCertificateType);
|
|
|
-
|
|
|
var filterCategories = $('.filterCategories').val();
|
|
|
- localStorage.setItem("filterCategoriesMember", filterCategories)
|
|
|
-
|
|
|
- const pageLength = 10;
|
|
|
+ var filterCourses = $('.filterCourses').val();
|
|
|
|
|
|
const dataTable = $('#recipients-table').DataTable({
|
|
|
serverSide: true,
|
|
|
- ajax: '/get_members?cards=' + filterCards + "&filterCategories=" + filterCategories + "&filterCertificateType=" + filterCertificateType + "&filterScadenza=" + filterScadenza + "&filterStatus=" + filterStatus + "&fromYear=" + fromYear + "&toYear=" + toYear + "&fromYearYear=" + fromYearYear + "&toYearYear=" + toYearYear,
|
|
|
+ ajax: '/get_recipients?cards=' + filterCards + "&filterCategories=" + filterCategories + "&filterCertificateType=" + filterCertificateType + "&filterScadenza=" + filterScadenza + "&filterStatus=" + filterStatus + "&fromYear=" + fromYear + "&toYear=" + toYear + "&fromYearYear=" + fromYearYear + "&toYearYear=" + toYearYear + "&filterCourses=" + (filterCourses || ""),
|
|
|
columns: [
|
|
|
+ {
|
|
|
+ orderable: false,
|
|
|
+ data: "id",
|
|
|
+ render: function (data){
|
|
|
+ const id = parseInt(data, 10);
|
|
|
+ const checked = selectedIds.has(id) ? 'checked' : '';
|
|
|
+ return `<input type="checkbox" value="${id}" ${checked} onclick="toggleRecipient(${id})" id="recipient_${id}"/>`;
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
data: "last_name",
|
|
|
render: function (data){
|
|
|
const d = data.split("|");
|
|
|
- var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
|
|
|
- return ret;
|
|
|
+ const id = d[1], value = d[0];
|
|
|
+ return `<label for="recipient_${id}">${value}</label>`;
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
data: "first_name",
|
|
|
render: function (data){
|
|
|
const d = data.split("|");
|
|
|
- var ret = '<a style="cursor:pointer" onclick="showData(' + d[1] + ')">' + d[0] + '</a>';
|
|
|
- return ret;
|
|
|
+ const id = d[1], value = d[0];
|
|
|
+ return `<label for="recipient_${id}">${value}</label>`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ data: "email",
|
|
|
+ render: function (data){
|
|
|
+ const d = data.split("|");
|
|
|
+ const id = d[1], value = d[0];
|
|
|
+ return `<label for="recipient_${id}">${value}</label>`;
|
|
|
}
|
|
|
},
|
|
|
{ data: "phone"},
|
|
|
@@ -565,41 +665,23 @@
|
|
|
data: "status",
|
|
|
render: function (data){
|
|
|
const d = data.split("|");
|
|
|
- var ret = '<span class="tablesaw-cell-content"><span class="badge tessera-badge ' + d[0] + '">' + d[1] + '</span></span>';
|
|
|
- return ret;
|
|
|
+ return '<span class="tablesaw-cell-content"><span class="badge tessera-badge ' + d[0] + '">' + d[1] + '</span></span>';
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
data: "certificate",
|
|
|
render: function (data){
|
|
|
- var ret = '';
|
|
|
- if (data != "") {
|
|
|
- const d = data.split("|");
|
|
|
- ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
|
|
|
- if (d[0] == "0") {
|
|
|
- ret += '<i class="ico--ui check suspended me-2"></i>';
|
|
|
- ret += 'Scaduto : ';
|
|
|
- }
|
|
|
- if (d[0] == "1") {
|
|
|
- ret += '<i class="ico--ui check due me-2"></i>';
|
|
|
- ret += 'In scadenza : ';
|
|
|
- }
|
|
|
- if (d[0] == "2") {
|
|
|
- ret += '<i class="ico--ui check active me-2"></i>';
|
|
|
- ret += 'Scadenza : ';
|
|
|
- }
|
|
|
- ret += d[1];
|
|
|
- ret += '</span>';
|
|
|
- }
|
|
|
- if(data == ""){
|
|
|
- ret += '<span class="tablesaw-cell-content d-flex align-items-center">';
|
|
|
- ret += '<i class="ico--ui check absent me-2"></i>';
|
|
|
- ret += 'Non consegnato';
|
|
|
- ret += '</span>';
|
|
|
- }
|
|
|
- return ret;
|
|
|
+ if (!data) return '<span class="tablesaw-cell-content d-flex align-items-center"><i class="ico--ui check absent me-2"></i>Non consegnato</span>';
|
|
|
+ const d = data.split("|");
|
|
|
+ const icon = d[0] === "0" ? "suspended" : (d[0] === "1" ? "due" : "active");
|
|
|
+ const label = d[0] === "0" ? "Scaduto" : (d[0] === "1" ? "In scadenza" : "Scadenza");
|
|
|
+ return '<span class="tablesaw-cell-content d-flex align-items-center"><i class="ico--ui check '+icon+' me-2"></i>'+label+' : '+d[1]+'</span>';
|
|
|
}
|
|
|
},
|
|
|
+ { data: "categories" },
|
|
|
+ ],
|
|
|
+ order: [
|
|
|
+ [1, 'desc']
|
|
|
],
|
|
|
fixedHeader: false,
|
|
|
thead: {
|
|
|
@@ -617,21 +699,20 @@
|
|
|
top1C :'search',
|
|
|
},
|
|
|
pagingType: 'numbers',
|
|
|
- "language": {
|
|
|
+ language: {
|
|
|
"url": "/assets/js/Italian.json"
|
|
|
},
|
|
|
- "fnInitComplete": function (oSettings, json) {
|
|
|
+ fnInitComplete: function (oSettings, json) {
|
|
|
var html = ' <a style="cursor:pointer" class="showHideFilter btn--ui"><i class="fa-solid fa-sliders"></i></a>';
|
|
|
$(".dt-search").append(html);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- $('#recipients-table thead tr th').addClass('col');
|
|
|
- $('#recipients-table thead tr th').css("background-color", "#f6f8fa");
|
|
|
- $('#recipients-table').on('draw.dt', function() {
|
|
|
- $('[data-bs-toggle="popover"]').popover()
|
|
|
- });
|
|
|
+ $('#recipients-table thead tr th').addClass('col').css("background-color", "#f6f8fa");
|
|
|
+ $('#recipients-table').on('draw.dt', function() { $('[data-bs-toggle="popover"]').popover() });
|
|
|
}
|
|
|
+
|
|
|
+ window.toggleRecipient = function(id) { @this.toggleRecipient(id); }
|
|
|
</script>
|
|
|
|
|
|
{{-- CKEditor --}}
|
|
|
@@ -645,33 +726,49 @@
|
|
|
}
|
|
|
</script>
|
|
|
<script type="module">
|
|
|
- import { ClassicEditor } from "ckeditor5";
|
|
|
- import { editorConfig } from "/assets/libraries/ckeditor5/config.js";
|
|
|
-
|
|
|
- Livewire.on("load-editor", () => {
|
|
|
- let messageField = document.querySelector('#message');
|
|
|
-
|
|
|
- if (messageField) {
|
|
|
- if (messageField.ckeditorInstance) messageField.ckeditorInstance.destroy();
|
|
|
-
|
|
|
- editorConfig.simpleUpload = {
|
|
|
- uploadUrl: "{{route('ckeditor.upload', ['_token' => csrf_token()])}}"
|
|
|
- }
|
|
|
-
|
|
|
- console.log(editorConfig);
|
|
|
-
|
|
|
- ClassicEditor
|
|
|
- .create(messageField, editorConfig)
|
|
|
- .then(editor => {
|
|
|
- editor.model.document.on('change:data', () => {
|
|
|
- @this.set('message', editor.getData());
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- console.error(error);
|
|
|
- });
|
|
|
+import { ClassicEditor } from "ckeditor5";
|
|
|
+import { editorConfig } from "/assets/libraries/ckeditor5/config.js";
|
|
|
+
|
|
|
+window.addEventListener("load-editor", (e) => {
|
|
|
+ let detail = e.detail || {};
|
|
|
+ let latestLocked = !!detail.locked;
|
|
|
+ let html = detail.html ?? '';
|
|
|
+
|
|
|
+ let el = document.querySelector('#message');
|
|
|
+ if (el.ckeditorInstance) el.ckeditorInstance.destroy();
|
|
|
+
|
|
|
+ editorConfig.simpleUpload = {
|
|
|
+ uploadUrl: "{{ route('ckeditor.upload', ['_token' => csrf_token()]) }}"
|
|
|
+ };
|
|
|
+
|
|
|
+ ClassicEditor
|
|
|
+ .create(el, editorConfig)
|
|
|
+ .then(editor => {
|
|
|
+ el.ckeditorInstance = editor;
|
|
|
+
|
|
|
+ editor.setData(html);
|
|
|
+
|
|
|
+ if (latestLocked) {
|
|
|
+ editor.enableReadOnlyMode('locked');
|
|
|
+ return;
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
+ .catch(console.error)
|
|
|
+});
|
|
|
+
|
|
|
+window.submitEmail = function(action){
|
|
|
+ const ed = document.querySelector('#message')?.ckeditorInstance;
|
|
|
+ const html = ed ? ed.getData() : '';
|
|
|
+
|
|
|
+ if (action === 'draft') {
|
|
|
+ @this.call('saveDraft', html);
|
|
|
+ } else if (action === 'send') {
|
|
|
+ @this.call('sendNow', html);
|
|
|
+ } else {
|
|
|
+ @this.call('scheduleMessage', html);
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
+
|
|
|
{{-- END CKEditor --}}
|
|
|
@endpush
|