refactor: consolidate class session views and introduce dedicated show page for session details
This commit is contained in:
parent
04c9ca5464
commit
bc85424f79
@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources\Learning\ClassSessions\Pages;
|
namespace App\Filament\Resources\Learning\ClassSessions\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Actions\BackAction;
|
||||||
use App\Filament\Actions\Cheerful\CreateAction;
|
use App\Filament\Actions\Cheerful\CreateAction;
|
||||||
use App\Filament\Actions\Cheerful\DeleteAction;
|
use App\Filament\Actions\Cheerful\DeleteAction;
|
||||||
use App\Filament\Actions\Cheerful\EditAction;
|
use App\Filament\Actions\Cheerful\EditAction;
|
||||||
use App\Filament\Resources\Learning\ClassSessions\ClassSessionResource;
|
use App\Filament\Resources\Learning\ClassSessions\ClassSessionResource;
|
||||||
|
use App\Filament\Support\SystemNotification;
|
||||||
use App\Models\ClassSession;
|
use App\Models\ClassSession;
|
||||||
use App\Models\Course;
|
use App\Models\Course;
|
||||||
use Filament\Actions\Action;
|
use Filament\Actions\Action;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\TimePicker;
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
use Filament\Forms\Contracts\HasForms;
|
use Filament\Forms\Contracts\HasForms;
|
||||||
use Filament\Resources\Pages\Page;
|
use Filament\Resources\Pages\Page;
|
||||||
|
use Filament\Schemas\Components\Grid;
|
||||||
use Filament\Support\Enums\Width;
|
use Filament\Support\Enums\Width;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Livewire\Attributes\Computed;
|
use Livewire\Attributes\Computed;
|
||||||
@ -24,7 +30,7 @@ class ListCourseSessions extends Page implements HasActions, HasForms
|
|||||||
|
|
||||||
protected static string $resource = ClassSessionResource::class;
|
protected static string $resource = ClassSessionResource::class;
|
||||||
|
|
||||||
protected string $view = 'filament.resources.learning.class-sessions.index';
|
protected string $view = 'filament.resources.learning.class-sessions.show';
|
||||||
|
|
||||||
public $courseId;
|
public $courseId;
|
||||||
|
|
||||||
@ -43,16 +49,52 @@ public function course(): Course
|
|||||||
public function sessions(): Collection
|
public function sessions(): Collection
|
||||||
{
|
{
|
||||||
return $this->course->classSessions()
|
return $this->course->classSessions()
|
||||||
|
->withCount(['attendances', 'materials', 'assignments'])
|
||||||
->orderBy('session_number', 'asc')
|
->orderBy('session_number', 'asc')
|
||||||
->get()
|
->get()
|
||||||
->map(fn ($session) => (object) [
|
->map(fn ($session) => (object) [
|
||||||
'id' => $session->id,
|
'id' => $session->id,
|
||||||
'session_number' => $session->session_number,
|
'session_number' => $session->session_number,
|
||||||
'date_formatted' => $session->date->format('l, d F Y'),
|
'date_formatted' => $session->date->translatedFormat('l, d F Y'),
|
||||||
'time_range' => $session->start_time->format('H:i').' - '.$session->end_time->format('H:i'),
|
'time_range' => $session->start_time->format('H:i').' - '.$session->end_time->format('H:i'),
|
||||||
|
'attendances_count' => $session->attendances_count,
|
||||||
|
'materials_count' => $session->materials_count,
|
||||||
|
'assignments_count' => $session->assignments_count,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function formSchema(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Grid::make(['default' => 3])
|
||||||
|
->schema([
|
||||||
|
TextInput::make('session_number')
|
||||||
|
->label('Pertemuan Ke-')
|
||||||
|
->numeric()
|
||||||
|
->default(fn () => ($this->course->classSessions()->max('session_number') ?? 0) + 1)
|
||||||
|
->required(),
|
||||||
|
DatePicker::make('date')
|
||||||
|
->label('Tanggal')
|
||||||
|
->default(now())
|
||||||
|
->native(false)
|
||||||
|
->required(),
|
||||||
|
Grid::make(['default' => 2])
|
||||||
|
->schema([
|
||||||
|
TimePicker::make('start_time')
|
||||||
|
->label('Mulai')
|
||||||
|
->native(false)
|
||||||
|
->seconds(false)
|
||||||
|
->required(),
|
||||||
|
TimePicker::make('end_time')
|
||||||
|
->label('Selesai')
|
||||||
|
->native(false)
|
||||||
|
->seconds(false)
|
||||||
|
->required(),
|
||||||
|
])->columnSpan(1),
|
||||||
|
]),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
#[Computed]
|
#[Computed]
|
||||||
public function description(): string
|
public function description(): string
|
||||||
{
|
{
|
||||||
@ -67,11 +109,16 @@ public function getTitle(): string
|
|||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
BackAction::make()
|
||||||
|
->url(ManageClassSessions::getUrl()),
|
||||||
|
|
||||||
|
$this->generateSessionsAction(),
|
||||||
CreateAction::make()
|
CreateAction::make()
|
||||||
->label('Tambah Sesi')
|
->label('Tambah Sesi')
|
||||||
->modalHeading('Tambah Sesi')
|
->modalHeading('Tambah Sesi')
|
||||||
->modalSubmitActionLabel('Simpan')
|
->modalSubmitActionLabel('Simpan')
|
||||||
->modalCancelActionLabel('Batal')
|
->modalCancelActionLabel('Batal')
|
||||||
|
->form($this->formSchema())
|
||||||
->mutateFormDataUsing(function (array $data): array {
|
->mutateFormDataUsing(function (array $data): array {
|
||||||
$data['course_id'] = $this->courseId;
|
$data['course_id'] = $this->courseId;
|
||||||
|
|
||||||
@ -85,10 +132,57 @@ protected function getHeaderActions(): array
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function generateSessionsAction(): Action
|
||||||
|
{
|
||||||
|
return Action::make('generateSessions')
|
||||||
|
->label('Generate Sesi')
|
||||||
|
->icon('heroicon-o-sparkles')
|
||||||
|
->color('warning')
|
||||||
|
->requiresConfirmation()
|
||||||
|
->modalHeading('Generate Sesi Pembelajaran')
|
||||||
|
->modalDescription('Sistem akan men-generate atau memperbarui sesi 1 sampai 16 secara otomatis berdasarkan jadwal mata kuliah ini.')
|
||||||
|
->form([
|
||||||
|
DatePicker::make('start_date')
|
||||||
|
->label('Tanggal Pertemuan Ke-1')
|
||||||
|
->default(now())
|
||||||
|
->required()
|
||||||
|
->native(false),
|
||||||
|
])
|
||||||
|
->action(function (array $data) {
|
||||||
|
$course = $this->course;
|
||||||
|
$schedule = $course->courseSchedules()->first();
|
||||||
|
|
||||||
|
if (! $schedule) {
|
||||||
|
SystemNotification::danger('Batal!', 'Jadwal belum ditentukan untuk mata kuliah ini.')->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$startDate = \Carbon\Carbon::parse($data['start_date']);
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 16; $i++) {
|
||||||
|
ClassSession::updateOrCreate(
|
||||||
|
[
|
||||||
|
'course_id' => $course->id,
|
||||||
|
'session_number' => $i,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'date' => $startDate->copy()->addWeeks($i - 1)->toDateString(),
|
||||||
|
'start_time' => $schedule->start_time,
|
||||||
|
'end_time' => $schedule->end_time,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemNotification::success('Selesai!', '16 Sesi berhasil digenerate/diperbarui.')->send();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function editSessionAction(): Action
|
public function editSessionAction(): Action
|
||||||
{
|
{
|
||||||
return EditAction::make('editSession')
|
return EditAction::make('editSession')
|
||||||
->record(fn (array $arguments) => ClassSession::find($arguments['session']))
|
->record(fn (array $arguments) => ClassSession::find($arguments['session']))
|
||||||
|
->form($this->formSchema())
|
||||||
->modalWidth(Width::TwoExtraLarge);
|
->modalWidth(Width::TwoExtraLarge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ManageClassSessions extends Page implements HasActions, HasForms
|
|||||||
|
|
||||||
protected static ?string $title = 'Sesi Kelas';
|
protected static ?string $title = 'Sesi Kelas';
|
||||||
|
|
||||||
protected string $view = 'filament.pages.learning.class-session.index';
|
protected string $view = 'filament.resources.learning.class-sessions.index';
|
||||||
|
|
||||||
public ?string $search = '';
|
public ?string $search = '';
|
||||||
|
|
||||||
|
|||||||
@ -1,137 +0,0 @@
|
|||||||
<x-filament-panels::page>
|
|
||||||
<!-- Search Section -->
|
|
||||||
<x-filament::section>
|
|
||||||
<div class="flex items-center justify-between gap-4">
|
|
||||||
<div class="w-full max-w-xl">
|
|
||||||
{{ $this->form }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
|
|
||||||
<!-- Today's Sessions Section -->
|
|
||||||
@if ($this->todaySessions->isNotEmpty())
|
|
||||||
<x-filament::section icon="heroicon-o-bolt" icon-color="primary">
|
|
||||||
<x-slot name="heading">
|
|
||||||
Sesi Hari Ini
|
|
||||||
</x-slot>
|
|
||||||
<x-slot name="description">
|
|
||||||
Sesi yang dijadwalkan pada {{ $this->today_date }}
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
<div class="space-y-4">
|
|
||||||
@foreach ($this->todaySessions as $session)
|
|
||||||
@if ($session->is_pending)
|
|
||||||
<div class="{{ $session->card_classes }}">
|
|
||||||
@else
|
|
||||||
<a href="{{ $session->url }}" class="{{ $session->card_classes }}">
|
|
||||||
@endif
|
|
||||||
<div class="flex flex-1 items-start gap-4 p-5">
|
|
||||||
<div class="{{ $session->session_badge_classes }}">
|
|
||||||
<span class="text-[9px] uppercase leading-none opacity-60 mb-0.5 font-bold">Sesi</span>
|
|
||||||
<span class="text-xl leading-none italic">#{{ $session->session_number }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex-1 min-w-0">
|
|
||||||
<div class="flex items-start justify-between gap-3 flex-wrap">
|
|
||||||
<div>
|
|
||||||
<h3 class="{{ $session->title_classes }}">
|
|
||||||
{{ $session->course_name }}
|
|
||||||
</h3>
|
|
||||||
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5 font-medium">
|
|
||||||
{{ $session->course_code }} • {{ $session->lecturer }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="{{ $session->status_badge_classes }}">
|
|
||||||
<x-heroicon-s-clock class="w-3.5 h-3.5" />
|
|
||||||
{{ $session->time_range }}
|
|
||||||
</div>
|
|
||||||
@if ($session->is_pending)
|
|
||||||
<div
|
|
||||||
class="mt-2 flex items-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500 font-medium italic">
|
|
||||||
<x-heroicon-m-calendar-days class="w-3.5 h-3.5" />
|
|
||||||
Sesuai Jadwal Hari Ini
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="{{ $session->attendance_section_classes }}">
|
|
||||||
@if ($session->is_pending)
|
|
||||||
<div class="flex items-center gap-2 text-gray-400 dark:text-gray-500 p-2 opacity-50">
|
|
||||||
<x-heroicon-m-clock class="w-5 h-5" />
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<div class="flex flex-col items-center justify-center min-w-[60px] p-2">
|
|
||||||
<span class="text-lg font-bold text-primary-600 dark:text-primary-400 leading-none">
|
|
||||||
{{ $session->attendances_count }}
|
|
||||||
</span>
|
|
||||||
<span class="text-[9px] uppercase font-bold text-gray-500 mt-1 leading-none tracking-wider">
|
|
||||||
Hadir
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if ($session->is_pending)
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
</x-filament::section>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<!-- All Courses Section -->
|
|
||||||
<x-filament::section icon="heroicon-o-academic-cap" icon-color="gray">
|
|
||||||
<x-slot name="heading">
|
|
||||||
Daftar Mata Kuliah Semester Ini
|
|
||||||
</x-slot>
|
|
||||||
<x-slot name="description">
|
|
||||||
Pilih mata kuliah untuk melihat dan mengelola semua riwayat sesi.
|
|
||||||
</x-slot>
|
|
||||||
|
|
||||||
@if ($this->courses->isNotEmpty())
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
||||||
@foreach ($this->courses as $course)
|
|
||||||
<a href="{{ $course->url }}"
|
|
||||||
class="fi-card rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm overflow-hidden transition hover:shadow-md h-fit block group">
|
|
||||||
|
|
||||||
<div class="p-5 space-y-4">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<span
|
|
||||||
class="inline-flex items-center rounded-md bg-primary-50 dark:bg-primary-500/10 px-2 py-1 text-xs font-semibold text-primary-700 dark:text-primary-300 ring-1 ring-inset ring-primary-600/20">
|
|
||||||
{{ $course->code }}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-2 text-gray-400 dark:text-gray-500">
|
|
||||||
<span class="text-xs font-medium">
|
|
||||||
{{ $course->sessions_count }} Sesi
|
|
||||||
</span>
|
|
||||||
<x-heroicon-m-chevron-right
|
|
||||||
class="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-1">
|
|
||||||
<h3
|
|
||||||
class="text-base font-bold text-gray-950 dark:text-white leading-tight group-hover:text-primary-600 dark:group-hover:text-primary-400 transition">
|
|
||||||
{{ $course->name }}
|
|
||||||
</h3>
|
|
||||||
<div class="flex items-center text-sm text-gray-500 dark:text-gray-400">
|
|
||||||
<x-heroicon-m-user class="w-4 h-4 mr-1.5 opacity-70" />
|
|
||||||
<span class="truncate">{{ $course->lecturer }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
|
||||||
@else
|
|
||||||
<x-filament::empty-state icon="heroicon-o-presentation-chart-bar" heading="Tidak ada data yang ditemukan"
|
|
||||||
description="Setelah Anda membuat data pertama, maka akan muncul disini." iconColor="gray">
|
|
||||||
</x-filament::empty-state>
|
|
||||||
@endif
|
|
||||||
</x-filament::section>
|
|
||||||
</x-filament-panels::page>
|
|
||||||
@ -1,54 +1,134 @@
|
|||||||
<x-filament-panels::page>
|
<x-filament-panels::page>
|
||||||
<div class="flex items-center gap-4 mb-6">
|
<!-- Search Section -->
|
||||||
<a href="{{ \App\Filament\Resources\Learning\ClassSessions\ClassSessionResource::getUrl('index') }}"
|
|
||||||
class="fi-btn fi-btn-size-md relative grid-flow-col items-center justify-center font-semibold outline-none transition duration-75 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-70 fi-btn-color-gray fi-color-gray bg-white dark:bg-white/5 text-gray-950 dark:text-white shadow-sm ring-1 ring-gray-950/10 dark:ring-white/20 hover:bg-gray-50 dark:hover:bg-white/10 fi-btn-icon-start gap-1 p-2 rounded-lg">
|
|
||||||
<x-heroicon-m-arrow-left class="w-5 h-5 text-gray-500" />
|
|
||||||
</a>
|
|
||||||
<div class="space-y-1">
|
|
||||||
<h1 class="text-2xl font-bold tracking-tight text-gray-950 dark:text-white sm:text-3xl">
|
|
||||||
{{ $this->getTitle() }}
|
|
||||||
</h1>
|
|
||||||
<p class="text-sm font-medium text-gray-500 dark:text-gray-400">
|
|
||||||
{{ $this->description }}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<x-filament::section>
|
<x-filament::section>
|
||||||
@if ($this->sessions->isNotEmpty())
|
<div class="flex items-center justify-between gap-4">
|
||||||
|
<div class="w-full max-w-xl">
|
||||||
|
{{ $this->form }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
|
||||||
|
<!-- Today's Sessions Section -->
|
||||||
|
@if ($this->todaySessions->isNotEmpty())
|
||||||
|
<x-filament::section icon="heroicon-o-bolt" icon-color="primary">
|
||||||
|
<x-slot name="heading">
|
||||||
|
Sesi Hari Ini
|
||||||
|
</x-slot>
|
||||||
|
<x-slot name="description">
|
||||||
|
Sesi yang dijadwalkan pada {{ $this->today_date }}
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
@foreach ($this->sessions as $session)
|
@foreach ($this->todaySessions as $session)
|
||||||
<div
|
@if ($session->is_pending)
|
||||||
class="fi-card p-5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm flex items-center justify-between hover:shadow-md transition">
|
<div class="{{ $session->card_classes }}">
|
||||||
<div class="flex items-start gap-4">
|
@else
|
||||||
<div
|
<a href="{{ $session->url }}" class="{{ $session->card_classes }}">
|
||||||
class="flex flex-col items-center justify-center w-12 h-12 rounded-lg bg-primary-100 dark:bg-primary-500/10 text-primary-700 dark:text-primary-300 font-bold border border-primary-200 dark:border-primary-500/20">
|
@endif
|
||||||
<span class="text-[10px] uppercase leading-none opacity-60 mb-0.5 mt-1">Sesi</span>
|
<div class="flex flex-1 items-start gap-4 p-5">
|
||||||
<span class="text-xl leading-none mb-1">#{{ $session->session_number }}</span>
|
<div class="{{ $session->session_badge_classes }}">
|
||||||
|
<span class="text-[9px] uppercase leading-none opacity-60 mb-0.5 font-bold">Sesi</span>
|
||||||
|
<span class="text-sm font-bold italic">Ke-{{ $session->session_number }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-1">
|
|
||||||
<div
|
<div class="flex-1 min-w-0">
|
||||||
class="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-gray-500 dark:text-gray-400">
|
<div class="flex items-start justify-between gap-3 flex-wrap">
|
||||||
<div class="flex items-center gap-1.5 font-bold text-gray-900 dark:text-white">
|
<div>
|
||||||
<x-heroicon-o-calendar class="w-4 h-4 text-primary-500" />
|
<h3 class="{{ $session->title_classes }}">
|
||||||
{{ $session->date_formatted }}
|
{{ $session->course_name }}
|
||||||
|
</h3>
|
||||||
|
<p class="text-sm text-gray-500 dark:text-gray-400 mt-0.5 font-medium">
|
||||||
|
{{ $session->course_code }} • {{ $session->lecturer }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1.5 font-medium">
|
<div class="{{ $session->status_badge_classes }}">
|
||||||
<x-heroicon-o-clock class="w-4 h-4 text-primary-500" />
|
<x-heroicon-s-clock class="w-3.5 h-3.5" />
|
||||||
{{ $session->time_range }}
|
{{ $session->time_range }}
|
||||||
</div>
|
</div>
|
||||||
|
@if ($session->is_pending)
|
||||||
|
<div
|
||||||
|
class="mt-2 flex items-center gap-1.5 text-[10px] text-gray-400 dark:text-gray-500 font-medium italic">
|
||||||
|
<x-heroicon-m-calendar-days class="w-3.5 h-3.5" />
|
||||||
|
Sesuai Jadwal Hari Ini
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="{{ $session->attendance_section_classes }}">
|
||||||
|
@if ($session->is_pending)
|
||||||
|
<div class="flex items-center gap-2 text-gray-400 dark:text-gray-500 p-2 opacity-50">
|
||||||
|
<x-heroicon-m-clock class="w-5 h-5" />
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="flex flex-col items-center justify-center min-w-[60px] p-2">
|
||||||
|
<span class="text-lg font-bold text-primary-600 dark:text-primary-400 leading-none">
|
||||||
|
{{ $session->attendances_count }}
|
||||||
|
</span>
|
||||||
|
<span class="text-[9px] uppercase font-bold text-gray-500 mt-1 leading-none tracking-wider">
|
||||||
|
Hadir
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if ($session->is_pending)
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</x-filament::section>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- All Courses Section -->
|
||||||
|
<x-filament::section icon="heroicon-o-academic-cap" icon-color="gray">
|
||||||
|
<x-slot name="heading">
|
||||||
|
Daftar Mata Kuliah Semester Ini
|
||||||
|
</x-slot>
|
||||||
|
<x-slot name="description">
|
||||||
|
Pilih mata kuliah untuk melihat dan mengelola semua riwayat sesi.
|
||||||
|
</x-slot>
|
||||||
|
|
||||||
|
@if ($this->courses->isNotEmpty())
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
@foreach ($this->courses as $course)
|
||||||
|
<a href="{{ $course->url }}"
|
||||||
|
class="fi-card rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm overflow-hidden transition hover:shadow-md h-fit block group">
|
||||||
|
|
||||||
|
<div class="p-5 space-y-4">
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center rounded-md bg-primary-50 dark:bg-primary-500/10 px-2 py-1 text-xs font-semibold text-primary-700 dark:text-primary-300 ring-1 ring-inset ring-primary-600/20">
|
||||||
|
{{ $course->code }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-2 text-gray-400 dark:text-gray-500">
|
||||||
|
<span class="text-xs font-medium">
|
||||||
|
{{ $course->sessions_count }} Sesi
|
||||||
|
</span>
|
||||||
|
<x-heroicon-m-chevron-right
|
||||||
|
class="w-4 h-4 transition-transform duration-300 group-hover:translate-x-1" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-1">
|
||||||
|
<h3
|
||||||
|
class="text-base font-bold text-gray-950 dark:text-white leading-tight group-hover:text-primary-600 dark:group-hover:text-primary-400 transition">
|
||||||
|
{{ $course->name }}
|
||||||
|
</h3>
|
||||||
|
<div class="flex items-center text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
<x-heroicon-m-user class="w-4 h-4 mr-1.5 opacity-70" />
|
||||||
|
<span class="truncate">{{ $course->lecturer }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
<div class="flex items-center gap-1">
|
|
||||||
{{ ($this->editSessionAction)(['session' => $session->id]) }}
|
|
||||||
{{ ($this->deleteSessionAction)(['session' => $session->id]) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<x-filament::empty-state icon="heroicon-o-presentation-chart-bar" heading="Tidak ada data yang ditemukan"
|
<x-filament::empty-state icon="heroicon-o-presentation-chart-bar" heading="Tidak ada data yang ditemukan"
|
||||||
description="Setelah Anda membuat data pertama, maka akan muncul disini." iconColor="gray">
|
description="Setelah Anda membuat data pertama, maka akan muncul disini." iconColor="gray">
|
||||||
</x-filament::empty-state>
|
</x-filament::empty-state>
|
||||||
|
|||||||
@ -0,0 +1,55 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
<x-filament::section>
|
||||||
|
@if ($this->sessions->isNotEmpty())
|
||||||
|
<div class="space-y-4">
|
||||||
|
@foreach ($this->sessions as $session)
|
||||||
|
<div
|
||||||
|
class="fi-card p-5 rounded-xl border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm flex items-center justify-between hover:shadow-md transition">
|
||||||
|
<div class="flex items-start gap-4">
|
||||||
|
<div
|
||||||
|
class="flex flex-col items-center justify-center w-12 h-12 rounded-lg bg-primary-100 dark:bg-primary-500/10 text-primary-700 dark:text-primary-300 font-bold border border-primary-200 dark:border-primary-500/20">
|
||||||
|
<span class="text-[10px] uppercase leading-none opacity-60 mb-0.5 mt-1">Sesi</span>
|
||||||
|
<span class="text-sm leading-none mb-1 text-primary-600 dark:text-primary-400 font-bold">Ke-{{ $session->session_number }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-1">
|
||||||
|
<div
|
||||||
|
class="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-gray-500 dark:text-gray-400">
|
||||||
|
<div class="flex items-center gap-1.5 font-bold text-gray-900 dark:text-white">
|
||||||
|
<x-heroicon-o-calendar class="w-4 h-4 text-primary-500" />
|
||||||
|
{{ $session->date_formatted }}
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-1.5 font-medium">
|
||||||
|
<x-heroicon-o-clock class="w-4 h-4 text-primary-500" />
|
||||||
|
{{ $session->time_range }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="flex items-center gap-1.5 font-bold text-success-600 dark:text-success-400">
|
||||||
|
<x-heroicon-o-user-group class="w-4 h-4" />
|
||||||
|
{{ $session->attendances_count }} Presensi
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-1.5 font-bold text-amber-600 dark:text-amber-400">
|
||||||
|
<x-heroicon-o-document-text class="w-4 h-4" />
|
||||||
|
{{ $session->materials_count }} Materi
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-1.5 font-bold text-info-600 dark:text-info-400">
|
||||||
|
<x-heroicon-o-clipboard-document-list class="w-4 h-4" />
|
||||||
|
{{ $session->assignments_count }} Tugas
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex items-center gap-1">
|
||||||
|
{{ ($this->editSessionAction)(['session' => $session->id]) }}
|
||||||
|
{{ ($this->deleteSessionAction)(['session' => $session->id]) }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<x-filament::empty-state icon="heroicon-o-presentation-chart-bar" heading="Tidak ada data yang ditemukan"
|
||||||
|
description="Setelah Anda membuat data pertama, maka akan muncul disini." iconColor="gray">
|
||||||
|
</x-filament::empty-state>
|
||||||
|
@endif
|
||||||
|
</x-filament::section>
|
||||||
|
</x-filament-panels::page>
|
||||||
Loading…
Reference in New Issue
Block a user