mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
activity: add user current location as default for a new activity
This commit is contained in:
parent
cd4de2e244
commit
63e5220084
@ -55,16 +55,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getLocationsList();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
getLocationsList() {
|
|
||||||
getLocations().then(response => new Promise(resolve => {
|
getLocations().then(response => new Promise(resolve => {
|
||||||
console.log('getLocations', response);
|
console.log('getLocations', response);
|
||||||
this.locations = response.results;
|
this.locations = response.results;
|
||||||
|
if (window.default_location_id) {
|
||||||
|
let location = this.locations.filter(l => l.id === window.default_location_id);
|
||||||
|
this.$store.dispatch('updateLocation', location);
|
||||||
|
}
|
||||||
resolve();
|
resolve();
|
||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
customLabel(value) {
|
customLabel(value) {
|
||||||
return `${value.locationType.title.fr} ${value.name ? value.name : ''}`;
|
return `${value.locationType.title.fr} ${value.name ? value.name : ''}`;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
'{{ "You are going to leave a page with unsubmitted data. Are you sure you want to leave ?"|trans }}');
|
||||||
});
|
});
|
||||||
window.activity = {{ activity_json|json_encode|raw }};
|
window.activity = {{ activity_json|json_encode|raw }};
|
||||||
|
window.default_location_id = {{ default_location_id }};
|
||||||
</script>
|
</script>
|
||||||
{{ encore_entry_script_tags('vue_activity') }}
|
{{ encore_entry_script_tags('vue_activity') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -29,7 +29,7 @@ class UserCurrentLocationType extends AbstractType
|
|||||||
'class' => Location::class,
|
'class' => Location::class,
|
||||||
'choice_label' => function (Location $entity) {
|
'choice_label' => function (Location $entity) {
|
||||||
return $entity->getName() ?
|
return $entity->getName() ?
|
||||||
$entity->getName() :
|
$entity->getLocationType()->getTitle()['fr'] . ' ' . $entity->getName() :
|
||||||
//$this->translatableStringHelper->localize($entity->getLocationType()->getTitle()); //TODO does not work
|
//$this->translatableStringHelper->localize($entity->getLocationType()->getTitle()); //TODO does not work
|
||||||
$entity->getLocationType()->getTitle()['fr'];
|
$entity->getLocationType()->getTitle()['fr'];
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user