dashboard done
This commit is contained in:
parent
f0df7e3f2d
commit
fae905acd6
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
|
class Dashboard extends \Filament\Pages\Dashboard
|
||||||
|
{
|
||||||
|
protected static ?string $title = 'Beranda';
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PengumumanResource\Pages;
|
||||||
|
use App\Models\Parameter;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Columns\ViewColumn;
|
||||||
|
|
||||||
|
class PengumumanResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Parameter::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
protected static ?string $navigationGroup = 'Penilaian';
|
||||||
|
protected static ?string $navigationLabel = 'Pengumuman';
|
||||||
|
protected static ?int $navigationSort = 3;
|
||||||
|
protected static ?string $slug = 'pengumuman';
|
||||||
|
|
||||||
|
protected static ?string $modelLabel = 'Pengumuman';
|
||||||
|
protected static ?string $pluralModelLabel = 'Pengumuman';
|
||||||
|
protected static ?string $breadcrumb = 'Pengumuman';
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('mahasiswa.nama')
|
||||||
|
->label('Nama Mahasiswa')
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
|
||||||
|
TextColumn::make('status')
|
||||||
|
->label('Status Berkas')
|
||||||
|
->badge()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
'valid' => 'success',
|
||||||
|
'tidak_valid' => 'danger',
|
||||||
|
'belum_validasi' => 'warning',
|
||||||
|
default => 'gray',
|
||||||
|
}),
|
||||||
|
|
||||||
|
TextColumn::make('hasil')
|
||||||
|
->label('Hasil Seleksi')
|
||||||
|
->badge()
|
||||||
|
->color(fn (string $state): string => match ($state) {
|
||||||
|
'Layak' => 'success',
|
||||||
|
'Dipertimbangkan' => 'warning',
|
||||||
|
'Tidak Layak' => 'danger',
|
||||||
|
default => 'gray',
|
||||||
|
}),
|
||||||
|
|
||||||
|
ViewColumn::make('keterangan')
|
||||||
|
->label('Keterangan')
|
||||||
|
->view('filament.tables.columns.keterangan-pengumuman'),
|
||||||
|
])
|
||||||
|
->defaultSort('total_nilai', 'desc');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListPengumuman::route('/'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\PengumumanResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\PengumumanResource;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListPengumuman extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = PengumumanResource::class;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use Filament\Widgets\AccountWidget as BaseWidget;
|
||||||
|
|
||||||
|
class CustomAccountWidget extends BaseWidget
|
||||||
|
{
|
||||||
|
protected int | string | array $columnSpan = 'full';
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Filament\Resources\SubKriteriaResource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Filament\Widgets\TableWidget as BaseWidget;
|
||||||
|
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
|
||||||
|
class DataMaster extends BaseWidget
|
||||||
|
{
|
||||||
|
protected static ?int $sort = 5;
|
||||||
|
protected static ?string $maxHeight = null;
|
||||||
|
protected int | string | array $columnSpan = 'full';
|
||||||
|
protected static bool $isLazy = false;
|
||||||
|
|
||||||
|
public function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->query(SubKriteriaResource::getEloquentQuery())
|
||||||
|
->defaultPaginationPageOption(5)
|
||||||
|
->columns([
|
||||||
|
TextColumn::make('kriteria.nama')
|
||||||
|
->label('Kriteria')
|
||||||
|
->sortable()
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('nama')
|
||||||
|
->label('Sub Kriteria')
|
||||||
|
->sortable()
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('deskripsi')
|
||||||
|
->sortable()
|
||||||
|
->searchable(),
|
||||||
|
TextColumn::make('prioritas')
|
||||||
|
->label('Prioritas')
|
||||||
|
->sortable(),
|
||||||
|
TextColumn::make('bobot')
|
||||||
|
->label('Bobot')
|
||||||
|
->formatStateUsing(fn ($state) => number_format($state, 4))
|
||||||
|
->sortable(),
|
||||||
|
])
|
||||||
|
->contentGrid([
|
||||||
|
'md' => 2,
|
||||||
|
'lg' => 3,
|
||||||
|
'xl' => 4,
|
||||||
|
])
|
||||||
|
->striped();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function canView(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Widgets;
|
||||||
|
|
||||||
|
use App\Models\Kriteria;
|
||||||
|
use App\Models\Mahasiswa;
|
||||||
|
use App\Models\SubKriteria;
|
||||||
|
use App\Models\parameter;
|
||||||
|
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||||
|
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||||
|
|
||||||
|
class TestWidget extends BaseWidget
|
||||||
|
{
|
||||||
|
protected function getStats(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Stat::make('Kriteria', Kriteria::count()),
|
||||||
|
Stat::make('SubKriteria', Subkriteria::count()),
|
||||||
|
Stat::make('Jumlah Pendaftar', Mahasiswa::count())
|
||||||
|
->description('Total Mahasiswa yang telah mendaftar')
|
||||||
|
->color('info')
|
||||||
|
->chart(Mahasiswa::selectRaw('DATE(created_at) as date, COUNT(*) as total')
|
||||||
|
->groupBy('date')
|
||||||
|
->orderBy('date')
|
||||||
|
->pluck('total')
|
||||||
|
->toArray()),
|
||||||
|
Stat::make('Validasi Data', Parameter::whereIn('status', ['valid', 'tidak_valid'])->count() . '/' . Parameter::count())
|
||||||
|
->description('Total data yang telah divalidasi')
|
||||||
|
// ->descriptionIcon('heroicon-m-check-circle')
|
||||||
|
->color('info')
|
||||||
|
->chart(Parameter::selectRaw('DATE(created_at) as date, COUNT(*) as total')
|
||||||
|
->whereIn('status', ['valid', 'tidak_valid'])
|
||||||
|
->groupBy('date')
|
||||||
|
->orderBy('date')
|
||||||
|
->pluck('total')
|
||||||
|
->toArray()),
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Parameter;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PengumumanController extends Controller
|
||||||
|
{
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$pengumuman = Parameter::where('mahasiswa_id', auth()->user()->mahasiswa->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return view('pengumuman', compact('pengumuman'));
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,6 +18,7 @@
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||||
use App\Filament\Pages\WizardForm;
|
use App\Filament\Pages\WizardForm;
|
||||||
|
use App\Filament\Widgets\CustomAccountWidget;
|
||||||
|
|
||||||
class AdminPanelProvider extends PanelProvider
|
class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
|
@ -34,13 +35,13 @@ public function panel(Panel $panel): Panel
|
||||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||||
->pages([
|
->pages([
|
||||||
Pages\Dashboard::class,
|
// Pages\Dashboard::class,
|
||||||
WizardForm::class,
|
WizardForm::class,
|
||||||
])
|
])
|
||||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||||
->widgets([
|
->widgets([
|
||||||
Widgets\AccountWidget::class,
|
CustomAccountWidget::class,
|
||||||
Widgets\FilamentInfoWidget::class,
|
// Widgets\FilamentInfoWidget::class,
|
||||||
])
|
])
|
||||||
->spa()
|
->spa()
|
||||||
->middleware([
|
->middleware([
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
@php
|
||||||
|
$record = $getRecord();
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if($record->status === 'tidak_valid')
|
||||||
|
<div class="text-danger-600">
|
||||||
|
Mohon maaf, berkas Anda dinyatakan tidak valid.
|
||||||
|
@if($record->alasan_tidak_valid)
|
||||||
|
<br>
|
||||||
|
<small>Alasan: {{ $record->alasan_tidak_valid }}</small>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@elseif($record->status === 'valid')
|
||||||
|
@if($record->hasil === 'Layak')
|
||||||
|
<div class="text-success-600">
|
||||||
|
Selamat! Anda dinyatakan LULUS seleksi dan berhak menerima KIP-K.
|
||||||
|
</div>
|
||||||
|
@elseif($record->hasil === 'Dipertimbangkan')
|
||||||
|
<div class="text-warning-600">
|
||||||
|
Anda masuk dalam daftar pertimbangan. Mohon tunggu pengumuman selanjutnya.
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="text-danger-600">
|
||||||
|
Mohon maaf, Anda dinyatakan TIDAK LULUS seleksi KIP-K.
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
<div class="text-gray-500">
|
||||||
|
Berkas Anda masih dalam proses validasi.
|
||||||
|
</div>
|
||||||
|
@endif
|
|
@ -0,0 +1,60 @@
|
||||||
|
<x-app-layout>
|
||||||
|
<div class="py-12">
|
||||||
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
|
||||||
|
<div class="bg-white overflow-hidden shadow-xl sm:rounded-lg p-6">
|
||||||
|
<h2 class="text-2xl font-bold mb-4">Hasil Pengumuman KIP-K</h2>
|
||||||
|
|
||||||
|
@if($pengumuman)
|
||||||
|
<div class="mb-4">
|
||||||
|
<h3 class="font-semibold">Status Berkas:</h3>
|
||||||
|
<div class="mt-2">
|
||||||
|
@if($pengumuman->status === 'valid')
|
||||||
|
<span class="px-2 py-1 bg-green-100 text-green-800 rounded">Valid</span>
|
||||||
|
@elseif($pengumuman->status === 'tidak_valid')
|
||||||
|
<span class="px-2 py-1 bg-red-100 text-red-800 rounded">Tidak Valid</span>
|
||||||
|
@else
|
||||||
|
<span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded">Dalam Proses Validasi</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($pengumuman->status === 'tidak_valid')
|
||||||
|
<div class="mt-4 p-4 bg-red-50 text-red-700 rounded">
|
||||||
|
<p class="font-semibold">Mohon maaf, berkas Anda dinyatakan tidak valid.</p>
|
||||||
|
@if($pengumuman->alasan_tidak_valid)
|
||||||
|
<p class="mt-2">Alasan: {{ $pengumuman->alasan_tidak_valid }}</p>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@elseif($pengumuman->status === 'valid')
|
||||||
|
<div class="mt-4">
|
||||||
|
<h3 class="font-semibold">Hasil Seleksi:</h3>
|
||||||
|
<div class="mt-4">
|
||||||
|
@if($pengumuman->hasil === 'Layak')
|
||||||
|
<div class="p-4 bg-green-50 text-green-700 rounded">
|
||||||
|
<p class="font-semibold">Selamat! Anda dinyatakan LULUS seleksi dan berhak menerima KIP-K.</p>
|
||||||
|
</div>
|
||||||
|
@elseif($pengumuman->hasil === 'Dipertimbangkan')
|
||||||
|
<div class="p-4 bg-yellow-50 text-yellow-700 rounded">
|
||||||
|
<p class="font-semibold">Anda masuk dalam daftar pertimbangan. Mohon tunggu pengumuman selanjutnya.</p>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="p-4 bg-red-50 text-red-700 rounded">
|
||||||
|
<p class="font-semibold">Mohon maaf, Anda dinyatakan TIDAK LULUS seleksi KIP-K.</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="mt-4 p-4 bg-gray-50 text-gray-700 rounded">
|
||||||
|
<p>Berkas Anda masih dalam proses validasi. Silakan cek kembali nanti.</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@else
|
||||||
|
<div class="p-4 bg-yellow-50 text-yellow-700 rounded">
|
||||||
|
<p>Anda belum mengajukan pendaftaran KIP-K.</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-app-layout>
|
|
@ -3,6 +3,7 @@
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use App\Http\Controllers\PdfViewController;
|
use App\Http\Controllers\PdfViewController;
|
||||||
|
use App\Http\Controllers\PengumumanController;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
|
@ -23,3 +24,7 @@
|
||||||
'Content-Disposition' => 'inline; filename="' . basename($path) . '"'
|
'Content-Disposition' => 'inline; filename="' . basename($path) . '"'
|
||||||
]);
|
]);
|
||||||
})->where('path', '.*');
|
})->where('path', '.*');
|
||||||
|
|
||||||
|
Route::middleware(['auth'])->group(function () {
|
||||||
|
Route::get('/pengumuman', [PengumumanController::class, 'show'])->name('pengumuman');
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue