- Aggiungere un campo "Vagliato dall'Editore" e aggiungere anche il campo "chi" e delle Note
This commit is contained in:
@@ -134,7 +134,7 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Scheda Libro</q-item-label>
|
||||
<q-item-label>Scheda</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
@@ -194,7 +194,7 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Carica dati del Libro (da GM)</q-item-label>
|
||||
<q-item-label>Carica dati (da GM)</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
@@ -213,7 +213,7 @@
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Carica dati del Libro (dal DB Locale)</q-item-label>
|
||||
<q-item-label>Carica dati (dal DB Locale)</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<!--<q-item
|
||||
@@ -675,7 +675,6 @@
|
||||
>
|
||||
</CSchedaProdotto>
|
||||
|
||||
updateFieldToGM
|
||||
</q-dialog>
|
||||
<q-dialog
|
||||
v-if="myproduct && modifTrafiletto"
|
||||
@@ -695,7 +694,6 @@
|
||||
>
|
||||
</CModifTrafiletto>
|
||||
|
||||
updateFieldToGM
|
||||
</q-dialog>
|
||||
<q-dialog
|
||||
v-if="visufromgm && myproduct"
|
||||
|
||||
@@ -40,9 +40,6 @@ import { costanti } from '@costanti'
|
||||
import objectId from '@src/js/objectId'
|
||||
import { useProducts } from '@src/store/Products'
|
||||
|
||||
import html2pdf from 'html2pdf.js'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyEditElem',
|
||||
components: {
|
||||
@@ -740,135 +737,11 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDebug() {
|
||||
myel.value.catalogo!.indebug = !myel.value.catalogo!.indebug
|
||||
}
|
||||
|
||||
const preparePDF = async () => {
|
||||
myel.value.catalogo!.generazionePDFInCorso = true
|
||||
myel.value.catalogo!.areadistampa!.scale = myel.value.catalogo!.areadistampa!.scale_printable
|
||||
}
|
||||
|
||||
const terminaPDF = async () => {
|
||||
myel.value.catalogo!.generazionePDFInCorso = false
|
||||
myel.value.catalogo!.areadistampa!.scale = 1
|
||||
}
|
||||
|
||||
|
||||
const generatePDF = async (optcatalogo: IOptCatalogo) => {
|
||||
|
||||
await nextTick()
|
||||
|
||||
$q.dialog({
|
||||
message: 'Generare il PDF ?',
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: 'Generazione PDF'
|
||||
}).onOk(async () => {
|
||||
|
||||
|
||||
$q.loading.show({
|
||||
message: 'Caricamento immagini e generazione PDF in corso...'
|
||||
})
|
||||
|
||||
|
||||
try {
|
||||
|
||||
let defaultMargin = 0.1
|
||||
if (optcatalogo.printable) {
|
||||
defaultMargin = 0
|
||||
} else {
|
||||
defaultMargin = 0
|
||||
}
|
||||
const unit = optcatalogo.areadistampa!.unit
|
||||
|
||||
let myformat = { ...optcatalogo.areadistampa!.format }
|
||||
|
||||
const scale = tools.getScale(optcatalogo)
|
||||
|
||||
const scalecanvas = optcatalogo.areadistampa!.scalecanvas
|
||||
|
||||
if (tools.isObject(myformat) && scale > 0) {
|
||||
} else {
|
||||
myformat = [210, 297]
|
||||
}
|
||||
|
||||
|
||||
const formatwidth = (myformat[0] * scale)
|
||||
const formatheight = (myformat[1] * scale)
|
||||
|
||||
let myfile = (optcatalogo.pdf_filename ?? 'catalogo_completo')
|
||||
|
||||
myfile += '_' + formatwidth + '_' + formatheight + '_' + unit + '_scale_' + scale
|
||||
|
||||
myfile += '.pdf'
|
||||
|
||||
|
||||
const element = document.getElementById('pdf-content')
|
||||
const opt = {
|
||||
margin: [
|
||||
optcatalogo.printable ? (parseFloat(optcatalogo.areadistampa!.margini?.top) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.printable ? (parseFloat(optcatalogo.areadistampa!.margini?.left) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.printable ? (parseFloat(optcatalogo.areadistampa!.margini?.bottom) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.printable ? (parseFloat(optcatalogo.areadistampa!.margini?.right) || defaultMargin) : defaultMargin
|
||||
],
|
||||
filename: myfile,
|
||||
image: {
|
||||
type: 'jpeg',
|
||||
quality: 0.98
|
||||
},
|
||||
html2canvas: {
|
||||
scale: scalecanvas,
|
||||
useCORS: true,
|
||||
letterRendering: true,
|
||||
},
|
||||
jsPDF: {
|
||||
unit: unit,
|
||||
format: [formatwidth, formatheight],
|
||||
orientation: optcatalogo.areadistampa!.orientation,
|
||||
compress: optcatalogo.areadistampa!.compress,
|
||||
},
|
||||
enableLinks: true,
|
||||
pagebreak: { mode: 'avoid-all', before: '.card-page' }
|
||||
}
|
||||
|
||||
console.log('opt di stampa', opt)
|
||||
// a4: [595.28, 841.89]
|
||||
|
||||
await html2pdf().set(opt).from(element).save()
|
||||
|
||||
optcatalogo.generazionePDFInCorso = false
|
||||
optcatalogo.areadistampa!.scale = 1
|
||||
|
||||
$q.loading.hide()
|
||||
$q.notify({
|
||||
color: 'positive',
|
||||
message: 'PDF generato con successo!',
|
||||
icon: 'check'
|
||||
})
|
||||
} catch (error) {
|
||||
$q.loading.hide()
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
message: 'Errore nella generazione del PDF',
|
||||
icon: 'error'
|
||||
})
|
||||
console.error('Errore nella generazione del PDF:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
preparePDF, terminaPDF, generatePDF,
|
||||
toggleDebug,
|
||||
tools,
|
||||
shared_consts,
|
||||
getArrDisciplines,
|
||||
|
||||
@@ -2480,28 +2480,6 @@
|
||||
</div>
|
||||
</q-expansion-item>
|
||||
<div></div>
|
||||
<q-btn
|
||||
v-if="myel.catalogo.pdf && !myel.catalogo.generazionePDFInCorso"
|
||||
:label="`Prepara PDF`"
|
||||
@click="preparePDF"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="myel.catalogo.generazionePDFInCorso"
|
||||
:label="`Termina Generazione`"
|
||||
@click="terminaPDF"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="myel.catalogo.pdf && myel.catalogo.generazionePDFInCorso"
|
||||
:label="`Genera PDF ${myel.catalogo.pdf_filename}`"
|
||||
@click="generatePDF(myel.catalogo)"
|
||||
color="positive"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Debug"
|
||||
@click="toggleDebug()"
|
||||
:push="myel.catalogo.indebug"
|
||||
:color="myel.catalogo.indebug ? `positive` : 'primary'"
|
||||
></q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-list>
|
||||
|
||||
@@ -537,6 +537,14 @@ export default defineComponent({
|
||||
}
|
||||
// console.log('props.field', props.field, 'props.subfield', props.subfield, 'myvalue: ', myvalue)
|
||||
}
|
||||
|
||||
if (props.type === costanti.FieldType.verifica && !myvalue.value) {
|
||||
myvalue.value = {
|
||||
esito: costanti.VALIDATO.NO,
|
||||
username: '',
|
||||
note: '',
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
@@ -631,6 +639,11 @@ export default defineComponent({
|
||||
|
||||
console.log('SaveValueInt', newVal, valinitial)
|
||||
|
||||
if (col.value.fieldtype === costanti.FieldType.verifica) {
|
||||
newVal.username = userStore.my.username
|
||||
newVal.data = tools.getDateNow()
|
||||
}
|
||||
|
||||
if (props.tablesel) {
|
||||
if (true) {
|
||||
|
||||
@@ -949,6 +962,14 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function updateValidazione(esito: any) {
|
||||
myvalue.value.esito = esito
|
||||
myvalue.value.data = tools.getDateNow()
|
||||
myvalue.value.username = userStore.my.username
|
||||
changevalRec(myvalue.value)
|
||||
Savedb(myvalue.value, '')
|
||||
}
|
||||
|
||||
|
||||
onBeforeMount(mounted)
|
||||
|
||||
@@ -998,6 +1019,7 @@ export default defineComponent({
|
||||
handleCancel,
|
||||
popupEditRef,
|
||||
copyToClipboard,
|
||||
updateValidazione,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -213,6 +213,46 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.verifica">
|
||||
<div>
|
||||
<div>
|
||||
<q-chip
|
||||
dense
|
||||
class="q-ma-xs q-pa-xs"
|
||||
:color="
|
||||
myvalue.esito === costanti.VALIDATO.SI
|
||||
? 'green'
|
||||
: myvalue.esito === costanti.VALIDATO.TO_RESOLV
|
||||
? 'red'
|
||||
: 'grey-7'
|
||||
"
|
||||
text-color="white"
|
||||
:icon="
|
||||
myvalue.esito === costanti.VALIDATO.NO
|
||||
? 'fas fa-question-circle'
|
||||
: myvalue.esito === costanti.VALIDATO.SI
|
||||
? 'fas fa-check-circle'
|
||||
: 'fas fa-exclamation-circle'
|
||||
"
|
||||
:label="
|
||||
myvalue.esito === costanti.VALIDATO.NO
|
||||
? $t('validazione.NO')
|
||||
: myvalue.esito === costanti.VALIDATO.SI
|
||||
? $t('validazione.SI')
|
||||
: $t('validazione.TO_RESOLV')
|
||||
"
|
||||
></q-chip>
|
||||
</div>
|
||||
<div v-if="myvalue.username">
|
||||
<span>(Utente: {{ myvalue.username }} - in Data: {{ tools.getstrDateTime(myvalue.data) }})</span>
|
||||
</div>
|
||||
|
||||
<div v-if="myvalue.note">
|
||||
<span>Note: {{ myvalue.note }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.string || col.fieldtype === costanti.FieldType.crypted">
|
||||
<div
|
||||
v-if="isInModif"
|
||||
@@ -1118,6 +1158,41 @@
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.verifica">
|
||||
<div>
|
||||
<q-option-group
|
||||
v-model="scope.value.esito"
|
||||
type="radio"
|
||||
:icon="
|
||||
[costanti.VALIDATO.NO, costanti.VALIDATO.TO_RESOLV].includes(myvalue.esito)
|
||||
? 'fas fa-question-circle'
|
||||
: 'fas fa-check-circle'
|
||||
"
|
||||
:color="
|
||||
myvalue.esito === costanti.VALIDATO.SI
|
||||
? 'green'
|
||||
: myvalue.esito === costanti.VALIDATO.TO_RESOLV
|
||||
? 'red'
|
||||
: 'grey-7'
|
||||
"
|
||||
inline
|
||||
:options="[
|
||||
{ label: '[Non verificato]', value: costanti.VALIDATO.NO },
|
||||
{ label: 'Validato', value: costanti.VALIDATO.SI },
|
||||
{ label: 'Da Risolvere', value: costanti.VALIDATO.TO_RESOLV },
|
||||
]"
|
||||
></q-option-group>
|
||||
Username: {{ scope.value.username }}
|
||||
<q-input
|
||||
v-model="scope.value.note"
|
||||
type="text"
|
||||
icon="fas fa-sticky-note"
|
||||
label="Nota"
|
||||
:autogrow="true"
|
||||
>
|
||||
</q-input>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="col.fieldtype === costanti.FieldType.string || col.fieldtype === costanti.FieldType.crypted"
|
||||
>
|
||||
@@ -1146,9 +1221,9 @@
|
||||
<div v-else-if="col.fieldtype === costanti.FieldType.editor_nohtml">
|
||||
<div
|
||||
class="q-pa-md"
|
||||
style="min-width: 600px;"
|
||||
style="min-width: 600px"
|
||||
>
|
||||
<CMyEditorAI
|
||||
<CMyEditorAI
|
||||
v-model:value="scope.value"
|
||||
:title="col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + col.label : undefined"
|
||||
@keyup.enter.stop
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
:height="opt.heightimg"
|
||||
class="clickable-image"
|
||||
fit="cover"
|
||||
:src="tools.getFullFileName([myrec.foto_collana], table, myrec.username, myrec._id)"
|
||||
:src="tools.getFullFileName([myrec.foto_collana], table, '', myrec._id)"
|
||||
>
|
||||
<template v-slot:error>
|
||||
<div class="absolute-full flex flex-center text-white">immagine non impostata</div>
|
||||
@@ -35,14 +35,11 @@
|
||||
{{ myrec.title }}
|
||||
</div>
|
||||
<div class="">
|
||||
<div
|
||||
v-if="numprodottistr"
|
||||
class="text-caption text-h7 text-grey q-pb-xs"
|
||||
>
|
||||
<div class="text-caption text-h7 text-grey q-pb-xs">
|
||||
<q-icon name="fas fa-list-ol" /> {{ $t('cataloglist.numprodotti') }}:
|
||||
<span class="text-blue">{{ numprodottistr }}</span>
|
||||
<span :class="`text-` + (numprodottistr === 0 ? 'red' : 'blue')">{{ numprodottistr }}</span>
|
||||
</div>
|
||||
<div class="text-caption text-h7 text-grey q-pb-xs">
|
||||
<div class="text-caption text-h7 text-grey q-pb-xs">
|
||||
<q-icon name="fas fa-user" /> {{ $t('cataloglist.referenti') }}:
|
||||
<span
|
||||
v-if="myrec.referenti && myrec.referenti.length > 0"
|
||||
@@ -114,6 +111,13 @@
|
||||
>
|
||||
(Data: {{ tools.getstrDate(myrec.data_generato) }})
|
||||
</div>
|
||||
<div class="text-caption text-h7 text-grey q-pb-xs">
|
||||
<q-icon name="fas fa-list" /> Lista generata il:
|
||||
<span :class="`text-` + (tools.isDateValid(myrec.data_lista_generata) ? 'blue' : 'red')"
|
||||
>{{ tools.getstrDate(myrec.data_lista_generata) || '(non ancora generata)' }} da
|
||||
{{ myrec.username_lista_generata }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="myrec.pdf_online"
|
||||
class="text-caption text-h7 text-blue q-pb-xs"
|
||||
@@ -238,7 +242,7 @@
|
||||
class="q-ma-sm"
|
||||
>
|
||||
<CLabel
|
||||
:class_text="{ 'text-bold': true }"
|
||||
:class_text="{ 'text-bold': true }"
|
||||
:value="esiste_descrintro ? 'PRESENTE ' : 'MANCANTE !'"
|
||||
label="Testo descrittivo"
|
||||
:color="esiste_descrintro ? 'green' : 'red'"
|
||||
@@ -249,19 +253,32 @@
|
||||
class="q-ma-sm"
|
||||
>
|
||||
<CLabel
|
||||
:value="myrec.pdf_generato || 'ancora non è stato generato'"
|
||||
label="PDF generato"
|
||||
:value="
|
||||
tools.getstrDate(myrec.data_lista_generata) + ' da ' + myrec.username_lista_generata ||
|
||||
'ancora non è stata generata'
|
||||
"
|
||||
label="Lista generata"
|
||||
:color="myrec.pdf_generato ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
<CLabel
|
||||
:value="myrec.pdf_online || 'ancora non è andato ONLINE'"
|
||||
label="PDF On-Line Ufficiale"
|
||||
:color="myrec.pdf_online ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="width: 300px"
|
||||
class="q-ma-sm"
|
||||
>
|
||||
<CLabel
|
||||
:value="myrec.pdf_generato || 'ancora non è stato generato'"
|
||||
label="PDF generato"
|
||||
:color="myrec.pdf_generato ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
<CLabel
|
||||
:value="myrec.pdf_online || 'ancora non è andato ONLINE'"
|
||||
label="PDF On-Line Ufficiale"
|
||||
:color="myrec.pdf_online ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<q-card-actions align="center">
|
||||
|
||||
@@ -101,7 +101,7 @@ export default defineComponent({
|
||||
maxlength: props.scheda?.testo_bottom?.maxlength
|
||||
}
|
||||
|
||||
const savedColumns = tools.getCookie("selColCat");
|
||||
const savedColumns = tools.getCookie("selColCat_2");
|
||||
if (savedColumns) {
|
||||
selectedColumns.value = savedColumns;
|
||||
}
|
||||
@@ -121,6 +121,7 @@ export default defineComponent({
|
||||
const allColumns = [
|
||||
{ name: "pos", label: "Ind", field: "pos", align: "left", style: "width: 50px" },
|
||||
{ name: "drag", label: "Ord", field: "", align: "left", style: "width: 50px", edit: true },
|
||||
{ name: "validato", label: "Val", field: "validato", align: "left", style: "" },
|
||||
{ name: "image", label: "Foto", field: "image", align: "center" },
|
||||
{ name: "name", label: "Titolo del Libro", field: "name", align: "left" },
|
||||
{ name: "authors", label: "Autore", field: "authors", align: "left" },
|
||||
@@ -133,12 +134,14 @@ export default defineComponent({
|
||||
{ name: "stato", label: "Stato", field: "stato", align: "left" },
|
||||
{ name: "tipologia", label: "Tipologia", field: "tipologia", align: "left" },
|
||||
{ name: "tipoformato", label: "Formato", field: "tipoformato", align: "left" },
|
||||
{ name: "pagine", label: "Pag.", field: "pagine", align: "right" },
|
||||
{ name: "prezzo", label: "€", field: "prezzo", align: "right" },
|
||||
{ name: "prezzo_sconto", label: "€ (sconto)", field: "prezzo_sconto", align: "right" },
|
||||
{ name: "date_pub", label: "Pubblicato", field: "date_pub", align: "left" },
|
||||
//{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
|
||||
//{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
//{ name: "rank6M", label: "Class. 6M", field: "rank6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
//{ name: "rank1Y", label: "Class. 1Y", field: "rank1Y", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "pagine", label: "Pag.", field: "pagine", align: "right" },
|
||||
{ name: "totVen", label: "Vend", field: "totVen", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "vLast6M", label: "Ven 6M", field: "vLast6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
{ name: "fatLast6M", label: "Fat 6M", field: "fatLast6M", align: "right", visu: costanti.VISUCAMPI.PER_EDITORE },
|
||||
@@ -167,6 +170,9 @@ export default defineComponent({
|
||||
case 'authors':
|
||||
return formatAuthors(element.productInfo?.authors);
|
||||
|
||||
case 'validato':
|
||||
return element.validaprod?.esito === costanti.VALIDATO.SI ? '<span class="text-bold">SI</span>' : (element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV ? '<span class="text-bold">ERR</span>' : 'NO');
|
||||
|
||||
case 'isbn':
|
||||
return element.isbn;
|
||||
|
||||
@@ -197,6 +203,12 @@ export default defineComponent({
|
||||
case 'date_pub':
|
||||
return tools.getstrDate(element.productInfo?.date_pub);
|
||||
|
||||
case 'prezzo':
|
||||
return tools.getstrDate(element.price);
|
||||
|
||||
case 'prezzo_sconto':
|
||||
return tools.getstrDate(element.sale_price);
|
||||
|
||||
case 'rank3M':
|
||||
return element.productInfo?.rank3M;
|
||||
|
||||
@@ -260,6 +272,15 @@ export default defineComponent({
|
||||
}
|
||||
return '';
|
||||
|
||||
case 'validato':
|
||||
if (element.validaprod?.esito === costanti.VALIDATO.SI) {
|
||||
return 'bg-green';
|
||||
} else if (element.validaprod?.esito === costanti.VALIDATO.TO_RESOLV) {
|
||||
return 'bg-red';
|
||||
} else {
|
||||
return 'bg-grey';
|
||||
}
|
||||
|
||||
case 'quantity':
|
||||
if (products.isPubblicato(element.productInfo)) {
|
||||
if (products.isQtaLimitata(element)) {
|
||||
@@ -291,8 +312,15 @@ export default defineComponent({
|
||||
|
||||
function getFieldStyle(element: any, field: any): Record<string, string> {
|
||||
if (!element)
|
||||
return ''
|
||||
return {}
|
||||
|
||||
switch (field.field) {
|
||||
case 'validato':
|
||||
return {
|
||||
cursor: 'pointer',
|
||||
textAlign: 'center',
|
||||
color: 'white',
|
||||
}
|
||||
case 'image':
|
||||
return {
|
||||
width: '50px',
|
||||
@@ -325,7 +353,7 @@ export default defineComponent({
|
||||
|
||||
let cookieValue: [] | null = null;
|
||||
try {
|
||||
cookieValue = tools.getCookie("selColCat");
|
||||
cookieValue = tools.getCookie("selColCat_2");
|
||||
// Se il cookie esiste e contiene una stringa JSON valida
|
||||
cookieValue = cookieValue ? cookieValue : [];
|
||||
} catch (error) {
|
||||
@@ -333,7 +361,7 @@ export default defineComponent({
|
||||
cookieValue = []; // In caso di errore, inizializza come array vuoto
|
||||
}
|
||||
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "image", "name", "authors", "isbn", "catprods", "stato", "date_pub", "pagine", "trafiletto", "vLast6M", "quantity", "actions"]);
|
||||
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["pos", "drag", "validato", "image", "name", "authors", "isbn", "catprods", "stato", "date_pub", "pagine", "trafiletto", "fatLast1Y", "quantity", "actions"]);
|
||||
|
||||
|
||||
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
||||
@@ -358,7 +386,7 @@ export default defineComponent({
|
||||
|
||||
// 8. Salvataggio delle colonne selezionate in un cookie
|
||||
const saveSelectedColumns = () => {
|
||||
tools.setCookie("selColCat", JSON.stringify(selectedColumns.value));
|
||||
tools.setCookie("selColCat_2", JSON.stringify(selectedColumns.value));
|
||||
};
|
||||
|
||||
// 9. Watcher per salvare automaticamente le preferenze quando cambiano
|
||||
@@ -485,6 +513,8 @@ export default defineComponent({
|
||||
|
||||
function getFieldClick(element: any, field: any): (() => void) | null {
|
||||
switch (field.field) {
|
||||
case 'validato':
|
||||
return () => modifyProduct(element)
|
||||
case 'image':
|
||||
return () => showProduct(element);
|
||||
|
||||
|
||||
@@ -7,13 +7,20 @@
|
||||
:options="allColumns"
|
||||
label="Colonne da visualizzare"
|
||||
multiple
|
||||
filled
|
||||
dense
|
||||
class="float-right"
|
||||
outlined
|
||||
emit-value
|
||||
map-options
|
||||
option-value="name"
|
||||
option-label="label"
|
||||
filled
|
||||
style="max-width: 300px"
|
||||
/>
|
||||
style="max-width: 200px"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="settings" />
|
||||
</template>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<div class="row justify-center q-mx-auto q-pt-sm text-italic">
|
||||
@@ -107,7 +114,7 @@
|
||||
:style="getFieldStyle(element, field)"
|
||||
@click="getFieldClick(element, field)?.()"
|
||||
>
|
||||
{{ getFieldValue(element, field) }}
|
||||
<span v-html="getFieldValue(element, field)"></span>
|
||||
</td>
|
||||
<!-- Azioni -->
|
||||
<td v-else-if="field.name === 'actions' && isColumnVisible('actions', true)">
|
||||
|
||||
@@ -274,6 +274,17 @@ export default defineComponent({
|
||||
|
||||
function getArrListScheda(): IRecFields[] {
|
||||
const arrlist: IRecFields[] = [
|
||||
{
|
||||
editOn: true,
|
||||
label: "Verifica",
|
||||
table: "products",
|
||||
id: myproduct.value._id,
|
||||
rec: myproduct.value,
|
||||
mykey: "validaprod",
|
||||
debounce: "1000",
|
||||
type: costanti.FieldType.verifica,
|
||||
dense: true,
|
||||
},
|
||||
{
|
||||
editOn: true,
|
||||
label: "Titolo",
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface ICatalog {
|
||||
|
||||
pdf_generato?: string
|
||||
data_generato?: Date
|
||||
data_lista_generata?: Date
|
||||
username_lista_generata?: string
|
||||
pdf_online?: string
|
||||
data_online?: Date
|
||||
|
||||
|
||||
@@ -674,7 +674,7 @@ export interface ITimeLineMain {
|
||||
export interface IImgGallery {
|
||||
_id?: string
|
||||
imagefile: string
|
||||
vers_img: number
|
||||
vers_img?: number
|
||||
// order?: number
|
||||
alt?: string
|
||||
description?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IUserFields, IUserShort } from './UserStore'
|
||||
|
||||
export interface IVerificaProd {
|
||||
export interface IValidaProd {
|
||||
esito?: number
|
||||
data?: Date
|
||||
username?: string
|
||||
@@ -97,6 +97,7 @@ export interface IVariazione {
|
||||
preOrderDate?: Date
|
||||
addtocart_link?: string
|
||||
eta?: string
|
||||
validaprod?: IValidaProd
|
||||
}
|
||||
|
||||
export interface IAuthor {
|
||||
|
||||
@@ -2076,7 +2076,13 @@ const msg_it = {
|
||||
withexplain: 'Con Spiegazione',
|
||||
temperatura: 'Temperatura',
|
||||
outputType: 'Formato di Uscita',
|
||||
}
|
||||
},
|
||||
|
||||
validazione: {
|
||||
SI: 'Validato',
|
||||
NO: 'NON Validato',
|
||||
TO_RESOLV: 'Da Risolvere!',
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
@@ -488,6 +488,7 @@ export const costanti = {
|
||||
arrmenu: 18000,
|
||||
op_andor: 19000,
|
||||
editor_nohtml: 20000,
|
||||
verifica: 21000,
|
||||
|
||||
},
|
||||
|
||||
@@ -557,6 +558,12 @@ export const costanti = {
|
||||
OP_ANDOR: {
|
||||
OP_OR: 0,
|
||||
OP_AND: 1,
|
||||
},
|
||||
|
||||
VALIDATO: {
|
||||
NO: 0,
|
||||
SI: 1,
|
||||
TO_RESOLV: -1,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2748,6 +2748,7 @@ export const colTableProducts = [
|
||||
|
||||
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'validaprod', label_trans: 'products.validaprod', fieldtype: costanti.FieldType.verifica }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
|
||||
@@ -9905,6 +9905,18 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
isDateValid(mydate: Date) {
|
||||
try {
|
||||
return (
|
||||
mydate instanceof Date &&
|
||||
isFinite(mydate.getTime()) &&
|
||||
mydate.toISOString().split("T")[0] !== "1970-01-01"
|
||||
)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
// FINE !
|
||||
|
||||
@@ -1943,7 +1943,24 @@ export const useProducts = defineStore('Products', {
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
getPathByPage(idpag: string) {
|
||||
|
||||
let linkpage = ''
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
if (idpag) {
|
||||
const mypage = globalStore.getPageById(idpag)
|
||||
if (mypage)
|
||||
linkpage = mypage.path!
|
||||
}
|
||||
|
||||
return linkpage
|
||||
|
||||
},
|
||||
|
||||
|
||||
},
|
||||
|
||||
@@ -20,6 +20,10 @@ import { CProductTable } from '@src/components/CProductTable'
|
||||
import { CSearchProduct } from '@src/components/CSearchProduct'
|
||||
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard'
|
||||
import { CSelectUserActive } from '@src/components/CSelectUserActive'
|
||||
|
||||
import html2pdf from 'html2pdf.js'
|
||||
|
||||
|
||||
import type {
|
||||
IOptCatalogo, IDimensioni, IFilterCatalogo,
|
||||
IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg,
|
||||
@@ -96,6 +100,17 @@ export default defineComponent({
|
||||
|
||||
const optcatalogo = ref(<IOptCatalogo>{ ...props.modelValue });
|
||||
|
||||
const getPdfFilename = () => {
|
||||
let myfilename = (optcatalogo.value.pdf_filename ?? 'catalogo_completo')
|
||||
|
||||
const catalog = getCatalogoByMyPage.value
|
||||
if (catalog) {
|
||||
myfilename = productStore.getPathByPage(catalog.idPageAssigned)
|
||||
}
|
||||
|
||||
return myfilename
|
||||
}
|
||||
|
||||
function updateCatalogoPadre() {
|
||||
console.log('catalogo.ts PADRE')
|
||||
emit('update:modelValue', optcatalogo.value);
|
||||
@@ -461,6 +476,25 @@ export default defineComponent({
|
||||
return argomenti
|
||||
}
|
||||
|
||||
function getidTipoFormatoDaFiltrare(def_idTipoFormato?: number[]) {
|
||||
let idTipoFormato: number[] = []
|
||||
|
||||
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
if (trovatocatalogo) {
|
||||
idTipoFormato = trovatocatalogo.idTipoFormato! || []
|
||||
} else {
|
||||
if (def_idTipoFormato && def_idTipoFormato.length > 0) {
|
||||
idTipoFormato = def_idTipoFormato
|
||||
} else {
|
||||
idTipoFormato = []
|
||||
}
|
||||
}
|
||||
|
||||
return idTipoFormato
|
||||
}
|
||||
|
||||
function getEditoreDaFiltrare(def_editori?: string[]) {
|
||||
let editore: string[] = []
|
||||
|
||||
@@ -546,7 +580,7 @@ export default defineComponent({
|
||||
|
||||
if (!(optrigenera.value.visibilitaDisp === costanti.DISP.TUTTI ||
|
||||
(optrigenera.value.visibilitaDisp === costanti.DISP.ESAURITI && productStore.isEsaurito(product)) ||
|
||||
(optrigenera.value.visibilitaDisp === costanti.DISP.DISPONIBILI && productStore.isDisponibile(product)))) {
|
||||
(optrigenera.value.visibilitaDisp === costanti.DISP.DISPONIBILI && (productStore.isDisponibile(product) || productStore.isPrevendita(product))))) {
|
||||
return false;
|
||||
}
|
||||
if (!(optrigenera.value.stato === costanti.STATO.TUTTI ||
|
||||
@@ -675,7 +709,7 @@ export default defineComponent({
|
||||
const filtroProductTypes = optcatalogo.value.productTypes || [0];
|
||||
const filtroExcludeProductTypes = optcatalogo.value.excludeproductTypes || [0];
|
||||
const filtroidTipologie = optcatalogo.value.idTipologie || [];
|
||||
const filtroidTipoFormato = optcatalogo.value.idTipoFormato || [];
|
||||
const filtroidTipoFormato = getidTipoFormatoDaFiltrare(optcatalogo.value.idTipoFormato);
|
||||
const editore = getEditoreDaFiltrare(optcatalogo.value.editore);
|
||||
const filtroPublishers = editore || [];
|
||||
const idCollane = getIdCollaneDaFiltrare(optcatalogo.value.idCollane);
|
||||
@@ -741,12 +775,31 @@ export default defineComponent({
|
||||
generatearrProdToViewSorted(!generalista, salva, !optcatalogo.value.showListaArgomenti);
|
||||
loaddata();
|
||||
|
||||
if (generalista) {
|
||||
const catalog = getCatalogoByMyPage.value
|
||||
if (catalog) {
|
||||
catalog.data_lista_generata = tools.getDateNow()
|
||||
catalog.username_lista_generata = userStore.my.username
|
||||
await saveCatalog()
|
||||
}
|
||||
}
|
||||
|
||||
console.log('***** FINE calcArrPROD')
|
||||
|
||||
generatinglist.value = false
|
||||
rigeneraLibri.value = false
|
||||
}
|
||||
|
||||
async function saveCatalog() {
|
||||
const catalog = getCatalogoByMyPage.value
|
||||
const mydata = {
|
||||
table: 'catalogs',
|
||||
data: catalog
|
||||
}
|
||||
|
||||
await globalStore.saveTable(mydata)
|
||||
}
|
||||
|
||||
function generaListaLibri() {
|
||||
// chiedi prima "Sei sicuro di rigenerare il catalogo?"
|
||||
let risposta_si = false
|
||||
@@ -815,7 +868,7 @@ export default defineComponent({
|
||||
const filtroProductTypes = scheda.productTypes || [0];
|
||||
const filtroExcludeProductTypes = scheda.excludeproductTypes || [0];
|
||||
const filtroidTipologie = scheda.idTipologie || [];
|
||||
const filtroidTipoFormato = scheda.idTipoFormato || [];
|
||||
const filtroidTipoFormato = getidTipoFormatoDaFiltrare(scheda.idTipoFormato);
|
||||
const editore = getEditoreDaFiltrare(scheda.editore);
|
||||
const filtroPublishers = editore || [];
|
||||
const idCollane = getIdCollaneDaFiltrare(scheda.idCollane);
|
||||
@@ -1500,6 +1553,130 @@ export default defineComponent({
|
||||
addnewProd.value = true
|
||||
}
|
||||
|
||||
function toggleDebug() {
|
||||
optcatalogo.value.indebug = !optcatalogo.value.indebug
|
||||
}
|
||||
|
||||
const preparePDF = async () => {
|
||||
optcatalogo.value.generazionePDFInCorso = true
|
||||
optcatalogo.value.areadistampa!.scale = optcatalogo.value.areadistampa!.scale_printable
|
||||
}
|
||||
|
||||
const terminaPDF = async () => {
|
||||
optcatalogo.value.generazionePDFInCorso = false
|
||||
optcatalogo.value.areadistampa!.scale = 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const generatePDF = async () => {
|
||||
|
||||
await nextTick()
|
||||
|
||||
$q.dialog({
|
||||
message: 'Generare il PDF ?',
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: 'Generazione PDF'
|
||||
}).onOk(async () => {
|
||||
|
||||
|
||||
$q.loading.show({
|
||||
message: 'Caricamento immagini e generazione PDF in corso...'
|
||||
})
|
||||
|
||||
try {
|
||||
|
||||
let defaultMargin = 0.1
|
||||
if (optcatalogo.value.printable) {
|
||||
defaultMargin = 0
|
||||
} else {
|
||||
defaultMargin = 0
|
||||
}
|
||||
const unit = optcatalogo.value.areadistampa!.unit
|
||||
|
||||
let myformat = { ...optcatalogo.value.areadistampa!.format }
|
||||
|
||||
const scale = tools.getScale(optcatalogo.value)
|
||||
|
||||
const scalecanvas = optcatalogo.value.areadistampa!.scalecanvas
|
||||
|
||||
if (tools.isObject(myformat) && scale > 0) {
|
||||
} else {
|
||||
myformat = [210, 297]
|
||||
}
|
||||
|
||||
|
||||
const formatwidth = (myformat[0] * scale)
|
||||
const formatheight = (myformat[1] * scale)
|
||||
|
||||
let myfile = getPdfFilename()
|
||||
|
||||
myfile += '_' + formatwidth + '_' + formatheight + '_' + unit + '_scale_' + scale
|
||||
|
||||
myfile += '.pdf'
|
||||
|
||||
|
||||
const element = document.getElementById('pdf-content')
|
||||
const opt = {
|
||||
margin: [
|
||||
optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.top) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.left) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.bottom) || defaultMargin) : defaultMargin,
|
||||
optcatalogo.value.printable ? (parseFloat(optcatalogo.value.areadistampa!.margini?.right) || defaultMargin) : defaultMargin
|
||||
],
|
||||
filename: myfile,
|
||||
image: {
|
||||
type: 'jpeg',
|
||||
quality: 0.98
|
||||
},
|
||||
html2canvas: {
|
||||
scale: scalecanvas,
|
||||
useCORS: true,
|
||||
letterRendering: true,
|
||||
},
|
||||
jsPDF: {
|
||||
unit: unit,
|
||||
format: [formatwidth, formatheight],
|
||||
orientation: optcatalogo.value.areadistampa!.orientation,
|
||||
compress: optcatalogo.value.areadistampa!.compress,
|
||||
},
|
||||
enableLinks: true,
|
||||
pagebreak: { mode: 'avoid-all', before: '.card-page' }
|
||||
}
|
||||
|
||||
console.log('opt di stampa', opt)
|
||||
// a4: [595.28, 841.89]
|
||||
|
||||
await html2pdf().set(opt).from(element).save()
|
||||
|
||||
optcatalogo.value.generazionePDFInCorso = false
|
||||
optcatalogo.value.areadistampa!.scale = 1
|
||||
|
||||
$q.loading.hide()
|
||||
$q.notify({
|
||||
color: 'positive',
|
||||
message: 'PDF generato con successo!',
|
||||
icon: 'check'
|
||||
})
|
||||
} catch (error) {
|
||||
$q.loading.hide()
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
message: 'Errore nella generazione del PDF',
|
||||
icon: 'error'
|
||||
})
|
||||
console.error('Errore nella generazione del PDF:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
@@ -1571,6 +1748,9 @@ export default defineComponent({
|
||||
getCatalogoByMyPage,
|
||||
getReferentiCatalogo,
|
||||
reSortList,
|
||||
preparePDF, terminaPDF, toggleDebug,
|
||||
generatePDF,
|
||||
getPdfFilename,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
<q-btn
|
||||
v-if="!showListaArgomenti"
|
||||
rounded
|
||||
icon="fas fa-redo"
|
||||
label="Rigenera Lista"
|
||||
color="primary"
|
||||
@click="rigeneraLibri = true"
|
||||
@@ -220,6 +221,31 @@
|
||||
>
|
||||
</q-spinner-tail>
|
||||
</q-inner-loading>
|
||||
<div>
|
||||
<q-btn
|
||||
v-if="optcatalogo.pdf && !optcatalogo.generazionePDFInCorso"
|
||||
:label="`Prepara PDF`"
|
||||
@click="preparePDF"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="optcatalogo.generazionePDFInCorso"
|
||||
:label="`Termina Generazione`"
|
||||
@click="terminaPDF"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="optcatalogo.pdf && optcatalogo.generazionePDFInCorso"
|
||||
:label="`Genera PDF ` + getPdfFilename()"
|
||||
@click="generatePDF()"
|
||||
color="positive"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
label="Debug"
|
||||
@click="toggleDebug()"
|
||||
:push="optcatalogo.indebug"
|
||||
:color="optcatalogo.indebug ? `positive` : 'primary'"
|
||||
></q-btn>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div class="text-center">
|
||||
@@ -760,7 +786,6 @@
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
|
||||
<!--<div ref="pdfContent" class="pdf-content">-->
|
||||
</div>
|
||||
</q-page>
|
||||
<CMyDialog
|
||||
@@ -868,6 +893,14 @@
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-actions align="center">
|
||||
<q-btn
|
||||
rounded
|
||||
label="Rigenera"
|
||||
color="primary"
|
||||
icon="fas fa-redo"
|
||||
@click="generaListaLibri()"
|
||||
class="float-right"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
rounded
|
||||
label="Chiudi"
|
||||
@@ -875,13 +908,6 @@
|
||||
class="float-right"
|
||||
@click="rigeneraLibri = false"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
rounded
|
||||
label="Rigenera"
|
||||
color="primary"
|
||||
@click="generaListaLibri()"
|
||||
class="float-right"
|
||||
></q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</CMyDialog>
|
||||
|
||||
Reference in New Issue
Block a user