netgescon-day0/app/Modules/StampeRate/Views/index_old_broken.blade.php

198 lines
9.6 KiB
PHP

@extends('modules.layouts.base')
@php
$moduleTitle = 'Stampe Rate';
$moduleIcon = 'fas fa-print';
$moduleBreadcrumb = 'Moduli > Stampe Rate';
@endphp
@section('module-actions')
<div class="btn-group" role="group">
@can('stampe_rate_create')
<a href="{{ route('stampeRate.create') }}" class="btn btn-module-primary">
<i class="fas fa-plus me-1"></i>
Nuova Stampa
</a>
@endcan
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown">
<i class="fas fa-cog"></i>
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="{{ route('stampeRate.dashboard') }}"><i class="fas fa-chart-bar me-2"></i>Dashboard</a></li>
<li><a class="dropdown-item" href="{{ route('stampeRate.history.index') }}"><i class="fas fa-history me-2"></i>Cronologia</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{{ route('stampeRate.templates.index') }}"><i class="fas fa-file-alt me-2"></i>Template</a></li>
</ul>
</div>
@endsection
@section('module-content')n.layouts.netgescon')
@section('title', 'Stampe Rate Avanzate')
@section('breadcrumb')
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ route('dashboard') }}">Dashboard</a></li>
<li class="breadcrumb-item active" aria-current="page">Stampe Rate</li>
</ol>
</nav>
@endsection
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h3 class="card-title mb-0">
<i class="fas fa-print me-2"></i>
Stampe Rate Avanzate
</h3>
<div>
<a href="{{ route('stampeRate.create') }}" class="btn btn-primary">
<i class="fas fa-plus me-1"></i>
Nuova Stampa
</a>
<a href="{{ route('stampeRate.templates.index') }}" class="btn btn-outline-secondary">
<i class="fas fa-cog me-1"></i>
Gestisci Template
</a>
</div>
</div>
<div class="card-body">
@if($stampe->isEmpty())
<div class="text-center py-5">
<i class="fas fa-print text-muted" style="font-size: 3rem;"></i>
<h4 class="mt-3 text-muted">Nessuna stampa rate ancora generata</h4>
<p class="text-muted">Inizia creando la tua prima stampa rate utilizzando i nostri template professionali.</p>
<a href="{{ route('stampeRate.create') }}" class="btn btn-primary btn-lg">
<i class="fas fa-plus me-2"></i>
Crea Prima Stampa
</a>
</div>
@else
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>Data Creazione</th>
<th>Stabile</th>
<th>Template</th>
<th>Rate Generate</th>
<th>Stato</th>
<th>Azioni</th>
</tr>
</thead>
<tbody>
@foreach($stampe as $stampa)
<tr>
<td>
<span class="fw-bold">{{ $stampa->created_at->format('d/m/Y') }}</span><br>
<small class="text-muted">{{ $stampa->created_at->format('H:i') }}</small>
</td>
<td>
<span class="fw-bold">{{ $stampa->stabile_nome }}</span><br>
<small class="text-muted">{{ $stampa->stabile_indirizzo }}</small>
</td>
<td>
<span class="badge bg-info">{{ $stampa->template_nome }}</span>
</td>
<td>
<span class="fw-bold text-primary">{{ $stampa->rate_count }}</span> rate
</td>
<td>
@if($stampa->status === 'completed')
<span class="badge bg-success">Completata</span>
@elseif($stampa->status === 'processing')
<span class="badge bg-warning">In elaborazione</span>
@elseif($stampa->status === 'failed')
<span class="badge bg-danger">Errore</span>
@else
<span class="badge bg-secondary">{{ ucfirst($stampa->status) }}</span>
@endif
</td>
<td>
<div class="btn-group" role="group">
<a href="{{ route('stampeRate.show', $stampa->id) }}"
class="btn btn-sm btn-outline-primary"
title="Visualizza">
<i class="fas fa-eye"></i>
</a>
@if($stampa->status === 'completed')
<a href="{{ route('stampeRate.download', $stampa->id) }}"
class="btn btn-sm btn-outline-success"
title="Scarica ZIP">
<i class="fas fa-download"></i>
</a>
@endif
<button type="button"
class="btn btn-sm btn-outline-danger"
title="Elimina"
onclick="confirmDelete({{ $stampa->id }})">
<i class="fas fa-trash"></i>
</button>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- Paginazione -->
@if($stampe->hasPages())
<div class="d-flex justify-content-center mt-4">
{{ $stampe->links() }}
</div>
@endif
@endif
</div>
</div>
</div>
</div>
</div>
<!-- Modal Conferma Eliminazione -->
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Conferma Eliminazione</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Sei sicuro di voler eliminare questa stampa rate? L'operazione non può essere annullata.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Annulla</button>
<form id="deleteForm" method="POST" style="display: inline;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Elimina</button>
</form>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
function confirmDelete(id) {
const deleteForm = document.getElementById('deleteForm');
deleteForm.action = `/stampe-rate/${id}`;
const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
deleteModal.show();
}
// Auto refresh per le stampe in elaborazione
@if($stampe->where('status', 'processing')->count() > 0)
setTimeout(function() {
location.reload();
}, 10000); // Ricarica ogni 10 secondi se ci sono stampe in elaborazione
@endif
</script>
@endpush