Merge branch 'master' into person_renderbox_thirdparty_onthefly

This commit is contained in:
2021-09-13 12:18:01 +02:00
37 changed files with 885 additions and 597 deletions

View File

@@ -87,7 +87,6 @@ div.person-view {
}
}
/*
* ACCOMPANYING_COURSE CONTEXT
* Header custom for Accompanying Course
@@ -125,7 +124,6 @@ abbr.referrer {
align-self: center; // in flex context
}
/*
* HOUSEHOLD CONTEXT
* Header custom for Household
@@ -157,12 +155,19 @@ div.banner {
span.badge-member {
flex-shrink: 0; flex-grow: 0; flex-basis: auto;
color: $white;
border: 1px solid #ffffff3b;
border: 1px solid transparentize($white, 0.75);
border-bottom: 3px solid transparentize( shade-color( $chill-green, 20%), 0.3);
border-radius: 8px;
padding: 0.4em 0.8em;
padding: 0.2em 0.7em;
margin-bottom: 0.2em;
margin-right: 0.3em;
&.holder { order: -1; }
&.holder {
order: -1;
.fa-holder .text-success {
color: transparentize( shade-color( $chill-green, 20%), 0.3) !important;
}
}
&.child { order: 2; }
}
}
@@ -179,3 +184,66 @@ div.banner {
}
}
}
div.household-resume {
display: flex;
flex-direction: row;
align-items: center;
div.col-address {
font-size: 120%;
padding-left: 1em;
}
div.col-comment {
//padding: 0;
margin-bottom: 1rem;
display: flex;
flex-direction: column;
> * > * {
& > .chill-user-quote {
margin: 1.5em -1.67em 0;
}
}
}
}
/*
* BADGES, MARKS, PINS
* for chill person theme
*/
// chill person badges
span.badge-person,
span.badge-thirdparty {
display: inline-block;
padding: 0 0.5em !important;
background-color: $white;
color: $dark;
border: 1px solid $chill-ll-gray;
border-bottom-width: 2px;
border-bottom-style: solid;
border-radius: 6px;
a {
text-decoration: none;
}
}
span.badge-person {
border-bottom-color: $chill-green;
}
// todo: move in thirdparty
span.badge-thirdparty {
border-bottom-color: shade-color($chill-pink, 10%);
}
// household holder mark
span.fa-holder {
width: 1em;
margin: -10px 0.3em -8px 0;
i:last-child {
font-weight: 900;
color: white;
font-size: 70%;
font-family: "Open Sans Extrabold";
}
}

View File

@@ -26,26 +26,3 @@
}
}
}
// specific chill badges
span.badge-person,
span.badge-thirdparty {
display: inline-block;
padding: 0 0.5em !important;
background-color: $white;
color: $dark;
border: 1px solid $chill-ll-gray;
border-bottom-width: 2px;
border-bottom-style: solid;
border-radius: 6px;
a {
text-decoration: none;
}
}
span.badge-person {
border-bottom-color: $chill-green;
}
// todo: move in thirdparty
span.badge-thirdparty {
border-bottom-color: shade-color($chill-pink, 10%);
}

View File

