feat: program management
- ProgramController: full CRUD, publish, close, delete (guarded if attendance exists) - StoreProgramRequest + UpdateProgramRequest with Malay attribute names - AuditLogService: logs admin actions, redacts sensitive fields (no_kp, token, password) - Program index: search, status filter, pagination (Bootstrap 5) - Program create/edit: shared _form partial with all fields (dates, sessions, walk-in toggle) - Program show: tab layout (participants, qr, template, questionnaire, statistics) - Bootstrap 5 pagination via Paginator::useBootstrapFive() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,63 +3,135 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Admin\StoreProgramRequest;
|
||||||
|
use App\Http\Requests\Admin\UpdateProgramRequest;
|
||||||
|
use App\Models\Program;
|
||||||
|
use App\Services\AuditLogService;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class ProgramController extends Controller
|
class ProgramController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
public function index(Request $request): View
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
{
|
||||||
//
|
$query = Program::with('creator')
|
||||||
|
->withCount(['attendances', 'programParticipants'])
|
||||||
|
->latest();
|
||||||
|
|
||||||
|
if ($request->filled('search')) {
|
||||||
|
$query->where(function ($q) use ($request) {
|
||||||
|
$q->where('title', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('organizer', 'like', '%' . $request->search . '%')
|
||||||
|
->orWhere('location', 'like', '%' . $request->search . '%');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if ($request->filled('status')) {
|
||||||
* Show the form for creating a new resource.
|
$query->where('status', $request->status);
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
$programs = $query->paginate(15)->withQueryString();
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
return view('admin.programs.index', compact('programs'));
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function create(): View
|
||||||
* Display the specified resource.
|
|
||||||
*/
|
|
||||||
public function show(string $id)
|
|
||||||
{
|
{
|
||||||
//
|
return view('admin.programs.create');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function store(StoreProgramRequest $request): RedirectResponse
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit(string $id)
|
|
||||||
{
|
{
|
||||||
//
|
$program = Program::create([
|
||||||
|
...$request->validated(),
|
||||||
|
'created_by' => auth()->id(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
AuditLogService::log('program.created', $program);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.programs.show', $program)
|
||||||
|
->with('success', 'Program "' . $program->title . '" berjaya ditambah.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function show(Program $program): View
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request, string $id)
|
|
||||||
{
|
{
|
||||||
//
|
$program->load([
|
||||||
|
'qrCode',
|
||||||
|
'certificateTemplate',
|
||||||
|
'questionnaire.questionnaireSet.questions',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$stats = [
|
||||||
|
'total_participants' => $program->programParticipants()->count(),
|
||||||
|
'pre_registered' => $program->programParticipants()->where('is_pre_registered', true)->count(),
|
||||||
|
'walk_in' => $program->programParticipants()->where('registration_source', 'walk_in')->count(),
|
||||||
|
'total_attendances' => $program->attendances()->count(),
|
||||||
|
'total_certificates' => $program->certificates()->count(),
|
||||||
|
'generated_certificates'=> $program->certificates()->whereIn('status', ['generated', 'emailed', 'downloaded'])->count(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return view('admin.programs.show', compact('program', 'stats'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function edit(Program $program): View
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy(string $id)
|
|
||||||
{
|
{
|
||||||
//
|
return view('admin.programs.edit', compact('program'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(UpdateProgramRequest $request, Program $program): RedirectResponse
|
||||||
|
{
|
||||||
|
$old = $program->only([
|
||||||
|
'title', 'status', 'checkin_start_at', 'checkin_end_at',
|
||||||
|
'ecert_download_start_at', 'ecert_download_end_at',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$program->update($request->validated());
|
||||||
|
|
||||||
|
AuditLogService::log('program.updated', $program, $old);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.programs.show', $program)
|
||||||
|
->with('success', 'Maklumat program berjaya dikemas kini.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Program $program): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($program->attendances()->exists()) {
|
||||||
|
return back()->with('error', 'Program tidak boleh dipadam kerana sudah ada rekod kehadiran.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $program->title;
|
||||||
|
AuditLogService::log('program.deleted', $program);
|
||||||
|
$program->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.programs.index')
|
||||||
|
->with('success', 'Program "' . $title . '" berjaya dipadam.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function publish(Program $program): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($program->status !== 'draft') {
|
||||||
|
return back()->with('error', 'Hanya program berstatus Draf boleh diterbitkan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$program->update(['status' => 'published']);
|
||||||
|
AuditLogService::log('program.published', $program);
|
||||||
|
|
||||||
|
return back()->with('success', 'Program berjaya diterbitkan.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function close(Program $program): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($program->status !== 'published') {
|
||||||
|
return back()->with('error', 'Hanya program berstatus Diterbitkan boleh ditutup.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$program->update(['status' => 'closed']);
|
||||||
|
AuditLogService::log('program.closed', $program);
|
||||||
|
|
||||||
|
return back()->with('success', 'Program berjaya ditutup.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
56
app/Http/Requests/Admin/StoreProgramRequest.php
Normal file
56
app/Http/Requests/Admin/StoreProgramRequest.php
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
|
class StoreProgramRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return auth()->check();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => ['required', 'string', 'max:255'],
|
||||||
|
'description' => ['nullable', 'string', 'max:5000'],
|
||||||
|
'organizer' => ['required', 'string', 'max:255'],
|
||||||
|
'location' => ['required', 'string', 'max:500'],
|
||||||
|
'start_date' => ['required', 'date'],
|
||||||
|
'end_date' => ['required', 'date', 'gte:start_date'],
|
||||||
|
'checkin_start_at' => ['nullable', 'date'],
|
||||||
|
'checkin_end_at' => ['nullable', 'date', 'after_or_equal:checkin_start_at'],
|
||||||
|
'ecert_download_start_at' => ['nullable', 'date'],
|
||||||
|
'ecert_download_end_at' => ['nullable', 'date', 'after_or_equal:ecert_download_start_at'],
|
||||||
|
'allow_walk_in' => ['boolean'],
|
||||||
|
'default_staff_session' => ['nullable', 'in:pagi,petang,full_day'],
|
||||||
|
'default_external_session' => ['nullable', 'in:pagi,petang,full_day'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function attributes(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => 'nama program',
|
||||||
|
'organizer' => 'penganjur',
|
||||||
|
'location' => 'lokasi',
|
||||||
|
'start_date' => 'tarikh mula',
|
||||||
|
'end_date' => 'tarikh tamat',
|
||||||
|
'checkin_start_at' => 'masa mula check-in',
|
||||||
|
'checkin_end_at' => 'masa tamat check-in',
|
||||||
|
'ecert_download_start_at' => 'masa mula download sijil',
|
||||||
|
'ecert_download_end_at' => 'masa tamat download sijil',
|
||||||
|
'default_staff_session' => 'sesi default kakitangan',
|
||||||
|
'default_external_session' => 'sesi default peserta luar',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function prepareForValidation(): void
|
||||||
|
{
|
||||||
|
$this->merge([
|
||||||
|
'allow_walk_in' => $this->boolean('allow_walk_in'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
app/Http/Requests/Admin/UpdateProgramRequest.php
Normal file
9
app/Http/Requests/Admin/UpdateProgramRequest.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Admin;
|
||||||
|
|
||||||
|
class UpdateProgramRequest extends StoreProgramRequest
|
||||||
|
{
|
||||||
|
// Inherits all rules from StoreProgramRequest.
|
||||||
|
// Status changes handled via dedicated publish/close actions, not here.
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Pagination\Paginator;
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
use Illuminate\Support\Facades\URL;
|
use Illuminate\Support\Facades\URL;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
@@ -14,6 +15,9 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
|
// Bootstrap pagination
|
||||||
|
Paginator::useBootstrapFive();
|
||||||
|
|
||||||
// Rate limiters for public routes
|
// Rate limiters for public routes
|
||||||
RateLimiter::for('checkin', fn(Request $request) =>
|
RateLimiter::for('checkin', fn(Request $request) =>
|
||||||
Limit::perMinute(60)->by($request->ip())
|
Limit::perMinute(60)->by($request->ip())
|
||||||
|
|||||||
39
app/Services/AuditLogService.php
Normal file
39
app/Services/AuditLogService.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Models\AuditLog;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class AuditLogService
|
||||||
|
{
|
||||||
|
public static function log(
|
||||||
|
string $action,
|
||||||
|
?Model $model = null,
|
||||||
|
array $oldValues = [],
|
||||||
|
array $newValues = []
|
||||||
|
): void {
|
||||||
|
try {
|
||||||
|
AuditLog::create([
|
||||||
|
'user_id' => auth()->id(),
|
||||||
|
'action' => $action,
|
||||||
|
'auditable_type' => $model ? get_class($model) : null,
|
||||||
|
'auditable_id' => $model?->getKey(),
|
||||||
|
'old_values' => self::redact($oldValues),
|
||||||
|
'new_values' => self::redact($newValues),
|
||||||
|
'ip_address' => request()->ip(),
|
||||||
|
'user_agent' => substr(request()->userAgent() ?? '', 0, 500),
|
||||||
|
]);
|
||||||
|
} catch (\Throwable) {
|
||||||
|
// Audit log failure must not break the main flow.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function redact(array $values): array
|
||||||
|
{
|
||||||
|
// Never log these sensitive fields.
|
||||||
|
$sensitive = ['no_kp', 'password', 'token', 'remember_token'];
|
||||||
|
|
||||||
|
return array_diff_key($values, array_flip($sensitive));
|
||||||
|
}
|
||||||
|
}
|
||||||
174
resources/views/admin/programs/_form.blade.php
Normal file
174
resources/views/admin/programs/_form.blade.php
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
{{--
|
||||||
|
Shared form partial.
|
||||||
|
Variables expected:
|
||||||
|
$program — Program model (or null for create)
|
||||||
|
$action — form action URL
|
||||||
|
$method — PUT for edit, omit for create (POST)
|
||||||
|
--}}
|
||||||
|
<form method="POST" action="{{ $action }}">
|
||||||
|
@csrf
|
||||||
|
@isset($method) @method($method) @endisset
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
|
||||||
|
{{-- ── Maklumat Asas ── --}}
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="card-header bg-white border-bottom py-3">
|
||||||
|
<span class="fw-semibold"><i class="bi bi-info-circle me-2 text-primary"></i>Maklumat Asas</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label fw-medium">Nama Program <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" name="title" class="form-control @error('title') is-invalid @enderror"
|
||||||
|
value="{{ old('title', $program->title ?? '') }}"
|
||||||
|
placeholder="Contoh: Kursus Pengurusan Projek 2025">
|
||||||
|
@error('title')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Penganjur <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" name="organizer" class="form-control @error('organizer') is-invalid @enderror"
|
||||||
|
value="{{ old('organizer', $program->organizer ?? 'MBIP') }}"
|
||||||
|
placeholder="Contoh: Jabatan Sumber Manusia">
|
||||||
|
@error('organizer')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Lokasi <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" name="location" class="form-control @error('location') is-invalid @enderror"
|
||||||
|
value="{{ old('location', $program->location ?? '') }}"
|
||||||
|
placeholder="Contoh: Dewan Bandaraya Ipoh">
|
||||||
|
@error('location')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<label class="form-label fw-medium">Deskripsi</label>
|
||||||
|
<textarea name="description" rows="3"
|
||||||
|
class="form-control @error('description') is-invalid @enderror"
|
||||||
|
placeholder="Huraian ringkas tentang program...">{{ old('description', $program->description ?? '') }}</textarea>
|
||||||
|
@error('description')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Tarikh & Masa ── --}}
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="card-header bg-white border-bottom py-3">
|
||||||
|
<span class="fw-semibold"><i class="bi bi-calendar-range me-2 text-primary"></i>Tarikh & Masa</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Tarikh Mula <span class="text-danger">*</span></label>
|
||||||
|
<input type="date" name="start_date" class="form-control @error('start_date') is-invalid @enderror"
|
||||||
|
value="{{ old('start_date', isset($program->start_date) ? $program->start_date->format('Y-m-d') : '') }}">
|
||||||
|
@error('start_date')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Tarikh Tamat <span class="text-danger">*</span></label>
|
||||||
|
<input type="date" name="end_date" class="form-control @error('end_date') is-invalid @enderror"
|
||||||
|
value="{{ old('end_date', isset($program->end_date) ? $program->end_date->format('Y-m-d') : '') }}">
|
||||||
|
@error('end_date')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12"><hr class="my-1"><p class="text-muted small mb-2">Tempoh Check-In (kosongkan jika tidak ditetapkan)</p></div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Mula Check-In</label>
|
||||||
|
<input type="datetime-local" name="checkin_start_at"
|
||||||
|
class="form-control @error('checkin_start_at') is-invalid @enderror"
|
||||||
|
value="{{ old('checkin_start_at', isset($program->checkin_start_at) ? $program->checkin_start_at->format('Y-m-d\TH:i') : '') }}">
|
||||||
|
@error('checkin_start_at')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Tamat Check-In</label>
|
||||||
|
<input type="datetime-local" name="checkin_end_at"
|
||||||
|
class="form-control @error('checkin_end_at') is-invalid @enderror"
|
||||||
|
value="{{ old('checkin_end_at', isset($program->checkin_end_at) ? $program->checkin_end_at->format('Y-m-d\TH:i') : '') }}">
|
||||||
|
@error('checkin_end_at')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12"><hr class="my-1"><p class="text-muted small mb-2">Tempoh Download eCert (kosongkan jika tidak ditetapkan)</p></div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Mula Download Sijil</label>
|
||||||
|
<input type="datetime-local" name="ecert_download_start_at"
|
||||||
|
class="form-control @error('ecert_download_start_at') is-invalid @enderror"
|
||||||
|
value="{{ old('ecert_download_start_at', isset($program->ecert_download_start_at) ? $program->ecert_download_start_at->format('Y-m-d\TH:i') : '') }}">
|
||||||
|
@error('ecert_download_start_at')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label fw-medium">Tamat Download Sijil</label>
|
||||||
|
<input type="datetime-local" name="ecert_download_end_at"
|
||||||
|
class="form-control @error('ecert_download_end_at') is-invalid @enderror"
|
||||||
|
value="{{ old('ecert_download_end_at', isset($program->ecert_download_end_at) ? $program->ecert_download_end_at->format('Y-m-d\TH:i') : '') }}">
|
||||||
|
@error('ecert_download_end_at')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Tetapan Kehadiran ── --}}
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="card-header bg-white border-bottom py-3">
|
||||||
|
<span class="fw-semibold"><i class="bi bi-person-check me-2 text-primary"></i>Tetapan Kehadiran</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row g-3">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="form-check form-switch mt-2">
|
||||||
|
<input type="hidden" name="allow_walk_in" value="0">
|
||||||
|
<input class="form-check-input" type="checkbox" id="allow_walk_in" name="allow_walk_in" value="1"
|
||||||
|
{{ old('allow_walk_in', $program->allow_walk_in ?? true) ? 'checked' : '' }}>
|
||||||
|
<label class="form-check-label fw-medium" for="allow_walk_in">
|
||||||
|
Benarkan Daftar Walk-in
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="text-muted small mt-1">Orang luar boleh daftar sendiri semasa program.</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-medium">Sesi Default (Kakitangan)</label>
|
||||||
|
<select name="default_staff_session" class="form-select @error('default_staff_session') is-invalid @enderror">
|
||||||
|
<option value="">— Pilih Sesi —</option>
|
||||||
|
<option value="pagi" {{ old('default_staff_session', $program->default_staff_session ?? '') === 'pagi' ? 'selected' : '' }}>Pagi</option>
|
||||||
|
<option value="petang" {{ old('default_staff_session', $program->default_staff_session ?? '') === 'petang' ? 'selected' : '' }}>Petang</option>
|
||||||
|
<option value="full_day" {{ old('default_staff_session', $program->default_staff_session ?? '') === 'full_day' ? 'selected' : '' }}>Sehari Penuh</option>
|
||||||
|
</select>
|
||||||
|
@error('default_staff_session')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label fw-medium">Sesi Default (Peserta Luar)</label>
|
||||||
|
<select name="default_external_session" class="form-select @error('default_external_session') is-invalid @enderror">
|
||||||
|
<option value="">— Pilih Sesi —</option>
|
||||||
|
<option value="pagi" {{ old('default_external_session', $program->default_external_session ?? '') === 'pagi' ? 'selected' : '' }}>Pagi</option>
|
||||||
|
<option value="petang" {{ old('default_external_session', $program->default_external_session ?? '') === 'petang' ? 'selected' : '' }}>Petang</option>
|
||||||
|
<option value="full_day" {{ old('default_external_session', $program->default_external_session ?? '') === 'full_day' ? 'selected' : '' }}>Sehari Penuh</option>
|
||||||
|
</select>
|
||||||
|
@error('default_external_session')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- ── Butang Submit ── --}}
|
||||||
|
<div class="col-12 d-flex justify-content-end gap-2">
|
||||||
|
<a href="{{ route('admin.programs.index') }}" class="btn btn-outline-secondary">
|
||||||
|
<i class="bi bi-x-lg me-1"></i> Batal
|
||||||
|
</a>
|
||||||
|
<button type="submit" class="btn btn-primary px-4">
|
||||||
|
<i class="bi bi-check-lg me-1"></i>
|
||||||
|
{{ isset($program) ? 'Simpan Perubahan' : 'Tambah Program' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
15
resources/views/admin/programs/create.blade.php
Normal file
15
resources/views/admin/programs/create.blade.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@extends('layouts.admin')
|
||||||
|
|
||||||
|
@section('title', 'Tambah Program Baru')
|
||||||
|
@section('header', 'Tambah Program Baru')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.programs.index') }}">Program</a></li>
|
||||||
|
<li class="breadcrumb-item active">Tambah Baru</li>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
@include('admin.programs._form', [
|
||||||
|
'action' => route('admin.programs.store'),
|
||||||
|
])
|
||||||
|
@endsection
|
||||||
18
resources/views/admin/programs/edit.blade.php
Normal file
18
resources/views/admin/programs/edit.blade.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@extends('layouts.admin')
|
||||||
|
|
||||||
|
@section('title', 'Edit Program')
|
||||||
|
@section('header', 'Edit Program')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.programs.index') }}">Program</a></li>
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.programs.show', $program) }}">{{ Str::limit($program->title, 30) }}</a></li>
|
||||||
|
<li class="breadcrumb-item active">Edit</li>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
@include('admin.programs._form', [
|
||||||
|
'program' => $program,
|
||||||
|
'action' => route('admin.programs.update', $program),
|
||||||
|
'method' => 'PUT',
|
||||||
|
])
|
||||||
|
@endsection
|
||||||
175
resources/views/admin/programs/index.blade.php
Normal file
175
resources/views/admin/programs/index.blade.php
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
@extends('layouts.admin')
|
||||||
|
|
||||||
|
@section('title', 'Senarai Program')
|
||||||
|
@section('header', 'Senarai Program')
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<li class="breadcrumb-item active">Program</li>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('header-actions')
|
||||||
|
<a href="{{ route('admin.programs.create') }}" class="btn btn-primary btn-sm">
|
||||||
|
<i class="bi bi-plus-lg me-1"></i> Program Baru
|
||||||
|
</a>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
{{-- Filter Bar --}}
|
||||||
|
<div class="card border-0 shadow-sm mb-4">
|
||||||
|
<div class="card-body py-3">
|
||||||
|
<form method="GET" class="row g-2 align-items-end">
|
||||||
|
<div class="col-sm-6 col-md-5">
|
||||||
|
<label class="form-label small text-muted mb-1">Carian</label>
|
||||||
|
<div class="input-group input-group-sm">
|
||||||
|
<span class="input-group-text"><i class="bi bi-search"></i></span>
|
||||||
|
<input type="text" name="search" class="form-control"
|
||||||
|
placeholder="Nama program, penganjur, lokasi..."
|
||||||
|
value="{{ request('search') }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4 col-md-3">
|
||||||
|
<label class="form-label small text-muted mb-1">Status</label>
|
||||||
|
<select name="status" class="form-select form-select-sm">
|
||||||
|
<option value="">Semua Status</option>
|
||||||
|
<option value="draft" {{ request('status') === 'draft' ? 'selected' : '' }}>Draf</option>
|
||||||
|
<option value="published" {{ request('status') === 'published' ? 'selected' : '' }}>Diterbitkan</option>
|
||||||
|
<option value="closed" {{ request('status') === 'closed' ? 'selected' : '' }}>Ditutup</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm">Tapis</button>
|
||||||
|
@if(request()->hasAny(['search', 'status']))
|
||||||
|
<a href="{{ route('admin.programs.index') }}" class="btn btn-outline-secondary btn-sm ms-1">Reset</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Table --}}
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="card-body p-0">
|
||||||
|
@if($programs->isEmpty())
|
||||||
|
<div class="text-center py-5 text-muted">
|
||||||
|
<i class="bi bi-calendar-x fs-1 d-block mb-2 opacity-25"></i>
|
||||||
|
@if(request()->hasAny(['search', 'status']))
|
||||||
|
Tiada program sepadan dengan carian.
|
||||||
|
@else
|
||||||
|
Belum ada program. <a href="{{ route('admin.programs.create') }}">Tambah sekarang</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover align-middle mb-0">
|
||||||
|
<thead class="table-light">
|
||||||
|
<tr>
|
||||||
|
<th>Nama Program</th>
|
||||||
|
<th>Tarikh</th>
|
||||||
|
<th class="text-center">Kehadiran</th>
|
||||||
|
<th class="text-center">Peserta</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th class="text-end">Tindakan</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($programs as $program)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="fw-medium">{{ $program->title }}</div>
|
||||||
|
<small class="text-muted">
|
||||||
|
<i class="bi bi-geo-alt me-1"></i>{{ Str::limit($program->location, 40) }}
|
||||||
|
</small>
|
||||||
|
</td>
|
||||||
|
<td style="min-width:130px;">
|
||||||
|
<div class="small">{{ $program->start_date->format('d M Y') }}</div>
|
||||||
|
@if($program->start_date->ne($program->end_date))
|
||||||
|
<div class="small text-muted">- {{ $program->end_date->format('d M Y') }}</div>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="badge bg-light text-dark border">
|
||||||
|
{{ $program->attendances_count }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<span class="badge bg-light text-dark border">
|
||||||
|
{{ $program->program_participants_count }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@include('admin.partials.program-status-badge', ['status' => $program->status])
|
||||||
|
</td>
|
||||||
|
<td class="text-end">
|
||||||
|
<div class="btn-group btn-group-sm">
|
||||||
|
<a href="{{ route('admin.programs.show', $program) }}"
|
||||||
|
class="btn btn-outline-primary" title="Lihat">
|
||||||
|
<i class="bi bi-eye"></i>
|
||||||
|
</a>
|
||||||
|
@if($program->status === 'draft')
|
||||||
|
<a href="{{ route('admin.programs.edit', $program) }}"
|
||||||
|
class="btn btn-outline-secondary" title="Edit">
|
||||||
|
<i class="bi bi-pencil"></i>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
@if($program->status === 'draft' && $program->attendances_count === 0)
|
||||||
|
<button type="button" class="btn btn-outline-danger"
|
||||||
|
title="Padam"
|
||||||
|
onclick="confirmDelete('{{ $program->title }}', '{{ route('admin.programs.destroy', $program) }}')">
|
||||||
|
<i class="bi bi-trash"></i>
|
||||||
|
</button>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Pagination --}}
|
||||||
|
@if($programs->hasPages())
|
||||||
|
<div class="px-3 py-3 border-top">
|
||||||
|
{{ $programs->links() }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Delete Confirm Modal --}}
|
||||||
|
<div class="modal fade" id="deleteModal" tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header border-0">
|
||||||
|
<h6 class="modal-title fw-semibold">Sahkan Pemadaman</h6>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p>Adakah anda pasti untuk memadam program <strong id="deleteTitle"></strong>?</p>
|
||||||
|
<p class="text-muted small mb-0">Tindakan ini tidak boleh dibatalkan.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer border-0">
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Batal</button>
|
||||||
|
<form id="deleteForm" method="POST">
|
||||||
|
@csrf @method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm">
|
||||||
|
<i class="bi bi-trash me-1"></i> Ya, Padam
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
function confirmDelete(title, url) {
|
||||||
|
document.getElementById('deleteTitle').textContent = '"' + title + '"';
|
||||||
|
document.getElementById('deleteForm').action = url;
|
||||||
|
new bootstrap.Modal(document.getElementById('deleteModal')).show();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
285
resources/views/admin/programs/show.blade.php
Normal file
285
resources/views/admin/programs/show.blade.php
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
@extends('layouts.admin')
|
||||||
|
|
||||||
|
@section('title', $program->title)
|
||||||
|
@section('header', $program->title)
|
||||||
|
|
||||||
|
@section('breadcrumb')
|
||||||
|
<li class="breadcrumb-item"><a href="{{ route('admin.programs.index') }}">Program</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ Str::limit($program->title, 35) }}</li>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('header-actions')
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
@if($program->status === 'draft')
|
||||||
|
<a href="{{ route('admin.programs.edit', $program) }}" class="btn btn-sm btn-outline-secondary">
|
||||||
|
<i class="bi bi-pencil me-1"></i> Edit
|
||||||
|
</a>
|
||||||
|
<form method="POST" action="{{ route('admin.programs.publish', $program) }}" class="d-inline">
|
||||||
|
@csrf
|
||||||
|
<button class="btn btn-sm btn-success" onclick="return confirm('Terbitkan program ini sekarang?')">
|
||||||
|
<i class="bi bi-send me-1"></i> Terbitkan
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@elseif($program->status === 'published')
|
||||||
|
<form method="POST" action="{{ route('admin.programs.close', $program) }}" class="d-inline">
|
||||||
|
@csrf
|
||||||
|
<button class="btn btn-sm btn-outline-danger" onclick="return confirm('Tutup program ini?')">
|
||||||
|
<i class="bi bi-lock me-1"></i> Tutup Program
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
{{-- Program Info Card --}}
|
||||||
|
<div class="row g-3 mb-4">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="card border-0 shadow-sm">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-between align-items-start mb-3">
|
||||||
|
<div>
|
||||||
|
<h6 class="mb-1 fw-semibold">{{ $program->title }}</h6>
|
||||||
|
<small class="text-muted">{{ $program->organizer }}</small>
|
||||||
|
</div>
|
||||||
|
@include('admin.partials.program-status-badge', ['status' => $program->status])
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-2 text-sm">
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="text-muted small">Tarikh</div>
|
||||||
|
<div>{{ $program->start_date->format('d M Y') }}
|
||||||
|
@if($program->start_date->ne($program->end_date))
|
||||||
|
— {{ $program->end_date->format('d M Y') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="text-muted small">Lokasi</div>
|
||||||
|
<div>{{ $program->location }}</div>
|
||||||
|
</div>
|
||||||
|
@if($program->checkin_start_at)
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="text-muted small">Tempoh Check-In</div>
|
||||||
|
<div class="small">{{ $program->checkin_start_at->format('d/m H:i') }} — {{ $program->checkin_end_at?->format('d/m H:i') ?? '—' }}</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@if($program->ecert_download_start_at)
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="text-muted small">Mula Download Sijil</div>
|
||||||
|
<div class="small">{{ $program->ecert_download_start_at->format('d M Y, H:i') }}</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Stat Cards --}}
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="row g-2">
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="card border-0 bg-primary bg-opacity-10 text-center p-3">
|
||||||
|
<div class="fs-3 fw-bold text-primary">{{ $stats['total_attendances'] }}</div>
|
||||||
|
<div class="small text-muted">Hadir</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="card border-0 bg-success bg-opacity-10 text-center p-3">
|
||||||
|
<div class="fs-3 fw-bold text-success">{{ $stats['total_participants'] }}</div>
|
||||||
|
<div class="small text-muted">Peserta</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="card border-0 bg-warning bg-opacity-10 text-center p-3">
|
||||||
|
<div class="fs-3 fw-bold text-warning">{{ $stats['total_certificates'] }}</div>
|
||||||
|
<div class="small text-muted">Sijil</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="card border-0 bg-info bg-opacity-10 text-center p-3">
|
||||||
|
<div class="fs-3 fw-bold text-info">{{ $stats['generated_certificates'] }}</div>
|
||||||
|
<div class="small text-muted">Dijana</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tab Navigation --}}
|
||||||
|
<ul class="nav nav-tabs mb-0" id="programTabs">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" data-bs-toggle="tab" href="#tab-participants">
|
||||||
|
<i class="bi bi-people me-1"></i> Peserta
|
||||||
|
<span class="badge bg-secondary ms-1">{{ $stats['total_participants'] }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-bs-toggle="tab" href="#tab-qr">
|
||||||
|
<i class="bi bi-qr-code me-1"></i> QR Code
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-bs-toggle="tab" href="#tab-template">
|
||||||
|
<i class="bi bi-image me-1"></i> Template Sijil
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-bs-toggle="tab" href="#tab-questionnaire">
|
||||||
|
<i class="bi bi-clipboard2-check me-1"></i> Soalselidik
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" data-bs-toggle="tab" href="#tab-statistics">
|
||||||
|
<i class="bi bi-bar-chart me-1"></i> Statistik
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content border border-top-0 rounded-bottom bg-white p-4 shadow-sm">
|
||||||
|
|
||||||
|
{{-- Tab: Peserta --}}
|
||||||
|
<div class="tab-pane fade show active" id="tab-participants">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<div>
|
||||||
|
<span class="text-muted small">
|
||||||
|
{{ $stats['pre_registered'] }} pra-daftar ·
|
||||||
|
{{ $stats['walk_in'] }} walk-in
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<a href="{{ route('admin.programs.participants.import.form', $program) }}" class="btn btn-sm btn-outline-secondary">
|
||||||
|
<i class="bi bi-upload me-1"></i> Import CSV
|
||||||
|
</a>
|
||||||
|
<a href="{{ route('admin.programs.participants.create', $program) }}" class="btn btn-sm btn-primary">
|
||||||
|
<i class="bi bi-person-plus me-1"></i> Tambah Peserta
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="text-center py-4 text-muted">
|
||||||
|
<a href="{{ route('admin.programs.participants.index', $program) }}" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-list-ul me-2"></i> Lihat Senarai Penuh Peserta
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tab: QR Code --}}
|
||||||
|
<div class="tab-pane fade" id="tab-qr">
|
||||||
|
@if($program->qrCode)
|
||||||
|
<div class="text-center py-3">
|
||||||
|
<img src="{{ Storage::url($program->qrCode->qr_image_path) }}"
|
||||||
|
alt="QR Code" class="img-fluid mb-3" style="max-width:220px;">
|
||||||
|
<div class="d-flex justify-content-center gap-2">
|
||||||
|
<a href="{{ route('admin.programs.qr.download', $program) }}" class="btn btn-sm btn-outline-primary">
|
||||||
|
<i class="bi bi-download me-1"></i> Muat Turun PNG
|
||||||
|
</a>
|
||||||
|
<form method="POST" action="{{ route('admin.programs.qr.generate', $program) }}">
|
||||||
|
@csrf
|
||||||
|
<button class="btn btn-sm btn-outline-warning" onclick="return confirm('Jana semula QR Code?')">
|
||||||
|
<i class="bi bi-arrow-repeat me-1"></i> Jana Semula
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3">
|
||||||
|
<small class="text-muted">URL Check-in:</small><br>
|
||||||
|
<code class="small">{{ route('public.checkin.show', $program->qrCode->token) }}</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="text-center py-4">
|
||||||
|
<i class="bi bi-qr-code fs-1 text-muted opacity-25 d-block mb-3"></i>
|
||||||
|
<p class="text-muted mb-3">QR Code belum dijana untuk program ini.</p>
|
||||||
|
<form method="POST" action="{{ route('admin.programs.qr.generate', $program) }}">
|
||||||
|
@csrf
|
||||||
|
<button class="btn btn-primary">
|
||||||
|
<i class="bi bi-qr-code me-2"></i> Jana QR Code
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tab: Template Sijil --}}
|
||||||
|
<div class="tab-pane fade" id="tab-template">
|
||||||
|
@if($program->certificateTemplate)
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<span class="small text-muted">Template aktif: <strong>{{ $program->certificateTemplate->original_filename }}</strong></span>
|
||||||
|
<a href="{{ route('admin.programs.template.show', $program) }}" class="btn btn-sm btn-primary">
|
||||||
|
<i class="bi bi-pencil-square me-1"></i> Urus Template
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<img src="{{ Storage::url($program->certificateTemplate->image_path) }}"
|
||||||
|
alt="Template" class="img-fluid rounded border" style="max-height:300px;">
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="text-center py-4">
|
||||||
|
<i class="bi bi-image fs-1 text-muted opacity-25 d-block mb-3"></i>
|
||||||
|
<p class="text-muted mb-3">Belum ada template sijil untuk program ini.</p>
|
||||||
|
<a href="{{ route('admin.programs.template.show', $program) }}" class="btn btn-primary">
|
||||||
|
<i class="bi bi-upload me-2"></i> Upload Template
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tab: Soalselidik --}}
|
||||||
|
<div class="tab-pane fade" id="tab-questionnaire">
|
||||||
|
@if($program->questionnaire && $program->questionnaire->questionnaireSet)
|
||||||
|
@php $qs = $program->questionnaire->questionnaireSet; @endphp
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
|
<div>
|
||||||
|
<span class="fw-medium">{{ $qs->title }}</span>
|
||||||
|
@if($program->questionnaire->is_confirmed)
|
||||||
|
<span class="badge bg-success ms-2">Disahkan</span>
|
||||||
|
@else
|
||||||
|
<span class="badge bg-warning ms-2">Belum Disahkan</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<a href="{{ route('admin.programs.questionnaire.show', $program) }}" class="btn btn-sm btn-primary">
|
||||||
|
<i class="bi bi-gear me-1"></i> Urus Soalselidik
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<p class="text-muted small">{{ $qs->questions->count() }} soalan · {{ $qs->description }}</p>
|
||||||
|
@else
|
||||||
|
<div class="text-center py-4">
|
||||||
|
<i class="bi bi-clipboard2-x fs-1 text-muted opacity-25 d-block mb-3"></i>
|
||||||
|
<p class="text-muted mb-3">Belum ada soalselidik dilampirkan untuk program ini.</p>
|
||||||
|
<a href="{{ route('admin.programs.questionnaire.show', $program) }}" class="btn btn-primary">
|
||||||
|
<i class="bi bi-clipboard2-plus me-2"></i> Lampir Soalselidik
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Tab: Statistik --}}
|
||||||
|
<div class="tab-pane fade" id="tab-statistics">
|
||||||
|
<div class="text-center py-4">
|
||||||
|
<a href="{{ route('admin.programs.statistics.show', $program) }}" class="btn btn-outline-primary">
|
||||||
|
<i class="bi bi-bar-chart-line me-2"></i> Lihat Statistik Penuh
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script>
|
||||||
|
// Persist active tab in URL hash
|
||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
const hash = window.location.hash;
|
||||||
|
if (hash) {
|
||||||
|
const tab = document.querySelector('[href="' + hash + '"]');
|
||||||
|
if (tab) bootstrap.Tab.getOrCreateInstance(tab).show();
|
||||||
|
}
|
||||||
|
document.querySelectorAll('#programTabs .nav-link').forEach(el => {
|
||||||
|
el.addEventListener('shown.bs.tab', () => {
|
||||||
|
history.replaceState(null, null, el.getAttribute('href'));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
Reference in New Issue
Block a user