|
1 | 1 | {% extends "base.html" %}
|
2 | 2 |
|
3 | 3 |
|
| 4 | +{% block javascript %} |
| 5 | + |
| 6 | +<script> |
| 7 | +var ctx = document.getElementById("myChart").getContext('2d'); |
| 8 | +var myChart = new Chart(ctx, { |
| 9 | + type: 'line', |
| 10 | + data: { |
| 11 | + labels: ["Monday", "Tues", "Wed", "Thurs", "Friday", "Sat", "Sun"], |
| 12 | + datasets: [{ |
| 13 | + label: 'Sales Per Day', |
| 14 | + data: [12, 19, 3, 5, 2, 3, 49], |
| 15 | + backgroundColor: 'rgba(0, 158, 29, 0.45)', |
| 16 | + borderColor:'rgba(0, 158, 29, 1)', |
| 17 | + }] |
| 18 | + }, |
| 19 | + options: { |
| 20 | + scales: { |
| 21 | + yAxes: [{ |
| 22 | + ticks: { |
| 23 | + beginAtZero:true |
| 24 | + } |
| 25 | + }] |
| 26 | + }, |
| 27 | + backgroundColor: 'rgba(75, 192, 192, 1)' |
| 28 | + } |
| 29 | +}); |
| 30 | +</script> |
| 31 | +{% endblock %} |
| 32 | + |
| 33 | + |
| 34 | + |
4 | 35 | {% block content %}
|
5 | 36 |
|
6 | 37 |
|
7 |
| -<div class='row'> |
| 38 | +<div class='row my-5'> |
8 | 39 | <div class='col-12'>
|
9 | 40 | <h1>Sales Data</h1>
|
10 | 41 | </div>
|
11 | 42 | </div>
|
12 | 43 |
|
13 |
| -<div class='row'> |
14 |
| - <div class='col-12'> |
15 |
| - <h1>Today's sales</h1> |
16 |
| - </div> |
17 |
| - <div class='col'> |
| 44 | +<hr/> |
| 45 | + |
| 46 | +<div class='row my-5'> |
| 47 | + <div class='col-4'> |
| 48 | + <h3>Today's sales</h3> |
| 49 | + <hr/> |
18 | 50 | <p>Recent Total: ${{ today.recent_data.total__sum }}</p>
|
19 | 51 | <ol>
|
20 |
| - {% for order in today.recent %} |
| 52 | + {% for order in today.recent|slice:":5" %} |
21 | 53 | <li>{{ order.order_id }}
|
22 | 54 | {{ order.total }}
|
23 | 55 | {{ order.updated }}</li>
|
24 | 56 | {% endfor %}
|
25 | 57 | </ol>
|
26 |
| - </div> |
27 |
| - <div class='col'> |
28 |
| - <p>Shipped Total: ${{ today.shipped_data.total__sum }}</p> |
29 |
| - <ol> |
30 |
| - {% for order in today.shipped %} |
31 |
| - <li>{{ order.order_id }} |
32 |
| - {{ order.total }} |
33 |
| - {{ order.updated }} </li> |
34 |
| - {% endfor %} |
35 |
| - </ol> |
36 |
| - </div> |
37 |
| - <div class='col'> |
38 |
| - <p>Paid Totals: ${{ today.paid_data.total__sum }}</p> |
39 |
| - <ol> |
40 |
| - {% for order in today.paid %} |
41 |
| - <li>{{ order.order_id }} |
42 |
| - {{ order.total }} |
43 |
| - {{ order.updated }} </li> |
44 |
| - {% endfor %} |
45 |
| - </ol> |
46 |
| - </div> |
47 |
| -</div> |
48 |
| - |
49 |
| - |
50 |
| - |
51 |
| -<div class='row'> |
52 |
| - <div class='col-12'> |
53 |
| - <h1>This week's sales</h1> |
54 |
| - </div> |
55 |
| - <div class='col'> |
| 58 | + |
| 59 | + <h3>This week's sales</h3> |
| 60 | + <hr/> |
56 | 61 | <p>Recent Total: ${{ this_week.recent_data.total__sum }}</p>
|
57 | 62 | <ol>
|
58 |
| - {% for order in this_week.recent %} |
| 63 | + {% for order in this_week.recent|slice:":5" %} |
59 | 64 | <li>{{ order.order_id }}
|
60 | 65 | {{ order.total }}
|
61 | 66 | {{ order.updated }}</li>
|
62 | 67 | {% endfor %}
|
63 | 68 | </ol>
|
64 | 69 | </div>
|
| 70 | + |
65 | 71 | <div class='col'>
|
66 |
| - <p>Shipped Total: ${{ this_week.shipped_data.total__sum }}</p> |
67 |
| - <ol> |
68 |
| - {% for order in this_week.shipped %} |
69 |
| - <li>{{ order.order_id }} |
70 |
| - {{ order.total }} |
71 |
| - {{ order.updated }} </li> |
72 |
| - {% endfor %} |
73 |
| - </ol> |
74 |
| - </div> |
75 |
| - <div class='col'> |
76 |
| - <p>Paid Totals: ${{ this_week.paid_data.total__sum }}</p> |
77 |
| - <ol> |
78 |
| - {% for order in this_week.paid %} |
79 |
| - <li>{{ order.order_id }} |
80 |
| - {{ order.total }} |
81 |
| - {{ order.updated }} </li> |
82 |
| - {% endfor %} |
83 |
| - </ol> |
| 72 | + <canvas id="myChart" width="400" height="400"></canvas> |
84 | 73 | </div>
|
85 | 74 | </div>
|
86 | 75 |
|
87 | 76 |
|
88 | 77 |
|
89 |
| -<div class='row'> |
| 78 | +<hr/> |
| 79 | + |
| 80 | +<div class='row my-5'> |
90 | 81 | <div class='col-12'>
|
91 | 82 | <h1>Previous 4 weeks</h1>
|
92 | 83 | </div>
|
|
0 commit comments