- aggiornamento Cataloghi
- Gestione delle versioni del prodotto ("Nuovi","Usati","Epub", ecc..)
This commit is contained in:
@@ -1,8 +1,30 @@
|
||||
import { defineComponent } from 'vue'
|
||||
import { PropType, defineComponent } from 'vue'
|
||||
|
||||
import { Catalogo } from '@src/views/ecommerce'
|
||||
import { ICatalogo } from '@src/model'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CCatalogo',
|
||||
components: { Catalogo },
|
||||
props: {
|
||||
// add options ICatalogo
|
||||
options: {
|
||||
type: Object as PropType<ICatalogo>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
//++AddCATALOGO_FIELDS
|
||||
productTypes: [],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
Editore: [],
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
||||
setup(props) {
|
||||
|
||||
return {
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Catalogo>
|
||||
<Catalogo :optcatalogo="optcatalogo">
|
||||
|
||||
</Catalogo>
|
||||
</div>
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CPrice } from '../CPrice'
|
||||
|
||||
import { func_tools, toolsext } from '@store/Modules/toolsext'
|
||||
|
||||
import { IBaseOrder, IGasordine, IOrder, IOrderCart, IProduct, IVariazione } from '@src/model'
|
||||
import { IBaseOrder, ICatalogo, IGasordine, IOrder, IOrderCart, IProduct, IVariazione } from '@src/model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useProducts } from '@store/Products'
|
||||
|
||||
@@ -28,7 +28,7 @@ import 'vue3-pdf-app/dist/icons/main.css'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CCatalogoCard',
|
||||
emits: ['selauthor'],
|
||||
emits: ['selauthor', 'opendetail'],
|
||||
props: {
|
||||
product: {
|
||||
type: Object as PropType<IProduct | null>,
|
||||
@@ -54,7 +54,19 @@ export default defineComponent({
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => { }
|
||||
}
|
||||
},
|
||||
optcatalogo: {
|
||||
type: Object as PropType<ICatalogo>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
//++AddCATALOGO_FIELDS
|
||||
productTypes: [0],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
Editore: [],
|
||||
}),
|
||||
},
|
||||
},
|
||||
components: { CTitleBanner, CCardState, CCopyBtn, CMyValueDb, VuePdfApp, CPrice },
|
||||
setup(props, { emit }) {
|
||||
@@ -477,6 +489,19 @@ export default defineComponent({
|
||||
emit('selauthor', id, autore)
|
||||
}
|
||||
|
||||
function click_opendetail(id: any, autore: any) {
|
||||
emit('opendetail')
|
||||
}
|
||||
function escludiArticolo(variazione: IVariazione) {
|
||||
let hasExcludeProductTypes = !props.optcatalogo.excludeproductTypes || (props.optcatalogo.excludeproductTypes && (variazione.arrversioni || []).every((item: any) => props.optcatalogo.excludeproductTypes.includes(item)))
|
||||
|
||||
return hasExcludeProductTypes
|
||||
}
|
||||
|
||||
function checkIfVariazioneDaVisu(variazione: IVariazione) {
|
||||
return !escludiArticolo(variazione)
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
onBeforeUnmount(beforeDestroy)
|
||||
|
||||
@@ -531,6 +556,8 @@ export default defineComponent({
|
||||
indvariazSel,
|
||||
checkifCartEnable,
|
||||
click_author,
|
||||
click_opendetail,
|
||||
checkIfVariazioneDaVisu,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
dense
|
||||
>
|
||||
</q-toggle>
|
||||
<q-page-sticky v-if="complete" position="bottom-right" :offset="[18, 0]">
|
||||
<q-btn fab icon="fas fa-arrow-up" class="semi-transparent" color="primary" v-close-popup/>
|
||||
</q-page-sticky>
|
||||
|
||||
<q-card-section>
|
||||
<div
|
||||
:class="{ 'flex q-pa-sm': true, 'shadow-2': options.in_3d }"
|
||||
@@ -40,32 +44,39 @@
|
||||
'cursor-pointer': !complete,
|
||||
'shadow-4': true,
|
||||
}"
|
||||
@click="
|
||||
@click="click_opendetail()"
|
||||
>
|
||||
<!--@click="
|
||||
complete
|
||||
? toggleFullScreen
|
||||
: naviga(`/catalogo/` + myproduct._id + '/' + cosa)
|
||||
"
|
||||
>
|
||||
"-->
|
||||
<div
|
||||
class="absolute transparent"
|
||||
style="left: 90%; top: 0; transform: translateX(-50%)"
|
||||
style="left: 90%; top: -18px; transform: translateX(-50%)"
|
||||
>
|
||||
<q-btn
|
||||
color="blue"
|
||||
color="blue-6"
|
||||
class="semi-transparent"
|
||||
round
|
||||
icon="search"
|
||||
@click="toggleFullScreen"
|
||||
size="md"
|
||||
@click.stop="toggleFullScreen"
|
||||
size="sm"
|
||||
/>
|
||||
</div>
|
||||
</q-img>
|
||||
|
||||
<div class="scheda-book">
|
||||
<q-card-title>
|
||||
<span class="book-title" :data-col="options.quante_col">{{
|
||||
myproduct.productInfo.name
|
||||
}}</span>
|
||||
<span class="book-title" :data-col="options.quante_col">
|
||||
<span
|
||||
v-if="!complete"
|
||||
class="cursor-pointer"
|
||||
@click="click_opendetail()"
|
||||
>{{ myproduct.productInfo.name }}
|
||||
</span>
|
||||
<span v-else>{{ myproduct.productInfo.name }} </span>
|
||||
</span>
|
||||
</q-card-title>
|
||||
<q-card-subtitle
|
||||
v-if="myproduct.productInfo.authors"
|
||||
@@ -78,8 +89,11 @@
|
||||
:key="author._id"
|
||||
>
|
||||
<span v-if="index > 0">, </span>
|
||||
<span class="author cursor-pointer text-primary"
|
||||
@click="click_author(author._id, author.name + ' ' + author.surname)"
|
||||
<span
|
||||
class="author cursor-pointer text-primary"
|
||||
@click="
|
||||
click_author(author._id, author.name + ' ' + author.surname)
|
||||
"
|
||||
>{{ author.name }} {{ author.surname }}</span
|
||||
>
|
||||
</span>
|
||||
@@ -141,21 +155,21 @@
|
||||
:key="index"
|
||||
@click="setvariazioneSelected(index)"
|
||||
>
|
||||
<div class="flex justify-between items-center q-mx-sm">
|
||||
<div v-if="checkIfVariazioneDaVisu(variazione)" class="flex justify-between items-center q-mx-sm">
|
||||
<q-badge
|
||||
class="q-badge--large"
|
||||
:color="
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.versione].color
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.arrversioni[0]].color
|
||||
"
|
||||
>
|
||||
<q-icon
|
||||
v-if="variazione.versione > 0"
|
||||
:name="tools.getIconByVersione(variazione.versione)"
|
||||
v-if="variazione.arrversioni[0] > 0"
|
||||
:name="tools.getIconByVersione(variazione.arrversioni[0])"
|
||||
color="white"
|
||||
></q-icon
|
||||
>
|
||||
{{
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.versione].label
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.arrversioni[0]].label
|
||||
}}
|
||||
</q-badge>
|
||||
<div v-if="variazione.formato && false">
|
||||
@@ -230,11 +244,9 @@
|
||||
v-for="(variazione, index) of myproduct.arrvariazioni"
|
||||
:key="index"
|
||||
>
|
||||
<div v-show="indvariazSel == index">
|
||||
<div v-show="indvariazSel == index && checkIfVariazioneDaVisu(variazione)">
|
||||
<div
|
||||
v-show="
|
||||
tools.disponibStr(variazione.quantita)
|
||||
"
|
||||
v-show="tools.disponibStr(variazione.quantita)"
|
||||
class="row justify-center q-mt-sm vertical-middle"
|
||||
style="align-items: center"
|
||||
>
|
||||
@@ -270,9 +282,9 @@
|
||||
>
|
||||
<span class="q-mr-sm">{{ $t('products.formato') }}:</span>
|
||||
<q-badge
|
||||
v-show="variazione.versione > 0"
|
||||
v-show="variazione.arrversioni[0] > 0"
|
||||
:color="
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.versione]
|
||||
shared_consts.VERSIONI_PRODOTTO[variazione.arrversioni[0]]
|
||||
.color
|
||||
"
|
||||
>{{ variazione.formato }}</q-badge
|
||||
@@ -281,9 +293,7 @@
|
||||
|
||||
<div class="row justify-center q-mt-sm">
|
||||
<q-btn
|
||||
v-if="
|
||||
variazione.addtocart_link && true
|
||||
"
|
||||
v-if="variazione.addtocart_link && true"
|
||||
:href="variazione.addtocart_link"
|
||||
target="_blank"
|
||||
color="primary"
|
||||
|
||||
1
src/components/CContainerCatalogoCard/CContainerCatalogoCard.scss
Executable file
1
src/components/CContainerCatalogoCard/CContainerCatalogoCard.scss
Executable file
@@ -0,0 +1 @@
|
||||
|
||||
94
src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts
Executable file
94
src/components/CContainerCatalogoCard/CContainerCatalogoCard.ts
Executable file
@@ -0,0 +1,94 @@
|
||||
import { defineComponent, ref, toRef, computed, PropType, watch, onMounted, reactive, onBeforeUnmount } from 'vue'
|
||||
import { useI18n } from '@src/boot/i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
|
||||
import { CCatalogoCard } from '../CCatalogoCard'
|
||||
|
||||
import { func_tools, toolsext } from '@store/Modules/toolsext'
|
||||
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useProducts } from '@store/Products'
|
||||
|
||||
import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
import { costanti } from '@costanti'
|
||||
import { ICatalogo } from '@src/model'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CContainerCatalogoCard',
|
||||
emits: ['selauthor'],
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
cosa: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
},
|
||||
complete: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: () => { }
|
||||
},
|
||||
optcatalogo: {
|
||||
type: Object as PropType<ICatalogo>,
|
||||
required: false,
|
||||
default: () => ({
|
||||
//++AddCATALOGO_FIELDS
|
||||
productTypes: [0],
|
||||
excludeproductTypes: [],
|
||||
formato: [],
|
||||
Categoria: [],
|
||||
Editore: [],
|
||||
}),
|
||||
},
|
||||
},
|
||||
components: { CCatalogoCard },
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
const opendetailbool = ref(false)
|
||||
|
||||
function selauthor(id: any, autore: any) {
|
||||
emit('selauthor', id, autore)
|
||||
}
|
||||
|
||||
function opendetail() {
|
||||
opendetailbool.value = true
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
//
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
tools,
|
||||
t,
|
||||
func_tools,
|
||||
toolsext,
|
||||
shared_consts,
|
||||
globalStore,
|
||||
costanti,
|
||||
selauthor,
|
||||
opendetail,
|
||||
opendetailbool,
|
||||
}
|
||||
}
|
||||
})
|
||||
49
src/components/CContainerCatalogoCard/CContainerCatalogoCard.vue
Executable file
49
src/components/CContainerCatalogoCard/CContainerCatalogoCard.vue
Executable file
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<div>
|
||||
<CCatalogoCard
|
||||
:id="id"
|
||||
:complete="complete"
|
||||
:cosa="cosa"
|
||||
:options="options"
|
||||
@selauthor="selauthor"
|
||||
@opendetail="opendetail"
|
||||
:optcatalogo="optcatalogo"
|
||||
>
|
||||
</CCatalogoCard>
|
||||
</div>
|
||||
<q-dialog
|
||||
v-model="opendetailbool"
|
||||
position="top"
|
||||
:maximized="true"
|
||||
class="q-pt-none"
|
||||
>
|
||||
<q-card>
|
||||
<q-card-section>
|
||||
<div class="row justify-center">
|
||||
<CCatalogoCard
|
||||
:id="id"
|
||||
:complete="true"
|
||||
:cosa="cosa"
|
||||
:options="{
|
||||
show_short_descr: true,
|
||||
show_price: true,
|
||||
show_cat: true,
|
||||
quante_col: 'c1',
|
||||
in_3d: true,
|
||||
}"
|
||||
:optcatalogo="optcatalogo"
|
||||
@selauthor="selauthor"
|
||||
>
|
||||
</CCatalogoCard>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CContainerCatalogoCard.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CContainerCatalogoCard.scss';
|
||||
</style>
|
||||
1
src/components/CContainerCatalogoCard/index.ts
Executable file
1
src/components/CContainerCatalogoCard/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CContainerCatalogoCard} from './CContainerCatalogoCard.vue'
|
||||
@@ -177,6 +177,8 @@ export default defineComponent({
|
||||
// console.log('myrec', myrec)
|
||||
myrec.value = ris
|
||||
notifStore.setAsRead(idnotif.value)
|
||||
}).catch((err) => {
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
|
||||
@@ -115,23 +115,7 @@ export default defineComponent({
|
||||
|
||||
visuadd.value = false
|
||||
|
||||
const newrec: IMyElem = {
|
||||
_id: undefined,
|
||||
type: newtype.value,
|
||||
path: props.myelem.path,
|
||||
order: order ? order : 1000,
|
||||
active: true,
|
||||
container: ''
|
||||
}
|
||||
|
||||
if (newrec.type === shared_consts.ELEMTYPE.CAROUSEL_IMGS) {
|
||||
newrec.container2 = '8'
|
||||
newrec.height = 600
|
||||
} else if (newrec.type === shared_consts.ELEMTYPE.CARD) {
|
||||
newrec.class2 = 'row justify-center'
|
||||
}
|
||||
|
||||
globalStore.addNewElem($q, t, newrec)
|
||||
let newrec = globalStore.prepareAddNewElem(order, $q, t, props.myelem, newtype.value)
|
||||
|
||||
emit('selElemClick', newrec)
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="myel.type === shared_consts.ELEMTYPE.CARD"
|
||||
v-else-if="myel.type === shared_consts.ELEMTYPE.CARD"
|
||||
:class="myel.span ? '' : ''"
|
||||
>
|
||||
<CSelectAnimation
|
||||
@@ -360,7 +360,7 @@
|
||||
</q-tab-panels>
|
||||
</div>
|
||||
|
||||
<div v-if="myel.type === shared_consts.ELEMTYPE.MARGINI">
|
||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.MARGINI">
|
||||
<div v-if="enableEdit">
|
||||
<q-input
|
||||
dense
|
||||
@@ -977,13 +977,56 @@
|
||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKIFISLOGGED">
|
||||
<q-select
|
||||
v-model="myel.container"
|
||||
:options="[{label: 'Mostra Sempre', value: true }, { label: 'Solo se Offline', value: false}]"
|
||||
:options="[
|
||||
{ label: 'Mostra Sempre', value: true },
|
||||
{ label: 'Solo se Offline', value: false },
|
||||
]"
|
||||
label="Quando mostrarlo"
|
||||
emit-value
|
||||
map-options
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CATALOGO">
|
||||
<div v-if="enableEdit" class="row">
|
||||
<div>Cataloghi:</div><br>
|
||||
|
||||
<!--++AddCATALOGO_FIELDS-->
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
v-if="enableEdit && myel.catalogo && myel.catalogo.productTypes"
|
||||
rounded
|
||||
outlined
|
||||
v-model="myel.catalogo.productTypes"
|
||||
:options="tools.SelectListVersione"
|
||||
@update:model-value="modifElem"
|
||||
multiple
|
||||
dense
|
||||
label="Includi"
|
||||
style="width: 150px"
|
||||
emit-value
|
||||
map-options
|
||||
>
|
||||
</q-select>
|
||||
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
v-if="enableEdit && myel.catalogo && myel.catalogo.excludeproductTypes"
|
||||
rounded
|
||||
outlined
|
||||
v-model="myel.catalogo.excludeproductTypes"
|
||||
:options="tools.SelectListVersione"
|
||||
@update:model-value="modifElem"
|
||||
multiple
|
||||
dense
|
||||
label="Escludi"
|
||||
style="width: 150px"
|
||||
emit-value
|
||||
map-options
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -117,7 +117,7 @@ export default defineComponent({
|
||||
|
||||
const newtype = ref(<any>'')
|
||||
|
||||
const isAppRunning = computed(() => globalStore.isAppRunning )
|
||||
const isAppRunning = computed(() => globalStore.isAppRunning)
|
||||
|
||||
watch(() => myel.value.order, (value, oldval) => {
|
||||
mounted()
|
||||
@@ -150,21 +150,7 @@ export default defineComponent({
|
||||
|
||||
function addNewElem(order?: number) {
|
||||
|
||||
const newrec: IMyElem = {
|
||||
_id: undefined,
|
||||
type: newtype.value,
|
||||
path: props.myelem.path,
|
||||
order: order ? order : 1000,
|
||||
active: true,
|
||||
container: ''
|
||||
}
|
||||
|
||||
if (newrec.type === shared_consts.ELEMTYPE.CAROUSEL_IMGS) {
|
||||
newrec.container2 = '8'
|
||||
newrec.height = 600
|
||||
}
|
||||
|
||||
globalStore.addNewElem($q, t, newrec)
|
||||
let newrec = globalStore.prepareAddNewElem(order, $q, t, props.myelem, newtype.value)
|
||||
}
|
||||
|
||||
function dupElem(order?: number) {
|
||||
|
||||
@@ -559,7 +559,8 @@
|
||||
</div>
|
||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CATALOGO">
|
||||
<div v-if="editOn" class="elemEdit">PRODOTTI CATALOGO:</div>
|
||||
<CCatalogo> </CCatalogo>
|
||||
<CCatalogo
|
||||
:optcatalogo="myel.catalogo"> </CCatalogo>
|
||||
</div>
|
||||
<div v-else-if="myel.type === shared_consts.ELEMTYPE.MAPPA">
|
||||
<div v-if="editOn" class="elemEdit">MAPPA:</div>
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
</div>
|
||||
<slot></slot>
|
||||
<div v-if="!nofooter">
|
||||
<LandingFooter></LandingFooter>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -440,6 +440,8 @@ export default defineComponent({
|
||||
// if (!props.useinput) {
|
||||
if (props.value) {
|
||||
myvalue.value = props.value
|
||||
} else {
|
||||
myvalue.value = ''
|
||||
}
|
||||
// }
|
||||
}
|
||||
@@ -547,9 +549,9 @@ export default defineComponent({
|
||||
function filterFn(val: any, update: any, abort: any) {
|
||||
update(
|
||||
async () => {
|
||||
console.log('Filter val', val, val.length)
|
||||
console.log('Filter val:', val, 'len=', val.length)
|
||||
console.log('props.filter_extra', props.filter_extra)
|
||||
|
||||
console.log('valori.value', valori.value)
|
||||
|
||||
let myarr: any = []
|
||||
|
||||
@@ -743,6 +745,10 @@ export default defineComponent({
|
||||
return ''
|
||||
}
|
||||
|
||||
function selectText(event: any) {
|
||||
// Seleziona tutto il testo all'interno della casella di testo
|
||||
event.target.select();
|
||||
}
|
||||
onMounted(mounted)
|
||||
|
||||
|
||||
@@ -758,6 +764,7 @@ export default defineComponent({
|
||||
newvaluefuncfirst,
|
||||
getIcon,
|
||||
tools,
|
||||
selectText,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
</q-select>
|
||||
</div>
|
||||
<div v-else-if="pickup">
|
||||
|
||||
<q-select
|
||||
v-if="pickup"
|
||||
:model-value="myvalue"
|
||||
@@ -95,9 +96,12 @@
|
||||
:option-value="optval"
|
||||
:option-label="optlab"
|
||||
map-options
|
||||
:use-chips="myvalue && myvalue !== '' ? true : false"
|
||||
stack-label
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
@filter="filterFn"
|
||||
v-bind="$attrs"
|
||||
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon
|
||||
|
||||
Reference in New Issue
Block a user