Skip to content

Commit 13d721f

Browse files
authored
Merge pull request #740 from Thoth2023/main-rebase-develop-08outubro
commit rebase develop para main
2 parents eac1405 + 522767a commit 13d721f

File tree

11 files changed

+241
-187
lines changed

11 files changed

+241
-187
lines changed

app/Livewire/Conducting/StudySelection/PaperModal.php

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Livewire\Attributes\On;
1919
use App\Traits\ProjectPermissions;
2020

21-
2221
class PaperModal extends Component
2322
{
2423

@@ -41,6 +40,7 @@ public function mount()
4140
{
4241
$this->projectId = request()->segment(2);
4342
$this->currentProject = Project::findOrFail($this->projectId);
43+
4444
}
4545
#[On('showPaper')]
4646
public function showPaper($paper, $criterias)
@@ -58,13 +58,22 @@ public function showPaper($paper, $criterias)
5858
->values()
5959
->toArray();
6060

61-
$this->paper = $paper;
61+
// Se showPaper for chamado com o ID do paper, carrega o objeto e converte para array
62+
// Se o paper for passado como um array de dados, usa o id_paper
63+
$paperId = is_array($paper) ? $paper['id_paper'] : $paper;
64+
65+
if (!$paperId) {
66+
Log::error('showPaper called without a valid paper ID or data.');
67+
return;
68+
}
69+
70+
$this->paper = Papers::where('id_paper', $paperId)->first()->toArray();
6271

6372
$databaseName = DB::table('data_base')
6473
->where('id_database', $this->paper['data_base'])
6574
->value('name');
6675

67-
$this->paper['database_name'] = $databaseName;
76+
$this->paper['database_name'] = $databaseName ?? 'Unknown';
6877

6978
// Buscar o membro específico para o projeto atual
7079
$member = Member::where('id_user', auth()->user()->id)
@@ -80,7 +89,7 @@ public function showPaper($paper, $criterias)
8089
$this->temp_selected_criterias = $this->selected_criterias;
8190

8291
//status selecionado com base no status salvo no banco de dados
83-
$this->selected_status = $this->paper['status_description'];
92+
$this->selected_status = $this->getPaperStatusDescription($this->paper['status_selection']);
8493

8594
// Carregar a nota existente
8695
$paperSelection = PapersSelection::where('id_paper', $this->paper['id_paper'])
@@ -200,24 +209,15 @@ public function saveSelectedCriterias()
200209
$this->selected_criterias = $this->temp_selected_criterias;
201210

202211
// Atualizar o status do paper
203-
204-
$criteria = Criteria::find(reset($addedCriterias));
205-
if ($criteria) {
212+
$criterias = Criteria::whereIn('id_criteria', $this->selected_criterias)->get();
213+
foreach ($criterias as $criteria) {
206214
$this->updatePaperStatus($criteria->type);
207215
}
208-
/*
209-
$criteria = null;
210-
if (!empty($addedCriterias)) {
211-
$criteria = Criteria::find(reset($addedCriterias));
212-
}
213-
214-
if ($criteria) {
215-
$this->updatePaperStatus($criteria->type);
216-
}*/
217216

218217
session()->flash('successMessage', 'Critérios salvos com sucesso');
219218
$this->dispatch('show-success');
220219
$this->dispatch('refreshPaperStatus');
220+
221221
}
222222

223223
// Método auxiliar para obter a descrição do status
@@ -284,6 +284,12 @@ private function updatePaperStatus($type)
284284
if ($member->level == 1) {
285285
Papers::where('id_paper', $id_paper)->update(['status_selection' => $new_status]);
286286
}
287+
// 🔥 Recarrega o paper atualizado
288+
$this->paper = Papers::where('id_paper', $id_paper)->first()->toArray();
289+
$this->paper['database_name'] = DB::table('data_base')
290+
->where('id_database', $this->paper['data_base'])
291+
->value('name') ?? '';
292+
287293
session()->forget('successMessage');
288294
session()->flash('successMessage', "Status updated successfully.");
289295
}

lang/en/auth/login.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@
1717
'failed' => 'The credentials do not match our records.',
1818
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
1919
'inactive' => 'User is inactive in the system',
20-
2120
'error' => 'The provided credentials do not match our records.'
2221
];

