(,), 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>
+26 -13
View File
@@ -1,7 +1,7 @@
<div x-data="{ nequi: @entangle('nequi'), valor_recarga: @entangle('valor_recarga') }">
<div x-data="{ nequi: @entangle('nequi'), valor_recarga: @entangle('valor_recarga'),valor_recarga_format: @entangle('valor_recarga_format') }">
<div class=" absolute backdrop-blur-sm bg-white/70 left-0 bottom-0 top-0 right-0 h-full z-40" wire:loading
wire:target="verPromocion,comprarPromo,editarPromo,editarPromoUpdate,comprar,pagar,create_newCategoria,add_tarifa,del_item,guardar,eliminar">
<div class="grid h-full place-items-center ">
<div class="grid h-full place-items-center">
<div class="max-w-xs">
<img src="./img/loading.gif" alt="" class="w-full text-center">
<p class="text-gray-500 text-center">Cargando</p>
@@ -30,21 +30,26 @@
Monto a recargar
</div>
<div>
<input type="tel" name="recharge" wire:model="valor_recarga" placeholder="$20.000" required
class="border-2 w-1/2 md:w-auto mb-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<input type="tel" name="recharge" id="valor_recarga" wire:model="valor_recarga" class="hidden">
<input
type="text"
id="valor_recarga_format"
name="recharge_format"
wire:model="valor_recarga_format"
placeholder="$20.000"
required
class="border-2 w-1/2 md:w-auto mb-2 border-neutral-200 rounded-[0.8rem] shadow appearance-none focus:border-neutral-300 focus:ring-0 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
oninput="formatInput(this)"
>
@if ($valor_recarga)
<div class="flex text-sm justify-center">Tu valor a pagar seria: $<p>
{{ $nuevo_valor = ($valor_recarga * 0.03 + '700') * 0.19 + ($valor_recarga * 0.03 + '700') + $valor_recarga }}
<div class="flex text-sm justify-center">Tu valor a pagar seria: $<p class="font-semibold">
{{ number_format($nuevo_valor = ($valor_recarga * 0.03 + '700') * 0.19 + ($valor_recarga * 0.03 + '700') + $valor_recarga) }}
</p>
</div>
@endif
<p class="text-sm text-green-600 py-2 ">Se sumara $700 COP+ IVA + 3% adicional al pago en
Mercado Pago por costos de sistema.</p>
<p class="text-sm text-green-600 py-2">Se sumara $700 COP+ IVA + 3% adicional al pago en Mercado Pago por costos de sistema.</p>
</div>
<div class="bg-white px-4 py-3 md:flex justify-center mt-4 mb-4">
@@ -96,7 +101,6 @@
<tbody class="text-gray-500 select-none">
@foreach ($historial_recargas as $historial_recarga)
<tr class="border-gray-200 text-left w-full pl-4">
{{-- <td class="pl-[2rem]">{{date("d/m/Y", strtotime($historial_recarga->created_at))}}</td> --}}
<td class="pl-[2rem]">{{ date('d/m/Y', strtotime($historial_recarga->created_at)) }}</td>
<td class="pl-[2rem]">${{ number_format($historial_recarga->monto) }}</td>
<td class="pl-[2rem] pr-[2rem]">{{ $historial_recarga->status }}</td>
@@ -125,5 +129,14 @@
</div>
</div>
<script>
function formatInput(input) {
let unformattedValue = input.value.replace(/\D/g, '');
let formattedValue = unformattedValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
input.value = formattedValue;
}
</script>
</div>
@@ -552,9 +552,10 @@
@endforeach
@endif
@endif
*Usuario:* {{ trim($cuenta->correo) }}
*Contraseña:* {{ trim($cuenta->password) }}
@endforeach
</textarea>
@@ -570,9 +571,7 @@
<h1 class="flex mt-4 gap-1">
Este servicio vencerá el <p class="font-semibold text-gray-600">
{{ Carbon\Carbon::parse($cuentas->fecha_final)->format('Y/m/d') ?? '' }}.</p>
Este servicio vencerá el <p class="font-semibold text-gray-600"> {{ Carbon\Carbon::parse($cuentas->fecha_final)->format('Y/m/d') ?? '' }}.</p>
</h1>
@endif
@@ -580,9 +580,7 @@
Monto a recargar
</div>
<div>
<input type="number" min="0" name="monto" wire:model="valor_recargar"
placeholder="$100.000" required
class="border-2 w-1/2 md:w-auto mb-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<input type="number" min="0" name="monto" wire:model="valor_recargar" placeholder="$100.000" required class="border-2 w-1/2 md:w-auto mb-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<div class="flex text-sm justify-center">Tu valor total seria: $<p>
{{ number_format($saldo_actual + $valor_recargar) }}