Fix lint errors/warnings
Signed-off-by: William Brawner <me@wbrawner.com>
This commit is contained in:
parent
9893263523
commit
1da4bd2638
7 changed files with 79 additions and 32 deletions
|
@ -7,8 +7,14 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'ProgressBar',
|
name: 'ProgressBar',
|
||||||
props: {
|
props: {
|
||||||
value: Number,
|
value: {
|
||||||
max: Number,
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
|
max: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
},
|
||||||
invertColors: Boolean,
|
invertColors: Boolean,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -39,7 +39,10 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
budget: {},
|
budget: {
|
||||||
|
default: {},
|
||||||
|
type: () => {},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -56,8 +59,8 @@ export default {
|
||||||
this.user = undefined
|
this.user = undefined
|
||||||
this.budget.users = this.budget.users.filter(u => u.user !== user)
|
this.budget.users = this.budget.users.filter(u => u.user !== user)
|
||||||
this.budget.users.push({
|
this.budget.users.push({
|
||||||
'user': user,
|
user: user,
|
||||||
'permission': 2,
|
permission: 2,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveBudget() {
|
saveBudget() {
|
||||||
|
|
|
@ -45,7 +45,10 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
category: Object,
|
category: {
|
||||||
|
default: () => {},
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -4,8 +4,17 @@
|
||||||
<a class="category-summary" @click="view(category.id)">
|
<a class="category-summary" @click="view(category.id)">
|
||||||
<div class="category-info">
|
<div class="category-info">
|
||||||
<p class="category-name">{{ category.name }}</p>
|
<p class="category-name">{{ category.name }}</p>
|
||||||
<p
|
<p class="category-balance">
|
||||||
class="category-balance">{{ category.expense ? 'Remaining' : 'Pending' }}: {{ (categoryRemainingBalance(category) / 100).toLocaleString(undefined, {style: 'currency', currency: 'USD'}) }}</p>
|
{{ category.expense ? "Remaining" : "Pending" }}:
|
||||||
|
{{
|
||||||
|
(
|
||||||
|
categoryRemainingBalance(category) / 100
|
||||||
|
).toLocaleString(undefined, {
|
||||||
|
style: "currency",
|
||||||
|
currency: "USD"
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
:max="category.amount"
|
:max="category.amount"
|
||||||
|
@ -25,8 +34,14 @@ export default {
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
budgetId: Number,
|
budgetId: {
|
||||||
expense: Boolean,
|
default: 0,
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
expense: {
|
||||||
|
default: true,
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['categories', 'currentCategory']),
|
...mapState(['categories', 'currentCategory']),
|
||||||
|
@ -67,5 +82,4 @@ export default {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-bottom: 0.5em;
|
padding-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,24 +1,31 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="!loading" class="add-edit-transaction">
|
<div v-if="!loading" class="add-edit-transaction">
|
||||||
<h2>{{ transaction.id ? 'Edit' : 'Add' }} Transaction</h2>
|
<h2>{{ transaction.id ? "Edit" : "Add" }} Transaction</h2>
|
||||||
<input v-model="transaction.name"
|
<input
|
||||||
|
v-model="transaction.name"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
title="Name">
|
title="Name">
|
||||||
<textarea v-model="transaction.description" placeholder="Description" title="Description" />
|
<textarea
|
||||||
<input v-model.number="transaction.amount"
|
v-model="transaction.description"
|
||||||
|
placeholder="Description"
|
||||||
|
title="Description" />
|
||||||
|
<input
|
||||||
|
v-model.number="transaction.amount"
|
||||||
type="number"
|
type="number"
|
||||||
placeholder="Amount"
|
placeholder="Amount"
|
||||||
title="Amount">
|
title="Amount">
|
||||||
<DatetimePicker :value="transaction.date" type="datetime" />
|
<DatetimePicker :value="transaction.date" type="datetime" />
|
||||||
<div class="radio-container">
|
<div class="radio-container">
|
||||||
<input id="expense"
|
<input
|
||||||
|
id="expense"
|
||||||
v-model="transaction.expense"
|
v-model="transaction.expense"
|
||||||
type="radio"
|
type="radio"
|
||||||
:value="true">
|
:value="true">
|
||||||
<label for="expense">Expense</label>
|
<label for="expense">Expense</label>
|
||||||
<input id="income"
|
<input
|
||||||
|
id="income"
|
||||||
v-model="transaction.expense"
|
v-model="transaction.expense"
|
||||||
type="radio"
|
type="radio"
|
||||||
:value="false">
|
:value="false">
|
||||||
|
@ -29,7 +36,9 @@
|
||||||
Select a budget
|
Select a budget
|
||||||
</option>
|
</option>
|
||||||
<option v-for="budget in budgets" :key="budget.id" :value="budget.id">
|
<option v-for="budget in budgets" :key="budget.id" :value="budget.id">
|
||||||
{{ budget.name }}
|
{{
|
||||||
|
budget.name
|
||||||
|
}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<select v-model="transaction.categoryId">
|
<select v-model="transaction.categoryId">
|
||||||
|
@ -60,7 +69,10 @@ export default {
|
||||||
DatetimePicker,
|
DatetimePicker,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
transaction: {},
|
transaction: {
|
||||||
|
default: () => {},
|
||||||
|
type: Object,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -96,19 +108,19 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.add-edit-transaction > * {
|
.add-edit-transaction > * {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
.radio-container {
|
.radio-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-container label {
|
.radio-container label {
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
}
|
}
|
||||||
.icon-loading {
|
.icon-loading {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -20,9 +20,18 @@ export default {
|
||||||
name: 'TransactionList',
|
name: 'TransactionList',
|
||||||
components: {},
|
components: {},
|
||||||
props: {
|
props: {
|
||||||
budgetId: 0,
|
budgetId: {
|
||||||
categoryId: 0,
|
default: 0,
|
||||||
limit: 0,
|
type: Number,
|
||||||
|
},
|
||||||
|
categoryId: {
|
||||||
|
default: 0,
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
default: 0,
|
||||||
|
type: Number,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['transactions', 'currentTransaction']),
|
...mapState(['transactions', 'currentTransaction']),
|
||||||
|
|
|
@ -68,7 +68,7 @@ export default new Vuex.Store({
|
||||||
if (budget.id) {
|
if (budget.id) {
|
||||||
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/budgets/${budget.id}`), budget)
|
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/budgets/${budget.id}`), budget)
|
||||||
} else {
|
} else {
|
||||||
request = axios.post(OC.generateUrl(`/apps/twigs/api/v1.0/budgets`), budget)
|
request = axios.post(OC.generateUrl('/apps/twigs/api/v1.0/budgets'), budget)
|
||||||
}
|
}
|
||||||
request.then(response => {
|
request.then(response => {
|
||||||
commit('addBudget', response.data)
|
commit('addBudget', response.data)
|
||||||
|
@ -140,7 +140,7 @@ export default new Vuex.Store({
|
||||||
if (category.id) {
|
if (category.id) {
|
||||||
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/categories/${category.id}`), category)
|
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/categories/${category.id}`), category)
|
||||||
} else {
|
} else {
|
||||||
request = axios.post(OC.generateUrl(`/apps/twigs/api/v1.0/categories`), category)
|
request = axios.post(OC.generateUrl('/apps/twigs/api/v1.0/categories'), category)
|
||||||
}
|
}
|
||||||
request.then(response => {
|
request.then(response => {
|
||||||
commit('addCategory', response.data)
|
commit('addCategory', response.data)
|
||||||
|
@ -180,7 +180,7 @@ export default new Vuex.Store({
|
||||||
if (transaction.id) {
|
if (transaction.id) {
|
||||||
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/transactions/${transaction.id}`), transaction)
|
request = axios.put(OC.generateUrl(`/apps/twigs/api/v1.0/transactions/${transaction.id}`), transaction)
|
||||||
} else {
|
} else {
|
||||||
request = axios.post(OC.generateUrl(`/apps/twigs/api/v1.0/transactions`), transaction)
|
request = axios.post(OC.generateUrl('/apps/twigs/api/v1.0/transactions'), transaction)
|
||||||
}
|
}
|
||||||
request.then(response => {
|
request.then(response => {
|
||||||
commit('addTransaction', response.data)
|
commit('addTransaction', response.data)
|
||||||
|
|
Loading…
Reference in a new issue