Skip to content
Snippets Groups Projects
Commit 6bb2a19c authored by a272-jones's avatar a272-jones
Browse files

Forgot to push billings view...

parent 417ebf5e
No related branches found
No related tags found
No related merge requests found
......@@ -96,11 +96,17 @@ def updateUsers(request, id):
return render(request, 'modelForms/updateUsers.html', context)
def interactionView(request):
interactions = Record.objects.all().values()
interactions = Record.objects.all()
context = {}
context = {'interactions': interactions}
return render(request, 'modelForms/interactionView.html', context)
def billingsView(request):
billings = Billing.objects.all()
context = {}
context = {'billings': billings}
return render(request, 'modelForms/billingsView.html', context)
##### DELETION SECTIONS
def deleteRecord(request, id):
......@@ -112,6 +118,13 @@ def deleteRecord(request, id):
context = {'record': record}
return render(request, 'modelForms/deleteRecord.html', context)
def deleteBillings(request, billingID):
record = Billing.objects.get(billingID=billingID)
if request.method == 'POST':
record.delete()
return redirect('billingsView')
context = {'record': record}
return render(request, 'modelForms/deleteBillings.html', context)
def deleteUsers(request, id):
user = Profile.objects.get(user_id=id)
......
......@@ -40,6 +40,9 @@ services:
image: mlservice
command: >
sh -c 'python main.py'
depends_on:
db:
condition: service_healthy
volumes:
......
......@@ -43,5 +43,7 @@ urlpatterns = [
path('modelForms/deleteUsers/<str:id>/', views.deleteUsers, name="deleteUsers"),
path('modelForms/deleteRecord/<str:id>/', views.deleteRecord, name="deleteRecord"),
path('modelForms/interactionView/', views.interactionView, name="interactionView"),
path('modelForms/billingsView/', views.billingsView, name="billingsView"),
path('modelForms/deleteBillings/<str:billingID>', views.deleteBillings, name="deleteBillings"),
]
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Billings View</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
min-height: 100vh;
margin: 0;
}
.container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
width: 60%;
max-width: 600px;
text-align: center;
}
a {
text-decoration: none;
color: #333;
font-weight: bold;
}
a:hover {
color: #555;
}
.record {
background: #fff;
padding: 15px;
margin: 15px 0;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
text-align: left;
}
.record p {
margin: 5px 0;
}
.delete-btn {
display: inline-block;
margin-top: 10px;
padding: 8px 12px;
background: #ff4d4d;
color: white;
border-radius: 5px;
text-decoration: none;
font-weight: bold;
}
.delete-btn:hover {
background: #cc0000;
}
hr {
border: 0;
height: 1px;
background: #ccc;
margin: 15px 0;
}
</style>
</head>
<body>
<div class="container">
<p><a href="{% url 'profile' %}">Return to Profile</a></p>
{% for record in billings %}
<div class="record">
<p><strong>Billing ID:</strong> {{ record.billingID }}</p>
<p><strong>Amount: </strong>£{{ record.amount }}</p>
<p><strong>Generated By: </strong>{{ record.username }}</p>
<p><strong>Company Billed: </strong>{{ record.companyName }}</p>
<a href="{% url 'deleteBillings' record.billingID %}" class="delete-btn">Delete Billing</a>
</div>
<hr>
{% endfor %}
</div>
<!-- Display all billings made by specific Finance team member. -->
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
text-align: center;
width: 300px;
}
p {
font-size: 16px;
margin-bottom: 20px;
}
a {
text-decoration: none;
color: #333;
font-weight: bold;
margin-right: 15px;
}
a:hover {
text-decoration: underline;
}
input[type="submit"] {
background: #333;
color: white;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
}
input[type="submit"]:hover {
background: #555;
}
</style>
</head>
<body>
<div class="container">
<p>Are you sure you want to delete this billing?</p>
<form action="{% url 'deleteBillings' record.billingID %}" method="POST">
{% csrf_token %}
<a href="{% url 'billingsView' %}">Go Back</a>
<input type="submit" name="confirm" value="Delete">
</form>
</div>
</body>
</html>
\ No newline at end of file
......@@ -172,14 +172,21 @@
<h2>Finance Dashboard</h2>
<p>View financial reports and tools.</p>
<hr>
<h1><a href="{% url 'genBillings' %}">Generate Billings</a></h1>
<h1>Generate Billings</h1>
<h2><a href="{% url 'genBillings' %}">Generate</a></h2>
<hr>
<h1>View Billings</h1>
<h2><a href="{% url 'billingsView' %}">View</a></h2>
{% elif user.profile.role == 'admin' %} <!-- Admin Dashboard -->
{% elif user.profile.role == 'admin' %}
<!-- Admin Dashboard -->
<h2>Admin Page</h2>
<p>View all Activity</p>
<p><a href="{% url 'manageUsers' %}">Manage Users</a></p>
<p><a href=""> View all Activity </a></p>
<h1>Manage users page</h1>
<h2><a href="{% url 'manageUsers' %}">Manage Users</a></h2>
<hr>
<h1>View all activity</h1>
<h2><a href=""> Activity </a></h2>
{% else %}
<!-- User Dashboard -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment