Pārlūkot izejas kodu

fix events form error

Olivier Massot 4 mēneši atpakaļ
vecāks
revīzija
427919fa5c
1 mainītis faili ar 41 papildinājumiem un 41 dzēšanām
  1. 41 41
      components/Form/Freemium/Event.vue

+ 41 - 41
components/Form/Freemium/Event.vue

@@ -5,44 +5,44 @@
         <h4 class="mb-8">{{ $t('general_informations') }}</h4>
 
         <UiInputText
-          v-model="entity.name"
+          v-model="localEntity.name"
           field="name"
           :rules="getAsserts('name')"
         />
 
         <span class="label">{{ $t('datetimeStart') }}</span>
         <UiInputDateTimePicker
-          :model-value="entity.datetimeStart"
+          :model-value="localEntity.datetimeStart"
           field="datetimeStart"
           label="datetimeStart"
           :with-time-picker="true"
           class="my-2"
           :rules="getAsserts('datetimeStart')"
           validate-on-blur
-          @update:model-value="onUpdateDateTimeStart(entity, $event)"
+          @update:model-value="onUpdateDateTimeStart(localEntity, $event)"
         />
 
         <span class="label">{{ $t('datetimeEnd') }}</span>
         <UiInputDateTimePicker
-          :model-value="entity.datetimeEnd"
+          :model-value="localEntity.datetimeEnd"
           field="datetimeEnd"
           label="datetimeEnd"
           :with-time-picker="true"
           class="my-2"
           :rules="getAsserts('datetimeEnd')"
-          @update:model-value="onUpdateDateTimeEnd(entity, $event)"
+          @update:model-value="onUpdateDateTimeEnd(localEntity, $event)"
         />
 
         <span class="label">{{ $t('description') }}</span>
-        <UiInputTextArea v-model="entity.description" class="mt-3" />
+        <UiInputTextArea v-model="localEntity.description" class="mt-3" />
 
         <UiInputTreeSelectEventCategories
-          v-model="entity.categories"
+          v-model="localEntity.categories"
           label="event_categories_choices"
         />
 
         <UiInputImage
-          v-model="entity.image"
+          v-model="localEntity.image"
           field="image"
           :width="240"
           :cropping-enabled="true"
@@ -58,24 +58,24 @@
 
         <UiInputAutocompleteApiResources
           v-if="!newPlace"
-          :model-value="entity.place"
+          :model-value="localEntity.place"
           field="place"
           :model="PlaceSearchItem"
           list-value="id"
           list-label="name"
-          @update:model-value="getPlace(entity)"
+          @update:model-value="getPlace(localEntity)"
         />
 
         <v-row v-if="!newPlace" class="mb-6 justify-center">
           <v-col
-            v-if="entity.place && !editPlace"
+            v-if="localEntity.place && !editPlace"
             cols="12"
             sm="6"
             class="d-flex justify-center mb-2"
           >
             <v-btn
               prepend-icon="fa-solid fa-pencil"
-              @click="onEditPlaceClick(entity)"
+              @click="onEditPlaceClick(localEntity)"
             >
               {{ $t('edit_place') }}
             </v-btn>
@@ -84,7 +84,7 @@
           <v-col cols="12" sm="6" class="d-flex justify-center mb-2">
             <v-btn
               prepend-icon="fa-solid fa-plus"
-              @click="onAddPlaceClick(entity)"
+              @click="onAddPlaceClick(localEntity)"
             >
               {{ $t('add_place') }}
             </v-btn>
@@ -92,43 +92,43 @@
         </v-row>
 
         <UiInputText
-          v-model="entity.placeName"
+          v-model="localEntity.placeName"
           :readonly="!newPlace && !editPlace"
           field="placeName"
         />
 
         <UiInputText
-          v-model="entity.streetAddress"
+          v-model="localEntity.streetAddress"
           :readonly="!newPlace && !editPlace"
           field="streetAddress"
         />
 
         <UiInputText
