77 lines
3.3 KiB
PHP
77 lines
3.3 KiB
PHP
@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 |