fix mailing an email
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
<a href="#signature" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-signature"></i> Firma
|
||||
</a>
|
||||
<a href="#firme" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-pen-fancy"></i> Firme Multiple
|
||||
</a>
|
||||
<a href="#mittenti" class="list-group-item list-group-item-action" data-toggle="tab">
|
||||
<i class="nav-icon fas fa-user-plus"></i> Mittenti Aggiuntivi
|
||||
</a>
|
||||
@@ -197,12 +200,32 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="from_email">Email Mittente Ufficiale <small class="text-muted">(se diversa dall'indirizzo IMAP)</small></label>
|
||||
<input type="email" name="from_email" id="from_email" class="form-control"
|
||||
value="{{ $settings->from_email ?? '' }}"
|
||||
placeholder="es. ufficiale@esempio.it">
|
||||
<small class="text-muted">Se impostata, viene usata come mittente e Reply-To nelle email in uscita</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="from_name">Nome Mittente Ufficiale</label>
|
||||
<input type="text" name="from_name" id="from_name" class="form-control"
|
||||
value="{{ $settings->from_name ?? '' }}"
|
||||
placeholder="es. Nome Ufficiale">
|
||||
</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="{{ $settings->reply_to ?? '' }}">
|
||||
<small class="text-muted">Usato solo se "Email Mittente Ufficiale" non è impostata</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -284,6 +307,64 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="firme">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Firme Multiple</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-sm btn-success" data-toggle="modal" data-target="#firmaModal" onclick="resetFirmaForm()">
|
||||
<i class="fas fa-plus mr-1"></i> Nuova Firma
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@if($firme->count() > 0)
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome</th>
|
||||
<th>Anteprima</th>
|
||||
<th>Predefinita</th>
|
||||
<th style="width: 140px;">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($firme as $firma)
|
||||
<tr>
|
||||
<td><strong>{{ $firma->nome }}</strong></td>
|
||||
<td><small class="text-muted">{!! Str::limit(strip_tags($firma->contenuto_html), 80) !!}</small></td>
|
||||
<td>
|
||||
@if($firma->is_default)
|
||||
<span class="badge badge-success"><i class="fas fa-check"></i> Default</span>
|
||||
@else
|
||||
<form action="{{ route('impostazioni.firma.default', $firma->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Impostare questa firma come predefinita?')">
|
||||
@csrf @method('PUT')
|
||||
<button type="submit" class="btn btn-xs btn-outline-secondary">Imposta default</button>
|
||||
</form>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-xs btn-info" onclick="editFirma({{ $firma->id }}, '{{ addslashes($firma->nome) }}', '{{ addslashes($firma->contenuto_html ?? '') }}')">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<form action="{{ route('impostazioni.firma.destroy', $firma->id) }}" method="POST" class="d-inline" onsubmit="return confirm('Eliminare questa firma?')">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn btn-xs btn-danger"><i class="fas fa-trash"></i></button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<p class="text-muted">Nessuna firma multipla configurata. La firma predefinita nella scheda "Firma" verrà usata come fallback.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="mittenti">
|
||||
<div class="card card-primary">
|
||||
<div class="card-header">
|
||||
@@ -513,9 +594,47 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="firmaModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="firmaForm" method="POST" action="{{ route('impostazioni.firma.store') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="_method" id="firmaMethod" value="POST">
|
||||
<input type="hidden" name="id" id="firmaId" value="">
|
||||
<div class="modal-header bg-primary">
|
||||
<h5 class="modal-title" id="firmaModalTitle"><i class="fas fa-pen-fancy mr-2"></i>Nuova Firma</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="firma_nome">Nome *</label>
|
||||
<input type="text" name="nome" id="firma_nome" class="form-control" required placeholder="Es: Default, Personale, Ufficio">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Contenuto Firma (HTML)</label>
|
||||
<div id="firma-quill-editor" style="height: 200px;"></div>
|
||||
<input type="hidden" name="contenuto_html" id="firma_contenuto_input" value="">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="firma_is_default" name="is_default" value="1">
|
||||
<label class="custom-control-label" for="firma_is_default">Imposta come predefinita</label>
|
||||
</div>
|
||||
</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-save mr-1"></i> Salva Firma</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
let senderAccounts = @json($senderAccounts);
|
||||
let firmaQuillInstance = null;
|
||||
|
||||
function resetSenderForm() {
|
||||
document.getElementById('senderForm').action = '{{ route('impostazioni.sender.store') }}';
|
||||
@@ -696,13 +815,89 @@ function createEditor() {
|
||||
quillEditorInstance = quill;
|
||||
}
|
||||
|
||||
function resetFirmaForm() {
|
||||
document.getElementById('firmaForm').action = '{{ route('impostazioni.firma.store') }}';
|
||||
document.getElementById('firmaMethod').value = 'POST';
|
||||
document.getElementById('firmaModalTitle').textContent = 'Nuova Firma';
|
||||
document.getElementById('firmaForm').reset();
|
||||
document.getElementById('firmaId').value = '';
|
||||
if (firmaQuillInstance) {
|
||||
firmaQuillInstance.root.innerHTML = '';
|
||||
}
|
||||
document.getElementById('firma_contenuto_input').value = '';
|
||||
}
|
||||
|
||||
function editFirma(id, nome, contenuto) {
|
||||
document.getElementById('firmaForm').action = '{{ route('impostazioni.firma.update', '__ID__') }}'.replace('__ID__', id);
|
||||
document.getElementById('firmaMethod').value = 'PUT';
|
||||
document.getElementById('firmaModalTitle').textContent = 'Modifica Firma - ' + nome;
|
||||
document.getElementById('firmaId').value = id;
|
||||
document.getElementById('firma_nome').value = nome;
|
||||
if (firmaQuillInstance && contenuto) {
|
||||
firmaQuillInstance.root.innerHTML = contenuto;
|
||||
document.getElementById('firma_contenuto_input').value = contenuto;
|
||||
}
|
||||
$('#firmaModal').modal('show');
|
||||
}
|
||||
|
||||
function initFirmaQuill() {
|
||||
var container = document.querySelector('#firma-quill-editor');
|
||||
if (!container || firmaQuillInstance) return;
|
||||
|
||||
var quill = new Quill('#firma-quill-editor', {
|
||||
theme: 'snow',
|
||||
modules: {
|
||||
toolbar: [
|
||||
['bold', 'italic', 'underline'],
|
||||
[{ 'color': [] }, { 'background': [] }],
|
||||
[{ 'header': 1 }, { 'header': 2 }, { 'header': 3 }],
|
||||
[{ 'align': [] }],
|
||||
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
||||
['link', 'image'],
|
||||
['clean']
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
var input = document.getElementById('firma_contenuto_input');
|
||||
|
||||
quill.on('text-change', function() {
|
||||
input.value = quill.root.innerHTML;
|
||||
});
|
||||
|
||||
firmaQuillInstance = quill;
|
||||
}
|
||||
|
||||
$('#firmaModal').on('shown.bs.modal', function () {
|
||||
if (typeof Quill === 'undefined') {
|
||||
var script = document.createElement('script');
|
||||
script.src = 'https://cdn.quilljs.com/1.3.7/quill.min.js';
|
||||
script.onload = function() {
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'https://cdn.quilljs.com/1.3.7/quill.snow.css';
|
||||
document.head.appendChild(link);
|
||||
setTimeout(initFirmaQuill, 200);
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
} else {
|
||||
setTimeout(initFirmaQuill, 100);
|
||||
}
|
||||
});
|
||||
|
||||
function initSignatureEditor() {
|
||||
if (quillEditorInstance) 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;
|
||||
script.onload = function() {
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = 'https://cdn.quilljs.com/1.3.7/quill.snow.css';
|
||||
document.head.appendChild(link);
|
||||
setTimeout(createEditor, 200);
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
|
||||
var link = document.createElement('link');
|
||||
|
||||
Reference in New Issue
Block a user