mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
activity: group locations by type in the selector
This commit is contained in:
parent
0bd0487801
commit
d13d42b9bf
@ -16,6 +16,8 @@
|
|||||||
:placeholder="$t('activity.choose_location')"
|
:placeholder="$t('activity.choose_location')"
|
||||||
:custom-label="customLabel"
|
:custom-label="customLabel"
|
||||||
:options="locations"
|
:options="locations"
|
||||||
|
group-values="locations"
|
||||||
|
group-label="locationGroup"
|
||||||
v-model="location"
|
v-model="location"
|
||||||
>
|
>
|
||||||
</VueMultiselect>
|
</VueMultiselect>
|
||||||
@ -69,10 +71,17 @@ export default {
|
|||||||
const concernedThirdPartiesLocation =
|
const concernedThirdPartiesLocation =
|
||||||
this.makeConcernedThirdPartiesLocation(thirdpartyLocationType);
|
this.makeConcernedThirdPartiesLocation(thirdpartyLocationType);
|
||||||
this.locations = [
|
this.locations = [
|
||||||
personLocation,
|
{
|
||||||
...concernedPersonsLocation,
|
locationGroup: 'Localisation du parcours',
|
||||||
...concernedThirdPartiesLocation,
|
locations: [personLocation]
|
||||||
...response.results,
|
},
|
||||||
|
{
|
||||||
|
locationGroup: 'Parties concernées',
|
||||||
|
locations: [...concernedPersonsLocation, ...concernedThirdPartiesLocation]},
|
||||||
|
{
|
||||||
|
locationGroup: 'Autres localisations',
|
||||||
|
locations: response.results
|
||||||
|
}
|
||||||
];
|
];
|
||||||
if (window.default_location_id) {
|
if (window.default_location_id) {
|
||||||
let location = this.locations.filter(
|
let location = this.locations.filter(
|
||||||
@ -90,7 +99,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
labelAccompanyingCourseLocation(value) {
|
labelAccompanyingCourseLocation(value) {
|
||||||
return `${value.address.text} (Localisation du parcours)`
|
return `${value.address.text}`
|
||||||
},
|
},
|
||||||
customLabel(value) {
|
customLabel(value) {
|
||||||
return value.name ?
|
return value.name ?
|
||||||
@ -106,6 +115,7 @@ export default {
|
|||||||
if (e.type === 'person' && e.current_household_address !== null){
|
if (e.type === 'person' && e.current_household_address !== null){
|
||||||
locations.push({
|
locations.push({
|
||||||
type: 'location',
|
type: 'location',
|
||||||
|
id: -this.suggestedEntities.indexOf(e)*10,
|
||||||
onthefly: true,
|
onthefly: true,
|
||||||
name: e.text,
|
name: e.text,
|
||||||
address: {
|
address: {
|
||||||
@ -122,9 +132,11 @@ export default {
|
|||||||
let locations = [];
|
let locations = [];
|
||||||
this.suggestedEntities.forEach(
|
this.suggestedEntities.forEach(
|
||||||
(e) => {
|
(e) => {
|
||||||
|
console.log(this.suggestedEntities.indexOf(e))
|
||||||
if (e.type === 'thirdparty' && e.address !== null){
|
if (e.type === 'thirdparty' && e.address !== null){
|
||||||
locations.push({
|
locations.push({
|
||||||
type: 'location',
|
type: 'location',
|
||||||
|
id: -this.suggestedEntities.indexOf(e)*10,
|
||||||
onthefly: true,
|
onthefly: true,
|
||||||
name: e.text,
|
name: e.text,
|
||||||
address: { id: e.address.address_id },
|
address: { id: e.address.address_id },
|
||||||
@ -139,6 +151,7 @@ export default {
|
|||||||
const accPeriodLocation = this.activity.accompanyingPeriod.location;
|
const accPeriodLocation = this.activity.accompanyingPeriod.location;
|
||||||
return {
|
return {
|
||||||
type: 'location',
|
type: 'location',
|
||||||
|
id: -1,
|
||||||
onthefly: true,
|
onthefly: true,
|
||||||
name: '__AccompanyingCourseLocation__',
|
name: '__AccompanyingCourseLocation__',
|
||||||
address: {
|
address: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user