Use Numeric in JSON output
This commit is contained in:
@ -1,38 +1,53 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { FETCH_MONTH_BUDGET } from "../store/action-types";
|
||||
import { TITLE } from "../store/mutation-types";
|
||||
import Currency from "../components/Currency.vue";
|
||||
|
||||
export default defineComponent({
|
||||
mounted() {
|
||||
this.$store.commit(TITLE, "Budget for " + this.month + " " + this.year)
|
||||
this.$store.commit(TITLE, "Budget for " + this.month + " " + this.year);
|
||||
return this.$store.dispatch(FETCH_MONTH_BUDGET, { budgetid: this.budgetid, year: this.$data.Year, month: this.$data.Month });
|
||||
},
|
||||
watch: {
|
||||
year() {
|
||||
return this.$store.dispatch(FETCH_MONTH_BUDGET, { budgetid: this.budgetid, year: this.$data.Year, month: this.$data.Month });
|
||||
},
|
||||
month() {
|
||||
return this.$store.dispatch(FETCH_MONTH_BUDGET, { budgetid: this.budgetid, year: this.$data.Year, month: this.$data.Month });
|
||||
},
|
||||
},
|
||||
props: ["budgetid", "year", "month"],
|
||||
data() {
|
||||
return {
|
||||
Year: this.year || new Date().getFullYear(),
|
||||
Month: this.month || new Date().getMonth()
|
||||
}
|
||||
Year: (this.year || new Date().getFullYear()) as number,
|
||||
Month: (this.month || new Date().getMonth()) as number
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
Categories() {
|
||||
return this.$store.getters.Categories(this.$data.Year, this.$data.Month);
|
||||
},
|
||||
previous() {
|
||||
return {
|
||||
Year: new Date(this.$data.Year, this.$data.Month - 1, 1).getFullYear(),
|
||||
Month: new Date(this.$data.Year, this.$data.Month - 1, 1).getMonth(),
|
||||
}
|
||||
};
|
||||
},
|
||||
current() {
|
||||
return {
|
||||
Year: new Date().getFullYear(),
|
||||
Month: new Date().getMonth(),
|
||||
}
|
||||
};
|
||||
},
|
||||
next() {
|
||||
return {
|
||||
Year: new Date(this.$data.Year, this.$data.Month + 1, 1).getFullYear(),
|
||||
Month: new Date(this.$data.Year, this.$data.Month + 1, 1).getMonth(),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
components: { Currency }
|
||||
})
|
||||
|
||||
/*{{define "title"}}
|
||||
@ -42,7 +57,7 @@ export default defineComponent({
|
||||
|
||||
<template>
|
||||
<h1>
|
||||
Budget for {{current.Month}}/{{current.Year}}
|
||||
Budget for {{Month}}/{{Year}}
|
||||
</h1>
|
||||
<div>
|
||||
<router-link :to="'/budget/'+$store.getters.CurrentBudget.ID +'/' + previous.Year + '/' + previous.Month">Previous Month</router-link> -
|
||||
@ -60,15 +75,15 @@ export default defineComponent({
|
||||
<th>Activity</th>
|
||||
<th>Available</th>
|
||||
</tr>
|
||||
<tr v-for="category in $store.getters.Categories(2022, 1)">
|
||||
<tr v-for="category in Categories">
|
||||
<td>{{category.Group}}</td>
|
||||
<td>{{category.Name}}</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{category.AvailableLastMonth}}</td>
|
||||
<td>{{category.Assigned}}</td>
|
||||
<td>{{category.Activity}}</td>
|
||||
<td>{{category.Available}}</td>
|
||||
<td class="text-right"><Currency :value="category.AvailableLastMonth" /></td>
|
||||
<td class="text-right"><Currency :value="category.Assigned" /></td>
|
||||
<td class="text-right"><Currency :value="category.Activity" /></td>
|
||||
<td class="text-right"><Currency :value="category.Available" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
Reference in New Issue
Block a user