dashboard.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <v-container fluid>
  3. <v-row>
  4. <!-- Bloc événements -->
  5. <v-col cols="12" md="8">
  6. <v-card>
  7. <v-tabs v-model="tab">
  8. <v-tab value="future">Mes événements à venir</v-tab>
  9. <v-tab value="past">Mes événements passés</v-tab>
  10. </v-tabs>
  11. <v-tabs-window v-model="tab">
  12. <v-tabs-window-item value="future">
  13. <UiEventList
  14. :events="upcomingEvents"
  15. @load-next="loadNextUpcoming"
  16. @load-prev="loadPrevUpcoming"
  17. @edit="editEvent"
  18. @delete="deleteEvent"
  19. />
  20. </v-tabs-window-item>
  21. <v-tabs-window-item value="past">
  22. <UiEventList
  23. :events="pastEvents"
  24. @load-next="loadNextPast"
  25. @load-prev="loadPrevPast"
  26. @edit="editEvent"
  27. @delete="deleteEvent"
  28. />
  29. </v-tabs-window-item>
  30. </v-tabs-window>
  31. <v-card-actions>
  32. <v-btn color="primary" to="events/new">Ajouter un événement</v-btn>
  33. </v-card-actions>
  34. </v-card>
  35. </v-col>
  36. <!-- Bloc structure -->
  37. <v-col cols="12" md="4">
  38. <v-card>
  39. <v-card-title>Structure</v-card-title>
  40. <v-card-text>
  41. <div><strong>Nom:</strong> {{ organization?.name }}</div>
  42. <div><strong>Email:</strong> {{ organization?.email }}</div>
  43. </v-card-text>
  44. <v-card-actions>
  45. <v-btn color="secondary" to="organization">Modifier la structure</v-btn>
  46. </v-card-actions>
  47. </v-card>
  48. </v-col>
  49. </v-row>
  50. </v-container>
  51. </template>
  52. <script setup lang="ts">
  53. import {useAp2iRequestService} from "~/composables/data/useAp2iRequestService";
  54. definePageMeta({
  55. name: 'freemium_dashboard_page',
  56. })
  57. import { ref } from 'vue'
  58. import {useEntityFetch} from "~/composables/data/useEntityFetch";
  59. import Organization from "~/models/Freemium/Organization";
  60. import type {AsyncData} from "#app";
  61. const tab = ref(null)
  62. const {apiRequestService, pending} = useAp2iRequestService()
  63. const { fetch } = useEntityFetch()
  64. const { data: organization } = fetch(
  65. Organization
  66. ) as AsyncData<Organization | null, Error | null>
  67. // Pagination state
  68. const upcomingPage = ref(1)
  69. const pastPage = ref(1)
  70. const upcomingEvents = ref<Event[]>([{
  71. 'id': 1,
  72. 'name': "Mon événement",
  73. 'date': "2025/10/25",
  74. 'location': "Cluses",
  75. 'image': "https://www.ville-lecastellet.fr/wp-content/uploads/sites/2/2022/04/declaration-devenements.jpg"
  76. },
  77. {
  78. 'id': 2,
  79. 'name': "Noel",
  80. 'date': "2025/12/25",
  81. 'location': "Thyez",
  82. 'image': "https://www.maisonvictor.fr/img/cms/sapin%20de%20noel.jpg"
  83. }
  84. ])
  85. const pastEvents = ref<Event[]>([{
  86. 'id': 3,
  87. 'name': "Musique en stock",
  88. 'date': "2025/07/03",
  89. 'location': "Scionzier",
  90. 'image': "https://musiquesenstock.fr/wp-content/uploads/MES2025_AFF_H-1024x695.jpg"
  91. }])
  92. function loadNextUpcoming() {
  93. upcomingPage.value++
  94. fetchUpcoming()
  95. }
  96. function loadPrevUpcoming() {
  97. if (upcomingPage.value > 1) upcomingPage.value--
  98. fetchUpcoming()
  99. }
  100. function loadNextPast() {
  101. pastPage.value++
  102. fetchPast()
  103. }
  104. function loadPrevPast() {
  105. if (pastPage.value > 1) pastPage.value--
  106. fetchPast()
  107. }
  108. function fetchUpcoming() {
  109. // TODO: call API with page=upcomingPage
  110. console.log('fetch upcoming events page', upcomingPage.value)
  111. }
  112. function fetchPast() {
  113. // TODO: call API with page=pastPage
  114. console.log('fetch past events page', pastPage.value)
  115. }
  116. function editEvent(eventId: number) {
  117. // TODO: navigate to event edit page
  118. console.log('edit event', eventId)
  119. }
  120. function deleteEvent(eventId: number) {
  121. // TODO: call delete API then refresh
  122. console.log('delete event', eventId)
  123. }
  124. function addEvent() {
  125. // TODO: navigate to add event page
  126. console.log('add new event')
  127. }
  128. </script>
  129. <style scoped>
  130. .v-card {
  131. margin-bottom: 16px;
  132. }
  133. </style>