display resources table row

This commit is contained in:
Mathieu Jaumotte 2021-05-14 21:25:30 +02:00
parent d872bf65dd
commit 9710f8be63
4 changed files with 38 additions and 17 deletions

View File

@ -1,10 +1,22 @@
<template>
<tr>
<td>{{ resource.resource.text }}</td>
<td>{{ resource.resource.type }} {{ resource.resource.id }}</td>
<td></td>
<td></td>
<td>
<span class="badge badge-pill badge-secondary"
v-bind:title="resource.resource.id">
<span v-if="resource.resource.type === 'person'" >{{ $t('item.type_person') }}</span>
<span v-if="resource.resource.type === 'thirdparty'" >{{ $t('item.type_thirdparty') }}</span>
</span>
{{ resource.resource.text }}
</td>
<td v-if="resource.resource.type === 'person'">
{{ $tc('person.born') }}{{ $d(resource.resource.birthdate.datetime, 'short') }}
</td>
<td v-else-if="resource.resource.type === 'thirdparty'">
{{ resource.resource.address.text }}<br>
{{ resource.resource.address.postcode.name }}
</td>
<td>
<ul class="record_actions">
@ -37,14 +49,20 @@
export default {
name: 'ResourceItem',
props: ['resource'],
data() {
return {
url: {
show: 'show', //'/fr/person/' + this.resource.person.id + '/general',
edit: 'edit' //'/fr/person/' + this.resource.person.id + '/general/edit'
emits: ['remove'],
computed: {
type() {
return this.resource.resource.type;
},
url() {
return (this.type === 'person') ? {
show: `/fr/person/${this.resource.resource.id}/general`,
edit: `/fr/person/${this.resource.resource.id}/general/edit`
} : {
show: `/fr/thirdparty/thirdparty/${this.resource.resource.id}/show`,
edit: `/fr/thirdparty/thirdparty/${this.resource.resource.id}/update`
}
}
},
emits: ['remove']
}
}
</script>

View File

@ -7,10 +7,8 @@
<table class="rounded">
<thead>
<tr>
<th class="chill-orange">{{ $t('resources.firstname') }}</th>
<th class="chill-orange">{{ $t('resources.lastname') }}</th>
<th>3</th>
<th>4</th>
<th class="chill-orange">{{ $t('resources.text') }}</th>
<th class="chill-orange">{{ $t('resources.description') }}</th>
<th class="chill-orange">{{ $t('action.actions') }}</th>
</tr>
</thead>

View File

@ -49,8 +49,8 @@ const appMessages = {
resources: {
title: "Interlocuteurs privilégiés",
counter: "Pas d'interlocuteur | 1 interlocuteur | {count} interlocuteurs",
firstname: "Prénom",
lastname: "Nom",
text: "Dénomination",
description: "Description",
add_resources: "Ajouter des interlocuteurs",
}
}

View File

@ -12,6 +12,11 @@ const personMessages = {
type_thirdparty: "Tiers",
type_household: "Ménage"
},
person: {
firstname: "Prénom",
lastname: "Nom",
born: "né le ",
},
error_only_one_person: "Une seule personne peut être sélectionnée !"
}
};