Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.2-fpm

# set your user name, ex: user=bernardo
ARG user=thoth
Expand Down
14 changes: 14 additions & 0 deletions app/Livewire/Conducting/DataExtraction/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Buttons extends Component
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;
public $hasPapers = false;


protected function messages()
Expand Down Expand Up @@ -204,10 +205,23 @@ private function formatPdf($papers)
public function mount()
{
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.conducting.data-extraction.buttons');
}
}
75 changes: 75 additions & 0 deletions app/Livewire/Conducting/DataExtraction/FileUpload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace App\Http\Livewire\Conducting\DataExtraction;

use App\Models\Project;
use App\Models\Member;
use App\Models\BibUpload;
use App\Jobs\ProcessBibUpload;
use App\Rules\ValidBibFile;
use Livewire\Component;
use Livewire\WithFileUploads;

class FileUpload extends Component
{
use WithFileUploads;

public $file;
public $project;
public $member;

public function rules()
{
return [
'file' => ['required', 'file', 'max:10240', new ValidBibFile],
];
}

public function mount()
{
$this->project = Project::findOrFail(session('project_id'));
$this->member = Member::where('user_id', auth()->id())
->where('project_id', $this->project->id)
->firstOrFail();
}

public function updatedFile()
{
$this->validateOnly('file');
}

public function save()
{
$this->validate();

try {
$file = $this->file;
$mimeType = $file->getMimeType();
$extension = $file->getClientOriginalExtension();

if (!in_array($extension, ['bib', 'csv']) ||
(!str_starts_with($mimeType, 'text/') && $mimeType !== 'application/csv')) {
throw new \Exception('Apenas arquivos .bib e .csv são permitidos.');
}

$fileName = time() . '_' . $file->getClientOriginalName();
$file->storeAs('uploads', $fileName, 'public');

$bibUpload = BibUpload::create([
'project_id' => $this->project->id,
'member_id' => $this->member->id,
'file_name' => $fileName,
'file_path' => 'uploads/' . $fileName,
'file_type' => $extension,
'status' => 'pending'
]);

ProcessBibUpload::dispatch($bibUpload);

$this->emit('toast', 'success', 'Arquivo enviado com sucesso!');
$this->reset('file');
} catch (\Exception $e) {
$this->emit('toast', 'error', $e->getMessage());
}
}
}
9 changes: 8 additions & 1 deletion app/Livewire/Conducting/DataExtraction/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,14 @@ public function render()

}

return view('livewire.conducting.data-extraction.table', compact('papers', 'databases', 'statuses'));
// Emitir evento para atualizar o estado dos botões
$this->dispatch('papers-updated', hasPapers: $papers->isNotEmpty());

return view('livewire.conducting.data-extraction.table', [
'papers' => $papers,
'databases' => $databases,
'statuses' => $statuses,
]);
}

}
21 changes: 21 additions & 0 deletions app/Livewire/Conducting/QualityAssessment/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use TCPDF;
use Illuminate\Support\Facades\View;
use App\Utils\ToastHelper;
use Livewire\Attributes\On;


class Buttons extends Component
Expand All @@ -21,6 +22,7 @@ class Buttons extends Component
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;
public $hasPapers = false;


protected function messages()
Expand Down Expand Up @@ -223,10 +225,29 @@ private function formatPdf($papers)
public function mount()
{
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.conducting.quality-assessment.buttons');
}

#[On('papers-updated')]
public function updatePapersAvailability($hasPapers)
{
$this->hasPapers = $hasPapers;
}
}
4 changes: 4 additions & 0 deletions app/Livewire/Conducting/QualityAssessment/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ public function render()
}
// Passa se o membro é administrador/pesquisador
$isAdministrator = $member->level == 1 || $member->level == 3;

// Emitir evento para atualizar o estado dos botões
$this->dispatch('papers-updated', hasPapers: $papers->isNotEmpty());

return view('livewire.conducting.quality-assessment.table', compact('papers', 'databases', 'statuses','isAdministrator'));
}

