mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
location: fix error when there is no defaultFor defined for locationType entities
This commit is contained in:
parent
aad4b6e5d0
commit
f002d48efd
@ -63,6 +63,7 @@ export default {
|
||||
new Promise((resolve) => {
|
||||
getLocationTypeByDefaultFor('person').then(
|
||||
personLocationType => {
|
||||
if (personLocationType) {
|
||||
const personLocation = this.makeAccompanyingPeriodLocation(personLocationType);
|
||||
const concernedPersonsLocation =
|
||||
this.makeConcernedPersonsLocation(personLocationType);
|
||||
@ -77,12 +78,23 @@ export default {
|
||||
},
|
||||
{
|
||||
locationGroup: 'Parties concernées',
|
||||
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]},
|
||||
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]
|
||||
},
|
||||
{
|
||||
locationGroup: 'Autres localisations',
|
||||
locations: response.results
|
||||
}
|
||||
];
|
||||
}
|
||||
)
|
||||
} else {
|
||||
this.locations = [
|
||||
{
|
||||
locationGroup: 'Localisations',
|
||||
locations: response.results
|
||||
}
|
||||
];
|
||||
}
|
||||
if (window.default_location_id) {
|
||||
let location = this.locations.filter(
|
||||
(l) => l.id === window.default_location_id
|
||||
@ -92,8 +104,6 @@ export default {
|
||||
resolve();
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
);
|
||||
},
|
||||
@ -102,11 +112,13 @@ export default {
|
||||
return `${value.address.text} (${value.locationType.title.fr})`
|
||||
},
|
||||
customLabel(value) {
|
||||
return value.name ?
|
||||
value.name === '__AccompanyingCourseLocation__' ?
|
||||
this.labelAccompanyingCourseLocation(value) :
|
||||
`${value.name} (${value.locationType.title.fr})` :
|
||||
value.locationType.title.fr;
|
||||
return value.locationType
|
||||
? value.name
|
||||
? value.name === '__AccompanyingCourseLocation__'
|
||||
? this.labelAccompanyingCourseLocation(value)
|
||||
: `${value.name} (${value.locationType.title.fr})`
|
||||
: value.locationType.title.fr
|
||||
: '';
|
||||
},
|
||||
makeConcernedPersonsLocation(locationType) {
|
||||
let locations = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user