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
62 changes: 55 additions & 7 deletions app/Livewire/Conducting/DataExtraction/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,58 @@
class Buttons extends Component
{

private $translationPath = 'project/conducting.data-extraction.buttons';
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;


protected function messages()
{
return [
'no-papers' => __($this->translationPath . '.no-papers'),
];
}

public function toast(string $message, string $type)
{
$this->dispatch('buttons', ToastHelper::dispatch($type, $message));
}

public function exportCsv()
{
$papers = $this->getPapersExport($this->projectId);
$papers = $this->getPapersExport();

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$csvData = $this->formatCsv($papers);
return response()->streamDownload(function() use ($csvData) {
return response()->streamDownload(function () use ($csvData) {
echo $csvData;
}, 'studies-extraction.csv');
}

public function exportXml()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$xmlData = $this->formatXml($papers);
return response()->streamDownload(function() use ($xmlData) {
return response()->streamDownload(function () use ($xmlData) {
echo $xmlData;
}, 'studies-extraction.xml');
}
Expand All @@ -41,8 +76,18 @@ public function exportPdf()
{

$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$pdfData = $this->formatPdf($papers);
return response()->streamDownload(function() use ($pdfData) {
return response()->streamDownload(function () use ($pdfData) {
echo $pdfData;
}, 'studies-extraction.pdf');
}
Expand Down Expand Up @@ -82,13 +127,15 @@ private function getPapersExport()
->where('papers.status_qa', 1)
->where('papers_qa.id_member', $member->id_members)
->distinct()
->select('papers.id as id_paper',
->select(
'papers.id as id_paper',
'papers.title',
'papers.year',
'data_base.name as database_name',
'users.firstname',
'users.lastname',
'status_extraction.description as status_description')
'status_extraction.description as status_description'
)
->get();
}

Expand Down Expand Up @@ -154,7 +201,8 @@ private function formatPdf($papers)
}


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

Expand Down
62 changes: 55 additions & 7 deletions app/Livewire/Conducting/QualityAssessment/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,58 @@
class Buttons extends Component
{

private $translationPath = 'project/conducting.data-extraction.buttons';
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;


protected function messages()
{
return [
'no-papers' => __($this->translationPath . '.no-papers'),
];
}

public function toast(string $message, string $type)
{
$this->dispatch('buttons', ToastHelper::dispatch($type, $message));
}

public function exportCsv()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$csvData = $this->formatCsv($papers);
return response()->streamDownload(function() use ($csvData) {
return response()->streamDownload(function () use ($csvData) {
echo $csvData;
}, 'studies-qa.csv');
}

public function exportXml()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$xmlData = $this->formatXml($papers);
return response()->streamDownload(function() use ($xmlData) {
return response()->streamDownload(function () use ($xmlData) {
echo $xmlData;
}, 'studies-qa.xml');
}
Expand All @@ -42,8 +77,18 @@ public function exportPdf()
{

$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$pdfData = $this->formatPdf($papers);
return response()->streamDownload(function() use ($pdfData) {
return response()->streamDownload(function () use ($pdfData) {
echo $pdfData;
}, 'studies-qa.pdf');
}
Expand All @@ -70,17 +115,19 @@ private function getPapersExport()
->join('members', 'members.id_members', '=', 'papers_qa.id_member')
->join('users', 'members.id_user', '=', 'users.id')
->join('papers_selection', 'papers_selection.id_paper', '=', 'papers_qa.id_paper')
->select('papers.*',
->select(
'papers.*',
'papers.id as id_paper',
'data_base.name as database_name',
'general_score.description as general_score',
'papers_qa.id_status as id_status_quality',
'users.firstname',
'users.lastname',
'paper_decision_conflicts.new_status_paper',
'status_qa.status as status_description')
'status_qa.status as status_description'
)

->leftJoin('paper_decision_conflicts', function($join) {
->leftJoin('paper_decision_conflicts', function ($join) {
$join->on('papers.id_paper', '=', 'paper_decision_conflicts.id_paper')
->where('paper_decision_conflicts.phase', '=', 'quality'); // Filtrar pela fase 'quality'
})
Expand Down Expand Up @@ -173,7 +220,8 @@ private function formatPdf($papers)
}


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

Expand Down
46 changes: 46 additions & 0 deletions app/Livewire/Conducting/Snowballing/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,38 @@
class Buttons extends Component
{

private $translationPath = 'project/conducting.data-extraction.buttons';
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;


protected function messages()
{
return [
'no-papers' => __($this->translationPath . '.no-papers'),
];
}

public function toast(string $message, string $type)
{
$this->dispatch('buttons', ToastHelper::dispatch($type, $message));
}


public function exportCsv()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$csvData = $this->formatCsv($papers);
return response()->streamDownload(function() use ($csvData) {
echo $csvData;
Expand All @@ -31,6 +57,16 @@ public function exportCsv()
public function exportXml()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$xmlData = $this->formatXml($papers);
return response()->streamDownload(function() use ($xmlData) {
echo $xmlData;
Expand All @@ -41,6 +77,16 @@ public function exportPdf()
{

$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$pdfData = $this->formatPdf($papers);
return response()->streamDownload(function() use ($pdfData) {
echo $pdfData;
Expand Down
41 changes: 41 additions & 0 deletions app/Livewire/Conducting/StudySelection/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,24 @@

class Buttons extends Component
{

private $translationPath = 'project/conducting.data-extraction.buttons';
private $toastMessages = 'project/conducting.data-extraction.buttons';

public $projectId;
public $duplicates = []; // Armazena os papers duplicados organizados por título
public $uniquePapers = [];
public $exactDuplicateCount = 0;

public $totalDuplicates = 0;

protected function messages()
{
return [
'no-papers' => __($this->translationPath . '.no-papers'),
];
}

private function translate(string $message, string $key = 'duplicates')
{
return __('project/conducting.study-selection.' . $key . '.' . $message);
Expand Down Expand Up @@ -295,6 +306,16 @@ public function toast(string $message, string $type)
public function exportCsv()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$csvData = $this->formatCsv($papers);
return response()->streamDownload(function() use ($csvData) {
echo $csvData;
Expand All @@ -304,6 +325,16 @@ public function exportCsv()
public function exportXml()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$xmlData = $this->formatXml($papers);
return response()->streamDownload(function() use ($xmlData) {
echo $xmlData;
Expand All @@ -313,6 +344,16 @@ public function exportXml()
public function exportPdf()
{
$papers = $this->getPapersExport($this->projectId);

// Verifica se existem papers para exportar
if ($papers->isEmpty()) {
$this->toast(
message: $this->toastMessages . '.no-papers',
type: 'error'
);
return;
}

$pdfData = $this->formatPdf($papers);
return response()->streamDownload(function() use ($pdfData) {
echo $pdfData;
Expand Down
3 changes: 1 addition & 2 deletions app/Livewire/Planning/DataExtraction/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ private function resetFields()
{
$this->optionId = null;
$this->description = null;
$this->questionId['value'] = $this->currentProject
->dataExtractionQuestions->first()->id_de ?? null;
$this->questionId = [];
$this->form['isEditing'] = false;
}

Expand Down
2 changes: 2 additions & 0 deletions lang/en/project/conducting.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
'select-database' => 'Show all Databases',
'select-status' => 'Show all Statuses...',
'search-papers' => 'Search papers...',
'no-papers' => 'No studies available for export.',
],
'modal' => [
'author' => 'Author',
Expand Down Expand Up @@ -416,6 +417,7 @@
'select-database' => 'Show all Databases',
'select-status' => 'Show all Statuses...',
'search-papers' => 'Search papers...',
'no-papers' => 'No studies available for export.',
],
'modal' => [
'author' => 'Author',
Expand Down
Loading
Loading