(,), editor, administrador

This commit is contained in:
Felipe
2024-03-08 16:28:07 -05:00
parent cd68c1d966
commit 3ec412ea55
6 changed files with 128 additions and 84 deletions
+71 -47
View File
@@ -26,7 +26,7 @@
<div class="grid grid-cols-1 text-center sm:flex justify-between my-2 items-center text-sm ">
<div class="grid grid-cols-1 sm:flex items-center gap-4">
<div class="flex text-sm">
<x-icon-arrow-right/>
<x-icon-arrow-right />
Planes
</div>
@@ -42,11 +42,17 @@
</svg>
</a>
@if (auth()->user()->rol->nombre != 'editor' && auth()->user()->rol->nombre != '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]">
<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]">
Modificar tarifas
<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 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
@@ -94,17 +100,11 @@
<label for="Repetidas">Repetidas</label>
<input type="checkbox" name="" id="Repetidas" wire:model="repetidas">
</div>
</div>
@if (auth()->user()->rol->nombre != 'editor')
<div class="my-1 md:my-0">
<button wire:click="eliminarCuentas"
class="bg-red-400 text-white px-4 py-2 rounded">Eliminar</button>
</div>
@endif
<div class="my-1 md:my-0">
<button wire:click="eliminarCuentas" class="bg-red-400 text-white px-4 py-2 rounded">Eliminar</button>
</div>
<div class="grid mt-4 sm:mt-0 sm:flex w-[8rem]">
<select name="servicios" id="servicios" wire:model.debounce.500ms="servicios_id"
@@ -153,13 +153,7 @@
) {
$historiales = $cuenta
->historiales()
->where(
'fecha_final',
'>',
now()
->addDay()
->toDateString(),
)
->where('fecha_final', '>', now()->addDay()->toDateString())
->count();
}
@@ -335,15 +329,19 @@
@if ($consulta_verUsuarios)
@if ($consulta_verUsuarios->estado == 'pendiente')
@if (count($consulta_verUsuarios->historiales) != $consulta_verUsuarios->servicio->completa)
<span class="mr-4">
<button wire:click="openAdd" 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 ">Añadir usuario</button>
</span>
@if (Auth::user()->rol->nombre != 'editor')
<span class="mr-4">
<button wire:click="openAdd" 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 ">Añadir usuario</button>
</span>
@endif
@endif
@else
@if (count($consulta_verUsuarios->historiales) != $consulta_verUsuarios->servicio->pantallas)
<span class="mr-4">
<button wire:click="openAdd" 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 ">Añadir usuario</button>
</span>
@if (Auth::user()->rol->nombre != 'editor')
<span class="mr-4">
<button wire:click="openAdd" 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 ">Añadir usuario</button>
</span>
@endif
@endif
@endif
@endif
@@ -376,12 +374,15 @@
<div class="mb-4">
<label for="usuario_renovar" class="block text-gray-700 text-sm font-bold mb-2">Usuario:</label>
<input type="email" id="usuario_nrenovar" wire:model="usuario_renovar" class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<input type="email" id="usuario_nrenovar" wire:model="usuario_renovar"
class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-4">
<label for="password_renovar" class="block text-gray-700 text-sm font-bold mb-2">Contraseña:</label>
<input type="text" id="password_renovar" wire:model="password_renovar" class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<label for="password_renovar"
class="block text-gray-700 text-sm font-bold mb-2">Contraseña:</label>
<input type="text" id="password_renovar" wire:model="password_renovar"
class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-4">
@@ -397,23 +398,28 @@
</div>
<div date-rangepicker class="flex items-center gap-2 mb-4">
<div class="relative">
<label for="fecha_inicial_renovar" class="block text-gray-700 text-sm font-bold mb-2">Fecha inicio:</label>
<input name="fecha_inicial_renovar" wire:model.defer="fecha_inicial_renovar" type="date" class="border-2 border-neutral-200 rounded-[0.8rem] px-4 py-2 text-gray-900 sm:text-sm focus:border-neutral-300 focus:outline-none focus:shadow-outline focus:ring-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 datepicker-input">
<label for="fecha_inicial_renovar" class="block text-gray-700 text-sm font-bold mb-2">Fecha
inicio:</label>
<input name="fecha_inicial_renovar" wire:model.defer="fecha_inicial_renovar" type="date"
class="border-2 border-neutral-200 rounded-[0.8rem] px-4 py-2 text-gray-900 sm:text-sm focus:border-neutral-300 focus:outline-none focus:shadow-outline focus:ring-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 datepicker-input">
</div>
<div class="relative">
<label for="fecha_final_renovar" class="block text-gray-700 text-sm font-bold mb-2">Fecha
Final:</label>
<input name="fecha_final_renovar" wire:model.defer="fecha_final_renovar" type="date" class="border-2 border-neutral-200 rounded-[0.8rem] px-4 py-2 text-gray-900 sm:text-sm focus:border-neutral-300 focus:outline-none focus:shadow-outline focus:ring-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 datepicker-input">
<input name="fecha_final_renovar" wire:model.defer="fecha_final_renovar" type="date"
class="border-2 border-neutral-200 rounded-[0.8rem] px-4 py-2 text-gray-900 sm:text-sm focus:border-neutral-300 focus:outline-none focus:shadow-outline focus:ring-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 datepicker-input">
</div>
</div>
<div class="bg-white px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse sm:justify-evenly gap-5 mt-4">
<span>
<button wire:click="saveRenovar()" 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>
<button wire:click="saveRenovar()" 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>
</span>
<span>
<button x-on:click="renovar=false" wire:click="" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
<button x-on:click="renovar=false" wire:click="" type="button"
class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
</span>
</div>
@@ -466,24 +472,38 @@
@if (!empty($consulta_verUsuarios->servicio->tarifas))
<label for="tarifa " class="block text-gray-700 text-sm font-bold mb-2">Tarifa:</label>
<select name="" id="" wire:model="tarifa" class="border-2 border-neutral-200 rounded-lg shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<select name="" id="" wire:model="tarifa"
class="border-2 border-neutral-200 rounded-lg shadow apperance-none focus:border-neutral-300 focus:ring-0 w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<option value="" select>Seleccionar</option>
@foreach ($consulta_verUsuarios->servicio->tarifas as $tarifaItem)
@if ($consulta_verUsuarios->estado == 'pendiente' && $tarifaItem->rol_id == '5' )
@if ($consulta_verUsuarios->estado == 'pendiente' && $tarifaItem->rol_id == '5')
@if ($tarifaItem->pantallas == $tarifaItem->servicio->completa)
@if ($tarifaItem->servicio->por_tiempo)
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} - {{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}</option>
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} -
{{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}
</option>
@else
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} - {{ $tarifaItem->pantallas }} {{ __($tarifaItem->pantallas == 1 ? 'pantalla' : 'pantallas') }} - {{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}</option>
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} -
{{ $tarifaItem->pantallas }}
{{ __($tarifaItem->pantallas == 1 ? 'pantalla' : 'pantallas') }} -
{{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}
</option>
@endif
@endif
@else
@if ($tarifaItem->rol_id == '5' && ($tarifaItem->pantallas < ($tarifaItem->servicio->pantallas - count($consulta_verUsuarios->historiales))))
@if (
$tarifaItem->rol_id == '5' &&
$tarifaItem->pantallas < $tarifaItem->servicio->pantallas - count($consulta_verUsuarios->historiales))
@if ($tarifaItem->servicio->por_tiempo)
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} - {{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}</option>
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} -
{{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}
</option>
@else
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} - {{ $tarifaItem->pantallas }} {{ __($tarifaItem->pantallas == 1 ? 'pantalla' : 'pantallas') }} - {{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}</option>
<option value="{{ $tarifaItem }}">{{ $tarifaItem->servicio->nombre }} -
{{ $tarifaItem->pantallas }}
{{ __($tarifaItem->pantallas == 1 ? 'pantalla' : 'pantallas') }} -
{{ $tarifaItem->dias }} {{ __($tarifaItem->dias == 1 ? 'día' : 'días') }}
</option>
@endif
@endif
@endif
@@ -496,7 +516,8 @@
<div class="bg-white px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse sm:justify-evenly gap-5 mt-4">
<span>
<button wire:click="saveUser()" 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>
<button wire:click="saveUser()" 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>
</span>
<span>
<button x-on:click="addUser=false" wire:click="" type="button"
@@ -786,7 +807,8 @@
<td class="pl-[1rem]">{{ $tarifa->dias ?? '' }}</td>
<td class="pl-[1rem]">{{ number_format($tarifa->utilidad ?? 0) }}</td>
<td class="pl-[1rem]">
<button wire:click="editar({{ $tarifa }})" class="justify-center flex px-3 py-2 rounded-lg text-xs cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">Editar</button>
<button wire:click="editar({{ $tarifa }})"
class="justify-center flex px-3 py-2 rounded-lg text-xs cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">Editar</button>
</td>
</tr>
@endforeach
@@ -797,7 +819,8 @@
<div class="bg-white px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse sm:justify-evenly gap-5 mt-4">
<span>
<button x-on:click="modTarifas=false" wire:click="" type="button" class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
<button x-on:click="modTarifas=false" wire:click="" type="button"
class="inline-flex justify-center w-full rounded-md border border-transparent px-4 py-2 text-white bg-[#585858] hover:bg-[#3a3a3a] focus:shadow-outline-green ease-in-out sm-text-sm sm-leading-5">Cerrar</button>
</span>
</div>
</div>
@@ -853,7 +876,8 @@
<div class="flex m-auto items-center">
<label class="text-gray-500 text-sm mr-2">Activa</label>
<input type="checkbox" id="estadoTarifa" wire:model="estadoTarifa" class="border-2 border-neutral-200 focus:ring-0 shadow apperance-none focus:border-neutral-300 text-[#B221FD] leading-tight focus:outline-none focus:shadow-outline">
<input type="checkbox" id="estadoTarifa" wire:model="estadoTarifa"
class="border-2 border-neutral-200 focus:ring-0 shadow apperance-none focus:border-neutral-300 text-[#B221FD] leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-3 mt-3 flex justify-end">
<span>