log historial

This commit is contained in:
Felipe
2024-03-01 08:05:52 -05:00
parent a13d666c95
commit 6c760652f6
7 changed files with 231 additions and 116 deletions
+3
View File
@@ -85,6 +85,9 @@ class MenuController extends Controller
public function showLogGeneral(){ public function showLogGeneral(){
return view('menu/log_general'); return view('menu/log_general');
} }
public function showLogHistorial(){
return view('menu/log_historial');
}
public function showroles(){ public function showroles(){
return view('menu/roles'); return view('menu/roles');
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Http\Livewire;
use App\Models\Log_historial;
use Livewire\Component;
class ShowLogGeneral extends Component
{
public $entradas;
public $buscar;
public $filtro_fecha;
public function render()
{
$query = Log_historial::query();
if ($this->buscar) {
$query->where('detalle', 'like', '%' . $this->buscar . '%');
}
if ($this->filtro_fecha) {
$query->whereDate('created_at', $this->filtro_fecha);
}
$logs = $query->orderBy('id', 'desc')->paginate($this->entradas);
return view('livewire.show-log-historial', [
'logs' => $logs
]);
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Log_historial extends Model
{
use HasFactory;
protected $table = 'log_historial';
protected $fillable = [
'user_id',
'detalle'
];
public function user()
{
return $this->belongsTo(User::class);
}
}
@@ -80,6 +80,7 @@
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logGeneral') }}">Log general</a> <a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logGeneral') }}">Log general</a>
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logs') }}">Log cuentas</a> <a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logs') }}">Log cuentas</a>
@if (auth()->user()->rol->nombre == 'super') @if (auth()->user()->rol->nombre == 'super')
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logHistorial') }}">Log historial</a>
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logsRecargas') }}">Log recargas</a> <a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('logsRecargas') }}">Log recargas</a>
<a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('promociones') }}">Gestión Promociones</a> <a class="block cursor-pointer text-center hover:bg-[#d1d3e1] border-b w-full px-3 py-1" href="{{ route('promociones') }}">Gestión Promociones</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('usuarios') }}">Gestión Usuarios</a>
@@ -0,0 +1,47 @@
<div class="h-full w-full md:my-2">
<div class="bg-[#f5f5f5] m-auto p-2 md:p-5 w-auto x-auto grid grid-cols-1 lg:grid-cols-1text-center rounded-xl py-4 px-2 ms:px-8 xl:mx-10 mb-8 ">
<div class="md:flex justify-center my-2 items-center text-center ">
<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">
<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" />
</svg>
Log historial
</div>
<div class="flex relative text-sm mx-auto w-64 md:w-auto my-2">
<input id="buscar" type="search" wire:model.lazy="buscar" placeholder="Buscar" class="shadow-md border-2 active:border-neutral-200 focus:ring-0 border-neutral-200 w-64 md:w-auto 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 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 class="text-sm mr-auto">
<input type="date" wire:model="filtro_fecha" class="shadow-md border-2 active:border-neutral-200 focus:ring-0 border-neutral-200 w-64 md:w-auto rounded-[0.8rem] pr-7 py-1 m-auto focus:border-neutral-300 focus:outline-none focus:shadow-outline">
</div>
</div>
<x-ver-entrada />
{{-- <x-primary-table>
<x-slot name="thead">
<tr class="text-left">
<th class="rounded-l-lg font-normal w-1/8 pl-2 sm:w-1/8">Usuario</th>
<th class="font-normal w-1/8 sm:w-1/8 pl-2">Detalle</th>
<th class="rounded-r-lg w-1/8 font-normal sm:w-1/8">Fecha</th>
</tr>
</x-slot>
<x-slot name="tbody">
@foreach ($logs as $log)
<tr class="border-gray-200 text-left w-full pl-4 hover:bg-gray-200 hover:ring-gray-500">
<td class="pl-2">{{ $log->user->name ?? '' }}</td>
<td class="pl-2">{{ $log->detalle ?? '' }}</td>
<td class="pl-2">{{ $log->created_at->format('d M Y h:m a') ?? '' }}</td>
</tr>
@endforeach
</x-slot>
<x-slot name="tlink">
{{ $logs->links() }}
</x-slot>
</x-primary-table> --}}
</div>
</div>
@@ -0,0 +1,7 @@
<x-app-layout>
<div class="pb-4">
<livewire:show-log-historial />
</div>
@include('layouts.footer')
</x-app-layout>
+1
View File
@@ -60,6 +60,7 @@ Route::middleware(["auth", "solo_usuario_administrador"])->group(function () {
Route::get('/import',[MenuController::class,'showimport' ])->name('import'); Route::get('/import',[MenuController::class,'showimport' ])->name('import');
Route::any('/logs-recargas',[MenuController::class,'showLogRecargas' ])->name('logsRecargas'); Route::any('/logs-recargas',[MenuController::class,'showLogRecargas' ])->name('logsRecargas');
Route::any('/log-general',[MenuController::class,'showLogGeneral' ])->name('logGeneral'); Route::any('/log-general',[MenuController::class,'showLogGeneral' ])->name('logGeneral');
Route::any('/log-historial',[MenuController::class,'showLogHistorial' ])->name('logHistorial');
Route::any('/roles',[MenuController::class,'showroles' ])->name('roles'); Route::any('/roles',[MenuController::class,'showroles' ])->name('roles');
Route::get('/utilidades',[MenuController::class,'showutilidad' ])->name('utilidades'); Route::get('/utilidades',[MenuController::class,'showutilidad' ])->name('utilidades');
}); });