Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lastbranch #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
424 changes: 405 additions & 19 deletions app.py

Large diffs are not rendered by default.

Binary file added static/.DS_Store
Binary file not shown.
Binary file added static/bootstrap/.DS_Store
Binary file not shown.
137 changes: 137 additions & 0 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
<!doctype html>
<html>

<head>
<title>Dashboard</title>
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}">
</head>

<body>


<div class="card-header text-white" style="background-color:rgb(27, 27, 27);">
<div class="topnav">
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:50px; margin-right:20px; text-decoration: none; font-size: 17px;" href="/">Home</a>
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:30px; margin-right:20px; text-decoration: none; font-size: 17px;" href="mips">Mip List</a>
</div>
</div>



<div class="container py-5">
<div class="row justify-content-center">
<div class="col-lg-8">


<div class="card shadow-lg mb-4">
<div class="card-header bg-primary text-white">
<h3 class="mb-0">Engineering Dashboard</h3>
</div>
<div class="card-body">
<h1 class="display-4">Welcome, {{ engineer[1] }}!</h1>
</div>
</div>

<div class="card shadow-lg mb-4">
<a href="/edit/{{engineer[0]}}" class="btn btn-secondary btn-sm">edit</a>
<a href="/delete/{{engineer[0]}}" class="btn btn-danger btn-delete btn-sm">delete</a>
</div>



<div class="card shadow-lg">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">MIP List</h3>
</div>
<div class="card-body" style="height: 420px; overflow-y: auto;">
<ul class="list-group">
{% for mip in mips %}
<li class="list-group-item" onclick="location.href='{{ url_for('paths', mip_id=mip[0]) }}'">
{{ mip[1] }}
<div class="right">
<a href="/edit_mip/{{mip[0]}}" class="btn btn-sm text-black"
style="background-color:rgb(147, 147, 147); font-size: 15px">edit</a>
<a href="/delete_mip/{{mip[0]}}" class="btn btn-delete btn-s text-black"
style="background-color:rgb(232, 125, 125);font-size: 14px">delete</a>
<a href="/add_mip/{{mip[0]}}" class="btn btn-delete btn-s text-black"
style="background-color:rgb(129, 180, 247);font-size: 14px">add</a>
</div>
</li>
{% endfor %}
</ul>
</div>
</div>

