diff --git a/mamutes/Users/__pycache__/models.cpython-312.pyc b/mamutes/Users/__pycache__/models.cpython-312.pyc index 0bf6828..66fb432 100644 Binary files a/mamutes/Users/__pycache__/models.cpython-312.pyc and b/mamutes/Users/__pycache__/models.cpython-312.pyc differ diff --git a/mamutes/Users/migrations/0008_remove_membroequipe_areas_and_more.py b/mamutes/Users/migrations/0008_remove_membroequipe_areas_and_more.py new file mode 100644 index 0000000..78d99fc --- /dev/null +++ b/mamutes/Users/migrations/0008_remove_membroequipe_areas_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 5.1.4 on 2024-12-22 23:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('Users', '0007_remove_membroequipe_profile_picture'), + ] + + operations = [ + migrations.RemoveField( + model_name='membroequipe', + name='areas', + ), + migrations.RemoveField( + model_name='membroequipe', + name='functions', + ), + ] diff --git a/mamutes/Users/models.py b/mamutes/Users/models.py index 6cea2a0..b2d2868 100644 --- a/mamutes/Users/models.py +++ b/mamutes/Users/models.py @@ -19,8 +19,8 @@ class MembroEquipe(AbstractUser): email = models.EmailField(max_length=200, blank=False, null=False) phone = models.CharField(max_length=20, blank=False, null=False) - areas = models.ManyToManyField(Area, related_name='membros', blank=True) - functions = models.ManyToManyField(Function, related_name='membros', blank=True) + #areas = models.ManyToManyField(Area, related_name='membros', blank=True) + #functions = models.ManyToManyField(Function, related_name='membros', blank=True) def __str__(self): return self.username diff --git a/mamutes/db.sqlite3 b/mamutes/db.sqlite3 index 81fe68a..c9563e2 100644 Binary files a/mamutes/db.sqlite3 and b/mamutes/db.sqlite3 differ diff --git a/mamutes/guest/templates/base.html b/mamutes/guest/templates/base.html index ab1310d..4c822af 100644 --- a/mamutes/guest/templates/base.html +++ b/mamutes/guest/templates/base.html @@ -13,9 +13,9 @@ - + + + {% block css %}{% endblock %} diff --git a/mamutes/mamutes/settings.py b/mamutes/mamutes/settings.py index 082266e..81c4940 100644 --- a/mamutes/mamutes/settings.py +++ b/mamutes/mamutes/settings.py @@ -39,6 +39,9 @@ 'django.contrib.messages', 'Users', 'guest', + 'report', + 'members', + 'stock', 'django.contrib.staticfiles', ] diff --git a/mamutes/mamutes/urls.py b/mamutes/mamutes/urls.py index b3a8ca2..c4c30f3 100644 --- a/mamutes/mamutes/urls.py +++ b/mamutes/mamutes/urls.py @@ -1,16 +1,28 @@ from django.contrib import admin -from django.urls import path +from django.urls import path, include from Users.views import login, register, recoverAccount, redefinePassword from guest.views import index, competition, admission - urlpatterns = [ + path('admin/', admin.site.urls), + + # Users path('login/', login, name='login'), path('register/', register, name='register'), path('account_recovery/', recoverAccount, name='recoverAccount'), path('redefine_password//', redefinePassword, name="redefinePassword"), + + # guest path('', index, name="index"), path('competition/', competition, name="competition"), path('admission/', admission, name="admission"), + + # report + path('report/', include('report.urls')), + + # members + + # stock + ] diff --git a/mamutes/members/__init__.py b/mamutes/members/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/members/admin.py b/mamutes/members/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/mamutes/members/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/mamutes/members/apps.py b/mamutes/members/apps.py new file mode 100644 index 0000000..c775af8 --- /dev/null +++ b/mamutes/members/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MembersConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'members' diff --git a/mamutes/members/migrations/0001_initial.py b/mamutes/members/migrations/0001_initial.py new file mode 100644 index 0000000..d058213 --- /dev/null +++ b/mamutes/members/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# Generated by Django 5.1.4 on 2024-12-22 23:23 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Task', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('description', models.TextField()), + ('status', models.CharField(choices=[('Pendente', 'Pendente'), ('Em Progresso', 'Em Progresso'), ('Concluída', 'Concluída')], max_length=15)), + ('creation_date', models.DateTimeField(auto_now_add=True)), + ('completion_date', models.DateTimeField(blank=True, null=True)), + ('responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/mamutes/members/migrations/__init__.py b/mamutes/members/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/members/models.py b/mamutes/members/models.py new file mode 100644 index 0000000..db9cae2 --- /dev/null +++ b/mamutes/members/models.py @@ -0,0 +1,19 @@ +from django.db import models +from Users.models import MembroEquipe + +# Create your models here. +class Task(models.Model): + id = models.AutoField(primary_key=True) + STATUS_CHOICES = [ + ('Pendente', 'Pendente'), + ('Em Progresso', 'Em Progresso'), + ('Concluída', 'Concluída'), + ] + description = models.TextField() + status = models.CharField(max_length=15, choices=STATUS_CHOICES) + creation_date = models.DateTimeField(auto_now_add=True) + completion_date = models.DateTimeField(null=True, blank=True) + responsible = models.ForeignKey(MembroEquipe, on_delete=models.CASCADE) + + def __str__(self): + return f"{self.description} - {self.status}" diff --git a/mamutes/members/tests.py b/mamutes/members/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/mamutes/members/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/mamutes/members/views.py b/mamutes/members/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/mamutes/members/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/mamutes/report/__init__.py b/mamutes/report/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/report/admin.py b/mamutes/report/admin.py new file mode 100644 index 0000000..91f980a --- /dev/null +++ b/mamutes/report/admin.py @@ -0,0 +1,8 @@ +from django.contrib import admin +from .models import FlightLog +from .models import Minutes +from .models import AccidentLog +# Register your models here. +admin.site.register(FlightLog) +admin.site.register(Minutes) +admin.site.register(AccidentLog) \ No newline at end of file diff --git a/mamutes/report/apps.py b/mamutes/report/apps.py new file mode 100644 index 0000000..1ed8809 --- /dev/null +++ b/mamutes/report/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ReportConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'report' diff --git a/mamutes/report/forms.py b/mamutes/report/forms.py new file mode 100644 index 0000000..a51824a --- /dev/null +++ b/mamutes/report/forms.py @@ -0,0 +1,7 @@ +from django import forms +from .models import FlightLog + +class FlightForm(forms.ModelForm): + class Meta: + model = FlightLog + fields = '__all__' # Inclui todos os campos do modelo Voo diff --git a/mamutes/report/migrations/0001_initial.py b/mamutes/report/migrations/0001_initial.py new file mode 100644 index 0000000..f30a295 --- /dev/null +++ b/mamutes/report/migrations/0001_initial.py @@ -0,0 +1,66 @@ +# Generated by Django 5.1.4 on 2024-12-22 23:23 + +import django.core.validators +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='FlightLog', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('date', models.DateField()), + ('start_time', models.TimeField()), + ('end_time', models.TimeField()), + ('document_username', models.CharField(max_length=255)), + ('pilot_name', models.CharField(max_length=255)), + ('location', models.CharField(max_length=255)), + ('team_members', models.TextField()), + ('flight_success_rating', models.IntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(5)])), + ('flight_objective_description', models.TextField()), + ('results', models.TextField()), + ('pilot_impressions', models.TextField()), + ('improvements', models.TextField()), + ('wind_speed', models.DecimalField(decimal_places=3, max_digits=4)), + ('wind_direction', models.CharField(max_length=100)), + ('atmospheric_pressure', models.DecimalField(decimal_places=3, max_digits=4)), + ('total_takeoff_weight', models.DecimalField(decimal_places=3, max_digits=4)), + ('flight_cycles', models.PositiveIntegerField()), + ('telemetry_link', models.URLField()), + ('occurred_accident', models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name='AccidentLog', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('description', models.TextField()), + ('damaged_parts', models.TextField()), + ('damaged_parts_photo', models.URLField()), + ('was_turbulent', models.BooleanField(default=False)), + ('pilot_flight_count', models.PositiveIntegerField()), + ('pilot_impressions', models.TextField()), + ('id_flightLog', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='report.flightlog')), + ], + ), + migrations.CreateModel( + name='Minutes', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('date', models.DateField()), + ('title', models.CharField(max_length=200)), + ('content', models.TextField()), + ('responsible', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/mamutes/report/migrations/__init__.py b/mamutes/report/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/report/models.py b/mamutes/report/models.py new file mode 100644 index 0000000..983f637 --- /dev/null +++ b/mamutes/report/models.py @@ -0,0 +1,56 @@ +from django.db import models +from Users.models import MembroEquipe +from django.core.validators import MinValueValidator, MaxValueValidator + +class Minutes(models.Model): + id = models.AutoField(primary_key=True) + date = models.DateField() + title = models.CharField(max_length=200) + content = models.TextField() + responsible = models.ForeignKey(MembroEquipe, on_delete=models.CASCADE) + + def __str__(self): + return self.title + +class FlightLog(models.Model): + id = models.AutoField(primary_key=True) + date = models.DateField() + start_time = models.TimeField() + end_time = models.TimeField() + document_username = models.CharField(max_length=255) + pilot_name = models.CharField(max_length=255) + location = models.CharField(max_length=255) + team_members = models.TextField() + flight_success_rating = models.IntegerField(validators=[MinValueValidator(1),MaxValueValidator(5)]) + flight_objective_description = models.TextField() ######### + results = models.TextField() + pilot_impressions = models.TextField() + improvements = models.TextField() + wind_speed = models.DecimalField(max_digits=4, decimal_places=3) + wind_direction = models.CharField(max_length=100) + atmospheric_pressure = models.DecimalField(max_digits=4, decimal_places=3) + total_takeoff_weight = models.DecimalField(max_digits=4, decimal_places=3) + flight_cycles = models.PositiveIntegerField() + telemetry_link = models.URLField() + occurred_accident = models.BooleanField(default=False) + + def __str__(self): + return f"Flight Log {self.id} - {self.date} by {self.pilot_name}" + +class AccidentLog(models.Model): + id = models.AutoField(primary_key=True) + id_flightLog = models.ForeignKey(FlightLog, on_delete=models.CASCADE) + description = models.TextField() + damaged_parts = models.TextField() + damaged_parts_photo = models.URLField() + was_turbulent = models.BooleanField(default=False) + pilot_flight_count = models.PositiveIntegerField() + pilot_impressions = models.TextField() + + def __str__(self): + return f"Accident Log {self.id} - Flight {self.flight_log.id}" + + + + + diff --git a/mamutes/report/static/css/voolist.css b/mamutes/report/static/css/voolist.css new file mode 100644 index 0000000..80d3a24 --- /dev/null +++ b/mamutes/report/static/css/voolist.css @@ -0,0 +1,92 @@ +body { + font-family: Arial, sans-serif; + background-color: #121212; + color: #f5f5f5; + margin: 0; + padding: 20px; +} + +h1 { + text-align: center; + color: #1e90ff; + margin-bottom: 20px; +} + +table { + width: 100%; + border-collapse: collapse; + background-color: #1c1c1c; + margin: 0 auto; + border-radius: 8px; + overflow: hidden; +} + +thead { + background-color: #1e90ff; +} + +thead th { + color: white; + text-align: left; + padding: 12px; +} + +tbody tr { + border-bottom: 1px solid #333; +} + +tbody tr:nth-child(even) { + background-color: #181818; +} + +tbody tr:hover { + background-color: #1e90ff; + color: white; +} + +tbody td { + padding: 12px; +} + +a { + color: #1e90ff; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +.btn { + padding: 6px 12px; + border-radius: 4px; + text-decoration: none; + color: #fff; + font-weight: bold; +} + +.btn-editar { + background-color: #007bff; +} + +.btn-editar:hover { + background-color: #0056b3; +} + +.btn-excluir { + background-color: #dc3545; +} + +.btn-excluir:hover { + background-color: #a71d2a; +} + +@media (max-width: 768px) { + table { + font-size: 14px; + } + + thead { + font-size: 16px; + } +} diff --git a/mamutes/report/templates/report/flight_confirm_delete.html b/mamutes/report/templates/report/flight_confirm_delete.html new file mode 100644 index 0000000..83a2775 --- /dev/null +++ b/mamutes/report/templates/report/flight_confirm_delete.html @@ -0,0 +1,15 @@ + + + + Excluir Voo + + +

