index.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <LayoutNavigation />
  3. <div v-if="shouldShowStickyMenu" id="sticky-menu">
  4. <CommonStickyMenu
  5. :shouldShowStickyMenu="shouldShowStickyMenu"
  6. :squaresData="squaresData"
  7. />
  8. </div>
  9. <JoinUsBanner />
  10. <JoinUsMissions />
  11. <LayoutFooterPrefooter />
  12. <LayoutFooter id="layout-footer" />
  13. </template>
  14. <script setup lang="ts">
  15. import { ref } from "vue";
  16. import { useMaestroRequestService } from "~/composables/useMaestroRequestService";
  17. const { apiRequestService } = useMaestroRequestService();
  18. const query = computed(() => {
  19. const queryParams: { page: number; type?: string; [key: string]: number | string } = {
  20. page: page.value,
  21. type: 'ENTREPRISE'
  22. };
  23. return queryParams;
  24. });
  25. // Base URL for API requests
  26. const totalItems = ref(0);
  27. const config = useRuntimeConfig();
  28. const baseUrl = `${config.public.apiBaseUrl}/api/job-postings`;
  29. const page: Ref<number> = ref(1);
  30. const itemsPerPage: Ref<number> = ref(10);
  31. const { t } = useI18n();
  32. const {
  33. data: jobs = [],
  34. pending,
  35. refresh,
  36. } = useLazyAsyncData("files", async () => {
  37. const response = await apiRequestService.get(baseUrl, query.value);
  38. const collection = response["hydra:member"];
  39. const currentDate = new Date();
  40. const filteredJobs = collection.filter(item => {
  41. const endPublicationDate = new Date(item.endPublication);
  42. return item.type === 'ENTREPRISE' && endPublicationDate >= currentDate;
  43. });
  44. totalItems.value = filteredJobs.length;
  45. console.log(filteredJobs);
  46. return filteredJobs;
  47. });
  48. </script>
  49. <style scoped>
  50. #sticky-menu {
  51. position: sticky;
  52. top: 20rem;
  53. z-index: 1;
  54. margin-bottom: -32rem;
  55. float: right;
  56. }
  57. @media (max-width: 1800px) {
  58. #sticky-menu {
  59. top: 16rem;
  60. margin-bottom: -28rem;
  61. }
  62. }
  63. </style>