Browse Source

minor fixes and lint

Olivier Massot 4 months ago
parent
commit
4e8563d736

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

@@ -5,44 +5,44 @@
         <h4 class="mb-8">{{ $t('general_informations') }}</h4>
 
         <UiInputText
-          v-model="localEntity.name"
+          v-model="proxyEntity.name"
           field="name"
           :rules="getAsserts('name')"
         />
 
         <span class="label">{{ $t('datetimeStart') }}</span>
         <UiInputDateTimePicker
-          :model-value="localEntity.datetimeStart"
+          :model-value="proxyEntity.datetimeStart"
           field="datetimeStart"
           label="datetimeStart"
           :with-time-picker="true"
           class="my-2"
           :rules="getAsserts('datetimeStart')"
           validate-on-blur
-          @update:model-value="onUpdateDateTimeStart(localEntity, $event)"
+          @update:model-value="onUpdateDateTimeStart(proxyEntity, $event)"
         />
 
         <span class="label">{{ $t('datetimeEnd') }}</span>
         <UiInputDateTimePicker
-          :model-value="localEntity.datetimeEnd"
+          :model-value="proxyEntity.datetimeEnd"
           field="datetimeEnd"
           label="datetimeEnd"
           :with-time-picker="true"
           class="my-2"
           :rules="getAsserts('datetimeEnd')"
-          @update:model-value="onUpdateDateTimeEnd(localEntity, $event)"
+          @update:model-value="onUpdateDateTimeEnd(proxyEntity, $event)"
         />
 
         <span class="label">{{ $t('description') }}</span>
-        <UiInputTextArea v-model="localEntity.description" class="mt-3" />
+        <UiInputTextArea v-model="proxyEntity.description" class="mt-3" />
 
         <UiInputTreeSelectEventCategories
-          v-model="localEntity.categories"
+          v-model="proxyEntity.categories"
           label="event_categories_choices"
         />
 
         <UiInputImage
-          v-model="localEntity.image"
+          v-model="proxyEntity.image"
           field="image"
           :width="240"
           :cropping-enabled="true"
@@ -58,24 +58,24 @@
 
         <UiInputAutocompleteApiResources
           v-if="!newPlace"
-          :model-value="localEntity.place"
+          :model-value="proxyEntity.place"
           field="place"
           :model="PlaceSearchItem"
           list-value="id"
           list-label="name"
-          @update:model-value="getPlace(localEntity)"
+          @update:model-value="getPlace(proxyEntity)"
         />
 
         <v-row v-if="!newPlace" class="mb-6 justify-center">
           <v-col
-            v-if="localEntity.place && !editPlace"
+            v-if="proxyEntity.place && !editPlace"
             cols="12"
             sm="6"
             class="d-flex justify-center mb-2"
           >
             <v-btn
               prepend-icon="fa-solid fa-pencil"
