Skip to content

Commit

Permalink
[UPDATE] - Added icons to tickets, tooltips, fixed nav, and glass pan…
Browse files Browse the repository at this point in the history
…eling

added a ton
  • Loading branch information
nulzo authored Nov 20, 2023
2 parents 73555d9 + a9f716a commit 350523f
Show file tree
Hide file tree
Showing 41 changed files with 1,669 additions and 1,186 deletions.
2 changes: 1 addition & 1 deletion backend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ lint:

.PHONY format:
format:
autoflake . --in-place --remove-all-unused-imports
autoflake -r . --in-place --remove-all-unused-imports
isort .
black .

Expand Down
6 changes: 4 additions & 2 deletions backend/api/endpoints/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def sanitize(self, querystring: str) -> str:

def get(self, request: Request) -> Response:
tickets = Ticket.generic.all()
print(tickets)
querystring = self.get_querystring(request=request)
if len(querystring) > 0:
if department := querystring.get("department"):
Expand All @@ -42,7 +41,10 @@ def get(self, request: Request) -> Response:
if active := querystring.get("active"):
tickets = tickets.filter(is_active=active.capitalize())

serializer = TicketSerializer(tickets, many=True)
if ticket_status := querystring.get("status"):
tickets = tickets.filter(status=ticket_status.upper())

serializer = TicketGetSerializer(tickets, many=True)
return Response(serializer.data)

def post(self, request: Request) -> Response:
Expand Down
100 changes: 53 additions & 47 deletions backend/api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.7 on 2023-11-15 06:26
# Generated by Django 4.2.7 on 2023-11-18 23:32

import django.db.models.deletion
import django.db.models.manager
Expand Down Expand Up @@ -62,42 +62,6 @@ class Migration(migrations.Migration):
("generic", django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name="Messages",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"message_type",
models.CharField(
choices=[
("INF", "Informative"),
("URG", "Urgent"),
("GEN", "General"),
],
default="INF",
max_length=3,
),
),
("message_header", models.CharField(max_length=50)),
("message_body", models.TextField(max_length=1024)),
("from_date", models.DateTimeField(blank=True)),
("to_date", models.DateTimeField(blank=True)),
],
options={
"verbose_name_plural": "messages",
},
managers=[
("generic", django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name="Professor",
fields=[
Expand Down Expand Up @@ -204,12 +168,24 @@ class Migration(migrations.Migration):
),
),
("name", models.CharField(max_length=50)),
("title", models.CharField(max_length=25)),
("description", models.TextField(max_length=1024)),
("completed", models.BooleanField(default=False)),
("started", models.BooleanField(default=False)),
("start_time", models.DateTimeField(blank=True, null=True)),
("end_time", models.DateTimeField(blank=True, null=True)),
("tutor_comments", models.CharField(blank=True, max_length=255)),
(
"status",
models.CharField(
choices=[
("NEW", "New"),
("OPENED", "Opened"),
("CLOSED", "Closed"),
],
default="NEW",
max_length=10,
),
),
("created_at", models.DateTimeField(auto_now_add=True)),
("opened_at", models.DateTimeField(blank=True, null=True)),
("updated_at", models.DateTimeField(auto_now_add=True)),
("closed_at", models.DateTimeField(blank=True, null=True)),
("was_successful", models.BooleanField(default=False)),
("was_reopened", models.BooleanField(default=False)),
(
Expand All @@ -231,16 +207,13 @@ class Migration(migrations.Migration):
(
"professor",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.PROTECT,
to="api.professor",
on_delete=django.db.models.deletion.PROTECT, to="api.professor"
),
),
(
"student",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="student_ticket",
to="api.user",
Expand All @@ -250,7 +223,6 @@ class Migration(migrations.Migration):
"tutor",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="tutor_ticket",
to="api.user",
Expand Down Expand Up @@ -297,6 +269,40 @@ class Migration(migrations.Migration):
("generic", django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name="Messages",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("message_content", models.TextField(max_length=128)),
("created_date", models.DateTimeField(auto_now_add=True)),
(
"sender",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT, to="api.user"
),
),
(
"ticket",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="api.ticket"
),
),
],
options={
"verbose_name_plural": "messages",
},
managers=[
("generic", django.db.models.manager.Manager()),
],
),
migrations.CreateModel(
name="Hour",
fields=[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Generated by Django 4.2.7 on 2023-11-19 00:46

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("api", "0001_initial"),
]

operations = [
migrations.AlterField(
model_name="ticket",
name="student",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="student_ticket",
to="api.user",
),
),
migrations.AlterField(
model_name="ticket",
name="tutor",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.PROTECT,
related_name="tutor_ticket",
to="api.user",
),
),
]
13 changes: 4 additions & 9 deletions backend/api/models/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ class Messages(models.Model):
The admin has the option to display the date within the announcment as well.
"""

INFORMATIVE = "INF"
URGENT = "URG"
GENERAL = "GEN"
TYPES = [(INFORMATIVE, "Informative"), (URGENT, "Urgent"), (GENERAL, "General")]
message_type = models.CharField(max_length=3, choices=TYPES, default=INFORMATIVE)
message_header = models.CharField(max_length=50)
message_body = models.TextField(max_length=1024)
from_date = models.DateTimeField(blank=True)
to_date = models.DateTimeField(blank=True)
ticket = models.ForeignKey("api.Ticket", on_delete=models.CASCADE, blank=False)
sender = models.ForeignKey("api.User", on_delete=models.PROTECT, blank=False)
message_content = models.TextField(max_length=128)
created_date = models.DateTimeField(auto_now_add=True)

generic = models.Manager()

Expand Down
27 changes: 17 additions & 10 deletions backend/api/models/ticket.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from django.db import models
from django.db.models.query import QuerySet

from .issue import Issues
from .professor import Professor


class TicketManager(models.Manager):
def get_all(self) -> QuerySet:
Expand Down Expand Up @@ -51,10 +48,19 @@ class Ticket(models.Model):
reopened after it was closed.
"""

