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
title
short_description
reference
images {
url
style_cardmedium_url
style_hd_url
}
samples{
showroom{
name
id
}
location
}
note{
id
}
}
images {

View File

@ -131,6 +131,7 @@ export default {
},
methods: {
...mapActions({
// refreshItem: 'Search/refreshItem',
createFlagColl: 'User/createFlagColl',
flagUnflag: 'User/flagUnflag'
}),
@ -190,7 +191,18 @@ export default {
if(this.isloggedin){
this.$modal.show(
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}`,
draggable: true,

View File

@ -285,7 +285,7 @@ const _debounce = require('lodash/debounce')
export default {
name: "ModalCard",
props: ['item'],
props: ['item', 'addNoteId'],
mixins: [cardMixins],
components: {
LinkedMaterialCard
@ -335,7 +335,7 @@ export default {
},
methods: {
...mapActions({
refreshItem: 'Search/refreshItem',
// refreshItem: 'Search/refreshItem',
createFlagColl: 'User/createFlagColl',
flagUnflag: 'User/flagUnflag'
}),
@ -467,8 +467,11 @@ export default {
console.log('createNote REST data', data)
this.note_nid = data.nid[0].value
// 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 => {
console.warn('Issue with createNote', error)

View File

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