|
|
@@ -66,6 +66,7 @@
|
|
|
listValue="id"
|
|
|
listLabel="name"
|
|
|
v-if="!newPlace"
|
|
|
+ @update:model-value="getPlace(entity)"
|
|
|
/>
|
|
|
|
|
|
<div class="d-flex justify-center"
|
|
|
@@ -78,22 +79,30 @@
|
|
|
>
|
|
|
{{ $t('add_place') }}
|
|
|
</v-btn>
|
|
|
+
|
|
|
+ <v-btn
|
|
|
+ prepend-icon="fa-solid fa-plus"
|
|
|
+ class="my-5"
|
|
|
+ @click="onEditPlaceClick(entity)"
|
|
|
+ >
|
|
|
+ {{ $t('edit_place') }}
|
|
|
+ </v-btn>
|
|
|
</div>
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.placeName" field="placeName" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.placeName" field="placeName" />
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.streetAddress" field="streetAddress" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.streetAddress" field="streetAddress" />
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.streetAddressSecond" field="streetAddressSecond" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.streetAddressSecond" field="streetAddressSecond" />
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.streetAddressThird" field="streetAddressThird" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.streetAddressThird" field="streetAddressThird" />
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.postalCode" field="postalCode" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.postalCode" field="postalCode" />
|
|
|
|
|
|
- <UiInputText v-if="newPlace" v-model="entity.addressCity" field="addressCity" />
|
|
|
+ <UiInputText :readonly="!newPlace && !editPlace" v-model="entity.addressCity" field="addressCity" />
|
|
|
|
|
|
<UiInputAutocompleteApiResources
|
|
|
- v-if="newPlace"
|
|
|
+ :readonly="!newPlace && !editPlace"
|
|
|
v-model="entity.addressCountry"
|
|
|
field="addressCountry"
|
|
|
:model="Country"
|
|
|
@@ -103,7 +112,6 @@
|
|
|
|
|
|
<client-only>
|
|
|
<UiMapLeaflet
|
|
|
- v-if="newPlace"
|
|
|
v-model:latitude="entity.latitude"
|
|
|
v-model:longitude="entity.longitude"
|
|
|
:streetAddress="entity.streetAddress"
|
|
|
@@ -147,15 +155,18 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import Event from "~/models/Freemium/Event";
|
|
|
+import Place from "~/models/Freemium/Place";
|
|
|
import {getAssertUtils} from "~/services/asserts/getAssertUtils";
|
|
|
import DateUtils from "~/services/utils/dateUtils";
|
|
|
import Country from "~/models/Core/Country";
|
|
|
import PlaceSearchItem from "~/models/Custom/Search/PlaceSearchItem";
|
|
|
+import {useEntityManager} from "~/composables/data/useEntityManager";
|
|
|
|
|
|
const props = defineProps<{
|
|
|
entity: Event
|
|
|
}>()
|
|
|
|
|
|
+const {em} = useEntityManager()
|
|
|
const getAsserts = (key) => getAssertUtils(Event.getAsserts(), key)
|
|
|
|
|
|
const onUpdateDateTimeStart = (entity, dateTime) =>{
|
|
|
@@ -170,6 +181,7 @@ const onUpdateDateTimeEnd = (entity, dateTime) =>{
|
|
|
}
|
|
|
|
|
|
const newPlace: Ref<boolean> = ref(false)
|
|
|
+const editPlace: Ref<boolean> = ref(false)
|
|
|
const onAddPlaceClick = function(entity: Event){
|
|
|
newPlace.value = true
|
|
|
entity.placeName = null
|
|
|
@@ -179,8 +191,27 @@ const onAddPlaceClick = function(entity: Event){
|
|
|
entity.addressCity = null
|
|
|
entity.postalCode = null
|
|
|
entity.addressCountry = null
|
|
|
+ entity.latitude = null
|
|
|
+ entity.longitude = null
|
|
|
entity.place = null
|
|
|
}
|
|
|
+
|
|
|
+const onEditPlaceClick = function(){
|
|
|
+ editPlace.value = true
|
|
|
+}
|
|
|
+
|
|
|
+const getPlace = async (entity: Event)=>{
|
|
|
+ const placeInstance = await em.fetch(Place, entity.place as number)
|
|
|
+ entity.placeName = placeInstance.name
|
|
|
+ entity.streetAddress = placeInstance.streetAddress
|
|
|
+ entity.streetAddressSecond = placeInstance.streetAddressSecond
|
|
|
+ entity.streetAddressThird = placeInstance.streetAddressThird
|
|
|
+ entity.addressCity = placeInstance.addressCity
|
|
|
+ entity.postalCode = placeInstance.postalCode
|
|
|
+ entity.addressCountry = placeInstance.addressCountry
|
|
|
+ entity.latitude = placeInstance.latitude
|
|
|
+ entity.longitude = placeInstance.longitude
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|