diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..30a48cf 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fa..86a2b56 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 6867ddf..fa58359 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..09486cb --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 5.2.7 on 2025-11-26 09:10 + +import uuid +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Ticket', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('ticket_id', models.CharField(editable=False, max_length=8, unique=True)), + ('name', models.CharField(max_length=100)), + ('email', models.EmailField(max_length=254)), + ('subject', models.CharField(max_length=255)), + ('description', models.TextField()), + ('status', models.CharField(choices=[('Open', 'Open'), ('In Progress', 'In Progress'), ('Closed', 'Closed')], default='Open', max_length=20)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..91916d8 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..d1c0d4a 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,28 @@ from django.db import models +import uuid -# Create your models here. +class Ticket(models.Model): + STATUS_CHOICES = [ + ('Open', 'Open'), + ('In Progress', 'In Progress'), + ('Closed', 'Closed'), + ] + + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + ticket_id = models.CharField(max_length=8, unique=True, editable=False) + name = models.CharField(max_length=100) + email = models.EmailField() + subject = models.CharField(max_length=255) + description = models.TextField() + status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='Open') + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def save(self, *args, **kwargs): + if not self.ticket_id: + # Generate a unique 8-character ticket ID + self.ticket_id = str(uuid.uuid4().hex)[:8].upper() + super().save(*args, **kwargs) + + def __str__(self): + return f"{self.ticket_id} - {self.subject}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..8580de9 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -14,6 +14,9 @@ {% endif %} {% load static %} + + + {% block head %}{% endblock %} diff --git a/core/templates/core/submit_ticket.html b/core/templates/core/submit_ticket.html new file mode 100644 index 0000000..c0061c8 --- /dev/null +++ b/core/templates/core/submit_ticket.html @@ -0,0 +1,66 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Submit a Ticket{% endblock %} + +{% block head %} + + +{% endblock %} + +{% block content %} +
+
+

Submit a New Ticket

+
+ {% csrf_token %} +
+ {{ form.name.label_tag }} + {{ form.name }} +
+
+ {{ form.email.label_tag }} + {{ form.email }} +
+
+ {{ form.subject.label_tag }} + {{ form.subject }} +
+
+ {{ form.description.label_tag }} + {{ form.description }} +
+ +
+
+
+{% endblock %} diff --git a/core/templates/core/ticket_success.html b/core/templates/core/ticket_success.html new file mode 100644 index 0000000..7978c83 --- /dev/null +++ b/core/templates/core/ticket_success.html @@ -0,0 +1,35 @@ +{% extends 'base.html' %} +{% load static %} + +{% block title %}Ticket Submitted Successfully{% endblock %} + +{% block head %} + + +{% endblock %} + +{% block content %} +
+

Thank You!

+

Your support ticket has been submitted successfully.

+

Your Ticket ID is:

