_id.vue 9.2 KB

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