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" @typing="getAsyncData"
@select="(option) => (selected = option)" @select="(option) => (selected = option)"
> >
<template slot-scope="props"> <!-- <template slot-scope="props">-->
<div class="media"> <!-- <div class="media">-->
<div class="media-left"></div> <!-- <div class="media-left"></div>-->
<div class="media-content"> <!-- <div class="media-content">-->
{{ props.option.title }} <!-- {{ props.name }}-->
<br /> <!-- <br />-->
<small> <!-- <small>-->
Released at {{ props.option.release_date }}, rated <!-- Released at {{ props.option.release_date }}, rated-->
<b>{{ props.option.vote_average }}</b> <!-- <b>{{ props.option.vote_average }}</b>-->
</small> <!-- </small>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</template> <!-- </template>-->
</b-autocomplete> </b-autocomplete>
</b-field> </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>
<section class="map"> <section class="map">
<br /> <br />
@ -120,9 +135,9 @@
></b-input> ></b-input>
</b-field> </b-field>
<b-field> <b-field>
<b-switch v-model="xml.tags.takeaway"> Vente à emporter </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['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['webaccess']"> Accès Internet</b-switch>
<b-switch v-model="xml.tags['elecborne']"> <b-switch v-model="xml.tags['elecborne']">
borne de recharge électrique sur parking borne de recharge électrique sur parking
</b-switch> </b-switch>
@ -135,12 +150,6 @@
<div class="padded"> <div class="padded">
{{ xml.tags.opening_hours }} {{ xml.tags.opening_hours }}
</div> </div>
<iframe
src="https://projets.pavie.info/yohours/"
frameborder="0"
width="100%"
height="800"
></iframe>
<button class="btn button has-background-success">Enregistrer</button> <button class="btn button has-background-success">Enregistrer</button>
</section> </section>
@ -176,11 +185,11 @@ export default {
} }
this.isFetching = true this.isFetching = true
this.$axios 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 }) => { .then(({ data }) => {
console.log('data', data) console.log('data', data)
this.data = [] this.data = []
data.results.forEach((item) => this.data.push(item)) data.features.forEach((item) => this.data.push(item))
}) })
.catch((error) => { .catch((error) => {
this.data = [] this.data = []

View File

@ -1,8 +1,10 @@
import en from './locales/en.json' import en from './locales/en.json'
import bz from './locales/bz.json'
import fr from './locales/fr.json' import fr from './locales/fr.json'
import oc from './locales/oc.json'
export default { export default {
locale: 'en', locale: 'fr',
fallbackLocale: 'en', fallbackLocale: 'fr',
messages: { en, 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> </template>
<script> <script>
import routelist from './routes'
export default { export default {
data() { data() {
return { return {
items: [ items: routelist,
{
title: 'Accueil',
icon: 'home',
to: { name: 'index' },
},
{
title: 'à propos',
icon: 'lightbulb',
to: { name: 'A-propos' },
},
],
} }
}, },
} }

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
},
}