_id.vue 8.5 KB

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