<div class="card shadow-lg text-center" style="top:10px;">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">{{engineer[1]}}'s Learning Paths</h3>
</div>
<div class="card-body" style=" overflow-y: auto;">
<ul class="list-group">
<div class="col-md-8">
<table id="example" class="table table-striped table-bordered" style="width:150%; top:20px">
<thead>
<tr>
<td>Engineer Name</td>
<td>Learning Path Name</td>
<td>Learning Path Step Name</td>
<td>Is Complete</td>
</tr>
</thead>
<tbody>
{% for row in list_par %}
<tr>
<td>{{row[0]}}</td>
<td>{{row[1]}}</td>
<td>{{row[2]}}</td>
<td>{{row[3]}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</ul>
</div>
</div>


<div class="card shadow-lg text-center" style="top:30px;">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">{{engineer[1]}} Number of Completed Paths</h3>
</div>
<div class="card-body" style=" overflow-y: auto;">
<ul class="list-group">
<div class="col-md-8">
<table id="example" class="table table-striped table-bordered" style="width:150%;top:20px">
<thead>
<tr>
<td>Learning Path Name</td>
<td>Number of uncompleted LP</td>
<td>Number of completed LP</td>
<td>Path Completion</td>
</tr>
</thead>
<tbody>
{% for row in list_complete %}
<tr>
<td>{{row[0]}}</td>
<td>{{row[1]}}</td>
<td>{{row[2]}}</td>
<td>{{row[3]}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</ul>
</div>
</div>

</div>
</div>
</div>
</body>

</html>
32 changes: 32 additions & 0 deletions templates/edit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="card-header text-white" style="background-color:rgb(27, 27, 27);">
<div class="topnav">
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:50px; margin-right:20px; text-decoration: none; font-size: 17px;" href="/">Home</a>
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:30px; margin-right:20px; text-decoration: none; font-size: 17px;" href="mips">Mip List</a>
</div>
</div>


{% extends "layout.html" %}
{% block body %}
<div class="row">
<div class="col-md-4 offset-md-4">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">Update {{ engineer[1] }}</h3>
</div>
<div class="card card-body">
<form action="/update/{{engineer[0]}}" method="POST">
<div class="form-group">
<input type="text" name="engineer_name" value="{{engineer[1]}}" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">
Update
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
51 changes: 51 additions & 0 deletions templates/editMIP.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<div class="card-header text-white" style="background-color:rgb(27, 27, 27);">
<div class="topnav">
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:50px; margin-right:20px; text-decoration: none; font-size: 17px;" href="/">Home</a>
<a class="form-label fw-bold text-white" width="100" height="100"
style="margin-left:30px; margin-right:20px; text-decoration: none; font-size: 17px;" href="mips">Mip List</a>
</div>
</div>

{% extends "layout.html" %}
{% block body %}
<div class="row justify-content-center">
<div class="col-md-4" style="width:1000px">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">Update Mip {{ mip[0] }}</h3>
</div>
<div class="card card-body">
<form action="/update_mip/{{mip[0]}}" method="POST">
<div class="form-group">
<input type="text" name="mip_name" value="{{mip[1]}}" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">
Update
</button>
</div>
</form>
</div>
</div>
</div>

<div class="row justify-content-center">
<div class="col-md-4" style="top:100px; width:3000px;">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0"> Add Learningpath to MIP {{mip[0]}}</h3>
</div>
<div class="card card-body">
<form action="/save_lp/{{mip[0]}}" method="POST">
<div class="form-group">
<input type="text" name="name" value="{{learningpath[1]}}" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">
Add
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
33 changes: 33 additions & 0 deletions templates/editlp.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

<div class="card-header text-white" style="background-color:rgb(27, 27, 27);">
<div class="topnav">
<a class="form-label fw-bold text-white" width="100" height="100"
style ="margin-left:50px; margin-right:20px; text-decoration: none; font-size: 17px;" href="/">Home</a>
<a class="form-label fw-bold text-white" width="100" height="100"
style ="margin-left:30px; margin-right:20px; text-decoration: none; font-size: 17px;" href="mips">Mip List</a>
</div>
</div>


{% extends "layout.html" %}
{% block body %}
<div class="row">
<div class="col-md-4 offset-md-4">
<div class="card-header bg-secondary text-white">
<h3 class="mb-0">Update Learningpath {{ learningpath[0] }}</h3>
</div>
<div class="card card-body">
<form action="/update_lp/{{learningpath[0]}}" method="POST">
<div class="form-group">
<input type="text" name="name" value="{{learningpath[2]}}" class="form-control">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block">
Update
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
21 changes: 0 additions & 21 deletions templates/hello.html

This file was deleted.

30 changes: 0 additions & 30 deletions templates/index.html

This file was deleted.

48 changes: 48 additions & 0 deletions templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title></title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"
id="bootstrap-css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>
</head>

<body>

<div class="container pt-4">
{% block body %}
{% endblock %}
</div>

<script>
const btnDelete = document.querySelectorAll('.btn-delete');
if (btnDelete) {
const btnArray = Array.from(btnDelete);
btnArray.forEach((btn) => {
btn.addEventListener('click', (e) => {
if (!confirm('Are you sure you want to delete it?')) {
e.preventDefault();
}
});
})
}

$(document).ready(function () {
$('#example').DataTable({
"aLengthMenu": [[3, 5, 10, 25, -1], [3, 5, 10, 25, "All"]],
"iDisplayLength": 3
}
);
});

</script>
</body>

</html>
Loading