|
|
@@ -1,17 +1,55 @@
|
|
|
<template>
|
|
|
<LayoutContainer>
|
|
|
<UiLoadingPanel v-if="pending" />
|
|
|
- <div v-else>
|
|
|
- <!-- Afficher la liste des résidences -->
|
|
|
- <ul>
|
|
|
- <li v-for="area in allResidenceArea" :key="area.id">
|
|
|
- {{ area.label }}
|
|
|
- <UiButtonDelete :model="ResidenceArea" :entity="area" />
|
|
|
- <span class="edit-icon" @click="goToEditPage(area.id)">✏️</span>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <button @click="goToCreatePage">Nouveau</button>
|
|
|
+ <v-container v-else style="width: 500px;">
|
|
|
+ <v-col cols="12">
|
|
|
+ <v-row class="justify-center">
|
|
|
+ <v-table class="w-100">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <td>{{ $t('residenceAreas') }}</td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr v-if="residenceAreas.length > 0" v-for="residenceArea in residenceAreas" :key="residenceArea.id">
|
|
|
+ <td class="cycle-editable-cell">
|
|
|
+ {{ residenceArea.label }}
|
|
|
+ </td>
|
|
|
+ <td class="d-flex flex-row">
|
|
|
+ <v-btn
|
|
|
+ :flat="true"
|
|
|
+ icon="fa fa-pen"
|
|
|
+ class="cycle-edit-icon mr-3"
|
|
|
+ @click="goToEditPage(residenceArea.id as number)"
|
|
|
+ />
|
|
|
+ <UiButtonDelete
|
|
|
+ :model="ResidenceArea"
|
|
|
+ :entity="residenceArea"
|
|
|
+ :flat="true"
|
|
|
+ class="cycle-edit-icon"
|
|
|
+ />
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr v-else class="theme-neutral">
|
|
|
+ <td><i>{{ $t('nothing_to_show')}}</i></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </v-table>
|
|
|
+ </v-row>
|
|
|
+ <v-row class="justify-end">
|
|
|
+ <v-btn
|
|
|
+ :flat="true"
|
|
|
+ prepend-icon="fa fa-plus"
|
|
|
+ class="theme-primary mt-2"
|
|
|
+ @click="goToCreatePage"
|
|
|
+ >
|
|
|
+ {{ $t('add') }}
|
|
|
+ </v-btn>
|
|
|
+ </v-row>
|
|
|
+ </v-col>
|
|
|
+ </v-container>
|
|
|
</LayoutContainer>
|
|
|
</template>
|
|
|
|
|
|
@@ -21,24 +59,26 @@ import ResidenceArea from '~/models/Billing/ResidenceArea'
|
|
|
import { useRepo } from 'pinia-orm'
|
|
|
import ResidenceAreasRepository from '~/stores/repositories/ResidenceAreasRepository'
|
|
|
import { useRouter } from 'vue-router'
|
|
|
+import UrlUtils from "~/services/utils/urlUtils";
|
|
|
+import EducationTiming from "~/models/Education/EducationTiming";
|
|
|
const residenceAreasRepo = useRepo(ResidenceAreasRepository)
|
|
|
|
|
|
const router = useRouter()
|
|
|
const { fetchCollection } = useEntityFetch()
|
|
|
const i18n = useI18n()
|
|
|
|
|
|
-const { data: residence_areas, pending } = fetchCollection(ResidenceArea)
|
|
|
+const { pending } = fetchCollection(ResidenceArea)
|
|
|
|
|
|
/**
|
|
|
- * On récupère les Residence Area via le store
|
|
|
+ * On récupère les Residence Area via le store
|
|
|
* (sans ça, les mises à jour SSE ne seront pas prises en compte)
|
|
|
*/
|
|
|
- const allResidenceArea: ComputedRef<Array<ResidenceArea>> = computed(() => {
|
|
|
+ const residenceAreas: ComputedRef<Array<ResidenceArea>> = computed(() => {
|
|
|
return residenceAreasRepo.getResidenceAreas()
|
|
|
})
|
|
|
|
|
|
const goToEditPage = (id: number) => {
|
|
|
- navigateTo(`/parameters/residence_areas/${id}`)
|
|
|
+ navigateTo(UrlUtils.join('/parameters/residence_areas', id))
|
|
|
}
|
|
|
|
|
|
const goToCreatePage = () => {
|
|
|
@@ -46,4 +86,10 @@ const goToCreatePage = () => {
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped lang="scss"></style>
|
|
|
+<style scoped lang="scss">
|
|
|
+// TODO: voir à factoriser ces styles, ptêt en faisant un component de ces boutons?
|
|
|
+:deep(.cycle-edit-icon .v-icon) {
|
|
|
+ color: rgb(var(--v-theme-primary));
|
|
|
+ font-size: 18px;
|
|
|
+}
|
|
|
+</style>
|