feat: perfil admin/padrao em funcionarios, protege ultimo admin
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
a2a5fc7905
commit
81f730df9e
@@ -12,6 +12,12 @@
|
||||
<input type="text" id="nome" name="nome" value="{{ dados.NOME if dados else (funcionario.NOME if funcionario else '') }}" required>
|
||||
<label for="login">Login</label>
|
||||
<input type="text" id="login" name="login" value="{{ dados.LOGIN if dados else (funcionario.LOGIN if funcionario else '') }}" required>
|
||||
<label for="perfil">Perfil</label>
|
||||
{% set perfil_atual = dados.PERFIL if dados else (funcionario.PERFIL if funcionario else 'PADRAO') %}
|
||||
<select id="perfil" name="perfil">
|
||||
<option value="PADRAO" {{ "selected" if perfil_atual == "PADRAO" else "" }}>Padrão</option>
|
||||
<option value="ADMIN" {{ "selected" if perfil_atual == "ADMIN" else "" }}>Administrador</option>
|
||||
</select>
|
||||
{% if not funcionario %}
|
||||
<label for="senha">Senha</label>
|
||||
<input type="password" id="senha" name="senha" required>
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
<h1>Funcionários</h1>
|
||||
<p><a class="botao" href="/funcionarios/novo">+ Novo funcionário</a></p>
|
||||
<table>
|
||||
<tr><th>Nome</th><th>Login</th><th>Status</th><th></th></tr>
|
||||
<tr><th>Nome</th><th>Login</th><th>Perfil</th><th>Status</th><th></th></tr>
|
||||
{% for f in funcionarios %}
|
||||
<tr>
|
||||
<td>{{ f.NOME }}</td>
|
||||
<td>{{ f.LOGIN }}</td>
|
||||
<td>{{ "Administrador" if f.PERFIL == "ADMIN" else "Padrão" }}</td>
|
||||
<td>{{ "Ativo" if f.ATIVO else "Inativo" }}</td>
|
||||
<td>
|
||||
<a class="botao" href="/funcionarios/{{ f.ID }}/editar">Editar</a>
|
||||
|
||||
Reference in New Issue
Block a user