Missions.client.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <LayoutContainer>
  3. <div v-if="pending">
  4. <v-row class="justify-center progress">
  5. <v-progress-circular indeterminate color="grey" />
  6. </v-row>
  7. </div>
  8. <div
  9. v-for="(job, index) in jobs"
  10. v-else
  11. :key="index"
  12. class="mission-container"
  13. >
  14. <div class="title-container">
  15. <NuxtLink :to="`/nous-rejoindre/${job.id}`" class="title">
  16. {{ job.title }} - {{ $t(job.contractType) }}
  17. <v-icon v-if="job.featured" class="star fas fa-star" />
  18. </NuxtLink>
  19. <v-btn :to="`/nous-rejoindre/${job.id}`" class="btn-more">
  20. En savoir plus
  21. </v-btn>
  22. </div>
  23. <div class="location-container">
  24. <v-icon icon="fas fa-map-marker" />
  25. <div class="location">
  26. {{ job.city }}
  27. </div>
  28. </div>
  29. </div>
  30. <v-row>
  31. <v-col cols="12">
  32. <LayoutPagination
  33. v-if="
  34. jobCollection &&
  35. jobCollection.pagination &&
  36. jobCollection.pagination.last > 1
  37. "
  38. :model-value="page"
  39. :pagination="jobCollection.pagination"
  40. class="mt-4"
  41. @update:model-value="onPageUpdated"
  42. />
  43. </v-col>
  44. </v-row>
  45. <v-row class="mb-6">
  46. <v-col cols="12">
  47. <p class="apply-now">
  48. Nous sommes toujours à la recherche de nouveaux talents.<br />
  49. N'hésitez pas à déposer votre candidature ci-dessous :
  50. </p>
  51. </v-col>
  52. </v-row>
  53. <v-row>
  54. <v-col cols="12">
  55. <v-btn class="btn-send" @click="dialog = true">
  56. Envoyer ma candidature
  57. </v-btn>
  58. </v-col>
  59. </v-row>
  60. <!-- Boite de dialogue "soumettre une candidature" -->
  61. <v-dialog
  62. v-model="dialog"
  63. max-width="600px"
  64. :persistent="!jobApplicationSent"
  65. no-click-animation
  66. :retain-focus="false"
  67. >
  68. <div v-if="!jobApplicationSent">
  69. <JoinUsForm @submit="onFormSubmit" />
  70. <v-btn @click="dialog = false"> Annuler </v-btn>
  71. </div>
  72. <div v-else>
  73. <v-card class="pa-6 text-center">
  74. Votre candidature a bien été envoyée, merci de votre intérêt.<br />
  75. Nous vous recontacterons dès que possible.
  76. </v-card>
  77. <v-btn @click="dialog = false"> Fermer </v-btn>
  78. </div>
  79. </v-dialog>
  80. </LayoutContainer>
  81. </template>
  82. <script setup lang="ts">
  83. import type { ComputedRef, Ref } from 'vue'
  84. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  85. import JobPosting from '~/models/Maestro/JobPosting'
  86. import type { AnyJson } from '~/types/data'
  87. const { fetchCollection } = useEntityFetch()
  88. const page: Ref<number> = ref(1)
  89. const query: ComputedRef<AnyJson> = computed(() => {
  90. return { type: 'BUSINESS', page: page.value }
  91. })
  92. const {
  93. data: jobCollection,
  94. pending,
  95. refresh,
  96. } = fetchCollection(JobPosting, null, query)
  97. // TODO: voir pourquoi on se retrouve obligé de passer par ce computed pour avoir le type TS correct?
  98. const jobs: ComputedRef<JobPosting[]> = computed(() => {
  99. return jobCollection.value !== null
  100. ? (jobCollection.value.items as JobPosting[])
  101. : []
  102. })
  103. const onPageUpdated = async (newVal: number): Promise<void> => {
  104. page.value = newVal
  105. pending.value = true
  106. await refresh()
  107. // TODO: remplacer par un watcher sur pending?
  108. setTimeout(
  109. async () => await navigateTo({ path: '', hash: '#join-us-anchor' }),
  110. 200
  111. )
  112. }
  113. /**
  114. * Faut-il afficher la boite de dialogue de candidature
  115. */
  116. const dialog = ref(false)
  117. const jobApplicationSent: Ref<boolean> = ref(false)
  118. const onFormSubmit = () => {
  119. jobApplicationSent.value = true
  120. }
  121. </script>
  122. <style scoped lang="scss">
  123. .progress {
  124. margin: 32px auto 128px auto;
  125. }
  126. .v-btn {
  127. font-weight: 600;
  128. height: 50px;
  129. border-radius: 6px;
  130. color: var(--on-neutral-color);
  131. gap: 9px;
  132. }
  133. .v-btn:hover {
  134. background-color: var(--on-neutral-color-extra-light);
  135. }
  136. .mission-container {
  137. margin: 64px 12%;
  138. .title-container {
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: center;
  142. background: var(--primary-color);
  143. color: var(--on-primary-color);
  144. height: 80px;
  145. padding: 10px 10px 10px 1px;
  146. @media (max-width: 600px) {
  147. flex-direction: column;
  148. height: auto;
  149. }
  150. .title {
  151. font-weight: 600;
  152. font-size: 1.5rem;
  153. line-height: 39px;
  154. color: var(--on-primary-color);
  155. text-decoration: none;
  156. margin-left: 36px;
  157. @media (max-width: 600px) {
  158. font-size: 1.2rem;
  159. margin-left: auto;
  160. margin-right: auto;
  161. width: 90%;
  162. }
  163. }
  164. .star {
  165. margin-left: 12px;
  166. font-size: 24px;
  167. color: yellow;
  168. vertical-align: baseline;
  169. }
  170. .btn-more {
  171. margin-right: 8px;
  172. display: flex;
  173. align-items: center;
  174. @media (max-width: 600px) {
  175. margin: 12px auto;
  176. }
  177. }
  178. }
  179. .location-container {
  180. background: var(--secondary-color);
  181. display: flex;
  182. align-items: center;
  183. padding: 10px;
  184. .v-icon {
  185. font-size: 1rem !important;
  186. color: var(--primary-color);
  187. }
  188. .location {
  189. color: var(--primary-color);
  190. margin-left: 10px;
  191. font-size: 1.3rem;
  192. }
  193. @media (max-width: 600px) {
  194. margin: 0 auto 12px auto;
  195. }
  196. }
  197. }
  198. @media (max-width: 600px) {
  199. .mission-container {
  200. margin: 64px 6%;
  201. }
  202. }
  203. .btn-send {
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. width: 30%;
  208. margin-left: auto;
  209. margin-right: auto;
  210. font-weight: 700;
  211. background-color: var(--secondary-color);
  212. @media (max-width: 600px) {
  213. width: 80%;
  214. margin: 12px auto;
  215. }
  216. }
  217. .apply-now {
  218. text-align: center;
  219. font-style: italic;
  220. font-weight: 300;
  221. font-size: 1.5rem;
  222. line-height: 40px;
  223. color: var(--primary-color);
  224. margin-bottom: 2rem;
  225. margin-left: 24px;
  226. @media (max-width: 600px) {
  227. max-width: 90%;
  228. margin: 12px auto;
  229. }
  230. }
  231. .v-dialog {
  232. :deep(.v-overlay__content) {
  233. overflow: auto !important;
  234. }
  235. :deep(.v-card) {
  236. border-bottom-left-radius: 0;
  237. border-bottom-right-radius: 0;
  238. }
  239. .v-btn {
  240. width: 100%;
  241. border-top-left-radius: 0;
  242. border-top-right-radius: 0;
  243. }
  244. }
  245. </style>