-              @click="onEditPlaceClick(localEntity)"
+              @click="onEditPlaceClick(proxyEntity)"
             >
               {{ $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(localEntity)"
+              @click="onAddPlaceClick(proxyEntity)"
             >
               {{ $t('add_place') }}
             </v-btn>
@@ -92,43 +92,43 @@
         </v-row>
 
         <UiInputText
-          v-model="localEntity.placeName"
+          v-model="proxyEntity.placeName"
           :readonly="!newPlace && !editPlace"
           field="placeName"
         />
 
         <UiInputText
-          v-model="localEntity.streetAddress"
+          v-model="proxyEntity.streetAddress"
           :readonly="!newPlace && !editPlace"
           field="streetAddress"
         />
 
         <UiInputText
-          v-model="localEntity.streetAddressSecond"
+          v-model="proxyEntity.streetAddressSecond"
           :readonly="!newPlace && !editPlace"
           field="streetAddressSecond"
         />
 
         <UiInputText
-          v-model="localEntity.streetAddressThird"
+          v-model="proxyEntity.streetAddressThird"
           :readonly="!newPlace && !editPlace"
           field="streetAddressThird"
         />
 
         <UiInputText
-          v-model="localEntity.postalCode"
+          v-model="proxyEntity.postalCode"
           :readonly="!newPlace && !editPlace"
           field="postalCode"
         />
 
         <UiInputText
-          v-model="localEntity.addressCity"
+          v-model="proxyEntity.addressCity"
           :readonly="!newPlace && !editPlace"
           field="addressCity"
         />
 
         <UiInputAutocompleteApiResources
-          v-model="localEntity.addressCountry"
+          v-model="proxyEntity.addressCountry"
           :readonly="!newPlace && !editPlace"
           field="addressCountry"
           :model="Country"
@@ -138,15 +138,15 @@
 
         <client-only>
           <UiMapLeaflet
-            v-model:latitude="localEntity.latitude"
-            v-model:longitude="localEntity.longitude"
+            v-model:latitude="proxyEntity.latitude"
+            v-model:longitude="proxyEntity.longitude"
             :readonly="!newPlace && !editPlace"
-            :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"
+            :street-address="proxyEntity.streetAddress"
+            :street-address-second="proxyEntity.streetAddressSecond"
+            :street-address-third="proxyEntity.streetAddressThird"
+            :postal-code="proxyEntity.postalCode"
+            :address-city="proxyEntity.addressCity"
+            :address-country-id="proxyEntity.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="localEntity.url" field="url" />
+        <UiInputText v-model="proxyEntity.url" field="url" />
 
         <UiInputAutocompleteEnum
-          v-model="localEntity.pricing"
+          v-model="proxyEntity.pricing"
           enum-name="pricing_event"
           field="pricing"
         />
 
         <UiInputText
-          v-if="localEntity.pricing === 'PAID'"
-          v-model="localEntity.urlTicket"
+          v-if="proxyEntity.pricing === 'PAID'"
+          v-model="proxyEntity.urlTicket"
           field="urlTicket"
         />
 
         <UiInputNumber
-          v-if="localEntity.pricing === 'PAID'"
-          v-model="localEntity.priceMini"
+          v-if="proxyEntity.pricing === 'PAID'"
+          v-model="proxyEntity.priceMini"
           field="priceMini"
         />
 
         <UiInputNumber
-          v-if="localEntity.pricing === 'PAID'"
-          v-model="localEntity.priceMaxi"
+          v-if="proxyEntity.pricing === 'PAID'"
+          v-model="proxyEntity.priceMaxi"
           field="priceMaxi"
         />
       </v-col>
@@ -228,7 +228,7 @@ const getAsserts = (key) => getAssertUtils(Event.getAsserts(), key)
 const emit = defineEmits(['update:entity'])
 
 // Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
-const localEntity = computed({
+const proxyEntity = computed({
   get: () => props.entity,
   set: (value) => emit('update:entity', value),
 })
@@ -244,7 +244,7 @@ const onUpdateDateTimeStart = (entity, dateTime) => {
     entity.datetimeEnd = dateTime
   }
   entity.datetimeStart = dateTime
-  emit('update:modelValue', entity)
+  emit('update:entity', entity)
 }
 
 /**
@@ -258,7 +258,7 @@ const onUpdateDateTimeEnd = (entity, dateTime) => {
     entity.datetimeStart = dateTime
   }
   entity.datetimeEnd = dateTime
-  emit('update:modelValue', entity)
+  emit('update:entity', entity)
 }
 
 const showAlert: Ref<boolean> = ref(false)
@@ -266,7 +266,7 @@ const newPlace: Ref<boolean> = ref(false)
 const editPlace: Ref<boolean> = ref(false)
 
 /**
- * Si on clic sur le bouton "Ajouter un lieu", le choix dans la liste déroulante
+ * Si on clique sur le bouton "Ajouter un lieu", le choix dans la liste déroulante
  * est mise à nulle, et les champs input de l'adresse sont vidées
  * @param entity
  */
@@ -277,7 +277,7 @@ const onAddPlaceClick = function (entity: Event) {
 }
 
 /**
- * Quand on clic sur le bouton "Editer le lieu", une alerte s'affiche
+ * Quand on clique sur le bouton "Editer le lieu", une alerte s'affiche.
  */
 const onEditPlaceClick = function () {
   showAlert.value = true
@@ -299,7 +299,7 @@ const onEditPlaceConfirm = function () {
 }
 
 /**
- * Lorsque l'on choisit un lieu dans la liste déroulante, on mets a jour les champs
+ * Lorsque l'on choisit un lieu dans la liste déroulante, on met à jour les champs
  * input de l'adresse
  * @param entity
  */
@@ -317,11 +317,11 @@ const getPlace = async (entity: Event) => {
     entity.longitude = placeInstance.longitude
     editPlace.value = false
   } else {
-    //Dans le cas où l'on ne récupère aucune place on remet a null le formulaire de l'adresse
+    // Dans le cas où l'on ne récupère aucune place on remet à null le formulaire de l'adresse
     resetPlace(entity)
   }
 
-  emit('update:modelValue', entity)
+  emit('update:entity', entity)
 }
 
 /**

+ 2 - 2
components/Form/Parameter/AttendanceBookingReason.vue

@@ -3,7 +3,7 @@
     <v-row>
       <v-col cols="12" sm="6">
         <UiInputText
-          v-model="localEntity.reason"
+          v-model="proxyEntity.reason"
           field="reason"
           type="string"
           :rules="getAsserts('reason')"
@@ -24,7 +24,7 @@ const props = defineProps<{
 const emit = defineEmits(['update:entity'])
 
 // Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
-const localEntity = computed({
+const proxyEntity = computed({
   get: () => props.entity,
   set: (value) => emit('update:entity', value),
 })

+ 2 - 2
components/Form/Parameter/EducationTiming.vue

@@ -3,7 +3,7 @@
     <v-row>
       <v-col cols="12" sm="6">
         <UiInputNumber
-          v-model="localEntity.timing"
+          v-model="proxyEntity.timing"
           field="educationTiming"
           :rules="getAsserts('timing')"
         />
@@ -23,7 +23,7 @@ const props = defineProps<{
 const emit = defineEmits(['update:entity'])
 
 // Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
-const localEntity = computed({
+const proxyEntity = computed({
   get: () => props.entity,
   set: (value) => emit('update:entity', value),
 })

+ 2 - 2
components/Form/Parameter/ResidenceArea.vue

@@ -3,7 +3,7 @@
     <v-row>
       <v-col cols="12" sm="6">
         <UiInputText
-          v-model="localEntity.label"
+          v-model="proxyEntity.label"
           field="label"
           type="string"
           :rules="getAsserts('label')"
@@ -24,7 +24,7 @@ const props = defineProps<{
 const emit = defineEmits(['update:entity'])
 
 // Pour éviter l'erreur eslint "Unexpected mutation of "modelValue" prop"
-const localEntity = computed({
+const proxyEntity = computed({
   get: () => props.entity,
   set: (value) => emit('update:entity', value),
 })

+ 2 - 4
pages/freemium/dashboard.vue

@@ -20,7 +20,7 @@
                   v-if="statusUpcomingEvents == FETCHING_STATUS.PENDING"
                 />
 
-                <span v-if="upcomingEvents.items.length == 0" class="no_event">
+                <span v-if="upcomingEvents?.items.length == 0" class="no_event">
                   {{ $t('no_future_event') }}
                 </span>
                 <UiEventList
@@ -38,7 +38,7 @@
                 <UiLoadingPanel
                   v-if="statusPastEvents == FETCHING_STATUS.PENDING"
                 />
-                <span v-if="pastEvents.items.length == 0" class="no_event">
+                <span v-if="pastEvents?.items.length == 0" class="no_event">
                   {{ $t('no_past_event') }}
                 </span>
                 <UiEventList
@@ -107,7 +107,6 @@ import { type Ref, ref } from 'vue'
 import { useEntityFetch } from '~/composables/data/useEntityFetch'
 import Organization from '~/models/Freemium/Organization'
 import Event from '~/models/Freemium/Event'
-import type { AsyncData } from '#app'
 import OrderBy from '~/services/data/Filters/OrderBy'
 import {
   FETCHING_STATUS,
@@ -127,7 +126,6 @@ definePageMeta({
 })
 
 //Ref Définition
-const runtimeConfig = useRuntimeConfig()
 const { fetch, fetchCollection } = useEntityFetch()
 const { apiRequestService } = useApiLegacyRequestService()
 const { makeAdminUrl } = useAdminUrl()