Commit 66dd5d33 authored by Guilherme Silva's avatar Guilherme Silva
Browse files

Permitindo criação avaliador selecionando seu tipo

parent 6ec36cc3
...@@ -182,6 +182,7 @@ class AdministradorController extends Controller ...@@ -182,6 +182,7 @@ class AdministradorController extends Controller
case "avaliador": case "avaliador":
$avaliador = new Avaliador(); $avaliador = new Avaliador();
$avaliador->user_id = $user->id; $avaliador->user_id = $user->id;
$avaliador->tipo = $request->tipoAvaliador;
$avaliador->save(); $avaliador->save();
break; break;
case "proponente": case "proponente":
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label for="tipo" class="col-form-label">{{ __('Tipo*') }}</label> <label for="tipo" class="col-form-label">{{ __('Tipo*') }}</label>
<select name="tipo" id="tipo" onchange="mudar()" class="form-control"> <select name="tipo" id="tipo" onchange="mudar(); avaliadorCheck();" class="form-control">
@if(auth()->user()->tipo == 'administrador') @if(auth()->user()->tipo == 'administrador')
<option @if ( old('tipo') == "administradorResponsavel" ) required @endif value="administradorResponsavel">Administrador responsável</option> <option @if ( old('tipo') == "administradorResponsavel" ) required @endif value="administradorResponsavel">Administrador responsável</option>
@endif @endif
...@@ -73,7 +73,16 @@ ...@@ -73,7 +73,16 @@
<option @if ( old('tipo') == "proponente" ) required @endif value="proponente">Proponente</option> <option @if ( old('tipo') == "proponente" ) required @endif value="proponente">Proponente</option>
<option @if ( old('tipo') == "participante" ) required @endif value="participante">Discente</option> <option @if ( old('tipo') == "participante" ) required @endif value="participante">Discente</option>
</select> </select>
</div> </div>
<div >
<label id="labTipoAvaliador" style="display: none" for="tipoAvaliador" class="col-form-label">{{ __('Avaliador*') }}</label>
<select id="tipoAvaliador" style="display: none" name="tipoAvaliador" class="form-control">
<option @if ( old('tipo') == "Externo" ) @endif value="Externo">Externo</option>
<option @if ( old('tipo') == "Interno" ) @endif value="Interno">Interno</option>
</select>
</div>
<div class="col-md-2"> <div class="col-md-2">
<label for="celular" class="col-form-label">{{ __('Celular*') }}</label> <label for="celular" class="col-form-label">{{ __('Celular*') }}</label>
<input id="celular" type="text" class="form-control @error('celular') is-invalid @enderror" name="celular" value="{{ old('celular') }}" required autocomplete="celular" autofocus> <input id="celular" type="text" class="form-control @error('celular') is-invalid @enderror" name="celular" value="{{ old('celular') }}" required autocomplete="celular" autofocus>
...@@ -357,6 +366,22 @@ ...@@ -357,6 +366,22 @@
instituicao.parentElement.style.display = 'none'; instituicao.parentElement.style.display = 'none';
} }
} }
function avaliadorCheck() {
var tipoUser = document.getElementById('tipo');
var tipoAval = document.getElementById("tipoAvaliador");
var labAval = document.getElementById("labTipoAvaliador")
if (tipo.value == "avaliador") {
tipoAval.style.display = "";
labAval.style.display = "";
tipo.parentElement.className = 'col-md-2'
} else {
tipo.parentElement.className = 'col-md-4'
labAval.parentElement.className = ''
tipoAval.parentElement.className = ''
tipoAval.style.display = "none";
labAval.style.display = "none";
}
}
window.onload = showInstituicao(); window.onload = showInstituicao();
</script> </script>
@endsection @endsection
\ No newline at end of file
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