@if (session('ia_estado') === 'requiere_confirmacion')
@php
$iaPropuesta = session('ia_propuesta', []);
$iaLineas = $iaPropuesta['lineas'] ?? [];
$iaClientes = (array) session('ia_clientes', []);
$iaSeries = (array) session('ia_series', []);
$baseTotal = 0; $ivaTotal = 0; $totalTotal = 0;
foreach ($iaLineas as $l) {
$base = (float)($l['cantidad'] ?? 0) * (float)($l['precio_unitario'] ?? 0);
$iva = $base * ((float)($l['iva_porcentaje'] ?? 0) / 100);
$baseTotal += $base;
$ivaTotal += $iva;
$totalTotal += $base + $iva;
}
@endphp
{{-- Header de propuesta --}}
Propuesta generada por IA
Revisa los datos y confirma para emitir la factura
{{-- Cliente detectado --}}
Cliente detectado
{{ session('ia_cliente_detectado') }}
{{-- Tabla de líneas --}}
@if (count($iaLineas) > 0)
Líneas de factura
| Concepto |
Cant. |
P. Unit. |
IVA |
Total |
@foreach ($iaLineas as $l)
@php
$lBase = (float)($l['cantidad'] ?? 0) * (float)($l['precio_unitario'] ?? 0);
$lIva = $lBase * ((float)($l['iva_porcentaje'] ?? 0) / 100);
@endphp
| {{ $l['concepto'] ?? '—' }} |
{{ $l['cantidad'] ?? 0 }} |
{{ number_format((float)($l['precio_unitario'] ?? 0), 2, ',', '.') }} € |
{{ (int)($l['iva_porcentaje'] ?? 0) }}%
|
{{ number_format($lBase + $lIva, 2, ',', '.') }} € |
@endforeach
{{-- Resumen de totales --}}
Base imponible
{{ number_format($baseTotal, 2, ',', '.') }} €
IVA
{{ number_format($ivaTotal, 2, ',', '.') }} €
TOTAL
{{ number_format($totalTotal, 2, ',', '.') }} €
@endif
{{-- Formulario de confirmación (sin botones dentro) --}}
{{-- Form de cancelar separado + botón de confirmar vinculado por form= --}}
@elseif (session('ia_estado') === 'requiere_confirmacion_presupuesto')
@php
$iaPropuesta = session('ia_presupuesto_propuesta', []);
$iaLineas = $iaPropuesta['lineas'] ?? [];
$iaClientes = (array) session('ia_clientes', []);
$baseTotal = 0; $ivaTotal = 0; $totalTotal = 0;
foreach ($iaLineas as $l) {
$base = (float)($l['cantidad'] ?? 0) * (float)($l['precio_unitario'] ?? 0);
$iva = $base * ((float)($l['iva_porcentaje'] ?? 0) / 100);
$baseTotal += $base;
$ivaTotal += $iva;
$totalTotal += $base + $iva;
}
@endphp
{{-- Header de propuesta --}}
Propuesta generada por IA
Revisa los datos y confirma para crear el presupuesto
{{-- Cliente detectado --}}
Cliente detectado
{{ session('ia_cliente_detectado') }}
{{-- Tabla de líneas --}}
@if (count($iaLineas) > 0)
Líneas de presupuesto
| Concepto |
Cant. |
P. Unit. |
IVA |
Total |
@foreach ($iaLineas as $l)
@php
$lBase = (float)($l['cantidad'] ?? 0) * (float)($l['precio_unitario'] ?? 0);
$lIva = $lBase * ((float)($l['iva_porcentaje'] ?? 0) / 100);
@endphp
| {{ $l['concepto'] ?? '—' }} |
{{ $l['cantidad'] ?? 0 }} |
{{ number_format((float)($l['precio_unitario'] ?? 0), 2, ',', '.') }} € |
{{ (int)($l['iva_porcentaje'] ?? 0) }}%
|
{{ number_format($lBase + $lIva, 2, ',', '.') }} € |
@endforeach
{{-- Resumen de totales --}}
Base imponible
{{ number_format($baseTotal, 2, ',', '.') }} €
IVA
{{ number_format($ivaTotal, 2, ',', '.') }} €
TOTAL
{{ number_format($totalTotal, 2, ',', '.') }} €
@endif
{{-- Formulario de confirmación --}}
@elseif (session('ia_estado') === 'requiere_confirmacion_cliente')
@php
$iaCliente = session('ia_cliente_propuesta', []);
@endphp