Vue.component('Prototab',{ template : `
`, props : { obj : Object }, data () { return { siteoff : { fr : "Site officiel", en : "Official website", it : "Sito ufficiale", }, } }, methods : { capitalize(s){ return s.charAt(0).toUpperCase() + s.slice(1) }, } }) Vue.component('Prix',{ template : `

{{ this.obj.txt.fr }}

{{ this.obj.txt.en }}

{{ this.obj.txt.it }}

{{ l.nameFR }} {{ l.nameEN }} {{ l.nameIT }} {{ checkPrice(l.price,free.fr) }} {{ checkPrice(l.price,free.en) }} {{ checkPrice(l.price,free.it) }}

{{ indicatif.fr }}

{{ indicatif.en }}

{{ indicatif.it }}

`, props : { obj : Object }, data () { return { indicatif : { fr : "Prix fournis à titre indicatif.", en : "Prices provided as an indication.", it : "Prezzi puramente indicativi.", }, free : { fr : "Gratuit", en : "Free", it : "Gratuito", } } }, methods : { checkPrice(p,f){ if (p == "") { return f } else { return p } }, } }) Vue.component('Info',{ template : `
{{ siteoff.fr }} {{ siteoff.en }} {{ siteoff.it }}
{{ this.obj.tel }}
{{ this.obj.email }}
{{ this.obj.address }}
{{ handi.fr }} {{ handi.en }} {{ handi.it }}
{{ hautmax.fr }} {{ this.obj.hautmax}} {{ hautmax.en }} {{ this.obj.hautmax}} {{ hautmax.it }} {{ this.obj.hautmax}}
`, props : { obj : Object }, computed : { telhref: function () { if (this.obj.hasOwnProperty('tel')) { return "tel:" + this.obj.tel } }, mailhref: function () { if (this.obj.hasOwnProperty('email')) { return "mailto:" + this.obj.email } }, }, data () { return { siteoff : { fr : "Site officiel", en : "Official website", it : "Sito ufficiale", }, handi : { fr : "Accessible en fauteuil roulant", en : "Wheelchair accessible", it : "Accessibile con sedia a rotelle", }, hautmax: { fr : "Hauteur maximum: ", en : "Maximum height: ", it : "Altezza massima: ", } } }, methods : { capitalize(s){ return s.charAt(0).toUpperCase() + s.slice(1) }, } //byl-icon-wifi //byl-icon-location_on //byl-icon-accessible }) Vue.component('Menu',{ template: `

{{ fourchette.fr }}

{{ fourchette.en }}

{{ fourchette.it }}

{{ this.obj.priceRange }}

{{ horsboissons.fr }}

{{ horsboissons.en }}

{{ horsboissons.it }}

{{ s.nameFR }}

{{ s.nameEN }}

{{ s.nameIT }}

{{ d.name }}

    {{ l2s(ings2ls(d.ing,"fr"), "fr") }}

    {{ l2s(ings2ls(d.ing,"en"), "en") }}

    {{ l2s(ings2ls(d.ing,"it"), "it") }}

    {{ l2s(ings2ls(d.ing,"fr"), "fr") }}

    {{ l2s(ings2ls(d.ing,"en"), "en") }}

    {{ l2s(ings2ls(d.ing,"it"), "it") }}




`, props : { obj : Object }, data () { return { message : "hello from menu", et : { fr : " et ", en : " and ", it : " e ", }, fourchette : { fr : "Fourchette de prix par personne :", en : "Price range per person:", it : "Fascia di prezzo per persona :", }, horsboissons : { fr : "(hors boissons)", en : "(excluding drinks)", it : "(bevande escluse)", }, indicatif : { fr : "Menu fournis à titre indicatif, soumis aux disponibilités", en : "Menu provided as an indication, subject to availability", it : "Menu fornito a titolo informativo, soggetto a disponibilità", } } }, methods : { capitalize(s){ return s.charAt(0).toUpperCase() + s.slice(1) }, l2s(l, lang) { let r = "" let llength = l.length - 1 for (i in l){ if (parseInt(i) === 0){ r = this.capitalize(l[i]) } else if (parseInt(i) < parseInt(llength)) { r = r + ", " + l[i] } else { r = r + this.et[lang] + l[i] } } return r }, ings2ls(ings, lang){ let l = [] for (i in ings) { l.push(ings[i][lang]) } return l } } }) Vue.component('Time', { template : `

{{ days[i].fr }} {{ days[i].en }} {{ days[i].it }} {{ d }} {{ closed.fr }} {{ closed.en }} {{ closed.it }}

`, props : { obj : Object }, data () { return { message : "hello from time", closed : { fr : "Fermé", en : "Closed", it : "Chiuso", }, days : { mon : { fr : "Lundi", en : "Monday", it : "Lunedì" }, tue : { fr : "Mardi", en : "Tuesday", it : "Martedì" }, wed : { fr : "Mercredi", en : "Wednesday", it : "Mercoledì" }, thu : { fr : "Jeudi", en : "Thursday", it : "Giovedì" }, fri : { fr : "Vendredi", en : "Friday", it : "Venerdì" }, sat : { fr : "Samedi", en : "Saturday", it : "Sabato" }, sun : { fr : "Dimanche", en : "Sunday", it : "Domenica" }, } } }, methods : { checkTime (d) { if (d != "" ){ return d } else { return this.closed } } } }); Vue.component('Accordeon', { template : `
`, props : { list : Object, taglist : Object }, data () { return { tl : this.taglist, isActive : false, displayCard : "block", cardTop : "110vh", tabrollxoff : 0, tabind : 0, markerL : 0, markerW : 0, } }, computed: { xy: function () { if ('xy' in this.list) { return this.list.xy } else { return [0,0] } }, dirxy: function () { if ('dirxy' in this.list) { return this.list.dirxy } else { return [0,0] } }, dirzl: function () { if ('dirzl' in this.list) { return this.list.dirzl } else { return 1 } }, href: function () { return "#" + this.list.id; }, cardid: function () { return "card" + this.list.id; }, tabcount: function () { if ('card' in this.list){ var arr = Object.entries(this.list.card.tabs); return arr.length } else { return 0; } }, tabrollw: function () { return this.tabcount + "00vw"; }, tabrollTransX: function () { return "translateX(-" + this.tabrollxoff + "00vw)"; }, }, methods : { toggleTag(t){ t.isActive = !t.isActive this.checkTagFunc() }, checkTagFunc() { Object.keys(resto).forEach(r => { tagCount = 0 Object.keys(restoTagList).forEach(rtli => { if (restoTagList[rtli].isActive) { for (t in resto[r].tags) { if (resto[r].tags[t] === restoTagList[rtli]) { tagCount++ } } } }) if (tagCount >= 1) { resto[r].isActive = true } else { resto[r].isActive = false } }) }, getMarkerId(i) { return this.cardid + this.getIndex(i).toString() }, getIndex(obj) { var arr = Object.entries(this.list.card.tabs); let ind = arr.findIndex(e => e[0] === obj.tabtype); return ind }, setTab(ind) { this.tabrollxoff = ind; this.tabind = ind t = document.getElementById(this.cardid + ind); this.markerL = t.offsetLeft + "px" this.markerW = t.offsetWidth + "px" }, getTabLogo(obj) { switch(obj.tabtype) { case "menu": return "byl-icon-restaurant" break; case "time": return "byl-icon-clock" break; case "info": return "byl-icon-info" break; case "prix": return "byl-icon-euro_symbol" break; default: return "" } }, showCard() { this.displayCard = "block"; this.setTab(0) this.cardTop = "0vh" this.setTab(0) this.setTab(0) this.setMap() this.setTab(0) }, hideCard() { this.cardTop = "110vh" }, donothing () { }, toggleActive () { this.list.isActive = !this.list.isActive document.getElementById(this.list.id).scrollIntoView(true); }, setMap () { map.setView(this.dirxy, this.dirzl) this.list.marker.openPopup() } }, }) let vm = new Vue({ el: '#root', data : jdb.data, methods: { hidelang: function(lang) { langClass = "b9h-lang-" + lang; langElms = document.getElementsByClassName(langClass); for (i = 0; i < langElms.length; i++) { langElms[i].style.display = 'none'; } }, hidelangs: function() { this.hidelang('fr'); this.hidelang('en'); this.hidelang('it'); }, showlang: function(lang) { this.hidelangs(); langClass = "b9h-lang-" + lang; langElms = document.getElementsByClassName(langClass); for (i = 0; i < langElms.length; i++) { langElms[i].style.display = 'revert'; } }, setlang: function (lang) { target = document.querySelector("#"+"tab-"+lang); marker = document.querySelector("#lang-marker"); marker.style.left = target.offsetLeft + "px"; marker.style.width = target.offsetWidth + "px"; this.showlang(lang); }, }, created: function(){ this.setlang('fr'); }, mounted: function() { this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); }, updated: function() { this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); this.setlang('fr'); } })