Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
submeta
Commits
85ff1f34
Commit
85ff1f34
authored
Nov 26, 2024
by
Vitor Roberto
Browse files
Ajuste na avaliação
parent
691d76ba
Changes
2
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/AvaliadorController.php
View file @
85ff1f34
...
...
@@ -111,24 +111,34 @@ class AvaliadorController extends Controller
}
public
function
parecer
(
Request
$request
)
{
public
function
parecer
(
Request
$request
)
{
$user
=
User
::
find
(
Auth
::
user
()
->
id
);
$avaliador
=
$user
->
avaliadors
->
where
(
'user_id'
,
$user
->
id
)
->
first
();
$avaliador
=
$user
->
avaliadors
->
where
(
'user_id'
,
$user
->
id
)
->
first
();
$trabalho
=
$avaliador
->
trabalhos
->
find
(
$request
->
trabalho_id
);
$evento
=
Evento
::
find
(
$request
->
evento
);
$hoje
=
Carbon
::
today
(
'America/Recife'
);
$hoje
=
$hoje
->
toDateString
();
$hoje
=
Carbon
::
today
(
'America/Recife'
)
->
toDateString
();
// Verficação de pendencia de substituição
$aux
=
count
(
Substituicao
::
where
(
'status'
,
'Em Aguardo'
)
->
whereIn
(
'participanteSubstituido_id'
,
$trabalho
->
participantes
->
pluck
(
'id'
))
->
get
());
if
(
$aux
!=
0
){
return
redirect
()
->
back
()
->
withErrors
(
"A proposta "
.
$trabalho
->
titulo
.
" possui substituições pendentes"
);
}
// Preenchendo $camposAvaliacao com os campos relacionados ao evento
$camposAvaliacao
=
CampoAvaliacao
::
where
(
'evento_id'
,
$evento
->
id
)
->
get
();
// Verificação de pendências de substituição
$aux
=
count
(
Substituicao
::
where
(
'status'
,
'Em Aguardo'
)
->
whereIn
(
'participanteSubstituido_id'
,
$trabalho
->
participantes
->
pluck
(
'id'
))
->
get
());
return
view
(
'avaliador.parecer'
,
[
'trabalho'
=>
$trabalho
,
'evento'
=>
$evento
,
'hoje'
=>
$hoje
]);
if
(
$aux
!=
0
)
{
return
redirect
()
->
back
()
->
withErrors
(
"A proposta "
.
$trabalho
->
titulo
.
" possui substituições pendentes"
);
}
return
view
(
'avaliador.parecerBarema'
,
[
'trabalho'
=>
$trabalho
,
'evento'
=>
$evento
,
'hoje'
=>
$hoje
,
'camposAvaliacao'
=>
$camposAvaliacao
// Passando os campos para a view
]);
}
public
function
parecerInterno
(
Request
$request
){
$user
=
User
::
find
(
Auth
::
user
()
->
id
);
...
...
@@ -246,37 +256,45 @@ class AvaliadorController extends Controller
public
function
enviarParecerBarema
(
Request
$request
)
{
$user
=
User
::
find
(
Auth
::
user
()
->
id
);
$avaliador
=
$user
->
avaliadors
->
where
(
'user_id'
,
$user
->
id
)
->
first
();
$avaliador
=
$user
->
avaliadors
->
where
(
'user_id'
,
$user
->
id
)
->
first
();
$camposAvaliacao
=
CampoAvaliacao
::
where
(
'evento_id'
,
$request
->
evento_id
)
->
get
();
$avaliacaoTrab
=
AvaliacaoTrabalho
::
where
(
'trabalho_id'
,
$request
->
trabalho_id
)
->
where
(
'avaliador_id'
,
$avaliador
->
id
)
->
get
();
$avaliacaoTrab
=
AvaliacaoTrabalho
::
where
(
'trabalho_id'
,
$request
->
trabalho_id
)
->
where
(
'avaliador_id'
,
$avaliador
->
id
)
->
get
();
$evento
=
Evento
::
find
(
$request
->
evento_id
);
$trabalho
=
$avaliador
->
trabalhos
->
find
(
$request
->
trabalho_id
);
$data
=
Carbon
::
now
(
'America/Recife'
);
// Remove avaliações anteriores
if
(
$avaliacaoTrab
->
count
()
>
0
)
{
foreach
(
$avaliacaoTrab
as
$avaliacao
)
{
$avaliacao
->
forceDelete
();
}
}
$i
=
0
;
$pontuacao
=
0
;
foreach
(
$camposAvaliacao
as
$campoAvaliacao
)
{
//dd("a");
// Itera sobre os campos de avaliação enviados
foreach
(
$request
->
inputField
as
$index
=>
$input
)
{
if
(
isset
(
$input
[
'nota'
]))
{
$avaliacaoTrab
=
new
AvaliacaoTrabalho
();
$avaliacaoTrab
->
nota
=
$
request
->
inputField
[
$i
]
[
'nota'
];
$avaliacaoTrab
->
nota
=
$
input
[
'nota'
];
$avaliacaoTrab
->
avaliador_id
=
$avaliador
->
id
;
$avaliacaoTrab
->
campo_avaliacao_id
=
$campoAvaliacao
->
id
;
$avaliacaoTrab
->
campo_avaliacao_id
=
$campo
s
Avaliacao
[
$index
]
->
id
;
$avaliacaoTrab
->
trabalho_id
=
$request
->
trabalho_id
;
$avaliacaoTrab
->
save
();
$pontuacao
+=
number_format
(
$request
->
inputField
[
$i
][
'nota'
]);
++
$i
;
$pontuacao
+=
number_format
(
$input
[
'nota'
]);
}
}
$avaliador
->
trabalhos
()
->
updateExistingPivot
(
$trabalho
->
id
,[
'status'
=>
1
,
'recomendacao'
=>
$request
->
recomendacao
,
'created_at'
=>
$data
,
'pontuacao'
=>
$pontuacao
]);
// Atualiza status do trabalho
$avaliador
->
trabalhos
()
->
updateExistingPivot
(
$trabalho
->
id
,
[
'status'
=>
1
,
'recomendacao'
=>
$request
->
recomendacao
,
'created_at'
=>
$data
,
'pontuacao'
=>
$pontuacao
]);
if
(
$trabalho
->
avaliadors
()
->
where
(
'status'
,
1
)
->
count
()
==
$trabalho
->
avaliadors
()
->
count
())
{
$trabalho
->
status
=
"avaliado"
;
...
...
resources/views/avaliador/parecerBarema.blade.php
View file @
85ff1f34
...
...
@@ -97,28 +97,61 @@
<
input
type
=
"hidden"
name
=
"evento_id"
value
=
"
{
{$evento->id}
}
"
>
<
div
class
=
"form-group"
>
<
p
>
Preencha
os
valores
da
notas
a
partir
de
cada
critério
.
</
p
>
<
p
>
Preencha
os
valores
das
notas
a
partir
de
cada
critério
.
</
p
>
<
div
class
=
"justify-content-center"
id
=
"displayCampos"
>
<
table
class
=
"table table-bordered col-sm-12"
id
=
"dynamicAddRemove"
>
{{
--
Seção
de
Avaliação
por
Barema
--
}}
<
h5
style
=
"color: #234B8B; font-weight: bold; margin-top: 20px;"
>
Avaliação
por
Barema
</
h5
>
<
table
class
=
"table table-bordered table-striped"
>
<
thead
class
=
"text-center"
>
<
tr
>
<
th
style
=
"width: 25%;"
>
Nome
</
th
>
<
th
style
=
"width: 35%;"
>
Descrição
</
th
>
<
th
style
=
"width: 10%;"
>
Nota
Máxima
</
th
>
<
th
style
=
"width: 10%;"
>
Prioridade
</
th
>
<
th
style
=
"width: 20%;"
>
Nota
da
avaliação
<
span
style
=
"color:red; font-weight:bold;"
>*</
span
></
th
>
</
tr
>
</
thead
>
<
tbody
>
@
foreach
(
$camposAvaliacao
as
$index
=>
$campoAvaliacao
)
@
if
(
str_contains
(
$campoAvaliacao
->
nome
,
'-b'
))
<
tr
>
<
td
><
input
type
=
"text"
class
=
"form-control"
value
=
"{{ str_replace('-b', '',
$campoAvaliacao->nome
) }}"
disabled
></
td
>
<
td
><
input
type
=
"text"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->descricao
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->nota_maxima
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->prioridade
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
min
=
"0"
max
=
"{{
$campoAvaliacao->nota_maxima
}}"
step
=
"1"
name
=
"inputField[{{
$index
}}][nota]"
class
=
"form-control"
required
></
td
>
</
tr
>
@
endif
@
endforeach
</
tbody
>
</
table
>
{{
--
Seção
de
Avaliação
por
Currículo
Lattes
--
}}
<
h5
style
=
"color: #234B8B; font-weight: bold; margin-top: 20px;"
>
Avaliação
por
Currículo
Lattes
</
h5
>
<
table
class
=
"table table-bordered table-striped"
>
<
thead
class
=
"text-center"
>
<
tr
>
<
th
>
Nome
</
th
>
<
th
>
Descrição
</
th
>
<
th
>
Nota
Máxima
</
th
>
<
th
>
Prioridade
</
th
>
<
th
>
Nota
da
avaliação
<
span
style
=
"color:red; font-weight:bold;"
>*</
span
></
th
>
<
th
style
=
"width: 25%;"
>
Nome
</
th
>
<
th
style
=
"width: 35%;"
>
Descrição
</
th
>
<
th
style
=
"width: 10%;"
>
Nota
Máxima
</
th
>
<
th
style
=
"width: 10%;"
>
Prioridade
</
th
>
<
th
style
=
"width: 20%;"
>
Nota
da
avaliação
<
span
style
=
"color:red; font-weight:bold;"
>*</
span
></
th
>
</
tr
>
@
foreach
(
$camposAvaliacao
as
$campoAvaliacao
)
</
thead
>
<
tbody
>
@
foreach
(
$camposAvaliacao
as
$index
=>
$campoAvaliacao
)
@
if
(
str_contains
(
$campoAvaliacao
->
nome
,
'-c'
))
<
tr
>
<
td
><
input
type
=
"text"
name
=
"inputField[
{
{$i}
}
][nome]"
class
=
"form-control nome"
value
=
"{{
$campoAvaliacao->nome
}}"
disabled
/></
td
>
<
td
><
input
type
=
"text"
name
=
"inputField[
{
{$i}
}
][descricao]"
class
=
"form-control descricao"
value
=
"{{
$campoAvaliacao->descricao
}}"
disabled
/>
</
td
>
<
td
><
input
type
=
"number"
name
=
"inputField[
{
{$i}
}
][nota_maxima]"
class
=
"form-control nota_maxima"
value
=
"{{
$campoAvaliacao->nota_maxima
}}"
disabled
/></
td
>
<
td
><
input
type
=
"number"
name
=
"inputField[
{
{$i}
}
][nota_prioridade]"
class
=
"form-control nota_maxima"
value
=
"{{
$campoAvaliacao->prioridade
}}"
disabled
/></
td
>
<
td
><
input
type
=
"number"
min
=
"0"
max
=
"{{
$campoAvaliacao->nota_maxima
}}"
step
=
"1"
name
=
"inputField[
{
{$i}
}
][nota]"
class
=
"form-control nota"
required
/>
<
td
><
input
type
=
"text"
class
=
"form-control"
value
=
"{{ str_replace('-c', '',
$campoAvaliacao->nome
) }}"
disabled
></
td
>
<
td
><
input
type
=
"text"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->descricao
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->nota_maxima
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
class
=
"form-control"
value
=
"{{
$campoAvaliacao->prioridade
}}"
disabled
></
td
>
<
td
><
input
type
=
"number"
min
=
"0"
max
=
"{{
$campoAvaliacao->nota_maxima
}}"
step
=
"1"
name
=
"inputField[{{
$index
}}][nota]"
class
=
"form-control"
required
></
td
>
</
tr
>
<
input
type
=
"checkbox"
id
=
"checkB[
{
{$i}
}
]"
checked
name
=
"campos[]"
value
=
"
{
{$i}
}
"
hidden
>
@
php
++
$i
;
++
$numCampos
;
@
endphp
@
endif
@
endforeach
</
tbody
>
</
table
>
</
div
>
</
div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment