_id.vue 9.5 KB

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