Excluir Voo

+

Tem certeza de que deseja excluir o voo "{{ flight }}"?

+
+ {% csrf_token %} + +
+ Cancelar + + diff --git a/mamutes/report/templates/report/flight_form.html b/mamutes/report/templates/report/flight_form.html new file mode 100644 index 0000000..9a6c14b --- /dev/null +++ b/mamutes/report/templates/report/flight_form.html @@ -0,0 +1,15 @@ + + + + Formulário de Voo + + +

{% if form.instance.pk %}Editar Voo{% else %}Adicionar Voo{% endif %}

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ Voltar + + diff --git a/mamutes/report/templates/report/flight_list.html b/mamutes/report/templates/report/flight_list.html new file mode 100644 index 0000000..e87125e --- /dev/null +++ b/mamutes/report/templates/report/flight_list.html @@ -0,0 +1,91 @@ +{% load static %} + + + + + + Lista de Voos + + + +

Lista de Voos

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + {% for flight in flights %} + + + + + + + + + + + + + + + + + + + + + + + + {% endfor %} + +
IDDataHora de inicioHora de fimDocumento feito porNome do PilotoLocalMembros EnvolvidosNível de SucessoDescrição do ObjetivoÊxitoImpressões do PilotoMelhoriasVelocidade (m/s)Direção do VentoPressão Atmosférica (hPa)Peso de Decolagem (kg)Ciclos de VooTelemetria (Link)AcidenteAções
{{ flight.id }}{{ flight.date }}{{ flight.start_time}}{{ flight.end_time}}{{ flight.document_username}}{{ flight.pilot_name }}{{ flight.location }}{{ flight.team_members }}{{ flight.flight_success_rating }}{{ flight.flight_objective_description }}{{ flight.results }}{{ flight.pilot_impressions }}{{ flight.improvements }}{{ flight.wind_speed }}{{ flight.wind_direction }}{{ flight.atmospheric_pressure }}{{ flight.total_takeoff_weight }}{{ flight.flight_cycles }}Acessar Telemetria{{ flight.occurred_accident }} + Editar + Excluir +
+ + + + \ No newline at end of file diff --git a/mamutes/report/tests.py b/mamutes/report/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/mamutes/report/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/mamutes/report/urls.py b/mamutes/report/urls.py new file mode 100644 index 0000000..a05a06d --- /dev/null +++ b/mamutes/report/urls.py @@ -0,0 +1,9 @@ +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.flight_list, name='flight_list'), # Listar todos os voos + path('create/', views.flight_create, name='flight_create'), # Criar um novo voo + path('/edit/', views.flight_edit, name='flight_edit'), # Editar um voo + path('/delete/', views.flight_delete, name='flight_delete'), # Deletar um voo +] diff --git a/mamutes/report/views.py b/mamutes/report/views.py new file mode 100644 index 0000000..5324869 --- /dev/null +++ b/mamutes/report/views.py @@ -0,0 +1,39 @@ +from django.shortcuts import render, redirect, get_object_or_404 +from .models import FlightLog +from .forms import FlightForm + +# Listar todos os voos +def flight_list(request): + flight = FlightLog.objects.all() + return render(request, 'report/flight_list.html', {'flights': flight}) + +# Criar um novo voo +def flight_create(request): + if request.method == 'POST': + form = FlightForm(request.POST) + if form.is_valid(): + form.save() + return redirect('flight_list') + else: + form = FlightForm() + return render(request, 'report/flight_form.html', {'form': form}) + +# Editar um voo existente +def flight_edit(request, id): + flight = get_object_or_404(FlightLog, id=id) + if request.method == 'POST': + form = FlightForm(request.POST, instance=flight) + if form.is_valid(): + form.save() + return redirect('flight_list') + else: + form = FlightForm(instance=flight) + return render(request, 'report/flight_form.html', {'form': form}) + +# Deletar um voo +def flight_delete(request, id): + flight = get_object_or_404(FlightLog, id=id) + if request.method == 'POST': + flight.delete() + return redirect('flight_list') + return render(request, 'report/flight_confirm_delete.html', {'flight': FlightLog}) diff --git a/mamutes/stock/__init__.py b/mamutes/stock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/stock/admin.py b/mamutes/stock/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/mamutes/stock/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/mamutes/stock/apps.py b/mamutes/stock/apps.py new file mode 100644 index 0000000..ee74ea8 --- /dev/null +++ b/mamutes/stock/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class StockConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'stock' diff --git a/mamutes/stock/migrations/0001_initial.py b/mamutes/stock/migrations/0001_initial.py new file mode 100644 index 0000000..d67f626 --- /dev/null +++ b/mamutes/stock/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 5.1.4 on 2024-12-22 23:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Tool', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('name', models.CharField(max_length=100)), + ('brand', models.CharField(max_length=100)), + ('quantity', models.IntegerField()), + ('observation', models.TextField(blank=True, max_length=300, null=True)), + ('location', models.CharField(max_length=100)), + ('being_used', models.BooleanField(default=False)), + ], + ), + ] diff --git a/mamutes/stock/migrations/__init__.py b/mamutes/stock/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mamutes/stock/models.py b/mamutes/stock/models.py new file mode 100644 index 0000000..ade311d --- /dev/null +++ b/mamutes/stock/models.py @@ -0,0 +1,14 @@ +from django.db import models +from django.contrib.auth.models import AbstractUser +# Create your models here. + +class Tool(models.Model): + id = models.AutoField(primary_key=True) + name = models.CharField(max_length=100) + brand = models.CharField(max_length=100) + quantity = models.IntegerField() + observation = models.TextField(max_length=300, null=True, blank=True) + location = models.CharField(max_length=100) + being_used = models.BooleanField(default=False) + def __str__(self): + return self.name \ No newline at end of file diff --git a/mamutes/stock/tests.py b/mamutes/stock/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/mamutes/stock/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/mamutes/stock/views.py b/mamutes/stock/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/mamutes/stock/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.