fix mailing an email
This commit is contained in:
@@ -2,6 +2,26 @@
|
||||
@section('title', 'Nuovo Gruppo')
|
||||
@section('page_title', 'Nuovo Gruppo')
|
||||
|
||||
@push('styles')
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap4-theme@1.0.0/dist/select2-bootstrap4.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice {
|
||||
color: #333;
|
||||
}
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-search__field {
|
||||
height: 28px !important;
|
||||
min-height: 28px !important;
|
||||
width: auto !important;
|
||||
min-width: 30px;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
margin: 0;
|
||||
padding: 0 4px;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<form action="/gruppi" method="POST">
|
||||
@csrf
|
||||
@@ -37,10 +57,9 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Diocesi</label>
|
||||
<select name="diocesi_id" class="form-control">
|
||||
<option value="">Seleziona...</option>
|
||||
<select name="diocesi_ids[]" class="form-control select2-multi" multiple style="width: 100%;">
|
||||
@foreach($diocesi as $d)
|
||||
<option value="{{ $d->id }}" {{ old('diocesi_id') == $d->id ? 'selected' : '' }}>{{ $d->nome }}</option>
|
||||
<option value="{{ $d->id }}" {{ in_array($d->id, old('diocesi_ids', [])) ? 'selected' : '' }}>{{ $d->nome }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@@ -89,6 +108,33 @@
|
||||
</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 del Gruppo</h3>
|
||||
<button type="button" class="btn btn-xs btn-success float-right" onclick="aggiungiContatto()">
|
||||
<i class="fas fa-plus mr-1"></i> Aggiungi Contatto
|
||||
</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: 40%;">Valore</th>
|
||||
<th style="width: 25%;">Etichetta</th>
|
||||
<th style="width: 80px;">Primario</th>
|
||||
<th style="width: 50px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="contatti-tbody">
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="no-contatti-msg" class="text-center text-muted py-4">
|
||||
<p class="mb-0">Nessun contatto. Clicca su "Aggiungi Contatto" per iniziare.</p>
|
||||
</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>
|
||||
@@ -138,10 +184,69 @@
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.select2-multi').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: 'Cerca diocesi...',
|
||||
width: '100%',
|
||||
sorter: function(data) {
|
||||
return data.sort(function(a, b) {
|
||||
if (a.selected && !b.selected) return -1;
|
||||
if (!a.selected && b.selected) return 1;
|
||||
return a.text.localeCompare(b.text, 'it');
|
||||
});
|
||||
},
|
||||
language: {
|
||||
noResults: function() { return 'Nessuna diocesi trovata'; },
|
||||
searching: function() { return 'Ricerca...'; }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
let contattiIndex = 0;
|
||||
let membriIndex = 0;
|
||||
const membriResponsabiliMap = new Map();
|
||||
|
||||
function aggiungiContatto() {
|
||||
const tbody = document.getElementById('contatti-tbody');
|
||||
const noMsg = document.getElementById('no-contatti-msg');
|
||||
if (noMsg) noMsg.style.display = 'none';
|
||||
|
||||
const row = document.createElement('tr');
|
||||
const idx = contattiIndex;
|
||||
row.innerHTML = `
|
||||
<td>
|
||||
<select name="contatti[${idx}][tipo]" class="form-control" required>
|
||||
<option value="">Seleziona...</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="telefono">Telefono</option>
|
||||
<option value="cellulare">Cellulare</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="text" name="contatti[${idx}][valore]" class="form-control" placeholder="Es. info@example.com" required></td>
|
||||
<td><input type="text" name="contatti[${idx}][etichetta]" class="form-control" placeholder="Es. Ufficio"></td>
|
||||
<td class="text-center">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="contatto-primary-${idx}" name="contatti[${idx}][is_primary]" value="1">
|
||||
<label class="custom-control-label" for="contatto-primary-${idx}"></label>
|
||||
</div>
|
||||
</td>
|
||||
<td><button type="button" class="btn btn-danger btn-xs" onclick="rimuoviContatto(this)"><i class="fas fa-trash"></i></button></td>
|
||||
`;
|
||||
tbody.appendChild(row);
|
||||
contattiIndex++;
|
||||
}
|
||||
|
||||
function rimuoviContatto(btn) {
|
||||
const row = btn.closest('tr');
|
||||
row.remove();
|
||||
if (document.getElementById('contatti-tbody').children.length === 0) {
|
||||
document.getElementById('no-contatti-msg').style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
function aggiungiMembro() {
|
||||
const tbody = document.getElementById('membri-tbody');
|
||||
const noMsg = document.getElementById('no-membri-msg');
|
||||
|
||||
Reference in New Issue
Block a user