first
This commit is contained in:
137
resources/views/admin/profile/show.blade.php
Normal file
137
resources/views/admin/profile/show.blade.php
Normal file
@@ -0,0 +1,137 @@
|
||||
@extends('layouts.admin')
|
||||
|
||||
@section('title', 'Profil Saya')
|
||||
@section('header', 'Profil Saya')
|
||||
|
||||
@section('breadcrumb')
|
||||
<li class="breadcrumb-item active">Profil</li>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row g-4" style="max-width:760px;">
|
||||
|
||||
{{-- Account Info --}}
|
||||
<div class="col-12">
|
||||
<div class="card border-0 shadow-sm">
|
||||
<div class="card-body d-flex align-items-center gap-3 py-3">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 d-flex align-items-center justify-content-center flex-shrink-0"
|
||||
style="width:52px;height:52px;">
|
||||
<i class="bi bi-person-fill text-primary fs-4"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="fw-semibold">{{ $user->name }}</div>
|
||||
<div class="text-muted small">{{ $user->email }}</div>
|
||||
<span class="badge {{ $user->isSuperAdmin() ? 'bg-danger' : 'bg-primary' }} mt-1">
|
||||
{{ $user->isSuperAdmin() ? 'Super Admin' : 'Admin Program' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Update Email --}}
|
||||
<div class="col-md-6">
|
||||
<div class="card border-0 shadow-sm h-100">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h6 class="mb-0 fw-semibold">
|
||||
<i class="bi bi-envelope me-2 text-primary"></i>Tukar Alamat Emel
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if(session('email_success'))
|
||||
<div class="alert alert-success small py-2">
|
||||
<i class="bi bi-check-circle me-1"></i>{{ session('email_success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('admin.profile.update-email') }}">
|
||||
@csrf @method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Kata Laluan Semasa <span class="text-danger">*</span></label>
|
||||
<input type="password" name="current_password" autocomplete="current-password"
|
||||
class="form-control form-control-sm @error('current_password', 'email') is-invalid @enderror"
|
||||
placeholder="••••••••">
|
||||
@error('current_password', 'email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Emel Baru <span class="text-danger">*</span></label>
|
||||
<input type="email" name="email" autocomplete="email"
|
||||
class="form-control form-control-sm @error('email', 'email') is-invalid @enderror"
|
||||
value="{{ old('email', $user->email) }}"
|
||||
placeholder="emel@contoh.com">
|
||||
@error('email', 'email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-sm w-100">
|
||||
<i class="bi bi-check-lg me-1"></i> Kemaskini Emel
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Update Password --}}
|
||||
<div class="col-md-6">
|
||||
<div class="card border-0 shadow-sm h-100">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h6 class="mb-0 fw-semibold">
|
||||
<i class="bi bi-key me-2 text-primary"></i>Tukar Kata Laluan
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if(session('password_success'))
|
||||
<div class="alert alert-success small py-2">
|
||||
<i class="bi bi-check-circle me-1"></i>{{ session('password_success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('admin.profile.update-password') }}">
|
||||
@csrf @method('PUT')
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Kata Laluan Semasa <span class="text-danger">*</span></label>
|
||||
<input type="password" name="current_password" autocomplete="current-password"
|
||||
class="form-control form-control-sm @error('current_password', 'password') is-invalid @enderror"
|
||||
placeholder="••••••••">
|
||||
@error('current_password', 'password')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Kata Laluan Baru <span class="text-danger">*</span></label>
|
||||
<input type="password" name="password" autocomplete="new-password"
|
||||
class="form-control form-control-sm @error('password', 'password') is-invalid @enderror"
|
||||
placeholder="Min. 8 aksara">
|
||||
@error('password', 'password')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Sahkan Kata Laluan Baru <span class="text-danger">*</span></label>
|
||||
<input type="password" name="password_confirmation" autocomplete="new-password"
|
||||
class="form-control form-control-sm"
|
||||
placeholder="••••••••">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-sm w-100">
|
||||
<i class="bi bi-check-lg me-1"></i> Tukar Kata Laluan
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
151
resources/views/admin/programs/questionnaire/preview.blade.php
Normal file
151
resources/views/admin/programs/questionnaire/preview.blade.php
Normal file
@@ -0,0 +1,151 @@
|
||||
@extends('layouts.public')
|
||||
|
||||
@section('title', 'Pratonton Soalselidik — ' . $program->title)
|
||||
|
||||
@section('hero')
|
||||
<h4 class="mb-1">{{ $program->title }}</h4>
|
||||
<div class="opacity-75 small">
|
||||
<i class="bi bi-clipboard2-check me-1"></i>Borang Penilaian Program
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
.preview-banner {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background: #fff3cd;
|
||||
border-bottom: 2px solid #ffc107;
|
||||
padding: .6rem 1rem;
|
||||
text-align: center;
|
||||
font-size: .85rem;
|
||||
font-weight: 600;
|
||||
color: #664d03;
|
||||
}
|
||||
.preview-banner i { margin-right: .4rem; }
|
||||
fieldset { border: none; padding: 0; margin: 0; }
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="preview-banner">
|
||||
<i class="bi bi-eye"></i>PRATONTON ADMIN — Borang ini tidak akan dihantar
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary ms-3 py-0" onclick="window.close()">
|
||||
<i class="bi bi-x-lg me-1"></i>Tutup
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="checkin-card card p-4 mb-3 mt-3">
|
||||
<div class="text-center mb-4">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 d-inline-flex align-items-center justify-content-center mx-auto mb-3"
|
||||
style="width:70px; height:70px;">
|
||||
<i class="bi bi-clipboard2-check-fill text-primary" style="font-size:2rem;"></i>
|
||||
</div>
|
||||
<h5 class="fw-bold mb-1">{{ $pq->questionnaireSet->title }}</h5>
|
||||
@if($pq->questionnaireSet->description)
|
||||
<p class="text-muted small mb-1">{{ $pq->questionnaireSet->description }}</p>
|
||||
@endif
|
||||
<p class="text-muted small mb-0">
|
||||
Sila jawab semua soalan sebelum memuat turun sijil anda, <strong>PESERTA CONTOH</strong>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<fieldset disabled>
|
||||
|
||||
@php $qNum = 0; @endphp
|
||||
|
||||
@foreach($questions as $q)
|
||||
|
||||
@if($q->question_type === 'tajuk')
|
||||
{{-- ── Section header ─────────────────────────────── --}}
|
||||
<div class="d-flex align-items-center gap-2 mt-4 mb-3 pb-1 border-bottom">
|
||||
<span class="fw-bold text-primary">{{ $q->question_text }}</span>
|
||||
</div>
|
||||
|
||||
@foreach($q->children as $child)
|
||||
@php $qNum++ @endphp
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-medium">
|
||||
{{ $qNum }}. {{ $child->question_text }}
|
||||
@if($child->is_required)<span class="text-danger">*</span>@endif
|
||||
</label>
|
||||
<div class="d-flex gap-3 flex-wrap">
|
||||
@for($i = 1; $i <= 5; $i++)
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio"
|
||||
name="q_{{ $child->id }}" value="{{ $i }}">
|
||||
<label class="form-check-label">
|
||||
{{ $i }}
|
||||
@php $label = $q->rating_labels[$i] ?? $q->rating_labels[strval($i)] ?? ''; @endphp
|
||||
@if($label)
|
||||
<small class="text-muted d-block" style="font-size:.7rem;">({{ $label }})</small>
|
||||
@endif
|
||||
</label>
|
||||
</div>
|
||||
@endfor
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
{{-- ── Standalone question ─────────────────────────── --}}
|
||||
@php $qNum++ @endphp
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-medium">
|
||||
{{ $qNum }}. {{ $q->question_text }}
|
||||
@if($q->is_required)<span class="text-danger">*</span>@endif
|
||||
</label>
|
||||
|
||||
@if($q->question_type === 'rating')
|
||||
<div class="d-flex gap-3 flex-wrap">
|
||||
@for($i = 1; $i <= 5; $i++)
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" name="q_{{ $q->id }}" value="{{ $i }}">
|
||||
<label class="form-check-label">
|
||||
{{ $i }}
|
||||
@if($i === 1)<small class="text-muted">(Sangat Tidak Setuju)</small>
|
||||
@elseif($i === 5)<small class="text-muted">(Sangat Setuju)</small>
|
||||
@endif
|
||||
</label>
|
||||
</div>
|
||||
@endfor
|
||||
</div>
|
||||
|
||||
@elseif($q->question_type === 'single_choice')
|
||||
@foreach($q->options_json ?? [] as $opt)
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="q_{{ $q->id }}" value="{{ $opt }}">
|
||||
<label class="form-check-label">{{ $opt }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@elseif($q->question_type === 'multiple_choice')
|
||||
@foreach($q->options_json ?? [] as $opt)
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="q_{{ $q->id }}[]" value="{{ $opt }}">
|
||||
<label class="form-check-label">{{ $opt }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@elseif($q->question_type === 'short_text')
|
||||
<input type="text" class="form-control" placeholder="Jawapan anda...">
|
||||
|
||||
@elseif($q->question_type === 'long_text')
|
||||
<textarea class="form-control" rows="4" placeholder="Jawapan anda..."></textarea>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div class="alert alert-warning d-flex align-items-center gap-2 mb-0 mt-2">
|
||||
<i class="bi bi-eye-fill flex-shrink-0"></i>
|
||||
<span class="small">Ini adalah <strong>pratonton admin</strong>. Borang ini tidak boleh dihantar.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@@ -10,9 +10,17 @@
|
||||
@endsection
|
||||
|
||||
@section('header-actions')
|
||||
<a href="{{ route('admin.programs.show', $program) }}#tab-questionnaire" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Kembali
|
||||
</a>
|
||||
<div class="d-flex gap-2">
|
||||
@if($pq && $pq->questionnaireSet)
|
||||
<a href="{{ route('admin.programs.questionnaire.preview', $program) }}" target="_blank"
|
||||
class="btn btn-sm btn-outline-primary">
|
||||
<i class="bi bi-eye me-1"></i> Pratonton
|
||||
</a>
|
||||
@endif
|
||||
<a href="{{ route('admin.programs.show', $program) }}#tab-questionnaire" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Kembali
|
||||
</a>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@@ -68,25 +76,48 @@
|
||||
{{-- List Questions --}}
|
||||
<div class="border rounded p-3 bg-light">
|
||||
<div class="small fw-medium text-muted mb-2">Senarai Soalan:</div>
|
||||
@foreach($pq->questionnaireSet->questions as $q)
|
||||
<div class="d-flex align-items-start gap-2 mb-2">
|
||||
<span class="badge bg-secondary flex-shrink-0">{{ $loop->iteration }}</span>
|
||||
<div>
|
||||
<div class="small">{{ $q->question_text }}</div>
|
||||
<span class="badge bg-light text-dark border" style="font-size:0.65rem;">
|
||||
{{ match($q->question_type) {
|
||||
'rating' => 'Rating',
|
||||
'single_choice' => 'Pilihan Tunggal',
|
||||
'multiple_choice' => 'Pilihan Berganda',
|
||||
'short_text' => 'Teks Pendek',
|
||||
'long_text' => 'Teks Panjang',
|
||||
} }}
|
||||
</span>
|
||||
@if($q->is_required)
|
||||
<span class="badge bg-danger bg-opacity-10 text-danger" style="font-size:0.65rem;">Wajib</span>
|
||||
@endif
|
||||
@php
|
||||
$allQs = $pq->questionnaireSet->questions->sortBy('sort_order');
|
||||
$topQs = $allQs->whereNull('parent_id');
|
||||
$qNum = 0;
|
||||
@endphp
|
||||
@foreach($topQs as $q)
|
||||
@if($q->question_type === 'tajuk')
|
||||
<div class="d-flex align-items-center gap-2 mt-2 mb-1">
|
||||
<span class="badge bg-dark" style="font-size:0.6rem;">Tajuk</span>
|
||||
<div class="small fw-semibold text-dark">{{ $q->question_text }}</div>
|
||||
</div>
|
||||
</div>
|
||||
@foreach($allQs->where('parent_id', $q->id)->sortBy('sort_order') as $child)
|
||||
@php $qNum++ @endphp
|
||||
<div class="d-flex align-items-start gap-2 mb-1 ps-3">
|
||||
<span class="badge bg-secondary flex-shrink-0" style="min-width:22px;font-size:0.65rem;">{{ $qNum }}</span>
|
||||
<div>
|
||||
<div class="small">{{ $child->question_text }}</div>
|
||||
<span class="badge bg-light text-dark border" style="font-size:0.6rem;">Rating 1–5</span>
|
||||
@if($child->is_required)<span class="badge bg-danger bg-opacity-10 text-danger" style="font-size:0.6rem;">Wajib</span>@endif
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
@php $qNum++ @endphp
|
||||
<div class="d-flex align-items-start gap-2 mb-2">
|
||||
<span class="badge bg-secondary flex-shrink-0" style="min-width:22px;font-size:0.65rem;">{{ $qNum }}</span>
|
||||
<div>
|
||||
<div class="small">{{ $q->question_text }}</div>
|
||||
<span class="badge bg-light text-dark border" style="font-size:0.65rem;">
|
||||
{{ match($q->question_type) {
|
||||
'rating' => 'Rating 1–5',
|
||||
'single_choice' => 'Pilihan Tunggal',
|
||||
'multiple_choice' => 'Pilihan Berganda',
|
||||
'short_text' => 'Teks Pendek',
|
||||
'long_text' => 'Teks Panjang',
|
||||
default => $q->question_type,
|
||||
} }}
|
||||
</span>
|
||||
@if($q->is_required)<span class="badge bg-danger bg-opacity-10 text-danger" style="font-size:0.65rem;">Wajib</span>@endif
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
@@ -31,13 +31,25 @@
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
.tajuk-block { border-left: 3px solid #6c757d; }
|
||||
.tajuk-header { background: #f8f9fa; }
|
||||
.children-list { border-top: 1px solid #dee2e6; }
|
||||
.children-list .list-group-item { background: #fff; }
|
||||
.children-list .list-group-item:last-child { border-bottom: 0; }
|
||||
.drag-handle { cursor: grab; color: #adb5bd; }
|
||||
.drag-handle:active { cursor: grabbing; }
|
||||
.sortable-ghost { opacity: .4; background: #e9f0ff !important; }
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row g-4">
|
||||
{{-- Left: Questions --}}
|
||||
<div class="col-md-8">
|
||||
|
||||
{{-- Status Banner --}}
|
||||
@if($set->status === 'draft')
|
||||
<div class="alert alert-warning mb-3 small">
|
||||
<i class="bi bi-exclamation-triangle me-2"></i>
|
||||
@@ -55,61 +67,140 @@
|
||||
<div class="card-header bg-white d-flex justify-content-between align-items-center py-3">
|
||||
<h6 class="mb-0 fw-semibold">
|
||||
<i class="bi bi-list-ul me-2 text-primary"></i>Senarai Soalan
|
||||
<span class="badge bg-secondary ms-2">{{ $set->questions->count() }}</span>
|
||||
<span class="badge bg-secondary ms-2">{{ $totalCount }}</span>
|
||||
</h6>
|
||||
<small class="text-muted"><i class="bi bi-grip-vertical me-1"></i>Seret untuk susun semula</small>
|
||||
</div>
|
||||
|
||||
@if($set->questions->isEmpty())
|
||||
@if($totalCount === 0)
|
||||
<div class="card-body text-center py-5 text-muted">
|
||||
<i class="bi bi-question-circle d-block fs-1 mb-3 opacity-25"></i>
|
||||
Belum ada soalan. Tambah soalan menggunakan borang di sebelah kanan.
|
||||
</div>
|
||||
@else
|
||||
<ul class="list-group list-group-flush" id="questionList">
|
||||
@foreach($set->questions as $q)
|
||||
@foreach($topLevel as $q)
|
||||
|
||||
@if($q->question_type === 'tajuk')
|
||||
{{-- ── TAJUK BLOCK ── --}}
|
||||
<li class="list-group-item p-0 tajuk-block" data-id="{{ $q->id }}">
|
||||
{{-- Tajuk header row --}}
|
||||
<div class="tajuk-header d-flex align-items-center gap-2 px-3 py-2">
|
||||
<i class="bi bi-grip-vertical drag-handle drag-handle-top fs-5"></i>
|
||||
<span class="badge bg-dark small">Tajuk</span>
|
||||
<div class="flex-grow-1 fw-semibold">{{ $q->question_text }}</div>
|
||||
@if($q->rating_labels)
|
||||
<div class="small text-muted text-nowrap d-none d-md-block">
|
||||
@php $labels = array_filter($q->rating_labels); @endphp
|
||||
@if(!empty($labels))
|
||||
<i class="bi bi-tag me-1"></i>{{ implode(' · ', $labels) }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
<div class="d-flex gap-1 flex-shrink-0">
|
||||
<button class="btn btn-sm btn-outline-secondary"
|
||||
onclick="editQuestion({{ $q->id }}, @json($q->question_text), 'tajuk', false, [], null, @json($q->rating_labels ?? []))">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<form method="POST" action="{{ route('admin.questions.destroy', $q) }}"
|
||||
onsubmit="return confirm('Padam bahagian '{{ addslashes($q->question_text) }}' dan semua soalan di dalamnya?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Rating labels pills --}}
|
||||
@if($q->rating_labels && array_filter($q->rating_labels))
|
||||
<div class="px-3 py-1 bg-light border-bottom d-flex gap-2 flex-wrap d-md-none">
|
||||
@foreach(array_filter($q->rating_labels) as $val => $lbl)
|
||||
<span class="badge bg-light text-dark border small">{{ $val }}: {{ $lbl }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
{{-- Children list --}}
|
||||
<ul class="children-list list-group list-group-flush" data-parent-id="{{ $q->id }}">
|
||||
@foreach($q->children as $child)
|
||||
<li class="list-group-item d-flex align-items-start gap-2 py-2 ps-4" data-id="{{ $child->id }}">
|
||||
<i class="bi bi-grip-vertical drag-handle drag-handle-child fs-5 mt-1"></i>
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex align-items-center gap-2 mb-1">
|
||||
<span class="badge bg-light text-dark border small">{{ $loop->iteration }}</span>
|
||||
<span class="badge bg-primary bg-opacity-10 text-primary small">Rating 1–5</span>
|
||||
@if($child->is_required)
|
||||
<span class="badge bg-danger bg-opacity-10 text-danger small">Wajib</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="small">{{ $child->question_text }}</div>
|
||||
</div>
|
||||
<div class="d-flex gap-1 flex-shrink-0">
|
||||
<button class="btn btn-sm btn-outline-secondary"
|
||||
onclick="editQuestion({{ $child->id }}, @json($child->question_text), 'rating', {{ $child->is_required ? 'true' : 'false' }}, [], {{ $child->parent_id ?? 'null' }}, [])">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<form method="POST" action="{{ route('admin.questions.destroy', $child) }}"
|
||||
onsubmit="return confirm('Padam soalan ini?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
@endforeach
|
||||
@if($q->children->isEmpty())
|
||||
<li class="list-group-item text-muted small text-center py-2 fst-italic ps-4">
|
||||
<i class="bi bi-arrow-down-short me-1"></i>Tiada soalan dalam bahagian ini
|
||||
</li>
|
||||
@endif
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@else
|
||||
{{-- ── STANDALONE QUESTION ── --}}
|
||||
<li class="list-group-item py-3" data-id="{{ $q->id }}">
|
||||
<div class="d-flex justify-content-between align-items-start gap-2">
|
||||
<div class="flex-grow-1">
|
||||
<div class="d-flex align-items-center gap-2 mb-1">
|
||||
<span class="badge bg-light text-dark border small">{{ $loop->iteration }}</span>
|
||||
<span class="badge bg-primary bg-opacity-10 text-primary small">
|
||||
{{ match($q->question_type) {
|
||||
'rating' => 'Rating',
|
||||
'single_choice' => 'Pilihan Tunggal',
|
||||
'multiple_choice' => 'Pilihan Berganda',
|
||||
'short_text' => 'Teks Pendek',
|
||||
'long_text' => 'Teks Panjang',
|
||||
default => $q->question_type,
|
||||
} }}
|
||||
</span>
|
||||
@if($q->is_required)
|
||||
<span class="badge bg-danger bg-opacity-10 text-danger small">Wajib</span>
|
||||
<div class="d-flex align-items-start gap-2 flex-grow-1">
|
||||
<i class="bi bi-grip-vertical drag-handle drag-handle-top fs-5 mt-1"></i>
|
||||
<div>
|
||||
<div class="d-flex align-items-center gap-2 mb-1">
|
||||
<span class="badge bg-light text-dark border small">{{ $loop->iteration }}</span>
|
||||
<span class="badge bg-primary bg-opacity-10 text-primary small">
|
||||
{{ match($q->question_type) {
|
||||
'rating' => 'Rating 1–5',
|
||||
'single_choice' => 'Pilihan Tunggal',
|
||||
'multiple_choice' => 'Pilihan Berganda',
|
||||
'short_text' => 'Teks Pendek',
|
||||
'long_text' => 'Teks Panjang',
|
||||
default => $q->question_type,
|
||||
} }}
|
||||
</span>
|
||||
@if($q->is_required)
|
||||
<span class="badge bg-danger bg-opacity-10 text-danger small">Wajib</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="fw-medium">{{ $q->question_text }}</div>
|
||||
@if($q->options_json)
|
||||
<div class="mt-1">
|
||||
@foreach($q->options_json as $opt)
|
||||
<span class="badge bg-light text-dark border me-1 small">{{ $opt }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="fw-medium">{{ $q->question_text }}</div>
|
||||
@if($q->options_json)
|
||||
<div class="mt-1">
|
||||
@foreach($q->options_json as $opt)
|
||||
<span class="badge bg-light text-dark border me-1 small">{{ $opt }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<div class="d-flex gap-1 flex-shrink-0">
|
||||
<button class="btn btn-sm btn-outline-secondary"
|
||||
onclick="editQuestion({{ $q->id }}, @json($q->question_text), '{{ $q->question_type }}', {{ $q->is_required ? 'true' : 'false' }}, @json($q->options_json ?? []))">
|
||||
onclick="editQuestion({{ $q->id }}, @json($q->question_text), '{{ $q->question_type }}', {{ $q->is_required ? 'true' : 'false' }}, @json($q->options_json ?? []), null, [])">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<form method="POST" action="{{ route('admin.questions.destroy', $q) }}"
|
||||
onsubmit="return confirm('Padam soalan ini?')">
|
||||
@csrf @method('DELETE')
|
||||
<button class="btn btn-sm btn-outline-danger">
|
||||
<i class="bi bi-trash"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-danger"><i class="bi bi-trash"></i></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@@ -143,27 +234,31 @@
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm sticky-top" style="top:80px;">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h6 class="mb-0 fw-semibold" id="formTitle"><i class="bi bi-plus-circle me-2 text-primary"></i>Tambah Soalan</h6>
|
||||
<h6 class="mb-0 fw-semibold" id="formTitle">
|
||||
<i class="bi bi-plus-circle me-2 text-primary"></i>Tambah Soalan
|
||||
</h6>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
{{-- Add Question Form --}}
|
||||
<form method="POST" id="questionForm" action="{{ route('admin.questions.store', $set) }}">
|
||||
@csrf
|
||||
<input type="hidden" name="_method" id="formMethod" value="POST">
|
||||
<input type="hidden" name="_question_id" id="questionId" value="">
|
||||
|
||||
{{-- Question text --}}
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Soalan <span class="text-danger">*</span></label>
|
||||
<label class="form-label small fw-medium">Teks Soalan / Tajuk <span class="text-danger">*</span></label>
|
||||
<textarea name="question_text" id="questionText" rows="3"
|
||||
class="form-control form-control-sm @error('question_text') is-invalid @enderror"
|
||||
placeholder="Taip soalan di sini..."></textarea>
|
||||
placeholder="Taip soalan atau nama bahagian..."></textarea>
|
||||
@error('question_text')<div class="invalid-feedback">{{ $message }}</div>@enderror
|
||||
</div>
|
||||
|
||||
{{-- Question type --}}
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-medium">Jenis Soalan <span class="text-danger">*</span></label>
|
||||
<select name="question_type" id="questionType" class="form-select form-select-sm" onchange="toggleOptions()">
|
||||
<label class="form-label small fw-medium">Jenis <span class="text-danger">*</span></label>
|
||||
<select name="question_type" id="questionType" class="form-select form-select-sm" onchange="onTypeChange()">
|
||||
<option value="tajuk">Tajuk Bahagian</option>
|
||||
<option value="rating">Rating (1–5)</option>
|
||||
<option value="single_choice">Pilihan Tunggal</option>
|
||||
<option value="multiple_choice">Pilihan Berganda</option>
|
||||
@@ -172,11 +267,41 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" name="is_required" id="isRequired" class="form-check-input" value="1" checked>
|
||||
{{-- Required (hidden for tajuk) --}}
|
||||
<div class="mb-3 form-check d-none" id="requiredSection">
|
||||
<input type="checkbox" name="is_required" id="isRequired"
|
||||
class="form-check-input" value="1" checked>
|
||||
<label class="form-check-label small" for="isRequired">Wajib dijawab</label>
|
||||
</div>
|
||||
|
||||
{{-- Parent selector (rating only) --}}
|
||||
<div id="parentSection" class="mb-3 d-none">
|
||||
<label class="form-label small fw-medium">Bahagian (Tajuk) <span class="text-danger">*</span></label>
|
||||
<select name="parent_id" id="parentId" class="form-select form-select-sm">
|
||||
<option value="">— Pilih Tajuk —</option>
|
||||
</select>
|
||||
@error('parent_id')
|
||||
<div class="text-danger small mt-1">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
{{-- Rating labels (tajuk only) --}}
|
||||
<div id="ratingLabelsSection" class="mb-3">
|
||||
<label class="form-label small fw-medium">Label Skala Rating</label>
|
||||
<div class="d-flex flex-column gap-1">
|
||||
@for ($i = 1; $i <= 5; $i++)
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text fw-bold" style="width:32px;justify-content:center;">{{ $i }}</span>
|
||||
<input type="text" name="rating_labels[{{ $i }}]" id="ratingLabel{{ $i }}"
|
||||
class="form-control"
|
||||
placeholder="{{ $i === 1 ? 'cth: Sangat Tidak Setuju' : ($i === 5 ? 'cth: Sangat Setuju' : '') }}">
|
||||
</div>
|
||||
@endfor
|
||||
</div>
|
||||
<div class="form-text">Kosongkan jika tiada label untuk nilai tersebut.</div>
|
||||
</div>
|
||||
|
||||
{{-- Options (choice types) --}}
|
||||
<div id="optionsSection" class="mb-3 d-none">
|
||||
<label class="form-label small fw-medium">Pilihan Jawapan</label>
|
||||
<div id="optionsList">
|
||||
@@ -192,13 +317,17 @@
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary w-100" onclick="addOption()">
|
||||
<i class="bi bi-plus me-1"></i> Tambah Pilihan
|
||||
</button>
|
||||
@error('options')
|
||||
<div class="text-danger small mt-1">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm w-100">
|
||||
<i class="bi bi-check-lg me-1"></i> <span id="submitLabel">Tambah</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="cancelEdit" style="display:none;" onclick="resetForm()">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="cancelEdit"
|
||||
style="display:none;" onclick="resetForm()">
|
||||
Batal
|
||||
</button>
|
||||
</div>
|
||||
@@ -212,21 +341,49 @@
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.3/Sortable.min.js"></script>
|
||||
<script>
|
||||
const setId = {{ $set->id }};
|
||||
const storeUrl = "{{ route('admin.questions.store', $set) }}";
|
||||
const setId = {{ $set->id }};
|
||||
const storeUrl = "{{ route('admin.questions.store', $set) }}";
|
||||
const updateBase = "{{ url('admin/questions') }}/";
|
||||
const reorderUrl = "{{ route('admin.questions.reorder') }}";
|
||||
const csrfToken = document.querySelector('meta[name="csrf-token"]').content;
|
||||
|
||||
function toggleOptions() {
|
||||
const type = document.getElementById('questionType').value;
|
||||
const section = document.getElementById('optionsSection');
|
||||
section.classList.toggle('d-none', !['single_choice','multiple_choice'].includes(type));
|
||||
// Tajuk questions available as parents for rating questions
|
||||
const tajukList = @json($topLevel->where('question_type', 'tajuk')->map(fn($q) => ['id' => $q->id, 'text' => $q->question_text])->values());
|
||||
|
||||
// ── UI helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
function populateParentDropdown(selectedId) {
|
||||
const sel = document.getElementById('parentId');
|
||||
sel.innerHTML = '<option value="">— Pilih Tajuk —</option>';
|
||||
tajukList.forEach(function(t) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = t.id;
|
||||
opt.textContent = t.text;
|
||||
if (selectedId && t.id == selectedId) opt.selected = true;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
}
|
||||
|
||||
function onTypeChange() {
|
||||
const type = document.getElementById('questionType').value;
|
||||
const isTajuk = type === 'tajuk';
|
||||
const isRating = type === 'rating';
|
||||
const isChoice = ['single_choice', 'multiple_choice'].includes(type);
|
||||
|
||||
document.getElementById('requiredSection').classList.toggle('d-none', isTajuk);
|
||||
document.getElementById('ratingLabelsSection').classList.toggle('d-none', !isTajuk);
|
||||
document.getElementById('parentSection').classList.toggle('d-none', !isRating);
|
||||
document.getElementById('optionsSection').classList.toggle('d-none', !isChoice);
|
||||
|
||||
if (isRating) populateParentDropdown(null);
|
||||
}
|
||||
|
||||
function addOption() {
|
||||
const list = document.getElementById('optionsList');
|
||||
const list = document.getElementById('optionsList');
|
||||
const count = list.querySelectorAll('input').length + 1;
|
||||
const div = document.createElement('div');
|
||||
const div = document.createElement('div');
|
||||
div.className = 'input-group input-group-sm mb-2';
|
||||
div.innerHTML = `<input type="text" name="options[]" class="form-control" placeholder="Pilihan ${count}">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>`;
|
||||
@@ -240,7 +397,7 @@ function removeOption(btn) {
|
||||
}
|
||||
}
|
||||
|
||||
function editQuestion(id, text, type, required, options) {
|
||||
function editQuestion(id, text, type, required, options, parentId, ratingLabels) {
|
||||
document.getElementById('formTitle').innerHTML = '<i class="bi bi-pencil me-2 text-warning"></i>Edit Soalan';
|
||||
document.getElementById('submitLabel').textContent = 'Kemaskini';
|
||||
document.getElementById('cancelEdit').style.display = '';
|
||||
@@ -253,18 +410,42 @@ function editQuestion(id, text, type, required, options) {
|
||||
form.action = updateBase + id;
|
||||
document.getElementById('formMethod').value = 'PUT';
|
||||
|
||||
toggleOptions();
|
||||
onTypeChange(); // show/hide sections
|
||||
|
||||
// Set parent if rating
|
||||
if (type === 'rating' && parentId) {
|
||||
populateParentDropdown(parentId);
|
||||
}
|
||||
|
||||
// Set rating labels if tajuk
|
||||
if (type === 'tajuk') {
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
const el = document.getElementById('ratingLabel' + i);
|
||||
if (el) el.value = (ratingLabels && (ratingLabels[i] || ratingLabels[String(i)])) || '';
|
||||
}
|
||||
}
|
||||
|
||||
// Options list
|
||||
const list = document.getElementById('optionsList');
|
||||
list.innerHTML = '';
|
||||
if (options && options.length) {
|
||||
options.forEach((opt, i) => {
|
||||
options.forEach(function(opt, i) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'input-group input-group-sm mb-2';
|
||||
div.innerHTML = `<input type="text" name="options[]" class="form-control" value="${opt}" placeholder="Pilihan ${i+1}">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>`;
|
||||
list.appendChild(div);
|
||||
});
|
||||
} else {
|
||||
// Restore default empty options for choice types
|
||||
list.innerHTML = `<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 1">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 2">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
form.scrollIntoView({ behavior: 'smooth' });
|
||||
@@ -278,17 +459,65 @@ function resetForm() {
|
||||
document.getElementById('questionForm').action = storeUrl;
|
||||
document.getElementById('formMethod').value = 'POST';
|
||||
document.getElementById('questionId').value = '';
|
||||
document.getElementById('optionsSection').classList.add('d-none');
|
||||
|
||||
const list = document.getElementById('optionsList');
|
||||
list.innerHTML = `<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 1">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 2">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>`;
|
||||
// Clear rating labels
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
const el = document.getElementById('ratingLabel' + i);
|
||||
if (el) el.value = '';
|
||||
}
|
||||
document.getElementById('parentId').value = '';
|
||||
onTypeChange();
|
||||
document.getElementById('optionsList').innerHTML = `
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 1">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>
|
||||
<div class="input-group input-group-sm mb-2">
|
||||
<input type="text" name="options[]" class="form-control" placeholder="Pilihan 2">
|
||||
<button type="button" class="btn btn-outline-danger" onclick="removeOption(this)"><i class="bi bi-x"></i></button>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// ── Drag & Drop ──────────────────────────────────────────────────────────────
|
||||
|
||||
function sendReorder(order, parentId) {
|
||||
fetch(reorderUrl, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': csrfToken },
|
||||
body: JSON.stringify({ order: order, parent_id: parentId }),
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Init: show sections for default type (tajuk)
|
||||
onTypeChange();
|
||||
|
||||
// Top-level sortable — sorts tajuk blocks + standalone questions
|
||||
const topList = document.getElementById('questionList');
|
||||
if (topList) {
|
||||
Sortable.create(topList, {
|
||||
animation: 150,
|
||||
handle: '.drag-handle-top',
|
||||
ghostClass: 'sortable-ghost',
|
||||
onEnd: function() {
|
||||
const order = [...topList.querySelectorAll(':scope > [data-id]')].map(el => +el.dataset.id);
|
||||
sendReorder(order, null);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Per-tajuk sortable — sorts rating children within a group
|
||||
document.querySelectorAll('.children-list').forEach(function(list) {
|
||||
Sortable.create(list, {
|
||||
animation: 150,
|
||||
handle: '.drag-handle-child',
|
||||
ghostClass: 'sortable-ghost',
|
||||
onEnd: function() {
|
||||
const parentId = +list.dataset.parentId;
|
||||
const order = [...list.querySelectorAll(':scope > [data-id]')].map(el => +el.dataset.id);
|
||||
sendReorder(order, parentId);
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -1,25 +1,67 @@
|
||||
<x-guest-layout>
|
||||
<div class="mb-4 text-sm text-gray-600">
|
||||
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="ms">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Terlupa Kata Laluan — eCert MBIP</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<style>
|
||||
body { background: linear-gradient(135deg, #1a56a0 0%, #2563eb 100%); min-height: 100vh; }
|
||||
.card { border-radius: 1rem; border: none; box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-width: 420px; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="d-flex align-items-center justify-content-center py-5">
|
||||
<div class="w-100 px-3">
|
||||
<div class="text-center mb-4">
|
||||
<i class="bi bi-award-fill text-white" style="font-size: 3rem;"></i>
|
||||
<h4 class="text-white fw-bold mt-2 mb-0">eCert MBIP</h4>
|
||||
<small class="text-white opacity-75">Sistem Pengurusan Sijil Digital</small>
|
||||
</div>
|
||||
|
||||
<div class="card mx-auto">
|
||||
<div class="card-body p-4">
|
||||
<h5 class="card-title fw-semibold mb-1">Terlupa Kata Laluan?</h5>
|
||||
<p class="text-muted small mb-4">
|
||||
Masukkan alamat emel anda dan kami akan hantar pautan untuk menetapkan semula kata laluan.
|
||||
</p>
|
||||
|
||||
@if(session('status'))
|
||||
<div class="alert alert-success small">
|
||||
<i class="bi bi-check-circle me-1"></i>{{ session('status') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label fw-medium">Alamat Emel</label>
|
||||
<input id="email" type="email" name="email"
|
||||
value="{{ old('email') }}" required autofocus autocomplete="email"
|
||||
class="form-control @error('email') is-invalid @enderror"
|
||||
placeholder="admin@mbip.gov.my">
|
||||
@error('email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn w-100 text-white fw-semibold mb-3"
|
||||
style="background: var(--mbip-primary, #1a56a0);">
|
||||
<i class="bi bi-send me-1"></i> Hantar Pautan Reset
|
||||
</button>
|
||||
|
||||
<div class="text-center">
|
||||
<a href="{{ route('login') }}" class="small text-decoration-none text-muted">
|
||||
<i class="bi bi-arrow-left me-1"></i> Kembali ke Log Masuk
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
<small class="text-white opacity-60">Majlis Bandaraya Ipoh Perak © {{ date('Y') }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="mb-4" :status="session('status')" />
|
||||
|
||||
<form method="POST" action="{{ route('password.email') }}">
|
||||
@csrf
|
||||
|
||||
<!-- Email Address -->
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('Email')" />
|
||||
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
|
||||
<x-input-error :messages="$errors->get('email')" class="mt-2" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end mt-4">
|
||||
<x-primary-button>
|
||||
{{ __('Email Password Reset Link') }}
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-guest-layout>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,39 +1,83 @@
|
||||
<x-guest-layout>
|
||||
<form method="POST" action="{{ route('password.store') }}">
|
||||
@csrf
|
||||
|
||||
<!-- Password Reset Token -->
|
||||
<input type="hidden" name="token" value="{{ $request->route('token') }}">
|
||||
|
||||
<!-- Email Address -->
|
||||
<div>
|
||||
<x-input-label for="email" :value="__('Email')" />
|
||||
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus autocomplete="username" />
|
||||
<x-input-error :messages="$errors->get('email')" class="mt-2" />
|
||||
<!DOCTYPE html>
|
||||
<html lang="ms">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Tetapkan Semula Kata Laluan — eCert MBIP</title>
|
||||
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<style>
|
||||
body { background: linear-gradient(135deg, #1a56a0 0%, #2563eb 100%); min-height: 100vh; }
|
||||
.card { border-radius: 1rem; border: none; box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-width: 420px; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="d-flex align-items-center justify-content-center py-5">
|
||||
<div class="w-100 px-3">
|
||||
<div class="text-center mb-4">
|
||||
<i class="bi bi-award-fill text-white" style="font-size: 3rem;"></i>
|
||||
<h4 class="text-white fw-bold mt-2 mb-0">eCert MBIP</h4>
|
||||
<small class="text-white opacity-75">Sistem Pengurusan Sijil Digital</small>
|
||||
</div>
|
||||
|
||||
<!-- Password -->
|
||||
<div class="mt-4">
|
||||
<x-input-label for="password" :value="__('Password')" />
|
||||
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
|
||||
<x-input-error :messages="$errors->get('password')" class="mt-2" />
|
||||
<div class="card mx-auto">
|
||||
<div class="card-body p-4">
|
||||
<h5 class="card-title fw-semibold mb-1">Tetapkan Semula Kata Laluan</h5>
|
||||
<p class="text-muted small mb-4">Masukkan kata laluan baru untuk akaun anda.</p>
|
||||
|
||||
<form method="POST" action="{{ route('password.store') }}">
|
||||
@csrf
|
||||
<input type="hidden" name="token" value="{{ $request->route('token') }}">
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label fw-medium">Alamat Emel</label>
|
||||
<input id="email" type="email" name="email"
|
||||
value="{{ old('email', $request->email) }}" required autofocus autocomplete="username"
|
||||
class="form-control @error('email') is-invalid @enderror"
|
||||
placeholder="admin@mbip.gov.my">
|
||||
@error('email')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label fw-medium">Kata Laluan Baru</label>
|
||||
<input id="password" type="password" name="password"
|
||||
required autocomplete="new-password"
|
||||
class="form-control @error('password') is-invalid @enderror"
|
||||
placeholder="Min. 8 aksara">
|
||||
@error('password')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="password_confirmation" class="form-label fw-medium">Sahkan Kata Laluan Baru</label>
|
||||
<input id="password_confirmation" type="password" name="password_confirmation"
|
||||
required autocomplete="new-password"
|
||||
class="form-control @error('password_confirmation') is-invalid @enderror"
|
||||
placeholder="••••••••">
|
||||
@error('password_confirmation')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn w-100 text-white fw-semibold mb-3"
|
||||
style="background: var(--mbip-primary, #1a56a0);">
|
||||
<i class="bi bi-key me-1"></i> Tetapkan Semula Kata Laluan
|
||||
</button>
|
||||
|
||||
<div class="text-center">
|
||||
<a href="{{ route('login') }}" class="small text-decoration-none text-muted">
|
||||
<i class="bi bi-arrow-left me-1"></i> Kembali ke Log Masuk
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Confirm Password -->
|
||||
<div class="mt-4">
|
||||
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
|
||||
|
||||
<x-text-input id="password_confirmation" class="block mt-1 w-full"
|
||||
type="password"
|
||||
name="password_confirmation" required autocomplete="new-password" />
|
||||
|
||||
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
|
||||
<div class="text-center mt-3">
|
||||
<small class="text-white opacity-60">Majlis Bandaraya Ipoh Perak © {{ date('Y') }}</small>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end mt-4">
|
||||
<x-primary-button>
|
||||
{{ __('Reset Password') }}
|
||||
</x-primary-button>
|
||||
</div>
|
||||
</form>
|
||||
</x-guest-layout>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -66,6 +66,12 @@
|
||||
<span class="badge {{ auth()->user()->isSuperAdmin() ? 'bg-danger' : 'bg-primary' }} mb-2 d-inline-block">
|
||||
{{ auth()->user()->isSuperAdmin() ? 'Super Admin' : 'Admin Program' }}
|
||||
</span>
|
||||
<div class="d-flex gap-2 mb-2">
|
||||
<a href="{{ route('admin.profile.show') }}"
|
||||
class="btn btn-sm btn-outline-light flex-grow-1 {{ request()->routeIs('admin.profile.*') ? 'active' : '' }}">
|
||||
<i class="bi bi-person-gear me-1"></i> Profil
|
||||
</a>
|
||||
</div>
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit" class="btn btn-sm btn-outline-light w-100">
|
||||
|
||||
@@ -26,13 +26,54 @@
|
||||
<form method="POST" action="{{ route('public.questionnaire.submit', [$qrCode->token, $participant->uuid]) }}">
|
||||
@csrf
|
||||
|
||||
@php $qNum = 0; @endphp
|
||||
|
||||
@foreach($questions as $q)
|
||||
|
||||
@if($q->question_type === 'tajuk')
|
||||
{{-- ── Section header ─────────────────────────────── --}}
|
||||
<div class="d-flex align-items-center gap-2 mt-4 mb-3 pb-1 border-bottom">
|
||||
<span class="fw-bold text-primary">{{ $q->question_text }}</span>
|
||||
</div>
|
||||
|
||||
@foreach($q->children as $child)
|
||||
@php $qNum++ @endphp
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-medium">
|
||||
{{ $loop->iteration }}. {{ $q->question_text }}
|
||||
@if($q->is_required)
|
||||
<span class="text-danger">*</span>
|
||||
@endif
|
||||
{{ $qNum }}. {{ $child->question_text }}
|
||||
@if($child->is_required)<span class="text-danger">*</span>@endif
|
||||
</label>
|
||||
|
||||
@error('q_' . $child->id)
|
||||
<div class="text-danger small mb-1"><i class="bi bi-exclamation-circle me-1"></i>{{ $message }}</div>
|
||||
@enderror
|
||||
|
||||
<div class="d-flex gap-3 flex-wrap">
|
||||
@for($i = 1; $i <= 5; $i++)
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio"
|
||||
name="q_{{ $child->id }}" id="q{{ $child->id }}_{{ $i }}"
|
||||
value="{{ $i }}" {{ old('q_'.$child->id) == $i ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="q{{ $child->id }}_{{ $i }}">
|
||||
{{ $i }}
|
||||
@php $label = $q->rating_labels[$i] ?? $q->rating_labels[strval($i)] ?? ''; @endphp
|
||||
@if($label)
|
||||
<small class="text-muted d-block" style="font-size:.7rem;">({{ $label }})</small>
|
||||
@endif
|
||||
</label>
|
||||
</div>
|
||||
@endfor
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
|
||||
@else
|
||||
{{-- ── Standalone question ─────────────────────────── --}}
|
||||
@php $qNum++ @endphp
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-medium">
|
||||
{{ $qNum }}. {{ $q->question_text }}
|
||||
@if($q->is_required)<span class="text-danger">*</span>@endif
|
||||
</label>
|
||||
|
||||
@error('q_' . $q->id)
|
||||
@@ -40,7 +81,7 @@
|
||||
@enderror
|
||||
|
||||
@if($q->question_type === 'rating')
|
||||
<div class="d-flex gap-2 flex-wrap">
|
||||
<div class="d-flex gap-3 flex-wrap">
|
||||
@for($i = 1; $i <= 5; $i++)
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio"
|
||||
@@ -48,8 +89,8 @@
|
||||
value="{{ $i }}" {{ old('q_'.$q->id) == $i ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="q{{ $q->id }}_{{ $i }}">
|
||||
{{ $i }}
|
||||
@if($i === 1) <small class="text-muted">(Sangat Tidak Setuju)</small>
|
||||
@elseif($i === 5) <small class="text-muted">(Sangat Setuju)</small>
|
||||
@if($i === 1)<small class="text-muted">(Sangat Tidak Setuju)</small>
|
||||
@elseif($i === 5)<small class="text-muted">(Sangat Setuju)</small>
|
||||
@endif
|
||||
</label>
|
||||
</div>
|
||||
@@ -80,8 +121,7 @@
|
||||
@elseif($q->question_type === 'short_text')
|
||||
<input type="text" name="q_{{ $q->id }}"
|
||||
class="form-control @error('q_'.$q->id) is-invalid @enderror"
|
||||
value="{{ old('q_'.$q->id) }}"
|
||||
placeholder="Jawapan anda...">
|
||||
value="{{ old('q_'.$q->id) }}" placeholder="Jawapan anda...">
|
||||
|
||||
@elseif($q->question_type === 'long_text')
|
||||
<textarea name="q_{{ $q->id }}" rows="4"
|
||||
@@ -89,6 +129,8 @@
|
||||
placeholder="Jawapan anda...">{{ old('q_'.$q->id) }}</textarea>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 btn-checkin">
|
||||
|
||||
Reference in New Issue
Block a user