Fixed quiz

This commit is contained in:
m.razaghi
2026-08-07 21:30:03 +03:30
parent d705c7c56d
commit bb69e7f953
4 changed files with 131 additions and 0 deletions

View File

@@ -60,6 +60,13 @@
</a>
</li>
<li>
<a href="{{ route('quiz-subjects.index') }}" class="waves-effect">
<i class="mdi mdi-book-open-page-variant"></i>
<span>مدیریت دروس</span>
</a>
</li>
<li>
<a href="javascript:%20void(0);" class="has-arrow waves-effect">

View File

@@ -0,0 +1,77 @@
@extends('admin.layouts.app')
@section('content')
<div class="row">
<!-- Form to Add Subject -->
<div class="col-lg-4">
<div class="card">
<div class="card-header bg-primary text-white">
<h6 class="mb-0 text-white">افزودن درس جدید</h6>
</div>
<div class="card-body">
@if ($errors->any())
<div class="alert alert-danger">
<ul class="mb-0">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('quiz-subjects.store') }}" method="POST">
@csrf
<div class="mb-3">
<label class="form-label">عنوان درس <span class="text-danger">*</span></label>
<input type="text" name="title" class="form-control" value="{{ old('title') }}" placeholder="مثال: حقوق مدنی" required>
</div>
<button type="submit" class="btn btn-success w-100">ثبت درس</button>
</form>
</div>
</div>
</div>
<!-- List of Subjects -->
<div class="col-lg-8">
<div class="card">
<div class="card-body">
<h5 class="card-title mb-4">دروس ثبت شده</h5>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>عنوان درس</th>
<th>تعداد سوالات مرتبط</th>
<th>عملیات</th>
</tr>
</thead>
<tbody>
@forelse($subjects as $subject)
<tr>
<td><strong>{{ $subject->title }}</strong></td>
<td>
<span class="badge bg-soft-info text-info">{{ $subject->questions_count }} سوال</span>
</td>
<td>
<form action="{{ route('quiz-subjects.destroy', $subject->id) }}" method="POST" class="d-inline" onsubmit="return confirm('آیا از حذف این درس اطمینان دارید؟')">
@csrf
@method('DELETE')
<button class="btn btn-sm btn-outline-danger">حذف</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="3" class="text-center py-3">هیچ درسی یافت نشد.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection