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 />
|
2022-03-10 09:15:07 +00:00
|
|
|
<AddNewQuote v-if="quotes.length > 0" @createQuote="createQuote"/>
|
2022-02-27 14:26:17 +00:00
|
|
|
<NoQuotesYet v-if="quotes.length == 0" />
|
2022-03-10 09:15:07 +00:00
|
|
|
<QuoteListItem
|
|
|
|
v-for="quote in quotes"
|
|
|
|
:key="quote.id"
|
|
|
|
:quote="quote"
|
|
|
|
@editQuote="editQuote"
|
|
|
|
/>
|
|
|
|
<AddNewQuote @createQuote="createQuote" />
|
|
|
|
<CollectQuote
|
|
|
|
v-if="showCollectQuoteDialog"
|
|
|
|
:quote="collectQuote"
|
|
|
|
@close="closeCollectQuoteDialog"
|
|
|
|
@saveQuote="saveQuote"
|
|
|
|
/>
|
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
|
|
|
},
|
|
|
|
},
|
2022-03-10 09:15:07 +00:00
|
|
|
methods: {
|
|
|
|
closeCollectQuoteDialog() {
|
2021-11-22 06:08:54 +00:00
|
|
|
this.showCollectQuoteDialog = false
|
2022-03-10 09:15:07 +00:00
|
|
|
},
|
|
|
|
editQuote(quote) {
|
2021-10-29 20:13:38 +00:00
|
|
|
this.showCollectQuoteDialog = true
|
|
|
|
this.collectQuote = {
|
|
|
|
id: quote.id,
|
|
|
|
quote: quote.quote,
|
|
|
|
}
|
2022-03-10 09:15:07 +00:00
|
|
|
},
|
|
|
|
async saveQuote(quote) {
|
|
|
|
this.showCollectQuoteDialog = false
|
2022-03-15 06:18:40 +00:00
|
|
|
await this.$engine.saveQuote(quote.id, quote.quote)
|
|
|
|
await this.$engine.getMyQuotes()
|
2022-03-10 09:15:07 +00:00
|
|
|
},
|
|
|
|
createQuote() {
|
2021-10-29 20:13:38 +00:00
|
|
|
this.showCollectQuoteDialog = true
|
|
|
|
this.collectQuote = {
|
|
|
|
id: ':new:',
|
|
|
|
quote: '',
|
|
|
|
}
|
2022-03-10 09:15:07 +00:00
|
|
|
},
|
2021-10-29 20:13:38 +00:00
|
|
|
},
|
2021-10-04 06:46:36 +00:00
|
|
|
async fetch() {
|
|
|
|
await this.$engine.getMyQuotes()
|
|
|
|
},
|
2021-10-01 14:40:07 +00:00
|
|
|
}
|
|
|
|
</script>
|