try badgeEntity with displayLong option

This commit is contained in:
Mathieu Jaumotte 2021-12-08 16:34:57 +01:00
parent 56ab304af1
commit 6100176c9f
9 changed files with 146 additions and 107 deletions

View File

@ -0,0 +1,39 @@
<template>
<span v-if="entity.type === 'person'" class="badge rounded-pill bg-person">
{{ $t('renderbox.person') }}
</span>
<span v-if="entity.type === 'thirdparty'" class="badge rounded-pill bg-thirdparty">
{{ $t('renderbox.type.thirdparty')}}
<i class="fa fa-user fa-fw" v-if="entity.kind === 'child'"></i>
<i class="fa fa-hospital-o fa-fw" v-else-if="entity.kind === 'company'"></i>
<i class="fa fa-user-md fa-fw" v-else></i>
<template v-if="options.displayLong === true">
<span v-if="entity.kind === 'child'">{{ $t('tparty.child')}}</span>
<span v-else-if="entity.kind === 'company'">{{ $t('tparty.company')}}</span>
<span v-else>{{ $t('tparty.contact')}}</span>
</template>
</span>
</template>
<script>
export default {
name: "BadgeEntity",
props: ['options', 'entity'],
i18n: {
messages: {
fr: {
tparty: {
child: "Personne de contact",
company: "Personne morale",
contact: "Personne physique",
}
}
}
}
}
</script>

View File

@ -65,7 +65,7 @@ const messages = {
household_without_address: "Le ménage de l'usager est sans adresse", household_without_address: "Le ménage de l'usager est sans adresse",
no_data: "Aucune information renseignée", no_data: "Aucune information renseignée",
type: { type: {
thirdparty: "Tiers professionel", thirdparty: "Tiers",
person: "Usager" person: "Usager"
}, },
holder: "Titulaire" holder: "Titulaire"

View File

@ -2,33 +2,83 @@
<person-render-box render="bloc" <person-render-box render="bloc"
v-if="resource.resource.type === 'person'" v-if="resource.resource.type === 'person'"
:person="resource.resource" :person="resource.resource"
:options="{ addInfo : true, addId : false, addEntity: true, addLink: false, addAltNames: true, addAge : false, hLevel : 3, isConfidential : true }" :options="{
> addInfo : true,
addId : false,
addEntity: true,
addLink: false,
addAltNames: true,
addAge : false,
hLevel : 3,
isConfidential : true
}">
<template v-slot:record-actions> <template v-slot:record-actions>
<ul class="record_actions"> <ul class="record_actions">
<!-- <!--
<button-location v-if="hasCurrentHouseholdAddress" :person="resource.resource"></button-location> <button-location v-if="hasCurrentHouseholdAddress" :person="resource.resource"></button-location>
--> -->
<li><on-the-fly :type="resource.resource.type" :id="resource.resource.id" action="show"></on-the-fly></li> <li>
<li><on-the-fly :type="resource.resource.type" :id="resource.resource.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li> <on-the-fly
<li><button class="btn btn-sm btn-remove" :title="$t('action.remove')" @click.prevent="$emit('remove', resource)"></button></li> :type="resource.resource.type"
:id="resource.resource.id"
action="show">
</on-the-fly>
</li>
<li>
<on-the-fly
:type="resource.resource.type"
:id="resource.resource.id"
action="edit"
@saveFormOnTheFly="saveFormOnTheFly">
</on-the-fly>
</li>
<li>
<button
class="btn btn-sm btn-remove"
:title="$t('action.remove')"
@click.prevent="$emit('remove', resource)">
</button>
</li>
</ul> </ul>
</template> </template>
</person-render-box> </person-render-box>
<third-party-render-box <third-party-render-box
v-if="resource.resource.type === 'thirdparty'" v-if="resource.resource.type === 'thirdparty'"
:thirdparty="resource.resource" :thirdparty="resource.resource"
:options="{ addLink : false, addId : false, addEntity: true, addInfo: false, hLevel: 3 }" :options="{
> addLink : false,
addId : false,
addEntity: true,
addInfo: false,
hLevel: 3
}">
<template v-slot:record-actions> <template v-slot:record-actions>
<ul class="record_actions"> <ul class="record_actions">
<li><on-the-fly :type="resource.resource.type" :id="resource.resource.id" action="show"></on-the-fly></li> <li>
<li><on-the-fly :type="resource.resource.type" :id="resource.resource.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly"></on-the-fly></li> <on-the-fly
<li><button class="btn btn-sm btn-remove" :title="$t('action.remove')" @click.prevent="$emit('remove', resource)"></button></li> :type="resource.resource.type"
:id="resource.resource.id"
action="show">
</on-the-fly>
</li>
<li>
<on-the-fly
:type="resource.resource.type"
:id="resource.resource.id"
action="edit"
@saveFormOnTheFly="saveFormOnTheFly">
</on-the-fly>
</li>
<li>
<button
class="btn btn-sm btn-remove"
:title="$t('action.remove')"
@click.prevent="$emit('remove', resource)">
</button>
</li>
</ul> </ul>
</template> </template>
</third-party-render-box> </third-party-render-box>
</template> </template>