-          v-model="entity.streetAddressSecond"
+          v-model="localEntity.streetAddressSecond"
           :readonly="!newPlace && !editPlace"
           field="streetAddressSecond"
         />
 
         <UiInputText
-          v-model="entity.streetAddressThird"
+          v-model="localEntity.streetAddressThird"
           :readonly="!newPlace && !editPlace"
           field="streetAddressThird"
         />
 
         <UiInputText
-          v-model="entity.postalCode"
+          v-model="localEntity.postalCode"
           :readonly="!newPlace && !editPlace"
           field="postalCode"
         />
 
         <UiInputText
-          v-model="entity.addressCity"
+          v-model="localEntity.addressCity"
           :readonly="!newPlace && !editPlace"
           field="addressCity"
         />
 
         <UiInputAutocompleteApiResources
-          v-model="entity.addressCountry"
+          v-model="localEntity.addressCountry"
           :readonly="!newPlace && !editPlace"
           field="addressCountry"
           :model="Country"
@@ -138,15 +138,15 @@
 
         <client-only>
           <UiMapLeaflet
-            v-model:latitude="entity.latitude"
-            v-model:longitude="entity.longitude"
+            v-model:latitude="localEntity.latitude"
+            v-model:longitude="localEntity.longitude"
             :readonly="!newPlace && !editPlace"
-            :street-address="entity.streetAddress"
-            :street-address-second="entity.streetAddressSecond"
-            :street-address-third="entity.streetAddressThird"
-            :postal-code="entity.postalCode"
-            :address-city="entity.addressCity"
-            :address-country-id="entity.addressCountry"
+            :street-address="localEntity.streetAddress"
+            :street-address-second="localEntity.streetAddressSecond"
+            :street-address-third="localEntity.streetAddressThird"
+            :postal-code="localEntity.postalCode"
+            :address-city="localEntity.addressCity"
+            :address-country-id="localEntity.addressCountry"
             :search-button="true"
           ></UiMapLeaflet>
         </client-only>
@@ -159,29 +159,29 @@
       <v-col cols="12">
         <h4 class="mb-8">{{ $t('communication_params') }}</h4>
 
-        <UiInputText v-model="entity.url" field="url" />
+        <UiInputText v-model="localEntity.url" field="url" />
 
         <UiInputAutocompleteEnum
-          v-model="entity.pricing"
+          v-model="localEntity.pricing"
           enum-name="pricing_event"
           field="pricing"
         />
 
         <UiInputText
-          v-if="entity.pricing === 'PAID'"
-          v-model="entity.urlTicket"
+          v-if="localEntity.pricing === 'PAID'"
+          v-model="localEntity.urlTicket"
           field="urlTicket"
         />
 
         <UiInputNumber
-          v-if="entity.pricing === 'PAID'"
-          v-model="entity.priceMini"
+          v-if="localEntity.pricing === 'PAID'"
+          v-model="localEntity.priceMini"
           field="priceMini"
         />
 
         <UiInputNumber
-          v-if="entity.pricing === 'PAID'"
-          v-model="entity.priceMaxi"
+          v-if="localEntity.pricing === 'PAID'"
+          v-model="localEntity.priceMaxi"
           field="priceMaxi"
         />
       </v-col>
@@ -219,18 +219,18 @@ import PlaceSearchItem from '~/models/Custom/Search/PlaceSearchItem'
 import { useEntityManager } from '~/composables/data/useEntityManager'
 
 const props = defineProps<{
-  modelValue: Event
+  entity: Event
 }>()
 
 const { em } = useEntityManager()
 const getAsserts = (key) => getAssertUtils(Event.getAsserts(), key)
 
-const emit = defineEmits(['update:modelValue'])
+const emit = defineEmits(['update:entity'])
 
 // Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
-const entity = computed({
-  get: () => props.modelValue,
-  set: (value) => emit('update:modelValue', value),
+const localEntity = computed({
+  get: () => props.entity,
+  set: (value) => emit('update:entity', value),
 })
 
 /**