menu visible

This commit is contained in:
Felipe
2024-03-04 11:32:45 -05:00
parent 15baeb4caf
commit 14a7b9a782
21 changed files with 313 additions and 362 deletions
+107 -46
View File
@@ -20,57 +20,118 @@
</div>
<div class="bg-[#f5f5f5] md:w-full m-auto p-2 md:p-5 rounded-lg relative mb-4">
<div class="grid grid-cols-1 sm:flex justify-between my-2 items-center">
<div class="grid grid-cols-1 sm:flex items-center gap-3 md:gap-8">
<div class="flex text-sm">
<svg class="w-4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svgjs="http://svgjs.com/svgjs" version="1.1" x="0" y="0" viewBox="0 0 24 24"
style="enable-background:new 0 0 512 512" xml:space="preserve">
<g>
<path
d="M15.4,9.88,10.81,5.29a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42L14,11.29a1,1,0,0,1,0,1.42L9.4,17.29a1,1,0,0,0,1.41,1.42l4.59-4.59A3,3,0,0,0,15.4,9.88Z"
fill="#b221fd" data-original="#000000" />
</g>
<div class="md:flex justify-center my-2 items-center text-center">
<div class="flex text-sm">
<x-icon-arrow-right/>
Usuario
</div>
<div class="flex gap-4">
@if (auth()->user()->rol->nombre !== 'administrador' && auth()->user()->rol->nombre !== 'editor')
<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">
<path d="M480,224H288V32c0-17.673-14.327-32-32-32s-32,14.327-32,32v192H32c-17.673,0-32,14.327-32,32s14.327,32,32,32h192v192 c0,17.673,14.327,32,32,32s32-14.327,32-32V288h192c17.673,0,32-14.327,32-32S497.673,224,480,224z" fill="#ffffff" />
</svg>
Usuario
</div>
@if (auth()->user()->rol->nombre !== 'administrador' && auth()->user()->rol->nombre !== 'editor')
<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">
<path
d="M480,224H288V32c0-17.673-14.327-32-32-32s-32,14.327-32,32v192H32c-17.673,0-32,14.327-32,32s14.327,32,32,32h192v192 c0,17.673,14.327,32,32,32s32-14.327,32-32V288h192c17.673,0,32-14.327,32-32S497.673,224,480,224z"
fill="#ffffff" />
</svg>
</a>
<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">
<polygon points="14.604 5.687 0 20.29 0 24 3.71 24 18.313 9.396 14.604 5.687" fill="#ffffff"
data-original="#000000" />
<path
d="M23.232.768a2.624,2.624,0,0,0-3.71,0l-3.5,3.505,3.709,3.709,3.5-3.5A2.624,2.624,0,0,0,23.232.768Z"
fill="#ffffff" data-original="#000000" />
</svg>
</a>
@endif
</a>
<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">
<polygon points="14.604 5.687 0 20.29 0 24 3.71 24 18.313 9.396 14.604 5.687" fill="#ffffff"
data-original="#000000" />
<path
d="M23.232.768a2.624,2.624,0,0,0-3.71,0l-3.5,3.505,3.709,3.709,3.5-3.5A2.624,2.624,0,0,0,23.232.768Z"
fill="#ffffff" data-original="#000000" />
</svg>
</a>
@endif
</div>
<div class="flex relative text-sm mx-auto w-64 md:w-auto my-2">
<input id="buscar" type="search" wire:model="buscar" placeholder="Buscar" class=" shadow-sm border-2 active:border-neutral-200 focus:ring-0 border-neutral-200 w-64 md:w-auto rounded-md pr-7 py-1 m-auto focus:border-neutral-300 focus:outline-none focus:shadow-outline">
<svg class="w-5 absolute top-2 right-3" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" class="w-4 absolute" x="0" y="0" viewBox="0 0 24 24" style="enable-background:new 0 0 512 512;rotate: 90deg;" xml:space="preserve" class="">
<g id="Layer_31" data-name="Layer 31">
<path d="m21.71 20.29-5.4-5.39a7.92 7.92 0 0 0 1.69-4.9 8 8 0 1 0 -8 8 7.92 7.92 0 0 0 4.9-1.69l5.39 5.4a1 1 0 0 0 1.42 0 1 1 0 0 0 0-1.42zm-17.71-10.29a6 6 0 1 1 6 6 6 6 0 0 1 -6-6z" fill="#b221fd" data-original="#000000" class=""></path>
</g>
</svg>
</div>
</div>
{{-- Buscar --}}
<div class="flex relative">
<input id="buscar" type="search" wire:model="buscar" placeholder="Buscar"
class="w-full md:w-auto shadow-md border-2 active:border-neutral-200 focus:ring-0 border-neutral-200 rounded-[0.8rem] px-4 py-1 m-auto focus:border-neutral-300 focus:outline-none focus:shadow-outline">
</div>
<x-ver-entrada />
{{-- -Tabla usuarios - --}}
<div class="py-2">
<x-primary-table>
<x-slot name="thead">
<tr class="text-left">
<th class="rounded-l-lg font-normal">Nombre</th>
<th class="font-normal">Email</th>
<th class="font-normal">Rol</th>
<th class="font-normal">Ventas</th>
<th class="font-normal">Saldo</th>
<th class="font-normal"></th>
<th class="rounded-r-lg font-normal"></th>
</tr>
</x-slot>
<x-slot name="tbody">
@foreach ($usuarios as $usuario)
<tr class="border-gray-200 text-left" x-data="{ openOption: false }">
<td>{{$usuario->name ?? '' }}</td>
<td>{{$usuario->email ?? '' }}</td>
<td>{{$usuario->rol->nombre ?? '' }}</td>
<td>{{$usuario->historiales_venta_count ?? '' }}</td>
<td>{{$usuario->saldo->valor ?? '' }}</td>
<td>
<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>
</td>
<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">
<path stroke-linecap="round" stroke-linejoin="round"
d="M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" />
</svg>
</button>
<div x-cloak x-show="openOption" @click.away="openOption = false"
class="sm:absolute bg-white text-center w-[8rem] rounded-[1rem] border-b border-gray-200 shadow-lg right-10">
<button x-on:click="openOption=false" wire:click="editar({{ $usuario->id }})"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 hover:rounded-t-[1rem]">Editar</button>
<button x-on:click="openOption=!openOption"
wire:click="editarPassword({{ $usuario->id }})"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 ">Editar
password</button>
<button x-on:click="openOption=false" wire:click="saldo({{ $usuario->id }})"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 ">Agregar
saldo</button>
<button x-on:click="openOption=false"
wire:click="saldodesc({{ $usuario->id }})"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 ">Descontar
saldo</button>
<button x-on:click="openOption=false,gestion=true"
wire:click="gestionar({{ $usuario->id }},'{{ $usuario->rol_id }}','{{ $usuario->name }}')"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 ">Precio
servicio</button>
<button x-on:click="openOption=false,gestionPromo=true"
wire:click="gestionarPromociones({{ $usuario->id }},'{{ $usuario->name }}')"
class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300 ">Precio
promocion</button>
<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>
</tr>
@endforeach
</x-slot>
<x-slot name="tlink">
{{ $usuarios->links() }}
</x-slot>
</x-primary-table>
{{-- <div class="py-2">
<table class="text-center rounded-lg shadow-lg m-auto mt-4 mb-4 bg-white md:w-10/12">
<thead class="font-normal bg-[#000029] text-white h-9">
<tr class="text-left">
@@ -145,7 +206,7 @@
</tbody>
</table>
{{ $usuarios->links() }}
</div>
</div> --}}
{{-- Gestionar precios --}}
<div x-cloak x-show="gestion" x-transition:enter="transition duration-350"