134 lines
5.4 KiB
Plaintext
134 lines
5.4 KiB
Plaintext
@model VirtualTask.Models.DatiAziendaTable
|
|
|
|
@{
|
|
ViewData["Title"] = "Modifica Intestazione Buoni Intervento";
|
|
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
|
}
|
|
|
|
<div class="agy-project-wrapper agy-project-page-wrapper">
|
|
<div class="container">
|
|
<form id="editForm" asp-action="Edit" enctype="multipart/form-data">
|
|
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
|
@Html.HiddenFor(x => x.azienda)
|
|
@Html.HiddenFor(x => x.url_logo)
|
|
@Html.HiddenFor(x => x.logo)
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered table-striped table-hover align-middle">
|
|
<thead class="table-primary">
|
|
<tr>
|
|
<th scope="col"> </th>
|
|
<th scope="col"> </th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tr>
|
|
<td class="fw-bold fs-5"><span class="badge bg-secondary"><label asp-for="tecnico" class="agy-client-quote"></label></span></td>
|
|
<td>
|
|
@Html.DropDownListFor(x => x.tecnico, (IEnumerable<SelectListItem>)ViewBag.AllTecnici, new { @class = "form-control" })
|
|
<span asp-validation-for="tecnico" class="text-danger"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold fs-5"><span class="badge bg-secondary"><label asp-for="ragsoc" class="agy-client-quote"></label></span></td>
|
|
<td>
|
|
<input asp-for="ragsoc" class="form-control" />
|
|
<span asp-validation-for="ragsoc" class="text-danger"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold fs-5"><span class="badge bg-secondary"><label asp-for="logo" class="agy-client-quote"></label></span></td>
|
|
<td>
|
|
@{
|
|
if (Model.logo != null && Model.logo.Length > 0)
|
|
{
|
|
var base64 = Convert.ToBase64String(Model.logo);
|
|
var imgSrc = $"data:image/png;base64,{base64}";
|
|
<img src="@imgSrc" height="80" class="mb-2" />
|
|
}
|
|
}
|
|
<input type="file" asp-for="logo2" />
|
|
<span asp-validation-for="logo" class="text-danger"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="fw-bold fs-5"><span class="badge bg-secondary"><label asp-for="testo_buono" class="agy-client-quote"></label></span></td>
|
|
<td>
|
|
<textarea asp-for="testo_buono" class="form-control"></textarea>
|
|
<span asp-validation-for="testo_buono" class="text-danger"></span>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2">
|
|
<input type="submit" value="Salva" class="agy-btn submitForm" />
|
|
<a asp-action="Index" class="agy-btn submitForm">Torna alla lista</a>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- TinyMCE -->
|
|
<script src="~/js/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
|
|
|
<!-- ✅ Dialog identica a quella della Create -->
|
|
<div class="modal fade" id="saveModal" tabindex="-1" role="dialog" aria-labelledby="saveModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="saveModalLabel">Dati salvati</h5>
|
|
</div>
|
|
<div class="modal-body">
|
|
I dati salvati non saranno visibili nell'app finché non effettuerai il logout.
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" id="modalOkBtn">OK</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@section Scripts {
|
|
@{
|
|
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
|
}
|
|
|
|
<script>
|
|
tinymce.init({
|
|
selector: 'textarea#testo_buono',
|
|
height: 300,
|
|
menubar: false,
|
|
plugins: 'lists link table code',
|
|
toolbar: 'undo redo | bold italic | bullist numlist | link table | code'
|
|
});
|
|
|
|
document.getElementById('editForm').addEventListener('submit', function (e) {
|
|
e.preventDefault();
|
|
tinymce.triggerSave();
|
|
|
|
const form = e.target;
|
|
const formData = new FormData(form);
|
|
|
|
fetch(form.action, {
|
|
method: 'POST',
|
|
body: formData
|
|
})
|
|
.then(response => {
|
|
if (response.ok) {
|
|
// ✅ Mostra la stessa dialog della Create
|
|
$('#saveModal').modal('show');
|
|
} else {
|
|
alert("Errore durante il salvataggio.");
|
|
}
|
|
})
|
|
.catch(err => console.error(err));
|
|
});
|
|
|
|
document.getElementById('modalOkBtn').addEventListener('click', function () {
|
|
window.location.href = '@Url.Action("Index")';
|
|
});
|
|
</script>
|
|
}
|