- ordinamento tabella titoli
- migliorata la lista degli argomenti
This commit is contained in:
@@ -257,7 +257,7 @@
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
|
||||
<q-item
|
||||
<!--<q-item
|
||||
v-if="
|
||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||
"
|
||||
@@ -276,6 +276,7 @@
|
||||
<q-item-label>Vedi Numero di Pagine (Da GM)</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
-->
|
||||
|
||||
<q-item
|
||||
v-if="
|
||||
|
||||
@@ -1576,6 +1576,15 @@
|
||||
icon="fas fa-play-circle"
|
||||
>
|
||||
<div class="column">
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.showListaArgomenti"
|
||||
color="positive"
|
||||
icon="fas fa-file-pdf"
|
||||
label="Mostra Lista Argomenti"
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
|
||||
<q-toggle
|
||||
v-model="myel.catalogo.pdf"
|
||||
color="positive"
|
||||
|
||||
@@ -72,6 +72,10 @@ export default defineComponent({
|
||||
|
||||
const modifOn = ref(false)
|
||||
|
||||
const sortAttribute = ref('')
|
||||
const sortDirection = ref(1)
|
||||
|
||||
|
||||
const optionscatalogo = ref(<any>{maxlength: 0})
|
||||
|
||||
const editOn = computed({
|
||||
@@ -255,6 +259,37 @@ export default defineComponent({
|
||||
|
||||
}
|
||||
|
||||
const sortTable = (sortAttributeToSort: string) => {
|
||||
|
||||
if (!props.optcatalogo.showListaArgomenti)
|
||||
return false
|
||||
|
||||
if (sortAttributeToSort) {
|
||||
if (sortAttribute.value === sortAttributeToSort) {
|
||||
sortDirection.value = -sortDirection.value
|
||||
} else {
|
||||
sortAttribute.value = sortAttributeToSort
|
||||
sortDirection.value = 1
|
||||
}
|
||||
internalProducts.value = internalProducts.value.sort((a: any, b: any) => {
|
||||
const aVal = a.productInfo?.[sortAttributeToSort] ?? ''
|
||||
const bVal = b.productInfo?.[sortAttributeToSort] ?? ''
|
||||
if (aVal instanceof Date && bVal instanceof Date) {
|
||||
return sortDirection.value === 1 ? aVal.getTime() - bVal.getTime() : bVal.getTime() - aVal.getTime()
|
||||
}
|
||||
if (typeof aVal === 'number' && typeof bVal === 'number') {
|
||||
return sortDirection.value === 1 ? aVal - bVal : bVal - aVal
|
||||
}
|
||||
if (typeof aVal === 'string' && typeof bVal === 'string') {
|
||||
return sortDirection.value === 1 ? aVal.localeCompare(bVal) : bVal.localeCompare(aVal)
|
||||
}
|
||||
return sortDirection.value === 1 ? String(aVal).localeCompare(String(bVal)) : String(bVal).localeCompare(String(aVal))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -287,6 +322,9 @@ export default defineComponent({
|
||||
optionscatalogo,
|
||||
t,
|
||||
products,
|
||||
sortTable,
|
||||
sortAttribute,
|
||||
sortDirection,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -25,8 +25,21 @@
|
||||
<th
|
||||
v-if="isColumnVisible(col.name)"
|
||||
:key="col.name"
|
||||
@click="sortTable(col.name)"
|
||||
>
|
||||
{{ col.label }}
|
||||
<q-icon
|
||||
v-if="(sortAttribute === col.name) && optcatalogo.showListaArgomenti"
|
||||
:name="sortDirection === 1 ? 'arrow_drop_up' : 'arrow_drop_down'"
|
||||
size="16px"
|
||||
class="q-ml-xs"
|
||||
/>
|
||||
<q-icon
|
||||
v-else-if="optcatalogo.showListaArgomenti"
|
||||
name="arrow_drop_up"
|
||||
size="16px"
|
||||
class="q-ml-xs"
|
||||
/>
|
||||
</th>
|
||||
</template>
|
||||
</tr>
|
||||
|
||||
@@ -23,6 +23,7 @@ import type {
|
||||
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
import Products from 'app/src/rootgen/admin/products/products.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CSearchProduct',
|
||||
@@ -254,7 +255,9 @@ export default defineComponent({
|
||||
if (!productStore.isPubblicatoById(rec.productInfo.idStatoProdotto))
|
||||
label += ' (' + productStore.getDescrStatiProdottoByIdStatoProdotto(rec.productInfo.idStatoProdotto || '') + ')'
|
||||
}
|
||||
|
||||
if (productStore.isEsaurito(rec)) {
|
||||
label += ' (Attualmente non disponibile)'
|
||||
}
|
||||
// console.log('Computed label:', label)
|
||||
}
|
||||
return label
|
||||
|
||||
@@ -861,6 +861,7 @@ export interface IOptCatalogo {
|
||||
printable?: boolean
|
||||
indebug?: boolean
|
||||
maxnumlibri?: number
|
||||
showListaArgomenti?: boolean
|
||||
generazionePDFInCorso?: boolean
|
||||
|
||||
first_page?: IDimensioni
|
||||
|
||||
@@ -190,7 +190,7 @@ export interface IProductsState {
|
||||
productInfos: IProductInfo[]
|
||||
userActive: IUserShort
|
||||
|
||||
isPubblicatoById: (idStatoProdotto: number) => boolean;
|
||||
isPubblicatoById?: (idStatoProdotto: number) => boolean;
|
||||
}
|
||||
|
||||
export interface IProducer {
|
||||
|
||||
@@ -130,18 +130,18 @@ export const useProducts = defineStore('Products', {
|
||||
},
|
||||
|
||||
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 100
|
||||
return product?.arrvariazioni?.[0]?.quantita > 100
|
||||
},
|
||||
|
||||
isQtaLimitata: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 50 && product.arrvariazioni[0].quantita < 100
|
||||
return product?.arrvariazioni?.[0]?.quantita > 50 && product?.arrvariazioni?.[0]?.quantita < 100
|
||||
},
|
||||
|
||||
isInEsaurendo: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita > 0 && product.arrvariazioni[0].quantita < 50
|
||||
return product?.arrvariazioni?.[0]?.quantita > 0 && product.arrvariazioni?.[0]?.quantita < 50
|
||||
},
|
||||
isEsaurito: (state: IProductsState) => (product: IProduct): boolean => {
|
||||
return product.arrvariazioni[0].quantita <= 0
|
||||
return product?.arrvariazioni?.[0]?.quantita <= 0
|
||||
},
|
||||
|
||||
isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
||||
|
||||
@@ -32,22 +32,6 @@ body {
|
||||
}
|
||||
|
||||
|
||||
// Underline like a href
|
||||
.category {
|
||||
color: darkblue;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 19px;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.category_sel {
|
||||
color: white !important;
|
||||
background: #5c8ef4 !important;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
font-weight: bold;
|
||||
font-size: 1.1rem;
|
||||
@@ -59,10 +43,13 @@ body {
|
||||
}
|
||||
|
||||
.fixed-width {
|
||||
width: var(--width) !important; /* Usa una variabile CSS */
|
||||
width: var(--width) !important;
|
||||
/* Usa una variabile CSS */
|
||||
}
|
||||
|
||||
.fixed-height {
|
||||
height: var(--height) !important; /* Usa una variabile CSS */
|
||||
height: var(--height) !important;
|
||||
/* Usa una variabile CSS */
|
||||
}
|
||||
|
||||
.break {
|
||||
@@ -96,6 +83,7 @@ body {
|
||||
margin-bottom: calc(5 * var(--scalecatalog) * 1px);
|
||||
font-size: calc(16 * var(--scalecatalog) * 1px);
|
||||
text-align: left !important;
|
||||
|
||||
&.big {
|
||||
font-size: calc(22 * var(--scalecatalog) * 1px);
|
||||
}
|
||||
@@ -125,6 +113,7 @@ body {
|
||||
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);
|
||||
@@ -138,3 +127,40 @@ body {
|
||||
font-size: calc(35 * var(--scalecatalog) * 1px);
|
||||
height: calc(100 * var(--scalecatalog) * 1px);
|
||||
}
|
||||
|
||||
.categories {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
border-radius: 24px;
|
||||
background-color: #e6f0ff;
|
||||
}
|
||||
|
||||
.category {
|
||||
font-family: 'Segoe UI', Arial, sans-serif;
|
||||
font-size: 0.95rem;
|
||||
padding: 8px 16px;
|
||||
background-color: white;
|
||||
color: #2c3e50;
|
||||
border: 1px solid #b0c4de;
|
||||
border-radius: 20px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease-in-out;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.category:hover {
|
||||
background-color: #dbe9ff;
|
||||
color: #1a3f8a;
|
||||
border-color: #89aef0;
|
||||
}
|
||||
|
||||
.category_sel {
|
||||
background-color: #5c8ef4 !important;
|
||||
color: white !important;
|
||||
font-weight: 600;
|
||||
border-color: #5c8ef4 !important;
|
||||
box-shadow: 0 0 0 2px rgba(92, 142, 244, 0.3);
|
||||
}
|
||||
|
||||
@@ -200,6 +200,10 @@ export default defineComponent({
|
||||
return !!getCatalogoByMyPage.value
|
||||
})
|
||||
|
||||
const showListaArgomenti = computed(() => {
|
||||
return optcatalogo.value.showListaArgomenti
|
||||
})
|
||||
|
||||
// Register the scroll event on component mount
|
||||
const handleScroll = () => {
|
||||
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
||||
@@ -572,10 +576,14 @@ export default defineComponent({
|
||||
// Se nel catalogo è stato già generato, allora gli passo quello.
|
||||
const trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
if (trovatocatalogo?.lista_prodotti.length === 0) {
|
||||
if (optcatalogo.value.showListaArgomenti) {
|
||||
generalista = true
|
||||
}
|
||||
|
||||
/*if (trovatocatalogo?.lista_prodotti.length === 0) {
|
||||
generalista = true
|
||||
}*/
|
||||
|
||||
if (!generalista && (trovatocatalogo?.lista_prodotti.length > 0)) {
|
||||
arrprod = trovatocatalogo?.lista_prodotti
|
||||
} else {
|
||||
@@ -604,7 +612,7 @@ export default defineComponent({
|
||||
// console.log('arrprod', arrprod)
|
||||
|
||||
populateDataWithlinkIdTemplate();
|
||||
generatearrProdToViewSorted(!generalista, salva);
|
||||
generatearrProdToViewSorted(!generalista, salva, !optcatalogo.value.showListaArgomenti);
|
||||
loaddata();
|
||||
|
||||
refreshpage.value = false;
|
||||
@@ -754,7 +762,7 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function generatearrProdToViewSorted(usaprodottiSalvati?: boolean, salva?: boolean) {
|
||||
function generatearrProdToViewSorted(usaprodottiSalvati?: boolean, salva?: boolean, salvasudb?: boolean) {
|
||||
console.log('generatearrProdToViewSorted... usaprodottiSalvati=', usaprodottiSalvati, ' salva=', salva)
|
||||
|
||||
try {
|
||||
@@ -880,9 +888,11 @@ export default defineComponent({
|
||||
if (trovatocatalogo) {
|
||||
trovatocatalogo.lista_prodotti = arrprod
|
||||
|
||||
if (salvasudb) {
|
||||
salvaListaProdotti(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Err', e)
|
||||
@@ -901,7 +911,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
// Salva gli ID dei prodotti nel catalogo
|
||||
tools.saveFieldToServer($q, 'catalogs', getCatalogoByMyPage.value._id, mydata, true, false)
|
||||
tools.saveFieldToServer($q, 'catalogs', getCatalogoByMyPage.value._id, mydata, !optcatalogo.value.showListaArgomenti, false)
|
||||
|
||||
|
||||
if (ricarica) {
|
||||
@@ -1244,7 +1254,10 @@ export default defineComponent({
|
||||
if (getCatalogoByMyPage.value) {
|
||||
getCatalogoByMyPage.value.lista_prodotti = [...arr]
|
||||
|
||||
if (optcatalogo.value.showListaArgomenti)
|
||||
salvaListaProdotti(true)
|
||||
else
|
||||
generatearrProdToViewSorted(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1332,6 +1345,7 @@ export default defineComponent({
|
||||
clickaddNewBook,
|
||||
addProductToList,
|
||||
addnewProd,
|
||||
showListaArgomenti,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -62,7 +62,35 @@
|
||||
name="lista"
|
||||
v-if="optcatalogo"
|
||||
>
|
||||
<q-tab-panel
|
||||
v-if="showListaArgomenti"
|
||||
name="categorie"
|
||||
>
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div class="categories">
|
||||
<div
|
||||
v-for="(reccat, index) in getCatProds()"
|
||||
:key="index"
|
||||
class="category"
|
||||
:class="{ category_sel: cat === reccat.value }"
|
||||
@click="cat = reccat.value"
|
||||
>
|
||||
{{ reccat.label }}
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
|
||||
<q-btn
|
||||
v-if="!showListaArgomenti"
|
||||
rounded
|
||||
label="Rigenera Ordinamento Libri"
|
||||
color="primary"
|
||||
@@ -70,6 +98,7 @@
|
||||
></q-btn>
|
||||
|
||||
<q-btn
|
||||
v-if="!showListaArgomenti"
|
||||
rounded
|
||||
label="Aggiungi"
|
||||
icon="fas fa-plus"
|
||||
@@ -103,7 +132,7 @@
|
||||
>
|
||||
<div class="container">
|
||||
<q-tabs
|
||||
v-if="!ispageCatalogata"
|
||||
v-if="showListaArgomenti"
|
||||
v-model="tabvisu"
|
||||
dense
|
||||
class="bg-indigo text-white"
|
||||
@@ -121,7 +150,7 @@
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
v-if="!ispageCatalogata"
|
||||
v-if="showListaArgomenti"
|
||||
name="autori"
|
||||
icon="fas fa-user"
|
||||
label="Autori"
|
||||
@@ -134,7 +163,7 @@
|
||||
>
|
||||
</q-tab>
|
||||
<q-tab
|
||||
v-if="!ispageCatalogata"
|
||||
v-if="showListaArgomenti"
|
||||
name="ricerca"
|
||||
icon="fas fa-search"
|
||||
label="Cerca"
|
||||
@@ -154,23 +183,20 @@
|
||||
keep-alive
|
||||
>
|
||||
<q-tab-panel
|
||||
v-if="!ispageCatalogata"
|
||||
v-if="showListaArgomenti"
|
||||
name="categorie"
|
||||
>
|
||||
<div class="row justify-center q-mx-auto bg-blue-1">
|
||||
<div class="categories">
|
||||
<div
|
||||
v-for="(reccat, index) in getCatProds()"
|
||||
:key="index"
|
||||
>
|
||||
<span
|
||||
:class="{
|
||||
category: true,
|
||||
category_sel: cat === reccat.value,
|
||||
}"
|
||||
class="category"
|
||||
:class="{ category_sel: cat === reccat.value }"
|
||||
@click="cat = reccat.value"
|
||||
>{{ reccat.label }}
|
||||
</span>
|
||||
|
|
||||
>
|
||||
{{ reccat.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-tab-panel>
|
||||
@@ -261,7 +287,7 @@
|
||||
</q-tab-panels>
|
||||
|
||||
<div
|
||||
v-if="!ispageCatalogata"
|
||||
v-if="showListaArgomenti"
|
||||
class="row justify-center q-mx-auto"
|
||||
>
|
||||
<q-select
|
||||
|
||||
Reference in New Issue
Block a user