Feat(tag): modal for adding keywords to tag
This commit is contained in:
77
src/components/associate_tag_keyword.vue
Normal file
77
src/components/associate_tag_keyword.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user