- generato lista libri, con possibilità di cambiare l'ordinamento dei libri o di cancellare libri.
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
.maximized-dialog-card {
|
||||||
|
max-width: 90%;
|
||||||
|
/* Larghezza massima del dialog */
|
||||||
|
max-height: 90%;
|
||||||
|
/* Altezza massima del dialog */
|
||||||
|
margin: auto;
|
||||||
|
/* Centra il dialog nello schermo */
|
||||||
|
border-radius: 16px;
|
||||||
|
/* Angoli arrotondati opzionali */
|
||||||
|
}
|
||||||
@@ -20,6 +20,11 @@ export default defineComponent({
|
|||||||
required: false,
|
required: false,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
class: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|||||||
@@ -1,25 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-dialog v-model="internalModel" maximized
|
<div :class="class">
|
||||||
transition-show="slide-up"
|
<q-dialog
|
||||||
transition-hide="slide-down"
|
v-model="internalModel"
|
||||||
>
|
maximized
|
||||||
<q-card class="dialog_card">
|
transition-show="slide-up"
|
||||||
<q-toolbar class="bg-primary text-white">
|
transition-hide="slide-down"
|
||||||
<q-toolbar-title>
|
>
|
||||||
{{ title }}
|
<q-card class="dialog_card maximized-dialog-card">
|
||||||
</q-toolbar-title>
|
<q-toolbar class="bg-primary text-white">
|
||||||
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
|
<q-toolbar-title>
|
||||||
</q-toolbar>
|
{{ title }}
|
||||||
|
</q-toolbar-title>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
color="white"
|
||||||
|
icon="close"
|
||||||
|
v-close-popup
|
||||||
|
></q-btn>
|
||||||
|
</q-toolbar>
|
||||||
|
|
||||||
<q-card-section class="inset-shadow">
|
<q-card-section class="inset-shadow">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" src="./CMyDialog.ts">
|
<script lang="ts" src="./CMyDialog.ts"></script>
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './CMyDialog';
|
@import './CMyDialog';
|
||||||
|
|||||||
@@ -368,174 +368,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
function addNewScheda() {
|
function addNewScheda() {
|
||||||
|
|
||||||
let maxorder = 0
|
Products.addNewScheda(myel.value.catalogo)
|
||||||
myel.value.catalogo!.arrSchede?.forEach(scheda => {
|
|
||||||
if (scheda?.order > maxorder) {
|
|
||||||
maxorder = scheda.order
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
let testodef: IText = {}
|
|
||||||
testodef = tools.resetIText(testodef)
|
|
||||||
|
|
||||||
const defaultDimensioniPag = tools.resetRecIDimensioni(null)
|
|
||||||
defaultDimensioniPag.size = {
|
|
||||||
width: '800px',
|
|
||||||
height: '600px',
|
|
||||||
}
|
|
||||||
defaultDimensioniPag.margini = {
|
|
||||||
top: '12px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
defaultDimensioniPag.padding = {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultDimensioniRiga = tools.resetRecIDimensioni(null)
|
|
||||||
|
|
||||||
defaultDimensioniRiga.size = {
|
|
||||||
width: '800px',
|
|
||||||
height: '300px',
|
|
||||||
}
|
|
||||||
defaultDimensioniRiga.margini = {
|
|
||||||
top: '40px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
defaultDimensioniRiga.padding = {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultSchedaProdotto = tools.resetRecIDimensioni(null)
|
|
||||||
|
|
||||||
defaultSchedaProdotto.size = {
|
|
||||||
width: '360px',
|
|
||||||
height: '230px',
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultSchedaProdotto.margini = {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultSchedaProdotto.padding = {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
}
|
|
||||||
|
|
||||||
const dimensioni: IElementiScheda = {
|
|
||||||
pagina: { dimensioni: defaultDimensioniPag, testo_down: testodef, testo_up: testodef, testo_title: testodef },
|
|
||||||
riga: defaultDimensioniRiga,
|
|
||||||
scheda_prodotto: defaultSchedaProdotto,
|
|
||||||
immagine_prodotto: {
|
|
||||||
size: {
|
|
||||||
width: '150px',
|
|
||||||
height: '235px',
|
|
||||||
},
|
|
||||||
margini: {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
},
|
|
||||||
padding: {
|
|
||||||
top: '0px',
|
|
||||||
bottom: '0px',
|
|
||||||
left: '0px',
|
|
||||||
right: '0px',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const newscheda: IMyScheda = {
|
|
||||||
_id: objectId(),
|
|
||||||
idapp: tools.appid()!,
|
|
||||||
isTemplate: false,
|
|
||||||
isPagIntro: false,
|
|
||||||
show_separatore: true,
|
|
||||||
name: 'Scheda Nuova',
|
|
||||||
dimensioni,
|
|
||||||
numschede_perRiga: 2,
|
|
||||||
numschede_perCol: 2,
|
|
||||||
testo_right_attaccato: {
|
|
||||||
contenuto: '',
|
|
||||||
maxlength: 0,
|
|
||||||
font: {
|
|
||||||
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
testo_right: {
|
|
||||||
contenuto: '',
|
|
||||||
maxlength: 0,
|
|
||||||
font: {
|
|
||||||
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
testo_bottom: {
|
|
||||||
contenuto: '',
|
|
||||||
maxlength: 0,
|
|
||||||
font: {
|
|
||||||
posiz_text: costanti.POSIZ_TESTO.IN_BASSO,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
barcode: {
|
|
||||||
show: false,
|
|
||||||
format: '',
|
|
||||||
size: {
|
|
||||||
width: '2',
|
|
||||||
height: '100',
|
|
||||||
},
|
|
||||||
font: {
|
|
||||||
name: 'monospace',
|
|
||||||
size: '16px',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
productTypes: [],
|
|
||||||
excludeproductTypes: [],
|
|
||||||
editore: [],
|
|
||||||
argomenti: [],
|
|
||||||
author: '',
|
|
||||||
sort_field: '',
|
|
||||||
sort_dir: 0,
|
|
||||||
arrProdottiSpeciali: [],
|
|
||||||
etichette: {
|
|
||||||
novita: {
|
|
||||||
show: false,
|
|
||||||
months: 6,
|
|
||||||
},
|
|
||||||
bestseller: {
|
|
||||||
show: false,
|
|
||||||
primiNInClassifica: 20
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!myel.value.catalogo!.arrSchede)
|
|
||||||
myel.value.catalogo!.arrSchede = []
|
|
||||||
|
|
||||||
myel.value.catalogo!.arrSchede.push(
|
|
||||||
{
|
|
||||||
_id: objectId(),
|
|
||||||
scheda: newscheda,
|
|
||||||
order: maxorder + 10,
|
|
||||||
numPagineMax: 0,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
// console.log('arrschede', myel.value.catalogo!.arrSchede)
|
|
||||||
|
|
||||||
modifElem()
|
modifElem()
|
||||||
|
|
||||||
|
|||||||
@@ -1463,6 +1463,7 @@
|
|||||||
@click="addNewScheda"
|
@click="addNewScheda"
|
||||||
>
|
>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-for="(recscheda, ind) in myel.catalogo.arrSchede"
|
v-for="(recscheda, ind) in myel.catalogo.arrSchede"
|
||||||
:key="recscheda._id"
|
:key="recscheda._id"
|
||||||
@@ -1470,6 +1471,41 @@
|
|||||||
dense
|
dense
|
||||||
:label="`${ind}. ` + recscheda.scheda.name ? recscheda.scheda.name : `Scheda ` + (ind + 1)"
|
:label="`${ind}. ` + recscheda.scheda.name ? recscheda.scheda.name : `Scheda ` + (ind + 1)"
|
||||||
>
|
>
|
||||||
|
<div class="row">
|
||||||
|
<q-select
|
||||||
|
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||||
|
v-if="enableEdit"
|
||||||
|
rounded
|
||||||
|
outlined
|
||||||
|
v-model="recscheda.scheda.linkIdTemplate"
|
||||||
|
:options="globalStore.getSchedeOpt('SEARCH_')"
|
||||||
|
@update:model-value="modifElem"
|
||||||
|
label="Scheda collegata:"
|
||||||
|
style="width: 250px"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
>
|
||||||
|
</q-select>
|
||||||
|
|
||||||
|
<q-toggle
|
||||||
|
v-model="recscheda.scheda.isTemplate"
|
||||||
|
color="positive"
|
||||||
|
icon="fas fa-file-pdf"
|
||||||
|
label="E' un template"
|
||||||
|
@update:model-value="modifElem"
|
||||||
|
>
|
||||||
|
</q-toggle>
|
||||||
|
<q-input
|
||||||
|
label="Nome Template"
|
||||||
|
@update:model-value="modifElem"
|
||||||
|
v-model="recscheda.scheda.name"
|
||||||
|
filled
|
||||||
|
debounce="1000"
|
||||||
|
v-on:keyup.enter="saveElem"
|
||||||
|
>
|
||||||
|
</q-input>
|
||||||
|
</div>
|
||||||
|
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
dense
|
dense
|
||||||
dense-toggle
|
dense-toggle
|
||||||
|
|||||||
@@ -21,6 +21,11 @@ export default defineComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
showvalue: {
|
||||||
|
type: Boolean,
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
min: {
|
min: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<q-badge color="primary"> {{ label }} <span v-if="modelValue">{{ modelValue }}</span> </q-badge>
|
<q-badge class="q-mx-sm" color="primary"> {{ label }} <span v-if="modelValue && showvalue"> ({{ modelValue }})</span> </q-badge>
|
||||||
<div class="q-pa-xs row no-wrap">
|
<div class="q-pa-xs row no-wrap">
|
||||||
<q-btn
|
<q-btn
|
||||||
icon="fas fa-minus"
|
icon="fas fa-minus"
|
||||||
|
|||||||
@@ -5,13 +5,21 @@ import { tools } from '@tools'
|
|||||||
|
|
||||||
import { useGlobalStore } from '@src/store/globalStore'
|
import { useGlobalStore } from '@src/store/globalStore'
|
||||||
|
|
||||||
|
import { CSearchProduct } from '@src/components/CSearchProduct'
|
||||||
|
import { CMyDialog } from '@src/components/CMyDialog'
|
||||||
|
|
||||||
import { costanti } from '@costanti'
|
import { costanti } from '@costanti'
|
||||||
import { IAuthor, ICatProd } from "app/src/model";
|
import { IAuthor, ICatProd } from "app/src/model";
|
||||||
|
|
||||||
|
import type {
|
||||||
|
IProduct
|
||||||
|
} from '@src/model';
|
||||||
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "CProductTable",
|
name: "CProductTable",
|
||||||
components: {
|
components: {
|
||||||
draggable,
|
draggable, CSearchProduct, CMyDialog,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
lista_prodotti: {
|
lista_prodotti: {
|
||||||
@@ -26,6 +34,9 @@ export default defineComponent({
|
|||||||
|
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
|
|
||||||
|
const showProd = ref(false)
|
||||||
|
const selProd = ref(<IProduct>{})
|
||||||
|
|
||||||
async function mounted() {
|
async function mounted() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -40,20 +51,28 @@ export default defineComponent({
|
|||||||
|
|
||||||
// Colonne della tabella
|
// Colonne della tabella
|
||||||
const allColumns = [
|
const allColumns = [
|
||||||
{ name: "drag", label: "", field: "", align: "left", style: "width: 50px" },
|
{ name: "drag", label: "Ordinamento", field: "", align: "left", style: "width: 50px" },
|
||||||
{ name: "image", label: "Immagine", field: "image", align: "center" },
|
{ name: "image", label: "Copertina", field: "image", align: "center" },
|
||||||
{ name: "title", label: "Titolo", field: "title", align: "left" },
|
{ name: "name", label: "Titolo", field: "name", align: "left" },
|
||||||
{ name: "author", label: "Autore", field: "author", align: "left" },
|
{ name: "authors", label: "Autore", field: "authors", align: "left" },
|
||||||
{ name: "topic", label: "Argomento", field: "topic", align: "left" },
|
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
|
||||||
|
{ name: "quantity", label: "Disponibilità", field: "quantity", align: "left" },
|
||||||
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" },
|
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" },
|
||||||
{ name: "actions", label: "Azioni", field: "", align: "center" },
|
{ name: "actions", label: "Azioni", field: "", align: "center" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const selectedColumns = ref(
|
let cookieValue: string | null = null;
|
||||||
tools.getCookie("selColCat")
|
try {
|
||||||
? JSON.parse(tools.getCookie("selColCat"))
|
cookieValue = tools.getCookie("selColCat");
|
||||||
: ["drag", "image", "name", "authors", "catprods", "isbn", "actions"] // Valori di default
|
// Se il cookie esiste e contiene una stringa JSON valida
|
||||||
)
|
cookieValue = cookieValue ? cookieValue : [];
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Errore durante la lettura del cookie 'selColCat'", error);
|
||||||
|
cookieValue = []; // In caso di errore, inizializza come array vuoto
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedColumns = ref(cookieValue.length > 0 ? cookieValue : ["drag", "image", "name", "authors", "catprods", "isbn", "actions"]);
|
||||||
|
|
||||||
|
|
||||||
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
||||||
const isColumnVisible = (column) => {
|
const isColumnVisible = (column) => {
|
||||||
@@ -96,7 +115,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
function formatCatProds(catprods: ICatProd[] | undefined | null): string {
|
function formatCatProds(catprods: ICatProd[] | undefined | null): string {
|
||||||
if (!catprods || !Array.isArray(catprods)) {
|
if (!catprods || !Array.isArray(catprods)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Estrai il nome e il cognome di ogni autore e uniscili con ', '
|
// Estrai il nome e il cognome di ogni autore e uniscili con ', '
|
||||||
@@ -110,10 +129,16 @@ export default defineComponent({
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const savedColumns = tools.getCookie("selColCat");
|
const savedColumns = tools.getCookie("selColCat");
|
||||||
if (savedColumns) {
|
if (savedColumns) {
|
||||||
selectedColumns.value = JSON.parse(savedColumns);
|
selectedColumns.value = savedColumns;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showProduct(element: any) {
|
||||||
|
selProd.value = element
|
||||||
|
|
||||||
|
showProd.value = true
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
allColumns,
|
allColumns,
|
||||||
selectedColumns,
|
selectedColumns,
|
||||||
@@ -126,6 +151,9 @@ export default defineComponent({
|
|||||||
globalStore,
|
globalStore,
|
||||||
costanti,
|
costanti,
|
||||||
onDragEnd,
|
onDragEnd,
|
||||||
|
showProduct,
|
||||||
|
showProd,
|
||||||
|
selProd,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
multiple
|
multiple
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
option-value="name"
|
||||||
|
option-label="label"
|
||||||
filled
|
filled
|
||||||
style="max-width: 400px"
|
style="max-width: 400px"
|
||||||
/>
|
/>
|
||||||
@@ -19,13 +21,14 @@
|
|||||||
<!-- Intestazioni (Thead) -->
|
<!-- Intestazioni (Thead) -->
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th v-if="isColumnVisible('drag')">Drag</th>
|
<template v-for="col in allColumns">
|
||||||
<th v-if="isColumnVisible('image')">Immagine</th>
|
<th
|
||||||
<th v-if="isColumnVisible('name')">Nome</th>
|
v-if="isColumnVisible(col.name)"
|
||||||
<th v-if="isColumnVisible('authors')">Autore</th>
|
:key="col.name"
|
||||||
<th v-if="isColumnVisible('catprods')">Argomento</th>
|
>
|
||||||
<th v-if="isColumnVisible('isbn')">ISBN</th>
|
{{ col.label }}
|
||||||
<th v-if="isColumnVisible('actions')">Azioni</th>
|
</th>
|
||||||
|
</template>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<!-- Corpo della Tabella (Tbody) -->
|
<!-- Corpo della Tabella (Tbody) -->
|
||||||
@@ -39,8 +42,15 @@
|
|||||||
<template #item="{ element }">
|
<template #item="{ element }">
|
||||||
<tr :key="element._id">
|
<tr :key="element._id">
|
||||||
<!-- Icona Drag Handle -->
|
<!-- Icona Drag Handle -->
|
||||||
<td v-if="isColumnVisible('drag')" class="drag-handle">
|
<td
|
||||||
<q-icon name="drag_handle" size="32px" color="primary" />
|
v-if="isColumnVisible('drag')"
|
||||||
|
class="drag-handle"
|
||||||
|
>
|
||||||
|
<q-icon
|
||||||
|
name="drag_handle"
|
||||||
|
size="32px"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Immagine Piccola -->
|
<!-- Immagine Piccola -->
|
||||||
@@ -52,7 +62,8 @@
|
|||||||
: element.productInfo?.image_link
|
: element.productInfo?.image_link
|
||||||
"
|
"
|
||||||
style="width: 50px; height: 50px"
|
style="width: 50px; height: 50px"
|
||||||
class="rounded-borders"
|
class="rounded-borders cursor-pointer"
|
||||||
|
@click="showProduct(element)"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@@ -65,14 +76,25 @@
|
|||||||
<!-- Argomento -->
|
<!-- Argomento -->
|
||||||
<td v-if="isColumnVisible('catprods')">{{ formatCatProds(element.productInfo?.catprods) }}</td>
|
<td v-if="isColumnVisible('catprods')">{{ formatCatProds(element.productInfo?.catprods) }}</td>
|
||||||
|
|
||||||
|
<!-- Quantità -->
|
||||||
|
<td v-if="isColumnVisible('quantity')">{{ element.arrvariazioni[0].quantita }}</td>
|
||||||
|
|
||||||
<!-- ISBN -->
|
<!-- ISBN -->
|
||||||
<td v-if="isColumnVisible('isbn')">{{ element.isbn }}</td>
|
<td v-if="isColumnVisible('isbn')">{{ element.isbn }}</td>
|
||||||
|
|
||||||
<!-- Azioni -->
|
<!-- Azioni -->
|
||||||
<td v-if="isColumnVisible('actions')">
|
<td v-if="isColumnVisible('actions')">
|
||||||
<q-btn-dropdown label="Azioni" color="primary" flat>
|
<q-btn-dropdown
|
||||||
|
label="Azioni"
|
||||||
|
color="primary"
|
||||||
|
flat
|
||||||
|
>
|
||||||
<q-list>
|
<q-list>
|
||||||
<q-item clickable v-close-popup @click="removeProduct(element)">
|
<q-item
|
||||||
|
clickable
|
||||||
|
v-close-popup
|
||||||
|
@click="removeProduct(element)"
|
||||||
|
>
|
||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>Elimina</q-item-label>
|
<q-item-label>Elimina</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
@@ -85,9 +107,15 @@
|
|||||||
</draggable>
|
</draggable>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<CMyDialog
|
||||||
|
v-model="showProd"
|
||||||
|
title="Prodotto"
|
||||||
|
class="q-ma-md"
|
||||||
|
>
|
||||||
|
<CSearchProduct v-if="selProd" :idprodtoshow="selProd._id" nameLinkTemplate="SEARCH_Prima"> </CSearchProduct>
|
||||||
|
</CMyDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<script lang="ts" src="./CProductTable.ts"></script>
|
<script lang="ts" src="./CProductTable.ts"></script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './CProductTable.scss';
|
@import './CProductTable.scss';
|
||||||
|
|||||||
@@ -32,7 +32,18 @@ export default defineComponent({
|
|||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object as PropType<IOptCatalogo>,
|
type: Object as PropType<IOptCatalogo>,
|
||||||
required: true,
|
required: false,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
idprodtoshow: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default : '',
|
||||||
|
},
|
||||||
|
nameLinkTemplate: {
|
||||||
|
type: String,
|
||||||
|
required: false,
|
||||||
|
default : '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
@@ -101,10 +112,12 @@ export default defineComponent({
|
|||||||
|
|
||||||
console.log('myproduct.value', myproduct.value)
|
console.log('myproduct.value', myproduct.value)
|
||||||
|
|
||||||
if (myproduct.value) {
|
if (!props.idprodtoshow) {
|
||||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, myproduct.value._id.toString())
|
if (myproduct.value) {
|
||||||
} else {
|
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, myproduct.value._id.toString())
|
||||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
} else {
|
||||||
|
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -123,18 +136,57 @@ export default defineComponent({
|
|||||||
return lista && lista.value && lista.value._id ? lista.value._id : ''
|
return lista && lista.value && lista.value._id ? lista.value._id : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function populateDataWithlinkIdTemplate() {
|
||||||
|
console.log('populateDataWithlinkIdTemplate')
|
||||||
|
|
||||||
|
if (optcatalogo.value) {
|
||||||
|
|
||||||
|
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||||
|
if (recscheda.scheda?.linkIdTemplate) {
|
||||||
|
// ricopia da Template:
|
||||||
|
const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda)
|
||||||
|
if (myscheda) {
|
||||||
|
recscheda.scheda = { ...myscheda }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(' FINE - populateDataWithlinkIdTemplate')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function mounted() {
|
async function mounted() {
|
||||||
// console.log('mounted Catalogo')
|
// console.log('mounted Catalogo')
|
||||||
|
|
||||||
optcatalogo.value = props.modelValue
|
if (props.modelValue) {
|
||||||
loadpage.value = false
|
optcatalogo.value = props.modelValue
|
||||||
|
} else {
|
||||||
|
optcatalogo.value = globalStore.createCatalogoVuoto()
|
||||||
|
productStore.addNewScheda(optcatalogo.value)
|
||||||
|
|
||||||
const id = tools.getCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
if (props.nameLinkTemplate) {
|
||||||
|
const linkIdTemplate = globalStore.getLinkIdTemplateByName(props.nameLinkTemplate)
|
||||||
|
optcatalogo.value.arrSchede[0].scheda.linkIdTemplate = linkIdTemplate
|
||||||
|
} else {
|
||||||
|
optcatalogo.value.arrSchede[0].scheda.name = 'SEARCH_NEW'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const id = props.idprodtoshow || tools.getCookie(tools.COOK_LAST_PROD_SEARCH, '')
|
||||||
|
|
||||||
|
if (props.nameLinkTemplate) {
|
||||||
|
populateDataWithlinkIdTemplate()
|
||||||
|
}
|
||||||
|
|
||||||
|
loadpage.value = false
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
await loadProduct(id)
|
await loadProduct(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mycolumns.value = fieldsTable.getArrColsByTable('products')
|
mycolumns.value = fieldsTable.getArrColsByTable('products')
|
||||||
|
|
||||||
searchList.value = [
|
searchList.value = [
|
||||||
|
|||||||
@@ -493,7 +493,7 @@ export interface IGlobalState {
|
|||||||
gallery: IGallery[],
|
gallery: IGallery[],
|
||||||
mypage: IMyPage[],
|
mypage: IMyPage[],
|
||||||
myelems: IMyElem[],
|
myelems: IMyElem[],
|
||||||
myschedas: IMyScheda[],
|
myschedas: ISchedaSingola[],
|
||||||
templemail: ITemplEmail[],
|
templemail: ITemplEmail[],
|
||||||
opzemail: ISettings[],
|
opzemail: ISettings[],
|
||||||
mailinglist: IMailinglist[],
|
mailinglist: IMailinglist[],
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda } from 'model'
|
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda } from 'model'
|
||||||
|
|
||||||
import { Api } from '@api'
|
import { Api } from '@api'
|
||||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||||
@@ -12,6 +12,9 @@ import { toolsext } from '@store/Modules/toolsext'
|
|||||||
import { useGlobalStore } from './globalStore'
|
import { useGlobalStore } from './globalStore'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
import objectId from '@src/js/objectId'
|
||||||
|
import { costanti } from '@costanti'
|
||||||
|
|
||||||
import translate from '@src/globalroutines/util'
|
import translate from '@src/globalroutines/util'
|
||||||
import { useCatalogStore } from './CatalogStore'
|
import { useCatalogStore } from './CatalogStore'
|
||||||
|
|
||||||
@@ -163,7 +166,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
mystr = ' - '
|
mystr = ' - '
|
||||||
mystr += myarrcat.name
|
mystr += myarrcat.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mystr
|
return mystr
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1529,7 +1532,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getSchedeOpt(arrschede: IMyScheda[]): any[] {
|
getSchedeOpt(arrschede: ISchedaSingola[], tag?: string): any[] {
|
||||||
|
|
||||||
let arr: any = []
|
let arr: any = []
|
||||||
|
|
||||||
@@ -1547,7 +1550,9 @@ export const useProducts = defineStore('Products', {
|
|||||||
pagename = '[Pag: ' + pagename + '] '
|
pagename = '[Pag: ' + pagename + '] '
|
||||||
|
|
||||||
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
|
const mylabel = pagename + (recscheda.scheda ? recscheda.scheda!.name : '')
|
||||||
arr.push({ label: mylabel, value: recscheda.scheda!._id })
|
if (!tag || mylabel.startsWith(tag)) {
|
||||||
|
arr.push({ label: mylabel, value: recscheda.scheda!._id })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1556,6 +1561,178 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addNewScheda(catalogo: IOptCatalogo) {
|
||||||
|
|
||||||
|
let maxorder = 0
|
||||||
|
catalogo!.arrSchede?.forEach(scheda => {
|
||||||
|
if (scheda?.order > maxorder) {
|
||||||
|
maxorder = scheda.order
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
let testodef: IText = {}
|
||||||
|
testodef = tools.resetIText(testodef)
|
||||||
|
|
||||||
|
const defaultDimensioniPag = tools.resetRecIDimensioni(null)
|
||||||
|
defaultDimensioniPag.size = {
|
||||||
|
width: '800px',
|
||||||
|
height: '600px',
|
||||||
|
}
|
||||||
|
defaultDimensioniPag.margini = {
|
||||||
|
top: '12px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
defaultDimensioniPag.padding = {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultDimensioniRiga = tools.resetRecIDimensioni(null)
|
||||||
|
|
||||||
|
defaultDimensioniRiga.size = {
|
||||||
|
width: '800px',
|
||||||
|
height: '300px',
|
||||||
|
}
|
||||||
|
defaultDimensioniRiga.margini = {
|
||||||
|
top: '40px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
defaultDimensioniRiga.padding = {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultSchedaProdotto = tools.resetRecIDimensioni(null)
|
||||||
|
|
||||||
|
defaultSchedaProdotto.size = {
|
||||||
|
width: '360px',
|
||||||
|
height: '230px',
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultSchedaProdotto.margini = {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultSchedaProdotto.padding = {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
}
|
||||||
|
|
||||||
|
const dimensioni: IElementiScheda = {
|
||||||
|
pagina: { dimensioni: defaultDimensioniPag, testo_down: testodef, testo_up: testodef, testo_title: testodef },
|
||||||
|
riga: defaultDimensioniRiga,
|
||||||
|
scheda_prodotto: defaultSchedaProdotto,
|
||||||
|
immagine_prodotto: {
|
||||||
|
size: {
|
||||||
|
width: '150px',
|
||||||
|
height: '235px',
|
||||||
|
},
|
||||||
|
margini: {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
},
|
||||||
|
padding: {
|
||||||
|
top: '0px',
|
||||||
|
bottom: '0px',
|
||||||
|
left: '0px',
|
||||||
|
right: '0px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const newscheda: IMyScheda = {
|
||||||
|
_id: objectId(),
|
||||||
|
idapp: tools.appid()!,
|
||||||
|
isTemplate: false,
|
||||||
|
isPagIntro: false,
|
||||||
|
show_separatore: true,
|
||||||
|
name: 'Scheda Nuova',
|
||||||
|
dimensioni,
|
||||||
|
numschede_perRiga: 2,
|
||||||
|
numschede_perCol: 2,
|
||||||
|
testo_right_attaccato: {
|
||||||
|
contenuto: '',
|
||||||
|
maxlength: 0,
|
||||||
|
font: {
|
||||||
|
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
testo_right: {
|
||||||
|
contenuto: '',
|
||||||
|
maxlength: 0,
|
||||||
|
font: {
|
||||||
|
posiz_text: costanti.POSIZ_TESTO.A_DESTRA,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
testo_bottom: {
|
||||||
|
contenuto: '',
|
||||||
|
maxlength: 0,
|
||||||
|
font: {
|
||||||
|
posiz_text: costanti.POSIZ_TESTO.IN_BASSO,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
barcode: {
|
||||||
|
show: false,
|
||||||
|
format: '',
|
||||||
|
size: {
|
||||||
|
width: '2',
|
||||||
|
height: '100',
|
||||||
|
},
|
||||||
|
font: {
|
||||||
|
name: 'monospace',
|
||||||
|
size: '16px',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
productTypes: [],
|
||||||
|
excludeproductTypes: [],
|
||||||
|
editore: [],
|
||||||
|
argomenti: [],
|
||||||
|
author: '',
|
||||||
|
sort_field: '',
|
||||||
|
sort_dir: 0,
|
||||||
|
arrProdottiSpeciali: [],
|
||||||
|
etichette: {
|
||||||
|
novita: {
|
||||||
|
show: false,
|
||||||
|
months: 6,
|
||||||
|
},
|
||||||
|
bestseller: {
|
||||||
|
show: false,
|
||||||
|
primiNInClassifica: 20
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!catalogo!.arrSchede)
|
||||||
|
catalogo!.arrSchede = []
|
||||||
|
|
||||||
|
catalogo!.arrSchede.push(
|
||||||
|
{
|
||||||
|
_id: objectId(),
|
||||||
|
scheda: newscheda,
|
||||||
|
order: maxorder + 10,
|
||||||
|
numPagineMax: 0,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import type {
|
|||||||
IStatusSkill,
|
IStatusSkill,
|
||||||
StateConnection,
|
StateConnection,
|
||||||
ISchedaSingola,
|
ISchedaSingola,
|
||||||
IOptQueryGM
|
IOptQueryGM,
|
||||||
|
IOptCatalogo
|
||||||
} from '@model';
|
} from '@model';
|
||||||
import {
|
import {
|
||||||
ICity, IMySkill,
|
ICity, IMySkill,
|
||||||
@@ -211,6 +212,31 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
|
|
||||||
|
sovrascriviSchedaFromTemplate: (state: IGlobalState) => (idTemplate: string, origScheda: ISchedaSingola) => {
|
||||||
|
|
||||||
|
const arrschede: ISchedaSingola[] = state.myschedas
|
||||||
|
const myfindscheda = arrschede.find((recscheda: ISchedaSingola) => recscheda.scheda?._id === idTemplate)
|
||||||
|
|
||||||
|
const linkIdTemplate = origScheda.scheda?.linkIdTemplate
|
||||||
|
const precname = origScheda.scheda?.name
|
||||||
|
|
||||||
|
if (myfindscheda) {
|
||||||
|
const myschedatocopy = tools.jsonCopy(myfindscheda)
|
||||||
|
|
||||||
|
if (myschedatocopy) {
|
||||||
|
myschedatocopy.scheda._id = origScheda.scheda?._id
|
||||||
|
myschedatocopy.scheda.isTemplate = false
|
||||||
|
myschedatocopy.scheda.name = precname
|
||||||
|
myschedatocopy.scheda.linkIdTemplate = linkIdTemplate
|
||||||
|
|
||||||
|
return myschedatocopy.scheda
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
},
|
||||||
|
|
||||||
// conta: (state: IGlobalState) => { state.conta },
|
// conta: (state: IGlobalState) => { state.conta },
|
||||||
// listatodo: (state: IGlobalState) => { state.listatodo },
|
// listatodo: (state: IGlobalState) => { state.listatodo },
|
||||||
// category: (state: IGlobalState) => { state.category },
|
// category: (state: IGlobalState) => { state.category },
|
||||||
@@ -258,10 +284,22 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
|
||||||
getSchedeOpt: (state: IGlobalState) => {
|
getSchedeOpt: (state: IGlobalState) => (tag?: string) => {
|
||||||
const Products = useProducts()
|
const Products = useProducts()
|
||||||
|
|
||||||
return Products.getSchedeOpt(state.myschedas)
|
return Products.getSchedeOpt(state.myschedas, tag)
|
||||||
|
},
|
||||||
|
|
||||||
|
getLinkIdTemplateByName: (state: IGlobalState) => (name: string) => {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const myrecscheda = state.myschedas.find((recscheda: ISchedaSingola) => recscheda.scheda.name === name)
|
||||||
|
|
||||||
|
return myrecscheda.scheda._id
|
||||||
|
} catch (error) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isMyLang: (state: IGlobalState) => (rec: any) => {
|
isMyLang: (state: IGlobalState) => (rec: any) => {
|
||||||
@@ -2393,6 +2431,21 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createCatalogoVuoto(): IOptCatalogo {
|
||||||
|
return {
|
||||||
|
productTypes: [0],
|
||||||
|
excludeproductTypes: [],
|
||||||
|
formato: [],
|
||||||
|
Categoria: [],
|
||||||
|
editore: [],
|
||||||
|
pdf: false,
|
||||||
|
dimensioni_def: {
|
||||||
|
pagina: tools.resetRecIDimensioni(null)
|
||||||
|
},
|
||||||
|
areadistampa: tools.resetRecIAreaDiStampa(null),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async prepareAddNewElem(order: any, $q: any, t: any, myelem: any, newtype: any) {
|
async prepareAddNewElem(order: any, $q: any, t: any, myelem: any, newtype: any) {
|
||||||
|
|
||||||
const newrec: IMyElem = {
|
const newrec: IMyElem = {
|
||||||
@@ -2411,30 +2464,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
} else if (newrec.type === shared_consts.ELEMTYPE.CARD) {
|
} else if (newrec.type === shared_consts.ELEMTYPE.CARD) {
|
||||||
newrec.class2 = 'row justify-center'
|
newrec.class2 = 'row justify-center'
|
||||||
} else if (newrec.type === shared_consts.ELEMTYPE.SEARCHPRODUCT) {
|
} else if (newrec.type === shared_consts.ELEMTYPE.SEARCHPRODUCT) {
|
||||||
newrec.catalogo = {
|
|
||||||
productTypes: [0],
|
newrec.catalogo = this.createCatalogoVuoto()
|
||||||
excludeproductTypes: [],
|
|
||||||
formato: [],
|
|
||||||
Categoria: [],
|
|
||||||
editore: [],
|
|
||||||
pdf: false,
|
|
||||||
dimensioni_def: {
|
|
||||||
pagina: tools.resetRecIDimensioni(null)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
} else if (newrec.type === shared_consts.ELEMTYPE.CATALOGO) {
|
} else if (newrec.type === shared_consts.ELEMTYPE.CATALOGO) {
|
||||||
newrec.catalogo = {
|
newrec.catalogo = this.createCatalogoVuoto()
|
||||||
//++AddCATALOGO_FIELDS
|
|
||||||
productTypes: [0],
|
|
||||||
excludeproductTypes: [],
|
|
||||||
formato: [],
|
|
||||||
Categoria: [],
|
|
||||||
editore: [],
|
|
||||||
pdf: false,
|
|
||||||
dimensioni_def: {
|
|
||||||
pagina: tools.resetRecIDimensioni(null)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mynewrec = await this.addNewElem($q, t, newrec)
|
const mynewrec = await this.addNewElem($q, t, newrec)
|
||||||
|
|||||||
@@ -410,33 +410,6 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sovrascriviSchedaFromTemplate(idTemplate: string, origScheda: ISchedaSingola) {
|
|
||||||
if (!optcatalogo.value)
|
|
||||||
return
|
|
||||||
|
|
||||||
const arrschede: ISchedaSingola[] = globalStore.getMySchede()
|
|
||||||
const myfindscheda = arrschede.find((recscheda: ISchedaSingola) => recscheda.scheda?._id === idTemplate)
|
|
||||||
|
|
||||||
const mynewscheda = tools.jsonCopy(origScheda)
|
|
||||||
|
|
||||||
const linkIdTemplate = origScheda.scheda?.linkIdTemplate
|
|
||||||
const precname = origScheda.scheda?.name
|
|
||||||
|
|
||||||
if (myfindscheda) {
|
|
||||||
const myschedatocopy = tools.jsonCopy(myfindscheda)
|
|
||||||
|
|
||||||
if (myschedatocopy) {
|
|
||||||
myschedatocopy.scheda._id = origScheda.scheda?._id
|
|
||||||
myschedatocopy.scheda.isTemplate = false
|
|
||||||
myschedatocopy.scheda.name = precname
|
|
||||||
myschedatocopy.scheda.linkIdTemplate = linkIdTemplate
|
|
||||||
|
|
||||||
return myschedatocopy.scheda
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateDataWithlinkIdTemplate() {
|
function populateDataWithlinkIdTemplate() {
|
||||||
// console.log('populateDataWithlinkIdTemplate')
|
// console.log('populateDataWithlinkIdTemplate')
|
||||||
@@ -446,15 +419,14 @@ export default defineComponent({
|
|||||||
for (const recscheda of optcatalogo.value.arrSchede!) {
|
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||||
if (recscheda.scheda?.linkIdTemplate) {
|
if (recscheda.scheda?.linkIdTemplate) {
|
||||||
// ricopia da Template:
|
// ricopia da Template:
|
||||||
const myscheda = sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda)
|
const myscheda = globalStore.sovrascriviSchedaFromTemplate(recscheda.scheda?.linkIdTemplate, recscheda)
|
||||||
if (myscheda) {
|
if (myscheda) {
|
||||||
recscheda.scheda = myscheda
|
recscheda.scheda = { ...myscheda }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(' FINE - populateDataWithlinkIdTemplate')
|
// console.log(' FINE - populateDataWithlinkIdTemplate')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,12 +558,12 @@ export default defineComponent({
|
|||||||
// Se nel catalogo è stato già generato, allora gli passo quello.
|
// Se nel catalogo è stato già generato, allora gli passo quello.
|
||||||
const trovatocatalogo = getCatalogoByMyPage.value
|
const trovatocatalogo = getCatalogoByMyPage.value
|
||||||
|
|
||||||
if (trovatocatalogo.lista_prodotti.length === 0) {
|
if (trovatocatalogo?.lista_prodotti.length === 0) {
|
||||||
generalista = true
|
generalista = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!generalista && (trovatocatalogo.lista_prodotti.length > 0)) {
|
if (!generalista && (trovatocatalogo?.lista_prodotti.length > 0)) {
|
||||||
arrprod = trovatocatalogo.lista_prodotti
|
arrprod = trovatocatalogo?.lista_prodotti
|
||||||
} else {
|
} else {
|
||||||
arrprod = productStore.getProducts(cosa.value)
|
arrprod = productStore.getProducts(cosa.value)
|
||||||
arrprod = filterProducts(
|
arrprod = filterProducts(
|
||||||
@@ -615,7 +587,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
arrProducts.value = arrprod;
|
arrProducts.value = arrprod;
|
||||||
|
|
||||||
console.log('arrprod', arrprod)
|
// console.log('arrprod', arrprod)
|
||||||
|
|
||||||
populateDataWithlinkIdTemplate();
|
populateDataWithlinkIdTemplate();
|
||||||
generatearrProdToViewSorted(!generalista, salva);
|
generatearrProdToViewSorted(!generalista, salva);
|
||||||
@@ -625,7 +597,17 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generaListaLibri() {
|
function generaListaLibri() {
|
||||||
calcArrProducts(true)
|
// chiedi prima "Sei sicuro di rigenerare il catalogo?"
|
||||||
|
let risposta_si = false
|
||||||
|
|
||||||
|
$q.dialog({
|
||||||
|
title: 'Genera catalogo',
|
||||||
|
message: 'Sei sicuro di rigenerare il catalogo?',
|
||||||
|
cancel: true,
|
||||||
|
persistent: true
|
||||||
|
}).onOk(() => {
|
||||||
|
calcArrProducts(true)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProductsFilteredByScheda(scheda: IMyScheda): IProduct[] {
|
function getProductsFilteredByScheda(scheda: IMyScheda): IProduct[] {
|
||||||
@@ -644,8 +626,8 @@ export default defineComponent({
|
|||||||
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
|
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
|
||||||
|
|
||||||
const trovatocatalogo = getCatalogoByMyPage.value
|
const trovatocatalogo = getCatalogoByMyPage.value
|
||||||
if (trovatocatalogo.lista_prodotti.length > 0) {
|
if (trovatocatalogo?.lista_prodotti.length > 0) {
|
||||||
arrprod = trovatocatalogo.lista_prodotti
|
arrprod = trovatocatalogo?.lista_prodotti
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
arrprod = filterProducts(
|
arrprod = filterProducts(
|
||||||
@@ -754,7 +736,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
let arrGeneraleProdotti = []
|
let arrGeneraleProdotti = []
|
||||||
|
|
||||||
if (usaprodottiSalvati) {
|
if (usaprodottiSalvati && trovatocatalogo?.lista_prodotti.length > 0) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
arrGeneraleProdotti = arrProducts.value;
|
arrGeneraleProdotti = arrProducts.value;
|
||||||
@@ -775,8 +757,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
let arrProdFiltrati: IProduct[] = []
|
let arrProdFiltrati: IProduct[] = []
|
||||||
|
|
||||||
if (usaprodottiSalvati && trovatocatalogo.lista_prodotti.length > 0) {
|
if (usaprodottiSalvati && trovatocatalogo?.lista_prodotti.length > 0) {
|
||||||
arrProdFiltrati = trovatocatalogo.lista_prodotti
|
arrProdFiltrati = trovatocatalogo?.lista_prodotti
|
||||||
} else {
|
} else {
|
||||||
if (recscheda.scheda.productTypes!.length > 0) {
|
if (recscheda.scheda.productTypes!.length > 0) {
|
||||||
// Filtra i prodotti in base ai filtri impostati !
|
// Filtra i prodotti in base ai filtri impostati !
|
||||||
@@ -860,9 +842,11 @@ export default defineComponent({
|
|||||||
|
|
||||||
|
|
||||||
if (!usaprodottiSalvati && salva) {
|
if (!usaprodottiSalvati && salva) {
|
||||||
trovatocatalogo.lista_prodotti = arrprod
|
if (trovatocatalogo) {
|
||||||
|
trovatocatalogo.lista_prodotti = arrprod
|
||||||
|
|
||||||
salvaListaProdotti(false)
|
salvaListaProdotti(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1234,9 +1218,11 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateProducts(arr: any) {
|
function updateProducts(arr: any) {
|
||||||
getCatalogoByMyPage.value.lista_prodotti = [...arr]
|
if (getCatalogoByMyPage.value) {
|
||||||
|
getCatalogoByMyPage.value.lista_prodotti = [...arr]
|
||||||
|
|
||||||
salvaListaProdotti(true)
|
salvaListaProdotti(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
>
|
>
|
||||||
</q-tab>
|
</q-tab>
|
||||||
<q-tab
|
<q-tab
|
||||||
|
v-if="lista_prodotti"
|
||||||
name="lista"
|
name="lista"
|
||||||
icon="fas fa-list"
|
icon="fas fa-list"
|
||||||
label="Lista"
|
label="Lista"
|
||||||
@@ -61,6 +62,13 @@
|
|||||||
name="lista"
|
name="lista"
|
||||||
v-if="optcatalogo"
|
v-if="optcatalogo"
|
||||||
>
|
>
|
||||||
|
<q-btn
|
||||||
|
rounded
|
||||||
|
label="Rigenera Lista Libri"
|
||||||
|
color="primary"
|
||||||
|
@click="generaListaLibri()"
|
||||||
|
></q-btn>
|
||||||
|
|
||||||
<CProductTable
|
<CProductTable
|
||||||
:lista_prodotti="lista_prodotti"
|
:lista_prodotti="lista_prodotti"
|
||||||
@update:lista_prodotti="updateProducts"
|
@update:lista_prodotti="updateProducts"
|
||||||
@@ -554,12 +562,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</q-tab-panel>
|
</q-tab-panel>
|
||||||
<q-tab-panel name="opzioni">
|
<q-tab-panel name="opzioni">
|
||||||
<q-btn
|
|
||||||
rounded
|
|
||||||
label="Genera Lista Libri"
|
|
||||||
color="primary"
|
|
||||||
@click="generaListaLibri()"
|
|
||||||
></q-btn>
|
|
||||||
<pre>
|
<pre>
|
||||||
<strong>PASSI DA COMPIERE PER FARE AGGIORNAMENTI :</strong>
|
<strong>PASSI DA COMPIERE PER FARE AGGIORNAMENTI :</strong>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user