Skip to content

Commit

Permalink
fix: preserve state of prerequisite adder even formstep changes for c…
Browse files Browse the repository at this point in the history
…ourse create
  • Loading branch information
IsharaEkanayaka authored and NuwanJ committed Oct 24, 2024
1 parent 0fae926 commit 2135f7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 4 additions & 2 deletions app/Http/Livewire/Backend/PrerequisiteSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public function courseRemoved($courseId)
$this->emit('prerequisitesUpdated', $this->selectedCourses);
}

public function mount($courseId = null)
public function mount($courseId = null, $prerequisites = null)
{
$this->courseId = $courseId;
$this->selectedCourses = $prerequisites;


if ($this->courseId != null) {
// Fetch existing prerequisites from the database
Expand Down Expand Up @@ -76,4 +78,4 @@ public function render()
'filteredAvailableCourses' => $filteredAvailableCourses,
]);
}
}
}
11 changes: 4 additions & 7 deletions resources/views/livewire/backend/create-courses.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
{{-- Academic Program --}}
<div class="col-12 col-sm-6 py-2">
<div class="col ps-0">
<label for="drop1">
<label for="dropAcademicProgram">
Academic Program*
<label for="dropAcademicProgram">
Academic Program
</label>
</label>
</div>
<select id="dropAcademicProgram" name="dropAcademicProgram" class="form-select"
wire:model="academicProgram">
Expand Down Expand Up @@ -217,9 +215,8 @@
Prerequisites:
<hr>
</div>
@livewire('backend.prerequisite-selector', ['academic_program' => $academicProgram, 'version' => $version, 'semester' => $semester])

<div class="h4 font-weight-bold mt-5">
@livewire('backend.prerequisite-selector', ['academic_program' => $academicProgram, 'version' => $version, 'semester' => $semester, 'prerequisites' => $prerequisites])
<div class="h4 font-weight-bold">
ILOs:
<hr>
</div>
Expand Down

0 comments on commit 2135f7d

Please sign in to comment.