diff --git a/app/Livewire/Conducting/StudySelection/PaperModal.php b/app/Livewire/Conducting/StudySelection/PaperModal.php index 1bf5d3b7..5abf3d30 100644 --- a/app/Livewire/Conducting/StudySelection/PaperModal.php +++ b/app/Livewire/Conducting/StudySelection/PaperModal.php @@ -42,7 +42,6 @@ public function mount() $this->projectId = request()->segment(2); $this->currentProject = Project::findOrFail($this->projectId); } - #[On('showPaper')] public function showPaper($paper, $criterias) { @@ -309,6 +308,23 @@ private function determineNewStatus($inclusion, $exclusion, $old_status) } } + + public function nextPaper(){ + $this->paper = Papers::where('id_paper', '>', $this->paper['id_paper']) + ->where('data_base', $this->paper['data_base']) + ->orderBy('id_paper') + ->first(); + + if ($this->paper) { + $this->dispatch('close-paper'); + + $this->showPaper($this->paper, $this->criterias); + } else { + session()->flash('errorMessage', 'No more papers available.'); + } + } + + public function render() { return view('livewire.conducting.study-selection.paper-modal'); diff --git a/resources/views/livewire/conducting/study-selection/paper-modal.blade.php b/resources/views/livewire/conducting/study-selection/paper-modal.blade.php index f8fb4dd2..16c66d9c 100644 --- a/resources/views/livewire/conducting/study-selection/paper-modal.blade.php +++ b/resources/views/livewire/conducting/study-selection/paper-modal.blade.php @@ -140,6 +140,14 @@ +