added note picto to medium Card responding to note creation on modalCard

This commit is contained in:
Bachir Soussi Chiadmi 2021-03-10 14:54:58 +01:00
parent fbf509a005
commit e0f8b123f9
5 changed files with 38 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -28,10 +28,21 @@ fragment ArticleFields on Article {
id id
title title
short_description short_description
reference
images { images {
url url
style_cardmedium_url style_cardmedium_url
style_hd_url style_hd_url
}
samples{
showroom{
name
id
}
location
}
note{
id
} }
} }
images { images {

View File

@ -131,6 +131,7 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
// refreshItem: 'Search/refreshItem',
createFlagColl: 'User/createFlagColl', createFlagColl: 'User/createFlagColl',
flagUnflag: 'User/flagUnflag' flagUnflag: 'User/flagUnflag'
}), }),
@ -190,7 +191,18 @@ export default {
if(this.isloggedin){ if(this.isloggedin){
this.$modal.show( this.$modal.show(
ModalCard, ModalCard,
{ item: this.item }, {
item: this.item,
// not really an event
// more a callback function passed as prop to the component
addNoteId:(id) => {
// no needs to refresh the entire item via searchresults
// plus if we are in article, there is not searchresults
// this.refreshItem({id: this.item.id})
// instead create the note id directly
this.item.note = {id: id}
}
},
{ {
name: `modal-${this.item.id}`, name: `modal-${this.item.id}`,
draggable: true, draggable: true,

View File

@ -285,7 +285,7 @@ const _debounce = require('lodash/debounce')
export default { export default {
name: "ModalCard", name: "ModalCard",
props: ['item'], props: ['item', 'addNoteId'],
mixins: [cardMixins], mixins: [cardMixins],
components: { components: {
LinkedMaterialCard LinkedMaterialCard
@ -335,7 +335,7 @@ export default {
}, },
methods: { methods: {
...mapActions({ ...mapActions({
refreshItem: 'Search/refreshItem', // refreshItem: 'Search/refreshItem',
createFlagColl: 'User/createFlagColl', createFlagColl: 'User/createFlagColl',
flagUnflag: 'User/flagUnflag' flagUnflag: 'User/flagUnflag'
}), }),
@ -467,8 +467,11 @@ export default {
console.log('createNote REST data', data) console.log('createNote REST data', data)
this.note_nid = data.nid[0].value this.note_nid = data.nid[0].value
// call search results refresh of the item to display that note is now existing for this item // call search results refresh of the item to display that note is now existing for this item
// TODO: do the same for article linked materials // this.refreshItem({id: this.item.id})
this.refreshItem({id: this.item.id}) // no needs to refresh the entire item via searchresults
// plus if we are in article, there is not searchresults
// instead call the callbackfunction from teh parent to add directly the note id
this.addNoteId(this.note_nid)
}) })
.catch(error => { .catch(error => {
console.warn('Issue with createNote', error) console.warn('Issue with createNote', error)

View File

@ -52,7 +52,9 @@ export default {
// find the right index // find the right index
const index = state.items.findIndex(i => i.id === item.id) const index = state.items.findIndex(i => i.id === item.id)
// update the array // update the array
if (index !== -1) {
Vue.set(state.items, index, item) Vue.set(state.items, index, item)
}
// console.log("mutation updateItem state.items", state.items) // console.log("mutation updateItem state.items", state.items)
}, },
resetItems (state) { resetItems (state) {