@@ -33,7 +33,7 @@ import AddressRenderBox from "ChillMainAssets/vuejs/_components/Entity/AddressRe
export default {
name: "ButtonLocation",
components: {
import AddressRenderBox from,
AddressRenderBox,
Modal,
},
props: ['person'],

View File

@@ -2,16 +2,44 @@
<div class="vue-component">
<h2><a name="section-10"></a>{{ $t('persons_associated.title')}}</h2>
<div v-if="participations.length > 0">
<div v-if="currentParticipations.length > 0">
<label class="col-form-label">{{ $tc('persons_associated.counter', counter) }}</label>
</div>
<div v-else>
<label class="chill-no-data-statement">{{ $tc('persons_associated.counter', counter) }}</label>
</div>
<div v-if="participationWithoutHousehold.length > 0" class="alert alert-warning no-household">
<i class="fa fa-warning fa-2x"></i>
<form method="GET" action="/fr/person/household/members/editor">
<div class="float-button bottom"><div class="box">
<div class="action">
<button class="btn btn-update" type="submit">{{ $t('persons_associated.update_household') }}</button>
</div>
<p class="mb-3">{{ $t('persons_associated.person_without_household_warning') }}</p>
<div class="form-check" v-for="p in participationWithoutHousehold">
<input type="checkbox"
class="form-check-input"
v-model="hasNoHousehold"
name="persons[]"
checked="checked"
:id="p.person.id"
:value="p.person.id"
/>
<label class="form-check-label" for="hasNoHousehold">
{{ p.person.text }}
</label>
</div>
<input type="hidden" name="expand_suggestions" value="true">
<input type="hidden" name="returnPath" :value="getReturnPath">
<input type="hidden" name="accompanying_period_id" :value="courseId">
</div></div>
</form>
</div>
<div class="flex-table mb-3">
<participation-item
v-for="participation in participations"
v-for="participation in currentParticipations"
v-bind:participation="participation"
v-bind:key="participation.id"
@remove="removeParticipation"
@@ -56,10 +84,24 @@ export default {
}
}
},
computed: mapState({
participations: state => state.accompanyingCourse.participations,
counter: state => state.accompanyingCourse.participations.length
}),
computed: {
...mapState({
courseId: state => state.accompanyingCourse.id,
participations: state => state.accompanyingCourse.participations
}),
currentParticipations() {
return this.participations.filter(p => p.endDate === null)
},
counter() {
return this.currentParticipations.length;
},
participationWithoutHousehold() {
return this.currentParticipations.filter(p => p.person.current_household_id === null);
},
getReturnPath() {
return window.location.pathname + window.location.search + window.location.hash;
}
},
methods: {
removeParticipation(item) {
//console.log('@@ CLICK remove participation: item', item);
@@ -81,3 +123,30 @@ export default {
}
}
</script>
<style lang="scss" scoped>
div#accompanying-course {
div.vue-component {
& > div.alert {
margin: 0 0 -1em;
}
div.no-household {
padding-bottom: 1.5em;
display: flex;
flex-direction: row;
& > i {
flex-basis: 1.5em; flex-grow: 0; flex-shrink: 0;
padding-top: 0.2em;
opacity: 0.75;
}
& > form {
flex-basis: auto;
div.action {
button.btn-update {
margin-right: 2em;
}
}
}
}
}
}
</style>

View File

