web-mooc/resources/views/admin/project/edit.blade.php
2026-02-03 09:00:31 +07:00

64 lines
2.7 KiB
PHP

@php
$project = App\Models\Lesson::join('sections', 'lessons.section_id', 'sections.id')
->join('courses', 'sections.course_id', 'courses.id')
->select('lessons.*', 'courses.id as course_id')
->where('lessons.id', $id)
->first();
@endphp
<form action="{{ route('admin.course.project.update', $id) }}" method="post">@csrf
{{-- FIX: Pass the course_id back to the controller --}}
<input type="hidden" name="course_id" value="{{ $project->course_id }}">
<div class="fpb7 mb-3">
<label class="form-label ol-form-label" for="title">
{{ get_phrase('Title') }}
<span class="text-danger ms-1">*</span>
</label>
<input class="form-control ol-form-control" type="text" id="title" name="title" value="{{ $project->title }}"
required>
</div>
<div class="row mb-3">
<div class="col-sm-12 fpb-7">
<label class="form-label ol-form-label">
{{ get_phrase('Section') }}
<span class="text-danger ms-1">*</span>
</label>
<select class="form-control ol-form-control ol-select2" data-toggle="select2" name="section" required>
<option value="">{{ get_phrase('Select an option') }}</option>
@foreach (App\Models\Section::where('course_id', $project->course_id)->get() as $section)
<option value="{{ $section->id }}" @if ($section->id == $project->section_id) selected @endif>
{{ $section->title }}</option>
@endforeach
</select>
</div>
</div>
<div class="fpb-7 mb-3">
<label for="description"
class="form-label ol-form-label col-form-label">{{ get_phrase('Project Assignment') }}</label>
<textarea name="description" rows="5" class="form-control ol-form-control text_editor">{!! $project->description !!}</textarea>
</div>
<div class="fpb-7 mb-3">
<label for="attachment"
class="form-label ol-form-label col-form-label">{{ get_phrase('Assessment Criteria') }}</label>
{{-- Ensure your Controller handles $request->attachment --}}
<textarea name="attachment" rows="5" class="form-control ol-form-control text_editor">{!! $project->attachment !!}</textarea>
</div>
<div class="fpb-7 mb-6">
<label for="summary"
class="form-label ol-form-label col-form-label">{{ get_phrase('Summary') }}</label>
<textarea name="summary" rows="5" class="form-control ol-form-control text_editor">{!! $project->summary !!}</textarea>
</div>
<div class="fpb7">
<button type="submit" class="btn ol-btn-primary">{{ get_phrase('Update Project') }}</button>
</div>
</form>
@include('admin.init')