2020-11-27 23:02:59 +01:00
|
|
|
<template>
|
|
|
|
<article class="card minicard">
|
2021-01-22 12:12:31 +01:00
|
|
|
<header
|
|
|
|
@click.prevent="openModalCard"
|
|
|
|
>
|
2020-11-27 23:02:59 +01:00
|
|
|
<h1>{{ item.title }}</h1>
|
2021-01-22 12:12:31 +01:00
|
|
|
<span v-if="item.reference" class="ref">{{ item.reference }}</span>
|
2020-11-27 23:02:59 +01:00
|
|
|
</header>
|
|
|
|
<nav class="tools">
|
2021-03-18 21:58:59 +01:00
|
|
|
<section class="tool samples" v-if="item.samples && item.samples.length">
|
|
|
|
<span class="btn mdi mdi-beaker-outline"/>
|
|
|
|
<div class="tool-content">
|
|
|
|
<span class="label">{{ $t("materio.Samples") }}</span>
|
|
|
|
<ul>
|
|
|
|
<li
|
|
|
|
v-for="sample in item.samples"
|
|
|
|
:key="sample.showroom.id"
|
|
|
|
>
|
|
|
|
<span class="showroom">{{ sample.showroom.name }}</span>: {{ sample.location }}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</section>
|
2020-11-27 23:02:59 +01:00
|
|
|
<section class="tool flags">
|
2020-12-01 20:40:37 +01:00
|
|
|
<span
|
|
|
|
class="mdi unflag"
|
|
|
|
:class="[
|
|
|
|
itemIsLoading() ? 'mdi-loading mdi-spin' : 'mdi-folder-remove'
|
|
|
|
]"
|
|
|
|
@click.prevent="onUnFlagCard"
|
|
|
|
/>
|
2020-11-27 23:02:59 +01:00
|
|
|
</section>
|
|
|
|
</nav>
|
|
|
|
<section class="images" v-switcher>
|
|
|
|
<figure
|
|
|
|
v-for="(img, index) in item.images"
|
|
|
|
:key="img.url"
|
2021-07-12 12:50:40 +02:00
|
|
|
v-lazy="index"
|
|
|
|
class="lazy"
|
2020-11-27 23:02:59 +01:00
|
|
|
>
|
|
|
|
<img
|
2020-12-23 18:05:25 +01:00
|
|
|
:data-src="img.style_minicard.url"
|
2020-11-27 23:02:59 +01:00
|
|
|
:title="img.title"
|
|
|
|
/>
|
2021-01-22 12:12:31 +01:00
|
|
|
<img
|
|
|
|
class="blank"
|
|
|
|
:src="blanksrc"
|
|
|
|
@click.prevent="openModalCard"
|
|
|
|
>
|
2020-11-27 23:02:59 +01:00
|
|
|
</figure>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapState, mapActions } from 'vuex'
|
|
|
|
import cardMixins from 'vuejs/components/cardMixins'
|
2021-01-22 12:12:31 +01:00
|
|
|
import ModalCard from 'vuejs/components/Content/ModalCard'
|
2020-11-27 23:02:59 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: "MiniCard",
|
2020-12-01 20:40:37 +01:00
|
|
|
props: ['item', 'collid'],
|
2020-11-27 23:02:59 +01:00
|
|
|
mixins: [cardMixins],
|
2021-01-22 12:12:31 +01:00
|
|
|
components: {
|
|
|
|
ModalCard
|
|
|
|
},
|
2020-11-27 23:02:59 +01:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,
|
2020-12-01 20:40:37 +01:00
|
|
|
loadingItem: false
|
2020-11-27 23:02:59 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-01-22 12:12:31 +01:00
|
|
|
...mapState({
|
|
|
|
isloggedin: state => state.User.isloggedin
|
|
|
|
})
|
2020-11-27 23:02:59 +01:00
|
|
|
},
|
|
|
|
methods: {
|
2020-12-01 20:40:37 +01:00
|
|
|
...mapActions({
|
|
|
|
flagUnflag: 'User/flagUnflag'
|
|
|
|
}),
|
|
|
|
itemIsLoading(id) {
|
|
|
|
return this.loadingItem
|
|
|
|
},
|
|
|
|
onUnFlagCard (e) {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log("Card onFlagActionCard", e, this.item)
|
2020-12-01 20:40:37 +01:00
|
|
|
if (!this.loadingItem) {
|
|
|
|
this.loadingItem = true;
|
|
|
|
this.flagUnflag({
|
|
|
|
action: 'unflag',
|
2020-12-23 18:05:25 +01:00
|
|
|
id: this.item.id,
|
2020-12-01 20:40:37 +01:00
|
|
|
collid: this.collid
|
|
|
|
})
|
|
|
|
.then(data => {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log("onUnFlagCard then", data)
|
2020-12-01 20:40:37 +01:00
|
|
|
this.loadingItem = false;
|
|
|
|
})
|
|
|
|
}
|
2021-01-22 12:12:31 +01:00
|
|
|
},
|
|
|
|
openModalCard (e) {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('openModalCard', this.isLoggedin)
|
|
|
|
if (this.isloggedin) {
|
2021-01-22 12:12:31 +01:00
|
|
|
this.$modal.show(
|
|
|
|
ModalCard,
|
|
|
|
{ item: this.item },
|
|
|
|
{
|
|
|
|
name: `modal-${this.item.id}`,
|
2021-03-31 11:03:00 +02:00
|
|
|
draggable: false,
|
|
|
|
classes: "vm--modale-card",
|
|
|
|
// this does not work
|
|
|
|
// adaptative: true,
|
|
|
|
// maxWidth: 850,
|
|
|
|
// maxHeight: 610,
|
|
|
|
width: '95%',
|
|
|
|
height: '95%'
|
2021-01-22 12:12:31 +01:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2020-12-01 20:40:37 +01:00
|
|
|
}
|
2020-11-27 23:02:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|