update global subvendedor

This commit is contained in:
Juan Felipe Duarte
2025-08-22 10:09:23 -07:00
parent 4042fab30b
commit a5aafd738d
10 changed files with 179 additions and 139 deletions
@@ -1,39 +1,34 @@
<div>
<div class=" text-center">
<div class="flex w-11/12 align-middle">
<input type="text" placeholder="Buscar" wire:model="buscar" class="mx-auto text-center rounded my-4">
<label for="aprobado" class="my-1 align-middle px-1">Aprobados</label>
<input type="checkbox" id="aprobado" wire:model="aprobado" class="my-1 align-middle px-1">
</div>
<div class=" text-center">
<div class="flex w-11/12 align-middle">
<input type="text" placeholder="Buscar" wire:model="buscar" class="mx-auto text-center rounded my-4">
<label for="aprobado" class="my-1 align-middle px-1">Aprobados</label>
<input type="checkbox" id="aprobado" wire:model="aprobado" class="my-1 align-middle px-1">
</div>
<table class="text-center w-11/12 mx-auto">
<tr class="border text-left">
<th>Compra</th>
<th>Usuario</th>
<th>Email</th>
<th>Valor pagado</th>
<th>Estado</th>
<th>Saldo</th>
</tr>
<table class="text-center w-11/12 mx-auto">
<tr class="border text-left">
<th>Compra</th>
<th>Usuario</th>
<th>Email</th>
<th>Valor pagado</th>
<th>Estado</th>
<th>Saldo</th>
</tr>
@foreach($historial_recargas as $item)
<tr class="border hover:bg-gray-200 hover:ring-gray-500 text-left text-sm" >
<td>{{\Carbon\Carbon::parse($item->created_at)->format('y/m/d h:i a')}}</td>
<td>{{$item->usuario?->name ?? 'N/A'}}</td>
<td>{{$item->usuario?->email ?? 'N/A'}}</td>
<td>{{$item->monto ?? 'N/A'}}</td>
<td>{{$item->status ?? 'N/A'}}</td>
<td>{{$item->valor_recarga ?? 'N/A'}}</td>
</tr>
@endforeach
</table>
<div class="mx-10">
{{ $historial_recargas->links( )}}
@foreach ($historial_recargas as $item)
<tr class="border hover:bg-gray-200 hover:ring-gray-500 text-left text-sm">
<td>{{ \Carbon\Carbon::parse($item->created_at)->format('y/m/d h:i a') }}</td>
<td>{{ $item->usuario?->name ?? 'N/A' }}</td>
<td>{{ $item->usuario?->email ?? 'N/A' }}</td>
<td>{{ $item->monto ?? 'N/A' }}</td>
<td>{{ $item->status ?? 'N/A' }}</td>
<td>{{ $item->valor_recarga ?? 'N/A' }}</td>
</tr>
@endforeach
</table>
<div class="mx-10">
{{ $historial_recargas->links() }}
</div>
</div>
</div>
</div>
@@ -92,6 +92,23 @@
</div>
{{-- Subvendedor --}}
<div class="bg-white text-center rounded-xl py-4 px-8 shadow-md xl:mx-10 mb-8">
<div class="flex items-center justify-center gap-2">
<span class="text-gray-700">Subvendedores</span>
<label class="relative inline-flex items-center cursor-pointer">
<input wire:model="subvendedor" type="checkbox" value="" class="sr-only peer">
<div class="w-11 h-6 bg-gray-200 rounded-full peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 peer-checked:bg-blue-600"></div>
</label>
</div>
{{-- Boton para guardar subvendedor --}}
<div class="mt-4">
<button wire:click="guardarSubvendedor"
class="inline-flex justify-center rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Guardar</button>
</div>
</div>
{{-- Slider --}}
<div class="bg-white grid grid-cols-1 text-center rounded-xl py-4 px-8 shadow-md xl:mx-10 my-8">
@@ -626,10 +643,6 @@
</span>
</div>
<div class="lg:col-span-1 mb-8 text-center">
<button wire:click="eliminarCache" class=" mx-auto inline-flex justify-center rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-red-500 hover:bg-red-700 focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Eliminar
@@ -21,7 +21,7 @@
Roles
</div>
@if (auth()->user()->subvendedor)
@if (auth()->user()->subvendedor && $config->subvendedor)
<a x-on:click="add = !add" class="flex items-center px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8] transition">
Añadir rol
<svg class="w-[0.87rem] ml-2" fill="#ffffff" viewBox="0 0 512 512">
@@ -41,9 +41,9 @@
this.search = '';
this.selectedId = null;
}
}"
}"
class="relative w-full max-w-md sm:max-w-xs">
<label class="block text-sm font-medium text-gray-700 mb-1">Buscar subvendedor</label>
<div class="relative">
@@ -224,4 +224,4 @@
</div>
</div>
</div>
@@ -24,7 +24,7 @@ editarTarifaPromo: @entangle('editarTarifaPromo'),
</div>
<div class="flex flex-col md:flex-row items-center justify-center gap-6 md:gap-4">
@if (auth()->user()->subvendedor)
@if (auth()->user()->subvendedor && $config->subvendedor)
<a x-on:click="modTarifas = true" class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">
Tarifas servicios
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" class="w-4 ml-2" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512" xml:space="preserve">
@@ -34,7 +34,7 @@ editarTarifaPromo: @entangle('editarTarifaPromo'),
</a>
@endif
@if (auth()->user()->subvendedor)
@if (auth()->user()->subvendedor && $config->subvendedor)
<a x-on:click="modTarifasPromo = true" class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">
Tarifas promociones
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" class="w-4 ml-2" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512" xml:space="preserve">
@@ -26,7 +26,7 @@
Usuario
</div>
<div class="flex gap-4">
@if (auth()->user()->subvendedor || auth()->user()->rol->nombre === 'administrador' || auth()->user()->rol->nombre === 'editor' || auth()->user()->rol->nombre === 'super')
@if ((auth()->user()->subvendedor && $config->subvendedor) || in_array(auth()->user()->rol->nombre, ['administrador', 'editor', 'super']))
<a x-on:click="add = !add" class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8] mb-3 md:mb-0">Añadir
usuario
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve" class="w-[0.87rem] ml-2">
@@ -35,7 +35,7 @@
</a>
@endif
@if (auth()->user()->rol->nombre === 'super' || auth()->user()->rol->nombre === 'administrador')
@if (in_array(auth()->user()->rol->nombre, ['super', 'administrador']))
<a x-on:click="modTarifas = true" class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">Mod.
tarifas promos
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" class="w-4 ml-2" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512" xml:space="preserve">
@@ -107,7 +107,7 @@
@if (auth()->user()->rol->nombre == 'super')
<button wire:click="saldo({{ $usuario->id }})" class="justify-center text-sm flex px-2 py-1 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8] mb-0 md:mb-0">Recargar</button>
@else
@if (Auth::user()->subvendedor)
@if (auth()->user()->subvendedor && $config->subvendedor)
<button wire:click="saldo({{ $usuario->id }})" class="justify-center text-sm flex px-2 py-1 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8] mb-0 md:mb-0">Recargar</button>
@endif
@endif
@@ -131,7 +131,7 @@
<button x-on:click="openOption=false" wire:click="eliminar({{ $usuario->id }})" class="text-white w-full py-1 bg-red-400 rounded-b-[1rem] hover:bg-red-600 hover:rounded-b-[1rem]">Eliminar</button>
</div>
</td>
@elseif (Auth::user()->subvendedor)
@elseif (Auth::user()->subvendedor && $config->subvendedor)
<td>
<button x-on:click="openOption=!openOption">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6 cursor-pointer">
@@ -660,7 +660,7 @@
@if (auth()->user()->rol->nombre === 'administrador' || auth()->user()->rol->nombre === 'super')
<button wire:click="addSaldo" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Guardar</button>
@else
@if (Auth::user()->subvendedor)
@if (auth()->user()->subvendedor && $config->subvendedor)
<button wire:click="addSaldoSubvendedor" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 sm:mb-[0] mb-2 text-white bg-[#B221FD] hover:bg-[#7a02b8] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Guardar</button>
@endif
@endif
@@ -905,4 +905,4 @@
input.value = formattedValue;
}
</script>
</div>
</div>