firdt
This commit is contained in:
parent
ee580a768b
commit
b33f69c64d
Binary file not shown.
Binary file not shown.
Binary file not shown.
29
core/migrations/0001_initial.py
Normal file
29
core/migrations/0001_initial.py
Normal file
@ -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)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,28 @@
|
|||||||
from django.db import models
|
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}"
|
||||||
@ -14,6 +14,9 @@
|
|||||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
66
core/templates/core/submit_ticket.html
Normal file
66
core/templates/core/submit_ticket.html
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}Submit a Ticket{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
.btn-primary-custom {
|
||||||
|
background-color: #1A237E;
|
||||||
|
border-color: #1A237E;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
font-weight: 500;
|
||||||
|
padding: 10px 25px;
|
||||||
|
}
|
||||||
|
.btn-primary-custom:hover {
|
||||||
|
background-color: #0D1241;
|
||||||
|
border-color: #0D1241;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="form-container">
|
||||||
|
<h1>Submit a New Ticket</h1>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="mb-3">
|
||||||
|
{{ form.name.label_tag }}
|
||||||
|
{{ form.name }}
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
{{ form.email.label_tag }}
|
||||||
|
{{ form.email }}
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
{{ form.subject.label_tag }}
|
||||||
|
{{ form.subject }}
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
{{ form.description.label_tag }}
|
||||||
|
{{ form.description }}
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary-custom">Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
35
core/templates/core/ticket_success.html
Normal file
35
core/templates/core/ticket_success.html
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
{% block title %}Ticket Submitted Successfully{% endblock %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.success-container {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 100px;
|
||||||
|
}
|
||||||
|
.success-container h1 {
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1A237E;
|
||||||
|
}
|
||||||
|
.ticket-id {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #5C6BC0;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container success-container">
|
||||||
|
<h1>Thank You!</h1>
|
||||||
|
<p>Your support ticket has been submitted successfully.</p>
|
||||||
|
<p>Your Ticket ID is:</p>
|
||||||
|
<div class="ticket-id">{{ ticket.ticket_id }}</div>
|
||||||
|
<a href="{% url 'core:index' %}" class="btn btn-primary">Back to Home</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -1,7 +1,11 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import home
|
from .views import index, submit_ticket, ticket_success
|
||||||
|
|
||||||
|
app_name = 'core'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path("", index, name="index"),
|
||||||
|
path("submit/", submit_ticket, name="submit_ticket"),
|
||||||
|
path("submit/success/<uuid:ticket_id>/", ticket_success, name="ticket_success"),
|
||||||
]
|
]
|
||||||
@ -1,25 +1,30 @@
|
|||||||
import os
|
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
|
class TicketForm(ModelForm):
|
||||||
from django.shortcuts import render
|
class Meta:
|
||||||
from django.utils import timezone
|
model = Ticket
|
||||||
|
fields = ['name', 'email', 'subject', 'description']
|
||||||
|
|
||||||
|
def index(request):
|
||||||
|
"""Render the landing screen."""
|
||||||
|
return render(request, "core/index.html")
|
||||||
|
|
||||||
def home(request):
|
def submit_ticket(request):
|
||||||
"""Render the landing screen with loader and environment details."""
|
if request.method == 'POST':
|
||||||
host_name = request.get_host().lower()
|
form = TicketForm(request.POST)
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
if form.is_valid():
|
||||||
now = timezone.now()
|
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 = {
|
def ticket_success(request, ticket_id):
|
||||||
"project_name": "New Style",
|
try:
|
||||||
"agent_brand": agent_brand,
|
ticket = Ticket.objects.get(id=ticket_id)
|
||||||
"django_version": django_version(),
|
except Ticket.DoesNotExist:
|
||||||
"python_version": platform.python_version(),
|
return redirect('core:index') # Or show a 404 page
|
||||||
"current_time": now,
|
return render(request, 'core/ticket_success.html', {'ticket': ticket})
|
||||||
"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)
|
|
||||||
@ -1,4 +1,70 @@
|
|||||||
/* Custom styles for the application */
|
/* Custom styles for the application */
|
||||||
body {
|
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;
|
||||||
}
|
}
|
||||||
@ -1,21 +1,70 @@
|
|||||||
|
/* Custom styles for the application */
|
||||||
: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);
|
|
||||||
}
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
font-family: 'Roboto', sans-serif;
|
||||||
font-family: 'Inter', sans-serif;
|
background-color: #f8f9fa;
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
}
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
/* Form styling */
|
||||||
justify-content: center;
|
.form-container {
|
||||||
align-items: center;
|
max-width: 700px;
|
||||||
min-height: 100vh;
|
margin: 50px auto;
|
||||||
text-align: center;
|
padding: 30px;
|
||||||
overflow: hidden;
|
background-color: #fff;
|
||||||
position: relative;
|
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;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user