Emmanuel Frimpong Asante commited on
Commit
f5b335c
·
1 Parent(s): a4fb48e

update space base

Browse files
Files changed (3) hide show
  1. app.py +8 -4
  2. templates/base.html +64 -6
  3. templates/home.html +0 -0
app.py CHANGED
@@ -1,10 +1,14 @@
1
- from fastapi import FastAPI
 
 
2
  from routes.authentication import auth_router
3
 
4
  app = FastAPI()
 
5
 
6
  app.include_router(auth_router, prefix="/auth", tags=["Authentication"])
7
 
8
- @app.get("/")
9
- def greet_json():
10
- return {"Hello": "World!"}
 
 
1
+ from fastapi import FastAPI, Request
2
+ from fastapi.templating import Jinja2Templates
3
+ from fastapi.responses import HTMLResponse
4
  from routes.authentication import auth_router
5
 
6
  app = FastAPI()
7
+ templates = Jinja2Templates(directory="templates")
8
 
9
  app.include_router(auth_router, prefix="/auth", tags=["Authentication"])
10
 
11
+ @app.get("/", response_class=HTMLResponse)
12
+ async def home(request: Request):
13
+ return templates.TemplateResponse("home.html", {"request": request, "title": "Dashboard"})
14
+
templates/base.html CHANGED
@@ -3,15 +3,73 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>{{ title }}</title>
7
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/css/adminlte.min.css">
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
  </head>
10
- <body class="hold-transition login-page">
11
- <div class="wrapper">
12
- {% block content %}{% endblock %}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  </div>
14
- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
15
- <script src="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/js/adminlte.min.js"></script>
 
 
 
 
 
 
 
 
16
  </body>
17
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{ title | default("Poultry Management System") }}</title>
7
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/css/adminlte.min.css">
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
9
  </head>
10
+ <body class="hold-transition sidebar-mini layout-fixed">
11
+ <div class="wrapper">
12
+ <!-- Navbar -->
13
+ <nav class="main-header navbar navbar-expand navbar-white navbar-light">
14
+ <ul class="navbar-nav ml-auto">
15
+ <li class="nav-item">
16
+ <a class="nav-link" href="/auth/logout">Logout</a>
17
+ </li>
18
+ </ul>
19
+ </nav>
20
+ <!-- Sidebar -->
21
+ <aside class="main-sidebar sidebar-dark-primary elevation-4">
22
+ <a href="/" class="brand-link">
23
+ <span class="brand-text font-weight-light">Poultry Management</span>
24
+ </a>
25
+ <div class="sidebar">
26
+ <nav class="mt-2">
27
+ <ul class="nav nav-pills nav-sidebar flex-column" role="menu">
28
+ <li class="nav-item">
29
+ <a href="/" class="nav-link">
30
+ <i class="nav-icon fas fa-home"></i>
31
+ <p>Home</p>
32
+ </a>
33
+ </li>
34
+ <li class="nav-item">
35
+ <a href="/inventory" class="nav-link">
36
+ <i class="nav-icon fas fa-boxes"></i>
37
+ <p>Inventory</p>
38
+ </a>
39
+ </li>
40
+ <li class="nav-item">
41
+ <a href="/health" class="nav-link">
42
+ <i class="nav-icon fas fa-heartbeat"></i>
43
+ <p>Health</p>
44
+ </a>
45
+ </li>
46
+ <li class="nav-item">
47
+ <a href="/todo" class="nav-link">
48
+ <i class="nav-icon fas fa-tasks"></i>
49
+ <p>To-Do List</p>
50
+ </a>
51
+ </li>
52
+ </ul>
53
+ </nav>
54
+ </div>
55
+ </aside>
56
+ <!-- Content Wrapper -->
57
+ <div class="content-wrapper">
58
+ <section class="content">
59
+ <div class="container-fluid">
60
+ {% block content %}{% endblock %}
61
+ </div>
62
+ </section>
63
  </div>
64
+ <!-- Footer -->
65
+ <footer class="main-footer">
66
+ <div class="float-right d-none d-sm-inline">
67
+ Poultry Management System
68
+ </div>
69
+ <strong>&copy; 2024</strong> All rights reserved.
70
+ </footer>
71
+ </div>
72
+ <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
73
+ <script src="https://cdn.jsdelivr.net/npm/admin-lte@3.1/dist/js/adminlte.min.js"></script>
74
  </body>
75
  </html>
templates/home.html ADDED
File without changes