Merge branch 'ameliorations_composants_vue' into improve_ux

This commit is contained in:
Mathieu Jaumotte 2021-08-20 00:40:42 +02:00
commit e711ac1feb
8 changed files with 145 additions and 164 deletions

View File

@ -98,6 +98,14 @@ export default {
} }
} }
div.flex-table {
div.item-row {
div.item-col:first-child {
flex-basis: 33%;
}
}
}
&.errors { &.errors {
//display: flex; //display: flex;
//position: sticky; //position: sticky;

View File

@ -2,7 +2,7 @@
<person-render-box <person-render-box
:options="{ :options="{
addInfo : true, addInfo : true,
addId : true, addId : false,
addEntity: false, addEntity: false,
addLink: false, addLink: false,
addAltNames: true, addAltNames: true,
@ -13,6 +13,10 @@
<template v-slot:record-actions> <template v-slot:record-actions>
<ul class="record_actions"> <ul class="record_actions">
<button-location
v-if="hasCurrentHouseholdAddress"
v-bind:person="participation.person">
</button-location>
<li> <li>
<on-the-fly <on-the-fly
v-bind:type="participation.person.type" v-bind:type="participation.person.type"
@ -39,23 +43,13 @@
v-bind:title="$t('action.remove')" v-bind:title="$t('action.remove')"
@click.prevent="$emit('close', participation)"> @click.prevent="$emit('close', participation)">
</button> </button>
<button v-else class="btn btn-sm btn-remove disabled"></button> <button v-else
class="btn btn-sm btn-remove disabled"></button>
</li> </li>
</ul> </ul>
</template> </template>
</person-render-box> </person-render-box>
<!-- dates of participation
<tr>
<td><span v-if="participation.startDate">
{{ $d(participation.startDate.datetime, 'short') }}</span>
</td>
<td><span v-if="participation.endDate">
{{ $d(participation.endDate.datetime, 'short') }}</span>
</td>
</tr>
-->
</template> </template>
<script> <script>
@ -95,4 +89,23 @@ export default {
} }
} }
} }
/*
* dates of participation
*
* :title="$t('persons_associated.date_start_to_end', {
* start: $d(participation.startDate.datetime, 'short'),
* end: $d(participation.endDate.datetime, 'short')
* })"
*
* <tr>
* <td><span v-if="participation.startDate">
* {{ $d(participation.startDate.datetime, 'short') }}</span>
* </td>
* <td><span v-if="participation.endDate">
* {{ $d(participation.endDate.datetime, 'short') }}</span>
* </td>
* </tr>
*
*/
</script> </script>

View File

