-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add; django view bills for monthly bills and crypto investments
(initial version)
- Loading branch information
Showing
6 changed files
with
126 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title> {{ title }} </title> | ||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width, user-scalable=no"> | ||
<link rel="icon" type="image/x-icon" href="{% static 'imgs/favicon.ico' %}"> | ||
<link rel="stylesheet" type="text/css" rel="noopener" target="_blank" | ||
href="../../../node_modules/bootstrap/dist/css/bootstrap.css"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> | ||
<link rel="stylesheet" type="text/css" rel="noopener" target="_blank" href="{% static 'css/styles.css' %}"> | ||
</head> | ||
|
||
<body> | ||
<body style="overflow-x: hidden; /* Prevent horizontal scrolling */"> | ||
{% include "_navbar.html" %} | ||
|
||
{% block content %} | ||
{% endblock %} | ||
</body> | ||
<script src="https://cdn.canvasjs.com/canvasjs.min.js"> </script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,31 +3,94 @@ | |
{% block title %} My Bills {% endblock %} | ||
|
||
{% block content %} | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Description</th> | ||
<th scope="col">value</th> | ||
|
||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for bill in bills %} | ||
<tr scope="row"> | ||
<th scope="row">{{ bill.id }}</th> | ||
<td> {{ bill.description }} </td> | ||
<td> ${{ bill.value }} </td> | ||
<script> | ||
window.onload = function () { | ||
var chart = new CanvasJS.Chart("monthlybillchart", { | ||
exportEnabled: false, | ||
animationEnabled: true, | ||
theme: "dark2", | ||
title: { | ||
text: "Monthly Bills", | ||
dockInsidePlotArea: true, | ||
verticalAlign: "center", | ||
height: 350, | ||
fontSize: 22 | ||
}, | ||
subtitles: [{ | ||
text: "" | ||
}], | ||
data: [{ | ||
type: "doughnut", | ||
startAngle: -90, | ||
indexLabel: "{name} ({y})", | ||
yValueFormatString: "#,##0.0#\"%\"", | ||
dataPoints: {{ bills_pie_values| safe }} | ||
}] | ||
}); | ||
chart.render(); | ||
} | ||
</script> | ||
<div class="container"> | ||
<div class="row" style="margin-top: 10px;"> | ||
<div class="col-sm-8"> | ||
<table class="table table-striped monthly-bills"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">Description</th> | ||
<th scope="col">Value</th> | ||
<th scope="col">Due Day</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for bill in bills %} | ||
<tr scope="row"> | ||
<th scope="row">{{ bill.id }}</th> | ||
<td> {{ bill.description }} </td> | ||
<td> {{ bill.currency.symbol }} {{ bill.value }} </td> | ||
<td> {{ bill.due_day }} </td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
<div class="col-sm-4"> | ||
<div id="monthlybillchart" style="width:100%; height: 350px;"></div> | ||
</div> | ||
</div> | ||
|
||
<div class="row" style="margin-top: 10px;"> | ||
<div class="col-sm-8"> | ||
<table class="table table-striped crypto-investments"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Coin</th> | ||
<th scope="col">Amount</th> | ||
<th scope="col">GBP</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for key, value in coins.items %} | ||
<tr scope="row"> | ||
<th scope="row">{{ key }}</th> | ||
<td> {{ value.balance }} </td> | ||
<td> {{ value.gbp }} </td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
<div class="shadow p-3 mb-5 bg-body-tertiary rounded bg-dark"> | ||
Total: ${{ total }} | ||
<div class="col-sm-4"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<footer class="bills-footer"> | ||
<p><a>Total Monthly Payments: £ {{ total }} </a></p> | ||
<p><a>Cryptos: £ {{ coin_balance_gbp }} </a></p> | ||
</footer> | ||
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" | ||
crossorigin="anonymous"></script> | ||
{% endblock %} |