feat(search): proposal of choices

This commit is contained in:
tykayn 2020-12-17 22:27:12 +01:00 committed by Baptiste Lemoine
commit ef62875a57
10 changed files with 108 additions and 41 deletions

View File

@ -12,21 +12,36 @@
@typing="getAsyncData"
@select="(option) => (selected = option)"
>
<template slot-scope="props">
<div class="media">
<div class="media-left"></div>
<div class="media-content">
{{ props.option.title }}
<br />
<small>
Released at {{ props.option.release_date }}, rated
<b>{{ props.option.vote_average }}</b>
</small>
</div>
</div>
</template>
<!-- <template slot-scope="props">-->
<!-- <div class="media">-->
<!-- <div class="media-left"></div>-->
<!-- <div class="media-content">-->
<!-- {{ props.name }}-->
<!-- <br />-->
<!-- <small>-->
<!-- Released at {{ props.option.release_date }}, rated-->
<!-- <b>{{ props.option.vote_average }}</b>-->
<!-- </small>-->
<!-- </div>-->
<!-- </div>-->
<!-- </template>-->
</b-autocomplete>
</b-field>
Résultats possibles: {{ data.length }}
<div v-if="data.length">
<ul>
<li v-for="item in data" :key="item.properties.id">
<div class="columns">
<div class="column">
{{ item.properties.name }}
</div>
<div class="column">
{{ item.properties.context }}
</div>
</div>
</li>
</ul>
</div>
</section>
<section class="map">
<br />
@ -120,9 +135,9 @@
></b-input>
</b-field>
<b-field>
<b-switch v-model="xml.tags.takeaway"> Vente à emporter </b-switch>
<b-switch v-model="xml.tags['parking:velo']"> Parking vélo </b-switch>
<b-switch v-model="xml.tags['webaccess']"> Accès Internet </b-switch>
<b-switch v-model="xml.tags.takeaway"> Vente à emporter</b-switch>
<b-switch v-model="xml.tags['parking:velo']"> Parking vélo</b-switch>
<b-switch v-model="xml.tags['webaccess']"> Accès Internet</b-switch>
<b-switch v-model="xml.tags['elecborne']">
borne de recharge électrique sur parking
</b-switch>
@ -135,12 +150,6 @@
<div class="padded">
{{ xml.tags.opening_hours }}
</div>
<iframe
src="https://projets.pavie.info/yohours/"
frameborder="0"
width="100%"
height="800"
></iframe>
<button class="btn button has-background-success">Enregistrer</button>
</section>
@ -176,11 +185,11 @@ export default {
}
this.isFetching = true
this.$axios
.get(`https://api-adresse.data.gouv.fr/search?&type=poi&q=${name}`)
.get(`https://demo.addok.xyz/search?&type=poi&q=${name}`)
.then(({ data }) => {
console.log('data', data)
this.data = []
data.results.forEach((item) => this.data.push(item))
data.features.forEach((item) => this.data.push(item))
})
.catch((error) => {
this.data = []

View File

@ -1,8 +1,10 @@
import en from './locales/en.json'
import bz from './locales/bz.json'
import fr from './locales/fr.json'
import oc from './locales/oc.json'
export default {
locale: 'en',
fallbackLocale: 'en',
messages: { en, fr },
locale: 'fr',
fallbackLocale: 'fr',
messages: { bz, en, fr, oc },
}

4
config/locales/bz.json Normal file
View File

@ -0,0 +1,4 @@
{
"locale_descritption": "Brezhoneg",
"message": "Bonjour en Breton!"
}

View File

@ -1,3 +1,4 @@
{
"message": "hello!"
"locale_descritption": "English",
"message": "Hello in English!"
}

View File

@ -1,3 +1,4 @@
{
"message": "bonjour!"
"locale_descritption": "Français",
"message": "Bonjour en Français!"
}

4
config/locales/oc.json Normal file
View File

@ -0,0 +1,4 @@
{
"locale_descritption": "Occitan",
"message": "bonjour en occitan!"
}

View File

@ -42,21 +42,12 @@
</template>
<script>
import routelist from './routes'
export default {
data() {
return {
items: [
{
title: 'Accueil',
icon: 'home',
to: { name: 'index' },
},
{
title: 'à propos',
icon: 'lightbulb',
to: { name: 'A-propos' },
},
],
items: routelist,
}
},
}

17
layouts/routes.ts Normal file
View File

@ -0,0 +1,17 @@
export default [
{
title: 'Accueil',
icon: 'home',
to: { name: 'index' },
},
{
title: 'Horaires',
icon: 'clock',
to: { name: 'Horaires' },
},
{
title: 'à propos',
icon: 'lightbulb',
to: { name: 'A-propos' },
},
]

12
pages/Horaires.vue Normal file
View File

@ -0,0 +1,12 @@
<template>
<section class="section">
<h1>Horaires</h1>
<p>Vos horaires actuelles</p>
<iframe
src="https://projets.pavie.info/yohours/"
frameborder="0"
width="100%"
height="800"
></iframe>
</section>
</template>

26
store/index.ts Normal file
View File

@ -0,0 +1,26 @@
export const state = () => ({
counter: 0,
list: [],
formConfig: {},
})
export const mutations = {
increment(state: any) {
state.counter++
},
add(state: any, text: any) {
state.list.push({
text,
done: false,
})
},
remove(state: any, { todo }: any) {
state.list.splice(state.list.indexOf(todo), 1)
},
toggle(state: any, todo: any) {
todo.done = !todo.done
},
setFormField(state: any, { field }: any) {
state.formConfig[state.formConfig.indexOf(field)] = field
},
}