|
| 1 | +<template> |
| 2 | + <main> |
| 3 | + <Manage> |
| 4 | + <h1>Invoices</h1> |
| 5 | + <Loading v-if="loading" :message="loading" /> |
| 6 | + <LargeMessage |
| 7 | + v-else-if="!loading && !invoices.length" |
| 8 | + heading="No invoices yet" |
| 9 | + text="You don't have any invoices yet, come back here once you've made your first payment." |
| 10 | + /> |
| 11 | + <div v-else> |
| 12 | + <table class="table table--type-cols"> |
| 13 | + <tbody> |
| 14 | + <tr |
| 15 | + v-for="(invoice, index) in invoices.data" |
| 16 | + :key="`${invoice.id}_${index}`" |
| 17 | + > |
| 18 | + <td> |
| 19 | + {{ invoice }} |
| 20 | + </td> |
| 21 | + </tr> |
| 22 | + </tbody> |
| 23 | + </table> |
| 24 | + </div> |
| 25 | + </Manage> |
| 26 | + </main> |
| 27 | +</template> |
| 28 | + |
| 29 | +<script lang="ts"> |
| 30 | +import { Component, Vue, Watch } from "vue-property-decorator"; |
| 31 | +import { mapGetters } from "vuex"; |
| 32 | +import Manage from "@/components/Manage.vue"; |
| 33 | +import Loading from "@/components/Loading.vue"; |
| 34 | +import LargeMessage from "@/components/LargeMessage.vue"; |
| 35 | +import Input from "@/components/form/Input.vue"; |
| 36 | +import Select from "@/components/form/Select.vue"; |
| 37 | +import Checkbox from "@/components/form/Checkbox.vue"; |
| 38 | +import { getAllCountries } from "countries-and-timezones"; |
| 39 | +import { User } from "../../types/auth"; |
| 40 | +
|
| 41 | +@Component({ |
| 42 | + components: { |
| 43 | + Manage, |
| 44 | + Loading, |
| 45 | + Input, |
| 46 | + Select, |
| 47 | + LargeMessage, |
| 48 | + Checkbox |
| 49 | + }, |
| 50 | + computed: mapGetters({ |
| 51 | + organization: "auth/activeOrganization", |
| 52 | + user: "auth/user", |
| 53 | + invoices: "manage/invoices" |
| 54 | + }) |
| 55 | +}) |
| 56 | +export default class ManageSettings extends Vue { |
| 57 | + organization!: any; |
| 58 | + invoices!: any; |
| 59 | + user!: any; |
| 60 | + loading = ""; |
| 61 | +
|
| 62 | + private mounted() { |
| 63 | + this.loading = "Loading invoices details"; |
| 64 | + this.$store |
| 65 | + .dispatch("manage/getInvoices", this.organization.organization.id) |
| 66 | + .then(invoices => {}) |
| 67 | + .catch(error => { |
| 68 | + if (error.response.data.error === "no-customer") { |
| 69 | + // this.name = this.user.name; |
| 70 | + } |
| 71 | + }) |
| 72 | + .finally(() => (this.loading = "")); |
| 73 | + } |
| 74 | +} |
| 75 | +</script> |
| 76 | + |
| 77 | +<style lang="scss" scoped></style> |
0 commit comments