professor = models.ForeignKey(Professor, null=True, on_delete=models.PROTECT)
NEW = "NEW"
OPENED = "OPENED"
CLOSED = "CLOSED"
STATUS_CHOICES = [
(NEW, "New"),
(OPENED, "Opened"),
(CLOSED, "Closed"),
]

professor = models.ForeignKey("api.Professor", on_delete=models.PROTECT)
# section = models.ForeignKey("api.Section", null=True, on_delete=models.PROTECT)
course = models.ForeignKey("api.Course", null=True, on_delete=models.PROTECT)
issue = models.ForeignKey(Issues, null=True, on_delete=models.PROTECT)
issue = models.ForeignKey("api.Issues", null=True, on_delete=models.PROTECT)
student = models.ForeignKey(
"api.User",
null=True,
Expand All @@ -70,12 +76,13 @@ class Ticket(models.Model):
blank=True,
)
name = models.CharField(blank=False, max_length=50)
title = models.CharField(blank=False, max_length=25)
description = models.TextField(max_length=1024)
completed = models.BooleanField(default=False)
started = models.BooleanField(default=False)
start_time = models.DateTimeField(null=True, blank=True)
end_time = models.DateTimeField(null=True, blank=True)
tutor_comments = models.CharField(max_length=255, blank=True)
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default=NEW)
created_at = models.DateTimeField(null=False, blank=False, auto_now_add=True)
opened_at = models.DateTimeField(null=True, blank=True)
updated_at = models.DateTimeField(null=False, blank=False, auto_now_add=True)
closed_at = models.DateTimeField(null=True, blank=True)
was_successful = models.BooleanField(default=False)
was_reopened = models.BooleanField(default=False)

Expand Down
8 changes: 5 additions & 3 deletions backend/base/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
ALLOWED_HOSTS: list[str] = ["*", "http://localhost", "localhost"]

CSRF_TRUSTED_ORIGINS = [
'http://localhost', 'http://localhost:80', 'http://localhost:4200', 'http://localhost:6969'
"http://localhost",
"http://localhost:80",
"http://localhost:4200",
"http://localhost:6969",
]

INSTALLED_APPS = [
Expand Down Expand Up @@ -62,8 +65,7 @@
CORS_ALLOW_ALL_ORIGINS = True

ASGI_APPLICATION = "api.routing.application"
CHANNEL_LAYERS = {"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer"}}
CHANNEL_LAYERS = {"default": {"BACKEND": "channels.layers.InMemoryChannelLayer"}}

MESSAGE_STORAGE = "django.contrib.messages.storage.cookie.CookieStorage"

Expand Down
24 changes: 11 additions & 13 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image" href="/UNO.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSLC Tutoring Portal</title>
</head>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image" href="/UNO.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSLC Tutoring Portal</title>
</head>

<body class="overscroll-none">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
<body class="overscroll-none antialiased text-foreground min-h-screen">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"@azure/msal-react": "^2.0.7",
"@hookform/resolvers": "^3.3.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-avatar": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-context-menu": "^2.1.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-hover-card": "^1.0.6",
"@radix-ui/react-icons": "^1.3.0",
Expand All @@ -40,7 +40,7 @@
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.6",
"@radix-ui/react-tooltip": "^1.0.7",
"@radix-ui/themes": "^1.1.2",
"@tailwindcss/forms": "^0.5.6",
"@tanstack/react-query": "^5.0.5",
Expand Down
Loading

0 comments on commit 350523f

Please sign in to comment.