vue_visgraph: improve household links (edges)

This commit is contained in:
2021-10-27 17:24:23 +02:00
parent 8ff581d5fa
commit 1d1a54f653
3 changed files with 54 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
import { createStore } from 'vuex'
import { getHouseholdByPerson, getCoursesByPerson, getRelationshipByPerson } from './api'
import { adapt2vis } from './vis-network'
import { adapt2vis, getHouseholdLabel, getHouseholdWidth } from './vis-network'
const debug = process.env.NODE_ENV !== 'production'
@@ -139,8 +139,8 @@ const store = createStore({
* @param Household household
*/
addLinkFromPersonsToHousehold({ commit }, household) {
const members = household.members.filter(v => household.current_members_id.includes(v.id))
members.forEach(m => {
const currentMembers = household.members.filter(v => household.current_members_id.includes(v.id))
currentMembers.forEach(m => {
//console.log('-> addLink from person', m.person.id, 'to household', m.person.current_household_id)
commit('addLink', {
from: `${m.person.type}_${m.person.id}`,
@@ -148,9 +148,9 @@ const store = createStore({
id: `p${m.person.id}-h${m.person.current_household_id}`,
arrows: 'from',
color: 'pink',
font: { color: 'pink' },
label: 'enfant',
////group: 'link_person_household',
font: { color: '#D04A60' },
label: getHouseholdLabel(m),
width: getHouseholdWidth(m),
})
})
@@ -203,9 +203,8 @@ const store = createStore({
id: `p${p.person.id}-c`+ course.id.split('_')[2],
arrows: 'to',
color: 'orange',
font: { color: 'orange' },
font: { color: 'darkorange' },
label: 'concerné',
//group: 'link_person_course',
})
})
},