View File

@ -1,6 +1,5 @@
<template> <template>
<div class="container"> <div class="container">
<span class="name"> <span class="name">
{{ item.result.text }} {{ item.result.text }}
</span> </span>
@ -11,29 +10,30 @@
{{ item.result.current_household_address.text }} - {{ item.result.current_household_address.text }} -
{{ item.result.current_household_address.postcode.name }} {{ item.result.current_household_address.postcode.name }}
</span> </span>
</div> </div>
<div class="right_actions">
<span class="badge rounded-pill bg-secondary" :title="item.key"> <div class="right_actions">
{{ $t('item.type_person') }} <badge-entity
</span> :entity="item.result"
:options="{ displayLong: true }">
</badge-entity>
<on-the-fly <on-the-fly
type="person" type="person"
v-bind:id="item.result.id" v-bind:id="item.result.id"
action="show"> action="show">
</on-the-fly> </on-the-fly>
</div> </div>
</template> </template>
<script> <script>
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
export default { export default {
name: 'SuggestionPerson', name: 'SuggestionPerson',
components: { components: {
OnTheFly, OnTheFly,
BadgeEntity
}, },
props: ['item'], props: ['item'],
computed: { computed: {

View File

@ -17,33 +17,23 @@
</span> </span>
</div> </div>
</div> </div>
<div class="right_actions"> <div class="right_actions">
<badge-entity
<span class="badge rounded-pill bg-thirdparty-child" v-if="item.result.kind == 'child'"> :entity="item.result"
{{ $t('thirdparty.child')}} :options="{ displayLong: true }">
</span> </badge-entity>
<span class="badge rounded-pill bg-thirdparty-company" v-else-if="item.result.kind == 'company'">
{{ $t('thirdparty.company')}}
</span>
<span class="badge rounded-pill bg-thirdparty-contact" v-else="item.result.kind == 'contact'">
{{ $t('thirdparty.contact')}}
</span>
<span class="badge rounded-pill bg-secondary" :title="item.key">
{{ $t('item.type_thirdparty') }}
</span>
<on-the-fly <on-the-fly
type="thirdparty" type="thirdparty"
v-bind:id="item.result.id" v-bind:id="item.result.id"
action="show"> action="show">
</on-the-fly> </on-the-fly>
</div> </div>
</template> </template>
<script> <script>
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
const i18n = { const i18n = {
messages: { messages: {
@ -60,7 +50,8 @@ const i18n = {
export default { export default {
name: 'SuggestionThirdParty', name: 'SuggestionThirdParty',
components: { components: {
OnTheFly OnTheFly,
BadgeEntity
}, },
props: ['item'], props: ['item'],
i18n, i18n,

View File

@ -23,7 +23,11 @@
</span> </span>
<span v-if="options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span> <span v-if="options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span>
<span v-if="options.addEntity == true" class="badge rounded-pill bg-person">{{ $t('renderbox.person') }}</span>
<badge-entity v-if="options.addEntity === true"
:entity="person"
:options="{ displayLong: options.entityDisplayLong }">
</badge-entity>
</div> </div>
@ -139,12 +143,14 @@
import {dateToISO} from 'ChillMainAssets/chill/js/date.js'; import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue'; import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
export default { export default {
name: "PersonRenderBox", name: "PersonRenderBox",
components: { components: {
AddressRenderBox, AddressRenderBox,
Confidential Confidential,
BadgeEntity
}, },
props: ['person', 'options', 'render', 'returnPath'], props: ['person', 'options', 'render', 'returnPath'],
computed: { computed: {

View File

@ -1,39 +1,12 @@
@import 'ChillMainAssets/module/bootstrap/shared'; @import 'ChillMainAssets/module/bootstrap/shared';
/// Specific badge rounded-pill /// Specific badge rounded-pill
/// bg-thirdparty-child -> Personne de contact
/// bg-thirdparty-company -> Personne morale
/// bg-thirdparty-contact -> Personne physique
.tp-type {
.badge.rounded-pill { .badge.rounded-pill {
&[class*='bg-thirdparty-'] { &.bg-thirdparty {
//@extend .$chill-ll-gray; //@extend .$chill-ll-gray;
background-color: $chill-ll-gray; background-color: $chill-ll-gray;
color: $chill-pink; color: $chill-pink;
} }
&.bg-thirdparty-default {
display: inline-block;
}
&.bg-thirdparty-child,
&.bg-thirdparty-company,
&.bg-thirdparty-contact {
display: none;
}
}
&:hover {
.badge.rounded-pill {
&.bg-thirdparty-default {
display: none;
}
&.bg-thirdparty-child,
&.bg-thirdparty-company,
&.bg-thirdparty-contact {
display: inline-block;
}
}
}
} }
/// force first column width in list /// force first column width in list

View File

@ -12,24 +12,14 @@
</a> </a>
<span class="name" v-else>{{ thirdparty.text }}</span> <span class="name" v-else>{{ thirdparty.text }}</span>
<span v-if="options.addId == true" class="id-number" :title="'n° ' + thirdparty.id"> <span v-if="options.addId === true" class="id-number" :title="'n° ' + thirdparty.id">
{{ thirdparty.id }} {{ thirdparty.id }}
</span> </span>
<span class="tp-type" v-if="options.addEntity === true"> <badge-entity v-if="options.addEntity === true"
<span class="badge rounded-pill bg-thirdparty-default"> :entity="thirdparty"
{{ $t('renderbox.type.thirdparty')}} :options="{ displayLong: options.entityDisplayLong }">
</span> </badge-entity>
<span class="badge rounded-pill bg-thirdparty-child" v-if="thirdparty.kind === 'child'">
{{ $t('tparty.child')}}
</span>
<span class="badge rounded-pill bg-thirdparty-company" v-else-if="thirdparty.kind === 'company'">
{{ $t('tparty.company')}}
</span>
<span class="badge rounded-pill bg-thirdparty-contact" v-else>
{{ $t('tparty.contact')}}
</span>
</span>
</div> </div>
<div v-if="hasParent"> <div v-if="hasParent">
@ -95,26 +85,15 @@
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import {dateToISO} from 'ChillMainAssets/chill/js/date.js'; import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue'; import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
const i18n = {
messages: {
fr: {
tparty: {
child: "Personne de contact",
company: "Personne morale",
contact: "Personne physique",
}
}
}
};
export default { export default {
name: "ThirdPartyRenderBox", name: "ThirdPartyRenderBox",
components: { components: {
AddressRenderBox, AddressRenderBox,
Confidential Confidential,
BadgeEntity
}, },
i18n,
props: ['thirdparty', 'options'], props: ['thirdparty', 'options'],
computed: { computed: {
isMultiline: function() { isMultiline: function() {

View File

@ -5,7 +5,8 @@
:thirdparty="thirdparty" :thirdparty="thirdparty"
:options="{ :options="{
addInfo: true, addInfo: true,
addEntity: false, addEntity: true,
entityDisplayLong: true,
addAltNames: true, addAltNames: true,
addId: true, addId: true,
addLink: false, addLink: false,