vista tarifas
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,78 @@
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Promociones;
|
||||
use App\Models\Role;
|
||||
use App\Models\Servicio;
|
||||
use App\Models\Tarifas;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use Jantinnerezo\LivewireAlert\LivewireAlert;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ShowTarifas extends Component
|
||||
{
|
||||
use LivewireAlert;
|
||||
use WithPagination;
|
||||
|
||||
public $tarifas;
|
||||
public $planes;
|
||||
|
||||
// Tarifa datos
|
||||
public $pantallas;
|
||||
public $dias = 30;
|
||||
public $precio;
|
||||
public $utilidad;
|
||||
public $estado;
|
||||
public $servicio_id;
|
||||
public $plan_id;
|
||||
public $rol_id;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.show-tarifas');
|
||||
$this->tarifas = Tarifas::where('servicio_id', $this->servicio_id)->where('rol_id', Auth::user()->rol->id)->where('estado', 'activo')->get();
|
||||
$this->planes = Tarifas::where('servicio_id', $this->servicio_id)->where('rol_id', Auth::user()->rol->id)->where('estado', 'activo')->get();
|
||||
|
||||
return view('livewire.show-tarifas', [
|
||||
'roles' => Role::where('subvendedor_id', auth()->user()->id)->get(),
|
||||
'promo' => Promociones::where('visible', 'true')->get(),
|
||||
'servicios' => Servicio::where('estado', 'activo')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function guardarTarifa()
|
||||
{
|
||||
$this->validate([
|
||||
'pantallas' => 'required',
|
||||
'dias' => 'required',
|
||||
'precio' => 'required',
|
||||
'utilidad' => 'required',
|
||||
'estado' => 'required',
|
||||
'servicio_id' => 'required',
|
||||
'rol_id' => 'required',
|
||||
], [
|
||||
'pantallas.required' => 'El campo pantallas es obligatorio',
|
||||
'dias.required' => 'El campo días es obligatorio',
|
||||
'precio.required' => 'El campo precio es obligatorio',
|
||||
'utilidad.required' => 'El campo utilidad es obligatorio',
|
||||
'estado.required' => 'El campo estado es obligatorio',
|
||||
'servicio_id.required' => 'El campo servicio es obligatorio',
|
||||
'rol_id.required' => 'El campo rol es obligatorio',
|
||||
]);
|
||||
|
||||
Tarifas::create([
|
||||
'pantallas' => $this->pantallas,
|
||||
'dias' => $this->dias,
|
||||
'valor' => $this->precio,
|
||||
'utilidad' => $this->utilidad,
|
||||
'estado' => $this->estado ? 'activo' : 'inactivo',
|
||||
'servicio_id' => $this->servicio_id,
|
||||
'rol_id' => $this->rol_id,
|
||||
'subvendedor_id' => Auth::user()->id,
|
||||
]);
|
||||
|
||||
$this->alert('success', '¡Tarifas creada correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,12 +100,11 @@ class ShowUsuarios extends Component
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
$consulta_tarifas = TarifaPromo::take(1);
|
||||
|
||||
$consulta_usuarios = User::withCount(['usuario_tarifas as active_tarifas' => function ($query) {
|
||||
$query->where('visible', 'true');
|
||||
}])
|
||||
$query->where('visible', 'true');
|
||||
}])
|
||||
->withCount(['usuario_promos as active_promos' => function ($query) {
|
||||
$query->where('visible', 'true');
|
||||
}])
|
||||
@@ -114,9 +113,15 @@ class ShowUsuarios extends Component
|
||||
->orWhere('email', 'ILIKE', '%' . $this->buscar . '%');
|
||||
});
|
||||
|
||||
|
||||
if ($this->verPreciosPersonalizados) {
|
||||
$consulta_usuarios = $consulta_usuarios->havingRaw('active_tarifas > 0 OR active_promos > 0');
|
||||
$consulta_usuarios = $consulta_usuarios->where(function ($query) {
|
||||
$query->whereHas('usuario_tarifas', function ($q) {
|
||||
$q->where('visible', true);
|
||||
})
|
||||
->orWhereHas('usuario_promos', function ($q) {
|
||||
$q->where('visible', true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (!(Auth::user()->rol->nombre == "super")) {
|
||||
@@ -316,6 +321,23 @@ class ShowUsuarios extends Component
|
||||
$this->limpiarSaldo();
|
||||
}
|
||||
|
||||
public function quitarSubvendedor($id)
|
||||
{
|
||||
User::FindOrFail($id);
|
||||
|
||||
User::find($id)->update([
|
||||
'subvendedor' => false
|
||||
]);
|
||||
}
|
||||
public function ponerSubvendedor($id)
|
||||
{
|
||||
User::FindOrFail($id);
|
||||
|
||||
User::find($id)->update([
|
||||
'subvendedor' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function editar($id)
|
||||
{
|
||||
$this->id_edit = $id;
|
||||
|
||||
+24
-18
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Tarifas extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'pantallas',
|
||||
'dias',
|
||||
@@ -15,37 +16,42 @@ class Tarifas extends Model
|
||||
'utilidad',
|
||||
'estado',
|
||||
'servicio_id',
|
||||
'rol_id'
|
||||
|
||||
'rol_id',
|
||||
'subvendedor_id',
|
||||
];
|
||||
|
||||
public function servicio(){
|
||||
return $this ->belongsTo(Servicio::class);
|
||||
public function servicio()
|
||||
{
|
||||
return $this->belongsTo(Servicio::class);
|
||||
}
|
||||
|
||||
public function preferenciales(){
|
||||
return $this ->hasMany(Preferencial::class,'tarifa_id');
|
||||
public function preferenciales()
|
||||
{
|
||||
return $this->hasMany(Preferencial::class, 'tarifa_id');
|
||||
}
|
||||
|
||||
public function cuentas(){
|
||||
return $this ->hasMany(Cuentas::class,'tarifa_id');
|
||||
public function cuentas()
|
||||
{
|
||||
return $this->hasMany(Cuentas::class, 'tarifa_id');
|
||||
}
|
||||
|
||||
public function historiales(){
|
||||
return $this ->hasMany(Historiale::class,'tarifa_id');
|
||||
public function historiales()
|
||||
{
|
||||
return $this->hasMany(Historiale::class, 'tarifa_id');
|
||||
}
|
||||
|
||||
public function promociones(){
|
||||
return $this ->belongsToMany(Promociones::class,'promocion_tarifas','tarifa_id','promocion_id');
|
||||
public function promociones()
|
||||
{
|
||||
return $this->belongsToMany(Promociones::class, 'promocion_tarifas', 'tarifa_id', 'promocion_id');
|
||||
}
|
||||
|
||||
public function rol(){
|
||||
return $this ->belongsTo(Role::class);
|
||||
public function rol()
|
||||
{
|
||||
return $this->belongsTo(Role::class);
|
||||
}
|
||||
|
||||
public function usuario_tarifas(){
|
||||
return $this ->hasMany(Usuario_tarifa::class,'tarifa_id');
|
||||
public function usuario_tarifas()
|
||||
{
|
||||
return $this->hasMany(Usuario_tarifa::class, 'tarifa_id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -113,10 +113,11 @@
|
||||
<h4 @click="selected !== 0 ? selected = 0 : selected = null" class="cursor-pointer px-5 py-3 bg-[#b221fd] text-white text-center inline-block hover:bg-[#7a02b8] hover:shadow rounded-lg">
|
||||
Admin
|
||||
</h4>
|
||||
<p class="absolute bg-[#f2f4ff] rounded-md @if (auth()->user()->rol->nombre == 'editor') -top-[400%] @elseif (auth()->user()->rol->nombre == 'administrador') -top-[200%] @elseif (auth()->user()->subvendedor) -top-3 @else -top-[800%] @endif -right-[20%] sm:-right-[55%]" x-show="selected == 0">
|
||||
<p class="absolute bg-[#f2f4ff] rounded-md @if (auth()->user()->rol->nombre == 'editor') -top-[400%] @elseif (auth()->user()->rol->nombre == 'administrador') -top-[200%] @elseif (auth()->user()->rol->nombre == 'super') -top-[300%] @elseif (auth()->user()->subvendedor) -top-3 @else -top-[800%] @endif -right-[20%] sm:-right-[55%]" x-show="selected == 0">
|
||||
@if (auth()->user()->subvendedor)
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('roles') }}">Gestión Roles</a>
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('usuarios') }}">Gestión Usuarios</a>
|
||||
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('tarifas') }}">Gestión Tarifas</a>
|
||||
@if ( auth()->user()->rol->nombre == 'super' || auth()->user()->rol->nombre == 'administrador' || auth()->user()->rol->nombre == 'editor')
|
||||
<a class="block cursor-pointer hover:rounded-t-md rounded-t-md text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('planes') }}">Gestión Planes</a>
|
||||
<a class="block cursor-pointer hover:rounded-b-md rounded-b-md text-center hover:bg-[#d1d3e1] w-full px-3 py-1" href="{{ route('import') }}">Importar cuentas</a>
|
||||
|
||||
@@ -24,53 +24,36 @@
|
||||
|
||||
|
||||
{{-- Buscador --}}
|
||||
<div class="bg-[#f5f5f5] md:w-[100%] m-auto p-2 md:p-5 rounded-[1.2rem] relative mb-4">
|
||||
<div class="bg-[#f5f5f5] md:w-full m-auto p-2 md:p-5 rounded-2xl relative mb-4">
|
||||
<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="grid grid-cols-1 sm:flex items-center gap-4">
|
||||
<div class="flex text-sm">
|
||||
<x-icon-arrow-right />
|
||||
Planes
|
||||
</div>
|
||||
|
||||
<a x-on:click="newCuenta = true"
|
||||
class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">
|
||||
<a x-on:click="newCuenta = true" class="justify-center flex px-4 py-2 rounded-lg cursor-pointer text-white bg-[#B221FD] hover:bg-[#7a02b8]">
|
||||
Nueva cuenta
|
||||
<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 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>
|
||||
@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
|
||||
</div>
|
||||
<div class="flex relative my-2">
|
||||
<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] 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="">
|
||||
<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] 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>
|
||||
<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>
|
||||
<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>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@@ -1,3 +1,150 @@
|
||||
<div>
|
||||
<h1>Tarifas</h1>
|
||||
<div x-data="{
|
||||
modTarifas: @entangle('modTarifas'),
|
||||
}" class="h-full w-full md:my-2">
|
||||
<div class=" fixed backdrop-blur-sm bg-white/70 left-0 bottom-0 top-0 right-0 h-full z-40" wire:loading wire:target="">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-[#f5f5f5] md:w-full m-auto p-2 md:p-5 rounded-2xl relative mb-4">
|
||||
<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 />
|
||||
Tarifas
|
||||
</div>
|
||||
|
||||
@if (auth()->user()->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]">
|
||||
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>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->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]">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>
|
||||
|
||||
<x-ver-entrada />
|
||||
|
||||
<div x-cloak x-show="modTarifas" x-transition:enter="transition duration-350" x-transition:enter-start="opacity-0 scale-100" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition duration-350" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-100" class="fixed backdrop-blur-sm bg-black/20 left-0 bottom-0 top-0 right-0 h-full z-20">
|
||||
<div class="grid h-full place-items-center">
|
||||
|
||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4 rounded-2xl shadow-md">
|
||||
<div class="mb-4">
|
||||
<select name="servicio" id="servicio_id" name="servicio_id" wire:model="servicio_id" class="border-2 border-neutral-200 rounded-[0.8rem] shadow apperance-none focus:border-neutral-300 focus:ring-0 w-[72%] sm:w-60 py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
<option value="" selected>Servicios</option>
|
||||
@foreach ($servicios as $servicio)
|
||||
<option value="{{ $servicio->id }}">{{ $servicio->nombre ?? '' }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-gray-700 text-sm font-bold mb-2">Pantallas:</label>
|
||||
<div class="grid grid-cols-6 gap-2 text-left mb-4">
|
||||
<div>
|
||||
<label for="rol_id" class="text-gray-500 text-sm">Rol</label>
|
||||
<select id="rol_id" name="rol_id" wire:model="rol_id" 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">
|
||||
<option value="" selected>Roles</option>
|
||||
@foreach ($roles as $rol)
|
||||
<option value="{{ $rol->id }}">{{ $rol->nombre ?? '' }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label id="plan_id" class="text-gray-500 text-sm">Plan</label>
|
||||
<select id="plan_id" name="plan_id" wire:model="plan_id" 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">
|
||||
<option value="" selected>Planes</option>
|
||||
@foreach ($planes as $plan)
|
||||
<option value="{{ $plan->id }}">{{ $plan->pantallas ?? 0 }} pantallas - {{ $plan->dias ?? 0 }} dias</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="precio" class="text-gray-500 text-sm">Precio</label>
|
||||
<input type="number" id="precio" name="precio" wire:model="precio" min="0" class="w-full border-2 border-neutral-200 rounded-[0.8rem] focus:ring-0 shadow apperance-none focus:border-neutral-300 py-2 pl-2 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
</div>
|
||||
<div>
|
||||
<label for="utilidad" class="text-gray-500 text-sm">Utilidad</label>
|
||||
<input type="number" id="utilidad" name="utilidad" wire:model="utilidad" min="0" class="w-full border-2 border-neutral-200 rounded-[0.8rem] focus:ring-0 shadow apperance-none focus:border-neutral-300 py-2 pl-2 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
|
||||
</div>
|
||||
<div class="flex m-auto items-center">
|
||||
<label for="estado" class="text-gray-500 text-sm mr-2">Activa</label>
|
||||
<input type="checkbox" id="estado" name="estado" wire:model="estado" checked 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">
|
||||
<button wire:click="guardarTarifa" type="button" class="inline-flex justify-center w-full md:w-auto rounded-md border border-transparent px-4 py-1 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</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="overflow-y-auto max-h-48">
|
||||
<table class="w-full sm-w-[20rem] text-center mt-4 border-separate border-spacing-y-2 mb-4">
|
||||
<thead class="font-normal bg-[#000029] text-white h-9">
|
||||
<tr class="text-left">
|
||||
<th class="rounded-l-lg font-normal pl-[1rem]">Estado</th>
|
||||
<th class="font-normal pl-[1rem]">Rol</th>
|
||||
<th class="font-normal pl-[1rem] whitespace-nowrap">Pantallas</th>
|
||||
<th class="font-normal pl-[1rem]">Valor</th>
|
||||
<th class="font-normal pl-[1rem]">Dias</th>
|
||||
<th class="font-normal pl-[1rem]">Utilidad</th>
|
||||
<th class="font-normal pl-[1rem]"></th>
|
||||
<th class="rounded-r-lg font-normal w-[1rem]"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-gray-500 select-none">
|
||||
@if (!empty($tarifas))
|
||||
@foreach ($tarifas as $tarifa)
|
||||
<tr class="border-gray-200 text-left w-full pl-4">
|
||||
<td class="pl-[1rem]">
|
||||
@if ($tarifa->estado == 'activo')
|
||||
<div class="bg-green-500 rounded-full w-3 h-3"></div>
|
||||
@else
|
||||
<div class="bg-red-500 rounded-full w-3 h-3"></div>
|
||||
@endif
|
||||
</td>
|
||||
<td class="pl-[1rem]">{{ $tarifa->rol->nombre ?? '' }}</td>
|
||||
<td class="pl-[1rem]">{{ $tarifa->pantallas ?? '' }}</td>
|
||||
<td class="pl-[1rem]">{{ number_format($tarifa->valor ?? 0) }}</td>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</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 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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
modalSaldoDesc: @entangle('modalSaldoDesc'),
|
||||
editarTarifaRol: @entangle('editarTarifaRol')
|
||||
}" class="h-full w-full md:my-2">
|
||||
<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="gestionarPromociones,actualizarTarifaRol,addpromos,eliminarUsuarioPromo,gestionar,eliminarUsuarioTarifa,addtarifas,crear,actualizar,editar,eliminar,limpiarInputAdd,limpiarInputEdit,editarPassword,limpiarContra,confirmarNewPassword,saldo,addSaldo">
|
||||
<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="gestionarPromociones,quitarSubvendedor,ponerSubvendedor,actualizarTarifaRol,addpromos,eliminarUsuarioPromo,gestionar,eliminarUsuarioTarifa,addtarifas,crear,actualizar,editar,eliminar,limpiarInputAdd,limpiarInputEdit,editarPassword,limpiarContra,confirmarNewPassword,saldo,addSaldo">
|
||||
<div class="grid h-full place-items-center ">
|
||||
<div class="max-w-xs">
|
||||
<img src="./img/loading.gif" alt="" class="w-full text-center">
|
||||
@@ -19,36 +18,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-[#f5f5f5] md:w-full m-auto p-2 md:p-5 rounded-lg relative mb-4">
|
||||
<div class="md:flex gap-4 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()->subvendedor || auth()->user()->rol->nombre === 'administrador' || auth()->user()->rol->nombre === 'editor' || auth()->user()->rol->nombre === '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">
|
||||
<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>
|
||||
@endif
|
||||
<div class="bg-[#f5f5f5] md:w-full m-auto p-2 md:p-5 rounded-2xl relative mb-4">
|
||||
<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 />
|
||||
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')
|
||||
<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>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->rol->nombre === 'super')
|
||||
<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
|
||||
@if (auth()->user()->rol->nombre === 'super' || 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]">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>
|
||||
|
||||
<div class="flex relative text-sm mx-auto w-64 md:w-auto my-2">
|
||||
@@ -88,7 +84,7 @@
|
||||
<th class="rounded-r-lg font-normal"></th>
|
||||
@elseif (Auth::user()->subvendedor)
|
||||
<th class="rounded-r-lg font-normal"></th>
|
||||
@else
|
||||
@else
|
||||
@endif
|
||||
</tr>
|
||||
</x-slot>
|
||||
@@ -144,6 +140,11 @@
|
||||
<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>
|
||||
@if ($usuario->subvendedor)
|
||||
<button x-on:click="openOption=!openOption" wire:click="quitarSubvendedor({{ $usuario->id }})" class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300">Quitar subvendedor</button>
|
||||
@else
|
||||
<button x-on:click="openOption=!openOption" wire:click="ponerSubvendedor({{ $usuario->id }})" class="text-gray-500 w-full py-1 hover:bg-gray-200 border-b border-gray-300">Habilitar subvendedor</button>
|
||||
@endif
|
||||
<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>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<x-app-layout>
|
||||
<div class="pb-4">
|
||||
<livewire:show-tarifas />
|
||||
</div>
|
||||
|
||||
@include('layouts.footer')
|
||||
</x-app-layout>
|
||||
+2
-1
@@ -43,12 +43,13 @@ Route::middleware(["auth"])->group(function () {
|
||||
Route::any('/logs', [MenuController::class, 'showlogs'])->name('logs');
|
||||
Route::any('/usuarios', [MenuController::class, 'showusuarios'])->name('usuarios');
|
||||
Route::any('/roles', [MenuController::class, 'showroles'])->name('roles');
|
||||
Route::any('/tarifas', [MenuController::class, 'showtarifas'])->name('tarifas');
|
||||
});
|
||||
|
||||
// Editores
|
||||
Route::middleware(["auth", "solo_usuario_editor"])->group(function () {
|
||||
Route::any('/planes', [MenuController::class, 'showplanes'])->name('planes');
|
||||
Route::get('/import', [MenuController::class, 'showimport'])->name('import');
|
||||
Route::any('/planes', [MenuController::class, 'showplanes'])->name('planes');
|
||||
});
|
||||
|
||||
//Administradores
|
||||
|
||||
Reference in New Issue
Block a user