_id.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <LayoutContainer>
  3. <header class="mb-4">
  4. <v-layout>
  5. <v-btn
  6. :to="{path: '/structures', query: { parent: parent, view: view, theme: theme }}"
  7. nuxt
  8. plain
  9. >
  10. <font-awesome-icon class="icon mr-1" :icon="['fas', 'chevron-left']" />
  11. {{ $t('go_back') }}
  12. </v-btn>
  13. </v-layout>
  14. </header>
  15. <v-container class="content">
  16. <v-layout class="flex-row align-center mb-4">
  17. <v-img
  18. v-if="structure.logoId"
  19. :src="'https://api.opentalent.fr/app.php/_internal/secure/files/' + structure.logoId + '/0x60'"
  20. alt="logo"
  21. max-width="60"
  22. />
  23. <h2 class="flex mx-4 d-flex align-center">
  24. {{ structure.name }}
  25. </h2>
  26. <div class="d-flex flex-row align-center">
  27. <a v-if="structure.facebook" :href="structure.facebook" class="facebook" target="_blank" :title="$t('find_us_on') + ' Facebook'">
  28. <font-awesome-icon class="icon social-icon" :icon="['fab', 'facebook']" />
  29. </a>
  30. <a v-if="structure.instagram" :href="structure.instagram" class="instagram" target="_blank" :title="$t('find_us_on') + ' Instagram'">
  31. <font-awesome-icon class="icon social-icon" :icon="['fab', 'instagram-square']" />
  32. </a>
  33. <a v-if="structure.twitter" :href="structure.twitter" class="twitter" target="_blank" title="$t('find_us_on') + ' Twitter'">
  34. <font-awesome-icon class="icon social-icon" :icon="['fab', 'twitter']" />
  35. </a>
  36. </div>
  37. </v-layout>
  38. <v-row>
  39. <v-col class="d-flex justify-center" cols="12">
  40. <img
  41. v-if="structure.imageId"
  42. :src="'https://api.opentalent.fr/app.php/_internal/secure/files/' + structure.imageId + '/raw'"
  43. alt="banner"
  44. style="max-height: 300px"
  45. >
  46. </v-col>
  47. </v-row>
  48. <v-row>
  49. <v-col cols="12">
  50. <v-chip-group v-if="structure.practices" :max="0" active-class="primary--text" class="justify-center">
  51. <v-chip v-for="practice in structure.practices" :key="practice">
  52. {{ $t(practice) }}
  53. </v-chip>
  54. </v-chip-group>
  55. </v-col>
  56. </v-row>
  57. <v-row class="mb-4">
  58. <v-col cols="12" class="d-flex flex-row justify-center">
  59. <v-btn
  60. v-for="article in structure.articles"
  61. :key="article.id"
  62. :href="(article.link.match(/https?:\/\/.*/) ? '' : 'https://') + article.link "
  63. target="_blank"
  64. small
  65. color="primary"
  66. class="ma-2"
  67. :title="article.title"
  68. >
  69. <font-awesome-icon class="icon mr-1" :icon="['fas', 'star']" />
  70. {{ $t('spot_on_from') + ' ' + new Date(article.date).toLocaleDateString($i18n.locale) }}
  71. </v-btn>
  72. </v-col>
  73. </v-row>
  74. <v-divider class="my-2" />
  75. <v-row class="my-2 py-2">
  76. <v-col
  77. cols="12"
  78. sm="6"
  79. class="description"
  80. >
  81. <div class="d-flex flex-row mb-3">
  82. <h4>{{ $t('descriptive') }}</h4>
  83. <v-spacer />
  84. </div>
  85. <div class="pa-2">
  86. <p v-if="structure.description" class="text-justify">
  87. {{ structure.description }}
  88. </p>
  89. <i v-else>({{ $t('no_description') }})</i>
  90. </div>
  91. </v-col>
  92. <v-col
  93. cols="12"
  94. sm="6"
  95. class="contact"
  96. >
  97. <div class="d-flex flex-row mb-3">
  98. <h4>{{ $t('contact') }}</h4>
  99. <v-spacer />
  100. </div>
  101. <table>
  102. <tr>
  103. <td>
  104. <font-awesome-icon class="icon" :icon="['fas', 'map-marker-alt']" />
  105. </td>
  106. <td class="mx-2">
  107. <span v-if="structure.streetAddress">{{ structure.streetAddress }}<br></span>
  108. <span v-if="structure.postalCode">{{ structure.postalCode }} </span>
  109. {{ structure.addressCity }}
  110. </td>
  111. </tr>
  112. <tr>
  113. <td>
  114. <font-awesome-icon class="icon" :icon="['fas', 'phone-alt']" />
  115. </td>
  116. <td class="phone">
  117. <div v-if="structure.telphone">
  118. <a v-if="showTel" :href="'tel:' + structure.telphone" class="neutral">
  119. {{ formatPhoneNumber(structure.telphone) }}
  120. </a>
  121. <v-btn v-else small @click="showTel = 1">
  122. {{ $t('show_tel') }}
  123. </v-btn>
  124. </div>
  125. <span v-else>-</span>
  126. </td>
  127. </tr>
  128. <tr>
  129. <td>
  130. <font-awesome-icon class="icon" :icon="['fas', 'at']" />
  131. </td>
  132. <td class="mail">
  133. <div v-if="structure.email">
  134. <a v-if="showMail" :href="'mailto:' + structure.email" class="neutral">
  135. {{ structure.email }}
  136. </a>
  137. <v-btn v-else small @click="showMail = 1">
  138. {{ $t('show_email') }}
  139. </v-btn>
  140. </div>
  141. <span v-else>-</span>
  142. </td>
  143. </tr>
  144. <tr>
  145. <td>
  146. <font-awesome-icon class="icon" :icon="['fas', 'globe-europe']" />
  147. </td>
  148. <td class="website">
  149. <a class="neutral" :href="structure.website" target="_blank">{{ structure.website }}</a>
  150. </td>
  151. </tr>
  152. <tr>
  153. <td>
  154. <font-awesome-icon class="icon" :icon="['fas', 'project-diagram']" />
  155. </td>
  156. <td class="network">
  157. <NuxtLink
  158. v-if="structure.n1Id !== parent"
  159. class="neutral"
  160. :to="{path: '/structures/' + structure.n1Id, query: { parent: parent, view: view, theme: theme }}"
  161. nuxt
  162. >
  163. {{ structure.n1Name }}
  164. </NuxtLink>
  165. <div v-else>
  166. {{ structure.n1Name }}
  167. </div>
  168. </td>
  169. </tr>
  170. </table>
  171. </v-col>
  172. </v-row>
  173. <v-row v-if="structure.latitude && structure.longitude">
  174. <v-col cols="12">
  175. <v-responsive width="100%" height="450px">
  176. <no-ssr>
  177. <l-map
  178. id="map"
  179. :zoom="13"
  180. :center="[structure.latitude, structure.longitude]"
  181. :options="{ scrollWheelZoom: false, zoomSnap: 0.25 }"
  182. >
  183. <l-tile-layer
  184. url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
  185. attribution="&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
  186. />
  187. <l-marker
  188. :key="structure.id"
  189. :lat-lng="[structure.latitude, structure.longitude]"
  190. >
  191. <l-popup>
  192. <b>{{ structure.name }}</b><br>
  193. {{ structure.postalCode }} {{ structure.addressCity }}<br>
  194. <a :href="structure.website" target="_blank">{{ structure.website }}</a>
  195. </l-popup>
  196. </l-marker>
  197. </l-map>
  198. </no-ssr>
  199. </v-responsive>
  200. </v-col>
  201. </v-row>
  202. </v-container>
  203. </LayoutContainer>
  204. </template>
  205. <script lang="ts">
  206. import Vue from 'vue'
  207. // eslint-disable-next-line import/no-named-as-default
  208. import parsePhoneNumber from 'libphonenumber-js'
  209. import StructuresProvider from '~/services/data/StructuresProvider'
  210. export default Vue.extend({
  211. validate ({ query }) {
  212. if (!/^\d+$/.test(query.parent as string ?? '')) {
  213. // eslint-disable-next-line no-console
  214. console.error('Missing parameter: parent')
  215. return false
  216. }
  217. return true
  218. },
  219. async asyncData ({
  220. params, $axios
  221. }): Promise<{ structure: Structure }> {
  222. return await new StructuresProvider($axios).getById(Number(params.id)).then((res) => {
  223. return { structure: res }
  224. })
  225. },
  226. data (): object {
  227. return {
  228. parent: parseInt(this.$route.query.parent as string),
  229. view: this.$route.query.view ?? 'map',
  230. theme: this.$route.query.theme ?? 'orange',
  231. showTel: false,
  232. showMail: false
  233. }
  234. },
  235. methods: {
  236. formatPhoneNumber (number: string): string {
  237. const parsed = parsePhoneNumber(number)
  238. return parsed ? parsed.formatNational() : ''
  239. }
  240. }
  241. })
  242. </script>
  243. <style scoped lang="scss">
  244. @import 'assets/style/variables.scss';
  245. .content {
  246. margin: 18px 10%;
  247. max-width: 80%;
  248. }
  249. h2 {
  250. color: var(--v-primary-base);
  251. font-size: 22px;
  252. }
  253. h4 {
  254. color: #666;
  255. border-bottom: solid 1px var(--v-primary-base);
  256. font-size: 22px;
  257. }
  258. .social-icon {
  259. font-size: 22px;
  260. color: gray;
  261. margin: auto 8px;
  262. }
  263. .content {
  264. color: #666666;
  265. }
  266. @media screen and (min-width: 600px) {
  267. .description {
  268. border-right: solid 2px #e4611b;
  269. width: 45%;
  270. padding-right: 5%;
  271. }
  272. .contact {
  273. width: 45%;
  274. padding-left: 5%;
  275. }
  276. }
  277. .contact td {
  278. padding: 6px 12px;
  279. }
  280. .contact .icon {
  281. color: var(--v-primary-base);
  282. }
  283. </style>