- Terminada seccion de ventas, index
This commit is contained in:
BryamE
2026-04-03 21:10:31 -03:00
parent f565e9cd45
commit 27da6df77b
+29 -35
View File
@@ -2,25 +2,23 @@
<x-section-header subtitle="Finanzas" title="Historial de " highlight="Ventas" /> <x-section-header subtitle="Finanzas" title="Historial de " highlight="Ventas" />
<div class="mb-6 bg-neutral-800/50 p-4 rounded-xl border border-neutral-800 shadow-sm"> <div class="mb-6 bg-gray-200/50 dark:bg-neutral-800/50 p-4 rounded-xl border border-neutral-400 dark: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"> <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"> <div class="md:col-span-3">
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider"> Venta</label> <x-forms.label value="N° Venta"/>
<div class="relative"> <div class="relative">
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none"> <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"> <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"/> <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> </svg>
</div> </div>
<input type="text" name="search" value="{{ request('search') }}" <x-forms.input type="text" name="search" value="{{ request('search') }}" class="ps-10" placeholder="Ej: 1420"/>
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>
</div> </div>
<div class="md:col-span-4"> <div class="md:col-span-4">
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Cliente</label> <x-forms.label value="Cliente"/>
<select name="client_id" class="w-full select2-filter"> <select name="client_id" class="w-full select2-filter">
<option value="">-- Todos --</option> <option value="">-- Todos --</option>
@foreach($clients as $client) @foreach($clients as $client)
@@ -32,25 +30,23 @@
</div> </div>
<div class="md:col-span-2"> <div class="md:col-span-2">
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Desde</label> <x-forms.label value="Desde"/>
<input type="date" name="date_from" value="{{ request('date_from') }}" <x-forms.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>
<div class="md:col-span-2"> <div class="md:col-span-2">
<label class="block text-xs text-gray-500 mb-1 uppercase font-bold tracking-wider">Hasta</label> <x-forms.label value="Hasta"/>
<input type="date" name="date_to" value="{{ request('date_to') }}" <x-forms.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>
<div class="md:col-span-1 flex gap-2"> <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"> <button type="submit" class="w-full bg-neutral-900 hover:bg-neutral-800 text-neon-lime dark:bg-neon-lime dark:hover:bg-[#b3e600] dark:text-neutral-900 font-bold rounded-lg text-sm p-2.5 transition-colors shadow-lg dark: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"> <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" /> <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> </svg>
</button> </button>
@if(request()->hasAny(['search', 'client_id', 'date_from', 'date_to'])) @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"> <a href="{{ route('sales.index') }}" class="w-full hover:bg-red-600 hover:text-white text-red-600 border border-red-600 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"> <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" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg> </svg>
@@ -61,14 +57,14 @@
</div> </div>
<div class="flex justify-end mb-6"> <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"> <a href="{{ route('sales.create') }}" class="px-6 py-2.5 border bg-neon-lime border-neutral-900 text-neutral-900 hover:text-neon-lime hover:bg-neutral-900 dark:bg-neutral-800 dark:border-neon-lime dark:text-neon-lime hover:dark:bg-neon-lime hover:dark:text-neutral-900 font-bold rounded-lg transition-all shadow-lg dark:shadow-neon-lime/10 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> <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 Nueva Venta
</a> </a>
</div> </div>
<div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-neutral-800 bg-panel-bg"> <div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-gray-400 dark:border-neutral-800">
<table class="w-full text-sm text-left text-gray-400"> <table class="w-full text-sm text-left text-neutral-900 dark:text-white">
<thead class="text-xs text-gray-300 uppercase bg-neutral-800 border-b border-neutral-700"> <thead class="text-xs text-neutral-800 dark:text-gray-300 uppercase bg-gray-400 dark:bg-neutral-800 border-b border-gray-300 dark:border-neutral-700">
<tr> <tr>
<th scope="col" class="px-6 py-3"># Ref</th> <th scope="col" class="px-6 py-3"># Ref</th>
<th scope="col" class="px-6 py-3">Fecha</th> <th scope="col" class="px-6 py-3">Fecha</th>
@@ -78,49 +74,48 @@
<th scope="col" class="px-6 py-3 text-center">Acciones</th> <th scope="col" class="px-6 py-3 text-center">Acciones</th>
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-neutral-800"> <tbody>
@forelse($sales as $sale) @forelse($sales as $sale)
<tr class="bg-neutral-900/50 hover:bg-neutral-800 transition-colors"> <tr class="bg-gray-200/50 dark:bg-neutral-900/50 border-b border-gray-400 dark:border-neutral-800 hover:bg-gray-400 hover:dark:bg-neutral-800 transition-colors group">
<td class="px-6 py-4 font-mono font-bold">
<td class="px-6 py-4 font-mono text-white font-bold">
#{{ str_pad($sale->id, 5, '0', STR_PAD_LEFT) }} #{{ str_pad($sale->id, 5, '0', STR_PAD_LEFT) }}
</td> </td>
<td class="px-6 py-4 text-gray-300"> <td class="px-6 py-4 text-gray-600 dark:text-gray-300">
{{ $sale->created_at->format('d/m/Y H:i') }} {{ $sale->created_at->format('d/m/Y H:i') }}
</td> </td>
<td class="px-6 py-4"> <td class="px-6 py-4">
@if($sale->client) @if($sale->client)
<div class="font-bold text-white">{{ $sale->client->name }}</div> <div class="font-bold">{{ $sale->client->name }}</div>
<div class="text-xs text-gray-500">{{ $sale->client->phone ?? '' }}</div> <div class="text-xs text-gray-700 dark:text-gray-400">{{ $sale->client->phone ?? '' }}</div>
@else @else
<span class="italic text-gray-500">Consumidor Final</span> <span class="italic text-gray-600 dark:text-gray-400">Consumidor Final</span>
@endif @endif
</td> </td>
<td class="px-6 py-4"> <td class="px-6 py-4">
@php @php
$colors = [ $colors = [
'Efectivo' => 'text-green-400 bg-green-900/20 border-green-800', 'Efectivo' => 'text-white dark:text-green-400 bg-green-600/80 dark:bg-green-900/20 border-green-800',
'Transferencia' => 'text-blue-400 bg-blue-900/20 border-blue-800', 'Transferencia' => 'text-white dark:text-blue-400 bg-blue-600/80 dark:bg-blue-900/20 border-blue-800',
'Tarjeta de Débito' => 'text-purple-400 bg-purple-900/20 border-purple-800', 'Tarjeta de Débito' => 'text-white dark:text-purple-400 bg-purple-600/80 dark:bg-purple-900/20 border-purple-800',
'Tarjeta de Crédito' => 'text-orange-400 bg-orange-900/20 border-orange-800', 'Tarjeta de Crédito' => 'text-white dark:text-orange-400 bg-orange-600/80 dark:bg-orange-900/20 border-orange-800',
]; ];
$badgeClass = $colors[$sale->payment_method] ?? 'text-gray-400 bg-gray-800 border-gray-700'; $badgeClass = $colors[$sale->payment_method] ?? 'bg-gray-400 dark:bg-gray-800 border-gray-700';
@endphp @endphp
<span class="{{ $badgeClass }} border px-2.5 py-0.5 rounded text-xs font-medium"> <span class="{{ $badgeClass }} border px-2.5 py-0.5 rounded text-xs font-medium">
{{ $sale->payment_method }} {{ $sale->payment_method }}
</span> </span>
</td> </td>
<td class="px-6 py-4 text-right font-bold text-lg text-neon-lime"> <td class="px-6 py-4 text-right font-bold text-lg text-zinc-900 dark:text-neon-lime">
${{ number_format($sale->total, 2) }} ${{ number_format($sale->total, 2) }}
</td> </td>
<td class="px-6 py-4 text-center"> <td class="px-6 py-4 text-center">
<a href="{{ route('sales.show', $sale) }}" <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" class="inline-flex items-center justify-center w-8 h-8 border-2 border-emerald-700 dark:border-green-600 rounded-4xl hover:bg-emerald-700 text-emerald-700 hover:dark:bg-green-600 dark:text-green-600 hover:text-white hover:dark:text-white transition-colors"
title="Ver Detalle"> 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"> <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="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
@@ -143,8 +138,7 @@
</table> </table>
</div> </div>
<div class="mt-4 w-full flex justify-center"> <div class="mt-4 w-full max-w-4xl">
{{ $sales->links() }} {{ $sales->links() }}
</div> </div>
</x-layout> </x-layout>