From d9ecd692ef248562729d45e43b54309a001d8af6 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 4 Jan 2024 21:58:11 +0000 Subject: [PATCH] working on tickets implementation --- .gitignore | 34 ++ README.md | 206 +-------- apps/authentication/admin.py | 8 +- .../authentication/migrations/0001_initial.py | 45 ++ .../migrations/0002_user_icon.py | 18 + .../migrations/0003_auto_20240104_1447.py | 24 + apps/authentication/migrations/__init__.py | 4 - apps/authentication/models.py | 23 +- apps/authentication/urls.py | 5 +- apps/authentication/views.py | 10 +- apps/home/admin.py | 7 +- apps/home/migrations/0001_initial.py | 45 ++ apps/home/migrations/__init__.py | 4 - apps/home/models.py | 67 ++- apps/home/urls.py | 9 +- apps/home/views.py | 38 +- apps/static/assets/css/index.css | 1 + apps/templates/accounts/profile.html | 49 ++ apps/templates/home/dashboard.html | 287 ++++++++++++ apps/templates/home/newticket.html | 35 ++ apps/templates/home/tickets.html | 422 ++++++++++++++++++ apps/templates/includes/footer.html | 2 +- apps/templates/includes/navigation.html | 6 +- apps/templates/includes/sidebar.html | 22 +- apps/templates/layouts/base.html | 35 +- core/settings.py | 22 +- core/urls.py | 10 +- media/django-dashboard-adminator-card-low.jpg | Bin 13705 -> 0 bytes media/django-dashboard-adminator-card-low.png | Bin 3900 -> 0 bytes media/django-dashboard-adminator-card.jpg | Bin 14368 -> 0 bytes media/django-dashboard-adminator-card.png | Bin 12916 -> 0 bytes ...-dashboard-adminator-content-image-low.png | Bin 11338 -> 0 bytes ...ango-dashboard-adminator-content-image.png | Bin 22172 -> 0 bytes media/django-dashboard-adminator-intro.gif | Bin 680025 -> 0 bytes ...jango-dashboard-adminator-screen-1-low.png | Bin 23887 -> 0 bytes media/django-dashboard-adminator-screen-1.png | Bin 24124 -> 0 bytes ...jango-dashboard-adminator-screen-2-low.png | Bin 7414 -> 0 bytes media/django-dashboard-adminator-screen-2.png | Bin 38073 -> 0 bytes ...jango-dashboard-adminator-screen-3-low.png | Bin 4767 -> 0 bytes media/django-dashboard-adminator-screen-3.png | Bin 36525 -> 0 bytes ...jango-dashboard-adminator-screen-4-low.png | Bin 11422 -> 0 bytes media/django-dashboard-adminator-screen-4.png | Bin 31154 -> 0 bytes ...o-dashboard-adminator-screen-login-low.png | Bin 87302 -> 0 bytes ...jango-dashboard-adminator-screen-login.png | Bin 320227 -> 0 bytes .../django-dashboard-adminator-screen-low.png | Bin 18851 -> 0 bytes media/django-dashboard-adminator-screen.png | Bin 36003 -> 0 bytes media/users/default.webp | Bin 0 -> 1876 bytes requirements.txt | 5 +- 48 files changed, 1190 insertions(+), 253 deletions(-) create mode 100644 .gitignore create mode 100644 apps/authentication/migrations/0001_initial.py create mode 100644 apps/authentication/migrations/0002_user_icon.py create mode 100644 apps/authentication/migrations/0003_auto_20240104_1447.py create mode 100644 apps/home/migrations/0001_initial.py create mode 100644 apps/templates/accounts/profile.html create mode 100644 apps/templates/home/dashboard.html create mode 100644 apps/templates/home/newticket.html create mode 100644 apps/templates/home/tickets.html delete mode 100644 media/django-dashboard-adminator-card-low.jpg delete mode 100644 media/django-dashboard-adminator-card-low.png delete mode 100644 media/django-dashboard-adminator-card.jpg delete mode 100644 media/django-dashboard-adminator-card.png delete mode 100644 media/django-dashboard-adminator-content-image-low.png delete mode 100644 media/django-dashboard-adminator-content-image.png delete mode 100644 media/django-dashboard-adminator-intro.gif delete mode 100644 media/django-dashboard-adminator-screen-1-low.png delete mode 100644 media/django-dashboard-adminator-screen-1.png delete mode 100644 media/django-dashboard-adminator-screen-2-low.png delete mode 100644 media/django-dashboard-adminator-screen-2.png delete mode 100644 media/django-dashboard-adminator-screen-3-low.png delete mode 100644 media/django-dashboard-adminator-screen-3.png delete mode 100644 media/django-dashboard-adminator-screen-4-low.png delete mode 100644 media/django-dashboard-adminator-screen-4.png delete mode 100644 media/django-dashboard-adminator-screen-login-low.png delete mode 100644 media/django-dashboard-adminator-screen-login.png delete mode 100644 media/django-dashboard-adminator-screen-low.png delete mode 100644 media/django-dashboard-adminator-screen.png create mode 100644 media/users/default.webp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df1888a --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# env vars +.env + +# tests and coverage +*.pytest_cache +.coverage + +# database & logs +*.db +*.sqlite3 +*.log + +# venv +env +venv + +# other +.DS_Store + +# javascript +package-lock.json + +staticfiles/* +!staticfiles/.gitkeep +.vscode/symbols.json + +apps/static/assets/node_modules +apps/static/assets/yarn.lock +apps/static/assets/.temp + diff --git a/README.md b/README.md index 60c3c8b..f04a828 100644 --- a/README.md +++ b/README.md @@ -1,204 +1,20 @@ -# [Adminator Django](https://appseed.us/product/adminator/django/) +# Contributing -Open-source **[Django Dashboard](https://appseed.us/admin-dashboards/django/)** generated by `AppSeed` op top of an iconic design. For newcomers, **Adminator** is one of the best open-source admin dashboard & control panel theme. Built on top of Bootstrap, `Adminator` provides a range of responsive, reusable, and commonly used components. +## Migrations -- 👉 [Adminator Django](https://appseed.us/product/adminator/django/) - `Product page` -- 👉 [Adminator Django](https://django-adminator.appseed-srv1.com) - `LIVE deployment` +If facing migration errors, delete folders in all apps called `migrations` and delete the `db.sqlite3` database file. Note you will lose all data. -
+To get started: -> 🚀 Built with [App Generator](https://appseed.us/generator/), Timestamp: `2022-05-31 07:49` +1. `python manage.py makemigrations authentication` +2. `python manage.py makemigrations home` +3. `python manage.py migrate` -- ✅ Database: `sqlite` -- ✅ UI-Ready app, Django Native ORM -- ✅ `Session-Based authentication`, Forms validation -- ✅ Design: [Adminator](https://github.com/app-generator/adminator) **v2.0.3** - - Gulp-generated version +## Run the server -
+`python manage.py runserver 0.0.0.0:8000` -![Adminator Dashboard - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/173175611-63faf177-33d8-4238-ad0b-271a16465bd0.png) +## Access the website -
+`http://localhost:8000` -## ✨ Start the app in Docker - -> **Step 1** - Download the code from the GH repository (using `GIT`) - -```bash -$ # Get the code -$ git clone https://github.com/app-generator/django-adminator.git -$ cd django-adminator -``` - -
- -> **Step 2** - Start the APP in `Docker` - -```bash -$ docker-compose up --build -``` - -Visit `http://localhost:5085` in your browser. The app should be up & running. - -
- -## ✨ How to use it - -> Download the code - -```bash -$ # Get the code -$ git clone https://github.com/app-generator/django-adminator.git -$ cd django-adminator -``` - -
- -### 👉 Set Up for `Unix`, `MacOS` - -> Install modules via `VENV` - -```bash -$ virtualenv env -$ source env/bin/activate -$ pip3 install -r requirements.txt -``` - -
- -> Set Up Database - -```bash -$ python manage.py makemigrations -$ python manage.py migrate -``` - -
- -> Start the app - -```bash -$ python manage.py runserver -``` - -At this point, the app runs at `http://127.0.0.1:8000/`. - -
- -### 👉 Set Up for `Windows` - -> Install modules via `VENV` (windows) - -``` -$ virtualenv env -$ .\env\Scripts\activate -$ pip3 install -r requirements.txt -``` - -
- -> Set Up Database - -```bash -$ python manage.py makemigrations -$ python manage.py migrate -``` - -
- -> Start the app - -```bash -$ python manage.py runserver -``` - -At this point, the app runs at `http://127.0.0.1:8000/`. - -
- -### 👉 Create Users - -By default, the app redirects guest users to authenticate. In order to access the private pages, follow this set up: - -- Start the app via `flask run` -- Access the `registration` page and create a new user: - - `http://127.0.0.1:8000/register/` -- Access the `sign in` page and authenticate - - `http://127.0.0.1:8000/login/` - -
- -## ✨ Code-base structure - -The project is coded using a simple and intuitive structure presented below: - -```bash -< PROJECT ROOT > - | - |-- core/ # Implements app configuration - | |-- settings.py # Defines Global Settings - | |-- wsgi.py # Start the app in production - | |-- urls.py # Define URLs served by all apps/nodes - | - |-- apps/ - | | - | |-- home/ # A simple app that serve HTML files - | | |-- views.py # Serve HTML pages for authenticated users - | | |-- urls.py # Define some super simple routes - | | - | |-- authentication/ # Handles auth routes (login and register) - | | |-- urls.py # Define authentication routes - | | |-- views.py # Handles login and registration - | | |-- forms.py # Define auth forms (login and register) - | | - | |-- static/ - | | |-- # CSS files, Javascripts files - | | - | |-- templates/ # Templates used to render pages - | |-- includes/ # HTML chunks and components - | | |-- navigation.html # Top menu component - | | |-- sidebar.html # Sidebar component - | | |-- footer.html # App Footer - | | |-- scripts.html # Scripts common to all pages - | | - | |-- layouts/ # Master pages - | | |-- base-fullscreen.html # Used by Authentication pages - | | |-- base.html # Used by common pages - | | - | |-- accounts/ # Authentication pages - | | |-- login.html # Login page - | | |-- register.html # Register page - | | - | |-- home/ # UI Kit Pages - | |-- index.html # Index page - | |-- 404-page.html # 404 page - | |-- *.html # All other pages - | - |-- requirements.txt # Development modules - SQLite storage - | - |-- .env # Inject Configuration via Environment - |-- manage.py # Start the app - Django default start script - | - |-- ************************************************************************ -``` - -
- -## ✨ PRO Version - -> For more components, pages and priority on support, feel free to take a look at this amazing starter: - -Soft UI Dashboard is a premium Bootstrap 5 Design now available for download in Django. Made of hundred of elements, designed blocks, and fully coded pages, Soft UI Dashboard PRO is ready to help you create stunning websites and web apps. - -- 👉 [Soft UI Dashboard PRO Django](https://appseed.us/product/soft-ui-dashboard-pro/django/) - Product Page -- 👉 [Soft UI Dashboard PRO Django](https://django-soft-ui-dashboard-pro.appseed-srv1.com/) - LIVE Demo - -
- -![Soft UI Dashboard PRO - Starter generated by AppSeed.](https://user-images.githubusercontent.com/51070104/170829870-8acde5af-849a-4878-b833-3be7e67cff2d.png) - -
- ---- -[Adminator Django](https://appseed.us/product/adminator/django/) - Open-source starter generated by **[AppSeed Generator](https://appseed.us/generator/)**. diff --git a/apps/authentication/admin.py b/apps/authentication/admin.py index 304ee83..6b03a4d 100644 --- a/apps/authentication/admin.py +++ b/apps/authentication/admin.py @@ -1,8 +1,8 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" from django.contrib import admin +from django.contrib.auth.admin import UserAdmin -# Register your models here. +from .models import User + +admin.site.register(User, UserAdmin) diff --git a/apps/authentication/migrations/0001_initial.py b/apps/authentication/migrations/0001_initial.py new file mode 100644 index 0000000..fe3e7eb --- /dev/null +++ b/apps/authentication/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 3.2.16 on 2024-01-04 14:05 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.utils.timezone +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0012_alter_user_first_name_max_length'), + ] + + operations = [ + migrations.CreateModel( + name='User', + fields=[ + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/apps/authentication/migrations/0002_user_icon.py b/apps/authentication/migrations/0002_user_icon.py new file mode 100644 index 0000000..d927614 --- /dev/null +++ b/apps/authentication/migrations/0002_user_icon.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.16 on 2024-01-04 14:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentication', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='icon', + field=models.ImageField(default='users/default.webp', upload_to='users'), + ), + ] diff --git a/apps/authentication/migrations/0003_auto_20240104_1447.py b/apps/authentication/migrations/0003_auto_20240104_1447.py new file mode 100644 index 0000000..c861b29 --- /dev/null +++ b/apps/authentication/migrations/0003_auto_20240104_1447.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.16 on 2024-01-04 14:47 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentication', '0002_user_icon'), + ] + + operations = [ + migrations.AddField( + model_name='user', + name='name', + field=models.CharField(default='Corban-Lee Jones', max_length=150), + preserve_default=False, + ), + migrations.AlterField( + model_name='user', + name='email', + field=models.EmailField(max_length=254, unique=True), + ), + ] diff --git a/apps/authentication/migrations/__init__.py b/apps/authentication/migrations/__init__.py index 58cca0e..e69de29 100644 --- a/apps/authentication/migrations/__init__.py +++ b/apps/authentication/migrations/__init__.py @@ -1,4 +0,0 @@ -# -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" diff --git a/apps/authentication/models.py b/apps/authentication/models.py index 602f3e8..c479520 100644 --- a/apps/authentication/models.py +++ b/apps/authentication/models.py @@ -1,8 +1,23 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" + +import uuid from django.db import models +from django.contrib.auth.models import AbstractUser -# Create your models here. + +# default user profile image +# https://st3.depositphotos.com/9998432/13335/v/450/depositphotos_133352156-stock-illustration-default-placeholder-profile-icon.jpg + + +class User(AbstractUser): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + icon = models.ImageField(upload_to="users", default="users/default.webp") + name = models.CharField(max_length=150) + email = models.EmailField(unique=True) + + USERNAME_FIELD = "email" + REQUIRED_FIELDS = ["id", "icon", "name"] + + def __str__(self): + return self.name diff --git a/apps/authentication/urls.py b/apps/authentication/urls.py index 1b5c270..e9953ad 100644 --- a/apps/authentication/urls.py +++ b/apps/authentication/urls.py @@ -4,11 +4,12 @@ Copyright (c) 2019 - present AppSeed.us """ from django.urls import path -from .views import login_view, register_user +from .views import login_view, register_user, profile_view from django.contrib.auth.views import LogoutView urlpatterns = [ path('login/', login_view, name="login"), path('register/', register_user, name="register"), - path("logout/", LogoutView.as_view(), name="logout") + path("logout/", LogoutView.as_view(), name="logout"), + path("profile/", profile_view, name="profile"), ] diff --git a/apps/authentication/views.py b/apps/authentication/views.py index 571f14f..9aa0fba 100644 --- a/apps/authentication/views.py +++ b/apps/authentication/views.py @@ -1,11 +1,9 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" -# Create your views here. from django.shortcuts import render, redirect from django.contrib.auth import authenticate, login +from django.contrib.auth.decorators import login_required + from .forms import LoginForm, SignUpForm @@ -54,3 +52,7 @@ def register_user(request): form = SignUpForm() return render(request, "accounts/register.html", {"form": form, "msg": msg, "success": success}) + +@login_required() +def profile_view(request): + return render(request, "accounts/profile.html") diff --git a/apps/home/admin.py b/apps/home/admin.py index 304ee83..e3660ff 100644 --- a/apps/home/admin.py +++ b/apps/home/admin.py @@ -1,8 +1,7 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" from django.contrib import admin -# Register your models here. +from .models import Ticket + +admin.site.register(Ticket) diff --git a/apps/home/migrations/0001_initial.py b/apps/home/migrations/0001_initial.py new file mode 100644 index 0000000..95342b2 --- /dev/null +++ b/apps/home/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 3.2.16 on 2024-01-04 14:05 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='TicketPriority', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=32)), + ('colour', models.CharField(max_length=7)), + ], + ), + migrations.CreateModel( + name='TicketTag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=32)), + ('colour', models.CharField(max_length=7)), + ], + ), + migrations.CreateModel( + name='Ticket', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=60)), + ('description', models.TextField(max_length=650)), + ('create_timestamp', models.DateTimeField(default=django.utils.timezone.now)), + ('edit_timestamp', models.DateTimeField(default=django.utils.timezone.now)), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/apps/home/migrations/__init__.py b/apps/home/migrations/__init__.py index 58cca0e..e69de29 100644 --- a/apps/home/migrations/__init__.py +++ b/apps/home/migrations/__init__.py @@ -1,4 +0,0 @@ -# -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" diff --git a/apps/home/models.py b/apps/home/models.py index c94fe84..c8d37a7 100644 --- a/apps/home/models.py +++ b/apps/home/models.py @@ -1,10 +1,67 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" + +from datetime import timedelta, datetime from django.db import models -from django.contrib.auth.models import User +from django.conf import settings +from django.utils import timezone -# Create your models here. +class TicketPriority(models.Model): + title = models.CharField(max_length=32) + colour = models.CharField(max_length=7) + + +class TicketTag(models.Model): + title = models.CharField(max_length=32) + colour = models.CharField(max_length=7) + + +class Ticket(models.Model): + title = models.CharField(max_length=60) + description = models.TextField(max_length=650) + author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + create_timestamp = models.DateTimeField(editable=True, default=timezone.now) + edit_timestamp = models.DateTimeField(editable=True, default=timezone.now) + + def __str__(self): + return f"#{self.id} • {self.title} • {self.author}" + + @property + def is_edited(self) -> bool: + """Returns boolean if the ticket is believed to have been edited. + We assume a ticket is edited if the edit_timestamp doesn't match the create_timestamp. + + Returns + ------- + bool + True if `self.edit_timestamp` doesn't match `self.create_timestamp`, False otherwise. + """ + + return self.create_timestamp != self.edit_timestamp + + @property + def is_older_than_day(self) -> bool: + """Returns boolean dependent on if `self.timestamp` is older than 24 hours. + + Returns + ------- + bool + True if `self.timestamp` is older than 24 hours, False otherwise. + """ + + dayago = timezone.now() - timedelta(hours=24) + return self.timestamp <= dayago + + @property + def timestamp(self) -> datetime: + """Returns `self.edit_timestamp` if `self.is_edited` is True, otherwise + returns `self.create_timestamp`. + + Returns + ------- + datetime + Either `self.edit_timestamp` or `self.create_timestamp`. + """ + + return self.edit_timestamp if self.is_edited else self.create_timestamp diff --git a/apps/home/urls.py b/apps/home/urls.py index 5acb444..e050667 100644 --- a/apps/home/urls.py +++ b/apps/home/urls.py @@ -3,7 +3,7 @@ Copyright (c) 2019 - present AppSeed.us """ -from django.urls import path, re_path +from django.urls import path, re_path, include from apps.home import views urlpatterns = [ @@ -11,6 +11,13 @@ urlpatterns = [ # The home page path('', views.index, name='home'), + # Custom Dashboard + path('dashboard/', views.dashboard, name="dashboard"), + path('tickets/', include([ + path('', views.tickets, name="tickets"), + path('new/', views.new_ticket, name="ticket-new"), + ])), + # Matches any html file re_path(r'^.*\.*', views.pages, name='pages'), diff --git a/apps/home/views.py b/apps/home/views.py index 2513b78..9d971db 100644 --- a/apps/home/views.py +++ b/apps/home/views.py @@ -1,16 +1,44 @@ # -*- encoding: utf-8 -*- -""" -Copyright (c) 2019 - present AppSeed.us -""" + +from datetime import timedelta, datetime from django import template from django.contrib.auth.decorators import login_required from django.http import HttpResponse, HttpResponseRedirect from django.template import loader +from django.shortcuts import render from django.urls import reverse +from .models import Ticket -@login_required(login_url="/login/") + +@login_required() +def dashboard(request): + return render(request, "home/dashboard.html") + + +@login_required() +def tickets(request): + tickets = Ticket.objects.all().order_by("-create_timestamp") + context = { + "tickets": tickets, + "dayago": datetime.now() - timedelta(hours=24) + } + + return render(request, "home/tickets.html", context) + + +def get_ticket(request, ticket_id: int): + ticket = Ticket.objects.get(id=ticket_id) + + + +@login_required() +def new_ticket(request): + return render(request, "home/newticket.html") + + +@login_required() def index(request): context = {'segment': 'index'} @@ -18,7 +46,7 @@ def index(request): return HttpResponse(html_template.render(context, request)) -@login_required(login_url="/login/") +@login_required() def pages(request): context = {} # All resource paths end in .html. diff --git a/apps/static/assets/css/index.css b/apps/static/assets/css/index.css index 4f5ca4e..6f476b3 100644 --- a/apps/static/assets/css/index.css +++ b/apps/static/assets/css/index.css @@ -69077,3 +69077,4 @@ table.dataTable.no-footer { ADD Custom code bellow this block */ /*# sourceMappingURL=index.css.map */ + diff --git a/apps/templates/accounts/profile.html b/apps/templates/accounts/profile.html new file mode 100644 index 0000000..54eddd7 --- /dev/null +++ b/apps/templates/accounts/profile.html @@ -0,0 +1,49 @@ +{% extends "layouts/base.html" %} + +{% block title %} Profile {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + +
+
+
+
+
+
+
Basic Form
+
+
+
+ + + We'll never share your email with anyone else. +
+ +
+
+
+
+
+
+
+
+ +
+
+

{{ request.user.name }}

+
+
+
+
+
+
+
+ +{% endblock content %} + + +{% block javascripts %}{% endblock javascripts %} diff --git a/apps/templates/home/dashboard.html b/apps/templates/home/dashboard.html new file mode 100644 index 0000000..7887e79 --- /dev/null +++ b/apps/templates/home/dashboard.html @@ -0,0 +1,287 @@ +{% extends "layouts/base.html" %} + +{% block title %} Dashboard {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + +
+
+
+
+
+
+ +
+
+
+
Total Tickets
+
+
+
+
+ +
+
+ +10% +
+
+
+
+
+ + +
+
+
+
Open Tickets
+
+
+
+
+ +
+
+ -7% +
+
+
+
+
+ + +
+
+
+
Pending Tickets
+
+
+
+
+ +
+
+ ~12% +
+
+
+
+
+ + +
+
+
+
Closed Tickets
+
+
+
+
+ +
+
+ 33% +
+
+
+
+
+
+
+
+
+
+
+
+
+
Monthly Stats
+
+
+ +
+
+
+
+ 2% + Open Tickets +
+
+ 15% + Pending Tickets +
+
+ 8% + Closed Tickets +
+
+
+
+
+
+
+
+ +
+
+
14
+ Open Tickets + 35% +
+
+ 35% Complete +
+
+
+
+
+
10
+ Pending Tickets + 25% +
+
+
+ 25% Complete +
+
+
+
+
+
16
+ Closed Tickets + 40% +
+
+
+ 40% Complete +
+
+
+
+ +
+
+
+ +
+
Low Priority
+
+
+
+ +
+
Medium Priority
+
+
+
+ +
+
High Priority
+
+
+
+
+
+
+
+
+
+ +
+
+
+
Tickets Report
+
+
+
+
+
+
January 2024
+

Tickets Report

+
+
+

17 Solved

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameStatusDateDepartment
Ticket #01Closed Jan 18Sales
Ticket #02OpenJan 19Sales
Ticket #03ClosedJan 20Sales
Ticket #04PendingJan 21Sales
Ticket #05OpenJan 22Sales
Ticket #06Open Jan 23Sales
Ticket #07PendingJan 22Sales
+
+
+
+ +
+
+
+
+
Bar Chart
+
+ +
+
+
+
+
+
+ +{% endblock content %} + + +{% block javascripts %}{% endblock javascripts %} diff --git a/apps/templates/home/newticket.html b/apps/templates/home/newticket.html new file mode 100644 index 0000000..3c10ad9 --- /dev/null +++ b/apps/templates/home/newticket.html @@ -0,0 +1,35 @@ +{% extends "layouts/base.html" %} + +{% block title %} New Ticket {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + +
+
+
+
+
+
+
Basic Form
+
+
+
+ + +
+
+
+
+
+
+
+
+ +{% endblock content %} + + +{% block javascripts %}{% endblock javascripts %} diff --git a/apps/templates/home/tickets.html b/apps/templates/home/tickets.html new file mode 100644 index 0000000..ee649fc --- /dev/null +++ b/apps/templates/home/tickets.html @@ -0,0 +1,422 @@ +{% extends "layouts/base.html" %} + +{% block title %} Tickets {% endblock title %} + + +{% block stylesheets %}{% endblock stylesheets %} + +{% block content %} + + +
+
+
+ +
+
+
+ + + +{% endblock content %} + + +{% block javascripts %} + +{% endblock javascripts %} diff --git a/apps/templates/includes/footer.html b/apps/templates/includes/footer.html index 20713d5..b567735 100644 --- a/apps/templates/includes/footer.html +++ b/apps/templates/includes/footer.html @@ -1,5 +1,5 @@
- © Designed by Colorlib - Supported By AppSeed. + © Designed by Colorlib.
\ No newline at end of file diff --git a/apps/templates/includes/navigation.html b/apps/templates/includes/navigation.html index 72f2c0f..0cfea85 100644 --- a/apps/templates/includes/navigation.html +++ b/apps/templates/includes/navigation.html @@ -181,10 +181,10 @@