Skip to content

Commit c60dc53

Browse files
committed
Update in Dashboard.
Update in Admin Dashboard with charts and Logs.
1 parent ec3ecdd commit c60dc53

File tree

12 files changed

+696
-292
lines changed

12 files changed

+696
-292
lines changed

db.sqlite3

0 Bytes
Binary file not shown.
248 Bytes
Binary file not shown.

firstapp/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
from django.contrib.auth.models import User
44
from django.contrib.auth.decorators import login_required
55
from firstapp.models import Theme
6+
from django.contrib.admin.models import LogEntry
67
# Create your views here.
78
@login_required
89
def home(request):
910
theme = theme_custom(request)
10-
return render(request, 'home.html', {'color':theme})
11+
logs = LogEntry.objects.filter(user_id=request.user.id)
12+
return render(request, 'home.html', {'color':theme,'log':logs,})
1113

1214
from .forms import SignUpForm, User_edit, profile_edit
1315
def signup_view(request):
@@ -59,7 +61,7 @@ def profile_update(request):
5961
}
6062
return render(request, 'profile/edit_profile.html', context)
6163

62-
# disable view for details
64+
6365
from django.contrib.auth import logout
6466
@login_required
6567
def disable_user(request, id):
@@ -82,15 +84,13 @@ def theme_custom(request):
8284
color = Theme.objects.get(user=request.user).color
8385
else:
8486
color = 'light'
85-
8687
return color
8788

8889
from django.urls import resolve
8990
from django.http import HttpResponseRedirect
9091
def theme(request):
9192
color = request.GET.get('color')
9293
current_url = resolve(request.path_info).url_name
93-
# previous_url = self.request.META.get('HTTP_REFERER')
9494
if color == 'dark':
9595
if Theme.objects.filter(user=request.user).exists():
9696
user_theme = Theme.objects.get(user=request.user)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ sqlparse==0.4.2
1919
tablib==3.3.0
2020
tzdata==2022.1
2121
xlrd==2.0.1
22-
xlwt==1.3.0
22+
xlwt==1.3.0

static/dashboard/style.css

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.order-card {
2+
color: #fff;
3+
}
4+
5+
.bg-c-blue {
6+
background: linear-gradient(45deg, #4099ff, #73b4ff);
7+
}
8+
9+
.bg-c-green {
10+
background: linear-gradient(45deg, #2ed8b6, #59e0c5);
11+
}
12+
13+
.bg-c-yellow {
14+
background: linear-gradient(45deg, #ffb64d, #ffcb80);
15+
}
16+
17+
.bg-c-pink {
18+
background: linear-gradient(45deg, #ff5370, #ff869a);
19+
}
20+
21+
.card {
22+
border-radius: 5px;
23+
-webkit-box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
24+
box-shadow: 0 1px 2.94px 0.06px rgba(4, 26, 55, 0.16);
25+
border: none;
26+
margin-bottom: 30px;
27+
-webkit-transition: all 0.3s ease-in-out;
28+
transition: all 0.3s ease-in-out;
29+
}
30+
31+
.card .card-block {
32+
padding: 25px;
33+
}
34+
35+
.order-card i {
36+
font-size: 26px;
37+
}
38+
39+
.f-left {
40+
float: left;
41+
}
42+
43+
.f-right {
44+
float: right;
45+
}
46+
47+
.timeline-with-icons {
48+
border-left: 1px solid hsl(0, 0%, 90%);
49+
position: relative;
50+
list-style: none;
51+
}
52+
53+
.timeline-with-icons .timeline-item {
54+
position: relative;
55+
}
56+
57+
.timeline-with-icons .timeline-item:after {
58+
position: absolute;
59+
display: block;
60+
top: 0;
61+
}
62+
63+
.timeline-with-icons .timeline-icon {
64+
position: absolute;
65+
left: -48px;
66+
background-color: hsl(217, 88.2%, 90%);
67+
color: hsl(217, 88.8%, 35.1%);
68+
border-radius: 50%;
69+
height: 31px;
70+
width: 31px;
71+
display: flex;
72+
align-items: center;
73+
justify-content: center;
74+
}
75+

static/dashboard/style.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const BarGraph = document.getElementById("BarGraphChart");
2+
new Chart(BarGraph, {
3+
type: "bar",
4+
data: {
5+
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
6+
datasets: [
7+
{
8+
label: "# of Votes",
9+
data: [12, 19, 3, 5, 2, 3],
10+
borderWidth: 1
11+
}
12+
]
13+
},
14+
options: {
15+
scales: {
16+
y: {
17+
beginAtZero: true
18+
}
19+
}
20+
}
21+
});
22+
23+
const LineGraph = document.getElementById("LineGraphChart");
24+
new Chart(LineGraph, {
25+
type: "line",
26+
data: {
27+
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
28+
datasets: [{
29+
label: 'Loss',
30+
data: [50, 40, 39, 60, 75, 66, 48, 50, 60, 53, 36, 25],
31+
fill: false,
32+
borderColor: 'rgb(255, 0, 0)'
33+
},
34+
{
35+
label: 'Gain',
36+
data: [15, 35, 49, 68, 80, 75, 77, 60, 52, 42, 59, 75],
37+
fill: false,
38+
borderColor: 'rgb(72, 255, 0)'
39+
}
40+
]
41+
},
42+
options: {
43+
plugins: {
44+
title: {
45+
display: true,
46+
text: 'Gain & Loss of (2023)'
47+
}
48+
},
49+
scales: {
50+
y: {
51+
beginAtZero: true
52+
},
53+
54+
},
55+
}
56+
});
57+
58+
59+
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
60+
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
61+
62+
function preview() {
63+
frame.src = URL.createObjectURL(event.target.files[0]);
64+
}
65+
66+
function clearImage() {
67+
document.getElementById('formFile').value = null;
68+
frame.src = "";
69+
}
70+

0 commit comments

Comments
 (0)