Skip to content

Commit

Permalink
feat(action_log): Make Action Log view Livewire Component
Browse files Browse the repository at this point in the history
  • Loading branch information
herrtxbias committed Mar 18, 2021
1 parent 01eef44 commit 045a67b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 31 deletions.
27 changes: 0 additions & 27 deletions app/Http/Controllers/AdminController.php

This file was deleted.

33 changes: 33 additions & 0 deletions app/Http/Livewire/Dashboard/Administration/ViewActionLog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace App\Http\Livewire\Dashboard\Administration;

use App\Events\ActionLog;
use App\Http\Livewire\DataTable\WithPerPagePagination;
use App\Models\Action;
use Auth;
use Livewire\Component;

class ViewActionLog extends Component
{
use WithPerPagePagination;

protected $listeners = ['refreshData'];

public $search = '';

public function render()
{
return view('livewire.dashboard.administration.view-action-log', [
'logs' => $this->applyPagination(Action::query()->orderBy('id', 'desc')->search('message', $this->search)),
]);
}

public function updatedSearch(){
$this->resetPage();
}

public function refreshData(){
// Placeholder
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-app-layout>
<div>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Action Log') }}
Expand All @@ -7,7 +7,23 @@
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 flex-col space-y-4">
<div class="flex justify-between">
<div class="w-1/3 flex space-x-2">
<x-jet-input type="text" wire:model="search" placeholder="Search Actions..." class="w-full"></x-jet-input>
</div>

<div class="space-x-2 flex items-center">
<x-input.group borderless paddingless for="perPage" label="Per Page">
<x-input.select wire:model="perPage" id="perPage" class="rounded-md">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</x-input.select>
</x-input.group>
</div>
</div>
<div class="mt-4 bg-white overflow-hidden shadow sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<div class="flow-root">
Expand Down Expand Up @@ -45,4 +61,4 @@
</div>
</div>
</div>
</x-app-layout>
</div>
3 changes: 2 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Controllers\AdminController;
use App\Http\Controllers\DashboardController;
use App\Http\Livewire\Dashboard\Administration\Users;
use App\Http\Livewire\Dashboard\Administration\ViewActionLog;
use App\Http\Livewire\Dashboard\Components\Components;
use App\Http\Livewire\Dashboard\Incidents\Incidents;
use App\Http\Livewire\Dashboard\Incidents\PastIncidents;
Expand Down Expand Up @@ -43,5 +44,5 @@
Route::get('/dashboard/metrics', Metrics::class)->middleware(['can:read_metrics'])->name('dashboard.metrics');

Route::get('/dashboard/admin/users', Users::class)->middleware(['can:read_users'])->name('dashboard.admin.users');
Route::get('/dashboard/admin/actionlog', [AdminController::class, 'actionLog'])->middleware(['can:read_actionlog'])->name('dashboard.admin.actionlog');
Route::get('/dashboard/admin/actionlog', ViewActionLog::class)->middleware(['can:read_actionlog'])->name('dashboard.admin.actionlog');
});

0 comments on commit 045a67b

Please sign in to comment.