lang/en/pages/user-manager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
return [
44
'Users' => 'Users',
5+
'description' => 'Here you can manage the users registered in the system.',
56
'Name' => 'Name',
67
'Role' => 'Permissions',
78
'super_user' => 'Super User Management',
@@ -13,7 +14,7 @@
1314
'Edit' => 'Edit',
1415
'Deactivate' => 'Deactivate',
1516
'Activate' => 'Activate',
16-
'Add_User' => '+ New User',
17+
'Add_User' => 'New User',
1718
'Yes' => 'Yes',
1819
'No' => 'No',
1920
'singup_user' => 'Sign Up new user',

lang/en/project/conducting.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
'conflicts-members' => 'Member Evaluation',
103103
'conflicts-criteria' => 'Selected I/E Criteria',
104104
'conflicts-status' => 'Evaluation Status',
105-
106105
],
107106
'option' => [
108107
'select' => 'Select an option',
@@ -119,7 +118,6 @@
119118
'close' => 'Close',
120119
'error' => 'Error',
121120
'success' => 'Success',
122-
123121
],
124122
'messages' => [
125123
'criteria_updated' => 'Criteria updated successfully. New status: :status',

lang/pt_BR/auth/login.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@
1717
'failed' => 'As credenciais não correspondem aos nossos registros.',
1818
'throttle' => 'Muitas tentativas de login. Tente novamente em :seconds segundos.',
1919
'inactive'=>'Usuário está Inativo no sistema',
20-
21-
'error' => 'As credenciais fornecidas não correspondem aos nossos registros.'
20+
'error' => 'As credenciais fornecidas não correspondem aos nossos registros.'
2221
];

lang/pt_BR/pages/user-manager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
return[
44
'Users' => 'Usuários',
5+
'description'=>'Aqui você pode gerenciar os usuários cadastrados no sistema.',
56
'Name' => 'Nome',
67
'Role' => 'Permissões de Acesso',
78
'super_user' => 'Acesso Administrativo',
@@ -13,7 +14,7 @@
1314
'Edit' => 'Editar',
1415
'Deactivate' => 'Desativar',
1516
'Activate' => 'Ativar',
16-
'Add_User' => '+ Novo Usuário',
17+
'Add_User' => 'Novo Usuário',
1718
'Yes' => 'Sim',
1819
'No' => 'Não',
1920
'singup_user' => 'Cadastrar novo usuário',

lang/pt_BR/project/conducting.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,13 @@
151151
'table-duplicate' => 'Duplicado',
152152
'table-duplicate-yes' => 'SIM',
153153
'table-duplicate-no' => 'NÃO',
154-
155154
],
156155
'messages' => [
157156
'criteria_updated' => 'Critério atualizado com sucesso. Novo status: :status',
158157
],
159158
'toasts' => [
160159
'denied' => 'Um visualizador não pode editar a seleção de estudos',
161160
]
162-
163161
],
164162
'snowballing' => [
165163
'title' => 'Snowballing',

resources/views/livewire/conducting/study-selection/paper-modal.blade.php

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<div>
22
<div wire:ignore.self class="modal fade" id="paperModal" tabindex="-1" role="dialog" aria-labelledby="paperModalLabel" wire:key="paperModal"
3-
aria-hidden="true">
3+
aria-hidden="true">
44
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
55
<div class="modal-content">
66
<div class="modal-header">
77
@if ($paper)
8-
<h5 class="modal-title" id="paperModalLabel">{{ $paper['title'] }}</h5>
9-
<button type="button" data-bs-dismiss="modal" class="btn">
10-
<span aria-hidden="true">X</span>
11-
</button>
8+
<h5 class="modal-title" id="paperModalLabel">{{ $paper['title'] }}</h5>
9+
<button type="button" data-bs-dismiss="modal" class="btn">
10+
<span aria-hidden="true">X</span>
11+
</button>
1212
</div>
1313
<div class="modal-body">
1414
<!-- O restante do conteúdo do paperModal -->
@@ -23,58 +23,61 @@
2323
</div>
2424
<div class="col-4">
2525
<b>{{ __('project/conducting.study-selection.modal.database' )}}:</b>
26-
<p>{{ $paper['database_name'] }}</p>
26+
<p>{{ $paper['database_name'] ?? ($paper['data_base'] ? 'Loading...' : '') }}</p>
2727
</div>
2828
<div class="col-2">
2929
<a class="btn py-1 px-3 btn-outline-dark" data-toggle="tooltip" data-original-title="Doi"
30-
href="https://doi.org/{{ $paper['doi'] }}" target="_blank">
30+
href="https://doi.org/{{ $paper['doi'] }}" target="_blank">
3131
<i class="fa-solid fa-arrow-up-right-from-square"></i>
3232
DOI
3333
</a>
3434
<a class="btn py-1 px-3 btn-outline-success" data-toggle="tooltip" data-original-title="URL"
35-
href="{{ $paper['url'] }}" target="_blank">
35+
href="{{ $paper['url'] }}" target="_blank">
3636
<i class="fa-solid fa-link"></i>
3737
URL
3838
</a>
3939
<a class="btn py-1 px-3 btn-outline-primary"
40-
data-toggle="tooltip"
40+
data-toggle="tooltip"
4141

42-
data-original-title="Buscar no Google Scholar"
43-
href="https://scholar.google.com/scholar?q={{ urlencode($paper['title']) }}"
44-
target="_blank">
42+
data-original-title="Buscar no Google Scholar"
43+
href="https://scholar.google.com/scholar?q={{ urlencode($paper['title']) }}"
44+
target="_blank">
4545
<i class="fa-solid fa-graduation-cap"></i>
4646
Google Scholar
4747
</a>
4848
@livewire('conducting.study-selection.buttons-update-paper', ['paperId' =>
4949
$paper['id_paper'], 'projectId' => $this->projectId], key($paper['id_paper']))
5050
</div>
5151

52+
{{-- @livewire('conducting.study-selection.paper-status', ['paperId' =>
53+
$paper['id_paper'],'projectId' => $this->projectId], key($paper['id_paper']))--}}
54+
5255
@livewire('conducting.study-selection.paper-status', ['paperId' =>
53-
$paper['id_paper'],'projectId' => $this->projectId], key($paper['id_paper']))
56+
$paper['id_paper'],'projectId' => $this->projectId], key('paper-status-'.$paper['id_paper']))
5457

