Skip to content

Commit f2c19ba

Browse files
committed
Frontend cleanup
1 parent 5027334 commit f2c19ba

File tree

3 files changed

+37
-244
lines changed

3 files changed

+37
-244
lines changed

src/main/resources/static/assets/js/transactions.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var transactionsOverview = new Vue({
1717
decimalsInFloat: 2
1818
},
1919
chart: {
20-
height: 300,
20+
height: 200,
2121
type: "area",
2222
},
2323
dataLabels: {
@@ -34,7 +34,7 @@ var transactionsOverview = new Vue({
3434
pieOptions : {
3535
series: [],
3636
chart: {
37-
height: 300,
37+
height: 200,
3838
type: 'donut',
3939
options: {
4040
chart: {
@@ -67,7 +67,7 @@ var transactionsOverview = new Vue({
6767
this.areaChart.render()
6868
this.pieChart = new ApexCharts(document.querySelector("#chart"), this.pieOptions);
6969
this.pieChart.render()
70-
this.getTransactions()
70+
this.getInitialData()
7171
this.connect()
7272
},
7373
watch: {
@@ -81,7 +81,7 @@ var transactionsOverview = new Vue({
8181
this.debouncedGetAnswer = _.debounce(this.getAnswer, 100)
8282
},
8383
methods: {
84-
getTransactions: function () {
84+
getInitialData: function () {
8585
var transactionsUrl = '/api/transactions'
8686
var vm = this
8787
axios.get(transactionsUrl)
@@ -93,6 +93,34 @@ var transactionsOverview = new Vue({
9393
.catch(function (error) {
9494
console.log('Error! Could not reach the API. ' + error)
9595
})
96+
97+
axios.get("/api/balance")
98+
.then(function (response) {
99+
vm.areaChart.updateSeries([{
100+
name: 'value',
101+
data: response.data
102+
}])
103+
})
104+
.catch(function (error) {
105+
console.log('Error! Could not reach the API. ' + error)
106+
})
107+
108+
axios.get("/api/biggestspenders")
109+
.then(function (response) {
110+
111+
vm.pieOptions.series = response.data.series
112+
vm.pieOptions.labels = response.data.labels
113+
114+
console.log('pieooptons', vm.pieOptions)
115+
116+
vm.pieChart.destroy()
117+
vm.pieChart = new ApexCharts(document.querySelector("#chart"), vm.pieOptions);
118+
vm.pieChart.render()
119+
120+
})
121+
.catch(function (error) {
122+
console.log('Error! Could not reach the API. ' + error)
123+
})
96124
},
97125
connect: function () {
98126
var vm = this

src/main/resources/static/balanceovertime.html

Lines changed: 0 additions & 224 deletions
This file was deleted.

src/main/resources/static/index.html

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,7 @@
4040
<li class="sidebar-item ">
4141
<a href="index.html" class='sidebar-link'>
4242
<i class="bi bi-grid-fill"></i>
43-
<span>Transaction overview</span>
44-
</a>
45-
</li>
46-
47-
<li class="sidebar-item ">
48-
<a href="index.html" class='sidebar-link'>
49-
<i class="bi bi-bar-chart-fill"></i>
50-
<span>Investment overview</span>
43+
<span>Account overview</span>
5144
</a>
5245
</li>
5346
</ul>
@@ -93,16 +86,12 @@ <h4 class="card-title">Account holder: L.S. Rosenquist, Nieuwegein, The Netherla
9386
</div>
9487
</div>
9588
<div class="row">
96-
<div class="col-md-6 col-12">
97-
Current balance: {{ balance }}
89+
<div class="col-md-6 col-12">Current balance:
90+
<transition name="balance"><label
91+
:key="balance">{{ balance }}</label></transition>
9892
</div>
9993
</div>
10094
</div>
101-
</div>
102-
<div class="card">
103-
<div class="card-header">
104-
<h4 class="card-title">How is my money doing?</h4>
105-
</div>
10695
<div class="card-content">
10796
<div class="card-body">
10897
<div class="row">
@@ -118,7 +107,7 @@ <h4 class="card-title">How is my money doing?</h4>
118107
</div>
119108
</div>
120109
</div>
121-
110+
122111
</section>
123112
<section>
124113
<div class="card">

0 commit comments

Comments
 (0)