|
18 | 18 | />
|
19 | 19 | </v-avatar>
|
20 | 20 | <div class="mt-1 ml-3 alignLeft">
|
21 |
| - {{ item.name | cleanString }} |
| 21 | + {{ $filters.cleanString(item.name) }} |
22 | 22 | </div>
|
23 | 23 | </div>
|
24 | 24 | </template>
|
25 | 25 | <template #[`item.type`]="{ item }">
|
26 |
| - {{ item.type | cleanString }} |
| 26 | + {{ $filters.cleanString(item.type) }} |
27 | 27 | </template>
|
28 | 28 | <template #[`item.isApproved`]="{ item }">
|
29 | 29 | <StatusPills
|
|
40 | 40 | />
|
41 | 41 | </template>
|
42 | 42 | <template #[`item.actions`]="{ item }">
|
43 |
| - <v-menu offset-x> |
44 |
| - <template #activator="{ on, attrs }"> |
| 43 | + <v-menu> |
| 44 | + <template #activator="{ props }"> |
45 | 45 | <v-icon
|
46 |
| - v-bind="attrs" |
47 |
| - v-on="on" |
| 46 | + v-bind="props" |
48 | 47 | >
|
49 | 48 | fas fa-ellipsis-v
|
50 | 49 | </v-icon>
|
51 | 50 | </template>
|
52 | 51 | <v-list>
|
53 | 52 | <v-list-item @click="previewRecord(item.id)">
|
54 |
| - <v-list-item-avatar><v-icon>fas fa-eye</v-icon></v-list-item-avatar> |
55 |
| - <v-list-item-content><v-list-item-title> Preview record </v-list-item-title></v-list-item-content> |
| 53 | + <v-avatar><v-icon>fas fa-eye</v-icon></v-avatar> |
| 54 | + <v-list-item-title> Preview record </v-list-item-title> |
56 | 55 | </v-list-item>
|
57 | 56 | <v-list-item @click="goToRecord(item.id)">
|
58 |
| - <v-list-item-avatar><v-icon>fas fa-newspaper</v-icon></v-list-item-avatar> |
59 |
| - <v-list-item-content><v-list-item-title> Go to record </v-list-item-title></v-list-item-content> |
| 57 | + <v-avatar><v-icon>fas fa-newspaper</v-icon></v-avatar> |
| 58 | + <v-list-item-title> Go to record </v-list-item-title> |
60 | 59 | </v-list-item>
|
61 | 60 | <v-list-item
|
62 | 61 | v-if="(source !== 'maintenanceRequests' && source !== 'watchedRecords') || (source === 'watchedRecords' && user().is_curator)"
|
63 | 62 | @click="goToEdit(item.id)"
|
64 | 63 | >
|
65 |
| - <v-list-item-avatar><v-icon>fas fa-pen</v-icon></v-list-item-avatar> |
66 |
| - <v-list-item-content><v-list-item-title> Edit record </v-list-item-title></v-list-item-content> |
| 64 | + <v-avatar><v-icon>fas fa-pen</v-icon></v-avatar> |
| 65 | + <v-list-item-title> Edit record </v-list-item-title> |
67 | 66 | </v-list-item>
|
68 | 67 | </v-list>
|
69 | 68 | </v-menu>
|
70 | 69 | </template>
|
71 |
| - <template slot="no-data"> |
| 70 | + <template #no-data> |
72 | 71 | <div>
|
73 | 72 | {{ noData }}
|
74 | 73 | <router-link
|
|
84 | 83 | <!-- PREVIEW RECORD -->
|
85 | 84 | <v-dialog v-model="showOverlay">
|
86 | 85 | <v-btn
|
87 |
| - fab |
88 |
| - small |
89 |
| - class="grey--text absolute" |
| 86 | + size="small" |
| 87 | + class="text-grey absolute" |
90 | 88 | @click="hideOverlay()"
|
91 | 89 | >
|
92 | 90 | <v-icon>fa-times</v-icon>
|
|
100 | 98 | </template>
|
101 | 99 |
|
102 | 100 | <script>
|
103 |
| - import { mapState } from "vuex" |
| 101 | +import { mapState } from "vuex" |
104 | 102 |
|
105 |
| - import Icon from "@/components/Icon"; |
106 |
| - import { cleanString } from "@/utils/stringUtils" |
107 |
| - import Record from "@/views/Records/Record"; |
| 103 | +import Icon from "@/components/Icon"; |
| 104 | +import Record from "@/views/Records/Record"; |
108 | 105 |
|
109 |
| - import StatusPills from "./StatusPills"; |
| 106 | +import StatusPills from "./StatusPills"; |
110 | 107 |
|
111 |
| - export default { |
112 |
| - name: "RecordsTable", |
113 |
| - components: {Icon, Record, StatusPills}, |
114 |
| - mixins: [cleanString], |
115 |
| - props: { |
116 |
| - records: {type: Array, default: () => []}, |
117 |
| - source: { type: String, default: null } |
118 |
| - }, |
119 |
| - data: () => { |
120 |
| - return { |
121 |
| - showOverlay: false, |
122 |
| - targetID: null |
123 |
| - } |
124 |
| - }, |
125 |
| - computed: { |
126 |
| - ...mapState('users', ['user']), |
127 |
| - headers(){ |
128 |
| - let headers = [ |
129 |
| - {text: 'Name', value: 'name', align: 'center'}, |
130 |
| - {text: 'Registry', value: 'type', align: 'center'} |
131 |
| - ]; |
132 |
| - if (this.source !== 'maintenanceRequests' && this.source !== 'watchedRecords'){ |
133 |
| - headers.push({text: 'Approved', value: 'isApproved', align: 'center'}); |
134 |
| - } |
135 |
| - else if (this.source === 'maintenanceRequests') { |
136 |
| - headers.push({text: 'Status', value: 'status', align: 'center'}); |
137 |
| - } |
138 |
| - headers.push({text: 'Actions', value: 'actions', align: 'center', sortable: false}); |
139 |
| - return headers; |
140 |
| - }, |
141 |
| - noData(){ |
142 |
| - return { |
143 |
| - maintenanceRequests: "You do not have any maintenance requests.", |
144 |
| - createdRecords: "You did not create any record yet. Start creating one ", |
145 |
| - maintainedRecords: "You do not maintain any records.", |
146 |
| - publicMaintainedRecords: "This user does not maintain any records.", |
147 |
| - watchedRecords: "You are not watching any record." |
148 |
| - }[this.source]; |
149 |
| - }, |
150 |
| - perPage(){ |
151 |
| - if (this.source === 'watchedRecords') return 7; |
152 |
| - return 5 |
153 |
| - }, |
154 |
| - footer(){ |
155 |
| - if (this.source === 'watchedRecords') return {'items-per-page-options': [7]}; |
156 |
| - return {'items-per-page-options': [5]} |
157 |
| - } |
158 |
| - }, |
159 |
| - methods: { |
160 |
| - goToEdit(id){ |
161 |
| - this.$router.push({path: `/${id}/edit`}) |
162 |
| - }, |
163 |
| - previewRecord(id) { |
164 |
| - this.targetID = id; |
165 |
| - this.showOverlay = true; |
166 |
| - }, |
167 |
| - goToRecord(id) { |
168 |
| - window.open("/" + id, '_blank'); |
169 |
| - }, |
170 |
| - hideOverlay(){ |
171 |
| - this.showOverlay = false; |
172 |
| - this.targetID = null; |
173 |
| - } |
174 |
| - } |
| 108 | +export default { |
| 109 | + name: "RecordsTable", |
| 110 | + components: {Icon, Record, StatusPills}, |
| 111 | + props: { |
| 112 | + records: {type: Array, default: () => []}, |
| 113 | + source: { type: String, default: null } |
| 114 | + }, |
| 115 | + data: () => { |
| 116 | + return { |
| 117 | + showOverlay: false, |
| 118 | + targetID: null |
175 | 119 | }
|
| 120 | + }, |
| 121 | + computed: { |
| 122 | + ...mapState('users', ['user']), |
| 123 | + headers(){ |
| 124 | + let headers = [ |
| 125 | + {title: 'Name', value: 'name', align: 'center'}, |
| 126 | + {title: 'Registry', value: 'type', align: 'center'} |
| 127 | + ]; |
| 128 | + if (this.source !== 'maintenanceRequests' && this.source !== 'watchedRecords'){ |
| 129 | + headers.push({title: 'Approved', value: 'isApproved', align: 'center'}); |
| 130 | + } |
| 131 | + else if (this.source === 'maintenanceRequests') { |
| 132 | + headers.push({title: 'Status', value: 'status', align: 'center'}); |
| 133 | + } |
| 134 | + headers.push({title: 'Actions', value: 'actions', align: 'center', sortable: false}); |
| 135 | + return headers; |
| 136 | + }, |
| 137 | + noData(){ |
| 138 | + return { |
| 139 | + maintenanceRequests: "You do not have any maintenance requests.", |
| 140 | + createdRecords: "You did not create any record yet. Start creating one ", |
| 141 | + maintainedRecords: "You do not maintain any records.", |
| 142 | + publicMaintainedRecords: "This user does not maintain any records.", |
| 143 | + watchedRecords: "You are not watching any record." |
| 144 | + }[this.source]; |
| 145 | + }, |
| 146 | + perPage(){ |
| 147 | + if (this.source === 'watchedRecords') return 7; |
| 148 | + return 5 |
| 149 | + }, |
| 150 | + footer(){ |
| 151 | + if (this.source === 'watchedRecords') return {'items-per-page-options': [7]}; |
| 152 | + return {'items-per-page-options': [5]} |
| 153 | + } |
| 154 | + }, |
| 155 | + methods: { |
| 156 | + goToEdit(id){ |
| 157 | + this.$router.push({path: `/${id}/edit`}) |
| 158 | + }, |
| 159 | + previewRecord(id) { |
| 160 | + this.targetID = id; |
| 161 | + this.showOverlay = true; |
| 162 | + }, |
| 163 | + goToRecord(id) { |
| 164 | + window.open("/" + id, '_blank'); |
| 165 | + }, |
| 166 | + hideOverlay(){ |
| 167 | + this.showOverlay = false; |
| 168 | + this.targetID = null; |
| 169 | + } |
| 170 | + } |
| 171 | +} |
176 | 172 | </script>
|
177 | 173 |
|
178 | 174 | <style scoped>
|
|
0 commit comments