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
}
}
} 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());
......
......@@ -87,7 +87,7 @@
<td>
@if ($evento->numParticipantes == 0)
@php
$planoTrabalho = $trabalho->proponente->planoTrabalho
$planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first();
@endphp
<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">
......@@ -198,7 +198,7 @@
<td style="text-align: center">
@if ($evento->numParticipantes == 0)
@php
$planoTrabalho = $trabalho->proponente->planoTrabalho
$planoTrabalho = App\Arquivo::where("trabalhoId", $trabalho->id)->first();
@endphp
<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">
......
......@@ -97,13 +97,16 @@
@endif
@if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-3">
<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>
</div>
<div class="col-md-9">
<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>
@error('nomePlanoTrabalho')
......@@ -117,9 +120,9 @@
<br>
<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>
@if ($proponente != null && $proponente->planoTrabalho)
@if ($proponente != null && $arquivo)
<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>
@else
<p><i class="fas fa-times-circle fa-2x"></i></p>
......
......@@ -77,15 +77,18 @@
@endif
@if ($edital->numParticipantes == 0)
@php
$arquivo = App\Arquivo::where("trabalhoId", $projeto->id)->first();
@endphp
<div class="col-md-12">
<br>
<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 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>
<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>
@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