forked from akhilrex/hammond
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickEntryDisplay.vue
68 lines (66 loc) · 1.62 KB
/
quickEntryDisplay.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<script>
import { mapGetters, mapState } from 'vuex'
import { parseAndFormatDateTime } from '@utils/format-date'
export default {
model: {
prop: 'quickEntry',
event: 'change',
},
props: {
user: {
type: Object,
required: true,
},
},
data: function() {
return {
quickEntry: null,
}
},
computed: {
...mapState('utils', ['isMobile']),
...mapGetters('vehicles', ['unprocessedQuickEntries', 'processedQuickEntries']),
},
methods: {
parseAndFormatDateTime(date) {
return parseAndFormatDateTime(date)
},
showQuickEntry(entry) {
const h = this.$createElement
const vnode = h('p', { class: 'image' }, [
h('img', {
attrs: {
src: `/api/attachments/${entry.attachmentId}/file?access_token=${this.user.token}`,
},
}),
])
this.$buefy.modal.open({
content: [vnode],
})
this.$emit('change', entry)
},
},
}
</script>
<template>
<div class="level">
<b-field class="level-right">
<b-select
v-if="unprocessedQuickEntries.length"
v-model="quickEntry"
:placeholder="this.$t('referquickentry')"
expanded
@input="showQuickEntry($event)"
>
<option v-for="option in unprocessedQuickEntries" :key="option.id" :value="option">
{{ $t('created') }}: {{ parseAndFormatDateTime(option.createdAt) }}
</option>
</b-select>
<p class="control">
<b-button v-if="quickEntry" type="is-primary" @click="showQuickEntry(quickEntry)"
>Show</b-button
></p
>
</b-field>
</div></template
>