Update meta files.

This commit is contained in:
James Cole
2020-06-22 18:03:57 +02:00
parent 1a043e35c2
commit bcb9794315
25 changed files with 507 additions and 414 deletions

View File

@@ -26,11 +26,7 @@
<main-account />
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<main-account-list/>
</div>
</div>
<main-account-list/>
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">

View File

@@ -40,7 +40,6 @@
this.chartData = DataConverter.methods.convertChart(response.data);
this.chartData = DataConverter.methods.colorizeData(this.chartData);
this.chartData = DataConverter.methods.convertLabelsToDate(this.chartData);
console.log(this.chartData);
this.loaded = true
});
},

View File

@@ -1,19 +1,69 @@
<template>
<div class="card">
<div class="card-header">
<h3 class="card-title">I am a card</h3>
</div>
<div class="card-body">
<p>
I am card body
</p>
<div class="row">
<div v-bind:class="{ 'col-lg-12': 1 === accounts.length, 'col-lg-6': 2 === accounts.length, 'col-lg-4': accounts.length > 2 }"
v-for="account in accounts">
<div class="card">
<div class="card-header">
<h3 class="card-title"><a :href="account.uri">{{ account.title }}</a></h3>
</div>
<div class="card-body table-responsive p-0">
<transaction-list-large :transactions="account.transactions" v-if="1===accounts.length" />
<transaction-list-medium :transactions="account.transactions" v-if="2===accounts.length" />
<transaction-list-small :transactions="account.transactions" v-if="accounts.length > 2" />
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "MainAccountList"
name: "MainAccountList",
data() {
return {
accounts: [],
}
},
mounted() {
axios.get('./api/v1/preferences/frontpageAccounts')
.then(response => {
this.loadAccounts(response);
}
);
},
methods:
{
loadAccounts(response) {
let accountIds = response.data.data.attributes.data;
for (let key in accountIds) {
if (accountIds.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
this.accounts.push({
id: accountIds[key],
title: '',
uri: '',
transactions: []
});
this.loadSingleAccount(key, accountIds[key]);
}
}
},
loadSingleAccount(key, accountId) {
axios.get('./api/v1/accounts/' + accountId)
.then(response => {
this.accounts[key].title = response.data.data.attributes.name;
this.accounts[key].uri = './accounts/show/' + response.data.data.id;
this.loadTransactions(key, accountId);
}
);
},
loadTransactions(key, accountId) {
axios.get('./api/v1/accounts/' + accountId + '/transactions?page=1&limit=10')
.then(response => {
this.accounts[key].transactions = response.data.data;
}
);
},
}
}
</script>

View File

@@ -0,0 +1,15 @@
<template>
<div>
Hello
</div>
</template>
<script>
export default {
name: "SingleTransactionRow"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "SmallTransactionList"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "TransactionListLarge"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,13 @@
<template>
</template>
<script>
export default {
name: "TransactionListMedium"
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,40 @@
<template>
<table class="table table-striped">
<tr v-for="transaction in transactions">
<td>
<a href="#">
<span v-if="transaction.attributes.transactions.length > 1">{{ transaction.attributes.group_title }}</span>
<span v-if="1===transaction.attributes.transactions.length">{{ transaction.attributes.transactions[0].description }}</span>
</a>
</td>
<td style="text-align:right;">
<span v-for="tr in transaction.attributes.transactions">
<span v-if="'withdrawal' === tr.type" class="text-danger">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount * -1)}}<br>
</span>
<span v-if="'deposit' === tr.type" class="text-success">
{{ Intl.NumberFormat('en-US', {style: 'currency', currency: tr.currency_code}).format(tr.amount)}}<br>
</span>
</span>
</td>
</tr>
</table>
</template>
<script>
export default {
name: "TransactionListSmall",
props: {
transactions: {
type: Array,
default: function () {
return [];
}
},
}
}
</script>
<style scoped>
</style>