@ -9,9 +9,30 @@
<input type="checkbox" v-model="isAnonymous" class="me-2" /> <input type="checkbox" v-model="isAnonymous" class="me-2" />
{{ $t('requestor.is_anonymous') }} {{ $t('requestor.is_anonymous') }}
</label> </label>
<div class="item-bloc"> <!-- <div class="flex-bloc row row-cols-1 g-0"> -->
<h4> <third-party-render-box v-if="accompanyingCourse.requestor.type == 'thirdparty'"
:thirdparty="accompanyingCourse.requestor"
:options="{
addLink: false,
addId: false,
addEntity: true,
addInfo: true
}"
></third-party-render-box>
<person-render-box v-else-if="accompanyingCourse.requestor.type == 'person'"
:person="accompanyingCourse.requestor"
:options="{
addLink: false,
addId: false,
addAltNames: false,
addEntity: true,
addInfo: true
}"
></person-render-box>
<!-- </div> -->
<!-- <h4>
<span class="badge rounded-pill bg-secondary">{{ accompanyingCourse.requestor.type }}</span> <span class="badge rounded-pill bg-secondary">{{ accompanyingCourse.requestor.type }}</span>
{{ accompanyingCourse.requestor.text }} {{ accompanyingCourse.requestor.text }}
</h4> </h4>
@ -54,8 +75,8 @@
action="edit"> action="edit">
</on-the-fly> </on-the-fly>
</li> </li>
</ul> </ul> -->
</div>
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
<button class="btn btn-remove" <button class="btn btn-remove"
@ -87,12 +108,16 @@
<script> <script>
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue'; import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
export default { export default {
name: 'Requestor', name: 'Requestor',
components: { components: {
AddPersons, AddPersons,
OnTheFly OnTheFly,
PersonRenderBox,
ThirdPartyRenderBox,
}, },
data() { data() {
return { return {

View File

@ -1,59 +1,54 @@
<template> <template>
<third-party-render-box <person-render-box
:options="{ v-if="resource.resource.type === 'person'"
addLink : false, :person="resource.resource"
addId : false, :options="{ addInfo : true, addId : false, addEntity: true, addLink: false, addAltNames: true, addAge : false, hLevel : 1 }"
addEntity: true, >
addInfo: true <template v-slot:record-actions>
}" <ul class="record_actions">
:thirdparty="resource"> <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><on-the-fly :type="resource.resource.type" :id="resource.resource.id" action="edit"></on-the-fly></li>
<li><button class="btn btn-sm btn-remove" :title="$t('action.remove')" @click.prevent="$emit('remove', resource)"></button></li>
</ul>
</template>
<template v-slot:record-actions> </person-render-box>
<ul class="record_actions"> <third-party-render-box
<li> v-if="resource.resource.type === 'thirdparty'"
<on-the-fly :thirdparty="resource.resource"
v-bind:type="resource.resource.type" :options="{ addLink : false, addId : false, addEntity: true, addInfo: true }"
v-bind:id="resource.resource.id" >
action="show"> <template v-slot:record-actions>
</on-the-fly> <ul class="record_actions">
</li> <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"></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>
v-bind:type="resource.resource.type" </ul>
v-bind:id="resource.resource.id" </template>
action="edit">
</on-the-fly> </third-party-render-box>
</li>
<li>
<button
class="btn btn-sm btn-remove"
v-bind:title="$t('action.remove')"
@click.prevent="$emit('remove', resource)">
</button>
</li>
</ul>
</template>
</third-party-render-box>
</template> </template>
<script> <script>
import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue'; import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
import ButtonLocation from '../ButtonLocation.vue'; import ButtonLocation from '../ButtonLocation.vue';
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue' import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue';
export default { export default {
name: 'ResourceItem', name: 'ResourceItem',
components: { components: {
OnTheFly, OnTheFly,
ButtonLocation, ButtonLocation,
PersonRenderBox,
ThirdPartyRenderBox ThirdPartyRenderBox
}, },
props: ['resource'], props: ['resource'],
emits: ['remove'], emits: ['remove'],
computed: { computed: {
hasCurrentHouseholdAddress() { hasCurrentHouseholdAddress() {
if ( this.resource.resource.type === 'person' if ( this.resource.resource.current_household_address !== null ) {
&& this.resource.resource.current_household_address !== null ) {
return true; return true;
} }
return false; return false;

View File

@ -41,6 +41,7 @@ const appMessages = {
startdate: "Date d'entrée", startdate: "Date d'entrée",
enddate: "Date de sortie", enddate: "Date de sortie",
add_persons: "Ajouter des usagers", add_persons: "Ajouter des usagers",
date_start_to_end: "Participation du {start} au {end}",
}, },
requestor: { requestor: {
title: "Demandeur", title: "Demandeur",

View File

@ -1,51 +1,33 @@
<template> <template>
<div class="item-bloc">
<div class="item-bloc">
<section class="chill-entity entity-person"> <section class="chill-entity entity-person">
<!-- ENTIRE RENDER_BOX -->
<div class="item-row entity-bloc"> <div class="item-row entity-bloc">
<!-- LABEL -->
<div class="item-col"> <div class="item-col">
<div class="entity-label"> <div class="entity-label">
<!-- NAME TAG -->
<!-- todo: make h class dynamic -->
<div class="denomination h3"> <div class="denomination h3">
<!-- NAME IF ADD LINK AND PERMISSION GRANTED --> <a v-if="this.options.addLink == true" href="#">
<!-- todo: change href -->
<a v-if="this.options.addLink == true" href="#">
<span class="firstname">{{ person.firstName }}</span> <span class="firstname">{{ person.firstName }}</span>
<span class="lastname">{{ person.lastName }}</span> <span class="lastname">{{ person.lastName }}</span>
<!-- IF ALT NAMES -->
<span v-if="this.options.addAltNames == true" class="altnames"> <span v-if="this.options.addAltNames == true" class="altnames">
<!-- LOOP THROUGH ALT NAMES -->
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span> <span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
<!-- END LOOP -->
</span> </span>
</a> </a>
<!-- WITHOUT LINK JUST NAME --> <span class="firstname">{{ person.firstName }}</span>
<span class="firstname">{{ person.firstName }}</span> <span class="lastname">{{ person.lastName }}</span>
<span class="lastname">{{ person.lastName }}</span> <span v-if="this.options.addAltNames == true" class="altnames">
<!-- IF ALT NAMES --> <span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
<span v-if="this.options.addAltNames == true" class="altnames"> </span>
<!-- LOOP THROUGH ALT NAMES -->
<span :class="'altname altname-' + altNameKey">{{ altNameLabel }}</span>
<!-- END LOOP -->
</span>
<!-- IF ADD ENTITY OPTION --> <span v-if="this.options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span>
<span v-if="this.options.addEntity == true" class="badge rounded-pill bg-secondary">{{ $t('renderbox.person') }}</span> <span v-if="this.options.addEntity == true" class="badge rounded-pill bg-secondary">{{ $t('renderbox.person') }}</span>
<span v-if="this.options.addId == true" class="id-number" :title="'n° ' + person.id">{{ person.id }}</span>
</div> </div>
<!-- END NAME TAG -->
<!-- BIRTHDATE / DEATHDATE AND AGE -->
<p v-if="this.options.addInfo == true" class="moreinfo"> <p v-if="this.options.addInfo == true" class="moreinfo">
<!-- todo: change icon if person is deceased? -->
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i> <i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
<time v-if="person.birthdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}"> <time v-if="person.birthdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
{{ $t(getGender) + ' ' + $d(birthdate, 'text') }} {{ $t(getGender) + ' ' + $d(birthdate, 'text') }}
@ -55,47 +37,34 @@
</time> </time>
<span class="age">{{ person.age }}</span> <span class="age">{{ person.age }}</span>
</p> </p>
<!-- END BIRTH/DEATH AND AGE -->
</div> </div>
</div> </div>
<!-- END LABEL -->
<!-- CONTACT INFO AND ACTIONS--> <div class="item-col separator">
<div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<!-- ADDRESS -->
<li v-if="person.current_household_address"> <li v-if="person.current_household_address">
<i class="fa fa-li fa-map-marker"></i> <i class="fa fa-li fa-map-marker"></i>
<show-address :address="person.current_household_address" :isMultiline="false"></show-address> <show-address :address="person.current_household_address" :isMultiline="false"></show-address>
</li> </li>
<!-- PHONENUMBER --> <li v-if="person.mobilenumber">
<!-- todo: change href for phonenumbers and format phone number? -->
<li v-if="this.person.mobilenumber">
<i class="fa fa-li fa-mobile"></i> <i class="fa fa-li fa-mobile"></i>
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a> <a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
</li> </li>
<li v-else-if="this.person.phonenumber"> <li v-else-if="person.phonenumber">
<i class="fa fa-li fa-phone"></i> <i class="fa fa-li fa-phone"></i>
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a> <a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
</li> </li>
<span v-else class="chill-no-data-statement">{{ $t('renderbox.no_information') }}</span>
</ul> </ul>
<!-- END ADDRESS AND PHONE NUMBER -->
<!-- ACTION BUTTONS -->
<slot name="record-actions"></slot> <slot name="record-actions"></slot>
<!-- END ACTIONS -->
</div> </div>
<!-- END CONTACT INFO AND ACTIONS -->
</div> </div>
</section> </section>
</div> </div>
</template> </template>
<script> <script>
// import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
import {dateToISO} from 'ChillMainAssets/chill/js/date.js'; import {dateToISO} from 'ChillMainAssets/chill/js/date.js';
import ShowAddress from 'ChillMainAssets/vuejs/Address/components/ShowAddress.vue'; import ShowAddress from 'ChillMainAssets/vuejs/Address/components/ShowAddress.vue';
@ -130,16 +99,14 @@ export default {
return this.person.altNames[i].key return this.person.altNames[i].key
} }
}, },
} }
} }
</script> </script>
<style> <style>
.lastname:before{ .lastname:before{
content: " " content: " "
} }
</style> </style>

View File

@ -36,8 +36,11 @@
'args' : {'person_id': person.id, 'person': person }, 'args' : {'person_id': person.id, 'person': person },
'activeRouteKey': activeRouteKey 'activeRouteKey': activeRouteKey
}) }} }) }}
<div class="block-post-menu"> {% block block_post_menu %}
{{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }} <div class="block-post-menu">
</div> {{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }}
</div>
{% endblock %}
{% endblock %} {% endblock %}

