|
|
@@ -604,10 +604,18 @@ use App\Models\Config;
|
|
604
|
604
|
</div>
|
|
605
|
605
|
|
|
606
|
606
|
<div class="col-12 col-lg-3">
|
|
607
|
|
- <div class="small text-muted mb-1">Assegnata a</div>
|
|
608
|
|
- <div class="fw-semibold mb-2">
|
|
609
|
|
- <i class="bx bx-user-check me-1"></i>
|
|
610
|
|
- {{ $segnalazione->assegnataA ? $segnalazione->assegnataA->full_name : '---' }}
|
|
|
607
|
+ <div class="d-flex justify-content-between align-items-start gap-2 mb-2">
|
|
|
608
|
+ <div class="min-w-0">
|
|
|
609
|
+ <div class="small text-muted mb-1">Assegnata a</div>
|
|
|
610
|
+ <div class="fw-semibold">
|
|
|
611
|
+ <i class="bx bx-user-check me-1"></i>
|
|
|
612
|
+ {{ $segnalazione->assegnataA ? $segnalazione->assegnataA->full_name : '---' }}
|
|
|
613
|
+ </div>
|
|
|
614
|
+ </div>
|
|
|
615
|
+ <div class="text-end flex-shrink-0">
|
|
|
616
|
+ <div class="small text-muted mb-1">Tempo totale</div>
|
|
|
617
|
+ <div class="fw-semibold">{{ $tempoTotale }}</div>
|
|
|
618
|
+ </div>
|
|
611
|
619
|
</div>
|
|
612
|
620
|
@if($segnalazione->ordineLavoro)
|
|
613
|
621
|
@php
|
|
|
@@ -722,15 +730,23 @@ use App\Models\Config;
|
|
722
|
730
|
</button>
|
|
723
|
731
|
<ul class="dropdown-menu dropdown-menu-end">
|
|
724
|
732
|
<li>
|
|
725
|
|
- <a class="dropdown-item" href="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'cliente']) }}" target="_blank">
|
|
|
733
|
+ <button type="button" class="dropdown-item js-apri-pdf-segnalazione"
|
|
|
734
|
+ data-title="Versione cliente"
|
|
|
735
|
+ data-destinatario="cliente"
|
|
|
736
|
+ data-preview-url="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'cliente']) }}"
|
|
|
737
|
+ data-download-url="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'cliente', 'download' => 1]) }}">
|
|
726
|
738
|
Versione cliente
|
|
727
|
|
- </a>
|
|
|
739
|
+ </button>
|
|
728
|
740
|
</li>
|
|
729
|
741
|
@if(! $isVistaCliente)
|
|
730
|
742
|
<li>
|
|
731
|
|
- <a class="dropdown-item" href="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'operatore']) }}" target="_blank">
|
|
|
743
|
+ <button type="button" class="dropdown-item js-apri-pdf-segnalazione"
|
|
|
744
|
+ data-title="Versione operatore"
|
|
|
745
|
+ data-destinatario="operatore"
|
|
|
746
|
+ data-preview-url="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'operatore']) }}"
|
|
|
747
|
+ data-download-url="{{ route('admin.segnalazione.pdf', ['id' => $segnalazione->id, 'destinatario' => 'operatore', 'download' => 1]) }}">
|
|
732
|
748
|
Versione operatore
|
|
733
|
|
- </a>
|
|
|
749
|
+ </button>
|
|
734
|
750
|
</li>
|
|
735
|
751
|
@endif
|
|
736
|
752
|
</ul>
|
|
|
@@ -1272,6 +1288,29 @@ use App\Models\Config;
|
|
1272
|
1288
|
</div>
|
|
1273
|
1289
|
</div>
|
|
1274
|
1290
|
|
|
|
1291
|
+<div class="modal fade" id="modalPdfSegnalazione" tabindex="-1" aria-hidden="true">
|
|
|
1292
|
+ <div class="modal-dialog modal-xl modal-dialog-centered">
|
|
|
1293
|
+ <div class="modal-content">
|
|
|
1294
|
+ <div class="modal-header">
|
|
|
1295
|
+ <h5 class="modal-title" id="modalPdfSegnalazioneTitle">PDF</h5>
|
|
|
1296
|
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Chiudi"></button>
|
|
|
1297
|
+ </div>
|
|
|
1298
|
+ <div class="modal-body p-0">
|
|
|
1299
|
+ <iframe id="modalPdfSegnalazioneFrame" title="Anteprima PDF" style="width: 100%; height: 70vh; border: 0;" src="about:blank"></iframe>
|
|
|
1300
|
+ </div>
|
|
|
1301
|
+ <div class="modal-footer">
|
|
|
1302
|
+ <button type="button" class="btn btn-label-secondary" data-bs-dismiss="modal">Chiudi</button>
|
|
|
1303
|
+ <a class="btn btn-primary" id="btnScaricaPdfSegnalazione" href="#">
|
|
|
1304
|
+ <i class="bx bx-download me-1"></i>Scarica PDF
|
|
|
1305
|
+ </a>
|
|
|
1306
|
+ <button type="button" class="btn btn-success" id="btnInviaPdfSegnalazione">
|
|
|
1307
|
+ <i class="bx bx-envelope me-1"></i>Invia per email
|
|
|
1308
|
+ </button>
|
|
|
1309
|
+ </div>
|
|
|
1310
|
+ </div>
|
|
|
1311
|
+ </div>
|
|
|
1312
|
+</div>
|
|
|
1313
|
+
|
|
1275
|
1314
|
|
|
1276
|
1315
|
|
|
1277
|
1316
|
|
|
|
@@ -2279,6 +2318,100 @@ use App\Models\Config;
|
|
2279
|
2318
|
});
|
|
2280
|
2319
|
}
|
|
2281
|
2320
|
|
|
|
2321
|
+ var pdfSegnalazioneCorrente = { destinatario: 'cliente' };
|
|
|
2322
|
+ var emailClienteSegnalazione = @json($segnalazione->user->email ?? '');
|
|
|
2323
|
+
|
|
|
2324
|
+ $(document).on('click', '.js-apri-pdf-segnalazione', function (e) {
|
|
|
2325
|
+ e.preventDefault();
|
|
|
2326
|
+ var $btn = $(this);
|
|
|
2327
|
+ pdfSegnalazioneCorrente.destinatario = $btn.data('destinatario') || 'cliente';
|
|
|
2328
|
+ $('#modalPdfSegnalazioneTitle').text($btn.data('title') || 'PDF');
|
|
|
2329
|
+ $('#modalPdfSegnalazioneFrame').attr('src', $btn.data('preview-url'));
|
|
|
2330
|
+ $('#btnScaricaPdfSegnalazione').attr('href', $btn.data('download-url'));
|
|
|
2331
|
+ $('#modalPdfSegnalazione').modal('show');
|
|
|
2332
|
+ });
|
|
|
2333
|
+
|
|
|
2334
|
+ $('#modalPdfSegnalazione').on('hidden.bs.modal', function () {
|
|
|
2335
|
+ $('#modalPdfSegnalazioneFrame').attr('src', 'about:blank');
|
|
|
2336
|
+ });
|
|
|
2337
|
+
|
|
|
2338
|
+ $('#btnInviaPdfSegnalazione').on('click', function () {
|
|
|
2339
|
+ Swal.fire({
|
|
|
2340
|
+ title: 'Invia per email',
|
|
|
2341
|
+ input: 'email',
|
|
|
2342
|
+ inputLabel: 'Indirizzo del cliente',
|
|
|
2343
|
+ inputValue: emailClienteSegnalazione,
|
|
|
2344
|
+ inputPlaceholder: 'cliente@example.com',
|
|
|
2345
|
+ showCancelButton: true,
|
|
|
2346
|
+ confirmButtonText: 'Invia',
|
|
|
2347
|
+ cancelButtonText: 'Annulla',
|
|
|
2348
|
+ buttonsStyling: false,
|
|
|
2349
|
+ customClass: {
|
|
|
2350
|
+ confirmButton: 'btn btn-success',
|
|
|
2351
|
+ cancelButton: 'btn btn-label-secondary ms-2'
|
|
|
2352
|
+ },
|
|
|
2353
|
+ didOpen: function () {
|
|
|
2354
|
+ var container = Swal.getContainer();
|
|
|
2355
|
+ if (container) {
|
|
|
2356
|
+ container.style.zIndex = '2000';
|
|
|
2357
|
+ }
|
|
|
2358
|
+ },
|
|
|
2359
|
+ inputValidator: function (value) {
|
|
|
2360
|
+ if (!value) {
|
|
|
2361
|
+ return 'Inserisci un indirizzo email';
|
|
|
2362
|
+ }
|
|
|
2363
|
+ }
|
|
|
2364
|
+ }).then(function (result) {
|
|
|
2365
|
+ if (!result.isConfirmed) {
|
|
|
2366
|
+ return;
|
|
|
2367
|
+ }
|
|
|
2368
|
+ Swal.fire({
|
|
|
2369
|
+ title: 'Invio in corso',
|
|
|
2370
|
+ allowOutsideClick: false,
|
|
|
2371
|
+ allowEscapeKey: false,
|
|
|
2372
|
+ didOpen: function () {
|
|
|
2373
|
+ var container = Swal.getContainer();
|
|
|
2374
|
+ if (container) {
|
|
|
2375
|
+ container.style.zIndex = '2000';
|
|
|
2376
|
+ }
|
|
|
2377
|
+ Swal.showLoading();
|
|
|
2378
|
+ }
|
|
|
2379
|
+ });
|
|
|
2380
|
+ $.ajax({
|
|
|
2381
|
+ url: @json(route('admin.segnalazione.pdf.invia', $segnalazione->id)),
|
|
|
2382
|
+ method: 'POST',
|
|
|
2383
|
+ data: {
|
|
|
2384
|
+ email: result.value,
|
|
|
2385
|
+ destinatario: pdfSegnalazioneCorrente.destinatario
|
|
|
2386
|
+ }
|
|
|
2387
|
+ }).done(function (res) {
|
|
|
2388
|
+ Swal.fire({
|
|
|
2389
|
+ icon: 'success',
|
|
|
2390
|
+ title: 'Email inviata',
|
|
|
2391
|
+ text: (res && res.message) ? res.message : 'PDF inviato.',
|
|
|
2392
|
+ customClass: { confirmButton: 'btn btn-success' },
|
|
|
2393
|
+ buttonsStyling: false
|
|
|
2394
|
+ });
|
|
|
2395
|
+ }).fail(function (xhr) {
|
|
|
2396
|
+ var msg = 'Invio non riuscito';
|
|
|
2397
|
+ if (xhr.responseJSON) {
|
|
|
2398
|
+ if (xhr.responseJSON.errors && xhr.responseJSON.errors.email && xhr.responseJSON.errors.email[0]) {
|
|
|
2399
|
+ msg = xhr.responseJSON.errors.email[0];
|
|
|
2400
|
+ } else if (xhr.responseJSON.message) {
|
|
|
2401
|
+ msg = xhr.responseJSON.message;
|
|
|
2402
|
+ }
|
|
|
2403
|
+ }
|
|
|
2404
|
+ Swal.fire({
|
|
|
2405
|
+ icon: 'error',
|
|
|
2406
|
+ title: 'Errore',
|
|
|
2407
|
+ text: msg,
|
|
|
2408
|
+ customClass: { confirmButton: 'btn btn-danger' },
|
|
|
2409
|
+ buttonsStyling: false
|
|
|
2410
|
+ });
|
|
|
2411
|
+ });
|
|
|
2412
|
+ });
|
|
|
2413
|
+ });
|
|
|
2414
|
+
|
|
2282
|
2415
|
function openModalAllegato(allegatoId) {
|
|
2283
|
2416
|
$('#extraLargeModal .modal-content').load('{{ route("allegato_annotazione.show") }}?allegato_annotazione_id=' + allegatoId);
|
|
2284
|
2417
|
$('#extraLargeModal').modal('show');
|