@@ -5,11 +5,13 @@
addId : false,
addEntity: false,
addLink: false,
addHouseholdLink: true,
addAltNames: true,
addAge : true,
hLevel : 3,
}"
:person="participation.person">
:person="participation.person"
:returnPath="getAccompanyingCourseReturnPath">
<template v-slot:record-actions>
<ul class="record_actions">
@@ -40,34 +42,54 @@
<li>
<button v-if="!participation.endDate"
class="btn btn-sm btn-remove"
v-bind:title="$t('action.remove')"
@click.prevent="$emit('close', participation)">
v-bind:title="$t('persons_associated.leave_course')"
@click="modal.showModal = true">
</button>
<button v-else
class="btn btn-sm btn-remove disabled"></button>
</li>
</ul>
</template>
</person-render-box>
<teleport to="body">
<modal v-if="modal.showModal" :modalDialogClass="modal.modalDialogClass" @close="modal.showModal = false">
<template v-slot:header>
<h2 class="modal-title">{{ $t('persons_associated.sure') }}</h2>
</template>
<template v-slot:body>
<p>{{ $t('persons_associated.sure_description') }}</p>
</template>
<template v-slot:footer>
<button class="btn btn-danger" @click.prevent="$emit('close', participation)">
{{ $t('persons_associated.ok') }}
</button>
</template>
</modal>
</teleport>
</template>
<script>
import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
import ButtonLocation from '../ButtonLocation.vue';
import PersonRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/PersonRenderBox.vue';
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
export default {
name: 'ParticipationItem',
components: {
OnTheFly,
ButtonLocation,
PersonRenderBox
PersonRenderBox,
Modal
},
props: ['participation'],
emits: ['remove', 'close'],
data() {
return {
modal: {
showModal: false,
modalDialogClass: "modal-dialog-centered modal-md"
},
PersonRenderBox: {
participation: 'participation',
options: {
@@ -86,6 +108,9 @@ export default {
return true;
}
return false;
},
getAccompanyingCourseReturnPath() {
return `fr/parcours/${this.$store.state.accompanyingCourse.id}/edit#section-10`;
}
}
}
@@ -93,10 +118,7 @@ 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">

View File

@@ -42,6 +42,14 @@ const appMessages = {
enddate: "Date de sortie",
add_persons: "Ajouter des usagers",
date_start_to_end: "Participation du {start} au {end}",
leave_course: "L'usager quitte le parcours",
sure: "Êtes-vous sûr ?",
sure_description: "Une fois confirmé, il ne sera pas possible de faire marche arrière ! La sortie reste cependant consignée dans l'historique du parcours.",
ok: "Oui, l'usager quitte le parcours",
show_household_number: "Voir le ménage (n° {id})",
show_household: "Voir le ménage",
person_without_household_warning: "Certaines personnes n'appartiennent à aucun ménage actuellement. Renseignez leur appartenance à un ménage dès que possible.",
update_household: "Modifier l'appartenance",
},
requestor: {
title: "Demandeur",

View File

@@ -35,7 +35,7 @@
<ul>
<li v-for="p in personsReachables" :key="p.id">
<input type="checkbox" :value="p.id" v-model="personsPicked">
<person-render-box render="badge" :person="p"></person-render-box>
<person-render-box render="badge" :options="{}" :person="p"></person-render-box>
</li>
</ul>
</div>

View File

@@ -122,7 +122,7 @@
<ul>
<li v-for="p in personsReachables" :key="p.id">
<input v-model="personsPicked" :value="p.id" type="checkbox">
<person-render-box render="badge" :person="p"></person-render-box>
<person-render-box render="badge" :options="{}" :person="p"></person-render-box>
</li>
</ul>
</div>

View File

@@ -25,7 +25,7 @@
<div class="item-row">
<div class="item-col">
<div>
<person-render-box render="badge" :person="conc.person"></person-render-box>
<person-render-box render="badge" :options="{}" :person="conc.person"></person-render-box>
</div>
<div v-if="conc.person.birthdate !== null">
{{ $t('person.born', {'gender': conc.person.gender} ) }}

View File

@@ -3,7 +3,7 @@
<div class="item-row">
<div class="item-col">
<div>
<person-render-box render="badge" :person="conc.person"></person-render-box>
<person-render-box render="badge" :options="{}" :person="conc.person"></person-render-box>
<span v-if="isHolder" class="badge bg-primary holder">
{{ $t('household_members_editor.holder') }}
</span>

View File

@@ -1,48 +0,0 @@
// CURRENTLY NOT IN USE
<template>
<li v-if="address" class="chill-entity entity-address">
<i v-if="options.with_picto == true" class="fa fa-fw fa-map-marker"></i>
<span v-if="options.render == 'list' || options.render == 'list'" :class="'address ' + {'multiline' : options.multiline === true}">
<!-- if address.street is not empty -->
<p v-if="address.street" class="street">{{ address.street }}
<!-- if address.streetNumber is not empty -->
<span v-if="address.streetNumber" class="streetnumber">{{ address.streetNumber }}</span>
</p>
<!-- if options['extended_infos'] -->
<div v-if="options.extended_infos == true">
<span v-if="address.floor" class="floor">{{ address.floor }}</span>
<span v-if="address.corridor" class="corridor">{{ address.corridor }}</span>
<span v-if="address.steps" class="steps">{{ address.steps }}</span>
<span v-if="address.buildingName" class="buildingName">{{ address.buildingName }}</span>
<span v-if="address.flat" class="flat">{{ address.flat }}</span>
<span v-if="address.distribution" class="distribution">{{ address.distribution }}</span>
<span v-if="address.extra" class="extra">{{ address.extra }}</span>
</div>
<!-- if address.postCode is not empty -->
<div v-if="address.postCode">
<p class="postcode">
<span class="code">{{ address.postCode.code }}</span>
<span class="name">{{ address.postCode.name }}</span>
</p>
<p class="country">{{ address.postCode.country.name }}</p>
</div>
</span>
</li>
</template>
<script>
export default{
name: "AddressRenderBox",
props: ['address', 'options']
}
</script>

View File

@@ -44,47 +44,67 @@
</div>
<div class="item-col">
<ul class="list-content fa-ul">
<div class="float-button bottom">
<div class="box">
<div class="action">
<slot name="record-actions"></slot>
</div>
<ul class="list-content fa-ul">
<li v-if="person.current_household_address">
<i class="fa fa-li fa-map-marker"></i>
<address-render-box :address="person.current_household_address" :isMultiline="isMultiline"></address-render-box>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-map-marker"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<li v-if="person.current_household_id">
<i class="fa fa-li fa-map-marker"></i>
<address-render-box v-if="person.current_household_address"
:address="person.current_household_address"
:isMultiline="isMultiline">
</address-render-box>
<p v-else class="chill-no-data-statement">
{{ $t('renderbox.household_without_address') }}
</p>
<a v-if="options.addHouseholdLink === true"
:href="getCurrentHouseholdUrl"
:title="$t('persons_associated.show_household_number', {id: person.current_household_id})">
<span class="badge rounded-pill bg-chill-beige">
<i class="fa fa-fw fa-home"></i><!--{{ $t('persons_associated.show_household') }}-->
</span>
</a>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-map-marker"></i>
<p class="chill-no-data-statement">
{{ $t('renderbox.no_data') }}
</p>
</li>
<li v-if="person.mobilenumber">
<i class="fa fa-li fa-mobile"></i>
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-mobile"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<li v-if="person.phonenumber">
<i class="fa fa-li fa-phone"></i>
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-phone"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<li v-if="person.mobilenumber">
<i class="fa fa-li fa-mobile"></i>
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-mobile"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<li v-if="person.phonenumber">
<i class="fa fa-li fa-phone"></i>
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-phone"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<li v-if="person.center && options.addCenter">
<i class="fa fa-li fa-long-arrow-right"></i>
{{ person.center.name }}
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-long-arrow-right"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<slot name="custom-zone"></slot>
<li v-if="person.center && options.addCenter">
<i class="fa fa-li fa-long-arrow-right"></i>
{{ person.center.name }}
</li>
<li v-else-if="options.addNoData">
<i class="fa fa-li fa-long-arrow-right"></i>
<p class="chill-no-data-statement">{{ $t('renderbox.no_data') }}</p>
</li>
<slot name="custom-zone"></slot>
</ul>
<slot name="record-actions"></slot>
</ul>
</div>
</div>
</div>
</div>
@@ -119,7 +139,7 @@ export default {
components: {
AddressRenderBox
},
props: ['person', 'options', 'render'],
props: ['person', 'options', 'render', 'returnPath'],
computed: {
getGenderTranslation: function() {
return this.person.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
@@ -155,12 +175,12 @@ export default {
return "";
}
},
altNameLabel: function(){
altNameLabel: function() {
for(let i = 0; i < this.person.altNames.length; i++){
return this.person.altNames[i].label
}
},
altNameKey: function(){
altNameKey: function() {
for(let i = 0; i < this.person.altNames.length; i++){
return this.person.altNames[i].key
}
@@ -168,7 +188,7 @@ export default {
getUrl: function() {
return `/fr/person/${this.person.id}/general`;
},
getAge: function(){
getAge: function() {
if(this.person.birthdate && !this.person.deathdate){
const birthday = new Date(this.person.birthdate.datetime)
const now = new Date()
@@ -184,6 +204,10 @@ export default {
// todo: change this
return "Age unknown"
}
},
getCurrentHouseholdUrl: function() {
let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``;
return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}`
}
}
}
@@ -191,17 +215,6 @@ export default {
<style lang='scss'>
span.fa-holder {
width: 1em;
margin: -10px 0.3em -8px 0;
i:last-child {
font-weight: 900;
color: white;
font-size: 70%;
font-family: "Open Sans Extrabold";
}
}
.lastname:before{
content: " "
}