This commit is contained in:
Lizandro Guarnizo
2026-01-06 15:35:59 -05:00
commit a768146f65
602 changed files with 42505 additions and 0 deletions
@@ -0,0 +1,193 @@
<x-filament-panels::page>
<div class="space-y-6">
<!-- Resumen de Alertas -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-2 bg-red-100 rounded-lg">
<svg class="w-6 h-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L4.268 18.5c-.77.833.192 2.5 1.732 2.5z"></path>
</svg>
</div>
<div class="ml-4">
<h3 class="text-lg font-medium text-gray-900">Stock Bajo</h3>
<p class="text-2xl font-bold text-red-600">{{ count($productosStockBajo) }}</p>
<p class="text-sm text-gray-500">Productos bajo mínimo</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-2 bg-blue-100 rounded-lg">
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path>
</svg>
</div>
<div class="ml-4">
<h3 class="text-lg font-medium text-gray-900">Bodegas Activas</h3>
<p class="text-2xl font-bold text-blue-600">{{ count($bodegasEstado) }}</p>
<p class="text-sm text-gray-500">Ubicaciones de almacén</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="flex items-center">
<div class="p-2 bg-green-100 rounded-lg">
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"></path>
</svg>
</div>
<div class="ml-4">
<h3 class="text-lg font-medium text-gray-900">Transferencias Sugeridas</h3>
<p class="text-2xl font-bold text-green-600">{{ count($sugerenciasTransferencia) }}</p>
<p class="text-sm text-gray-500">Rebalanceos recomendados</p>
</div>
</div>
</div>
</div>
<!-- Productos con Stock Bajo -->
@if(count($productosStockBajo) > 0)
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="text-lg font-medium text-gray-900">⚠️ Productos con Stock Bajo</h3>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Producto</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Categoría</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock Actual</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock Mínimo</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Distribución</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($productosStockBajo as $producto)
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">{{ $producto['nombre'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">
{{ $producto['categoria'] }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="text-sm font-medium {{ $producto['stock_actual'] == 0 ? 'text-red-600' : 'text-orange-600' }}">
{{ $producto['stock_actual'] }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
{{ $producto['stock_minimo'] }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-xs space-y-1">
@foreach($producto['distribucion'] as $dist)
<div class="flex justify-between">
<span class="text-gray-600">{{ $dist['bodega'] }}:</span>
<span class="font-medium">{{ $dist['stock'] }}</span>
</div>
@endforeach
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
<!-- Estado de Bodegas -->
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="text-lg font-medium text-gray-900">📦 Estado de Bodegas</h3>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-6">
@foreach($bodegasEstado as $bodega)
<div class="border rounded-lg p-4">
<h4 class="font-medium text-gray-900 mb-2">{{ $bodega['nombre'] }}</h4>
<div class="space-y-2 text-sm">
<div class="flex justify-between">
<span class="text-gray-600">Total productos:</span>
<span class="font-medium">{{ $bodega['total_productos'] }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Con stock:</span>
<span class="font-medium">{{ $bodega['productos_con_stock'] }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Stock total:</span>
<span class="font-medium">{{ number_format($bodega['stock_total']) }}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Utilización:</span>
<span class="font-medium {{ $bodega['utilizacion'] > 70 ? 'text-green-600' : ($bodega['utilizacion'] > 40 ? 'text-yellow-600' : 'text-red-600') }}">
{{ $bodega['utilizacion'] }}%
</span>
</div>
</div>
</div>
@endforeach
</div>
</div>
<!-- Transferencias Sugeridas -->
@if(count($sugerenciasTransferencia) > 0)
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="text-lg font-medium text-gray-900">🔄 Transferencias Sugeridas</h3>
<p class="text-sm text-gray-500 mt-1">Rebalanceos automáticos recomendados para optimizar distribución</p>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Producto</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Desde</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Hacia</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cantidad</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Razón</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acción</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($sugerenciasTransferencia as $sugerencia)
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">{{ $sugerencia['producto_nombre'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $sugerencia['bodega_origen'] }}</div>
<div class="text-xs text-gray-500">Stock: {{ $sugerencia['stock_origen'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $sugerencia['bodega_destino'] }}</div>
<div class="text-xs text-gray-500">Stock: {{ $sugerencia['stock_destino'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="text-sm font-medium text-blue-600">{{ $sugerencia['cantidad_sugerida'] }}</span>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">{{ $sugerencia['razon'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<button
wire:click="ejecutarTransferenciaSugerida({{ json_encode($sugerencia) }})"
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
Ejecutar
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
</x-filament-panels::page>
@@ -0,0 +1,139 @@
<div class="space-y-6">
{{-- Información del Período --}}
<div class="bg-blue-50 rounded-lg p-4 border border-blue-200">
<h3 class="text-lg font-semibold text-blue-900 mb-2">📅 Período Analizado</h3>
<div class="grid grid-cols-3 gap-4 text-sm">
<div>
<span class="font-medium text-blue-800">Desde:</span>
<span class="text-blue-600">{{ $resumen['periodo']['fecha_desde'] }}</span>
</div>
<div>
<span class="font-medium text-blue-800">Hasta:</span>
<span class="text-blue-600">{{ $resumen['periodo']['fecha_hasta'] }}</span>
</div>
<div>
<span class="font-medium text-blue-800">Días:</span>
<span class="text-blue-600">{{ $resumen['periodo']['dias'] }} días</span>
</div>
</div>
</div>
{{-- Métricas Principales --}}
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="bg-green-50 rounded-lg p-4 border border-green-200">
<div class="text-2xl font-bold text-green-700">{{ number_format($resumen['totales']['productos_vendidos']) }}</div>
<div class="text-sm text-green-600">Productos Vendidos</div>
</div>
<div class="bg-orange-50 rounded-lg p-4 border border-orange-200">
<div class="text-2xl font-bold text-orange-700">${{ number_format($resumen['totales']['promedio_compra'], 0) }}</div>
<div class="text-sm text-orange-600">Promedio Ponderado</div>
</div>
<div class="bg-red-50 rounded-lg p-4 border border-red-200">
<div class="text-2xl font-bold text-red-700">${{ number_format($resumen['totales']['valor_total_compra'], 0) }}</div>
<div class="text-sm text-red-600">Valor Total Compra</div>
</div>
<div class="bg-purple-50 rounded-lg p-4 border border-purple-200">
<div class="text-2xl font-bold text-purple-700">{{ round($resumen['totales']['margen_total'], 2) }}%</div>
<div class="text-sm text-purple-600">Margen Total</div>
</div>
</div>
{{-- Análisis Financiero --}}
<div class="bg-gray-50 rounded-lg p-4 border border-gray-200">
<h3 class="text-lg font-semibold text-gray-900 mb-3">💰 Análisis Financiero</h3>
<div class="grid grid-cols-2 gap-4 text-sm">
<div>
<span class="font-medium text-gray-700">Valor Total Compra:</span>
<span class="text-gray-900">${{ number_format($resumen['totales']['valor_total_compra'], 0) }}</span>
</div>
<div>
<span class="font-medium text-gray-700">Valor Total Venta:</span>
<span class="text-gray-900">${{ number_format($resumen['totales']['valor_total_venta'], 0) }}</span>
</div>
<div>
<span class="font-medium text-gray-700">Beneficio Total:</span>
<span class="text-{{ $resumen['totales']['beneficio_total'] >= 0 ? 'green' : 'red' }}-600 font-semibold">
${{ number_format($resumen['totales']['beneficio_total'], 0) }}
</span>
</div>
<div>
<span class="font-medium text-gray-700">Promedio Venta:</span>
<span class="text-gray-900">${{ number_format($resumen['totales']['promedio_venta'], 0) }}</span>
</div>
</div>
</div>
{{-- Top Productos --}}
<div class="bg-white rounded-lg border border-gray-200">
<div class="bg-gray-50 px-4 py-3 border-b border-gray-200">
<h3 class="text-lg font-semibold text-gray-900">🏆 Top 10 Productos por Valor de Compra</h3>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Producto</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Cantidad</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Precio Compra</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Valor Total</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($resumen['top_productos'] as $producto)
<tr class="hover:bg-gray-50">
<td class="px-4 py-2 text-sm text-gray-900">{{ $producto->nombre }}</td>
<td class="px-4 py-2 text-sm text-gray-600 text-right">{{ number_format($producto->cantidad_vendida) }}</td>
<td class="px-4 py-2 text-sm text-gray-600 text-right">${{ number_format($producto->precio_compra, 0) }}</td>
<td class="px-4 py-2 text-sm font-medium text-gray-900 text-right">${{ number_format($producto->valor_compra_total, 0) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{{-- Análisis por Categoría --}}
<div class="bg-white rounded-lg border border-gray-200">
<div class="bg-gray-50 px-4 py-3 border-b border-gray-200">
<h3 class="text-lg font-semibold text-gray-900">📊 Análisis por Categoría</h3>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase">Categoría</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Productos</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Cantidad</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Precio Promedio</th>
<th class="px-4 py-2 text-right text-xs font-medium text-gray-500 uppercase">Valor Total</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
@foreach($resumen['categorias'] as $categoria)
<tr class="hover:bg-gray-50">
<td class="px-4 py-2 text-sm font-medium text-gray-900">{{ $categoria->categoria }}</td>
<td class="px-4 py-2 text-sm text-gray-600 text-right">{{ $categoria->productos_diferentes }}</td>
<td class="px-4 py-2 text-sm text-gray-600 text-right">{{ number_format($categoria->cantidad_vendida) }}</td>
<td class="px-4 py-2 text-sm text-gray-600 text-right">${{ number_format($categoria->precio_compra_promedio, 0) }}</td>
<td class="px-4 py-2 text-sm font-medium text-gray-900 text-right">${{ number_format($categoria->valor_compra_total, 0) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
{{-- Notas Explicativas --}}
<div class="bg-yellow-50 rounded-lg p-4 border border-yellow-200">
<h4 class="text-sm font-semibold text-yellow-800 mb-2">📋 Notas Importantes:</h4>
<ul class="text-xs text-yellow-700 space-y-1">
<li> <strong>Promedio Ponderado:</strong> Se calcula como (Σ cantidad × precio_compra) ÷ Σ cantidad</li>
<li> <strong>Margen:</strong> Porcentaje de ganancia sobre el precio de compra</li>
<li> <strong>Valor Total Compra:</strong> Inversión total en los productos vendidos durante el período</li>
<li> <strong>Solo se consideran productos vendidos</strong> en el rango de fechas seleccionado</li>
</ul>
</div>
</div>
@@ -0,0 +1,215 @@
<x-filament-panels::page>
<div class="mb-4" x-data x-init="$nextTick(() => $refs.barcodeInput.focus())">
<input x-ref="barcodeInput" tabindex="1" type="text" wire:model.lazy="barcodeBusqueda"
wire:keydown.enter="buscarProductoPorBarcode" class="w-full p-2 border rounded-lg"
placeholder="Escanea o escribe el código de barras..." />
</div>
<div class="flex gap-4 justify-between w-full">
<div class="w-3/5 min-w-0">
<h2 class="text-xl font-bold">Selecciona un producto</h2>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 w-full text-center">
@foreach ($productos as $producto)
<div class="p-4 border rounded-lg hover:bg-gray-100">
<img src="{{ $producto->imagen ? asset('/storage/' . $producto->imagen) : asset('/img/generico1.png') }}" class="w-32 text-center mx-auto">
<h3 class="font-semibold">{{ $producto->nombre }}</h3>
<p>${{ number_format($producto->precio_venta, 2) }}</p>
@php $bodegas = $producto->bodegas; @endphp
@if($bodegas->count())
<div class="text-xs text-gray-600 mt-1">
Disponible en:
@foreach($bodegas as $bodega)
{{ $bodega->nombre }} ({{ $bodega->pivot->stock }})@if(!$loop->last), @endif
@endforeach
</div>
@endif
@php
$variantes = $producto->variants ?? [];
@endphp
@if (!count($variantes))
<x-filament::button wire:click="agregarAlCarrito({{ $producto->id }}, 'p')" color="primary"
size="sm" class="mt-2">
Agregar al Carrito
</x-filament::button>
@endif
@if (count($variantes))
<div class="mt-2">
<h4 class="text-sm font-bold">Variantes disponibles:</h4>
<div class="flex flex-col gap-2 mt-2">
@foreach ($variantes as $variante)
<x-filament::button wire:click="agregarAlCarrito({{ $variante->id }}, 'v')"
color="gray" size="sm" class="justify-start">
Color: {{ $variante->color->name ?? '-' }}, Talla:
{{ $variante->size->name ?? '-' }}
</x-filament::button>
@endforeach
</div>
</div>
@endif
</div>
@endforeach
</div>
</div>
<div class="w-full max-w-md bg-white shadow-xl p-6 rounded-2xl space-y-6">
<h2 class="text-2xl font-bold text-gray-800">Carrito de Compras</h2>
<div class="space-y-3">
@foreach ($carrito as $key => $item)
<div class="p-3 border border-gray-200 rounded-lg bg-gray-50 hover:bg-gray-100 transition">
{{-- Nombre del producto --}}
<div class="flex justify-between items-start mb-2">
<div class="flex-1">
<div class="font-semibold text-gray-700">{{ $item['nombre'] }}</div>
@if (isset($item['variante']))
<div class="text-xs text-gray-500 mt-1">{{ $item['variante'] }}</div>
@endif
</div>
{{-- Botón eliminar --}}
<x-filament::button wire:click="eliminarDelCarrito('{{ $key }}')" color="danger"
size="xs" icon="heroicon-o-x-mark" />
</div>
{{-- Precio editable --}}
<div class="mb-2">
<div class="flex items-center gap-2 flex-wrap">
<label class="text-xs text-gray-600 font-medium">Precio:</label>
{{-- Mostrar precio original tachado si fue modificado --}}
@if ($item['precio_modificado'] != $item['precio_original'])
<span class="text-xs text-gray-400 line-through">
${{ number_format($item['precio_original'], 2) }}
</span>
@endif
{{-- Campo editable de precio --}}
<input
type="number"
step="0.01"
min="0"
wire:model.lazy="carrito.{{ $key }}.precio_modificado"
wire:change="actualizarPrecio('{{ $key }}', $event.target.value)"
class="w-28 px-2 py-1 text-sm border border-gray-300 rounded bg-white focus:outline-none focus:ring-2 focus:ring-blue-500"
value="{{ $item['precio_modificado'] }}"
/>
{{-- Mostrar porcentaje de descuento/aumento --}}
@if ($item['precio_modificado'] < $item['precio_original'])
<span class="text-xs text-green-600 font-semibold">
-{{ number_format((($item['precio_original'] - $item['precio_modificado']) / $item['precio_original']) * 100, 1) }}%
</span>
@elseif ($item['precio_modificado'] > $item['precio_original'])
<span class="text-xs text-red-600 font-semibold">
+{{ number_format((($item['precio_modificado'] - $item['precio_original']) / $item['precio_original']) * 100, 1) }}%
</span>
@endif
</div>
</div>
{{-- Cantidad y Subtotal --}}
<div class="flex justify-between items-center">
{{-- Controles de cantidad --}}
<div class="flex items-center gap-2">
<span class="text-xs text-gray-600">Cantidad:</span>
<div class="flex items-center border border-gray-300 rounded bg-white">
<x-filament::button wire:click="decrementarCantidad('{{ $key }}')"
color="warning" size="xs" icon="heroicon-o-minus" />
<div class="text-sm font-semibold w-8 text-center">
{{ $item['cantidad'] }}
</div>
<x-filament::button wire:click="incrementarCantidad('{{ $key }}')"
color="primary" size="xs" icon="heroicon-o-plus" />
</div>
</div>
{{-- Subtotal --}}
<div class="text-sm font-semibold text-gray-700">
Subtotal: ${{ number_format($item['precio_modificado'] * $item['cantidad'], 2) }}
</div>
</div>
</div>
@endforeach
</div>
<div class="text-lg font-bold text-right text-gray-800">
Total: ${{ number_format($total, 2) }}
</div>
<div class="space-y-3">
<input type="text" tabindex="2" wire:model.defer="numeroDocumentoCliente"
placeholder="Número de documento"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500" />
<x-filament::button wire:click="buscarClientePorDocumento" color="primary" size="sm" class="w-full"
tabindex="3">
Buscar Cliente
</x-filament::button>
@if (!$cliente_id && $numeroDocumentoCliente)
<div class="grid grid-cols-1 gap-2">
<input type="text" wire:model.defer="datosCliente.nombre" placeholder="Nombre"
class="w-full px-4 py-2 border border-gray-300 rounded-lg" />
<input type="text" wire:model.defer="datosCliente.correo" placeholder="Correo"
class="w-full px-4 py-2 border border-gray-300 rounded-lg" />
<input type="text" wire:model.defer="datosCliente.telefono" placeholder="Teléfono"
class="w-full px-4 py-2 border border-gray-300 rounded-lg" />
</div>
@endif
{{-- Campo tipo de pago --}}
<select wire:model.defer="tipo_pago"
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"
tabindex="4">
<option value="" disabled selected>Selecciona tipo de pago</option>
<option value="Transferencia">Transferencia</option>
<option value="Efectivo">Efectivo</option>
</select>
</div>
<x-filament::button wire:click="procesarVenta" color="success" size="lg" class="w-full" tabindex="4">
Finalizar Venta
</x-filament::button>
<div class="pt-4 border-t border-gray-200 space-y-3">
<input type="email" wire:model.lazy="correoCotizacion" tabindex="5"
class="w-full px-4 py-2 border border-gray-300 rounded-lg"
placeholder="Correo electrónico para enviar cotización" />
<x-filament::button wire:click="enviarCotizacion" color="gray" size="lg" class="w-full"
tabindex="6">
Enviar Cotización
</x-filament::button>
</div>
</div>
</div>
@if (session()->has('error'))
<div class="text-red-500 font-semibold mb-2">
{{ session('error') }}
</div>
@endif
@if (session()->has('message'))
<div class="text-primary-500 font-semibold mb-2">
{{ session('message') }}
</div>
@endif
<script>
window.addEventListener('imprimir-recibo', event => {
const ventaId = event.detail.venta_id;
const printWindow = window.open(`/imprimir-recibo/${ventaId}`, '_blank', 'width=300,height=600');
printWindow.focus();
});
</script>
</x-filament-panels::page>
@@ -0,0 +1,40 @@
<x-filament-panels::page>
<form wire:submit.prevent="generateReport" class="space-y-4 max-w-xl">
<div>
<label for="fromDate" class="block font-medium text-sm text-gray-700">Desde</label>
<input type="date" id="fromDate" wire:model.defer="fromDate"
class="mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring focus:ring-opacity-50" />
@error('fromDate')
<p class="text-red-600 text-sm">{{ $message }}</p>
@enderror
</div>
<div>
<label for="toDate" class="block font-medium text-sm text-gray-700">Hasta</label>
<input type="date" id="toDate" wire:model.defer="toDate"
class="mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring focus:ring-opacity-50" />
@error('toDate')
<p class="text-red-600 text-sm">{{ $message }}</p>
@enderror
</div>
<div>
<label for="email" class="block font-medium text-sm text-gray-700">Correo electrónico</label>
<input type="email" id="email" wire:model.defer="email"
class="mt-1 block w-full rounded-md shadow-sm border-gray-300 focus:ring focus:ring-opacity-50"
placeholder="Ingrese el correo electrónico" />
@error('email')
<p class="text-red-600 text-sm">{{ $message }}</p>
@enderror
</div>
<x-filament::button type="submit">
Enviar reporte por correo
</x-filament::button>
@if (session()->has('success'))
<div class="text-green-600 font-semibold">{{ session('success') }}</div>
@endif
</form>
</x-filament-panels::page>
@@ -0,0 +1,8 @@
<x-filament::page>
<form wire:submit.prevent="save" class="space-y-4">
{{ $this->form }}
<x-filament::button type="submit">
Guardar configuración
</x-filament::button>
</form>
</x-filament::page>