Commit 8e9f859b authored by carlos's avatar carlos
Browse files

visualizar projeto

parent 7a525de0
...@@ -86,6 +86,10 @@ class ArquivoController extends Controller ...@@ -86,6 +86,10 @@ class ArquivoController extends Controller
public function baixarPlano($id) { public function baixarPlano($id) {
$arquivo = Arquivo::find($id); $arquivo = Arquivo::find($id);
return Storage::download($arquivo->nome);
if (Storage::disk()->exists($arquivo->nome)) {
return Storage::download($arquivo->nome);
}
return abort(404);
} }
} }
...@@ -266,9 +266,28 @@ class TrabalhoController extends Controller ...@@ -266,9 +266,28 @@ class TrabalhoController extends Controller
* @param \App\Trabalho $trabalho * @param \App\Trabalho $trabalho
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function show(Trabalho $trabalho) public function show($id)
{ {
// $projeto = Trabalho::find($id);
$edital = Evento::find($projeto->evento_id);
$grandeAreas = GrandeArea::orderBy('nome')->get();
$areas = Area::orderBy('nome')->get();
$subareas = Subarea::orderBy('nome')->get();
$funcaoParticipantes = FuncaoParticipantes::all();
$participantes = Participante::where('trabalho_id', $id)->get();
$participantesUsersIds = Participante::where('trabalho_id', $id)->select('user_id')->get();
$users = User::whereIn('id', $participantesUsersIds)->get();
$arquivos = Arquivo::where('trabalhoId', $id)->get();
return view('projeto.visualizar')->with(['projeto' => $projeto,
'grandeAreas' => $grandeAreas,
'areas' => $areas,
'subAreas' => $subareas,
'edital' => $edital,
'users' => $users,
'funcaoParticipantes' => $funcaoParticipantes,
'participantes' => $participantes,
'arquivos' => $arquivos,]);
} }
/** /**
...@@ -650,26 +669,45 @@ class TrabalhoController extends Controller ...@@ -650,26 +669,45 @@ class TrabalhoController extends Controller
public function baixarAnexoProjeto($id) { public function baixarAnexoProjeto($id) {
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
return Storage::download($projeto->anexoProjeto); if (Storage::disk()->exists($projeto->anexoProjeto)) {
return Storage::download($projeto->anexoProjeto);
}
return abort(404);
} }
public function baixarAnexoConsu($id) { public function baixarAnexoConsu($id) {
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
return Storage::download($projeto->anexoDecisaoCONSU);
if (Storage::disk()->exists($projeto->anexoDecisaoCONSU)) {
return Storage::download($projeto->anexoDecisaoCONSU);
}
return abort(404);
} }
public function baixarAnexoComite($id) { public function baixarAnexoComite($id) {
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
return Storage::download($projeto->anexoAutorizacaoComiteEtica);
if (Storage::disk()->exists($projeto->anexoAutorizacaoComiteEtica)) {
return Storage::download($projeto->anexoAutorizacaoComiteEtica);
}
return abort(404);
} }
public function baixarAnexoLattes($id) { public function baixarAnexoLattes($id) {
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
return Storage::download($projeto->anexoLattesCoordenador);
if (Storage::disk()->exists($projeto->anexoLattesCoordenador)) {
return Storage::download($projeto->anexoLattesCoordenador);
}
return abort(404);
} }
public function baixarAnexoPlanilha($id) { public function baixarAnexoPlanilha($id) {
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
return Storage::download($projeto->anexoPlanilhaPontuacao);
if (Storage::disk()->exists($projeto->anexoPlanilhaPontuacao)) {
return Storage::download($projeto->anexoPlanilhaPontuacao);
}
return abort(404);
} }
} }
...@@ -564,6 +564,8 @@ ...@@ -564,6 +564,8 @@
$.each(dados, function(i, obj){ $.each(dados, function(i, obj){
option += '<option value="'+obj.id+'">'+obj.nome+'</option>'; option += '<option value="'+obj.id+'">'+obj.nome+'</option>';
}) })
} else {
var option = "<option>-- Área --</option>";
} }
$('#area').html(option).show(); $('#area').html(option).show();
}) })
...@@ -578,6 +580,8 @@ ...@@ -578,6 +580,8 @@
$.each(dados, function(i, obj){ $.each(dados, function(i, obj){
option += '<option value="'+obj.id+'">'+obj.nome+'</option>'; option += '<option value="'+obj.id+'">'+obj.nome+'</option>';
}) })
} else {
var option = "<option>-- Sub Área --</option>";
} }
$('#subArea').html(option).show(); $('#subArea').html(option).show();
}) })
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-sm-4"> <div class="col-sm-4">
<label for="grandeArea" class="col-form-label">{{ __('Grande Área:') }}</label> <label for="grandeArea" class="col-form-label">{{ __('Grande Área:') }}</label>
<select class="form-control @error('grandeArea') is-invalid @enderror" id="grandeArea" name="grandeArea"> <select class="form-control @error('grandeArea') is-invalid @enderror" id="grandeArea" name="grandeArea" onchange="areas()">
<option value="" disabled selected hidden>-- Grande Área --</option> <option value="" disabled selected hidden>-- Grande Área --</option>
@foreach($grandeAreas as $grandeArea) @foreach($grandeAreas as $grandeArea)
@if($grandeArea->id === $projeto->grande_area_id) @if($grandeArea->id === $projeto->grande_area_id)
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
<label for="area" class="col-form-label">{{ __('Área:') }}</label> <label for="area" class="col-form-label">{{ __('Área:') }}</label>
<select class="form-control @error('area') is-invalid @enderror" id="area" name="area"> <select class="form-control @error('area') is-invalid @enderror" id="area" name="area" onchange="subareas()">
<option value="" disabled selected hidden>-- Área --</option> <option value="" disabled selected hidden>-- Área --</option>
@foreach($areas as $area) @foreach($areas as $area)
@if($area->id === $projeto->area_id) @if($area->id === $projeto->area_id)
...@@ -418,10 +418,10 @@ ...@@ -418,10 +418,10 @@
}); });
// Exibir modalidade de acordo com a área // Exibir modalidade de acordo com a área
$("#area").change(function() { // $("#area").change(function() {
console.log($(this).val()); // console.log($(this).val());
addModalidade($(this).val()); // addModalidade($(this).val());
}); // });
$(document).on('click', '.delete', function() { $(document).on('click', '.delete', function() {
if (qtdParticipantes > 1) { if (qtdParticipantes > 1) {
qtdParticipantes--; qtdParticipantes--;
...@@ -457,16 +457,16 @@ ...@@ -457,16 +457,16 @@
}); });
// Remover Coautor // Remover Coautor
function addModalidade(areaId) { // function addModalidade(areaId) {
console.log(modalidades) // console.log(modalidades)
$("#modalidade").empty(); // $("#modalidade").empty();
for (let i = 0; i < modalidades.length; i++) { // for (let i = 0; i < modalidades.length; i++) {
if (modalidades[i].areaId == areaId) { // if (modalidades[i].areaId == areaId) {
console.log(modalidades[i]); // console.log(modalidades[i]);
$("#modalidade").append("<option value=" + modalidades[i].modalidadeId + ">" + modalidades[i].modalidadeNome + "</option>") // $("#modalidade").append("<option value=" + modalidades[i].modalidadeId + ">" + modalidades[i].modalidadeNome + "</option>")
} // }
} // }
} // }
function montarLinhaInput() { function montarLinhaInput() {
...@@ -577,5 +577,37 @@ ...@@ -577,5 +577,37 @@
// "</div>"+ // "</div>"+
// "</div>"; // "</div>";
// } // }
function areas() {
var grandeArea = $('#grandeArea').val();
$.getJSON("{{ config('app.url') }}/naturezas/areas/" + grandeArea,
function (dados){
if (dados.length > 0){
var option = "<option>-- Área --</option>";
$.each(dados, function(i, obj){
option += '<option value="'+obj.id+'">'+obj.nome+'</option>';
})
} else {
var option = "<option>-- Área --</option>";
}
$('#area').html(option).show();
})
}
function subareas() {
var area = $('#area').val();
$.getJSON("{{ config('app.url') }}/naturezas/subarea/" + area,
function (dados){
if (dados.length > 0){
var option = "<option>-- Sub Área --</option>";
$.each(dados, function(i, obj){
option += '<option value="'+obj.id+'">'+obj.nome+'</option>';
})
} else {
var option = "<option>-- Sub Área --</option>";
}
$('#subArea').html(option).show();
})
}
</script> </script>
@endsection @endsection
\ No newline at end of file
...@@ -50,9 +50,9 @@ ...@@ -50,9 +50,9 @@
<a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;"> <a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;">
Editar projeto Editar projeto
</a> </a>
{{-- <a href="" class="dropdown-item" style="text-align: center"> <a href="{{ route('trabalho.show', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center">
Adicionar participantes Visualizar projeto
</a> --}} </a>
<a href="" class="dropdown-item" style="text-align: center"> <a href="" class="dropdown-item" style="text-align: center">
Recorrer Recorrer
</a> </a>
......
@extends('layouts.app')
@section('content')
<div class="container content">
<div class="row justify-content-center">
<div class="col-sm-12">
<div class="card" style="margin-top:50px">
<div class="card-body">
<h3 class="card-title">Dados do Projeto</h3>
<p class="card-text">
<input type="hidden" name="editalId" value="{{ $edital->id }}">
{{-- Nome do Projeto --}}
<div class="row justify-content-center">
<div class="col-sm-12">
<label for="nomeTrabalho" class="col-form-label">{{ __('Nome do Projeto:') }}</label>
<input id="nomeTrabalho" value="{{ $projeto->titulo }}" type="text" class="form-control @error('nomeTrabalho') is-invalid @enderror" name="nomeProjeto" value="{{ old('nomeTrabalho') }}" required autocomplete="nomeTrabalho" autofocus disabled>
@error('nomeTrabalho')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
{{-- Grande Area --}}
<div class="row justify-content-center">
<div class="col-sm-4">
<label for="grandeArea" class="col-form-label">{{ __('Grande Área:') }}</label>
<select class="form-control @error('grandeArea') is-invalid @enderror" id="grandeArea" name="grandeArea" disabled>
<option value="" disabled selected hidden>-- Grande Área --</option>
@foreach($grandeAreas as $grandeArea)
@if($grandeArea->id === $projeto->grande_area_id)
<option value="{{$grandeArea->id}}" selected>{{$grandeArea->nome}}</option>
@else
<option value="{{$grandeArea->id}}">{{$grandeArea->nome}}</option>
@endif
@endforeach
</select>
@error('grandeArea')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label for="area" class="col-form-label">{{ __('Área:') }}</label>
<select class="form-control @error('area') is-invalid @enderror" id="area" name="area" disabled>
<option value="" disabled selected hidden>-- Área --</option>
@foreach($areas as $area)
@if($area->id === $projeto->area_id)
<option value="{{$area->id}}" selected>{{$area->nome}}</option>
@else
<option value="{{$area->id}}">{{$area->nome}}</option>
@endif
@endforeach
</select>
@error('area')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label for="subArea" class="col-form-label">{{ __('Sub Área:') }}</label>
<select class="form-control @error('subArea') is-invalid @enderror" id="subArea" name="subArea" disabled>
<option value="" disabled selected hidden>-- Sub Área --</option>
@foreach($subAreas as $subArea)
@if($subArea->id === $projeto->sub_area_id)
<option value="{{$subArea->id}}" selected>{{$subArea->nome}}</option>
@else
<option value="{{$subArea->id}}">{{$subArea->nome}}</option>
@endif
@endforeach
</select>
@error('subArea')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<hr>
<h3>Coordenador</h3>
{{-- Coordenador --}}
<div class="row justify-content-center">
<div class="col-sm-6">
<label for="nomeCoordenador" class="col-form-label">{{ __('Coordenador:') }}</label>
<input class="form-control" value="{{ auth()->user()->name }}" type="text" id="nomeCoordenador" name="nomeCoordenador" disabled="disabled" value="{{ Auth()->user()->name }}">
</div>
<div class="col-sm-6">
<label for="nomeTrabalho" class="col-form-label">Link Lattes do Proponente</label>
<input class="form-control @error('linkLattesEstudante') is-invalid @enderror" type="text" name="linkLattesEstudante"
@if(Auth()->user()->proponentes->linkLattes != null)
value="{{ Auth()->user()->proponentes->linkLattes }}"
@else
value=""
@endif disabled>
@error('linkLattesEstudante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="nomeTrabalho" class="col-form-label">{{ __('Pontuação da Planilha de Pontuação :') }}</label>
<input value="{{ $projeto->pontuacaoPlanilha }}" class="form-control @error('pontuacaoPlanilha') is-invalid @enderror" type="text" name="pontuacaoPlanilha" disabled>
@error('pontuacaoPlanilha')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-6">
<label for="nomeTrabalho" class="col-form-label">{{ __('Link do grupo de pesquisa:') }}</label>
<input value="{{ $projeto->linkGrupoPesquisa }}" class="form-control @error('linkGrupo') is-invalid @enderror" type="text" name="linkGrupo" disabled>
@error('linkGrupo')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<hr>
<h3>Anexos</h3>
{{-- Anexo do Projeto --}}
<div class="row">
{{-- Arquivo --}}
<ul>
<li>
<a href="{{ route('baixar.anexo.projeto', ['id' => $projeto->id])}}">{{ __('Projeto') }}</a>
</li>
<li>
<a href="{{ route('baixar.anexo.lattes', ['id' => $projeto->id]) }}">{{ __('Lattes do Coordenador') }}</a>
</li>
<li>
@if (!(is_null($projeto->anexoAutorizacaoComiteEdica)))
<a href="{{ route('baixar.anexo.comite', ['id' => $projeto->id]) }}">{{ __('Autorização do Comitê de Ética') }}</a>
@else
<a href="#">{{ __('Justificativa do Comitê de Ética') }}</a>
@endif
</li>
<li>
<a href="{{ route('baixar.anexo.planilha', ['id' => $projeto->id]) }}">{{ __('Planilha de Pontuação') }}</a>
</li>
@if($edital->tipo == 'PIBIC' || $edital->tipo == 'PIBIC-EM')
<li>
<a href="{{ route('baixar.anexo.consu', ['id' => $projeto->id]) }}">{{__('Decisão do CONSU')}}</a>
</li>
@endif
</ul>
</div>
<hr>
<h3>Participantes</h3>
{{-- Participantes --}}
<div class="row" style="margin-top:20px">
<div class="col-sm-12">
<div id="participantes">
@foreach($participantes as $participante)
@foreach($users as $user)
@if($participante->user_id === $user->id)
<div id="novoParticipante">
<br>
<div class="row">
<div class="col-sm-5">
<label>Nome Completo</label>
<input value="{{ $user->name }}" type="text" style="margin-bottom:10px" class="form-control @error('nomeParticipante') is-invalid @enderror" name="nomeParticipante[]" placeholder="Nome" required disabled>
@error('nomeParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-4">
<label>E-mail</label>
<input value="{{ $user->email }}" type="email" style="margin-bottom:10px" class="form-control @error('emailParticipante') is-invalid @enderror" name="emailParticipante[]" placeholder="email" required disabled>
@error('emailParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="col-sm-3">
<label>Função:</label>
<select class="form-control @error('funcaoParticipante') is-invalid @enderror" name="funcaoParticipante[]" id="funcaoParticipante" disabled>
<option value="" disabled selected hidden>-- Função --</option>
@foreach($funcaoParticipantes as $funcaoParticipante)
@if($funcaoParticipante->id === $participante->funcao_participante_id)
<option value="{{$funcaoParticipante->id}}" selected>{{$funcaoParticipante->nome}}</option>
@else
<option value="{{$funcaoParticipante->id}}">{{$funcaoParticipante->nome}}</option>
@endif
@endforeach
@error('funcaoParticipante')
<span class="invalid-feedback" role="alert" style="overflow: visible; display:block">
<strong>{{ $message }}</strong>
</span>
@enderror
</select>
</div>
</div>
@foreach ($arquivos as $arquivo)
@if($arquivo->participanteId === $participante->id)
<a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">Plano de trabalho atual</a>
@endif
@endforeach
</div>
@endif
@endforeach
@endforeach
</div>
</div>
</div>
</p>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('javascript')
<script>
</script>
@endsection
\ No newline at end of file
...@@ -91,9 +91,10 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){ ...@@ -91,9 +91,10 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){
Route::post( '/trabalho/novaVersao', 'TrabalhoController@novaVersao' )->name('trabalho.novaVersao'); Route::post( '/trabalho/novaVersao', 'TrabalhoController@novaVersao' )->name('trabalho.novaVersao');
Route::post( '/trabalho/criar', 'TrabalhoController@store' )->name('trabalho.store'); Route::post( '/trabalho/criar', 'TrabalhoController@store' )->name('trabalho.store');
Route::get( '/edital/{id}/projetos', 'TrabalhoController@projetosDoEdital' )->name('projetos.edital'); Route::get( '/edital/{id}/projetos', 'TrabalhoController@projetosDoEdital' )->name('projetos.edital');
Route::get( '/projeto/{id}/visualizar', 'TrabalhoController@show' )->name('trabalho.show');
Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar'); Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar');
Route::post( '/projeto/{id}/atualizar', 'TrabalhoController@update' )->name('trabalho.update'); Route::post( '/projeto/{id}/atualizar', 'TrabalhoController@update' )->name('trabalho.update');
Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy'); Route::get( '/projeto/{id}/excluir', 'TrabalhoController@destroy' )->name('trabalho.destroy');
//######### Atribuição ####################################### //######### Atribuição #######################################
Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao'); Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment