78 lines
1.9 KiB
Vue
78 lines
1.9 KiB
Vue
<template>
|
|
<b-form @submit="saveExit">
|
|
<b-form-group label="Mot clé"
|
|
label-for="keyword"
|
|
>
|
|
<b-form-input v-model="keyword"
|
|
id="keyword"
|
|
type="text"
|
|
required
|
|
>
|
|
</b-form-input>
|
|
</b-form-group>
|
|
<b-form-group label="Tag associé"
|
|
label-for="tag"
|
|
>
|
|
<b-form-select v-model="tagName"
|
|
id="tag"
|
|
:options="tagsName"
|
|
required
|
|
>
|
|
</b-form-select>
|
|
</b-form-group>
|
|
<b-btn type="submit" class="mt-3" variant="outline-success" block >Valider</b-btn>
|
|
<b-btn class="mt-3" variant="outline-danger" block @click="discardExit">Annuler</b-btn>
|
|
</b-form>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters, mapActions } from 'vuex'
|
|
export default {
|
|
name: 'associateTagKeyword',
|
|
props: [
|
|
'libelle'
|
|
],
|
|
data () {
|
|
return {
|
|
tagName: '',
|
|
keyword: this.cleanLibelle(this.libelle)
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters({
|
|
'tags': 'config/tags'
|
|
}),
|
|
tagsName () {
|
|
return Object.keys(this.tags)
|
|
}
|
|
},
|
|
methods: {
|
|
...mapActions({
|
|
'append_keywords': 'config/append_keywords'
|
|
}),
|
|
cleanLibelle (libelle) {
|
|
var head = /PAIEMENT CB \d* /g
|
|
var tail = / CARTE \d*/g
|
|
return libelle.replace(head, '').replace(tail, '')
|
|
},
|
|
hideModal () {
|
|
this.$root.$emit('bv::hide::modal', this.libelle)
|
|
},
|
|
saveExit () {
|
|
this.append_keywords({
|
|
tagName: this.tagName,
|
|
keyword: this.keyword
|
|
})
|
|
this.hideModal()
|
|
},
|
|
discardExit () {
|
|
this.hideModal()
|
|
}
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped>
|
|
</style>
|