Adicionados os campos mínimos do Banco de Dados, precisa melhorar interface e controle de acesso que será posterior nessa branch mesmo
This commit is contained in:
@@ -1,35 +1,94 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Listar Militantes{% endblock %}
|
||||
{% block title %}Novo Material{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Registrar Novo Material</h1>
|
||||
<form method="post">
|
||||
<div>
|
||||
<label for="militante_id">ID do Militante:</label>
|
||||
<input type="number" id="militante_id" name="militante_id" required>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1 class="mb-4">Novo Material</h1>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="POST" class="needs-validation" novalidate>
|
||||
<div class="mb-3">
|
||||
<label for="nome" class="form-label">Nome</label>
|
||||
<input type="text" class="form-control" id="nome" name="nome" required>
|
||||
<div class="invalid-feedback">
|
||||
Por favor, insira o nome do material.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="descricao" class="form-label">Descrição</label>
|
||||
<textarea class="form-control" id="descricao" name="descricao" rows="3" required></textarea>
|
||||
<div class="invalid-feedback">
|
||||
Por favor, insira a descrição do material.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="preco" class="form-label">Preço</label>
|
||||
<input type="number" class="form-control" id="preco" name="preco" step="0.01" required>
|
||||
<div class="invalid-feedback">
|
||||
Por favor, insira o preço do material.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="quantidade" class="form-label">Quantidade</label>
|
||||
<input type="number" class="form-control" id="quantidade" name="quantidade" required>
|
||||
<div class="invalid-feedback">
|
||||
Por favor, insira a quantidade do material.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="tipo_id" class="form-label">Tipo de Material</label>
|
||||
<select class="form-select" id="tipo_id" name="tipo_id" required>
|
||||
<option value="">Selecione um tipo</option>
|
||||
{% for tipo in tipos %}
|
||||
<option value="{{ tipo.id }}">{{ tipo.nome }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="invalid-feedback">
|
||||
Por favor, selecione o tipo do material.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<button type="submit" class="btn btn-success">Registrar</button>
|
||||
<a href="{{ url_for('listar_materiais') }}" class="btn btn-outline-secondary">Voltar</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<label for="tipo_material_id">Tipo de Material:</label>
|
||||
<input type="number" id="tipo_material_id" name="tipo_material_id" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="descricao">Descrição:</label>
|
||||
<input type="text" id="descricao" name="descricao" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="valor">Valor:</label>
|
||||
<input type="number" id="valor" name="valor" step="0.01" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="data_venda">Data da Venda:</label>
|
||||
<input type="date" id="data_venda" name="data_venda" required>
|
||||
</div>
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-primary">Registrar</button>
|
||||
<a href="{{ url_for('listar_materiais') }}" class="btn btn-secondary">Voltar</a>
|
||||
<a href="{{ url_for('home') }}" class="btn btn-outline-primary">Início</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Validação do formulário
|
||||
(function () {
|
||||
'use strict'
|
||||
|
||||
var forms = document.querySelectorAll('.needs-validation')
|
||||
|
||||
Array.prototype.slice.call(forms)
|
||||
.forEach(function (form) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
if (!form.checkValidity()) {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}
|
||||
|
||||
form.classList.add('was-validated')
|
||||
}, false)
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user