add entity 'user' to pills badge-entity

This commit is contained in:
Mathieu Jaumotte 2021-12-10 12:35:25 +01:00
parent 57c4f2ee61
commit c7ee2cc600
4 changed files with 30 additions and 23 deletions

View File

@ -1,13 +1,12 @@
<template> <template>
<span v-if="entity.type === 'person'" class="badge rounded-pill bg-person"> <span v-if="entity.type === 'person'" class="badge rounded-pill bg-person">
{{ $t('renderbox.person') }} {{ $t('person') }}
</span> </span>
<span v-if="entity.type === 'thirdparty'" class="badge rounded-pill bg-thirdparty"> <span v-if="entity.type === 'thirdparty'" class="badge rounded-pill bg-thirdparty">
<template v-if="options.displayLong !== true"> <template v-if="options.displayLong !== true">
{{ $t('renderbox.type.thirdparty')}} {{ $t('thirdparty.thirdparty')}}
</template> </template>
<i class="fa fa-fw fa-user" v-if="entity.kind === 'child'"></i> <i class="fa fa-fw fa-user" v-if="entity.kind === 'child'"></i>
@ -15,12 +14,16 @@
<i class="fa fa-fw fa-user-md" v-else></i> <i class="fa fa-fw fa-user-md" v-else></i>
<template v-if="options.displayLong === true"> <template v-if="options.displayLong === true">
<span v-if="entity.kind === 'child'">{{ $t('tparty.child')}}</span> <span v-if="entity.kind === 'child'">{{ $t('thirdparty.child')}}</span>
<span v-else-if="entity.kind === 'company'">{{ $t('tparty.company')}}</span> <span v-else-if="entity.kind === 'company'">{{ $t('thirdparty.company')}}</span>
<span v-else>{{ $t('tparty.contact')}}</span> <span v-else>{{ $t('thirdparty.contact')}}</span>
</template> </template>
</span> </span>
<span v-if="entity.type === 'user'" class="badge rounded-pill bg-user">
{{ $t('user')}}
</span>
</template> </template>
<script> <script>
@ -30,11 +33,14 @@ export default {
i18n: { i18n: {
messages: { messages: {
fr: { fr: {
tparty: { person: "Usager",
thirdparty: {
thirdparty: "Tiers",
child: "Personne de contact", child: "Personne de contact",
company: "Personne morale", company: "Personne morale",
contact: "Personne physique", contact: "Personne physique",
} },
user: 'TMS'
} }
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* BADGES PERSON AND THIRDPARTY * BADGES USER, PERSON AND THIRDPARTY
*/ */
span.badge-user, span.badge-user,
@ -167,7 +167,7 @@ div[class*='activity-'] {
} }
/* /*
* Specific badge rounded-pill * Pill badge by entity
*/ */
.badge { .badge {
&.bg-person { &.bg-person {
@ -175,5 +175,10 @@ div[class*='activity-'] {
background-color: $chill-ll-gray; background-color: $chill-ll-gray;
color: $chill-green; color: $chill-green;
} }
&.bg-user {
//@extend .$chill-ll-gray;
background-color: $chill-ll-gray;
color: $chill-blue;
}
} }

View File

@ -7,26 +7,22 @@
</div> </div>
</div> </div>
<div class="right_actions"> <div class="right_actions">
<span class="badge rounded-pill bg-secondary"> <badge-entity
{{ $t('user')}} :entity="item.result"
</span> :options="{ displayLong: true }">
</badge-entity>
</div> </div>
</template> </template>
<script> <script>
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
const i18n = {
messages: {
fr: {
user: 'Utilisateur' // TODO how to define other translations?
}
}
};
export default { export default {
name: 'SuggestionUser', name: 'SuggestionUser',
components: {
BadgeEntity
},
props: ['item'], props: ['item'],
i18n,
computed: { computed: {
hasParent() { hasParent() {
return this.$props.item.result.parent !== null; return this.$props.item.result.parent !== null;

View File

@ -1,6 +1,6 @@
@import 'ChillMainAssets/module/bootstrap/shared'; @import 'ChillMainAssets/module/bootstrap/shared';
/// Specific badge rounded-pill /// Pill badge by entity
.badge.rounded-pill { .badge.rounded-pill {
&.bg-thirdparty { &.bg-thirdparty {
//@extend .$chill-ll-gray; //@extend .$chill-ll-gray;