- modifiche al catalogo

- tolta la richiesta di accettazione dei RIS, che ora vengono accettati automaticamente.
This commit is contained in:
Surya Paolo
2024-07-03 13:22:57 +02:00
parent 2ffcf56625
commit 8e711d0f63
50 changed files with 1882 additions and 1390 deletions

View File

@@ -21,7 +21,7 @@ import { fieldsTable } from '@store/Modules/fieldsTable'
export default defineComponent({
name: 'Catalogo',
components: { CContainerCatalogoCard, CProductCard, CSelectUserActive, CMySelect },
props: {
props: {
optcatalogo: {
type: Object as PropType<ICatalogo>,
required: false,
@@ -48,6 +48,7 @@ export default defineComponent({
const filter = ref(<any>{
author: '',
sort: 1,
publisher: '',
type: '',
ageGroup: ''
@@ -135,6 +136,14 @@ export default defineComponent({
}
})
watch(() => filter.value.sort, (newval, oldval) => {
calcArrProducts()
if (tools.scrollTop() > 300) {
tools.scrollToTopValue(300)
}
})
watch(() => cosa.value, (newval, oldval) => {
tools.setCookie(tools.COOK_COSA_PRODOTTI, cosa.value.toString())
if (cosa.value !== shared_consts.PROD.TUTTI)
@@ -146,7 +155,7 @@ export default defineComponent({
const mialista = getSearchList()
if (mialista && mialista.value && mialista.value.hasOwnProperty('name')) {
mialista.value = null
}
}
search.value = ''
}
@@ -170,6 +179,7 @@ export default defineComponent({
let arrprod = productStore.getProducts(cosa.value) || [];
let filtroAuthor = filter.value.author || '';
//++AddCATALOGO_FIELDS
let filtroProductTypes = props.optcatalogo.productTypes || [0]
@@ -177,6 +187,9 @@ export default defineComponent({
let boolfiltroVuotoProductTypes = (filtroProductTypes.length === 0 || (filtroProductTypes.length === 1 && (filtroProductTypes[0] === 0)))
let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0
let filtroPublishers = props.optcatalogo.Editore || []
let boolfiltroVuotoEditore = (filtroPublishers.length === 0)
//console.log('filtroVersione', filtroProductTypes)
let catstr = cat.value || ''
@@ -187,7 +200,7 @@ export default defineComponent({
}
let lowerSearchText = (searchtext || '').toLowerCase().trim();
lowerSearchText = lowerSearchText.replace(/[-@:=]/g, '');
if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) {
if ((!lowerSearchText || (lowerSearchText && lowerSearchText.length < 2)) && !catstr && boolfiltroVuotoProductTypes && boolfiltroVuotoExcludeProductTypes && boolfiltroVuotoEditore && !filtroAuthor && (!gasselstr && (cosa.value !== shared_consts.PROD.GAS))) {
} else {
@@ -198,6 +211,7 @@ export default defineComponent({
let hasAuthor = !filtroAuthor || (filtroAuthor && (product.productInfo.idAuthors || []).includes(filtroAuthor));
let hasProductTypes = true
let hasPublished = true
let hasExcludeProductTypes = false
//++AddCATALOGO_FIELDS
@@ -206,6 +220,9 @@ export default defineComponent({
// check if productInfo.productTypes array includes some item in props.optcatalogo.ProductTypes array
hasProductTypes = !props.optcatalogo.productTypes || (props.optcatalogo.productTypes && (product.productInfo.productTypes || []).some((item: any) => props.optcatalogo.productTypes.includes(item)))
}
if (props.optcatalogo && !boolfiltroVuotoEditore) {
hasPublished = !props.optcatalogo.Editore || (props.optcatalogo.Editore && props.optcatalogo.Editore.includes(product.productInfo.idPublisher!))
}
if (props.optcatalogo && !boolfiltroVuotoExcludeProductTypes) {
// check if productInfo.productTypes array exclude some item in props.optcatalogo.ProductTypes array
@@ -224,7 +241,7 @@ export default defineComponent({
// Check if all words in lowerSearchText are present in lowerName
let allWordsPresent = lowerSearchText.split(/\s+/).every(word => new RegExp(`\\b${word}\\b`, 'i').test(lowerName));
return (codeMatch.test(product.productInfo.code || '') || allWordsPresent) && hasCategoria && hasAuthor && productgassel && hasProductTypes && !hasExcludeProductTypes;
return (codeMatch.test(product.productInfo.code || '') || allWordsPresent) && hasCategoria && hasAuthor && productgassel && hasProductTypes && hasPublished && !hasExcludeProductTypes;
} else {
console.error('product or product.productInfo is null');
return false;
@@ -232,6 +249,18 @@ export default defineComponent({
});
}
console.log('filter.value.sort', filter.value.sort)
// sort using filter.value.sort :
if (filter.value.sort === costanti.SORT_PUBDATE) {
arrprod = arrprod.sort((a: IProduct, b: IProduct) => {
return b.productInfo.date_publishing_ts - a.productInfo.date_publishing_ts
})
} else if (filter.value.sort === costanti.SORT_ALPHA) {
}
arrProducts.value = arrprod
loaddata()
refreshpage.value = false
@@ -404,6 +433,7 @@ export default defineComponent({
labelcombo,
mycolumns,
tabvisu,
getSearchText,
}
}
})

View File

@@ -8,9 +8,15 @@
<div class="container">
<q-tabs v-model="tabvisu" dense class="bg-indigo text-white">
<q-tab name="categorie" icon="fas fa-folder-open" label="Categorie" />
<q-tab name="autori" icon="fas fa-user" label="Autori" />
<q-tab name="ricerca" icon="fas fa-search" label="Cerca" />
<q-tab name="categorie" icon="fas fa-folder-open" label="Categorie">
<q-badge v-if="cat" color="red" floating>1</q-badge>
</q-tab>
<q-tab name="autori" icon="fas fa-user" label="Autori">
<q-badge v-if="filter.author" color="red" floating>1</q-badge>
</q-tab>
<q-tab name="ricerca" icon="fas fa-search" label="Cerca">
<q-badge v-if="getSearchText()" color="red" floating>1</q-badge>
</q-tab>
</q-tabs>
<q-tab-panels v-model="tabvisu" animated class="">
<q-tab-panel name="categorie">
@@ -133,6 +139,22 @@
</div>
</q-tab-panel>
</q-tab-panels>
<div class="row justify-center q-mx-auto">
<q-select
v-model="filter.sort"
dense
:options="costanti.ORDINAMENTO_CATALOGHI"
label="Ordinamento"
placeholder=""
emit-value
map-options
filled
rounded
></q-select>
</div>
<div class="text-center q-py-sm prod_trov">
<span v-show="productStore.getNumProdTot() !== arrProducts.length">{{
t('ecomm.prodotti_trovati', {
@@ -175,7 +197,6 @@
productInfo.productTypes.includes(
shared_consts.PRODUCTTYPE.PRODUCT
))
"
:id="product._id"
:complete="false"

View File

@@ -5,6 +5,7 @@ import { useI18n } from '@/boot/i18n'
import { useQuasar } from 'quasar'
import { CMyCardPopup } from '@/components/CMyCardPopup'
import { CMyCardService } from '@/components/CMyCardService'
import { shared_consts } from '@src/common/shared_vuejs'
import { CMyPage } from '@/components/CMyPage'
import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged'
import { toolsext } from '@store/Modules/toolsext'
@@ -27,6 +28,7 @@ export default defineComponent({
idBacheca,
toolsext,
tools,
shared_consts,
}
}
})

View File

@@ -8,6 +8,7 @@ import { CMyPage } from '@/components/CMyPage'
import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged'
import { toolsext } from '@store/Modules/toolsext'
import { tools } from '@store/Modules/tools'
import { shared_consts } from '@src/common/shared_vuejs'
export default defineComponent({
name: 'mypagehosp',
@@ -26,6 +27,7 @@ export default defineComponent({
idHosp,
toolsext,
tools,
shared_consts,
}
}
})