index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <LayoutNavigation />
  3. <h1 class="title mt-12 mb-12">Toutes les news</h1>
  4. <div v-if="pending">{{ t("pending") }}</div>
  5. <div v-else>
  6. <v-row>
  7. <v-col>
  8. <div class="d-flex align-items-center ml-12 mt-6 mb-6">
  9. <div class="carousel-button">
  10. <i class="fa-solid fa-arrow-left" />
  11. </div>
  12. <nuxt-link to="/actualites" class="ml-2 back-button mt-6">
  13. Retour à l'accueil
  14. </nuxt-link>
  15. </div>
  16. </v-col>
  17. <v-pagination
  18. v-model="page"
  19. :length="Math.ceil(totalItems / itemsPerPage)"
  20. total-visible="9"
  21. @input="updatePage"
  22. rounded="circle"
  23. max="10"
  24. class="pagination mr-10 mt-6"
  25. :prev-icon="page !== 1 ? 'fas fa-arrow-left' : ''"
  26. :next-icon="
  27. page !== Math.ceil(totalItems / itemsPerPage)
  28. ? 'fas fa-arrow-right'
  29. : ''
  30. "
  31. />
  32. </v-row>
  33. <v-row
  34. class="d-flex align-center mr-10"
  35. v-for="(news, index) in news"
  36. :key="index"
  37. >
  38. <v-card class="container-green">
  39. <v-card-item>
  40. <v-container fluid>
  41. <v-row align="center">
  42. <v-col cols="3">
  43. <v-img
  44. :src="getImageUrl(news.attachment)"
  45. alt="poster"
  46. class="image-actu"
  47. height="200"
  48. width="400"
  49. />
  50. </v-col>
  51. <v-col cols="9">
  52. <div class="border">
  53. <NuxtLink
  54. :to="`/actualites/${news.id}`"
  55. class="text-decoration-none"
  56. >
  57. <v-card-title class="card-title">
  58. {{ news.title }}
  59. </v-card-title>
  60. </NuxtLink>
  61. <v-card-text class="infos">
  62. <div class="flex-container">
  63. <div class="text-container">
  64. <table>
  65. <tr>
  66. <td class="leadtext">
  67. {{ news.leadText }}
  68. </td>
  69. </tr>
  70. </table>
  71. </div>
  72. <div class="button-container">
  73. <v-card-actions class="justify-end">
  74. <v-btn class="btn" text>
  75. <v-icon class="fas fa-info mr-2"></v-icon>En savoir
  76. plus
  77. </v-btn>
  78. </v-card-actions>
  79. </div>
  80. </div>
  81. </v-card-text>
  82. <v-col :cols="actionsColumnWidth"> </v-col>
  83. </div>
  84. </v-col>
  85. </v-row>
  86. </v-container>
  87. </v-card-item>
  88. </v-card>
  89. </v-row>
  90. <v-pagination
  91. v-model="page"
  92. :length="Math.ceil(totalItems / itemsPerPage)"
  93. total-visible="9"
  94. @input="updatePage"
  95. rounded="circle"
  96. max="10"
  97. class="pagination mr-10"
  98. :prev-icon="page !== 1 ? 'fas fa-arrow-left' : ''"
  99. :next-icon="
  100. page !== Math.ceil(totalItems / itemsPerPage)
  101. ? 'fas fa-arrow-right'
  102. : ''
  103. "
  104. />
  105. </div>
  106. </template>
  107. <script setup lang="ts">
  108. import { ref, onMounted, watch } from "vue";
  109. import { useMaestroRequestService } from "~/composables/useMaestroRequestService";
  110. const { apiRequestService } = useMaestroRequestService();
  111. const currentPage = ref(1);
  112. const totalPages = ref(0);
  113. const page: Ref<number> = ref(1);
  114. const itemsPerPage: Ref<number> = ref(10);
  115. const { t } = useI18n();
  116. const updatePage = (newPage: number) => {
  117. console.log("updatePage", newPage);
  118. page.value = newPage;
  119. };
  120. // récupère les événements en fonction des filtres
  121. const query = computed(() => {
  122. const queryParams: { page: number; [key: string]: number | string } = {
  123. page: page.value,
  124. };
  125. return queryParams;
  126. });
  127. const getImageUrl = (attachment: string) => {
  128. return `https://local.maestro.opentalent.fr/uploads/news/${attachment}`;
  129. };
  130. const totalItems = ref(0);
  131. // data event list using lazy loading
  132. const {
  133. data: news = [],
  134. pending,
  135. refresh,
  136. } = useLazyAsyncData("files", async () => {
  137. const response = await apiRequestService.get(
  138. "https://local.maestro.opentalent.fr/api/news",
  139. query.value
  140. );
  141. const collection = response["hydra:member"];
  142. totalItems.value = response["hydra:totalItems"];
  143. console.log(collection);
  144. return collection;
  145. });
  146. watch(page, () => {
  147. refresh();
  148. });
  149. </script>
  150. <style scoped>
  151. .v-container {
  152. padding: 0 !important;
  153. }
  154. .v-card-text {
  155. letter-spacing: 0 !important;
  156. padding: 0 !important;
  157. }
  158. .v-card-item {
  159. padding: 0 !important;
  160. }
  161. .title {
  162. color: #d1cdc7;
  163. margin-left: 3rem;
  164. margin-top: 2rem;
  165. font-family: Barlow;
  166. font-size: 4rem;
  167. font-style: normal;
  168. font-weight: 600;
  169. line-height: 42px;
  170. }
  171. .border {
  172. border: 1px solid white !important;
  173. padding: 9px;
  174. border-radius: 20px;
  175. width: 99%;
  176. }
  177. .image-actu {
  178. width: 80%;
  179. margin-left: auto;
  180. margin-right: auto;
  181. }
  182. .btn {
  183. background: var(--Vert-60, #64afb7);
  184. display: flex;
  185. left: 0;
  186. padding: 25px 28px;
  187. align-items: center;
  188. gap: 9px;
  189. color: var(--NEUTRAL---BLANC, #fff);
  190. font-family: Barlow;
  191. font-size: 0.9rem;
  192. border-radius: 5px;
  193. font-style: normal;
  194. font-weight: 700;
  195. line-height: 15px;
  196. letter-spacing: 1.3px;
  197. text-transform: uppercase;
  198. margin-bottom: -1rem;
  199. }
  200. .card-title {
  201. color: #FFF;
  202. font-family: Barlow;
  203. font-size: 36px;
  204. font-style: normal;
  205. font-weight: 600;
  206. line-height: 39px
  207. }
  208. .container-green {
  209. border-radius: 10px;
  210. min-width: 100%;
  211. background: #112528;
  212. margin-bottom: 1rem;
  213. margin-left: 2rem;
  214. margin-right: 2rem;
  215. padding-top: 0.2rem;
  216. padding-bottom: 0.2rem;
  217. height: 60%;
  218. }
  219. .infos {
  220. color: #fff;
  221. }
  222. .pagination {
  223. align-items: center;
  224. margin-top: 16px;
  225. margin-bottom: 16px;
  226. color: #112528;
  227. }
  228. .leadtext {
  229. color: #FFF;
  230. font-family: Barlow;
  231. font-size: 22px;
  232. font-style: normal;
  233. font-weight: 500;
  234. line-height: 26px;
  235. margin-left: 1rem;
  236. }
  237. .carousel-button {
  238. display: flex;
  239. justify-content: center;
  240. align-items: center;
  241. width: 60px;
  242. height: 60px;
  243. background-color: transparent;
  244. border: 2px solid #000000;
  245. cursor: pointer;
  246. margin-right: 1rem;
  247. }
  248. .back-button {
  249. text-decoration: none;
  250. color: #000000;
  251. font-family: Barlow;
  252. font-size: 0.9rem;
  253. font-style: normal;
  254. font-weight: 700;
  255. line-height: 15px;
  256. letter-spacing: 1.8px;
  257. text-transform: uppercase;
  258. }
  259. </style>