This commit is contained in:
Julian Prieber 2023-10-23 23:55:19 +02:00
parent 0dea6bf503
commit 8ca57d9d31
3 changed files with 15 additions and 18 deletions

View File

@ -16,21 +16,22 @@ class UserTable extends DataTableComponent
{ {
$this->setPrimaryKey('id'); $this->setPrimaryKey('id');
$this->setPerPageAccepted([50, 100, 250, 500, 1000, -1]); $this->setPerPageAccepted([50, 100, 250, 500, 1000, -1]);
$this->setColumnSelectEnabled();
} }
public function columns(): array public function columns(): array
{ {
return [ return [
Column::make("Id", "id") Column::make(__('messages.ID'), "id")
->sortable() ->sortable()
->searchable(), ->searchable(),
Column::make("Name", "name") Column::make(__('messages.Name'), "name")
->sortable() ->sortable()
->searchable(), ->searchable(),
Column::make("Email", "email") Column::make(__('messages.E-Mail'), "email")
->sortable() ->sortable()
->searchable(), ->searchable(),
Column::make("Littlelink name", "littlelink_name") Column::make(__('messages.Page'), "littlelink_name")
->sortable() ->sortable()
->searchable() ->searchable()
->format(function ($value, $row, Column $column) { ->format(function ($value, $row, Column $column) {
@ -41,22 +42,20 @@ class UserTable extends DataTableComponent
} }
}) })
->html(), ->html(),
Column::make("Role", "role") Column::make(__('messages.Role'), "role")
->sortable() ->sortable()
->searchable(), ->searchable(),
Column::make("Test", "id") Column::make(__('messages.Links'), "id")
->sortable()
->format(function ($value, $row) { ->format(function ($value, $row) {
$linkCount = Link::where('user_id', $row->id)->count(); $linkCount = Link::where('user_id', $row->id)->count();
return $linkCount; return $linkCount;
}), }),
Column::make("Clicks Sum", "id") Column::make(__('messages.Clicks'), "id")
->sortable()
->format(function ($value, $row) { ->format(function ($value, $row) {
$clicksSum = Link::where('user_id', $row->id)->sum('click_number'); $clicksSum = Link::where('user_id', $row->id)->sum('click_number');
return $clicksSum; return $clicksSum;
}), }),
Column::make("E-mail", "email_verified_at") Column::make(__('messages.E-Mail'), "email_verified_at")
->sortable() ->sortable()
->format(function ($value, $row, Column $column) { ->format(function ($value, $row, Column $column) {
if (env('REGISTER_AUTH') !== 'auth') { if (env('REGISTER_AUTH') !== 'auth') {
@ -78,7 +77,7 @@ class UserTable extends DataTableComponent
} }
return ''; return '';
})->html(), })->html(),
Column::make("Blocked", "block") Column::make(__('messages.Status'), "block")
->sortable() ->sortable()
->format(function ($value, $row, Column $column) { ->format(function ($value, $row, Column $column) {
if ($row->role === 'admin' && $row->id === 1) { if ($row->role === 'admin' && $row->id === 1) {
@ -94,7 +93,7 @@ class UserTable extends DataTableComponent
} }
}) })
->html(), ->html(),
Column::make("Created at", "created_at") Column::make(__('messages.Created at'), "created_at")
->sortable() ->sortable()
->format(function ($value) { ->format(function ($value) {
if ($value) { if ($value) {
@ -103,7 +102,7 @@ class UserTable extends DataTableComponent
return ''; return '';
} }
}), }),
Column::make("Last seen", "updated_at") Column::make(__('messages.Last seen'), "updated_at")
->sortable() ->sortable()
->format(function ($value) { ->format(function ($value) {
$now = now(); $now = now();
@ -119,7 +118,7 @@ class UserTable extends DataTableComponent
return $diff->y . ' years ago'; return $diff->y . ' years ago';
} }
}), }),
Column::make('Actions', "id") Column::make(__('messages.Action'), "id")
->format(function ($value, $row, Column $column) { ->format(function ($value, $row, Column $column) {
return view('components.table-components.action', ['user' => $row]); return view('components.table-components.action', ['user' => $row]);
}), }),

View File

@ -19,7 +19,6 @@ $usrhandl = Auth::user()->littlelink_name;
<base href="{{url()->current()}}" /> <base href="{{url()->current()}}" />
@livewireStyles
@include('layouts.analytics') @include('layouts.analytics')
@stack('sidebar-stylesheets') @stack('sidebar-stylesheets')
@include('layouts.notifications') @include('layouts.notifications')
@ -792,7 +791,6 @@ $usrhandl = Auth::user()->littlelink_name;
<script src="{{ asset('assets/js/jquery-block-ui.js') }}"></script> <script src="{{ asset('assets/js/jquery-block-ui.js') }}"></script>
<script src="{{ asset('assets/js/main-dashboard.js') }}"></script> <script src="{{ asset('assets/js/main-dashboard.js') }}"></script>
@livewireScripts
@stack('sidebar-scripts') @stack('sidebar-scripts')
</body> </body>

View File

@ -23,7 +23,6 @@
<section class="text-gray-400"> <section class="text-gray-400">
<h2 class="mb-4 card-header"><i class="bi bi-person"> {{__('messages.Manage Users')}}</i></h2> <h2 class="mb-4 card-header"><i class="bi bi-person"> {{__('messages.Manage Users')}}</i></h2>
<div class="card-body p-0 p-md-3"> <div class="card-body p-0 p-md-3">
{{__('messages.Users:')}}
<livewire:user-table /> <livewire:user-table />
@ -52,8 +51,9 @@
</div> </div>
</div> </div>
@push('sidebar-styles') @push('sidebar-stylesheets')
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="{{url('vendor/livewire/livewire/dist/livewire.js')}}"></script>
@endpush @endpush
@push('sidebar-scripts') @push('sidebar-scripts')