Newer
Older
<table
class="ui very basic table"
aria-describedby="Table des données du signalement"
>
<tr v-if="feature_type">
<td>
<b> Type de signalement </b>
</td>
<td>
<router-link
:to="{
name: 'details-type-signalement',
params: { feature_type_slug: feature_type.slug },
}"
class="feature-type-title"
>
<img
v-if="feature_type.geom_type === 'point'"
class="list-image-type"
src="@/assets/img/marker.png"
>
<img
v-if="feature_type.geom_type === 'linestring'"
class="list-image-type"
src="@/assets/img/line.png"
>
<img
v-if="feature_type.geom_type === 'polygon'"
class="list-image-type"
src="@/assets/img/polygon.png"
>
{{ feature_type.title }}
</router-link>
</td>
</tr>
v-for="(field, index) in currentFeature.feature_data"
:key="'field' + index"
>
<td>
<strong>{{ field.label }}</strong>
</td>
<td>
<strong>
<i
v-if="field.field_type === 'boolean'"
:class="[
'icon',
field.value ? 'olive check' : 'grey times',
]"
aria-hidden="true"
/>
<span v-else>
{{ field.value }}
</span>
</strong>
</td>
</tr>
<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>
<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, mapGetters } from 'vuex';
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'
]),
...mapGetters('feature-type', [
'feature_type',
]),
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
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>
<style scoped>
.feature-type-title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 1.5em;
}
.list-image-type {
margin-right: 5px;
height: 25px;
vertical-align: bottom;
}
</style>