5558
@livewire('conducting.study-selection.paper-abstract-keywords', ['paperId' =>
5659
$paper['id_paper'], 'projectId' => $this->projectId], key($paper['id_paper']))
5760

5861
</div>
5962
<table class="table table-striped table-bordered mb-3">
6063
<thead>
61-
<tr>
62-
<th class="w-5 align-middle text-center">{{ __('project/conducting.study-selection.modal.table.select' )}}</th>
63-
<th class="w-5 align-middle text-center">ID</th>
64-
<th class="w-70 align-middle text-wrap">{{ __('project/conducting.study-selection.modal.table.description' )}}</th>
65-
<th class="w-5 align-middle text-center">{{ __('project/conducting.study-selection.modal.table.type' )}}</th>
64+
<tr>
65+
<th class="w-5 align-middle text-center">{{ __('project/conducting.study-selection.modal.table.select' )}}</th>
66+
<th class="w-5 align-middle text-center">ID</th>
67+
<th class="w-70 align-middle text-wrap">{{ __('project/conducting.study-selection.modal.table.description' )}}</th>
68+
<th class="w-5 align-middle text-center">{{ __('project/conducting.study-selection.modal.table.type' )}}</th>
6669

67-
</tr>
70+
</tr>
6871
</thead>
6972
<tbody>
70-
@foreach ($criterias as $criteria)
73+
@foreach ($criterias as $criteria)
7174
<tr>
7275
<td class="w-5 align-middle text-center">
7376
<input type="checkbox" id="criteria-{{ $criteria['id_criteria'] }}"
74-
wire:key="criteria-{{ $criteria['id_criteria'] }}"
75-
wire:model="temp_selected_criterias"
76-
value="{{ $criteria['id_criteria'] }}"
77-
@if(in_array($criteria['id_criteria'], $temp_selected_criterias)) checked @endif
77+
wire:key="criteria-{{ $criteria['id_criteria'] }}"
78+
wire:model="temp_selected_criterias"
79+
value="{{ $criteria['id_criteria'] }}"
80+
@if(in_array($criteria['id_criteria'], $temp_selected_criterias)) checked @endif
7881

7982
>
8083
</td>
@@ -83,7 +86,7 @@
8386
<td class="w-5 align-middle text-center">{{ $criteria['type'] }}</td>
8487
<td class="w-5 align-middle text-center">{{ $criteria['rule'] }}</td>
8588
</tr>
86-
@endforeach
89+
@endforeach
8790
</tbody>
8891
</table>
8992
<div class="text-end mb-3">
@@ -96,8 +99,8 @@
9699
<div class="d-flex flex-column mt-3">
97100
<label>{{ __('project/conducting.study-selection.modal.paper-conflict-note' )}}</label>
98101
<textarea id="note" class="form-control" rows="2" wire:model="note" wire:blur="saveNote"
99-
placeholder="{{ __('project/conducting.study-selection.modal.paper-conflict-writer' )}}"
100-
@if(!$canEdit) disabled @endif required>
102+
placeholder="{{ __('project/conducting.study-selection.modal.paper-conflict-writer' )}}"
103+
@if(!$canEdit) disabled @endif required>
101104
</textarea>
102105
</div>
103106

