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
94275bdd
Commit
94275bdd
authored
May 29, 2020
by
Gabriel-31415
Browse files
atribuir avaliador a trabalho
parent
904ecc3f
Changes
12
Hide whitespace changes
Inline
Side-by-side
app/Evento.php
View file @
94275bdd
...
...
@@ -37,6 +37,9 @@ class Evento extends Model
public
function
coordenadorComissao
(){
return
$this
->
belongsTo
(
'App\CoordenadorComissao'
,
'coordenadorId'
);
}
public
function
trabalhos
(){
return
$this
->
hasMany
(
'App\Trabalho'
);
}
}
app/Http/Controllers/CoordenadorComissaoController.php
View file @
94275bdd
...
...
@@ -27,7 +27,7 @@ class CoordenadorComissaoController extends Controller
$coordenador
=
CoordenadorComissao
::
with
(
'user'
)
->
where
(
'user_id'
,
Auth
()
->
user
()
->
id
)
->
first
();
$eventos
=
Evento
::
where
(
'coordenadorId'
,
$coordenador
->
id
)
->
get
();
//dd($eventos);
return
view
(
'coordenadorComissao.editais'
,
[
'eventos'
=>
$eventos
]);
}
public
function
coordenadorComite
(){
...
...
@@ -51,4 +51,68 @@ class CoordenadorComissaoController extends Controller
return
view
(
'coordenadorComissao.listarUsuarios'
,
[
'usuarios'
=>
$usuarios
]);
}
public
function
listarTrabalhos
(
Request
$request
){
$evento
=
Evento
::
where
(
'id'
,
$request
->
evento_id
)
->
first
();
$trabalhos
=
$evento
->
trabalhos
;
return
view
(
'coordenadorComissao.listarTrabalhos'
,
[
'trabalhos'
=>
$trabalhos
]);
}
public
function
detalhesEdital
(
Request
$request
){
$evento
=
Evento
::
where
(
'id'
,
$request
->
evento_id
)
->
first
();
$trabalhos
=
$evento
->
trabalhos
;
return
view
(
'coordenadorComissao.detalhesEdital'
,
[
'evento'
=>
$evento
]);
}
public
function
retornoDetalhes
(
Request
$request
){
// array:2 [▼
// "item" => "listarTrabalhos"
// "evento_id" => "1"
// ]
//dd($request->all());
if
(
$request
->
item
==
"definirSubmissoes"
){
}
else
if
(
$request
->
item
==
"listarTrabalhos"
){
$evento
=
Evento
::
where
(
'id'
,
$request
->
evento_id
)
->
first
();
$trabalhos
=
$evento
->
trabalhos
;
//dd($trabalhos);
return
view
(
'coordenadorComissao.gerenciarEdital.listarTrabalhos'
,
[
'trabalhos'
=>
$trabalhos
]);
}
else
if
(
$request
->
item
==
"cadastrarAreas"
){
return
view
(
'coordenadorComissao.gerenciarEdital.cadastrarAreas'
,
[
'trabalhos'
=>
$trabalhos
]);
}
else
if
(
$request
->
item
==
"listarAreas"
){
return
view
(
'coordenadorComissao.gerenciarEdital.listarAreas'
,
[
'trabalhos'
=>
$trabalhos
]);
}
else
if
(
$request
->
item
==
"cadastrarRevisores"
){
return
view
(
'coordenadorComissao.gerenciarEdital.cadastrarRevisores'
,
[
'trabalhos'
=>
$trabalhos
]);
}
else
if
(
$request
->
item
==
"listarRevisores"
){
$avaliadores
=
Avaliador
::
all
();
return
view
(
'coordenadorComissao.gerenciarEdital.listarRevisores'
,
[
'avaliadores'
=>
$avaliadores
]);
}
else
if
(
$request
->
item
==
"definirCoordenador"
){
return
view
(
'coordenadorComissao.gerenciarEdital.definirCoordenador'
,
[
'trabalhos'
=>
$trabalhos
]);
}
else
if
(
$request
->
item
==
"listarComissao"
){
return
view
(
'coordenadorComissao.gerenciarEdital.listarComissao'
,
[
'trabalhos'
=>
$trabalhos
]);
}
}
}
app/Http/Controllers/TrabalhoController.php
View file @
94275bdd
...
...
@@ -18,6 +18,7 @@ use App\GrandeArea;
use
App\SubArea
;
use
App\FuncaoParticipantes
;
use
App\Participante
;
use
App\Avaliador
;
use
Carbon\Carbon
;
use
Auth
;
use
Illuminate\Http\Request
;
...
...
@@ -27,6 +28,7 @@ use Illuminate\Support\Facades\Mail;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Str
;
use
App\Mail\SubmissaoTrabalho
;
use
App\Mail\EventoCriado
;
class
TrabalhoController
extends
Controller
{
...
...
@@ -401,5 +403,39 @@ class TrabalhoController extends Controller
'revisoresDisponiveis'
=>
$revisoresAux1
],
200
);
}
public
function
atribuirAvaliadorTrabalho
(
Request
$request
){
$request
->
trabalho_id
;
$trabalho
=
Trabalho
::
find
(
$request
->
trabalho_id
);
$avaliadores
=
Avaliador
::
all
();
return
view
(
'coordenadorComissao.gerenciarEdital.atribuirAvaliadorTrabalho'
,
[
'avaliadores'
=>
$avaliadores
,
'trabalho'
=>
$trabalho
,
'evento'
=>
$trabalho
->
evento
]);
}
public
function
atribuir
(
Request
$request
){
$trabalho
=
Trabalho
::
find
(
$request
->
trabalho_id
);
$todosAvaliadores
=
Avaliador
::
all
();
$avaliadores
=
Avaliador
::
whereIn
(
'id'
,
$request
->
avaliadores
)
->
with
(
'user'
)
->
get
();
$trabalho
->
avaliadors
()
->
sync
(
$request
->
avaliadores
);
foreach
(
$avaliadores
as
$key
=>
$avaliador
)
{
$user
=
$avaliador
->
user
;
$subject
=
"Trabalho atribuido"
;
Mail
::
to
(
$user
->
email
)
->
send
(
new
EventoCriado
(
$user
,
$subject
));
}
return
view
(
'coordenadorComissao.detalhesEdital'
,
[
'evento'
=>
$trabalho
->
evento
]);
}
}
app/Trabalho.php
View file @
94275bdd
...
...
@@ -67,7 +67,7 @@ class Trabalho extends Model
}
public
function
evento
(){
return
$this
->
belongsTo
(
'App\Evento'
,
'eventoId'
);
return
$this
->
belongsTo
(
'App\Evento'
);
}
public
function
planoTrabalho
(){
return
$this
->
hasMany
(
'App\PlanoTrabalho'
);
...
...
database/seeds/DatabaseSeeder.php
View file @
94275bdd
...
...
@@ -22,6 +22,7 @@ class DatabaseSeeder extends Seeder
$this
->
call
(
FuncaoParticipanteSeeder
::
class
);
$this
->
call
(
CoordenadorComissaoSeeder
::
class
);
$this
->
call
(
ParticipanteSeeder
::
class
);
// $this->call(UsersTableSeeder::class);
// DB::table('enderecos')->insert([ // 1
...
...
@@ -134,6 +135,6 @@ class DatabaseSeeder extends Seeder
// ];
$this
->
call
(
TrabalhoSeeder
::
class
);
}
}
resources/views/coordenadorComissao/detalhesEdital.blade.php
View file @
94275bdd
...
...
@@ -15,7 +15,7 @@
<
img
src
=
"
{
{asset('img/icons/file-alt-regular.svg')}
}
"
alt
=
""
><
h5
>
Trabalhos
</
h5
><
img
class
=
"arrow"
src
=
"
{
{asset('img/icons/arrow.svg')}
}
"
>
</
li
>
<
ul
class
=
"sub-menu collapse"
id
=
"ajuda"
style
=
"background-color: gray"
>
<
a
id
=
"
s
ubmissoes"
class
=
"exibir"
>
<
a
id
=
"
definirS
ubmissoes"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/plus-square-solid.svg')}
}
"
alt
=
""
><
h5
>
Definir
Submissões
</
h5
>
</
li
>
...
...
@@ -32,12 +32,12 @@
<
img
src
=
"
{
{asset('img/icons/area.svg')}
}
"
alt
=
""
><
h5
>
Áreas
</
h5
><
img
class
=
"arrow"
src
=
"
{
{asset('img/icons/arrow.svg')}
}
"
>
</
li
>
<
ul
class
=
"sub-menu collapse"
id
=
"menuAreas"
style
=
"background-color: gray"
>
<
a
>
<
a
id
=
"cadastrarAreas"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/plus-square-solid.svg')}
}
"
alt
=
""
><
h5
>
Cadastrar
Áreas
</
h5
>
</
li
>
</
a
>
<
a
>
<
a
id
=
"listarAreas"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/list.svg')}
}
"
alt
=
""
><
h5
>
Listar
Áreas
</
h5
>
</
li
>
...
...
@@ -49,12 +49,12 @@
<
img
src
=
"
{
{asset('img/icons/glasses-solid.svg')}
}
"
alt
=
""
><
h5
>
Avaliadores
</
h5
><
img
class
=
"arrow"
src
=
"
{
{asset('img/icons/arrow.svg')}
}
"
>
</
li
>
<
ul
class
=
"sub-menu collapse"
id
=
"menuAvaliador"
style
=
"background-color: gray"
>
<
a
>
<
a
id
=
"cadastrarRevisores"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/user-plus-solid.svg')}
}
"
alt
=
""
><
h5
>
Cadastrar
Revisores
</
h5
>
</
li
>
</
a
>
<
a
>
<
a
id
=
"listarRevisores"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/list.svg')}
}
"
alt
=
""
><
h5
>
Listar
Revisores
</
h5
>
</
li
>
...
...
@@ -67,12 +67,12 @@
<
img
src
=
"
{
{asset('img/icons/user-tie-solid.svg')}
}
"
alt
=
""
><
h5
>
Comissão
</
h5
><
img
class
=
"arrow"
src
=
"
{
{asset('img/icons/arrow.svg')}
}
"
>
</
li
>
<
ul
class
=
"sub-menu collapse"
id
=
"menuComissao"
style
=
"background-color: gray"
>
<
a
>
<
a
id
=
"definirCoordenador"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/crown-solid.svg')}
}
"
alt
=
""
><
h5
>
Definir
Coordenador
</
h5
>
</
li
>
</
a
>
<
a
>
<
a
id
=
"listarComissao"
class
=
"exibir"
>
<
li
>
<
img
src
=
"
{
{asset('img/icons/list.svg')}
}
"
alt
=
""
><
h5
>
Listar
Comissão
</
h5
>
</
li
>
...
...
@@ -99,15 +99,10 @@
@
endsection
@
section
(
'javascript'
)
<
script
type
=
"text/javascript"
>
$
(
document
)
.
ready
(()
=>
{
$
(
'.exibir'
)
.
on
(
'click'
,(
event
)
=>
{
event
.
preventDefault
();
console
.
log
(
event
.
currentTarget
.
id
);
...
...
resources/views/coordenadorComissao/editais.blade.php
View file @
94275bdd
...
...
@@ -24,7 +24,7 @@
@
foreach
(
$eventos
as
$evento
)
<
tr
>
<
td
>
<
a
href
=
"{{ route('
evento.visualizar',['
id'=>
$evento->id
]) }}"
class
=
"visualizarEvento"
>
<
a
href
=
"{{ route('
coordenador.detalhesEdital',['evento_
id'=>
$evento->id
]) }}"
class
=
"visualizarEvento"
>
{{
$evento
->
nome
}}
</
a
>
</
td
>
...
...
resources/views/coordenadorComissao/gerenciarEdital/atribuirAvaliadorTrabalho.blade.php
0 → 100644
View file @
94275bdd
@
extends
(
'layouts.app'
)
@
section
(
'content'
)
<
div
class
=
"container"
style
=
"margin-top: 100px;"
>
<
h2
>
{{
$trabalho
->
titulo
}}
</
h2
>
<
form
action
=
"{{ route('coordenador.atribuir') }}"
method
=
"post"
enctype
=
"multipart/form-data"
>
@
csrf
<
input
type
=
"hidden"
name
=
"trabalho_id"
value
=
"
{
{$trabalho->id}
}
"
>
<
div
class
=
"form-group"
>
<
label
>
Avaliadores
</
label
>
<
select
name
=
"avaliadores[]"
id
=
""
class
=
"form-control"
multiple
>
@
foreach
(
$avaliadores
as
$avaliador
)
<
option
value
=
"
{
{$avaliador->id}}">{{$avaliador->user->name}
}
</option>
@endforeach
</select>
</div>
<div>
<a href="
{{
route
(
'coordenador.detalhesEdital'
,
[
'evento_id'
=>
$evento
->
id
])
}}
" class="
btn
btn
-
danger
">Cancelar</a>
<button type="
submit
" class="
btn
btn
-
primary
">Atribuir</button>
</div>
</form>
</div>
@endsection
@section('javascript')
<script>
</script>
@endsection
resources/views/coordenadorComissao/gerenciarEdital/listarRevisores.blade.php
0 → 100644
View file @
94275bdd
<div
class=
"col-sm-10"
>
<h1
class=
""
>
Avaliadores
</h1>
</div>
<table
class=
"table table-hover table-responsive-lg table-sm"
>
<thead>
<tr>
<th
scope=
"col"
>
ID
</th>
<th
scope=
"col"
>
Nome
</th>
<th
scope=
"col"
>
E-mail
</th>
<th
scope=
"col"
>
Trabalhos
</th>
<th
scope=
"col"
>
Visualizar
</th>
</tr>
</thead>
<tbody>
@php $i = 0; @endphp
@foreach($avaliadores as $avaliador)
<tr>
<td>
{{$avaliador->id}}
</td>
<td>
{{$avaliador->user->name}}
</td>
<td>
{{$avaliador->user->email}}
</td>
<td>
</td>
<td>
</td>
</tr>
@endforeach
</tbody>
</table>
resources/views/coordenadorComissao/gerenciarEdital/listarTrabalhos.blade.php
0 → 100644
View file @
94275bdd
<div
class=
"col-sm-10"
>
<h1
class=
""
>
Trabalhos
</h1>
</div>
<table
class=
"table table-hover table-responsive-lg table-sm"
>
<thead>
<tr>
<th
scope=
"col"
>
ID
</th>
<th
scope=
"col"
>
Titulo
</th>
<th
scope=
"col"
>
Avaliadores
</th>
<th
scope=
"col"
style=
"text-align:center"
>
Baixar
</th>
<th
scope=
"col"
style=
"text-align:center"
>
Atribuição
</th>
</tr>
</thead>
<tbody>
@php $i = 0; @endphp
@foreach($trabalhos as $trabalho)
<tr>
<td>
{{$trabalho->id}}
</td>
<td>
{{$trabalho->titulo}}
</td>
<td>
@foreach($trabalho->avaliadors as $atribuicao)
{{$atribuicao->user->email}},
@endforeach
</td>
<td
style=
"text-align:center"
>
@php $arquivo = ""; $i++; @endphp
@foreach($trabalho->arquivo as $key)
@php
if($key->versaoFinal == true){
$arquivo = $key->nome;
}
@endphp
@endforeach
<img
onclick=
"document.getElementById('formDownload{{$i}}').submit();"
class=
""
src=
"{{asset('img/icons/file-download-solid-black.svg')}}"
style=
"width:20px"
alt=
""
>
<form
method=
"GET"
action=
"{{ route('download') }}"
target=
"_new"
id=
"formDownload{{$i}}"
>
<input
type=
"hidden"
name=
"file"
value=
"{{$arquivo}}"
>
</form>
</td>
<td
style=
"text-align:center"
>
<a
id=
"listarComissao"
class=
"exibir"
>
<form
action=
"{{ route('coordenador.atribuirAvaliadorTrabalho') }}"
method=
"POST"
>
@csrf
<input
type=
"hidden"
name=
"trabalho_id"
value=
"{{$trabalho->id}}"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
Atribuir Avaliadores
</button>
</form>
{{--
<a
class=
"botaoAjax"
href=
"#"
data-toggle=
"modal"
onclick=
""
data-target=
"#modalTrabalho"
><img
src=
"{{asset('img/icons/eye-regular.svg')}}"
style=
"width:20px"
></a>
--}}
</td>
</tr>
@endforeach
</tbody>
</table>
resources/views/coordenadorComissao/listarTrabalhos.blade.php
deleted
100644 → 0
View file @
904ecc3f
<div
class=
"col-sm-10"
>
<h1
class=
""
>
Trabalhos
</h1>
</div>
<table
class=
"table table-hover table-responsive-lg table-sm"
>
<thead>
<tr>
<th
scope=
"col"
>
ID
</th>
<th
scope=
"col"
>
Área
</th>
<th
scope=
"col"
>
Avaliadores
</th>
<th
scope=
"col"
style=
"text-align:center"
>
Baixar
</th>
<th
scope=
"col"
style=
"text-align:center"
>
Visualizar
</th>
</tr>
</thead>
<tbody>
@php $i = 0; @endphp
@foreach($trabalhos as $trabalho)
<tr>
<td>
{{$trabalho->id}}
</td>
<td>
{{-- {{$trabalho->area->nome}} --}}
</td>
<td>
@foreach($trabalho->avaliadors as $atribuicao)
{{$atribuicao->user->email}},
@endforeach
</td>
<td
style=
"text-align:center"
>
@php $arquivo = ""; $i++; @endphp
@foreach($trabalho->arquivo as $key)
@php
if($key->versaoFinal == true){
$arquivo = $key->nome;
}
@endphp
@endforeach
<img
onclick=
"document.getElementById('formDownload{{$i}}').submit();"
class=
""
src=
"{{asset('img/icons/file-download-solid-black.svg')}}"
style=
"width:20px"
alt=
""
>
<form
method=
"GET"
action=
"{{ route('download') }}"
target=
"_new"
id=
"formDownload{{$i}}"
>
<input
type=
"hidden"
name=
"file"
value=
"{{$arquivo}}"
>
</form>
</td>
<td
style=
"text-align:center"
>
<a
class=
"botaoAjax"
href=
"#"
data-toggle=
"modal"
onclick=
"trabalhoId({{$trabalho->id}})"
data-target=
"#modalTrabalho"
><img
src=
"{{asset('img/icons/eye-regular.svg')}}"
style=
"width:20px"
></a>
</td>
</tr>
@endforeach
</tbody>
</table>
\ No newline at end of file
routes/web.php
View file @
94275bdd
...
...
@@ -95,6 +95,13 @@ Route::get('/coordenador/listarCoord', 'CoordenadorComissaoController@coordenado
Route
::
get
(
'/coordenador/listarAvaliador'
,
'CoordenadorComissaoController@avaliador'
)
->
name
(
'coordenador.avaliador'
);
Route
::
get
(
'/coordenador/listarProponente'
,
'CoordenadorComissaoController@proponente'
)
->
name
(
'coordenador.proponente'
);
Route
::
get
(
'/coordenador/listarParticipante'
,
'CoordenadorComissaoController@participante'
)
->
name
(
'coordenador.participante'
);
Route
::
get
(
'/coordenador/listarTrabalhos'
,
'CoordenadorComissaoController@listarTrabalhos'
)
->
name
(
'coordenador.listarTrabalhos'
);
Route
::
get
(
'/coordenador/detalhesEdital'
,
'CoordenadorComissaoController@detalhesEdital'
)
->
name
(
'coordenador.detalhesEdital'
);
Route
::
post
(
'/coordenador/retornoDetalhes'
,
'CoordenadorComissaoController@retornoDetalhes'
)
->
name
(
'coordenador.retornoDetalhes'
);
Route
::
post
(
'/coordenador/atribuirAvaliadorTrabalho'
,
'TrabalhoController@atribuirAvaliadorTrabalho'
)
->
name
(
'coordenador.atribuirAvaliadorTrabalho'
);
Route
::
post
(
'/coordenador/atribuir'
,
'TrabalhoController@atribuir'
)
->
name
(
'coordenador.atribuir'
);
Route
::
group
([
'middleware'
=>
[
'isTemp'
,
'auth'
,
'verified'
]],
function
(){
...
...
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