Commit e845ab51 authored by carlos's avatar carlos
Browse files

atualizando criar e editar projeto

parent ae44f10e
......@@ -80,7 +80,7 @@ class TrabalhoController extends Controller
$proponente = Proponente::where('user_id', Auth::user()->id)->first();
//$trabalho->proponentes()->save($proponente);
//dd($coordenador->id);
$trabalho = "trabalho";
if($evento->inicioSubmissao > $mytime){
if($mytime >= $evento->fimSubmissao){
return redirect()->route('home');
......@@ -179,8 +179,6 @@ class TrabalhoController extends Controller
}
//Envia email com senha temp para cada participante do projeto
if($request->emailParticipante != null){
......@@ -198,11 +196,10 @@ class TrabalhoController extends Controller
'usuarioTemp' => true,
'name' => $request->nomeParticipante[$key],
'tipo' => 'participante',
'funcao_participante_id' => $request->funcaoParticipante[$key],
]);
$participante = $usuario->participantes()->create([
'trabalho_id' => $trabalho->id,
'funcao_participante_id' => $request->funcaoParticipante[$key],
]);
$participante->trabalhos()->save($trabalho);
......@@ -216,29 +213,14 @@ class TrabalhoController extends Controller
}
}
$anexos = array(
$request->anexoCONSU,
$request->anexoProjeto,
$request->anexoComiteEtica,
$request->anexoLatterCoordenador,
$request->anexoPlanilha,
);
foreach ($anexos as $key => $value) {
$pasta = 'trabalhos/' . $request->editalId . '/' . $trabalho->id;
$file = $value;
$path = 'trabalhos/' . $request->editalId . '/' . $trabalho->id .'/';
$nome = "1.pdf";
Storage::putFileAs($path, $file, $nome);
$arquivo = Arquivo::create([
'nome' => $path . $nome,
'trabalhoId' => $trabalho->id,
'data' => $mytime,
'versaoFinal' => true,
]);
}
$trabalho->anexoDecisaoCONSU = Storage::putFileAs($pasta, $request->anexoCONSU, "CONSU.pdf");
$trabalho->anexoProjeto = Storage::putFileAs($pasta, $request->anexoProjeto, "Projeto.pdf");
$trabalho->anexoAutorizacaoComiteEtica = Storage::putFileAs($pasta, $request->anexoComiteEtica, "Comite_de_etica.pdf");
$trabalho->anexoLattesCoordenador = Storage::putFileAs($pasta, $request->anexoLatterCoordenador, "Latter_Coordenador.pdf");
$trabalho->anexoPlanilhaPontuacao = Storage::putFileAs($pasta, $request->anexoPlanilha, "Planilha.pdf");
$trabalho->update();
if($request->anexoPlanoTrabalho != null){
foreach ($request->anexoPlanoTrabalho as $key => $value) {
......@@ -285,9 +267,23 @@ class TrabalhoController extends Controller
* @param \App\Trabalho $trabalho
* @return \Illuminate\Http\Response
*/
public function edit(Trabalho $trabalho)
public function edit($id)
{
//
$projeto = Trabalho::find($id);
$edital = Evento::find($projeto->evento_id);
$grandeAreas = GrandeArea::all();
$areas = Area::all();
$subareas = Subarea::all();
$funcaoParticipantes = FuncaoParticipantes::all();
$participantes = Participante::where('trabalho_id', $id)->get();
return view('projeto.editar')->with(['projeto' => $projeto,
'grandeAreas' => $grandeAreas,
'areas' => $areas,
'subAreas' => $subareas,
'edital' => $edital,
'funcaoParticipantes' => $funcaoParticipantes,
'participantes' => $participantes]);
}
/**
......@@ -451,4 +447,29 @@ class TrabalhoController extends Controller
return view('projeto.index')->with(['edital' => $edital, 'projetos' => $projetos]);
}
public function baixarAnexoProjeto($id) {
$projeto = Trabalho::find($id);
return Storage::download($projeto->anexoProjeto);
}
public function baixarAnexoConsu($id) {
$projeto = Trabalho::find($id);
return Storage::download($projeto->anexoDecisaoCONSU);
}
public function baixarAnexoComite($id) {
$projeto = Trabalho::find($id);
return Storage::download($projeto->anexoAutorizacaoComiteEtica);
}
public function baixarAnexoLattes($id) {
$projeto = Trabalho::find($id);
return Storage::download($projeto->anexoLattesCoordenador);
}
public function baixarAnexoPlanilha($id) {
$projeto = Trabalho::find($id);
return Storage::download($projeto->anexoPlanilhaPontuacao);
}
}
......@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class Participante extends Model
{
protected $fillable = ['name', 'user_id', 'trabalho_id'];
protected $fillable = ['name', 'user_id', 'trabalho_id', 'participante_id'];
public function user(){
return $this->belongsTo('App\User');
......
This diff is collapsed.
......@@ -35,14 +35,14 @@
@else
<td style="color: rgb(0, 0, 0)">Submetido</td>
@endif
<td>{{$projeto->update}}</td>
<td>{{ date('d-m-Y', strtotime($projeto->updated_at)) }}</td>
<td>
<div class="btn-group dropright dropdown-options">
<a id="options" class="dropdown-toggle " data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{-- <img src="{{asset('img/icons/ellipsis-v-solid.svg')}}" style="width:8px"> --}}
</a>
<div class="dropdown-menu">
<a href="" class="dropdown-item" style="text-align: center;">
<a href="{{ route('trabalho.editar', ['id' => $projeto->id]) }}" class="dropdown-item" style="text-align: center;">
Editar projeto
</a>
{{-- <a href="" class="dropdown-item" style="text-align: center">
......
......@@ -88,6 +88,7 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){
Route::post( '/trabalho/novaVersao', 'TrabalhoController@novaVersao' )->name('trabalho.novaVersao');
Route::post( '/trabalho/criar', 'TrabalhoController@store' )->name('trabalho.store');
Route::get( '/edital/{id}/projetos', 'TrabalhoController@projetosDoEdital' )->name('projetos.edital');
Route::get( '/projeto/{id}/editar', 'TrabalhoController@edit' )->name('trabalho.editar');
//######### Atribuição #######################################
Route::get( '/atribuir', 'AtribuicaoController@distribuicaoAutomatica' )->name('distribuicao');
......@@ -101,7 +102,13 @@ Route::group(['middleware' => ['isTemp', 'auth', 'verified']], function(){
Route::post( '/revisor/email', 'RevisorController@enviarEmailRevisor' )->name('revisor.email');
Route::post( '/revisor/emailTodos', 'RevisorController@enviarEmailTodosRevisores' )->name('revisor.emailTodos');
//########## Rotas de download de documentos ###########################
Route::get('/baixar/edital/{id}', 'EventoController@baixarEdital' )->name('baixar.edital');
Route::get('/baixar/anexo-projeto/{id}', 'TrabalhoController@baixarAnexoProjeto' )->name('baixar.anexo.projeto');
Route::get('/baixar/anexo-consu/{id}', 'TrabalhoController@baixarAnexoConsu' )->name('baixar.anexo.consu');
Route::get('/baixar/anexo-comite/{id}', 'TrabalhoController@baixarAnexoComite' )->name('baixar.anexo.comite');
Route::get('/baixar/anexo-lattes/{id}', 'TrabalhoController@baixarAnexoLattes' )->name('baixar.anexo.lattes');
Route::get('/baixar/anexo-planilha/{id}','TrabalhoController@baixarAnexoPlanilha' )->name('baixar.anexo.planilha');
});
Route::prefix('usuarios')->name('admin.')->group(function(){
......@@ -180,8 +187,6 @@ Route::prefix('evento')->name('evento.')->group(function(){
});
Route::get('/baixar/edital/{id}', 'EventoController@baixarEdital' )->name('baixar.edital');
//########## Rotas de administrador responsavel (Reitor ou pro-reitor)########
Route::prefix('adminResp')->name('adminResp.')->group(function(){
......
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