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

View File

@ -19,7 +19,6 @@ $usrhandl = Auth::user()->littlelink_name;
<base href="{{url()->current()}}" />
@livewireStyles
@include('layouts.analytics')
@stack('sidebar-stylesheets')
@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/main-dashboard.js') }}"></script>
@livewireScripts
@stack('sidebar-scripts')
</body>

View File

@ -23,7 +23,6 @@
<section class="text-gray-400">
<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">
{{__('messages.Users:')}}
<livewire:user-table />
@ -52,8 +51,9 @@
</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 src="{{url('vendor/livewire/livewire/dist/livewire.js')}}"></script>
@endpush
@push('sidebar-scripts')