feat: tambah sistem poin anggota (kehadiran +10, artikel +5)
- Model MemberPoint + migration - PostObserver: +5 poin saat artikel dipublish - ActivityObserver: +10 poin saat peserta hadir di kegiatan - MemberPointResource: tampil di grup Organisasi - MemberPointSeeder + update ActivitySeeder dengan pivot status kehadiran - Update PermissionSeeder: anggota bisa lihat poin
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MemberPoints\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class MemberPointsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('user.name')->label('Anggota')->searchable()->sortable(),
|
||||
TextColumn::make('points')->label('Poin')->sortable()
|
||||
->color(fn ($state) => $state > 0 ? 'success' : 'danger'),
|
||||
TextColumn::make('reason')->label('Keterangan')->limit(50),
|
||||
TextColumn::make('source_type')->label('Sumber')->badge()
|
||||
->color(fn ($state) => match ($state) {
|
||||
'activity' => 'info',
|
||||
'post' => 'warning',
|
||||
default => 'gray',
|
||||
}),
|
||||
TextColumn::make('created_at')->label('Tanggal')->date('d M Y')->sortable(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->filters([
|
||||
SelectFilter::make('source_type')->label('Sumber')
|
||||
->options(['activity' => 'Kegiatan', 'post' => 'Artikel']),
|
||||
])
|
||||
->toolbarActions([BulkActionGroup::make([DeleteBulkAction::make()])]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user