_id.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <template>
  2. <LayoutContainer>
  3. <header class="mb-4">
  4. <v-layout>
  5. <v-btn
  6. :to="{path: '/events', query: { theme: theme, hideTitle: hideTitle }}"
  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-row>
  17. <v-col cols="6" class="pr-6">
  18. <img
  19. v-if="publicEvent.imageId"
  20. :src="publicEvent.imageId ? 'https://api.opentalent.fr/app.php/_internal/secure/files/' + publicEvent.imageId + '/raw' : '/images/event-default.jpg'"
  21. alt="banner"
  22. style="max-width: 100%"
  23. >
  24. </v-col>
  25. <v-col cols="6" class="pl-6">
  26. <v-container class="d-flex flex-column" style="min-height: 100%">
  27. <v-row class="py-2">
  28. <h2>{{ publicEvent.name }}</h2>
  29. </v-row>
  30. <v-row class="py-2">
  31. <table class="infos">
  32. <tr v-if="publicEvent.datetimeStart" class="pa-1">
  33. <td class="pt-1">
  34. <font-awesome-icon :icon="['fas', 'calendar']" class="icon mr-2" />
  35. </td>
  36. <td class="pa-1">
  37. <span>
  38. {{ dateUtils.formatDateIntervalFor(new Date(publicEvent.datetimeStart), new Date(publicEvent.datetimeEnd), false) }}
  39. </span>
  40. </td>
  41. </tr>
  42. <tr v-if="publicEvent.address.addressCity">
  43. <td class="pt-1">
  44. <font-awesome-icon class="icon" :icon="['fas', 'map-marker-alt']" />
  45. </td>
  46. <td class="pa-1">
  47. <span v-if="publicEvent.roomName" style="white-space: pre-line;">{{ publicEvent.roomName }}<br></span>
  48. <span v-if="publicEvent.address.streetAddress" style="white-space: pre-line;">{{ publicEvent.address.streetAddress }}<br></span>
  49. <span>{{ publicEvent.address.addressCity }}</span>
  50. </td>
  51. </tr>
  52. </table>
  53. </v-row>
  54. <v-row class="py-2 flex">
  55. <h4 class="mt-2 mb-3">
  56. {{ $t('description') }}
  57. </h4>
  58. <p class="flex">
  59. {{ publicEvent.description }}
  60. </p>
  61. </v-row>
  62. <v-row v-if="publicEvent.url" justify="end" class="py-2">
  63. <v-btn :href="publicEvent.url" target="_blank">{{ $t("more_to_know") }}</v-btn>
  64. </v-row>
  65. </v-container>
  66. </v-col>
  67. </v-row>
  68. <v-row>
  69. <v-col cols="12">
  70. <v-responsive width="100%" height="300px">
  71. <no-ssr>
  72. <l-map
  73. id="map"
  74. :zoom="13"
  75. :center="[publicEvent.address.latitude, publicEvent.address.longitude]"
  76. :options="{ scrollWheelZoom: false, zoomSnap: 0.25 }"
  77. >
  78. <l-tile-layer
  79. url="http://{s}.tile.osm.org/{z}/{x}/{y}.png"
  80. attribution="&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
  81. />
  82. <l-marker
  83. :key="publicEvent.id"
  84. :lat-lng="[publicEvent.address.latitude, publicEvent.address.longitude]"
  85. >
  86. <l-popup>
  87. <b>{{ publicEvent.name }}</b><br>
  88. <span v-if="publicEvent.mapAddress">
  89. {{ publicEvent.address.postalCode }} {{ publicEvent.address.addressCity }}
  90. </span><br>
  91. </l-popup>
  92. </l-marker>
  93. </l-map>
  94. </no-ssr>
  95. </v-responsive>
  96. </v-col>
  97. </v-row>
  98. <v-row align-content="space-between">
  99. <v-col cols="2">
  100. </v-col>
  101. <v-spacer />
  102. <v-col cols="5" class="d-flex flex-column align-end">
  103. <h5 class="ma-2">
  104. {{ $t('share') }}
  105. </h5>
  106. <div class="d-flex flex-row align-items-end flex-wrap">
  107. <ShareNetwork
  108. v-for="socialNetwork in socialNetworks"
  109. :key="socialNetwork.network"
  110. :network="socialNetwork.network"
  111. :url="localUrl"
  112. :title="publicEvent.name"
  113. :description="publicEvent.description"
  114. hashtags="opentalent,event"
  115. :media="publicEvent.imageId ? 'https://api.opentalent.fr/app.php/_internal/secure/files/' + publicEvent.imageId + '/raw' : '/images/event-default.jpg'"
  116. class="social-link"
  117. >
  118. <a
  119. :title="$t('share_on') + ' ' + socialNetwork.name"
  120. :style="{color: socialNetwork.color}"
  121. >
  122. <font-awesome-icon
  123. class="icon social-icon"
  124. :icon="socialNetwork.icon"
  125. />
  126. </a>
  127. </ShareNetwork>
  128. </div>
  129. </v-col>
  130. </v-row>
  131. </v-container>
  132. </LayoutContainer>
  133. </template>
  134. <script lang="ts">
  135. import Vue from 'vue'
  136. // eslint-disable-next-line import/no-named-as-default
  137. import EventsProvider from '~/services/data/EventsProvider'
  138. import DatesUtils from "~/services/utils/dateUtils";
  139. export default Vue.extend({
  140. data () {
  141. return {
  142. theme: this.$route.query.theme ?? 'orange',
  143. hideTitle: this.$route.query.hideTitle === 'true',
  144. dateUtils: new DatesUtils(this.$dateFns, this.$t, this.$i18n),
  145. localUrl: location.href,
  146. socialNetworks: [
  147. { network: 'facebook', name: 'Facebook', icon: ['fab', 'facebook-f'], color: '#1877f2' },
  148. { network: 'messenger', name: 'Messenger', icon: ['fab', 'facebook-messenger'], color: '#0084ff' },
  149. { network: 'twitter', name: 'Twitter', icon: ['fab', 'twitter'], color: '#1da1f2' },
  150. { network: 'reddit', name: 'Reddit', icon: ['fab', 'reddit-alien'], color: '#ff4500' },
  151. { network: 'telegram', name: 'Telegram', icon: ['fab', 'telegram-plane'], color: '#0088cc' },
  152. { network: 'whatsapp', name: 'Whatsapp', icon: ['fab', 'whatsapp'], color: '#25d366' },
  153. { network: 'email', name: 'Email', icon: ['fa', 'envelope'], color: '#333333' },
  154. ] // @see https://nicolasbeauvais.github.io/vue-social-sharing/?path=/story/vuesocialsharing--multiple-share-networks
  155. }
  156. },
  157. async asyncData ({
  158. params, $axios
  159. }): Promise<{ publicEvent: PublicEvent }> {
  160. return await new EventsProvider($axios).getById(params.id).then((res) => {
  161. return { publicEvent: res }
  162. })
  163. }
  164. })
  165. </script>
  166. <style scoped lang="scss">
  167. @import 'assets/style/variables.scss';
  168. .content {
  169. margin: 18px 10%;
  170. max-width: 80%;
  171. }
  172. h2 {
  173. color: var(--v-primary-base);
  174. font-size: 22px;
  175. text-transform: uppercase;
  176. }
  177. h4 {
  178. color: #666;
  179. border-bottom: solid 1px var(--v-primary-base);
  180. font-size: 22px;
  181. }
  182. .content {
  183. color: #4d4d4d;
  184. }
  185. .infos {
  186. text-transform: uppercase;
  187. font-weight: 700;
  188. }
  189. @media screen and (min-width: 600px) {
  190. .description {
  191. border-right: solid 2px var(--v-primary-base);
  192. width: 45%;
  193. padding-right: 5%;
  194. }
  195. .contact {
  196. width: 45%;
  197. padding-left: 5%;
  198. }
  199. }
  200. .contact td {
  201. padding: 6px 12px;
  202. }
  203. .contact .icon {
  204. color: var(--v-primary-base);
  205. }
  206. .social-link {
  207. display: flex;
  208. flex-direction: row;
  209. justify-content: center;
  210. padding: 6px;
  211. text-decoration: none;
  212. position:relative;
  213. }
  214. .social-link:hover {
  215. text-decoration: underline;
  216. }
  217. .social-icon {
  218. font-size: 22px;
  219. margin: auto 6px;
  220. }
  221. .social-link:before {
  222. display:block;
  223. content:" ";
  224. position:absolute;
  225. z-index:100;
  226. background:rgba(255, 255, 255, 0.3);
  227. top:0;
  228. left:0;
  229. right:0;
  230. bottom:0;
  231. opacity:0;
  232. }
  233. .social-link:hover:before {
  234. opacity:1;
  235. }
  236. </style>