- Ricerca Titolo per nome o autore o ISBN o codice articolo
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
@click="click_opendetail()"
|
||||
/>
|
||||
</a>
|
||||
<div class="q-ma-md ">
|
||||
<div class="q-ma-sm">
|
||||
<div class="row absolute-top-left semi-transparent" style="z-index: 10;">
|
||||
<q-btn-dropdown
|
||||
push
|
||||
@@ -243,7 +243,7 @@
|
||||
<div
|
||||
v-if="scheda.testo_right_attaccato.font?.posiz_text !== costanti.POSIZ_TESTO.IN_BASSO"
|
||||
:style="{
|
||||
alignSelf: scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? '' : 'end',
|
||||
alignSelf: scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? '' : 'center',
|
||||
marginTop:
|
||||
scheda.testo_right_attaccato.font?.posiz_text === costanti.POSIZ_TESTO.IN_BASSO ? 'auto' : '0',
|
||||
}"
|
||||
|
||||
@@ -280,6 +280,9 @@ export default defineComponent({
|
||||
if (!recscheda.scheda?.dimensioni?.pagina?.testo_up) {
|
||||
recscheda.scheda!.dimensioni.pagina.testo_up = tools.resetIText(null)
|
||||
}
|
||||
if (!recscheda.scheda?.dimensioni?.pagina?.testo_title) {
|
||||
recscheda.scheda!.dimensioni.pagina.testo_title = tools.resetIText(null)
|
||||
}
|
||||
if (!recscheda.scheda?.dimensioni?.pagina?.testo_down) {
|
||||
recscheda.scheda!.dimensioni.pagina.testo_down = tools.resetIText(null)
|
||||
}
|
||||
@@ -435,7 +438,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const dimensioni: IElementiScheda = {
|
||||
pagina: { dimensioni: defaultDimensioniPag, testo_down: testodef, testo_up: testodef },
|
||||
pagina: { dimensioni: defaultDimensioniPag, testo_down: testodef, testo_up: testodef, testo_title: testodef },
|
||||
riga: defaultDimensioniRiga,
|
||||
scheda_prodotto: defaultSchedaProdotto,
|
||||
immagine_prodotto: {
|
||||
|
||||
@@ -1989,6 +1989,14 @@
|
||||
:show_imgsfondo="true"
|
||||
@update:model-value="modifElem"
|
||||
></CMyDimensioni>
|
||||
<CMyText
|
||||
v-model="recscheda.scheda.dimensioni.pagina.testo_title"
|
||||
@modifElem="modifElem"
|
||||
@saveFieldElem="saveFieldElem"
|
||||
@update:model-value="modifElem"
|
||||
label="Titolo in Alto"
|
||||
>
|
||||
</CMyText>
|
||||
<CMyText
|
||||
v-model="recscheda.scheda.dimensioni.pagina.testo_up"
|
||||
@modifElem="modifElem"
|
||||
|
||||
@@ -761,6 +761,31 @@ export default defineComponent({
|
||||
// Seleziona tutto il testo all'interno della casella di testo
|
||||
event.target.select();
|
||||
}
|
||||
|
||||
function getLabelValue(opt: any): string {
|
||||
const collabel = props.optlab
|
||||
|
||||
if (typeof collabel === 'function') {
|
||||
// Se collabel è una funzione, chiamala con opt
|
||||
return collabel(opt)
|
||||
} else if (typeof collabel === 'string') {
|
||||
// Se collabel è una stringa, usa il valore della proprietà corrispondente
|
||||
return opt[collabel] || 'N/A'
|
||||
}
|
||||
|
||||
// Fallback generico
|
||||
return 'N/A';
|
||||
}
|
||||
|
||||
function getOptionLabel(option: any): string {
|
||||
console.log('getOptionLabel', option)
|
||||
if (typeof props.optlab === 'function') {
|
||||
return props.optlab(option); // Se optlab è una funzione, chiamala
|
||||
} else {
|
||||
return option[props.optlab]; // Se optlab è una stringa, usa la proprietà corrispondente
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
|
||||
@@ -777,6 +802,8 @@ export default defineComponent({
|
||||
getIcon,
|
||||
tools,
|
||||
selectText,
|
||||
getLabelValue,
|
||||
getOptionLabel,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -93,8 +93,7 @@
|
||||
:input-class="myclass"
|
||||
:options="valori"
|
||||
:option-value="optval"
|
||||
:option-label="optlab"
|
||||
map-options
|
||||
:option-label="getOptionLabel"
|
||||
:use-chips="myvalue && myvalue !== '' ? true : false"
|
||||
stack-label
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
@@ -125,7 +124,8 @@
|
||||
<q-item v-bind="scope.itemProps">
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}</q-item-label
|
||||
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
|
||||
</q-item-label
|
||||
>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
@@ -13,6 +13,9 @@ export default defineComponent({
|
||||
type: [String, Number],
|
||||
required: false,
|
||||
default: '0',
|
||||
validator: (value) => {
|
||||
return true;
|
||||
},
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
|
||||
@@ -74,6 +74,15 @@ export default defineComponent({
|
||||
}, { immediate: true });
|
||||
|
||||
function mounted() {
|
||||
if (!internalModel.font) {
|
||||
internalModel.font = {
|
||||
line_height: 1,
|
||||
posiz_text: 0,
|
||||
perc_text: '',
|
||||
name: '',
|
||||
size: '14px',
|
||||
}
|
||||
}
|
||||
if (!internalModel.font?.perc_text) {
|
||||
internalModel.font!.perc_text = ''
|
||||
}
|
||||
|
||||
@@ -12,77 +12,82 @@
|
||||
@update_col="update_col"
|
||||
>
|
||||
</CMyFieldRec>
|
||||
<q-select
|
||||
v-model="internalModel.font.posiz_text"
|
||||
:options="tools.posizTextOptions"
|
||||
label="Posizione"
|
||||
options-dense
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
style="width: 100px"
|
||||
@update:model-value="modifElem"
|
||||
fill-input
|
||||
text-color="white"
|
||||
>
|
||||
</q-select>
|
||||
<CMySlider
|
||||
label="Margine % tra l'immagine"
|
||||
v-model="internalModel.font.perc_text"
|
||||
:min="0"
|
||||
:max="100"
|
||||
color="blue"
|
||||
addstr="%"
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySlider
|
||||
label="Line Height:"
|
||||
v-model="internalModel.font.line_height"
|
||||
:min="0.5"
|
||||
:max="2"
|
||||
color="blue"
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySlider
|
||||
v-if="show_maxlength"
|
||||
label="Max numero di caratteri:"
|
||||
v-model="internalModel.maxlength"
|
||||
:min="0"
|
||||
:max="1000"
|
||||
color="blue"
|
||||
addstr=""
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySize
|
||||
v-if="show_dimensioni"
|
||||
label="Dimensioni:"
|
||||
v-model="internalModel.size"
|
||||
@update:model-value="modifElem"
|
||||
></CMySize>
|
||||
<div v-if="internalModel">
|
||||
<q-select
|
||||
v-if="internalModel.font"
|
||||
v-model="internalModel.font.posiz_text"
|
||||
:options="tools.posizTextOptions"
|
||||
label="Posizione"
|
||||
options-dense
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
style="width: 100px"
|
||||
@update:model-value="modifElem"
|
||||
fill-input
|
||||
text-color="white"
|
||||
>
|
||||
</q-select>
|
||||
<CMySlider
|
||||
v-if="internalModel.font"
|
||||
label="Margine % tra l'immagine"
|
||||
v-model="internalModel.font.perc_text"
|
||||
:min="0"
|
||||
:max="100"
|
||||
color="blue"
|
||||
addstr="%"
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySlider
|
||||
v-if="internalModel.font"
|
||||
label="Line Height:"
|
||||
v-model="internalModel.font.line_height"
|
||||
:min="0.5"
|
||||
:max="2"
|
||||
color="blue"
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySlider
|
||||
v-if="show_maxlength"
|
||||
label="Max numero di caratteri:"
|
||||
v-model="internalModel.maxlength"
|
||||
:min="0"
|
||||
:max="1000"
|
||||
color="blue"
|
||||
addstr=""
|
||||
@update:model-value="modifElem"
|
||||
></CMySlider>
|
||||
<CMySize
|
||||
v-if="show_dimensioni"
|
||||
label="Dimensioni:"
|
||||
v-model="internalModel.size"
|
||||
@update:model-value="modifElem"
|
||||
></CMySize>
|
||||
|
||||
<div>
|
||||
Parole Chiave: {autore} {titolo} {descrizione} {date_pub} {ranking}
|
||||
{sottotitolo} {prezzo} {prezzo_scontato} {descrizione_estesa}
|
||||
<div>
|
||||
Parole Chiave: {autore} {titolo} {descrizione} {date_pub} {ranking} {sottotitolo} {prezzo} {prezzo_scontato}
|
||||
{descrizione_estesa}
|
||||
</div>
|
||||
|
||||
<q-select
|
||||
v-if="internalModel.font"
|
||||
v-model="internalModel.font.size"
|
||||
:options="tools.fontSizeOptions"
|
||||
label="Size Titolo"
|
||||
options-dense
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
style="width: 120px"
|
||||
@update:model-value="modifElem"
|
||||
fill-input
|
||||
text-color="white"
|
||||
>
|
||||
</q-select>
|
||||
</div>
|
||||
|
||||
<q-select
|
||||
v-model="internalModel.font.size"
|
||||
:options="tools.fontSizeOptions"
|
||||
label="Size Titolo"
|
||||
options-dense
|
||||
dense
|
||||
emit-value
|
||||
map-options
|
||||
style="width: 120px"
|
||||
@update:model-value="modifElem"
|
||||
fill-input
|
||||
text-color="white"
|
||||
>
|
||||
</q-select>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyText.ts">
|
||||
</script>
|
||||
<script lang="ts" src="./CMyText.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyText.scss';
|
||||
|
||||
7
src/components/CProductTable/CProductTable.scss
Executable file
7
src/components/CProductTable/CProductTable.scss
Executable file
@@ -0,0 +1,7 @@
|
||||
.drag-handle {
|
||||
cursor: grab; /* Mostra la manina */
|
||||
}
|
||||
|
||||
.drag-handle:active {
|
||||
cursor: grabbing; /* Cambia la manina quando l'utente sta trascinando */
|
||||
}
|
||||
131
src/components/CProductTable/CProductTable.ts
Executable file
131
src/components/CProductTable/CProductTable.ts
Executable file
@@ -0,0 +1,131 @@
|
||||
import { defineComponent, onMounted, ref, watch } from "vue";
|
||||
import draggable from 'vuedraggable'
|
||||
|
||||
import { tools } from '@tools'
|
||||
|
||||
import { useGlobalStore } from '@src/store/globalStore'
|
||||
|
||||
import { costanti } from '@costanti'
|
||||
import { IAuthor, ICatProd } from "app/src/model";
|
||||
|
||||
export default defineComponent({
|
||||
name: "CProductTable",
|
||||
components: {
|
||||
draggable,
|
||||
},
|
||||
props: {
|
||||
lista_prodotti: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:lista_prodotti"],
|
||||
setup(props, { emit }) {
|
||||
// Copia locale della lista_prodotti per manipolazione interna
|
||||
const internalProducts = ref([...props.lista_prodotti]);
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
async function mounted() {
|
||||
|
||||
}
|
||||
|
||||
// Aggiorna la copia locale quando il prop cambia
|
||||
watch(
|
||||
() => props.lista_prodotti,
|
||||
(newVal) => {
|
||||
internalProducts.value = [...newVal];
|
||||
}
|
||||
);
|
||||
|
||||
// Colonne della tabella
|
||||
const allColumns = [
|
||||
{ name: "drag", label: "", field: "", align: "left", style: "width: 50px" },
|
||||
{ name: "image", label: "Immagine", field: "image", align: "center" },
|
||||
{ name: "title", label: "Titolo", field: "title", align: "left" },
|
||||
{ name: "author", label: "Autore", field: "author", align: "left" },
|
||||
{ name: "topic", label: "Argomento", field: "topic", align: "left" },
|
||||
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" },
|
||||
{ name: "actions", label: "Azioni", field: "", align: "center" },
|
||||
];
|
||||
|
||||
const selectedColumns = ref(
|
||||
tools.getCookie("selColCat")
|
||||
? JSON.parse(tools.getCookie("selColCat"))
|
||||
: ["drag", "image", "name", "authors", "catprods", "isbn", "actions"] // Valori di default
|
||||
)
|
||||
|
||||
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
|
||||
const isColumnVisible = (column) => {
|
||||
return selectedColumns.value.includes(column);
|
||||
}
|
||||
|
||||
// Funzione per eliminare un prodotto
|
||||
const removeProduct = (product) => {
|
||||
internalProducts.value = internalProducts.value.filter((p: any) => p._id !== product._id);
|
||||
emit("update:lista_prodotti", internalProducts.value); // Notifica il parent del cambiamento
|
||||
}
|
||||
|
||||
// 8. Salvataggio delle colonne selezionate in un cookie
|
||||
const saveSelectedColumns = () => {
|
||||
tools.setCookie("selColCat", JSON.stringify(selectedColumns.value));
|
||||
};
|
||||
|
||||
// 9. Watcher per salvare automaticamente le preferenze quando cambiano
|
||||
watch(() => selectedColumns.value, () => {
|
||||
saveSelectedColumns();
|
||||
});
|
||||
|
||||
// Funzione chiamata alla fine del drag-and-drop
|
||||
const onDragEnd = () => {
|
||||
// console.log("Nuovo ordine:", internalProducts.value);
|
||||
emit("update:lista_prodotti", internalProducts.value); // Notifica il parent del cambiamento
|
||||
}
|
||||
|
||||
function formatAuthors(authors: IAuthor[] | undefined | null): string {
|
||||
if (!authors || !Array.isArray(authors)) {
|
||||
return ""; // Restituisci una stringa vuota se authors non è un array valido
|
||||
}
|
||||
|
||||
// Estrai il nome e il cognome di ogni autore e uniscili con ', '
|
||||
return authors
|
||||
.map((author) => `${author.name ?? ""} ${author.surname ?? ""}`.trim())
|
||||
.filter((name) => name.length > 0) // Filtra eventuali nomi vuoti
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
function formatCatProds(catprods: ICatProd[] | undefined | null): string {
|
||||
if (!catprods || !Array.isArray(catprods)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Estrai il nome e il cognome di ogni autore e uniscili con ', '
|
||||
return catprods
|
||||
.map((catprod) => `${catprod.name ?? ""}`.trim())
|
||||
.filter((name) => name.length > 0) // Filtra eventuali nomi vuoti
|
||||
.join(", ");
|
||||
}
|
||||
|
||||
// Caricamento delle preferenze al mount del componente
|
||||
onMounted(() => {
|
||||
const savedColumns = tools.getCookie("selColCat");
|
||||
if (savedColumns) {
|
||||
selectedColumns.value = JSON.parse(savedColumns);
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
allColumns,
|
||||
selectedColumns,
|
||||
isColumnVisible,
|
||||
internalProducts,
|
||||
formatAuthors,
|
||||
formatCatProds,
|
||||
removeProduct,
|
||||
tools,
|
||||
globalStore,
|
||||
costanti,
|
||||
onDragEnd,
|
||||
}
|
||||
},
|
||||
})
|
||||
94
src/components/CProductTable/CProductTable.vue
Executable file
94
src/components/CProductTable/CProductTable.vue
Executable file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Selezione Colonne -->
|
||||
<div class="q-mb-md">
|
||||
<q-select
|
||||
v-model="selectedColumns"
|
||||
:options="allColumns"
|
||||
label="Colonne da visualizzare"
|
||||
multiple
|
||||
emit-value
|
||||
map-options
|
||||
filled
|
||||
style="max-width: 400px"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Tabella Prodotti -->
|
||||
<table>
|
||||
<!-- Intestazioni (Thead) -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th v-if="isColumnVisible('drag')">Drag</th>
|
||||
<th v-if="isColumnVisible('image')">Immagine</th>
|
||||
<th v-if="isColumnVisible('name')">Nome</th>
|
||||
<th v-if="isColumnVisible('authors')">Autore</th>
|
||||
<th v-if="isColumnVisible('catprods')">Argomento</th>
|
||||
<th v-if="isColumnVisible('isbn')">ISBN</th>
|
||||
<th v-if="isColumnVisible('actions')">Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- Corpo della Tabella (Tbody) -->
|
||||
<draggable
|
||||
v-model="internalProducts"
|
||||
tag="tbody"
|
||||
handle=".drag-handle"
|
||||
item-key="_id"
|
||||
@end="onDragEnd"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<tr :key="element._id">
|
||||
<!-- Icona Drag Handle -->
|
||||
<td v-if="isColumnVisible('drag')" class="drag-handle">
|
||||
<q-icon name="drag_handle" size="32px" color="primary" />
|
||||
</td>
|
||||
|
||||
<!-- Immagine Piccola -->
|
||||
<td v-if="isColumnVisible('image')">
|
||||
<q-img
|
||||
:src="
|
||||
element.productInfo?.imagefile
|
||||
? tools.getFullFileNameByImageFile('productInfos', element.productInfo?.imagefile)
|
||||
: element.productInfo?.image_link
|
||||
"
|
||||
style="width: 50px; height: 50px"
|
||||
class="rounded-borders"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<!-- Titolo -->
|
||||
<td v-if="isColumnVisible('name')">{{ element.productInfo?.name }}</td>
|
||||
|
||||
<!-- Autore -->
|
||||
<td v-if="isColumnVisible('authors')">{{ formatAuthors(element.productInfo?.authors) }}</td>
|
||||
|
||||
<!-- Argomento -->
|
||||
<td v-if="isColumnVisible('catprods')">{{ formatCatProds(element.productInfo?.catprods) }}</td>
|
||||
|
||||
<!-- ISBN -->
|
||||
<td v-if="isColumnVisible('isbn')">{{ element.isbn }}</td>
|
||||
|
||||
<!-- Azioni -->
|
||||
<td v-if="isColumnVisible('actions')">
|
||||
<q-btn-dropdown label="Azioni" color="primary" flat>
|
||||
<q-list>
|
||||
<q-item clickable v-close-popup @click="removeProduct(element)">
|
||||
<q-item-section>
|
||||
<q-item-label>Elimina</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-btn-dropdown>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</draggable>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" src="./CProductTable.ts"></script>
|
||||
<style lang="scss" scoped>
|
||||
@import './CProductTable.scss';
|
||||
</style>
|
||||
1
src/components/CProductTable/index.ts
Executable file
1
src/components/CProductTable/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export { default as CProductTable } from './CProductTable.vue'
|
||||
@@ -54,7 +54,7 @@ export default defineComponent({
|
||||
const idPage = ref('')
|
||||
const selauthor = ref('')
|
||||
|
||||
const searchList = ref(<any[]>[])
|
||||
const searchList = ref(<ISearchList[]>[])
|
||||
|
||||
const optcatalogo = ref<IOptCatalogo | null>(null);
|
||||
|
||||
@@ -99,6 +99,8 @@ export default defineComponent({
|
||||
myproduct.value = null
|
||||
}
|
||||
|
||||
console.log('myproduct.value', myproduct.value)
|
||||
|
||||
if (myproduct.value) {
|
||||
tools.setCookie(tools.COOK_LAST_PROD_SEARCH, myproduct.value._id.toString())
|
||||
} else {
|
||||
@@ -142,8 +144,8 @@ export default defineComponent({
|
||||
table: 'products',
|
||||
key: 'titolo',
|
||||
type: costanti.FieldType.select_by_server,
|
||||
value: myproduct.value?.productInfo?.name,
|
||||
// addall: true,
|
||||
value: myproduct.value,
|
||||
collabel: collabel,
|
||||
arrvalue: [],
|
||||
useinput: true,
|
||||
filter: null,
|
||||
@@ -161,6 +163,16 @@ export default defineComponent({
|
||||
router.push(path)
|
||||
}
|
||||
|
||||
function collabel (rec: any) {
|
||||
console.log('Record:', rec)
|
||||
let label = ''
|
||||
if (rec && rec.productInfo) {
|
||||
label = `${rec.productInfo.name} - ${rec.productInfo.authors.map((a: any) => a.name + ' ' + a.surname).join(', ')}`
|
||||
console.log('Computed label:', label)
|
||||
}
|
||||
return label
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
myclass=""
|
||||
:icon_alternative="item.icon"
|
||||
:optval="fieldsTable.getKeyByTable(item.table)"
|
||||
:optlab="fieldsTable.getLabelByTable(item.table)"
|
||||
:optlab="item.collabel"
|
||||
:options="valoriopt(item, false)"
|
||||
:filter="item.filter"
|
||||
:filter_extra="item.filter_extra"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { IImg } from "./GlobalStore"
|
||||
import type { ICollana } from "./Products"
|
||||
import type { ICollana, IProduct } from "./Products"
|
||||
|
||||
|
||||
export interface ICatalog {
|
||||
@@ -26,7 +26,7 @@ export interface ICatalog {
|
||||
data_generato?: Date
|
||||
pdf_online?: string
|
||||
data_online?: Date
|
||||
|
||||
|
||||
pdf_generato_stampa?: string
|
||||
data_generato_stampa?: Date
|
||||
pdf_online_stampa?: string
|
||||
@@ -34,8 +34,10 @@ export interface ICatalog {
|
||||
|
||||
date_created?: Date,
|
||||
date_updated?: Date,
|
||||
|
||||
lista_prodotti?: IProduct[]
|
||||
}
|
||||
|
||||
export interface ICatalogState {
|
||||
catalogs?: ICatalog[]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,6 +747,7 @@ export interface IBarCode {
|
||||
|
||||
export interface IPagina {
|
||||
dimensioni?: IDimensioni
|
||||
testo_title?: IText
|
||||
testo_up?: IText
|
||||
testo_down?: IText
|
||||
}
|
||||
@@ -1034,6 +1035,7 @@ export interface ISearchList {
|
||||
keycookie?: string
|
||||
showcount?: boolean
|
||||
tablesel?: string
|
||||
collabel?: string | object
|
||||
icon?: string
|
||||
filteradv?: boolean
|
||||
filter_extra?: object
|
||||
@@ -1098,6 +1100,7 @@ export interface IDataToSet {
|
||||
data?: any
|
||||
myfunc?: any
|
||||
inviaemail?: any
|
||||
aggiornainmem?: boolean
|
||||
}
|
||||
|
||||
export interface INewsState {
|
||||
|
||||
@@ -4168,12 +4168,16 @@ export const fieldsTable = {
|
||||
if (myrec) return ((myrec.colkey) ? myrec.colkey : '_id')
|
||||
return '_id'
|
||||
},
|
||||
getLabelByTable(mytable: string): string {
|
||||
const myrec = this.getrecTableList(mytable)
|
||||
if (myrec) { // @ts-ignore
|
||||
return ((myrec.collabel) ? myrec.collabel : 'label')
|
||||
getLabelByTable(mytable: string, collabel?: any): string {
|
||||
if (collabel) {
|
||||
return collabel
|
||||
} else {
|
||||
const myrec = this.getrecTableList(mytable)
|
||||
if (myrec) { // @ts-ignore
|
||||
return ((myrec.collabel) ? myrec.collabel : 'label')
|
||||
}
|
||||
return 'label'
|
||||
}
|
||||
return 'label'
|
||||
},
|
||||
getValByTabAndId(table: string, field: string, idvalue: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
@@ -2835,13 +2835,14 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
async saveFieldToServer(mythisq: any, table: string, id: any, mydata: any, notif = true) {
|
||||
async saveFieldToServer(mythisq: any, table: string, id: any, mydata: any, notif = true, aggiornainmem = true) {
|
||||
|
||||
const mydatatosave = {
|
||||
id,
|
||||
table,
|
||||
fieldsvalue: mydata,
|
||||
notifBot: null,
|
||||
aggiornainmem,
|
||||
}
|
||||
|
||||
const globalStore = useGlobalStore()
|
||||
@@ -9637,6 +9638,9 @@ export const tools = {
|
||||
if (!myrec.dimensioni) {
|
||||
myrec.dimensioni = this.resetRecIDimensioni(null)
|
||||
}
|
||||
if (!myrec.testo_title) {
|
||||
myrec.testo_title = this.resetIText(null)
|
||||
}
|
||||
if (!myrec.testo_up) {
|
||||
myrec.testo_up = this.resetIText(null)
|
||||
}
|
||||
|
||||
@@ -1434,6 +1434,8 @@ export const useProducts = defineStore('Products', {
|
||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
const qta = myproduct.arrvariazioni![0].quantita || ''
|
||||
const isbn = myproduct.productInfo.code || ''
|
||||
const image_link = myproduct.productInfo.image_link || ''
|
||||
const imagefile = myproduct.productInfo.imagefile || ''
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
@@ -1465,6 +1467,8 @@ export const useProducts = defineStore('Products', {
|
||||
'{descrizione_breve_macro}': descrizione_breve_macro || '',
|
||||
'{link_macro}': link_macro || '',
|
||||
'{qta}': qta || '',
|
||||
'{image_link}': image_link || '',
|
||||
'{imagefile}': imagefile || '',
|
||||
};
|
||||
|
||||
// Esegue le sostituzioni
|
||||
|
||||
@@ -1419,7 +1419,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return Api.SendReq('/chval', 'PATCH', { data: mydata })
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
this.UpdateValuesInMemory(mydata)
|
||||
if (mydata.aggiornainmem)
|
||||
this.UpdateValuesInMemory(mydata)
|
||||
return (res.data.code === serv_constants.RIS_CODE_OK)
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -84,7 +84,6 @@ body {
|
||||
.book-author {
|
||||
font-family: 'DINPro-Condensed-Regular', sans-serif;
|
||||
font-size: calc(16 * var(--scalecatalog) * 1px);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.book-descr {
|
||||
@@ -95,7 +94,7 @@ body {
|
||||
.book-details {
|
||||
font-family: 'DINPro-Condensed-Regular', sans-serif;
|
||||
margin-bottom: calc(5 * var(--scalecatalog) * 1px);
|
||||
font-size: calc(13 * var(--scalecatalog) * 1px);
|
||||
font-size: calc(14 * var(--scalecatalog) * 1px);
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
@@ -121,8 +120,18 @@ body {
|
||||
font-family: 'DINPro', sans-serif;
|
||||
margin-bottom: calc(5 * var(--scalecatalog) * 1px);
|
||||
font-size: calc(20 * var(--scalecatalog) * 1px);
|
||||
height: calc(380 * var(--scalecatalog) * 1px);
|
||||
}
|
||||
.book-text-down {
|
||||
font-family: 'DINPro', sans-serif;
|
||||
margin-bottom: calc(5 * var(--scalecatalog) * 1px);
|
||||
}
|
||||
|
||||
.book-pagina-title {
|
||||
font-family: 'DINPro', sans-serif;
|
||||
color: white;
|
||||
margin-top: calc(20 * var(--scalecatalog) * 1px);
|
||||
margin-bottom: calc(5 * var(--scalecatalog) * 1px);
|
||||
font-size: calc(35 * var(--scalecatalog) * 1px);
|
||||
height: calc(100 * var(--scalecatalog) * 1px);
|
||||
}
|
||||
@@ -14,11 +14,13 @@ import { shared_consts } from '@src/common/shared_vuejs'
|
||||
import { CProductCard } from '@src/components/CProductCard'
|
||||
|
||||
import { CMySelect } from '@src/components/CMySelect'
|
||||
import { CProductTable } from '@src/components/CProductTable'
|
||||
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard'
|
||||
import { CSelectUserActive } from '@src/components/CSelectUserActive'
|
||||
import type {
|
||||
IOptCatalogo, IDimensioni, IFilterCatalogo,
|
||||
IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg
|
||||
IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg,
|
||||
IText
|
||||
} from 'model';
|
||||
import {
|
||||
IMyPage,
|
||||
@@ -28,10 +30,11 @@ import {
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
import { useCatalogStore } from '@src/store/CatalogStore'
|
||||
import { Catalogo } from '.';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Catalogo',
|
||||
components: { CContainerCatalogoCard, CProductCard, CSelectUserActive, CMySelect },
|
||||
components: { CContainerCatalogoCard, CProductCard, CSelectUserActive, CMySelect, CProductTable },
|
||||
emits: ['update:modelValue', 'updateCatalogo'],
|
||||
props: {
|
||||
modelValue: {
|
||||
@@ -98,7 +101,7 @@ export default defineComponent({
|
||||
const catalogStore = useCatalogStore()
|
||||
|
||||
const tabvisu = ref('categorie')
|
||||
const tabcatalogo = ref('visu')
|
||||
const tabcatalogo = ref()
|
||||
|
||||
const searchList = ref([] as ISearchList[])
|
||||
|
||||
@@ -112,6 +115,10 @@ export default defineComponent({
|
||||
|
||||
const isFixed = ref(false);
|
||||
|
||||
watch(() => tabcatalogo.value, () => {
|
||||
tools.setCookie('TAB_CAT', tabcatalogo.value)
|
||||
})
|
||||
|
||||
const labelcombo = computed(() => (item: any) => {
|
||||
let lab = item.label
|
||||
if (item.showcount)
|
||||
@@ -150,10 +157,37 @@ export default defineComponent({
|
||||
|
||||
})
|
||||
|
||||
function getTextSostituito(testo: IText) {
|
||||
const replacements = {
|
||||
'{titolo_catalogo}': getTitoloCatalogo() || '',
|
||||
};
|
||||
|
||||
// Esegue le sostituzioni
|
||||
let result = testo.contenuto;
|
||||
for (const [key, value] of Object.entries(replacements)) {
|
||||
result = result.replace(new RegExp(key, 'g'), value);
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
const getTitoloPagina = computed(() => (product: IProduct, recscheda: ISchedaSingola) => {
|
||||
|
||||
let testo = getTextSostituito(recscheda.scheda!.dimensioni.pagina?.testo_title)
|
||||
|
||||
return testo
|
||||
|
||||
})
|
||||
|
||||
const getCatalogoByMyPage = computed(() => {
|
||||
return catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
|
||||
})
|
||||
|
||||
const lista_prodotti = computed(() => {
|
||||
const arr = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
|
||||
return arr?.lista_prodotti
|
||||
})
|
||||
|
||||
const ispageCatalogata = computed(() => {
|
||||
return !!getCatalogoByMyPage.value
|
||||
})
|
||||
@@ -432,13 +466,13 @@ export default defineComponent({
|
||||
filtroProductTypes: number[],
|
||||
filtroExcludeProductTypes: number[],
|
||||
editore: string[],
|
||||
idCollane: string[],
|
||||
idCollane: number[],
|
||||
arrargomstr: any[],
|
||||
catstr: string,
|
||||
gasselstr: string,
|
||||
cosaValue: any,
|
||||
sortField?: string,
|
||||
sortDir?: string
|
||||
sortDir?: number
|
||||
): IProduct[] {
|
||||
const lowerSearchTexts = Array.isArray(searchtext)
|
||||
? searchtext.map((text: string) => text.toLowerCase().trim().replace(/[-@:=]/g, ''))
|
||||
@@ -449,9 +483,9 @@ export default defineComponent({
|
||||
const boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0;
|
||||
const boolfiltroVuotoEditore = editore.length === 0;
|
||||
const boolfiltroVuotoCollane = idCollane.length === 0;
|
||||
const boolfiltroVuotoArgomenti = arrargomstr.length === 0;
|
||||
// const boolfiltroVuotoArgomenti = arrargomstr.length === 0;
|
||||
|
||||
return products
|
||||
const arrris = products
|
||||
.filter((product: IProduct) => {
|
||||
if (!product || !product.productInfo) {
|
||||
console.error('product or product.productInfo is null');
|
||||
@@ -512,9 +546,9 @@ export default defineComponent({
|
||||
productgassel &&
|
||||
hasProductTypes &&
|
||||
(
|
||||
hasPublished ||
|
||||
hasCollana ||
|
||||
hasCategoria ||
|
||||
hasPublished &&
|
||||
hasCollana &&
|
||||
hasCategoria &&
|
||||
hasArgomentiCat
|
||||
)
|
||||
&&
|
||||
@@ -522,11 +556,19 @@ export default defineComponent({
|
||||
);
|
||||
})
|
||||
.sort((a, b) => getProductsSorted([a, b], sortField, sortDir)[0] === a ? -1 : 1);
|
||||
|
||||
console.log(' Filtro=' + arrargomstr)
|
||||
console.log(' idCollane=' + idCollane)
|
||||
console.log('PRODOTTI FILTRATI:', arrris.length)
|
||||
|
||||
return arrris
|
||||
}
|
||||
|
||||
function calcArrProducts() {
|
||||
function calcArrProducts(generalista?: boolean) {
|
||||
console.log('calcArrProducts (generalista=' + generalista + ')')
|
||||
|
||||
const searchtext = getSearchText();
|
||||
let arrprod = productStore.getProducts(cosa.value) || [];
|
||||
let arrprod = [];
|
||||
const filtroAuthor = filter.value.author || '';
|
||||
const filtroProductTypes = optcatalogo.value.productTypes || [0];
|
||||
const filtroExcludeProductTypes = optcatalogo.value.excludeproductTypes || [0];
|
||||
@@ -540,29 +582,52 @@ export default defineComponent({
|
||||
const catstr = cat.value || '';
|
||||
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
|
||||
|
||||
arrprod = filterProducts(
|
||||
arrprod,
|
||||
searchtext,
|
||||
filtroAuthor,
|
||||
filtroProductTypes,
|
||||
filtroExcludeProductTypes,
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
filter.value.sort_field,
|
||||
filter.value.sort_dir
|
||||
);
|
||||
let salva = false
|
||||
// Se nel catalogo è stato già generato, allora gli passo quello.
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
if (trovatocatalogo.lista_prodotti.length === 0) {
|
||||
generalista = true
|
||||
}
|
||||
|
||||
if (!generalista && (trovatocatalogo.lista_prodotti.length > 0)) {
|
||||
arrprod = trovatocatalogo.lista_prodotti
|
||||
} else {
|
||||
arrprod = productStore.getProducts(cosa.value)
|
||||
arrprod = filterProducts(
|
||||
arrprod,
|
||||
searchtext,
|
||||
filtroAuthor,
|
||||
filtroProductTypes,
|
||||
filtroExcludeProductTypes,
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
filter.value.sort_field,
|
||||
filter.value.sort_dir
|
||||
);
|
||||
|
||||
salva = true
|
||||
}
|
||||
|
||||
arrProducts.value = arrprod;
|
||||
|
||||
console.log('arrprod', arrprod)
|
||||
|
||||
populateDataWithlinkIdTemplate();
|
||||
generatearrProdToViewSorted();
|
||||
generatearrProdToViewSorted(!generalista, salva);
|
||||
loaddata();
|
||||
|
||||
refreshpage.value = false;
|
||||
}
|
||||
|
||||
function generaListaLibri() {
|
||||
calcArrProducts(true)
|
||||
}
|
||||
|
||||
function getProductsFilteredByScheda(scheda: IMyScheda): IProduct[] {
|
||||
let arrprod = productStore.getProducts(cosa.value) || [];
|
||||
const filtroAuthor = filter.value.author || '';
|
||||
@@ -578,21 +643,27 @@ export default defineComponent({
|
||||
const catstr = cat.value || '';
|
||||
const gasselstr = cosa.value === shared_consts.PROD.GAS ? idGasSel.value || '' : '';
|
||||
|
||||
arrprod = filterProducts(
|
||||
arrprod,
|
||||
scheda.arrProdottiSpeciali || [],
|
||||
filtroAuthor,
|
||||
filtroProductTypes,
|
||||
filtroExcludeProductTypes,
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
scheda?.sort_field,
|
||||
scheda?.sort_dir
|
||||
);
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
if (trovatocatalogo.lista_prodotti.length > 0) {
|
||||
arrprod = trovatocatalogo.lista_prodotti
|
||||
} else {
|
||||
|
||||
arrprod = filterProducts(
|
||||
arrprod,
|
||||
scheda.arrProdottiSpeciali || [],
|
||||
filtroAuthor,
|
||||
filtroProductTypes,
|
||||
filtroExcludeProductTypes,
|
||||
filtroPublishers,
|
||||
filtroCollane,
|
||||
arrargomstr,
|
||||
catstr,
|
||||
gasselstr,
|
||||
cosa.value,
|
||||
scheda?.sort_field,
|
||||
scheda?.sort_dir
|
||||
);
|
||||
}
|
||||
|
||||
return arrprod;
|
||||
}
|
||||
@@ -671,22 +742,31 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function generatearrProdToViewSorted() {
|
||||
// console.log('generatearrProdToViewSorted...')
|
||||
function generatearrProdToViewSorted(usaprodottiSalvati?: boolean, salva?: boolean) {
|
||||
console.log('generatearrProdToViewSorted... usaprodottiSalvati=', usaprodottiSalvati, ' salva=', salva)
|
||||
|
||||
try {
|
||||
|
||||
// Svuota
|
||||
arrProdToView.value = []
|
||||
|
||||
// gia filtrati
|
||||
const arrGeneraleProdotti = arrProducts.value;
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
let arrGeneraleProdotti = []
|
||||
|
||||
if (usaprodottiSalvati) {
|
||||
|
||||
} else {
|
||||
arrGeneraleProdotti = arrProducts.value;
|
||||
}
|
||||
|
||||
let indprod = 0
|
||||
const indprodGenerale = 0
|
||||
|
||||
let indtotale = 0
|
||||
|
||||
let arrprod = []
|
||||
|
||||
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||
if (recscheda && recscheda.scheda) {
|
||||
const schedePerRiga = recscheda.scheda.numschede_perRiga || 1
|
||||
@@ -695,17 +775,21 @@ export default defineComponent({
|
||||
|
||||
let arrProdFiltrati: IProduct[] = []
|
||||
|
||||
if (recscheda.scheda.productTypes!.length > 0) {
|
||||
// Filtra i prodotti in base ai filtri impostati !
|
||||
arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
|
||||
indprod = 0
|
||||
if (usaprodottiSalvati && trovatocatalogo.lista_prodotti.length > 0) {
|
||||
arrProdFiltrati = trovatocatalogo.lista_prodotti
|
||||
} else {
|
||||
if (recscheda.scheda.sort_field!) {
|
||||
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field, recscheda.scheda.sort_dir);
|
||||
if (recscheda.scheda.productTypes!.length > 0) {
|
||||
// Filtra i prodotti in base ai filtri impostati !
|
||||
arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
|
||||
indprod = 0
|
||||
} else {
|
||||
indprod = indprodGenerale
|
||||
arrProdFiltrati = arrGeneraleProdotti
|
||||
if (recscheda.scheda.sort_field!) {
|
||||
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field, recscheda.scheda.sort_dir);
|
||||
indprod = 0
|
||||
} else {
|
||||
indprod = indprodGenerale
|
||||
arrProdFiltrati = arrGeneraleProdotti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,6 +821,8 @@ export default defineComponent({
|
||||
|
||||
// console.log('RANKING: ', result.myrec.indiceRanking!)
|
||||
|
||||
arrprod.push(result.myrec)
|
||||
|
||||
recscheda.arrProdToShow[pagina][riga][col] = result.myrec
|
||||
|
||||
indadded++
|
||||
@@ -772,6 +858,13 @@ export default defineComponent({
|
||||
|
||||
// console.log(' FINE - generatearrProdToViewSorted !')
|
||||
|
||||
|
||||
if (!usaprodottiSalvati && salva) {
|
||||
trovatocatalogo.lista_prodotti = arrprod
|
||||
|
||||
salvaListaProdotti(false)
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Err', e)
|
||||
}
|
||||
@@ -779,6 +872,24 @@ export default defineComponent({
|
||||
// console.log('Fine...')
|
||||
}
|
||||
|
||||
function salvaListaProdotti(ricarica: boolean) {
|
||||
// Estrai solo gli ID dei prodotti filtrati
|
||||
const myarr = [...getCatalogoByMyPage.value.lista_prodotti]
|
||||
const productIds = myarr.map(product => product._id);
|
||||
|
||||
let mydata = {
|
||||
lista_prodotti: productIds
|
||||
}
|
||||
|
||||
// Salva gli ID dei prodotti nel catalogo
|
||||
tools.saveFieldToServer($q, 'catalogs', getCatalogoByMyPage.value._id, mydata, true, false)
|
||||
|
||||
|
||||
if (ricarica) {
|
||||
generatearrProdToViewSorted(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
function getNextProd() {
|
||||
const nextRecord = arrProdToView.value.find((rec: any) => !rec.showed)
|
||||
|
||||
@@ -810,6 +921,9 @@ export default defineComponent({
|
||||
|
||||
async function mounted() {
|
||||
// console.log('mounted Catalogo')
|
||||
|
||||
tabcatalogo.value = tools.getCookie('TAB_CAT', 'visu')
|
||||
|
||||
loadpage.value = false
|
||||
await productStore.loadProducts()
|
||||
|
||||
@@ -1119,6 +1233,12 @@ export default defineComponent({
|
||||
router.push(path)
|
||||
}
|
||||
|
||||
function updateProducts(arr: any) {
|
||||
getCatalogoByMyPage.value.lista_prodotti = [...arr]
|
||||
|
||||
salvaListaProdotti(true)
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -1174,6 +1294,10 @@ export default defineComponent({
|
||||
ispageCatalogata,
|
||||
naviga,
|
||||
getTitoloCatalogo,
|
||||
getTitoloPagina,
|
||||
generaListaLibri,
|
||||
lista_prodotti,
|
||||
updateProducts,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -12,7 +12,18 @@
|
||||
dense
|
||||
class="bg-green text-white"
|
||||
>
|
||||
<q-tab name="visu" icon="fas fa-eye" label="Visualizza"> </q-tab>
|
||||
<q-tab
|
||||
name="visu"
|
||||
icon="fas fa-eye"
|
||||
label="Visualizza"
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
name="lista"
|
||||
icon="fas fa-list"
|
||||
label="Lista"
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
v-if="tools.isGrafico()"
|
||||
name="sfondo"
|
||||
@@ -27,11 +38,39 @@
|
||||
label="Pagine"
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab name="tutorial" icon="fas fa-info" label="Tutorial"> </q-tab>
|
||||
<q-tab name="opzioni" icon="fas fa-save" label="Avanzati"> </q-tab>
|
||||
<q-tab
|
||||
name="tutorial"
|
||||
icon="fas fa-info"
|
||||
label="Tutorial"
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
name="opzioni"
|
||||
icon="fas fa-save"
|
||||
label="Avanzati"
|
||||
>
|
||||
</q-tab>
|
||||
</q-tabs>
|
||||
<q-tab-panels v-model="tabcatalogo" animated class="" keep-alive>
|
||||
<q-tab-panel name="visu" v-if="optcatalogo">
|
||||
<q-tab-panels
|
||||
v-model="tabcatalogo"
|
||||
animated
|
||||
class=""
|
||||
keep-alive
|
||||
>
|
||||
<q-tab-panel
|
||||
name="lista"
|
||||
v-if="optcatalogo"
|
||||
>
|
||||
<CProductTable
|
||||
:lista_prodotti="lista_prodotti"
|
||||
@update:lista_prodotti="updateProducts"
|
||||
/>
|
||||
</q-tab-panel>
|
||||
|
||||
<q-tab-panel
|
||||
name="visu"
|
||||
v-if="optcatalogo"
|
||||
>
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div class="text-center">
|
||||
<q-spinner
|
||||
@@ -41,7 +80,10 @@
|
||||
:thickness="2"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="loadpage" class="panel">
|
||||
<div
|
||||
v-if="loadpage"
|
||||
class="panel"
|
||||
>
|
||||
<div class="container">
|
||||
<q-tabs
|
||||
v-if="!ispageCatalogata"
|
||||
@@ -54,7 +96,12 @@
|
||||
icon="fas fa-folder-open"
|
||||
label="Categorie"
|
||||
>
|
||||
<q-badge v-if="cat" color="red" floating>1</q-badge>
|
||||
<q-badge
|
||||
v-if="cat"
|
||||
color="red"
|
||||
floating
|
||||
>1</q-badge
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
v-if="!ispageCatalogata"
|
||||
@@ -62,7 +109,12 @@
|
||||
icon="fas fa-user"
|
||||
label="Autori"
|
||||
>
|
||||
<q-badge v-if="filter.author" color="red" floating>1</q-badge>
|
||||
<q-badge
|
||||
v-if="filter.author"
|
||||
color="red"
|
||||
floating
|
||||
>1</q-badge
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
v-if="!ispageCatalogata"
|
||||
@@ -70,15 +122,29 @@
|
||||
icon="fas fa-search"
|
||||
label="Cerca"
|
||||
>
|
||||
<q-badge v-if="getSearchText()" color="red" floating
|
||||
<q-badge
|
||||
v-if="getSearchText()"
|
||||
color="red"
|
||||
floating
|
||||
>1</q-badge
|
||||
>
|
||||
</q-tab>
|
||||
</q-tabs>
|
||||
<q-tab-panels v-model="tabvisu" animated class="" keep-alive>
|
||||
<q-tab-panel v-if="!ispageCatalogata" name="categorie">
|
||||
<q-tab-panels
|
||||
v-model="tabvisu"
|
||||
animated
|
||||
class=""
|
||||
keep-alive
|
||||
>
|
||||
<q-tab-panel
|
||||
v-if="!ispageCatalogata"
|
||||
name="categorie"
|
||||
>
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div v-for="(reccat, index) in getCatProds()" :key="index">
|
||||
<div
|
||||
v-for="(reccat, index) in getCatProds()"
|
||||
:key="index"
|
||||
>
|
||||
<span
|
||||
:class="{
|
||||
category: true,
|
||||
@@ -150,26 +216,15 @@
|
||||
<CMySelect
|
||||
:col="fieldsTable.getColByColumns(mycolumns, item.key)"
|
||||
v-if="
|
||||
item.type === costanti.FieldType.select ||
|
||||
item.type === costanti.FieldType.select_by_server
|
||||
"
|
||||
:label="
|
||||
item.value && item.value._id > 0
|
||||
? undefined
|
||||
: labelcombo(item)
|
||||
item.type === costanti.FieldType.select || item.type === costanti.FieldType.select_by_server
|
||||
"
|
||||
:label="item.value && item.value._id > 0 ? undefined : labelcombo(item)"
|
||||
v-model:value="item.value"
|
||||
:addall="item.addall"
|
||||
:addnone="item.addnone"
|
||||
:addlast="true"
|
||||
:tablesel="
|
||||
item.type === costanti.FieldType.select_by_server
|
||||
? item.tablesel
|
||||
: ''
|
||||
"
|
||||
:pickup="
|
||||
item.type === costanti.FieldType.select_by_server
|
||||
"
|
||||
:tablesel="item.type === costanti.FieldType.select_by_server ? item.tablesel : ''"
|
||||
:pickup="item.type === costanti.FieldType.select_by_server"
|
||||
:label-color="$q.dark.isActive ? 'white' : 'black'"
|
||||
myclass="comboselector"
|
||||
color="primary"
|
||||
@@ -181,10 +236,7 @@
|
||||
:filter="item.filter"
|
||||
:filter_extra="item.filter_extra"
|
||||
style="font-size: 0.8rem !important"
|
||||
:useinput="
|
||||
item.useinput &&
|
||||
item.type !== costanti.FieldType.select_by_server
|
||||
"
|
||||
:useinput="item.useinput && item.type !== costanti.FieldType.select_by_server"
|
||||
>
|
||||
</CMySelect>
|
||||
</div>
|
||||
@@ -220,17 +272,17 @@
|
||||
</div>
|
||||
|
||||
<div class="text-center q-py-sm prod_trov">
|
||||
<span
|
||||
v-show="productStore.getNumProdTot() !== arrProducts.length"
|
||||
>{{
|
||||
t("ecomm.prodotti_trovati", {
|
||||
qta: arrProducts.length,
|
||||
qtatot: productStore.getNumProdTot(),
|
||||
})
|
||||
}}</span
|
||||
>
|
||||
<span v-show="productStore.getNumProdTot() !== arrProducts.length">{{
|
||||
t('ecomm.prodotti_trovati', {
|
||||
qta: arrProducts.length,
|
||||
qtatot: productStore.getNumProdTot(),
|
||||
})
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="row justify-around" v-if="tools.isManager() && false">
|
||||
<div
|
||||
class="row justify-around"
|
||||
v-if="tools.isManager() && false"
|
||||
>
|
||||
<q-toggle
|
||||
v-if="!optcatalogo.pdf"
|
||||
v-model="show_hide"
|
||||
@@ -254,20 +306,14 @@
|
||||
optcatalogo.first_page.text_html &&
|
||||
optcatalogo.first_page.text_html.contenuto
|
||||
"
|
||||
:style="
|
||||
generateStyleByPageDim(optcatalogo, optcatalogo.first_page)
|
||||
"
|
||||
:style="generateStyleByPageDim(optcatalogo, optcatalogo.first_page)"
|
||||
>
|
||||
<div
|
||||
v-html="optcatalogo.first_page.text_html.contenuto"
|
||||
></div>
|
||||
<div v-html="optcatalogo.first_page.text_html.contenuto"></div>
|
||||
</div>
|
||||
<div :style="generateStyleCatalogo(optcatalogo)">
|
||||
<div class="flex-container-book">
|
||||
<q-infinite-scroll
|
||||
v-if="
|
||||
!optcatalogo.pdf && arrLoaded && arrLoaded.length > 0
|
||||
"
|
||||
v-if="!optcatalogo.pdf && arrLoaded && arrLoaded.length > 0"
|
||||
ref="myinfscroll"
|
||||
:initial-index="0"
|
||||
@load="onLoadScroll"
|
||||
@@ -276,14 +322,14 @@
|
||||
class="row items-start"
|
||||
style="place-content: center"
|
||||
>
|
||||
<div v-for="(product, index) in arrLoaded" :key="index">
|
||||
<div
|
||||
v-for="(product, index) in arrLoaded"
|
||||
:key="index"
|
||||
>
|
||||
<CContainerCatalogoCard
|
||||
v-if="
|
||||
product.active ||
|
||||
(show_hide &&
|
||||
product.productInfo.productTypes.includes(
|
||||
shared_consts.PRODUCTTYPE.PRODUCT
|
||||
))
|
||||
(show_hide && product.productInfo.productTypes.includes(shared_consts.PRODUCTTYPE.PRODUCT))
|
||||
"
|
||||
:id="product._id"
|
||||
:product="product"
|
||||
@@ -310,16 +356,20 @@
|
||||
</div>
|
||||
<template v-slot:loading>
|
||||
<div class="text-center">
|
||||
<q-spinner-dots color="primary" size="40px" />
|
||||
<q-spinner-dots
|
||||
color="primary"
|
||||
size="40px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</q-infinite-scroll>
|
||||
<div v-else class="cards-container">
|
||||
<div
|
||||
v-else
|
||||
class="cards-container"
|
||||
>
|
||||
<!-- Itera sulle schede -->
|
||||
<div
|
||||
v-for="(
|
||||
recscheda, schedaIndex
|
||||
) in optcatalogo.arrSchede"
|
||||
v-for="(recscheda, schedaIndex) in optcatalogo.arrSchede"
|
||||
:key="schedaIndex"
|
||||
>
|
||||
<div v-if="recscheda && recscheda.scheda">
|
||||
@@ -335,23 +385,34 @@
|
||||
'fixed-height': true,
|
||||
'card-page': false,
|
||||
}"
|
||||
:style="
|
||||
generateStylePageScheda(
|
||||
optcatalogo,
|
||||
recscheda.scheda
|
||||
)
|
||||
"
|
||||
:style="generateStylePageScheda(optcatalogo, recscheda.scheda)"
|
||||
>
|
||||
<div
|
||||
v-if="
|
||||
recscheda.scheda.dimensioni.pagina?.testo_up
|
||||
?.contenuto
|
||||
"
|
||||
v-if="recscheda.scheda.dimensioni.pagina?.testo_title?.contenuto"
|
||||
:style="{
|
||||
'--scalecatalog': tools.getScale(optcatalogo),
|
||||
'line-height':
|
||||
recscheda.scheda.dimensioni.pagina?.testo_up
|
||||
?.font.line_height,
|
||||
'line-height': recscheda.scheda.dimensioni.pagina?.testo_title?.font.line_height,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
position: 'relative', // Posizionamento assoluto
|
||||
top: '0', // Posiziona in alto
|
||||
left: '50%', // Centra orizzontalmente
|
||||
transform: 'translateX(-50%)', // Correzione per centrare perfettamente
|
||||
width: '100%', // Assicura che il contenitore occupi l'intera larghezza
|
||||
textAlign: 'center', // Allinea il testo al centro
|
||||
zIndex: '10', // Assicura che il testo sia visibile sopra altri elementi
|
||||
}"
|
||||
>
|
||||
<div
|
||||
v-html="getTitoloPagina(null, recscheda)"
|
||||
style="display: flex; flex-direction: row; justify-content: center"
|
||||
></div>
|
||||
</div>
|
||||
<div
|
||||
v-if="recscheda.scheda.dimensioni.pagina?.testo_up?.contenuto"
|
||||
:style="{
|
||||
'--scalecatalog': tools.getScale(optcatalogo),
|
||||
'line-height': recscheda.scheda.dimensioni.pagina?.testo_up?.font.line_height,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
}"
|
||||
@@ -401,9 +462,7 @@
|
||||
@selauthor="selauthor"
|
||||
/>
|
||||
<CProductCard
|
||||
v-else-if="
|
||||
prod && (prod.active || show_hide)
|
||||
"
|
||||
v-else-if="prod && (prod.active || show_hide)"
|
||||
:id="prod._id"
|
||||
:complete="false"
|
||||
:cosa="cosa"
|
||||
@@ -414,18 +473,13 @@
|
||||
|
||||
<!-- Separatore -->
|
||||
<div
|
||||
v-if="
|
||||
recscheda.scheda?.show_separatore &&
|
||||
rowIndex !== page.length - 1
|
||||
"
|
||||
v-if="recscheda.scheda?.show_separatore && rowIndex !== page.length - 1"
|
||||
class="text-center"
|
||||
:style="getStyleRow(recscheda)"
|
||||
>
|
||||
<q-separator
|
||||
inset
|
||||
:size="
|
||||
tools.adjustSize(optcatalogo, '1px')
|
||||
"
|
||||
:size="tools.adjustSize(optcatalogo, '1px')"
|
||||
></q-separator>
|
||||
</div>
|
||||
</div>
|
||||
@@ -446,9 +500,7 @@
|
||||
optcatalogo.last_page.text_html &&
|
||||
optcatalogo.last_page.text_html.contenuto
|
||||
"
|
||||
:style="
|
||||
generateStyleByPageDim(optcatalogo, optcatalogo.last_page)
|
||||
"
|
||||
:style="generateStyleByPageDim(optcatalogo, optcatalogo.last_page)"
|
||||
>
|
||||
<div v-html="optcatalogo.last_page.text_html.contenuto"></div>
|
||||
</div>
|
||||
@@ -461,19 +513,13 @@
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div>
|
||||
Sfondo:
|
||||
{{
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
|
||||
}}
|
||||
{{ tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile }}
|
||||
</div>
|
||||
|
||||
<q-img
|
||||
v-if="optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile"
|
||||
:src="
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
|
||||
tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
|
||||
"
|
||||
>
|
||||
</q-img>
|
||||
@@ -483,37 +529,17 @@
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div>
|
||||
Prima Pagina:
|
||||
{{
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.first_page.imgsfondo.imagefile
|
||||
}}
|
||||
{{ tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.first_page.imgsfondo.imagefile }}
|
||||
</div>
|
||||
|
||||
<q-img
|
||||
:src="
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.first_page.imgsfondo.imagefile
|
||||
"
|
||||
>
|
||||
<q-img :src="tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.first_page.imgsfondo.imagefile">
|
||||
</q-img>
|
||||
<div>
|
||||
Ultima Pagina:
|
||||
{{
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.last_page.imgsfondo.imagefile
|
||||
}}
|
||||
{{ tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.last_page.imgsfondo.imagefile }}
|
||||
</div>
|
||||
|
||||
<q-img
|
||||
:src="
|
||||
tools.getDirUpload() +
|
||||
costanti.DIR_CATALOGO +
|
||||
optcatalogo.last_page.imgsfondo.imagefile
|
||||
"
|
||||
>
|
||||
<q-img :src="tools.getDirUpload() + costanti.DIR_CATALOGO + optcatalogo.last_page.imgsfondo.imagefile">
|
||||
</q-img>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
@@ -528,6 +554,12 @@
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="opzioni">
|
||||
<q-btn
|
||||
rounded
|
||||
label="Genera Lista Libri"
|
||||
color="primary"
|
||||
@click="generaListaLibri()"
|
||||
></q-btn>
|
||||
<pre>
|
||||
<strong>PASSI DA COMPIERE PER FARE AGGIORNAMENTI :</strong>
|
||||
|
||||
@@ -606,9 +638,8 @@
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./catalogo.ts">
|
||||
</script>
|
||||
<script lang="ts" src="./catalogo.ts"></script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "./catalogo.scss";
|
||||
@import './catalogo.scss';
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user