diff --git a/app/Http/Requests/UpdateTrabalho.php b/app/Http/Requests/UpdateTrabalho.php index ce09032285a498d730a6f29ccb1f5974cbf72a77..83534ac6bce9723515cf2c87259bd6d3f522437d 100755 --- a/app/Http/Requests/UpdateTrabalho.php +++ b/app/Http/Requests/UpdateTrabalho.php @@ -71,9 +71,9 @@ class UpdateTrabalho extends FormRequest } } } else { - $proponente = Proponente::find($projeto->proponente_id); - $rules['anexoPlanoTrabalho'] = [Rule::requiredIf($proponente->planoTrabalho == null)]; - $rules['nomePlanoTrabalho'] = [Rule::requiredIf($proponente->planoTrabalho->titulo == null), 'string']; + $arquivo = Arquivo::where("trabalhoId", $projeto->id)->first(); + $rules['anexoPlanoTrabalho'] = [Rule::requiredIf($arquivo == null)]; + $rules['nomePlanoTrabalho'] = [Rule::requiredIf($arquivo->titulo == null), 'string']; } // dd($this->all()); diff --git a/resources/views/avaliador/listarTrabalhos.blade.php b/resources/views/avaliador/listarTrabalhos.blade.php index acf015013e086fa5b051d04a46f01fbf13ce279c..430c841af94627143594427e466530d7887f23e1 100755 --- a/resources/views/avaliador/listarTrabalhos.blade.php +++ b/resources/views/avaliador/listarTrabalhos.blade.php @@ -87,7 +87,7 @@ @if ($evento->numParticipantes == 0) @php - $planoTrabalho = $trabalho->proponente->planoTrabalho + $planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first(); @endphp @@ -198,7 +198,7 @@ @if ($evento->numParticipantes == 0) @php - $planoTrabalho = $trabalho->proponente->planoTrabalho + $planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first(); @endphp diff --git a/resources/views/projeto/editaFormulario/proponente.blade.php b/resources/views/projeto/editaFormulario/proponente.blade.php index 164304efce768a8a7c45f9b9ad6359adcd314923..e6aacf4adbadbec78fd3e7ce79b0193c23f84942 100755 --- a/resources/views/projeto/editaFormulario/proponente.blade.php +++ b/resources/views/projeto/editaFormulario/proponente.blade.php @@ -97,13 +97,16 @@ @endif @if ($edital->numParticipantes == 0) + @php + $arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first(); + @endphp


- + @error('nomePlanoTrabalho') @@ -117,9 +120,9 @@
- @if ($proponente != null && $proponente->planoTrabalho) + @if ($proponente != null && $arquivo)
+ href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}"> @else

diff --git a/resources/views/projeto/formularioVisualizar/proponente2.blade.php b/resources/views/projeto/formularioVisualizar/proponente2.blade.php index 222447254c7ed474c86caf95ebbe89ed3fa87e86..0d5ca1169be895bea5105fbc27e504016e3155af 100644 --- a/resources/views/projeto/formularioVisualizar/proponente2.blade.php +++ b/resources/views/projeto/formularioVisualizar/proponente2.blade.php @@ -77,15 +77,18 @@ @endif @if ($edital->numParticipantes == 0) + @php + $arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first(); + @endphp

Título do Plano de Trabalho: - {{$projeto->proponente->planoTrabalho->titulo}} + {{$arquivo->titulo}}
- +
@endif