Merge branch 'giane' of https://github.com/BryamE/ProyectoLauck into bryam
This commit is contained in:
@@ -2,21 +2,70 @@
|
||||
|
||||
<x-section-header subtitle="Finanzas" title="Historial de " highlight="Ventas" />
|
||||
|
||||
<!-- Barra de Herramientas -->
|
||||
<div class="w-full flex justify-between items-center mb-6">
|
||||
<!-- Buscador simple (opcional visualmente, funcionalidad futura) -->
|
||||
<div class="relative w-1/3">
|
||||
<input type="text" placeholder="Buscar por N° Venta o Cliente..." class="bg-neutral-800 border border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5">
|
||||
</div>
|
||||
<div class="mb-6 bg-neutral-800/50 p-4 rounded-xl border border-neutral-800 shadow-sm">
|
||||
<form action="{{ route('sales.index') }}" method="GET" class="grid grid-cols-1 md:grid-cols-12 gap-4 items-end">
|
||||
|
||||
<div class="md:col-span-3">
|
||||
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">N° Venta</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
||||
<svg class="w-4 h-4 text-gray-500" fill="none" viewBox="0 0 20 20">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<input type="text" name="search" value="{{ request('search') }}"
|
||||
class="bg-neutral-800 border border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5 ps-10 placeholder-gray-600"
|
||||
placeholder="Ej: 1420">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Botón Nueva Venta -->
|
||||
<a href="{{ route('sales.create') }}" class="px-5 py-2.5 bg-neon-lime text-neutral-900 font-bold rounded-lg hover:bg-[#b3e600] transition-colors shadow-lg shadow-neon-lime/20 flex items-center gap-2">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
|
||||
Registrar Venta
|
||||
</a>
|
||||
<div class="md:col-span-4">
|
||||
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Cliente</label>
|
||||
<select name="client_id" class="w-full select2-filter">
|
||||
<option value="">-- Todos --</option>
|
||||
@foreach($clients as $client)
|
||||
<option value="{{ $client->id }}" {{ request('client_id') == $client->id ? 'selected' : '' }}>
|
||||
{{ $client->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-2">
|
||||
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Desde</label>
|
||||
<input type="date" name="date_from" value="{{ request('date_from') }}"
|
||||
class="bg-neutral-800 border border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5">
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Hasta</label>
|
||||
<input type="date" name="date_to" value="{{ request('date_to') }}"
|
||||
class="bg-neutral-800 border border-neutral-700 text-white text-sm rounded-lg focus:ring-neon-lime focus:border-neon-lime block w-full p-2.5">
|
||||
</div>
|
||||
|
||||
<div class="md:col-span-1 flex gap-2">
|
||||
<button type="submit" class="w-full bg-neon-lime hover:bg-[#b3e600] text-neutral-900 font-bold rounded-lg text-sm p-2.5 transition-colors shadow-lg shadow-neon-lime/20 flex items-center justify-center" title="Aplicar Filtros">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
@if(request()->hasAny(['search', 'client_id', 'date_from', 'date_to']))
|
||||
<a href="{{ route('sales.index') }}" class="w-full bg-neutral-700 hover:bg-neutral-600 text-white font-bold rounded-lg text-sm p-2.5 flex items-center justify-center transition-colors" title="Limpiar Filtros">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Tabla de Ventas -->
|
||||
<div class="flex justify-end mb-6">
|
||||
<a href="{{ route('sales.create') }}" class="px-6 py-2.5 bg-neutral-800 border border-neon-lime text-neon-lime hover:bg-neon-lime hover:text-neutral-900 font-bold rounded-lg transition-all shadow-lg shadow-neon-lime/10 flex items-center gap-2 transform hover:-translate-y-0.5">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg>
|
||||
Nueva Venta
|
||||
</a>
|
||||
</div>
|
||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-neutral-800 bg-panel-bg">
|
||||
<table class="w-full text-sm text-left text-gray-400">
|
||||
<thead class="text-xs text-gray-300 uppercase bg-neutral-800 border-b border-neutral-700">
|
||||
@@ -29,14 +78,73 @@
|
||||
<th scope="col" class="px-6 py-3 text-center">Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="divide-y divide-neutral-800">
|
||||
@forelse($sales as $sale)
|
||||
<tr class="bg-neutral-900/50 hover:bg-neutral-800 transition-colors">
|
||||
|
||||
<td class="px-6 py-4 font-mono text-white font-bold">
|
||||
#{{ str_pad($sale->id, 5, '0', STR_PAD_LEFT) }}
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 text-gray-300">
|
||||
{{ $sale->created_at->format('d/m/Y H:i') }}
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4">
|
||||
@if($sale->client)
|
||||
<div class="font-bold text-white">{{ $sale->client->name }}</div>
|
||||
<div class="text-xs text-gray-500">{{ $sale->client->phone ?? '' }}</div>
|
||||
@else
|
||||
<span class="italic text-gray-500">Consumidor Final</span>
|
||||
@endif
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4">
|
||||
@php
|
||||
$colors = [
|
||||
'Efectivo' => 'text-green-400 bg-green-900/20 border-green-800',
|
||||
'Transferencia' => 'text-blue-400 bg-blue-900/20 border-blue-800',
|
||||
'Tarjeta de Débito' => 'text-purple-400 bg-purple-900/20 border-purple-800',
|
||||
'Tarjeta de Crédito' => 'text-orange-400 bg-orange-900/20 border-orange-800',
|
||||
];
|
||||
$badgeClass = $colors[$sale->payment_method] ?? 'text-gray-400 bg-gray-800 border-gray-700';
|
||||
@endphp
|
||||
<span class="{{ $badgeClass }} border px-2.5 py-0.5 rounded text-xs font-medium">
|
||||
{{ $sale->payment_method }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 text-right font-bold text-lg text-neon-lime">
|
||||
${{ number_format($sale->total, 2) }}
|
||||
</td>
|
||||
|
||||
<td class="px-6 py-4 text-center">
|
||||
<a href="{{ route('sales.show', $sale) }}"
|
||||
class="inline-flex items-center justify-center w-8 h-8 rounded bg-neutral-700 hover:bg-neutral-600 text-gray-300 hover:text-white transition-colors"
|
||||
title="Ver Detalle">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-6 py-12 text-center text-gray-500">
|
||||
<div class="flex flex-col items-center justify-center">
|
||||
<svg class="w-12 h-12 mb-3 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg>
|
||||
<p class="text-base">No se encontraron ventas registradas.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Paginación -->
|
||||
<div class="mt-4 w-full flex justify-center">
|
||||
{{ $sales->links() }}
|
||||
</div>
|
||||
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user