+
{{ ticket.ticket_id }}
+ Back to Home +
+{% endblock %} diff --git a/core/urls.py b/core/urls.py index 6299e3d..8fdc404 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,7 +1,11 @@ from django.urls import path -from .views import home +from .views import index, submit_ticket, ticket_success + +app_name = 'core' urlpatterns = [ - path("", home, name="home"), -] + path("", index, name="index"), + path("submit/", submit_ticket, name="submit_ticket"), + path("submit/success//", ticket_success, name="ticket_success"), +] \ No newline at end of file diff --git a/core/views.py b/core/views.py index c9aed12..527d924 100644 --- a/core/views.py +++ b/core/views.py @@ -1,25 +1,30 @@ import os -import platform +from django.shortcuts import render, redirect +from django.forms import ModelForm +from .models import Ticket -from django import get_version as django_version -from django.shortcuts import render -from django.utils import timezone +class TicketForm(ModelForm): + class Meta: + model = Ticket + fields = ['name', 'email', 'subject', 'description'] +def index(request): + """Render the landing screen.""" + return render(request, "core/index.html") -def home(request): - """Render the landing screen with loader and environment details.""" - host_name = request.get_host().lower() - agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" - now = timezone.now() +def submit_ticket(request): + if request.method == 'POST': + form = TicketForm(request.POST) + if form.is_valid(): + ticket = form.save() + return redirect('core:ticket_success', ticket_id=ticket.id) + else: + form = TicketForm() + return render(request, 'core/submit_ticket.html', {'form': form}) - context = { - "project_name": "New Style", - "agent_brand": agent_brand, - "django_version": django_version(), - "python_version": platform.python_version(), - "current_time": now, - "host_name": host_name, - "project_description": os.getenv("PROJECT_DESCRIPTION", ""), - "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), - } - return render(request, "core/index.html", context) +def ticket_success(request, ticket_id): + try: + ticket = Ticket.objects.get(id=ticket_id) + except Ticket.DoesNotExist: + return redirect('core:index') # Or show a 404 page + return render(request, 'core/ticket_success.html', {'ticket': ticket}) \ No newline at end of file diff --git a/static/css/custom.css b/static/css/custom.css index 925f6ed..ad8e252 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,4 +1,70 @@ /* Custom styles for the application */ body { - font-family: system-ui, -apple-system, sans-serif; + font-family: 'Roboto', sans-serif; + background-color: #f8f9fa; } + +/* Form styling */ +.form-container { + max-width: 700px; + margin: 50px auto; + padding: 30px; + background-color: #fff; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0,0,0,0.1); +} + +.form-container h1 { + font-family: 'Poppins', sans-serif; + font-weight: 700; + margin-bottom: 30px; +} + +.form-label { + font-family: 'Roboto', sans-serif; + font-weight: 500; +} + +.form-control { + border-radius: 0.25rem; +} + +.btn-primary-custom { + background-color: #1A237E; + border-color: #1A237E; + font-family: 'Roboto', sans-serif; + font-weight: 500; + padding: 10px 25px; + color: #fff; +} + +.btn-primary-custom:hover { + background-color: #0D1241; + border-color: #0D1241; + color: #fff; +} + +/* Helper to apply bootstrap form-control styles to our form fields */ +input[type="text"], +input[type="email"], +textarea { + display: block; + width: 100%; + padding: .375rem .75rem; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #212529; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border-radius: .25rem; + transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; +} + +textarea { + min-height: 150px; +} \ No newline at end of file diff --git a/staticfiles/css/custom.css b/staticfiles/css/custom.css index 108056f..ad8e252 100644 --- a/staticfiles/css/custom.css +++ b/staticfiles/css/custom.css @@ -1,21 +1,70 @@ - -:root { - --bg-color-start: #6a11cb; - --bg-color-end: #2575fc; - --text-color: #ffffff; - --card-bg-color: rgba(255, 255, 255, 0.01); - --card-border-color: rgba(255, 255, 255, 0.1); -} +/* Custom styles for the application */ body { - margin: 0; - font-family: 'Inter', sans-serif; - background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); - color: var(--text-color); - display: flex; - justify-content: center; - align-items: center; - min-height: 100vh; - text-align: center; - overflow: hidden; - position: relative; + font-family: 'Roboto', sans-serif; + background-color: #f8f9fa; } + +/* Form styling */ +.form-container { + max-width: 700px; + margin: 50px auto; + padding: 30px; + background-color: #fff; + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0,0,0,0.1); +} + +.form-container h1 { + font-family: 'Poppins', sans-serif; + font-weight: 700; + margin-bottom: 30px; +} + +.form-label { + font-family: 'Roboto', sans-serif; + font-weight: 500; +} + +.form-control { + border-radius: 0.25rem; +} + +.btn-primary-custom { + background-color: #1A237E; + border-color: #1A237E; + font-family: 'Roboto', sans-serif; + font-weight: 500; + padding: 10px 25px; + color: #fff; +} + +.btn-primary-custom:hover { + background-color: #0D1241; + border-color: #0D1241; + color: #fff; +} + +/* Helper to apply bootstrap form-control styles to our form fields */ +input[type="text"], +input[type="email"], +textarea { + display: block; + width: 100%; + padding: .375rem .75rem; + font-size: 1rem; + font-weight: 400; + line-height: 1.5; + color: #212529; + background-color: #fff; + background-clip: padding-box; + border: 1px solid #ced4da; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + border-radius: .25rem; + transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; +} + +textarea { + min-height: 150px; +} \ No newline at end of file