diff --git a/app/Livewire/Reporting/StudySelection.php b/app/Livewire/Reporting/StudySelection.php index bb411f04a..82603737c 100644 --- a/app/Livewire/Reporting/StudySelection.php +++ b/app/Livewire/Reporting/StudySelection.php @@ -12,6 +12,9 @@ class StudySelection extends Component { public $currentProject; + public $selected_criterias = []; + public $criterias = []; + public function mount() { @@ -20,8 +23,31 @@ public function mount() // Busca o projeto e lança uma exceção se não for encontrado $this->currentProject = ProjectModel::findOrFail($projectId); + + // Carrega os critérios do banco de dados + $this->criterias = EvaluationCriteria::all()->keyBy('id')->toArray(); + } + + public function changePreSelected($criteriaId, $type) + { + if (!isset($this->criterias[$criteriaId])) { + return; + } + + // Aqui você pode definir alguma lógica específica para o tipo do critério + if ($type === 'Inclusion') { + // Exemplo: faz algo se for um critério de inclusão + } else { + // Exemplo: faz algo diferente para outro tipo + } + + // Apenas como exemplo, armazenamos o critério como "selecionado" + if (!in_array($criteriaId, $this->selected_criterias)) { + $this->selected_criterias[] = $criteriaId; + } } + public function getPapersPerStatusSelection() { // Consulta para pegar os papers vinculados ao projeto corrente, agrupados por status de seleção @@ -35,7 +61,7 @@ public function getPapersPerStatusSelection() ->get(); // Mapear os resultados para o formato necessário - return $papers->map(function($paper) { + return $papers->map(function ($paper) { return [ 'name' => $paper->status_description, 'y' => (int) $paper->total // Total de papers por status @@ -119,6 +145,6 @@ public function render() // Obtenha os dados de critérios por usuário $criteriaData = $this->getCriteriaPerUser(); - return view('livewire.reporting.study-selection', compact('papersPerStatus','criteriaData','papersByUserAndStatus')); + return view('livewire.reporting.study-selection', compact('papersPerStatus', 'criteriaData', 'papersByUserAndStatus')); } } 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 af9a597ad..b73630465 100644 --- a/resources/views/livewire/conducting/study-selection/paper-modal.blade.php +++ b/resources/views/livewire/conducting/study-selection/paper-modal.blade.php @@ -14,8 +14,7 @@
- @livewire('conducting.study-selection.paper-authors', ['paperId' => $paper['id_paper'], - 'projectId' => $this->projectId], key($paper['id_paper'])) + @livewire('conducting.study-selection.paper-authors', ['paperId' => $paper['id_paper'], 'projectId' => $this->projectId], key($paper['id_paper']))
{{ __('project/conducting.study-selection.modal.year' )}}: @@ -36,7 +35,9 @@ URL - @@ -57,16 +58,11 @@ - + - - + + + @@ -75,10 +71,11 @@ @@ -89,6 +86,7 @@
- {{ __('project/conducting.study-selection.modal.table.select' )}} - {{ __('project/conducting.study-selection.modal.table.select' )}} ID - {{ __('project/conducting.study-selection.modal.table.description' )}} - - {{ __('project/conducting.study-selection.modal.table.type' )}} - {{ __('project/conducting.study-selection.modal.table.description' )}}{{ __('project/conducting.study-selection.modal.table.type' )}}
+ wire:model.defer="selected_criterias" + value="{{ $criteria['id_criteria'] }}" + @if(in_array($criteria['id_criteria'], $selected_criterias)) checked @endif + @if(!$canEdit) disabled @endif + > {{ $criteria['id'] }} {{ $criteria['description'] }}

+