@@ -106,35 +109,35 @@
106109
<hr />
107110
<!-- Verificação do status -->
108111
@if($paper['status_selection'] != 1 && $paper['status_selection'] != 2)
109-
<!-- Apenas mostrar se o status não for Accepted (1) ou Rejected (2) -->
110-
<p>{{ __('project/conducting.study-selection.modal.option.select' )}}</p>
111-
112-
<div class="btn-group mt-2" role="group">
113-
<input type="radio" class="btn-check" wire:model="selected_status"
114-
wire:change="updateStatusManual" value="Unclassified" name="btnradio" id="btnradio2"
115-
autocomplete="off" @if(!$canEdit) disabled @endif>
116-
<label class="btn btn-outline-primary"
117-
for="btnradio2">{{ __('project/conducting.study-selection.modal.option.unclassified' )}}</label>
118-
119-
<input type="radio" class="btn-check" wire:model="selected_status"
120-
wire:change="updateStatusManual" value="Removed" name="btnradio" id="btnradio1"
121-
autocomplete="off" @if(!$canEdit) disabled @endif>
122-
<label class="btn btn-outline-primary"
123-
for="btnradio1">{{ __('project/conducting.study-selection.modal.option.remove' )}}</label>
124-
125-
<input type="radio" class="btn-check" wire:model="selected_status"
126-
wire:change="updateStatusManual" value="Duplicate" name="btnradio" id="btnradio4"
127-
autocomplete="off" @if(!$canEdit) disabled @endif>
128-
<label class="btn btn-outline-primary"
129-
for="btnradio4">{{ __('project/conducting.study-selection.modal.option.duplicated' )}}</label>
130-
</div>
112+
<!-- Apenas mostrar se o status não for Accepted (1) ou Rejected (2) -->
113+
<p>{{ __('project/conducting.study-selection.modal.option.select' )}}</p>
114+
115+
<div class="btn-group mt-2" role="group">
116+
<input type="radio" class="btn-check" wire:model="selected_status"
117+
wire:change="updateStatusManual" value="Unclassified" name="btnradio" id="btnradio2"
118+
autocomplete="off" @if(!$canEdit) disabled @endif>
119+
<label class="btn btn-outline-primary"
120+
for="btnradio2">{{ __('project/conducting.study-selection.modal.option.unclassified' )}}</label>
121+
122+
<input type="radio" class="btn-check" wire:model="selected_status"
123+
wire:change="updateStatusManual" value="Removed" name="btnradio" id="btnradio1"
124+
autocomplete="off" @if(!$canEdit) disabled @endif>
125+
<label class="btn btn-outline-primary"
126+
for="btnradio1">{{ __('project/conducting.study-selection.modal.option.remove' )}}</label>
127+
128+
<input type="radio" class="btn-check" wire:model="selected_status"
129+
wire:change="updateStatusManual" value="Duplicate" name="btnradio" id="btnradio4"
130+
autocomplete="off" @if(!$canEdit) disabled @endif>
131+
<label class="btn btn-outline-primary"
132+
for="btnradio4">{{ __('project/conducting.study-selection.modal.option.duplicated' )}}</label>
133+
</div>
131134
@endif
132135
@endif
133136

134137
</div>
135138
<div class="modal-footer">
136139
<button type="button" class="btn btn-secondary"
137-
data-bs-dismiss="modal">{{ __('project/conducting.study-selection.modal.close' )}}</button>
140+
data-bs-dismiss="modal">{{ __('project/conducting.study-selection.modal.close' )}}</button>
138141
</div>
139142
<!--
140143
<div class="d-flex justify-content-between px-4">
@@ -151,11 +154,11 @@
151154
</div>
152155

153156
<div wire:ignore.self class="modal fade" id="successModal" tabindex="-1" role="dialog"
154-
aria-labelledby="successModalLabel" aria-hidden="true">
157+
aria-labelledby="successModalLabel" aria-hidden="true">
155158
<div class="modal-dialog modal-dialog-centered" role="document">
156159
<div class="modal-content">
157160
<div class="modal-header">
158-
<h5 class="modal-title" id="successModalLabel">Success</h5>
161+
<h5 class="modal-title" id="successModalLabel">{{ __('project/conducting.study-selection.modal.success' )}}</h5>
159162
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
160163
</div>
161164
<div class="modal-body">
@@ -227,4 +230,3 @@
227230
228231
229232
230-

resources/views/pages/database-manager.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
@extends("layouts.app")
1+
@extends('layouts.app')
22

3-
@section("content")
4-
@include("layouts.navbars.guest.navbar", ["title" => "pages.home.home"])
5-
<!-- Page header section for the database manager, displaying title and description -->
6-
<div class="container mt-7 mb-3">
3+
@section('content')
4+
<!-- Displays the database management table with options to add, edit, activate or deactivate -->
5+
@include('layouts.navbars.auth.topnav', ['title' => __("nav/side.user_manager")])
6+
<div class="container mt-4 mb-3">
77
<div class="page-header d-flex flex-column pt-4 pb-11 border-radius-lg">
88
<div
99
class="row justify-content-center rounded-3 py-4 bg-gradient-faded-dark opacity-8 "

0 commit comments

Comments
 (0)