Newer
Older
<table
class="ui very basic table"
aria-describedby="Table des données du signalement"
>
<tbody>
<div
v-for="(field, index) in currentFeature.feature_data"
:key="'field' + index"
>
<tr v-if="field">
<th scope="row">
<strong>{{ field.label }}</strong>
</th>
v-if="field.field_type === 'boolean'"
:class="[
'icon',
field.value ? 'olive check' : 'grey times',
]"
<td>{{ currentFeature.display_creator }}</td>
</tr>
<tr>
v-if="currentFeature.status"
:class="['icon', statusIcon]"
<td v-if="currentFeature.created_on">
{{ currentFeature.created_on | formatDate }}
</td>
</tr>
<tr>
<th
scope="row"
>
Date de dernière modification
</th>
<td v-if="currentFeature.updated_on">
{{ currentFeature.updated_on | formatDate }}
</td>
</tr>
</tbody>
</table>
<h3>Liaison entre signalements</h3>
<table
class="ui very basic table"
aria-describedby="Table des signalements lié à ce signalement"
>
<tbody>
<tr
v-for="(link, index) in linked_features"
:key="link.feature_to.title + index"
>
<th
v-if="link.feature_to.feature_type_slug"
scope="row"
>
</th>
<td
v-if="link.feature_to.feature_type_slug"
>
<a @click="pushNgo(link)">{{ link.feature_to.title }} </a>
({{ link.feature_to.display_creator }} -
{{ link.feature_to.created_on }})
</td>
</tr>
</tbody>
</table>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: 'FeatureTable',
filters: {
formatDate(value) {
let date = new Date(value);
date = date.toLocaleString().replace(',', '');
return date.substr(0, date.length - 3); //* quick & dirty way to remove seconds from date
},
},
computed: {
...mapState('feature', [
'currentFeature',
'linked_features',
'statusChoices'
]),
statusIcon() {
switch (this.currentFeature.status) {
case 'archived':
return 'grey archive';
case 'pending':
return 'teal hourglass outline';
case 'published':
return 'olive check';
case 'draft':
return 'orange pencil alternate';
default:
return '';
}
},
statusLabel() {
const status = this.statusChoices.find(
(el) => el.value === this.currentFeature.status
);
return status ? status.name : '';
},
},
methods: {
pushNgo(link) {
this.$emit('push-n-go', link);
}
}
};
</script>