2021-10-01 14:40:07 +00:00
|
|
|
<template>
|
2021-10-15 18:45:41 +00:00
|
|
|
<div>
|
2022-02-27 14:26:17 +00:00
|
|
|
<CollectQuotesExplain />
|
2021-11-27 20:10:09 +00:00
|
|
|
<AddNewQuote v-if="quotes.length > 0"/>
|
2022-02-27 14:26:17 +00:00
|
|
|
<NoQuotesYet v-if="quotes.length == 0" />
|
|
|
|
<QuoteListItem v-for="quote in quotes" :key="quote.id" :quote="quote" />
|
|
|
|
<AddNewQuote />
|
2021-10-29 20:13:38 +00:00
|
|
|
<CollectQuote v-if="showCollectQuoteDialog" :quote="collectQuote" />
|
2021-10-01 14:40:07 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
2021-10-04 06:46:36 +00:00
|
|
|
export default {
|
2021-10-29 20:13:38 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showCollectQuoteDialog: false,
|
|
|
|
collectQuote: {},
|
|
|
|
}
|
|
|
|
},
|
2021-10-04 06:46:36 +00:00
|
|
|
computed: {
|
|
|
|
quotes() {
|
2021-12-02 18:06:26 +00:00
|
|
|
var quotes = [...this.$store.state.myQuotes.quotes]
|
|
|
|
quotes.sort((a, b) => {
|
|
|
|
return a.id.localeCompare(b.id)
|
|
|
|
})
|
|
|
|
return quotes
|
2021-10-04 06:46:36 +00:00
|
|
|
},
|
|
|
|
},
|
2021-10-29 20:13:38 +00:00
|
|
|
created() {
|
2021-11-22 06:08:54 +00:00
|
|
|
this.$nuxt.$on('close-quote', () => {
|
|
|
|
this.showCollectQuoteDialog = false
|
|
|
|
})
|
|
|
|
|
2021-10-29 20:13:38 +00:00
|
|
|
this.$nuxt.$on('edit-quote', (quote) => {
|
|
|
|
this.showCollectQuoteDialog = true
|
|
|
|
this.collectQuote = {
|
|
|
|
id: quote.id,
|
|
|
|
quote: quote.quote,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
this.$nuxt.$on('create-quote', (quote) => {
|
|
|
|
this.showCollectQuoteDialog = true
|
|
|
|
this.collectQuote = {
|
|
|
|
id: ':new:',
|
|
|
|
quote: '',
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
this.$nuxt.$on('save-quote', async (quote) => {
|
|
|
|
this.$engine.saveQuote(quote.id, quote.quote)
|
|
|
|
await this.$engine.getMyQuotes()
|
|
|
|
this.showCollectQuoteDialog = false
|
|
|
|
})
|
|
|
|
},
|
2021-10-04 06:46:36 +00:00
|
|
|
async fetch() {
|
|
|
|
await this.$engine.getMyQuotes()
|
|
|
|
},
|
2021-10-01 14:40:07 +00:00
|
|
|
}
|
|
|
|
</script>
|