Skip to content

Commit a6a6eb8

Browse files
authored
Merge pull request #720 from Thoth2023/develop
Develop -> Main
2 parents ca2d8cf + 39c49b4 commit a6a6eb8

File tree

7 files changed

+112
-38
lines changed

7 files changed

+112
-38
lines changed

app/Livewire/Conducting/StudySelection/PaperModal.php

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function showPaper($paper, $criterias)
6767
->where('id_member', $member->id_members)
6868
->pluck('id_criteria')
6969
->toArray();
70-
70+
7171
$this->temp_selected_criterias = $this->selected_criterias;
7272

7373
//status selecionado com base no status salvo no banco de dados
@@ -166,7 +166,7 @@ public function saveSelectedCriterias()
166166

167167
// Encontrar critérios que foram desmarcados
168168
$removedCriterias = array_diff($this->selected_criterias, $this->temp_selected_criterias);
169-
169+
170170
// Encontrar critérios que foram marcados
171171
$addedCriterias = array_diff($this->temp_selected_criterias, $this->selected_criterias);
172172

@@ -191,7 +191,17 @@ public function saveSelectedCriterias()
191191
$this->selected_criterias = $this->temp_selected_criterias;
192192

193193
// Atualizar o status do paper
194+
/*
194195
$criteria = Criteria::find(reset($addedCriterias));
196+
if ($criteria) {
197+
$this->updatePaperStatus($criteria->type);
198+
}*/
199+
200+
$criteria = null;
201+
if (!empty($addedCriterias)) {
202+
$criteria = Criteria::find(reset($addedCriterias));
203+
}
204+
195205
if ($criteria) {
196206
$this->updatePaperStatus($criteria->type);
197207
}
@@ -309,18 +319,39 @@ private function determineNewStatus($inclusion, $exclusion, $old_status)
309319
}
310320

311321

312-
public function nextPaper(){
313-
$this->paper = Papers::where('id_paper', '>', $this->paper['id_paper'])
322+
public function nextPaper()
323+
{
324+
// Obtém o próximo paper baseado na ordem atual
325+
$nextPaper = Papers::where('id_paper', '>', $this->paper['id_paper'])
314326
->where('data_base', $this->paper['data_base'])
315327
->orderBy('id_paper')
316328
->first();
317329

318-
if ($this->paper) {
330+
if ($nextPaper) {
331+
// Fecha o modal atual
319332
$this->dispatch('close-paper');
320-
321-
$this->showPaper($this->paper, $this->criterias);
333+
334+
// Mostra o próximo
335+
$this->showPaper($nextPaper, $this->criterias);
322336
} else {
323337
session()->flash('errorMessage', 'No more papers available.');
338+
$this->dispatch('notify', message: 'No more papers available.', type: 'warning');
339+
}
340+
}
341+
342+
public function previousPaper()
343+
{
344+
$previousPaper = Papers::where('id_paper', '<', $this->paper['id_paper'])
345+
->where('data_base', $this->paper['data_base'])
346+
->orderByDesc('id_paper')
347+
->first();
348+
349+
if ($previousPaper) {
350+
$this->dispatch('close-paper');
351+
$this->showPaper($previousPaper, $this->criterias);
352+
} else {
353+
session()->flash('errorMessage', 'This is the first paper.');
354+
$this->dispatch('notify', message: 'This is the first paper.', type: 'info');
324355
}
325356
}
326357

@@ -329,4 +360,4 @@ public function render()
329360
{
330361
return view('livewire.conducting.study-selection.paper-modal');
331362
}
332-
}
363+
}

lang/en/auth/login.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'user_not_found' => 'This email address is not registered.',
1717
'failed' => 'The credentials do not match our records.',
1818
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
19+
'inactive' => 'User is inactive in the system',
1920

2021
'error' => 'The provided credentials do not match our records.'
2122
];

lang/en/project/conducting.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
'error-status' => 'Select your Final Decision',
9393
'last-confirmation' => 'Last Confirmation',
9494
'confirmation-date' => 'in',
95+
'save-criterias' => 'Save Criterias',
96+
'apply-selection' => 'Apply Selection',
9597
'table' => [
9698
'select' => 'Select',
9799
'description' => 'Description',

lang/pt_BR/auth/login.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'user_not_found' => 'Este endereço de e-mail não está cadastrado.',
1717
'failed' => 'As credenciais não correspondem aos nossos registros.',
1818
'throttle' => 'Muitas tentativas de login. Tente novamente em :seconds segundos.',
19+
'inactive'=>'Usuário está Inativo no sistema',
1920

2021
'error' => 'As credenciais fornecidas não correspondem aos nossos registros.'
2122
];

