_id.vue 9.2 KB

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