Kaynağa Gözat

fix eslint errors

Olivier Massot 6 ay önce
ebeveyn
işleme
6cf6dd846d

+ 3 - 3
components/Layout/Parameters/Table.vue

@@ -26,13 +26,13 @@ A data table for the parameters page
 
           <td class="d-flex flex-row justify-center actions-cell">
             <v-menu min-width="120" location="end" class="action-menu">
-              <template #activator="{ props }">
+              <template #activator="{ props: menuProps }">
                 <v-btn
                   v-if="
                     actions.includes(TABLE_ACTION.EDIT) ||
                     actions.includes(TABLE_ACTION.DELETE)
                   "
-                  v-bind="props"
+                  v-bind="menuProps"
                   :flat="true"
                   icon="fas fa-ellipsis-vertical"
                 />
@@ -136,7 +136,7 @@ const props = defineProps({
   actions: {
     type: Array as PropType<Array<TABLE_ACTION>>,
     required: false,
-    default: [TABLE_ACTION.EDIT, TABLE_ACTION.DELETE, TABLE_ACTION.ADD],
+    default: () => [TABLE_ACTION.EDIT, TABLE_ACTION.DELETE, TABLE_ACTION.ADD],
   },
   /**
    * The URL for the edit / create pages

+ 1 - 1
components/Layout/Parameters/Website/ActivationSwitch.vue

@@ -79,7 +79,7 @@ const onDialogYesBtnClick = () => {
 
 const onDialogNoBtnClick = () => {
   showWebsiteDeactivationDialog.value = false
-  props.modelValue = true
+  emit('update:modelValue', true)
 }
 </script>
 

+ 1 - 3
components/Layout/SubHeader/Breadcrumbs.vue

@@ -30,9 +30,7 @@ const items: ComputedRef<Array<AnyJson>> = computed(() => {
   pathPart.forEach((part) => {
     path = UrlUtils.join(path, part)
 
-    let match
-
-    match = router.resolve(path)
+    const match = router.resolve(path)
     if (match.name) {
       crumbs.push({
         title: !parseInt(part, 10)

+ 1 - 1
components/Layout/SubHeader/DataTimingRange.vue

@@ -39,7 +39,7 @@ const datesRange: Ref<Array<Date> | null> = ref(
   start && end ? [new Date(start), new Date(end)] : null,
 )
 
-const updateDateTimeRange = async (dates: Array<Date>): Promise<any> => {
+const updateDateTimeRange = async (dates: Array<Date>): Promise<void> => {
   const accessId = accessProfileStore.currentAccessId
 
   datesRange.value = dates

+ 9 - 5
components/Ui/Button/Submit.vue

@@ -18,7 +18,7 @@
       :nudge-top="dropDirection === 'top' ? 6 : 0"
       :nudge-bottom="dropDirection === 'bottom' ? 6 : 0"
     >
-      <template #activator="{ on, attrs }">
+      <template #activator="{ on }">
         <v-toolbar-title v-on="on">
           <v-icon class="pl-3 pr-3">
             {{
@@ -29,16 +29,16 @@
       </template>
       <v-list :min-width="menuSize">
         <v-list-item
-          v-for="(action, index) in actions"
-          v-if="index > 0"
+          v-for="(action, index) in otherActions"
           :key="index"
           dense
           class="subAction"
         >
           <v-list-item-title
             @click="submitAction(action)"
-            v-text="$t(action)"
-          />
+          >
+            {{ $t(action) }}
+          </v-list-item-title>
         </v-list-item>
       </v-list>
     </v-menu>
@@ -85,6 +85,10 @@ const mainAction: ComputedRef<string> = computed(() => {
 const hasOtherActions: ComputedRef<boolean> = computed(() => {
   return props.actions.length > 1
 })
+
+const otherActions: ComputedRef<Array<string>> = computed(() => {
+  return props.actions.filter((_, index) => index > 0) as Array<string>
+})
 </script>
 
 <style scoped>

+ 3 - 1
components/Ui/Collection.vue

@@ -5,7 +5,7 @@
     <v-skeleton-loader v-if="pending" :type="loaderType" />
     <div v-else>
       <!-- Content -->
-      <slot name="list.item" v-bind="{ collection.items }" />
+      <slot name="list.item" v-bind="{ items: collection?.items }" />
 
       <!-- New button -->
       <v-btn v-if="newLink" class="theme-primary float-right">
@@ -33,6 +33,7 @@ const props = defineProps({
   parent: {
     type: Object,
     required: false,
+    default: () => null,
   },
   loaderType: {
     type: String,
@@ -42,6 +43,7 @@ const props = defineProps({
   newLink: {
     type: String,
     required: false,
+    default: null,
   },
 })
 

+ 10 - 4
components/Ui/DataTable.vue

@@ -13,9 +13,9 @@ Tableau interactif conçu pour l'affichage d'une collection d'entités
       :loading="$fetchState.pending"
       class="elevation-1"
     >
-      <template v-for="(header, index) in headersWithItem" :key="index" #[header.item]="props">
-        <slot :name="header.item" v-bind="props">
-          {{ props.item[header.value] }}
+      <template v-for="(header, index) in headersWithItem" :key="index" #[header.item]="slotProps">
+        <slot :name="header.item" v-bind="slotProps">
+          {{ slotProps.item[header.value] }}
         </slot>
       </template>
 
@@ -51,8 +51,14 @@ const props = defineProps({
 
 const { parent, model, headers } = toRefs(props)
 
+interface TableHeader {
+  value: string;
+  item?: string;
+  [key: string]: string | undefined;
+}
+
 const headersWithItem = computed(() => {
-  return headers.value.map((header: any) => {
+  return headers.value.map((header: TableHeader) => {
     header.item = 'item.' + header.value
     return header
   })

+ 1 - 1
env/setupEnv.mjs

@@ -32,7 +32,7 @@ const environments = {
   ci: '.env.ci',
 }
 
-if (!environments.hasOwnProperty(hostname)) {
+if (!Object.prototype.hasOwnProperty.call(environments, hostname)) {
   throw new Error('Critical : unknown environment [' + hostname + ']')
 }
 

+ 38 - 36
pages/parameters/attendances.vue

@@ -1,44 +1,46 @@
 <template>
-  <LayoutParametersSection v-if="organizationProfile.isSchool">
-    <h4>{{ $t('alert_configuration') }}</h4>
-    <UiLoadingPanel v-if="pending" />
-    <UiForm v-else-if="parameters !== null" v-model="parameters">
-      <v-row>
-        <v-col cols="12">
-          <UiInputCheckbox
-            v-model="parameters.sendAttendanceEmail"
-            field="sendAttendanceEmail"
-            label="sendAttendanceEmail"
-          />
+  <div>
+    <LayoutParametersSection v-if="organizationProfile.isSchool">
+      <h4>{{ $t('alert_configuration') }}</h4>
+      <UiLoadingPanel v-if="pending" />
+      <UiForm v-else-if="parameters !== null" v-model="parameters">
+        <v-row>
+          <v-col cols="12">
+            <UiInputCheckbox
+              v-model="parameters.sendAttendanceEmail"
+              field="sendAttendanceEmail"
+              label="sendAttendanceEmail"
+            />
 
-          <UiInputCheckbox
-            v-model="parameters.sendAttendanceSms"
-            field="sendAttendanceSms"
-          />
+            <UiInputCheckbox
+              v-model="parameters.sendAttendanceSms"
+              field="sendAttendanceSms"
+            />
 
-          <UiInputCheckbox
-            v-model="parameters.notifyAdministrationAbsence"
-            field="notifyAdministrationAbsence"
-          />
+            <UiInputCheckbox
+              v-model="parameters.notifyAdministrationAbsence"
+              field="notifyAdministrationAbsence"
+            />
 
-          <UiInputNumber
-            v-if="parameters.notifyAdministrationAbsence"
-            v-model="parameters.numberConsecutiveAbsences"
-            field="numberConsecutiveAbsences"
-            :rules="rules()"
-          />
-        </v-col>
-      </v-row>
-    </UiForm>
-  </LayoutParametersSection>
+            <UiInputNumber
+              v-if="parameters.notifyAdministrationAbsence"
+              v-model="parameters.numberConsecutiveAbsences"
+              field="numberConsecutiveAbsences"
+              :rules="rules()"
+            />
+          </v-col>
+        </v-row>
+      </UiForm>
+    </LayoutParametersSection>
 
-  <LayoutParametersSection>
-    <LayoutParametersEntityTable
-      :model="AttendanceBookingReason"
-      :title="$t('attendanceBookingReasons')"
-      :columns-definitions="[{ property: 'reason' }]"
-    />
-  </LayoutParametersSection>
+    <LayoutParametersSection>
+      <LayoutParametersEntityTable
+        :model="AttendanceBookingReason"
+        :title="$t('attendanceBookingReasons')"
+        :columns-definitions="[{ property: 'reason' }]"
+      />
+    </LayoutParametersSection>
+  </div>
 </template>
 <script setup lang="ts">
 import type { AsyncData } from '#app'

+ 32 - 30
pages/subscription.vue

@@ -4,24 +4,25 @@ Page 'Mon abonnement'
 @see https://ressources.opentalent.fr/display/SPEC/Mon+abonnement
 -->
 <template>
-  <LayoutContainer>
-    <v-expansion-panels v-model="openedPanels" :multiple="true">
-      <UiExpansionPanel title="subscription_page" icon="fas fa-info">
-        <v-container fluid class="container">
-          <v-row>
-            <v-col cols="12" lg="6" sm="12">
-              {{ $t('version') }} :
-              <strong>{{
-                dolibarrAccount ? $t(dolibarrAccount.product) : '-'
-              }}</strong>
-            </v-col>
-            <v-col cols="12" lg="6" sm="12">
-              {{ $t('client_id') }} :
-              {{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}
-            </v-col>
-          </v-row>
-        </v-container>
-      </UiExpansionPanel>
+  <div>
+    <LayoutContainer>
+      <v-expansion-panels v-model="openedPanels" :multiple="true">
+        <UiExpansionPanel title="subscription_page" icon="fas fa-info">
+          <v-container fluid class="container">
+            <v-row>
+              <v-col cols="12" lg="6" sm="12">
+                {{ $t('version') }} :
+                <strong>{{
+                  dolibarrAccount ? $t(dolibarrAccount.product) : '-'
+                }}</strong>
+              </v-col>
+              <v-col cols="12" lg="6" sm="12">
+                {{ $t('client_id') }} :
+                {{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}
+              </v-col>
+            </v-row>
+          </v-container>
+        </UiExpansionPanel>
 
       <UiExpansionPanel
         v-if="dolibarrAccount && dolibarrAccount.contract"
@@ -420,18 +421,19 @@ Page 'Mon abonnement'
         </v-container>
       </UiExpansionPanel>
     </v-expansion-panels>
-  </LayoutContainer>
-
-  <LayoutDialogTrialAlreadyDid
-    :show="showDialogTrialAllReadyDid"
-    @close-dialog="showDialogTrialAllReadyDid = false"
-  />
-
-  <LayoutDialogTrialStopConfirmation
-    :show="showDialogTrialStopConfirmation"
-    @close-dialog="showDialogTrialStopConfirmation = false"
-    @stop-trial="stopTrial"
-  />
+    </LayoutContainer>
+
+    <LayoutDialogTrialAlreadyDid
+      :show="showDialogTrialAllReadyDid"
+      @close-dialog="showDialogTrialAllReadyDid = false"
+    />
+
+    <LayoutDialogTrialStopConfirmation
+      :show="showDialogTrialStopConfirmation"
+      @close-dialog="showDialogTrialStopConfirmation = false"
+      @stop-trial="stopTrial"
+    />
+  </div>
 </template>
 
 <script setup lang="ts">