Julien Fastré 7e932e838f Squashed commit of the following:
commit 9e767fa3e0788d87437c235e51fcdc4f26f75d98
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Mon Jan 17 15:28:02 2022 +0100

    traductions

commit db6513474377b702cc2258be3e2ba720d007bc11
Author: nobohan <juminet@gmail.com>
Date:   Mon Jan 17 12:17:22 2022 +0100

    add person: increase z-index of toast and wait for validation before closing modal

commit 7af4c3434ef39b27eb51881611338b50a379acc8
Merge: a09c8ee8a 46c6d0e29
Author: Julien Fastré <julien.fastre@champs-libres.coop>
Date:   Sun Jan 16 22:51:45 2022 +0100

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

commit a09c8ee8af962021b9d6a402863c8c5671c0e621
Author: nobohan <juminet@gmail.com>
Date:   Wed Jan 12 15:47:11 2022 +0100

    upd CHANGELOG

commit a312a9463d861659f70909bed7d8aa67fef444f2
Author: nobohan <juminet@gmail.com>
Date:   Wed Jan 12 15:29:32 2022 +0100

    address: display error message if some fields are empty (street & streetnumber)

commit 0035128138ddd3d877befae3e489329634555f79
Author: nobohan <juminet@gmail.com>
Date:   Wed Jan 12 14:47:43 2022 +0100

    address: display error message if some fields are empty

commit 49cb15467297bd24c5eb9a0dd7e366ccd7744679
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 20:58:00 2022 +0100

    address: add field validation (WIP)

commit 1a7ec9e39631e00d59fcb3204a157e1583679cda
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 17:16:43 2022 +0100

    Activity: fix vuejs warning

commit fa0b9271c2b4963564fdc1e0eda09a12758caa4b
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 16:13:23 2022 +0100

    location: treat 422 error when POSTing new location

commit c7b9a1a3fe8891f80699faa2dd277064dce7b0b6
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 16:00:29 2022 +0100

    location: fix error when creating a new location: a new location could not be added to the availableLocations due to refactoring

commit f1c61a2387df7507c79c55e7defe46fbb052df6c
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 15:20:33 2022 +0100

    person: treat 422 error in AddPerson for thirdparty

commit 8f6a70b240c286c18e1a102953f243e57b4af97a
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 11:30:05 2022 +0100

    person: add validation for required fields in on-the-fly person

commit 40e4bf953fa8e9a04a34e0330562bd25324c5589
Author: nobohan <juminet@gmail.com>
Date:   Tue Jan 11 09:34:15 2022 +0100

    vuejs: better violations message in 422 error handling

commit 378f3a16fc34228334cd44b9e7ca618bc7eb72aa
Author: nobohan <juminet@gmail.com>
Date:   Mon Jan 10 18:11:02 2022 +0100

    person: on-the-fly person: first implementation of makeFetch for posting person
2022-01-17 15:28:49 +01:00

72 lines
2.4 KiB
Vue

<template>
<teleport to="#location">
<div class="mb-3 row">
<label class="col-form-label col-sm-4">
{{ $t("activity.location") }}
</label>
<div class="col-sm-8">
<VueMultiselect
name="selectLocation"
id="selectLocation"
label="name"
track-by="id"
open-direction="top"
:multiple="false"
:searchable="true"
:placeholder="$t('activity.choose_location')"
:custom-label="customLabel"
:select-label="$t('multiselect.select_label')"
:deselect-label="$t('multiselect.deselect_label')"
:selected-label="$t('multiselect.selected_label')"
:options="availableLocations"
group-values="locations"
group-label="locationGroup"
v-model="location"
>
</VueMultiselect>
<new-location v-bind:availableLocations="availableLocations"></new-location>
</div>
</div>
</teleport>
</template>
<script>
import { mapState, mapGetters } from "vuex";
import VueMultiselect from "vue-multiselect";
import NewLocation from "./Location/NewLocation.vue";
export default {
name: "Location",
components: {
NewLocation,
VueMultiselect,
},
computed: {
...mapState(["activity", "availableLocations"]),
...mapGetters(["suggestedEntities"]),
location: {
get() {
return this.activity.location;
},
set(value) {
this.$store.dispatch("updateLocation", value);
},
},
},
methods: {
labelAccompanyingCourseLocation(value) {
return `${value.address.text} (${value.locationType.title.fr})`
},
customLabel(value) {
return value.locationType
? value.name
? value.name === '__AccompanyingCourseLocation__'
? this.labelAccompanyingCourseLocation(value)
: `${value.name} (${value.locationType.title.fr})`
: value.locationType.title.fr
: '';
},
},
};
</script>