lang/pt_BR/project/conducting.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
'error-status'=>'Selecione sua Decisão Final',
9292
'last-confirmation' => 'Confirmado por',
9393
'confirmation-date' => 'em',
94+
'save-criterias' => 'Salvar Critérios',
95+
'apply-selection' => 'Aplicar Seleção',
9496
'table' => [
9597
'select' => 'Selecionar',
9698
'description' => 'Descrição',

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

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
</table>
8989
<div class="text-end mb-3">
9090
<button wire:click="saveSelectedCriterias" class="btn btn-primary">
91-
<i class="fas fa-save"></i> Salvar Critérios
91+
<i class="fas fa-save"></i> {{ __('project/conducting.study-selection.modal.save-criterias' )}}
9292
</button>
9393
</div>
9494
<hr />
@@ -131,8 +131,8 @@
131131
@endif
132132
@endif
133133
<div class="text-center mt-3">
134-
<button class="btn btn-primary" wire:click="applySelectedCriterias">
135-
Aplicar Seleção
134+
<button class="btn btn-primary" wire:click="updatePaperStatus">
135+
{{ __('project/conducting.study-selection.modal.apply-selection' )}}
136136
</button>
137137
</div>
138138

@@ -174,41 +174,35 @@
174174

175175
@script
176176
<script>
177-
$(document).ready(function(){
178-
// Show the paper modal
179-
$wire.on('show-paper', () => {
177+
document.addEventListener('livewire:initialized', () => {
178+
// Mostrar modal de paper
179+
Livewire.on('show-paper', () => {
180180
setTimeout(() => {
181181
$('#paperModal').modal('show');
182-
}, 800);
182+
}, 500);
183183
});
184184
185-
// Show the success modal on success event
185+
// Modal de sucesso
186186
Livewire.on('show-success', () => {
187187
$('#paperModal').modal('hide');
188188
$('#successModal').modal('show');
189189
});
190190
191-
// Handle the closing of success modal to reopen the paper modal
191+
// Ao fechar modal de sucesso, reabrir o paper
192192
$('#successModal').on('hidden.bs.modal', function() {
193193
$('#paperModal').modal('show');
194194
});
195-
});
196-
197-
// Recarregar papers e mostrar modais
198-
Livewire.on('reload-papers', () => {
199-
Livewire.emit('show-success');
200-
});
201-
202-
Livewire.on('show-success', () => {
203-
Livewire.emit('show-success-quality');
204-
});
205195
206-
Livewire.on('show-sucess', () => {
207-
Livewire.emit('show-sucess-quality');
208-
});
196+
// Eventos de reload e propagação entre componentes
197+
Livewire.on('reload-papers', () => Livewire.dispatch('show-success'));
198+
Livewire.on('show-success', () => Livewire.dispatch('show-success-quality'));
199+
Livewire.on('show-sucess', () => Livewire.dispatch('show-sucess-quality'));
209200
210-
$wire.on('paper-modal', ({ message, type }) => {
211-
toasty({ message, type });
201+
// Toasts e mensagens rápidas
202+
Livewire.on('paper-modal', ({ message, type }) => toasty({ message, type }));
203+
Livewire.on('notify', ({ message, type }) => toasty({ message, type }));
212204
});
213205
</script>
214206
@endscript
207+
208+

resources/views/projects/project-overview.blade.php

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
</div>
6262
<div class="progress" style="height: 18px;">
6363
<div class="progress-bar bg-primary"
64-
role="progressbar"
6564
style="width: {{ $planningProgress["overall"] ?? 0 }}%"
6665
aria-valuenow="{{ $planningProgress["overall"] ?? 0 }}"
6766
aria-valuemin="0" aria-valuemax="100">
@@ -77,7 +76,6 @@
7776
</div>
7877
<div class="progress" style="height: 18px;">
7978
<div class="progress-bar bg-success"
80-
role="progressbar"
8179
style="width: {{ $conductingProgress['overall'] ?? 0 }}%"
8280
aria-valuenow="{{ $conductingProgress['overall'] ?? 0 }}"
8381
aria-valuemin="0" aria-valuemax="100">
@@ -93,7 +91,6 @@
9391
</div>
9492
<div class="progress" style="height: 18px;">
9593
<div class="progress-bar bg-dark"
96-
role="progressbar"
9794
style="width: {{ $conductingProgress['study_selection'] ?? 0 }}%"
9895
aria-valuenow="{{ $conductingProgress['study_selection'] ?? 0 }}"
9996
aria-valuemin="0" aria-valuemax="100">
@@ -109,7 +106,6 @@
109106
</div>
110107
<div class="progress" style="height: 18px;">
111108
<div class="progress-bar bg-info"
112-
role="progressbar"
113109
style="width: {{ $conductingProgress['quality_assessment'] ?? 0 }}%"
114110
aria-valuenow="{{ $conductingProgress['quality_assessment'] ?? 0 }}"
115111
aria-valuemin="0" aria-valuemax="100">
@@ -125,7 +121,6 @@
125121
</div>
126122
<div class="progress" style="height: 18px;">
127123
<div class="progress-bar bg-secondary"
128-
role="progressbar"
129124
style="width: {{ $conductingProgress['snowballing'] ?? 0 }}%"
130125
aria-valuenow="{{ $conductingProgress['snowballing'] ?? 0 }}"
131126
aria-valuemin="0" aria-valuemax="100">
@@ -141,7 +136,6 @@
141136
</div>
142137
<div class="progress" style="height: 18px;">
143138
<div class="progress-bar bg-danger"
144-
role="progressbar"
145139
style="width: {{ $conductingProgress['data_extraction'] ?? 0 }}%"
146140
aria-valuenow="{{ $conductingProgress['data_extraction'] ?? 0 }}"
147141
aria-valuemin="0" aria-valuemax="100">
@@ -159,6 +153,7 @@
159153
<div class="card-header bg-white border-0">
160154
<h5 class="mb-0">{{ __('project/overview.activity_record') }}</h5>
161155
</div>
156+
162157
<div class="card-body p-3" style="max-height:400px; overflow-y:auto;">
163158
@if (!empty($activities))
164159
@foreach ($activities->take(10) as $activity)
@@ -194,3 +189,51 @@
194189
</div>
195190
</div>
196191
</div>
192+
193+
<!-- Modal: Histórico Completo -->
194+
<div class="modal fade" id="allActivitiesModal" tabindex="-1" aria-labelledby="allActivitiesModalLabel" aria-hidden="true">
195+
<div class="modal-dialog modal-lg modal-dialog-scrollable">
196+
<div class="modal-content">
197+
<div class="modal-header">
198+
<h5 class="modal-title" id="allActivitiesModalLabel">{{ __('project/overview.full_activity_history') }}</h5>
199+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
200+
</div>
201+
<div class="modal-body">
202+
@if (!empty($activities) && $activities->count())
203+
@foreach ($activities as $activity)
204+
<div class="card p-0 mb-3 border rounded-3 text-start">
205+
<div class="card-header bg-light rounded-top py-2">
206+
<strong>{{ $activity->user->username }}</strong>
207+
</div>
208+
<div class="card-body bg-white py-2">
209+
{{ $activity->activity }}
210+
</div>
211+
<div class="card-footer text-muted py-2">
212+
<small>
213+
@php
214+
$locale = app()->getLocale();
215+
$date = \Carbon\Carbon::parse($activity->created_at)->locale($locale);
216+
$format = $locale === 'pt_BR' || $locale === 'pt' ? 'd/m/Y H:i' : 'm/d/Y h:i A';
217+
@endphp
218+
{{ $date->translatedFormat($format) }}
219+
</small>
220+
</div>
221+
</div>
222+
@endforeach
223+
@else
224+
<div class="text-center text-muted py-3">
225+
{{ __('project/overview.no_activities') }}
226+
</div>
227+
@endif
228+
</div>
229+
<div class="modal-footer">
230+
<a href="{{ route('projects.exportActivities', ['project' => $project->id_project]) }}" class="btn btn-warning btn-sm">
231+
{{ __('project/overview.export') }}
232+
</a>
233+
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">
234+
{{ __('project/overview.close') }}
235+
</button>
236+
</div>
237+
</div>
238+
</div>
239+
</div>

0 commit comments

Comments
 (0)