|
|
@@ -1,58 +1,55 @@
|
|
|
<template>
|
|
|
- <LayoutCommonSection>
|
|
|
- <v-row>
|
|
|
- <v-col cols="12" sm="12">
|
|
|
- <h4 class="mb-8">{{ $t('general_informations') }}</h4>
|
|
|
-
|
|
|
- <UiInputText
|
|
|
- v-model="entity.name"
|
|
|
- field="name"
|
|
|
- :rules="getAsserts('name')"
|
|
|
- />
|
|
|
-
|
|
|
- <span class="label">{{$t('datetimeStart')}}</span>
|
|
|
- <UiInputDateTimePicker
|
|
|
- :model-value="entity.datetimeStart"
|
|
|
- field="datetimeStart"
|
|
|
- label="datetimeStart"
|
|
|
- :with-time-picker="true"
|
|
|
- class="my-2"
|
|
|
- :rules="getAsserts('datetimeStart')"
|
|
|
- validate-on-blur
|
|
|
- @update:model-value="onUpdateDateTimeStart(entity, $event)"
|
|
|
- />
|
|
|
-
|
|
|
- <span class="label">{{$t('datetimeEnd')}}</span>
|
|
|
- <UiInputDateTimePicker
|
|
|
- :model-value="entity.datetimeEnd"
|
|
|
- field="datetimeEnd"
|
|
|
- label="datetimeEnd"
|
|
|
- :with-time-picker="true"
|
|
|
- class="my-2"
|
|
|
- :rules="getAsserts('datetimeEnd')"
|
|
|
- @update:model-value="onUpdateDateTimeEnd(entity, $event)"
|
|
|
- />
|
|
|
-
|
|
|
- <span class="label">{{$t('description')}}</span>
|
|
|
- <UiInputTextArea
|
|
|
- v-model="entity.description"
|
|
|
- class="mt-3"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputTreeSelectEventCategories
|
|
|
- v-model="entity.categories"
|
|
|
- label="event_categories_choices"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputImage
|
|
|
- v-model="entity.image"
|
|
|
- field="image"
|
|
|
- :width="240"
|
|
|
- :cropping-enabled="true"
|
|
|
- />
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
- </LayoutCommonSection>
|
|
|
+ <LayoutCommonSection>
|
|
|
+ <v-row>
|
|
|
+ <v-col cols="12" sm="12">
|
|
|
+ <h4 class="mb-8">{{ $t('general_informations') }}</h4>
|
|
|
+
|
|
|
+ <UiInputText
|
|
|
+ v-model="entity.name"
|
|
|
+ field="name"
|
|
|
+ :rules="getAsserts('name')"
|
|
|
+ />
|
|
|
+
|
|
|
+ <span class="label">{{ $t('datetimeStart') }}</span>
|
|
|
+ <UiInputDateTimePicker
|
|
|
+ :model-value="entity.datetimeStart"
|
|
|
+ field="datetimeStart"
|
|
|
+ label="datetimeStart"
|
|
|
+ :with-time-picker="true"
|
|
|
+ class="my-2"
|
|
|
+ :rules="getAsserts('datetimeStart')"
|
|
|
+ validate-on-blur
|
|
|
+ @update:model-value="onUpdateDateTimeStart(entity, $event)"
|
|
|
+ />
|
|
|
+
|
|
|
+ <span class="label">{{ $t('datetimeEnd') }}</span>
|
|
|
+ <UiInputDateTimePicker
|
|
|
+ :model-value="entity.datetimeEnd"
|
|
|
+ field="datetimeEnd"
|
|
|
+ label="datetimeEnd"
|
|
|
+ :with-time-picker="true"
|
|
|
+ class="my-2"
|
|
|
+ :rules="getAsserts('datetimeEnd')"
|
|
|
+ @update:model-value="onUpdateDateTimeEnd(entity, $event)"
|
|
|
+ />
|
|
|
+
|
|
|
+ <span class="label">{{ $t('description') }}</span>
|
|
|
+ <UiInputTextArea v-model="entity.description" class="mt-3" />
|
|
|
+
|
|
|
+ <UiInputTreeSelectEventCategories
|
|
|
+ v-model="entity.categories"
|
|
|
+ label="event_categories_choices"
|
|
|
+ />
|
|
|
+
|
|
|
+ <UiInputImage
|
|
|
+ v-model="entity.image"
|
|
|
+ field="image"
|
|
|
+ :width="240"
|
|
|
+ :cropping-enabled="true"
|
|
|
+ />
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </LayoutCommonSection>
|
|
|
|
|
|
<LayoutCommonSection>
|
|
|
<v-row>
|
|
|
@@ -69,26 +66,22 @@
|
|
|
@update:model-value="getPlace(entity)"
|
|
|
/>
|
|
|
|
|
|
- <v-row v-if="!newPlace" class="mb-6 justify-center">
|
|
|
+ <v-row v-if="!newPlace" class="mb-6 justify-center">
|
|
|
<v-col
|
|
|
v-if="entity.place && !editPlace"
|
|
|
cols="12"
|
|
|
sm="6"
|
|
|
class="d-flex justify-center mb-2"
|
|
|
>
|
|
|
- <v-btn
|
|
|
- prepend-icon="fa-solid fa-pencil"
|
|
|
- @click="onEditPlaceClick(entity)"
|
|
|
- >
|
|
|
- {{ $t('edit_place') }}
|
|
|
- </v-btn>
|
|
|
+ <v-btn
|
|
|
+ prepend-icon="fa-solid fa-pencil"
|
|
|
+ @click="onEditPlaceClick(entity)"
|
|
|
+ >
|
|
|
+ {{ $t('edit_place') }}
|
|
|
+ </v-btn>
|
|
|
</v-col>
|
|
|
|
|
|
- <v-col
|
|
|
- cols="12"
|
|
|
- sm="6"
|
|
|
- class="d-flex justify-center mb-2"
|
|
|
- >
|
|
|
+ <v-col cols="12" sm="6" class="d-flex justify-center mb-2">
|
|
|
<v-btn
|
|
|
prepend-icon="fa-solid fa-plus"
|
|
|
@click="onAddPlaceClick(entity)"
|
|
|
@@ -157,106 +150,97 @@
|
|
|
:search-button="true"
|
|
|
></UiMapLeaflet>
|
|
|
</client-only>
|
|
|
+ </v-col>
|
|
|
+ </v-row>
|
|
|
+ </LayoutCommonSection>
|
|
|
+
|
|
|
+ <LayoutCommonSection>
|
|
|
+ <v-row>
|
|
|
+ <v-col cols="12">
|
|
|
+ <h4 class="mb-8">{{ $t('communication_params') }}</h4>
|
|
|
+
|
|
|
+ <UiInputText v-model="entity.url" field="url" />
|
|
|
|
|
|
+ <UiInputAutocompleteEnum
|
|
|
+ v-model="entity.pricing"
|
|
|
+ enum-name="pricing_event"
|
|
|
+ field="pricing"
|
|
|
+ />
|
|
|
+
|
|
|
+ <UiInputText
|
|
|
+ v-if="entity.pricing === 'PAID'"
|
|
|
+ v-model="entity.urlTicket"
|
|
|
+ field="urlTicket"
|
|
|
+ />
|
|
|
+
|
|
|
+ <UiInputNumber
|
|
|
+ v-if="entity.pricing === 'PAID'"
|
|
|
+ v-model="entity.priceMini"
|
|
|
+ field="priceMini"
|
|
|
+ />
|
|
|
+
|
|
|
+ <UiInputNumber
|
|
|
+ v-if="entity.pricing === 'PAID'"
|
|
|
+ v-model="entity.priceMaxi"
|
|
|
+ field="priceMaxi"
|
|
|
+ />
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
</LayoutCommonSection>
|
|
|
|
|
|
- <LayoutCommonSection>
|
|
|
- <v-row>
|
|
|
- <v-col cols="12">
|
|
|
-
|
|
|
- <h4 class="mb-8">{{ $t('communication_params') }}</h4>
|
|
|
-
|
|
|
- <UiInputText
|
|
|
- v-model="entity.url"
|
|
|
- field="url"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputAutocompleteEnum
|
|
|
- v-model="entity.pricing"
|
|
|
- enum-name="pricing_event"
|
|
|
- field="pricing"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputText
|
|
|
- v-if="entity.pricing==='PAID'"
|
|
|
- v-model="entity.urlTicket"
|
|
|
- field="urlTicket"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputNumber
|
|
|
- v-if="entity.pricing==='PAID'"
|
|
|
- v-model="entity.priceMini"
|
|
|
- field="priceMini"
|
|
|
- />
|
|
|
-
|
|
|
- <UiInputNumber
|
|
|
- v-if="entity.pricing==='PAID'"
|
|
|
- v-model="entity.priceMaxi"
|
|
|
- field="priceMaxi"
|
|
|
- />
|
|
|
-
|
|
|
- </v-col>
|
|
|
- </v-row>
|
|
|
- </LayoutCommonSection>
|
|
|
-
|
|
|
- <LazyLayoutDialog :show="showAlert" theme="warning">
|
|
|
- <template #dialogType>{{ $t('important') }}</template>
|
|
|
- <template #dialogTitle>{{ $t('place_change_everywhere') }}</template>
|
|
|
- <template #dialogText>
|
|
|
- <v-card-text class="text">
|
|
|
- <p>
|
|
|
- {{$t('warning_edit_place')}}
|
|
|
- </p>
|
|
|
- </v-card-text>
|
|
|
- </template>
|
|
|
- <template #dialogBtn>
|
|
|
- <v-btn class="mr-4 submitBtn theme-neutral-strong" @click="closeDialog">
|
|
|
- {{ $t('cancel') }}
|
|
|
- </v-btn>
|
|
|
- <v-btn class="mr-4 submitBtn theme-warning" @click="onEditPlaceConfirm">
|
|
|
- {{ $t('i_understand') }}
|
|
|
- </v-btn>
|
|
|
- </template>
|
|
|
- </LazyLayoutDialog>
|
|
|
+ <LazyLayoutDialog :show="showAlert" theme="warning">
|
|
|
+ <template #dialogType>{{ $t('important') }}</template>
|
|
|
+ <template #dialogTitle>{{ $t('place_change_everywhere') }}</template>
|
|
|
+ <template #dialogText>
|
|
|
+ <v-card-text class="text">
|
|
|
+ <p>
|
|
|
+ {{ $t('warning_edit_place') }}
|
|
|
+ </p>
|
|
|
+ </v-card-text>
|
|
|
+ </template>
|
|
|
+ <template #dialogBtn>
|
|
|
+ <v-btn class="mr-4 submitBtn theme-neutral-strong" @click="closeDialog">
|
|
|
+ {{ $t('cancel') }}
|
|
|
+ </v-btn>
|
|
|
+ <v-btn class="mr-4 submitBtn theme-warning" @click="onEditPlaceConfirm">
|
|
|
+ {{ $t('i_understand') }}
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </LazyLayoutDialog>
|
|
|
</template>
|
|
|
|
|
|
<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";
|
|
|
+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<{
|
|
|
modelValue: Event
|
|
|
}>()
|
|
|
|
|
|
-const {em} = useEntityManager()
|
|
|
+const { em } = useEntityManager()
|
|
|
const getAsserts = (key) => getAssertUtils(Event.getAsserts(), key)
|
|
|
|
|
|
-const emit = defineEmits([
|
|
|
- 'update:modelValue',
|
|
|
-])
|
|
|
+const emit = defineEmits(['update:modelValue'])
|
|
|
|
|
|
// Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
|
|
|
const entity = computed({
|
|
|
get: () => props.modelValue,
|
|
|
- set: (value) => emit('update:modelValue', value)
|
|
|
+ set: (value) => emit('update:modelValue', value),
|
|
|
})
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* Si la date de début est mise à jour, on s'assure que la date de fin est
|
|
|
* après elle, sinon elle devient égale
|
|
|
* @param entity
|
|
|
* @param dateTime
|
|
|
*/
|
|
|
-const onUpdateDateTimeStart = (entity, dateTime) =>{
|
|
|
- if(DateUtils.isBefore(props.entity.datetimeEnd, dateTime, false)){
|
|
|
+const onUpdateDateTimeStart = (entity, dateTime) => {
|
|
|
+ if (DateUtils.isBefore(props.entity.datetimeEnd, dateTime, false)) {
|
|
|
entity.datetimeEnd = dateTime
|
|
|
}
|
|
|
entity.datetimeStart = dateTime
|
|
|
@@ -269,8 +253,8 @@ const onUpdateDateTimeStart = (entity, dateTime) =>{
|
|
|
* @param entity
|
|
|
* @param dateTime
|
|
|
*/
|
|
|
-const onUpdateDateTimeEnd = (entity, dateTime) =>{
|
|
|
- if(DateUtils.isBefore(dateTime, props.entity.datetimeStart, false)){
|
|
|
+const onUpdateDateTimeEnd = (entity, dateTime) => {
|
|
|
+ if (DateUtils.isBefore(dateTime, props.entity.datetimeStart, false)) {
|
|
|
entity.datetimeStart = dateTime
|
|
|
}
|
|
|
entity.datetimeEnd = dateTime
|
|
|
@@ -286,7 +270,7 @@ const editPlace: Ref<boolean> = ref(false)
|
|
|
* est mise à nulle, et les champs input de l'adresse sont vidées
|
|
|
* @param entity
|
|
|
*/
|
|
|
-const onAddPlaceClick = function(entity: Event){
|
|
|
+const onAddPlaceClick = function (entity: Event) {
|
|
|
newPlace.value = true
|
|
|
entity.place = null
|
|
|
resetPlace(entity)
|
|
|
@@ -295,21 +279,21 @@ const onAddPlaceClick = function(entity: Event){
|
|
|
/**
|
|
|
* Quand on clic sur le bouton "Editer le lieu", une alerte s'affiche
|
|
|
*/
|
|
|
-const onEditPlaceClick = function(){
|
|
|
+const onEditPlaceClick = function () {
|
|
|
showAlert.value = true
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Quand on ferme la boite de dialogue
|
|
|
*/
|
|
|
-const closeDialog = function(){
|
|
|
+const closeDialog = function () {
|
|
|
showAlert.value = false
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Si on décide d'éditer le lieu
|
|
|
*/
|
|
|
-const onEditPlaceConfirm = function(){
|
|
|
+const onEditPlaceConfirm = function () {
|
|
|
showAlert.value = false
|
|
|
editPlace.value = true
|
|
|
}
|
|
|
@@ -319,8 +303,8 @@ const onEditPlaceConfirm = function(){
|
|
|
* input de l'adresse
|
|
|
* @param entity
|
|
|
*/
|
|
|
-const getPlace = async (entity: Event)=>{
|
|
|
- if(entity.place){
|
|
|
+const getPlace = async (entity: Event) => {
|
|
|
+ if (entity.place) {
|
|
|
const placeInstance = await em.fetch(Place, entity.place as number)
|
|
|
entity.placeName = placeInstance.name
|
|
|
entity.streetAddress = placeInstance.streetAddress
|
|
|
@@ -332,7 +316,7 @@ const getPlace = async (entity: Event)=>{
|
|
|
entity.latitude = placeInstance.latitude
|
|
|
entity.longitude = placeInstance.longitude
|
|
|
editPlace.value = false
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//Dans le cas où l'on ne récupère aucune place on remet a null le formulaire de l'adresse
|
|
|
resetPlace(entity)
|
|
|
}
|
|
|
@@ -344,7 +328,7 @@ const getPlace = async (entity: Event)=>{
|
|
|
* fonction permettant de remettre à vide tous les champs input de l'adresse
|
|
|
* @param entity
|
|
|
*/
|
|
|
-const resetPlace = (entity: Event)=>{
|
|
|
+const resetPlace = (entity: Event) => {
|
|
|
entity.placeName = null
|
|
|
entity.streetAddress = null
|
|
|
entity.streetAddressSecond = null
|
|
|
@@ -367,8 +351,8 @@ onBeforeUnmount(() => {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- .label{
|
|
|
- font-size: 16px;
|
|
|
- color: rgb(var(--v-theme-on-primary-alt));
|
|
|
- }
|
|
|
+.label {
|
|
|
+ font-size: 16px;
|
|
|
+ color: rgb(var(--v-theme-on-primary-alt));
|
|
|
+}
|
|
|
</style>
|