Skip to content

Commit

Permalink
Atualizações nos aplicativos
Browse files Browse the repository at this point in the history
  • Loading branch information
AnonJV committed Nov 29, 2024
1 parent 7a87176 commit faacd04
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 79 deletions.
17 changes: 1 addition & 16 deletions Web/onibusca/enterprise/models.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
from django.db import models

# Create your models here.
class Estado(models.Model):
nome = models.CharField(max_length=100)
sigla = models.CharField(max_length=2, unique=True)

def __str__(self):
return self.sigla

class Cidade(models.Model):
nome = models.CharField(max_length=28)
estado = models.ForeignKey(Estado, on_delete=models.CASCADE, related_name='cidades')

class Meta:
unique_together = (('nome', 'estado'),)

class Enterprise(models.Model):
cnpj = models.CharField(max_length=14, unique=True)
nome = models.CharField(max_length=50)
email = models.EmailField(unique=True)
cidades = models.ManyToManyField(Cidade, related_name='empresas')
email = models.EmailField(unique=True)
47 changes: 0 additions & 47 deletions Web/onibusca/enterprise/static/js/formEmpresas.js

This file was deleted.

17 changes: 3 additions & 14 deletions Web/onibusca/enterprise/templates/formEmpresas.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="formEmpresas.css">
<title>Cadastrar empresa</title>
{% load static %}
<link rel="stylesheet" href="{% static 'css/formEmpresas.css' %}">
</head>

<body>
Expand All @@ -28,7 +29,7 @@
</nav>
<main>
<div id="img">
<img src="empresa.png" alt="onibus">
<img src="{% static 'img/empresa.png' %}" alt="onibus">
</div>
<div id="form-div">
<form action="">
Expand All @@ -44,20 +45,8 @@
<label for="horaInicial">Email</label>
<input type="email" name="emailEmpresa" id="emailEmpresa" required>
</span>
<span>
<div id="addCity">
<label for="horaTermino">Cidades</label>
</div>
<div id="camposCidade">
<input type="text" id="cidade0" name="cidade0" placeholder="1ª cidade" required>
</div>
</span>
<button id="adicionarCidade">Adicionar</button>
<input type="submit" value="SALVAR" id="save">
</form>
</div>
</main>
</body>
<script src="formEmpresas.js"></script>

</html>
5 changes: 5 additions & 0 deletions Web/onibusca/enterprise/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from django.shortcuts import render

# Create your views here.
def cadastro_empresa(request):
if request.method == 'POST':
cnpj = request.POST['cnpj']
nome = request.POST['nomeEmpresa']
email = request.POST['emailEmpresa']
25 changes: 23 additions & 2 deletions Web/onibusca/staticPages/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<ul>
{% if user.is_superuser %}
<li><a href="{% url 'formLinhas' %}">Linhas</a></li>
<li><a href="{% url 'quem_somos' %}">Quem somos?</a></li>
{% endif %}
<li><a href="{% url 'quem_somos' %}">Quem somos?</a></li>
<li><a href="{% url 'suporte' %}">Ajuda</a></li>
{% if user.is_authenticated %}
<li><a href="meuPerfil.html" class="profileIcon"><img src="{% static 'img/user.png' %}" alt="perfil"></a></li>
Expand All @@ -44,8 +44,29 @@ <h4>Para onde <span class="green">você</span> quer ir?</h4>
</div>
</main>

{% if messages %}
<div id="messages-container" style="display: none;">
{% for message in messages %}
{{ message }}<br/>
{% endfor %}
</div>
{% endif %}

<footer id="footer">
<p>&copy; Onibusca</p>
<p>&copy; OrkaShield</p>
</footer>

<script>
window.onload = function() {
const messagesContainer = document.getElementById('messages-container');
if (messagesContainer) {
const messages = messagesContainer.innerHTML.trim();
if (messages) {
alert(messages);
}
}
}
</script>

</body>
</html>
Binary file modified Web/onibusca/users/__pycache__/views.cpython-312.pyc
Binary file not shown.
19 changes: 19 additions & 0 deletions Web/onibusca/users/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,29 @@ <h3>LOGIN</h3>
</form>
</div>
</main>

{% if messages %}
<div id="messages-container" style="display: none;">
{% for message in messages %}
{{ message }}
{% endfor %}
</div>
{% endif %}

<footer id="footer">
<p>&copy; OrkaShield</p>
</footer>
<script>
window.onload = function() {
const messagesContainer = document.getElementById('messages-container');
if (messagesContainer) {
const messages = messagesContainer.innerHTML.trim();
if (messages) {
alert(messages);
}
}
}

let showPassword = document.getElementById("showPassword");
let inputSenha = document.getElementById("senha");

Expand Down
1 change: 1 addition & 0 deletions Web/onibusca/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def login_view(request):

if user is not None:
login(request, user)
messages.success(request, 'Login realizado com sucesso!')
return redirect('home')
else:
messages.error(request, 'Email ou senha inválidos')
Expand Down

0 comments on commit faacd04

Please sign in to comment.