Commit 5ac2f872 authored by Lucas Henrique's avatar Lucas Henrique
Browse files

Resolve bug de consistência das informações do plano de trabalho

parent 80b785de
...@@ -71,9 +71,9 @@ class UpdateTrabalho extends FormRequest ...@@ -71,9 +71,9 @@ class UpdateTrabalho extends FormRequest
} }
} }
} else { } else {
$proponente = Proponente::find($projeto->proponente_id); $arquivo = Arquivo::where("trabalhoId", $projeto->id)->first();
$rules['anexoPlanoTrabalho'] = [Rule::requiredIf($proponente->planoTrabalho == null)]; $rules['anexoPlanoTrabalho'] = [Rule::requiredIf($arquivo == null)];
$rules['nomePlanoTrabalho'] = [Rule::requiredIf($proponente->planoTrabalho->titulo == null), 'string']; $rules['nomePlanoTrabalho'] = [Rule::requiredIf($arquivo->titulo == null), 'string'];
} }
// dd($this->all()); // dd($this->all());
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
<td> <td>
@if ($evento->numParticipantes == 0) @if ($evento->numParticipantes == 0)
@php @php
$planoTrabalho = $trabalho->proponente->planoTrabalho $planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first();
@endphp @endphp
<a href="{{ route('baixar.plano', ['id' => $planoTrabalho->id]) }}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light"> <a href="{{ route('baixar.plano', ['id' => $planoTrabalho->id]) }}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light">
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px"> <img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px">
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
<td style="text-align: center"> <td style="text-align: center">
@if ($evento->numParticipantes == 0) @if ($evento->numParticipantes == 0)
@php @php
$planoTrabalho = $trabalho->proponente->planoTrabalho $planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first();
@endphp @endphp
<a href="{{ route('baixar.plano', ['id' => $planoTrabalho->id]) }}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light"> <a href="{{ route('baixar.plano', ['id' => $planoTrabalho->id]) }}" target="_new" style="font-size: 20px; color: #114048ff;" class="btn btn-light">
<img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px"> <img class="" src="{{asset('img/icons/file-download-solid.svg')}}" style="width:15px">
......
...@@ -97,13 +97,16 @@ ...@@ -97,13 +97,16 @@
@endif @endif
@if ($edital->numParticipantes == 0) @if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-3"> <div class="col-md-3">
<br> <br>
<label for="nomePlanoTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Título do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label> <label for="nomePlanoTrabalho" class="col-form-label font-tam" style="font-weight: bold">{{ __('Título do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
</div> </div>
<div class="col-md-9"> <div class="col-md-9">
<br> <br>
<input type="text" class="form-control" value="{{old('nomePlanoTrabalho') ?? $proponente->planoTrabalho->titulo ?? "" }}" name="nomePlanoTrabalho" maxlength="255" id="nomePlanoTrabalho" required> <input type="text" class="form-control" value="{{old('nomePlanoTrabalho') ?? $arquivo->titulo ?? "" }}" name="nomePlanoTrabalho" maxlength="255" id="nomePlanoTrabalho" required>
<span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho"> <span style="color: red; font-size: 12px" id="caracsRestantesnomePlanoTrabalho">
</span> </span>
@error('nomePlanoTrabalho') @error('nomePlanoTrabalho')
...@@ -117,9 +120,9 @@ ...@@ -117,9 +120,9 @@
<br> <br>
<label for="anexoPlanoTrabalho" class="col-form-label font-tam" <label for="anexoPlanoTrabalho" class="col-form-label font-tam"
style="font-weight: bold">{{ __('Anexo do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label> style="font-weight: bold">{{ __('Anexo do plano de trabalho: ') }}<span style="color: red; font-weight:bold">*</span></label>
@if ($proponente != null && $proponente->planoTrabalho) @if ($proponente != null && $arquivo)
<a style="margin-left: 5px" <a style="margin-left: 5px"
href="{{ route('baixar.plano', ['id' => $proponente->planoTrabalho->id]) }}"> href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}">
<i class="fas fa-file-pdf fa-2x"></i></a> <i class="fas fa-file-pdf fa-2x"></i></a>
@else @else
<p><i class="fas fa-times-circle fa-2x"></i></p> <p><i class="fas fa-times-circle fa-2x"></i></p>
......
...@@ -77,15 +77,18 @@ ...@@ -77,15 +77,18 @@
@endif @endif
@if ($edital->numParticipantes == 0) @if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-12"> <div class="col-md-12">
<br> <br>
<b style="color: #4D4D4D;">Título do Plano de Trabalho: </b> <b style="color: #4D4D4D;">Título do Plano de Trabalho: </b>
<a style="color: #4D4D4D;">{{$projeto->proponente->planoTrabalho->titulo}}</a> <a style="color: #4D4D4D;">{{$arquivo->titulo}}</a>
</div> </div>
<div class="col-sm-4" style="float: left"> <div class="col-sm-4" style="float: left">
<label for="anexoProjeto" class="col-form-label font-tam" style="font-weight: bold">{{ __('Anexo do Plano de Trabalho: ') }}</label> <label for="anexoProjeto" class="col-form-label font-tam" style="font-weight: bold">{{ __('Anexo do Plano de Trabalho: ') }}</label>
<a href="{{ route('baixar.plano', ['id' => $projeto->proponente->planoTrabalho->id]) }}"><img class="" src="{{asset('img/icons/pdf.ico')}}" style="width:40px" alt=""></a> <a href="{{ route('baixar.plano', ['id' => $arquivo->id]) }}"><img class="" src="{{asset('img/icons/pdf.ico')}}" style="width:40px" alt=""></a>
</div> </div>
@endif @endif
......
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