mantenimiento

This commit is contained in:
Felipe
2024-04-29 18:21:04 -05:00
parent 5890584bb8
commit 80c8748182
6 changed files with 137 additions and 2 deletions
+3 -1
View File
@@ -93,7 +93,9 @@ class MenuController extends Controller
return view('menu/roles');
}
public function mantenimiento(){
return view('menu/mantenimiento');
}
public function pay($estado){
return view('menu/order',[
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Http\Livewire;
use App\Models\Historial_cuenta;
use Livewire\Component;
use Jantinnerezo\LivewireAlert\LivewireAlert;
use Livewire\WithPagination;
class ShowMantenimiento extends Component
{
use WithPagination;
use LivewireAlert;
public $entradas = 10;
public $delete_1 = [];
public $cont = [];
public function render()
{
$historialesConEstadoPendiente = Historial_cuenta::whereHas('historial', function ($query) {
$query->where('estado', 'pendiente');
})->paginate($this->entradas);
$this->cont = $historialesConEstadoPendiente->toArray();
return view('livewire.show-mantenimiento',[
'historiales' => $historialesConEstadoPendiente
]);
}
public function seleccionarTodos(){
if (count($this->delete_1) == 0) {
$this->delete_1 = array_column($this->cont['data'], 'id');
} else {
$this->delete_1 = [];
}
dd($this->delete_1);
}
public function eliminarCuentas()
{
Historial_cuenta::whereIn('id', $this->delete_1)->delete();
$this->delete_1 = [];
$this->alert('success', 'Historiales eliminados correctamente!', [
'position' => 'top'
]);
}
}
-1
View File
@@ -770,6 +770,5 @@ class ShowPlanes extends Component
}
//dd($this->delete_1);
}
}
@@ -0,0 +1,75 @@
<div 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="eliminarCuentas">
<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-[100%] m-auto p-2 md:p-5 rounded-[1.2rem] 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 />
Mantenimiento
</div>
</div>
<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>
<div class="flex justify-between items-center gap-x-2">
<div>
<div class="my-1 md:my-0 text-sm">
<input type="checkbox" name="" id="Libres 100%" wire:click="seleccionarTodos">
<label for="Libres 100%">Seleccionar todos</label>
</div>
</div>
<x-ver-entrada />
</div>
<x-primary-table>
<x-slot name="thead">
<tr class="text-left">
<th class="rounded-l-lg font-normal pl-[2rem]"></th>
<th class="font-normal pl-[2rem]">id</th>
<th class="font-normal pl-[2rem]">Estado</th>
<th class="font-normal pl-[2rem]">Cuenta</th>
</tr>
</x-slot>
<x-slot name="tbody">
@foreach ($historiales as $historial)
<tr class="hover:bg-gray-200 hover:ring-gray-500 border-gray-200 text-sm text-left w-full pl-4 @if ($historiales >= '1') bg-green-200 @endif"
x-data="{ openOption: false }">
<td>
<input type="checkbox" wire:model="delete_1" value="{{ $historial->id }}">
</td>
<td class="pl-[2rem]">{{ $historial->id ?? '' }}</td>
<td class="pl-[2rem]">{{ $historial->historial->estado ?? '' }}</td>
<td class="pl-[2rem]">
{{ $historial->cuenta->correo ?? '' }}
-
{{ $historial->cuenta->password ?? 'No disponible' }}
</td>
</tr>
@endforeach
</x-slot>
<x-slot name="tlink">
{{ $historiales->links() }}
</x-slot>
</x-primary-table>
</div>
</div>
@@ -0,0 +1,3 @@
<x-app-layout>
<livewire:show-mantenimiento />
</x-app-layout>
+1
View File
@@ -63,6 +63,7 @@ Route::middleware(["auth", "solo_usuario_administrador"])->group(function () {
Route::any('/log-historial', [MenuController::class, 'showLogHistorial'])->name('logHistorial');
Route::any('/roles', [MenuController::class, 'showroles'])->name('roles');
Route::get('/utilidades', [MenuController::class, 'showutilidad'])->name('utilidades');
Route::get('/mantenimiento', [MenuController::class, 'mantenimiento'])->name('mantenimiento');
});