View File

@ -1,82 +1,58 @@
<template> <template>
<div class="item-bloc"> <div class="item-bloc col">
<section class="chill-entity entity-person"> <section class="chill-entity entity-thirdparty">
<!-- ENTIRE RENDER_BOX -->
<div class="item-row entity-bloc"> <div class="item-row entity-bloc">
<!-- LABEL -->
<div class="item-col"> <div class="item-col">
<div class="entity-label"> <div class="entity-label">
<!-- NAME TAG -->
<!-- todo: make h class dynamic -->
<div class="denomination h3"> <div class="denomination h3">
<span v-if="options.addEntity == true && thirdparty.resource.type == 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
<span v-if="options.addEntity == true && thirdparty.resource.type == 'person'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.person') }}</span>
<!-- NAME IF ADD LINK AND PERMISSION GRANTED -->
<!-- todo: change href -->
<a v-if="this.options.addLink == true" href="#"> <a v-if="this.options.addLink == true" href="#">
<span class="name">{{ thirdparty.resource.text }}</span> <span class="name">{{ thirdparty.text }}</span>
</a> </a>
<!-- WITHOUT LINK JUST NAME --> <span class="name">{{ thirdparty.text }}</span>
<span class="name">{{ thirdparty.resource.text }}</span>
<!-- IF ADD ENTITY OPTION -->
<span v-if="options.addId == true" class="id-number" :title="'n° ' + thirdparty.id">{{ thirdparty.id }}</span> <span v-if="options.addId == true" class="id-number" :title="'n° ' + thirdparty.id">{{ thirdparty.id }}</span>
<span v-if="options.addEntity == true && thirdparty.type == 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
</div> </div>
<!-- END NAME TAG -->
<!-- EXTRA INFO -->
<p v-if="this.options.addInfo == true" class="moreinfo"> <p v-if="this.options.addInfo == true" class="moreinfo">
<!-- todo: change icon if person is deceased? --> <i v-if="thirdparty.birthdate" :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i> <time v-if="thirdparty.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
<time v-if="thirdparty.resource.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
{{ $t(getGender) + ' ' + $d(birthdate, 'short') }} {{ $t(getGender) + ' ' + $d(birthdate, 'short') }}
</time> </time>
<time v-else-if="thirdparty.resource.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}"> <time v-else-if="thirdparty.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}">
{{ birthdate }} - {{ deathdate }} {{ birthdate }} - {{ deathdate }}
</time> </time>
<span class="age">{{ thirdparty.age }}</span> <span class="age">{{ thirdparty.age }}</span>
</p> </p>
</div> </div>
</div> </div>
<!-- END LABEL -->
<!-- CONTACT INFO AND ACTIONS--> <div class="item-col separator">
<div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<!-- ADDRESS --> <li v-if="thirdparty.address">
<li v-if="thirdparty.resource.address">
<i class="fa fa-li fa-map-marker"></i> <i class="fa fa-li fa-map-marker"></i>
<show-address :address="thirdparty.resource.address" :isMultiline="false"></show-address> <show-address :address="thirdparty.address" :isMultiline="false"></show-address>
</li> </li>
<!-- PHONENUMBER --> <li v-if="thirdparty.telephone">
<!-- todo: change href for phonenumbers -->
<li>
<i class="fa fa-li fa-mobile"></i> <i class="fa fa-li fa-mobile"></i>
<a v-if="thirdparty.resource.telephone" :href="'tel: ' + thirdparty.resource.telephone">{{ thirdparty.resource.telephone }}</a> <a :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
<span v-else class="chill-no-data-statement">{{ $t('renderbox.no_information') }}</span>
</li> </li>
<li v-if="thirdparty.resource.type == 'thirdparty'"> <li v-if="thirdparty.email">
<i class="fa fa-li fa-envelope-o"></i> <i class="fa fa-li fa-envelope-o"></i>
<a v-if="thirdparty.resource.email" :href="'mailto: ' + thirdparty.resource.email">{{ thirdparty.resource.email }}</a> <a :href="'mailto: ' + thirdparty.email">{{ thirdparty.email }}</a>
<span v-else class="chill-no-data-statement">{{ $t('renderbox.no_information') }}</span>
</li> </li>
</ul>
<!-- END ADDRESS AND PHONE NUMBER -->
<!-- ACTION BUTTONS --> </ul>
<slot name="record-actions"></slot> <slot name="record-actions"></slot>
<!-- END ACTIONS -->
</div> </div>
<!-- END CONTACT INFO AND ACTIONS -->
</div> </div>
</section> </section>
</div> </div>
</template> </template>
@ -92,17 +68,17 @@ export default {
props: ['thirdparty', 'options'], props: ['thirdparty', 'options'],
computed: { computed: {
getGender: function() { getGender: function() {
return this.thirdparty.resource.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man'; return this.thirdparty.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
}, },
getGenderIcon: function() { getGenderIcon: function() {
return this.thirdparty.resource.gender == 'woman' ? 'fa-venus' : this.thirdparty.resource.gender == 'man' ? 'fa-mars' : 'fa-neuter'; return this.thirdparty.gender == 'woman' ? 'fa-venus' : this.thirdparty.gender == 'man' ? 'fa-mars' : 'fa-neuter';
}, },
birthdate: function(){ birthdate: function(){
var date = new Date(this.thirdparty.resource.birthdate.datetime); var date = new Date(this.thirdparty.birthdate.datetime);
return dateToISO(date); return dateToISO(date);
}, },
deathdate: function(){ deathdate: function(){
var date = new Date(this.thirdparty.resource.deathdate.datetime); var date = new Date(this.thirdparty.deathdate.datetime);
return dateToISO(date); return dateToISO(date);
}, },
} }
@ -110,18 +86,11 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.lastname{
&:before{
content: " "
}
}
.name{ .name{
&:before{ &:before{
content: " " content: " "
} }
} }
</style> </style>