Expand Down
21 changes: 21 additions & 0 deletions app/Livewire/Conducting/Snowballing/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Livewire\Component;
use TCPDF;
use App\Utils\ToastHelper;
use Livewire\Attributes\On;


class Buttons extends Component
Expand All @@ -20,6 +21,7 @@ class Buttons extends Component
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;
public $hasPapers = false;


protected function messages()
Expand Down Expand Up @@ -200,10 +202,29 @@ private function formatPdf($papers)

public function mount() {
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.conducting.snowballing.buttons');
}

#[On('papers-updated')]
public function updatePapersAvailability($hasPapers)
{
$this->hasPapers = $hasPapers;
}
}
3 changes: 3 additions & 0 deletions app/Livewire/Conducting/Snowballing/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ public function render()
}
}

// Emitir evento para atualizar o estado dos botões
$this->dispatch('papers-updated', hasPapers: $papers->isNotEmpty());

return view('livewire.conducting.snowballing.table', compact('papers', 'databases', 'statuses'));
}

Expand Down
20 changes: 20 additions & 0 deletions app/Livewire/Conducting/StudySelection/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use TCPDF;
use Illuminate\Support\Facades\View;
use App\Utils\ToastHelper;
use Livewire\Attributes\On;


class Buttons extends Component
Expand All @@ -27,6 +28,7 @@ class Buttons extends Component
public $exactDuplicateCount = 0;

public $totalDuplicates = 0;
public $hasPapers = false;

protected function messages()
{
Expand Down Expand Up @@ -515,11 +517,29 @@ private function formatPdf($papers)

public function mount() {
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.conducting.study-selection.buttons');
}

#[On('papers-updated')]
public function updatePapersAvailability($hasPapers)
{
$this->hasPapers = $hasPapers;
}
}
4 changes: 4 additions & 0 deletions app/Livewire/Conducting/StudySelection/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ public function render()
}
// Passa se o membro é administrador/pesquisador
$isAdministrator = $member->level == 1 || $member->level == 3;

// Emitir evento para atualizar o estado dos botões
$this->dispatch('papers-updated', hasPapers: $papers->isNotEmpty());

return view('livewire.conducting.study-selection.table', compact('papers', 'databases', 'statuses','isAdministrator'));
}

Expand Down
21 changes: 21 additions & 0 deletions app/Livewire/Reporting/PeerReviewQualityButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
use Livewire\Component;
use TCPDF;
use Illuminate\Support\Facades\View;
use Livewire\Attributes\On;


class PeerReviewQualityButtons extends Component
{

public $projectId;
public $hasPapers = false;


public function exportCsv()
Expand Down Expand Up @@ -170,10 +172,29 @@ private function formatPdf($papers)

public function mount() {
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.reporting.peer-review-quality-buttons');
}

#[On('papers-updated')]
public function updatePapersAvailability($hasPapers)
{
$this->hasPapers = $hasPapers;
}
}
20 changes: 20 additions & 0 deletions app/Livewire/Reporting/PeerReviewSelectionButtons.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use TCPDF;
use Illuminate\Support\Facades\View;
use App\Utils\ToastHelper;
use Livewire\Attributes\On;


class PeerReviewSelectionButtons extends Component
Expand All @@ -23,6 +24,7 @@ class PeerReviewSelectionButtons extends Component
public $exactDuplicateCount = 0;

public $totalDuplicates = 0;
public $hasPapers = false;

private function translate(string $message, string $key = 'duplicates')
{
Expand Down Expand Up @@ -461,11 +463,29 @@ private function formatPdf($papers)

public function mount() {
$this->projectId = request()->segment(2);
$this->checkPapersAvailability();
}

public function checkPapersAvailability()
{
try {
$papers = $this->getPapersExport();
$this->hasPapers = $papers->isNotEmpty();
} catch (\Exception $e) {
$this->hasPapers = false;
}
}

public function render()
{
// Verificar novamente se existem papers disponíveis antes de renderizar
$this->checkPapersAvailability();
return view('livewire.reporting.peer-review-selection-buttons');
}

#[On('papers-updated')]
public function updatePapersAvailability($hasPapers)
{
$this->hasPapers = $hasPapers;
}
}
Loading