94 lines
5.4 KiB
PHP
94 lines
5.4 KiB
PHP
<div class="bg-[#f5f5f5] md:w-[100%] m-auto p-2 md:p-5 rounded-[1.2rem] relative mb-4">
|
|
<div class="flex flex-wrap justify-between items-center gap-2 mb-4">
|
|
<h1 class="text-lg font-bold">Reversar Compras</h1>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
<input type="date" wire:model="fecha_desde"
|
|
class="border-2 border-neutral-200 rounded-[0.8rem] shadow px-3 py-2 focus:outline-none focus:border-neutral-400 text-sm">
|
|
<span class="text-gray-400">a</span>
|
|
<input type="date" wire:model="fecha_hasta"
|
|
class="border-2 border-neutral-200 rounded-[0.8rem] shadow px-3 py-2 focus:outline-none focus:border-neutral-400 text-sm">
|
|
<input type="text" placeholder="Buscar por ID, vendedor, cliente o cuenta..." wire:model.lazy="buscar"
|
|
class="border-2 border-neutral-200 rounded-[0.8rem] shadow px-4 py-2 w-64 focus:outline-none focus:border-neutral-400">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-sm bg-white rounded-lg shadow-lg">
|
|
<thead class="bg-[#000029] text-white">
|
|
<tr class="text-left">
|
|
<th class="p-3">ID</th>
|
|
<th class="p-3">Fecha</th>
|
|
<th class="p-3">Vendedor</th>
|
|
<th class="p-3">Cliente</th>
|
|
<th class="p-3">Servicio</th>
|
|
<th class="p-3">Valor</th>
|
|
<th class="p-3">Cuentas Asignadas</th>
|
|
<th class="p-3 text-center">Acción</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse ($historiales as $item)
|
|
<tr class="border-b hover:bg-gray-100 {{ $confirmando_id === $item->id ? 'bg-red-50' : '' }}">
|
|
<td class="p-3 font-semibold">#{{ $item->id }}</td>
|
|
<td class="p-3">{{ \Carbon\Carbon::parse($item->created_at)->format('d/m/Y h:i a') }}</td>
|
|
<td class="p-3">{{ $item->vendedor->name ?? 'N/A' }}<br><span class="text-xs text-gray-400">{{ $item->vendedor->email ?? '' }}</span></td>
|
|
<td class="p-3">{{ $item->nombre_cliente ?? $item->cliente->name ?? 'N/A' }}<br><span class="text-xs text-gray-400">{{ $item->cliente->email ?? '' }}</span></td>
|
|
<td class="p-3">
|
|
@if ($item->promocion)
|
|
{{ $item->promocion->nombre ?? 'Promoción' }}
|
|
@elseif($item->tarifa && $item->tarifa->servicio)
|
|
{{ $item->tarifa->servicio->nombre }}
|
|
@if (!$item->tarifa->servicio->por_tiempo)
|
|
- {{ $item->tarifa->pantallas }}P
|
|
@endif
|
|
- {{ $item->tarifa->dias }}d
|
|
@else
|
|
N/A
|
|
@endif
|
|
</td>
|
|
<td class="p-3 font-semibold">${{ number_format($item->valor) }}</td>
|
|
<td class="p-3 text-xs">
|
|
@forelse ($item->cuentas->unique() as $cuenta)
|
|
<div class="mb-1">{{ $cuenta->correo }} - {{ $cuenta->password }}</div>
|
|
@empty
|
|
<span class="text-gray-400">Sin cuentas</span>
|
|
@endforelse
|
|
</td>
|
|
<td class="p-3 text-center">
|
|
@if ($confirmando_id === $item->id)
|
|
<div class="flex flex-col items-center gap-1">
|
|
<p class="text-red-600 text-xs font-bold">¿Revertir compra #{{ $item->id }}?</p>
|
|
<p class="text-xs text-gray-500">Se devolverá ${{ number_format($item->valor) }} al vendedor</p>
|
|
<div class="flex gap-2 mt-1">
|
|
<button wire:click="reversar({{ $item->id }})"
|
|
class="px-3 py-1 bg-red-600 text-white rounded text-xs hover:bg-red-700">
|
|
Sí, revertir
|
|
</button>
|
|
<button wire:click="cancelarConfirmacion"
|
|
class="px-3 py-1 bg-gray-400 text-white rounded text-xs hover:bg-gray-500">
|
|
Cancelar
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@else
|
|
<button wire:click="confirmar({{ $item->id }})"
|
|
class="px-3 py-1 bg-red-500 text-white rounded text-xs hover:bg-red-600">
|
|
Reversar
|
|
</button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="p-6 text-center text-gray-400">No hay compras activas para mostrar</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
{{ $historiales->links() }}
|
|
</div>
|
|
</div>
|