Files
newfreeplanet_OLD/src/components/CCatalogoCard/CCatalogoCard.vue

373 lines
11 KiB
Vue
Raw Normal View History

2024-05-04 14:49:09 +02:00
<template>
2024-05-08 16:07:42 +02:00
<div
:class="{
2024-10-26 17:12:05 +02:00
' items-start q-gutter-sm': true,
2024-05-08 16:07:42 +02:00
}"
2024-10-26 17:12:05 +02:00
:style="
2024-11-19 19:19:14 +01:00
scheda.height ? ' height: ' + scheda.height + 'px !important; ' : ''
2024-10-26 17:12:05 +02:00
"
2024-05-08 16:07:42 +02:00
>
2024-05-04 14:49:09 +02:00
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
2024-11-19 19:19:14 +01:00
2024-05-04 14:49:09 +02:00
<div
v-if="!!myproduct && !!myproduct.productInfo"
2024-05-05 19:09:08 +02:00
:class="{
2024-05-08 16:07:42 +02:00
'my-card-big book-details': complete,
2024-10-26 17:12:05 +02:00
'book-card': !complete && !optcatalogo.pdf,
colfix_prodotti_1: options.quante_col == 'c1' && !optcatalogo.pdf,
colfix_prodotti_2: options.quante_col == 'c2' && !optcatalogo.pdf,
colfix_prodotti_3: options.quante_col == 'c3' && !optcatalogo.pdf,
2024-05-05 19:09:08 +02:00
}"
2024-05-04 14:49:09 +02:00
>
2024-05-05 19:09:08 +02:00
<q-toggle
2024-10-26 17:12:05 +02:00
v-if="tools.isManager() && !optcatalogo.pdf"
2024-05-05 19:09:08 +02:00
v-model="editOn"
class="absolute-top-right"
color="green"
icon="fas fa-pencil-alt"
dense
>
</q-toggle>
<q-page-sticky
2024-10-26 17:12:05 +02:00
v-if="complete && !optcatalogo.pdf"
position="bottom-right"
:offset="[18, 0]"
style="z-index: 1000"
>
<q-btn
fab
icon="fas fa-arrow-up"
class="semi-transparent"
color="primary"
v-close-popup
/>
</q-page-sticky>
2024-05-04 14:49:09 +02:00
<q-card-section>
2024-05-08 16:07:42 +02:00
<div
2024-10-31 23:23:06 +01:00
:class="[
'flex q-pa-xs', // Classi comuni
{ 'shadow-2': options.in_3d }, // Classe condizionale
scheda.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
2024-10-31 23:23:06 +01:00
? 'flex-col'
: 'flex-row', // Layout flessibile
]"
:style="{
justifyContent: 'center',
alignItems: 'flex-start',
gap: '0.5rem',
2024-11-19 19:19:14 +01:00
width: scheda.dimensioni?.scheda_prodotto?.size.width ?? '100%',
2024-10-26 17:12:05 +02:00
}"
2024-05-08 16:07:42 +02:00
>
2024-05-04 14:49:09 +02:00
<q-img
2024-10-26 17:12:05 +02:00
v-if="myproduct.productInfo"
2024-05-04 14:49:09 +02:00
:src="
2024-10-26 17:12:05 +02:00
myproduct.productInfo.imagefile
? tools.getFullFileNameByImageFile(
'productInfos',
myproduct.productInfo.imagefile
)
2024-05-04 14:49:09 +02:00
: myproduct.productInfo.image_link
"
:alt="myproduct.productInfo.name"
2024-05-05 19:09:08 +02:00
:class="{
'book-image-fixed': complete,
'cursor-pointer': !complete,
2024-05-08 16:07:42 +02:00
'shadow-4': true,
2024-10-26 17:12:05 +02:00
'image-wrapper': optcatalogo.pdf,
2024-05-05 19:09:08 +02:00
}"
2024-10-31 23:23:06 +01:00
:style="{
width:
scheda.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
2024-10-31 23:23:06 +01:00
? '50%'
: '45%',
2024-11-19 19:19:14 +01:00
...(scheda.dimensioni?.immagine_prodotto?.size?.width && {
width:
scheda.dimensioni?.immagine_prodotto.size?.width +
' !important',
2024-10-31 23:23:06 +01:00
}),
display: 'block',
}"
@click="click_opendetail()"
>
2024-05-08 16:07:42 +02:00
<div
class="absolute transparent"
style="left: 90%; top: -18px; transform: translateX(-50%)"
2024-05-08 16:07:42 +02:00
>
<q-btn
2024-10-26 17:12:05 +02:00
v-if="!optcatalogo.pdf"
color="blue-6"
2024-05-08 16:07:42 +02:00
class="semi-transparent"
round
icon="search"
@click.stop="toggleFullScreen"
size="sm"
2024-05-08 16:07:42 +02:00
/>
</div>
2024-05-05 19:09:08 +02:00
</q-img>
2024-10-31 23:23:06 +01:00
<!-- Testo associato all'immagine -->
<div
:style="{
width:
scheda.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
2024-10-31 23:23:06 +01:00
? '100%'
: '50%',
textAlign: 'center',
marginTop:
scheda.posiz_text === costanti.POSIZ_TESTO.IN_BASSO
2024-10-31 23:23:06 +01:00
? '1rem'
: '0',
}"
2024-11-19 19:19:14 +01:00
>
<div
v-if="scheda.testo_right"
:style="`line-height: ${scheda.line_height}%; `"
v-html="products.replaceKeyWordsByProduct(myproduct, scheda.testo_right)"
></div>
<div v-if="scheda.barcode && scheda.barcode.show">
<CBarCode
:value="myproduct.productInfo.code"
:format="scheda.barcode.format"
:fontsize="scheda.barcode.font?.size"
:width="parseInt(scheda.barcode.size.width)"
:height="parseInt(scheda.barcode.size.height)"
:text="`ISBN: ${myproduct.productInfo.code}`"
>
</CBarCode>
</div>
</div>
<div
v-if="scheda.testo_bottom && scheda.testo_bottom.contenuto"
:style="{
width: '100%',
textAlign: 'center',
marginTop: '1rem',
}"
2024-10-31 23:23:06 +01:00
>
2024-05-05 19:09:08 +02:00
<div
:style="`line-height: ${scheda.line_height}%; `"
2024-11-19 19:19:14 +01:00
v-html="products.replaceKeyWordsByProduct(myproduct, scheda.testo_bottom)"
2024-10-31 23:23:06 +01:00
></div>
2024-05-04 14:49:09 +02:00
</div>
</div>
</q-card-section>
2024-05-05 19:09:08 +02:00
<q-separator v-if="complete" class="q-my-sm"></q-separator>
2024-05-04 14:49:09 +02:00
<q-card-section v-if="complete && myproduct.productInfo.description">
2024-05-05 19:09:08 +02:00
<div class="title-descr text-blue row">Descrizione:</div>
2024-05-04 14:49:09 +02:00
<div class="row items-center">
<div class="text-title text-grey-9">
<span
class="text-grey-7"
v-html="myproduct.productInfo.description"
></span>
</div>
</div>
</q-card-section>
2024-05-05 19:09:08 +02:00
</div>
2024-05-04 14:49:09 +02:00
<q-dialog v-if="myproduct" v-model="openlistorders">
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title>
{{ t('ecomm.listaord') }} - {{ myproduct.productInfo.name }}
</q-toolbar-title>
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<q-markup-table
wrap-cells
bordered
separator="horizontal"
class="listaev__table"
>
<thead>
2024-10-31 23:23:06 +01:00
<tr>
<th>Data</th>
<th>Persona</th>
<th>Stato</th>
<th>Quantita</th>
<th>Note</th>
</tr>
2024-05-04 14:49:09 +02:00
</thead>
<tbody>
<tr
v-for="(ordcart, index) of listord"
:key="index"
class="listaev listaev__table"
>
<td class="text-center">
<div>
{{ func_tools.getDateTimeShortStr(ordcart.created_at) }}
</div>
</td>
<td class="text-center">
<strong>{{
tools.getNomeUtenteEUsernameByRecUser(ordcart.user)
}}</strong>
</td>
<td class="text-center">
<strong>{{
shared_consts.getStatusStr(ordcart.status)
}}</strong>
</td>
<td class="text-center">
<div v-for="(singleord, index) in ordcart.items" :key="index">
<span
v-if="
singleord.order.idProduct === myproduct._id &&
singleord.order.quantity > 0
"
>
{{ singleord.order.quantity }}</span
>
<span
v-if="
singleord.order.idProduct === myproduct._id &&
singleord.order.quantitypreordered > 0
"
>
{{ singleord.order.quantitypreordered }}</span
>
</div>
</td>
<td class="text-center">
{{ ordcart.note }}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="text-center">
Totali:
<span class="totali">{{ sumval }}</span>
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</q-markup-table>
</q-card-section>
</q-card>
</q-dialog>
<q-dialog
v-if="
true &&
myproduct &&
myproduct.productInfo &&
myproduct.productInfo.link_scheda
"
v-model="apriSchedaPDF"
maximized
>
<q-card>
<q-toolbar class="bg-primary text-white">
<q-toolbar-title>
{{ myproduct.productInfo.name }}
</q-toolbar-title>
<q-btn
flat
round
color="white"
label="CHIUDI"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section>
<iframe
:src="myproduct.productInfo.link_scheda"
frameborder="0"
width="100%"
height="100%"
></iframe>
</q-card-section>
</q-card>
<q-card-actions align="bottom">
<q-btn color="primary" label="Chiudi" @click="apriSchedaPDF = false" />
</q-card-actions>
</q-dialog>
<q-dialog
v-if="
false &&
myproduct &&
myproduct.productInfo &&
myproduct.productInfo.link_scheda
"
v-model="apriSchedaPDF"
fullscreen
>
<q-toolbar class="bg-primary text-white">
<q-toolbar-title>
{{ myproduct.productInfo.name }}
</q-toolbar-title>
<q-btn
flat
round
color="white"
label="CHIUDI"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section>
<vue-pdf-app
:pdf="myproduct.productInfo.link_scheda"
style="height: 100vh"
></vue-pdf-app>
</q-card-section>
</q-dialog>
<q-dialog
v-model="isFullScreen"
position="top"
:maximized="true"
class="q-pt-none"
>
<div
v-if="isFullScreen"
class="fullscreen-container"
@touchmove.prevent
@click="toggleFullScreen"
>
<q-img
:src="
myproduct.productInfo.imagefile
? `` + myproduct.productInfo.imagefile
2024-05-04 14:49:09 +02:00
: myproduct.productInfo.image_link
"
:alt="myproduct.productInfo.name"
2024-05-08 16:07:42 +02:00
:fit="tools.isMobile() ? 'fill' : 'contain'"
class="fullscreen-image"
2024-05-04 14:49:09 +02:00
@touchstart="onTouchStart"
@touchmove="onTouchMove"
@touchend="onTouchEnd"
ref="fullscreenImage"
2024-05-08 16:07:42 +02:00
>
</q-img>
2024-05-04 14:49:09 +02:00
<br />
</div>
<div class="text-center">
<q-btn
class="q-ma-md"
@click="isFullScreen = false"
label="Chiudi"
rounded
color="primary"
icon="close"
></q-btn>
</div>
</q-dialog>
</div>
</template>
<script lang="ts" src="./CCatalogoCard.ts">
</script>
<style lang="scss" scoped>
@import './CCatalogoCard.scss';
</style>