Merge remote-tracking branch 'origin/master' into issue491_thirdparty_edit_modal

This commit is contained in:
2022-03-24 18:44:42 +01:00
146 changed files with 1835 additions and 1018 deletions

View File

@@ -176,6 +176,47 @@ div[class*='activity-'] {
}
}
div[class*='budget-'] {
div.dashboard,
h4.badge-title,
h3.badge-title,
h2.badge-title {
span.title_label {
// Calculate same color then border:groove
&_resource {
background-color: shade-color($budget-resource-color, 34%);
}
&_charge {
background-color: shade-color($budget-charge-color, 34%);
}
h3 {
color: $white;
}
}
span.title_action {
&_resource {
@include dashboard_like_badge($budget-resource-color);
}
&_charge {
@include dashboard_like_badge($budget-charge-color);
}
}
span.title_label {
div.duration {
font-size: 70%;
font-weight: 500;
p {
margin-bottom: 0;
text-align: right;
abbr {
text-decoration: none;
}
}
}
}
}
}
/*
* Pill badge by entity
*/

View File

@@ -113,7 +113,18 @@
</template>
</modal>
</teleport>
<ul class="record_actions sticky-form-buttons">
<li>
<add-persons
buttonTitle="visgraph.add_person"
modalTitle="visgraph.add_person"
v-bind:key="addPersons.key"
v-bind:options="addPersons.options"
@addNewPersons="addNewPersons"
ref="addPersons">
</add-persons>
</li>
</ul>
</template>
<script>
@@ -124,12 +135,14 @@ import VueMultiselect from 'vue-multiselect'
import { getRelationsList, postRelationship, patchRelationship, deleteRelationship } from "./api"
import { splitId, getAge } from "./vis-network"
import { visMessages } from "./i18n";
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
export default {
name: "App",
components: {
Modal,
VueMultiselect
VueMultiselect,
AddPersons
},
props: ['household_id'],
data() {
@@ -159,6 +172,14 @@ export default {
},
canvas: null,
link: null,
addPersons: {
key: 'filiation',
options: {
type: ['person'],
priority: null,
uniq: false,
}
}
}
},
computed: {
@@ -235,12 +256,28 @@ export default {
this.initGraph()
this.listenOnGraph()
this.getRelationsList()
console.log(this.persons);
this.canvas = document.getElementById('visgraph').querySelector('canvas')
this.link = document.getElementById('exportCanvasBtn')
},
methods: {
addNewPersons({ selected, modal }) {
// console.log('@@@ CLICK button addNewPersons', selected);
selected.forEach(function(item) {
this.$store.dispatch('addMorePerson', item.result)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: violations})
}
});
}, this
);
this.$refs.addPersons.resetSearch(); // to cast child method
modal.showModal = false;
},
initGraph() {
this.container = document.getElementById('visgraph')
// Instanciate vis objects in separate window variables, see vis-network.js

View File

@@ -1,5 +1,11 @@
const visMessages = {
fr: {
add_persons: {
title: "Ajouter des usagers",
suggested_counter: "Pas de résultats | 1 résultat | {count} résultats",
selected_counter: " 1 sélectionné | {count} sélectionnés",
search_some_persons: "Rechercher des personnes..",
},
visgraph: {
Course: 'Parcours',
Household: 'Ménage',
@@ -21,12 +27,48 @@ const visMessages = {
between: "entre",
and: "et",
add_link: "Créer un lien de filiation",
add_person: "Ajouter une personne",
create_link_help: "Pour créer un lien de filiation, cliquez d'abord sur un usager, puis sur un second ; précisez ensuite la nature du lien dans le formulaire d'édition.",
refresh: "Rafraîchir",
screenshot: "Prendre une photo",
choose_relation: "Choisissez le lien de parenté",
relationship_household: "Filiation du ménage",
},
item: {
type_person: "Usager",
type_user: "TMS",
type_thirdparty: "Tiers professionnel",
type_household: "Ménage"
},
person: {
firstname: "Prénom",
lastname: "Nom",
born: (ctx) => {
if (ctx.gender === 'man') {
return 'Né le';
} else if (ctx.gender === 'woman') {
return 'Née le';
} else {
return 'Né·e le';
}
},
center_id: "Identifiant du centre",
center_type: "Type de centre",
center_name: "Territoire", // vendée
phonenumber: "Téléphone",
mobilenumber: "Mobile",
altnames: "Autres noms",
email: "Courriel",
gender: {
title: "Genre",
placeholder: "Choisissez le genre de l'usager",
woman: "Féminin",
man: "Masculin",
neuter: "Neutre, non binaire",
undefined: "Non renseigné"
}
},
error_only_one_person: "Une seule personne peut être sélectionnée !",
edit: 'Éditer',
del: 'Supprimer',
back: 'Revenir en arrière',

View File

@@ -117,10 +117,27 @@ const store = createStore({
return group
},
getPersonById: (state) => (person_id) => {
return state.persons.find(p => p._id === person_id);
}
},
mutations: {
addPerson(state, [person, options]) {
if (!'_id' in person) {
person._id = person.id
person.id = `person_${person.id}`
}
let existing = state.persons.find(p => p._id === person._id);
if (typeof existing !== 'undefined') {
if (!options.folded && person.folded) {
// unfold
}
return;
}
let age = getAge(person)
age = (age === '')? '' : ' - ' + age
@@ -232,6 +249,9 @@ const store = createStore({
//// unfold
unfoldPerson(state, person) {
if (!person.folded) {
return;
}
//console.log('unfoldPerson', person)
person.label = person._label
delete person._label
@@ -261,6 +281,31 @@ const store = createStore({
dispatch('fetchInfoForPerson', person)
},
/**
* Add a person manually
*
* @param commit
* @param dispatch
* @param person
*/
addMorePerson({ commit, dispatch, getters }, person) {
let nodeId = `person_${person.id}`;
if (getters.isPersonLoaded(person.id)) {
if (getters.isExcludedNode(nodeId)) {
commit('removeExcludedNode', nodeId);
let p = getters.getPersonById(person.id);
if (typeof p !== 'undefined') {
commit('unfoldPerson', p);
} else {
throw 'a person loaded was not found';
}
commit('updateHack');
}
} else {
return dispatch('addPerson', person);
}
},
/**
* 2) Fetch infos for this person (hub)
* @param object
@@ -287,7 +332,7 @@ const store = createStore({
//console.log(' isHouseholdLoading ?', getters.isHouseholdLoading(person.current_household_id))
if (! getters.isHouseholdLoading(person.current_household_id)) {
commit('markHouseholdLoading', person.current_household_id)
getHouseholdByPerson(person)
return getHouseholdByPerson(person)
.then(household => new Promise(resolve => {
commit('addHousehold', household)
// DISABLED: in init or expand loop, layer is uncheck when added
@@ -295,7 +340,7 @@ const store = createStore({
//commit('updateHack')
dispatch('addLinkFromPersonsToHousehold', household)
commit('updateHack')
resolve()
resolve();
})
).catch( () => {
commit('unmarkHouseholdLoading', person.current_household_id)
@@ -335,7 +380,7 @@ const store = createStore({
* @param person
*/
fetchCoursesByPerson({ commit, dispatch }, person) {
getCoursesByPerson(person)
return getCoursesByPerson(person)
.then(courses => new Promise(resolve => {
dispatch('addCourses', courses)
resolve()
@@ -383,6 +428,8 @@ const store = createStore({
dispatch('addMissingPerson', [p.person, course])
}
})
return Promise.resolve();
},
/**

View File

@@ -164,14 +164,8 @@ const getGender = (gender) => {
* @returns {string|null}
*/
const getAge = (person) => {
if (person.birthdate) {
let birthdate = new Date(person.birthdate.datetime)
if (person.deathdate) {
let deathdate = new Date(person.deathdate.datetime)
return (deathdate.getFullYear() - birthdate.getFullYear()) + visMessages.fr.visgraph.years
}
let now = new Date()
return (now.getFullYear() - birthdate.getFullYear()) + visMessages.fr.visgraph.years
if (person.age) {
return person.age + ' ' + visMessages.fr.visgraph.years;
}
return ''
}

View File

@@ -18,7 +18,7 @@
{% block title page_title %}
{% block personcontent %}
{% block content %}
<h1>{{ page_title }}</h1>

View File

@@ -4,7 +4,7 @@
{% block title %}{{ 'Accompanying period list for person'|trans }}{% endblock title %}
{% block personcontent %}
{% block content %}
<div class="person-accompanyingperiods">
<h1>{{ 'Accompanying period list'|trans }}</h1>

View File

@@ -4,7 +4,7 @@
{% block title 'Re-Open a period'|trans %}
{% block personcontent %}
{% block content %}
<h1>{{ 'Re-Open a period'|trans }}</h1>

View File

@@ -20,7 +20,7 @@
{% block title 'Edit an address'|trans %}
{% block personcontent %}
{% block content %}
<div class="address-edit">
{% block content %}

View File

@@ -20,7 +20,7 @@
{% block title %}{{ 'Addresses history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="person-address">
<h1>{{ 'Addresses history'|trans }}</h1>

View File

@@ -20,7 +20,7 @@
{% block title %}{{ 'New address'|trans }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="address-new">
{% block content %}

View File

@@ -3,7 +3,7 @@
{% set person = entity.person %}
{% set activeRouteKey = '' %}
{% block personcontent %}
{% block content %}
{% embed '@ChillMain/CRUD/_delete_content.html.twig' %}
{% endembed %}
{% endblock %}

View File

@@ -7,7 +7,7 @@
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock title %}
{% block personcontent %}
{% block content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% endembed %}
{% endblock %}

View File

@@ -4,7 +4,7 @@
{% block title %}{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}{% endblock %}
{% block personcontent %}
{% block content %}
{% embed '@ChillPerson/CRUD/_index.html.twig' %}
{% block add_new %}
<li>

View File

@@ -7,7 +7,7 @@
{% embed('@ChillPerson/CRUD/_new_title.html.twig') %}{% endembed %}
{% endblock %}
{% block personcontent %}
{% block content %}
{% embed '@ChillPerson/CRUD/_new_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ ('crud.'~crud_name~'.title_new')|trans({'%person%': person|chill_entity_render_string }) }}</h1>

View File

@@ -7,7 +7,7 @@
{% include('@ChillPerson/CRUD/_view_title.html.twig') %}
{% endblock %}
{% block personcontent %}
{% block content %}
{% embed '@ChillPerson/CRUD/_view_content.html.twig' %}
{% block crud_content_header %}
<h1>{{ ('crud.' ~ crud_name ~ '.title_view')|trans({'%person%': person|chill_entity_render_string }) }}</h1>

View File

@@ -20,7 +20,7 @@
{% block title %}{{ 'Update details for %name%'|trans({ '%name%': person|chill_entity_render_string } ) }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="person-edit">
<h1>{{ block('title') }}</h1>

View File

@@ -84,7 +84,7 @@
</div>
{% endmacro %}
{% block personcontent %}
{% block content %}
<div class="person-household">
<h1>{{ 'household.Household history'|trans }}</h1>

View File

@@ -25,7 +25,7 @@
{% block layout_wvm_content %}
<div class="row justify-content-center">
<div class="col-md-10 col-xxl">
{% block personcontent %}{# block personcontent empty #}{% endblock %}
{% block content %}{# block content empty #}{% endblock %}
</div>
</div>
{% endblock %}

View File

@@ -32,7 +32,7 @@ This view should receive those arguments:
{% set edit_tmp_args = { 'form_path_args' : { 'person_id': person.id },
'form_path_key' : 'chill_person_general_edit' } %}
{% block personcontent %}
{% block content %}
<div class="person-view">
<div class="row">

View File

@@ -6,7 +6,7 @@
' ' ~ person.lastName }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="person-duplicate">
<h1>{{ 'Désigner un dossier doublon'|trans }}</h1>

View File

@@ -5,7 +5,7 @@
{% block title %}{{ 'Person duplicate'|trans|capitalize ~ ' ' ~ person.firstName|capitalize ~
' ' ~ person.lastName }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="person-duplicate">
<h1>{{ title|default('Person duplicate')|trans }}</h1>

View File

@@ -5,7 +5,7 @@
{% block title 'Remove resource'|trans %}
{% block personcontent %}
{% block content %}
{{ include('@ChillMain/Util/confirmation_template.html.twig',
{
'title' : 'Remove resource'|trans,

View File

@@ -14,7 +14,7 @@
{% block title %}{{ 'edit resource'|trans|capitalize }}{% endblock %}
{% block personcontent %}
{% block content %}
<h1 style="margin-bottom: 2rem;">{{ 'edit resource'|trans }}</h1>

View File

@@ -14,7 +14,7 @@
{{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}
{% block personcontent %}
{% block content %}
<h1>{{ 'List of resources'|trans }}</h1>

View File

@@ -4,7 +4,7 @@
{% block title %}{{ 'Delete residential address'|trans }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="address-new">
<h1>{{ block('title') }}</h1>

View File

@@ -4,7 +4,7 @@
{% block title 'Edit a residential address'|trans %}
{% block personcontent %}
{% block content %}
<div class="address-edit">
{% block content %}

View File

@@ -4,7 +4,7 @@
{% block title %}{{ 'Residential addresses history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="person-address">
<h1>{{ 'Residential addresses history'|trans }}</h1>

View File

@@ -4,7 +4,7 @@
{% block title %}{{ 'New residential address'|trans }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="address-new">
{% block content %}

View File

@@ -26,7 +26,7 @@ This view should receive those arguments:
{% block title %}{{ 'Timeline for %name%'|trans({'%name%': person }) }}{% endblock %}
{% block personcontent %}
{% block content %}
<div class="timeline">
{{ timeline|raw }}