Переглянути джерело

implement new system in parameters page

Olivier Massot 1 рік тому
батько
коміт
46648c4bcd

+ 2 - 2
pages/parameters/attendances.vue

@@ -39,8 +39,8 @@
             <td></td>
           </tr>
         </thead>
-        <tbody v-if="attendanceBookingReasons!.items.length > 0">
-          <tr v-for="reason in attendanceBookingReasons!.items" :key="reason.id">
+        <tbody v-if="attendanceBookingReasons!.value.items.length > 0">
+          <tr v-for="reason in attendanceBookingReasons!.value.items" :key="reason.id">
             <td class="cycle-editable-cell">
               {{ reason.reason }}
             </td>

+ 3 - 13
pages/parameters/education_timings/index.vue

@@ -9,8 +9,8 @@
             <td></td>
           </tr>
         </thead>
-        <tbody v-if="educationTimings.length > 0">
-          <tr v-for="timing in educationTimings" :key="timing.id">
+        <tbody v-if="educationTimings!.value.items.length > 0">
+          <tr v-for="timing in educationTimings!.value.items" :key="timing.id">
             <td class="cycle-editable-cell">
               {{ timing.timing }}
             </td>
@@ -68,17 +68,7 @@ if (organizationProfile.parametersId === null) {
 
 const { fetchCollection } = useEntityFetch()
 
-const { pending } = fetchCollection(EducationTiming)
-
-const educationTimingRepo = useRepo(EducationTimingsRepository)
-
-/**
- * On récupère les timings via le store
- * (sans ça, les mises à jour SSE ne seront pas prises en compte)
- */
-const educationTimings: ComputedRef<Array<EducationTiming>> = computed(() => {
-  return educationTimingRepo.getEducationTimings()
-})
+const { data: educationTimings, pending } = fetchCollection(EducationTiming)
 
 const goToEditPage = (id: number) => {
   navigateTo(UrlUtils.join('/parameters/education_timings', id))

+ 2 - 2
pages/parameters/residence_areas/index.vue

@@ -9,8 +9,8 @@
             <td></td>
           </tr>
         </thead>
-        <tbody v-if="residenceAreas!.items.length > 0">
-          <tr v-for="residenceArea in residenceAreas!.items" :key="residenceArea.id">
+        <tbody v-if="residenceAreas!.value.items.length > 0">
+          <tr v-for="residenceArea in residenceAreas!.value.items" :key="residenceArea.id">
             <td class="cycle-editable-cell">
               {{ residenceArea.label }}
             </td>

+ 1 - 1
pages/parameters/teaching.vue

@@ -91,7 +91,7 @@ const orderedCycles: ComputedRef<AnyJson> = computed(() => {
     orderedCycles[enumItem.value] = null
   }
 
-  for (const cycle of cycles.value.items) {
+  for (const cycle of cycles.value.value.items) {
     if (!Object.prototype.hasOwnProperty.call(orderedCycles, cycle.cycleEnum)) {
       console.error('Unknown cycle enum : ' + cycle.cycleEnum)
       continue

+ 3 - 3
pages/parameters/website.vue

@@ -45,10 +45,10 @@
             </div>
             <UiLoadingPanel v-if="subdomainsPending" />
             <div v-else>
-              <v-table v-if="subdomains!.items.value" class="subdomains-table my-2">
+              <v-table v-if="subdomains!.value.items" class="subdomains-table my-2">
                 <tbody>
                   <tr
-                    v-for="subdomain in subdomains!.items.value"
+                    v-for="subdomain in subdomains!.value.items"
                     :key="subdomain.id"
                     :title="subdomain.subdomain"
                     :class="
@@ -172,7 +172,7 @@ const { data: subdomains, pending: subdomainsPending } = fetchCollection(
 )
 
 const canAddNewSubdomain: ComputedRef<boolean> = computed(
-  () => subdomains.value !== null && subdomains.value.items.length < 3,
+  () => subdomains.value !== null && subdomains.value.value.items.length < 3,
 )
 
 const goToEditPage = (id: number) => {