aggiornamento cataloghi, search

This commit is contained in:
Surya Paolo
2025-04-22 18:30:42 +02:00
parent 6d0efaadb9
commit ae4efab0f3
18 changed files with 117 additions and 27 deletions

View File

@@ -2407,6 +2407,7 @@ export const shared_consts = {
{ label: 'Venduti Ultimi 2 Anni', value: 'vLast2Y' }, { label: 'Venduti Ultimi 2 Anni', value: 'vLast2Y' },
{ label: 'Fatturati Ultimi 3 Mesi', value: 'fatLast3M' }, { label: 'Fatturati Ultimi 3 Mesi', value: 'fatLast3M' },
{ label: 'Fatturati Ultimi 6 Mesi', value: 'fatLast6M' }, { label: 'Fatturati Ultimi 6 Mesi', value: 'fatLast6M' },
{ label: 'Fatturati Ultimo Anno', value: 'fatLast1Y' },
{ label: 'Data Ultimo Ordine', value: 'dataUltimoOrdine' }, { label: 'Data Ultimo Ordine', value: 'dataUltimoOrdine' },
], ],

View File

@@ -93,10 +93,6 @@ export default defineComponent({
const myCatRef = ref(<any>null) const myCatRef = ref(<any>null)
const searchList_Cataloghi = ref(<ISearchList[]>
tools.getsearchList_Cataloghi()
)
/* /*
const idSectorServizi = computed(() => { const idSectorServizi = computed(() => {
let myval: any = null let myval: any = null
@@ -210,7 +206,6 @@ export default defineComponent({
clickButtBar, clickButtBar,
myCatRef, myCatRef,
table, table,
searchList_Cataloghi,
} }
}, },
}) })

View File

@@ -25,7 +25,7 @@
:noresultLabel="t('grid.nosearchfound')" :noresultLabel="t('grid.nosearchfound')"
:arrfilters="arrfilterand" :arrfilters="arrfilterand"
:filtercustom="filtercustom" :filtercustom="filtercustom"
:prop_searchList="searchList_Cataloghi" :prop_searchList="tools.getsearchList_Cataloghi()"
:defaultnewrec="tools.getdefaultnewrec(table)" :defaultnewrec="tools.getdefaultnewrec(table)"
labelBtnAddRow="NONE" labelBtnAddRow="NONE"
:prop_SortFieldsAvailable="mySortFieldsAvailable()" :prop_SortFieldsAvailable="mySortFieldsAvailable()"

View File

@@ -650,10 +650,11 @@ export default defineComponent({
field_updated_fromGM.value = '' field_updated_fromGM.value = ''
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!, myproduct.value.isbn) const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!, myproduct.value.isbn)
if (ris) { if (ris) {
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false) await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
updatefromgm.value = false
} }
loading.value = false loading.value = false
} }
@@ -666,10 +667,11 @@ export default defineComponent({
field_updated_fromGM.value = '' field_updated_fromGM.value = ''
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options, caricatutti: true }) const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options, caricatutti: true })
if (ris) { if (ris) {
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false) await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
updatefromgm.value = false
} }
loading.value = false loading.value = false
} }
@@ -682,10 +684,11 @@ export default defineComponent({
field_updated_fromGM.value = '' field_updated_fromGM.value = ''
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options }) const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options })
if (ris) { if (ris) {
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false) await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
updatefromgm.value = false
} }
loading.value = false loading.value = false
} }

View File

@@ -676,7 +676,7 @@
nameTable: 'T_Web_Articoli', nameTable: 'T_Web_Articoli',
campispeciali: true, campispeciali: true,
numrec: 1, numrec: 1,
where: 'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = ' + myproduct.productInfo.code, where: 'T.IdArticolo =' + myproduct.productInfo.sku + ' AND T.Ean13 = \'' + myproduct.productInfo.code + '\'',
showQtaDisponibile, showQtaDisponibile,
outhtml: true, outhtml: true,
}" }"

View File

@@ -100,6 +100,7 @@
v-show="searchList" v-show="searchList"
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `" :class="$q.screen.lt.sm ? `` : `row` + ` text-blue `"
> >
<span v-for="(item, index) in searchList" :key="index"> <span v-for="(item, index) in searchList" :key="index">
<div <div
class="text-center q-my-xs" class="text-center q-my-xs"
@@ -119,6 +120,7 @@
" "
@click="showfilteradv = !showfilteradv" @click="showfilteradv = !showfilteradv"
></q-btn> ></q-btn>
</div> </div>
<div <div

View File

@@ -13,7 +13,7 @@ import { tools } from '@tools'
export default defineComponent({ export default defineComponent({
name: 'CMySelect', name: 'CMySelect',
emits: ['update:value', 'update:arrvalue', 'changeval', 'clear'], emits: ['update:value', 'update:arrvalue', 'changeval', 'clear', 'searchOnGM'],
props: { props: {
options: { options: {
type: Array, type: Array,
@@ -177,6 +177,8 @@ export default defineComponent({
const selectMultiple = ref(null) const selectMultiple = ref(null)
const selectGeneric = ref(null) const selectGeneric = ref(null)
const mystr = ref('')
const valoriload = computed(() => { const valoriload = computed(() => {
return updateArrOptions() return updateArrOptions()
}) })
@@ -596,7 +598,7 @@ export default defineComponent({
let myarr: any = [] let myarr: any = []
const mystr = val.toLocaleLowerCase() mystr.value = val.toLocaleLowerCase()
myarr = updateArrOptions() myarr = updateArrOptions()
if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) { if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) {
@@ -618,7 +620,7 @@ export default defineComponent({
valori.value = myarr.filter((v: any) => { valori.value = myarr.filter((v: any) => {
const mioval = tools.getRecordByField(optlab, v) const mioval = tools.getRecordByField(optlab, v)
if (mioval) if (mioval)
return mioval?.toLowerCase().indexOf(mystr) > -1 return mioval?.toLowerCase().indexOf(mystr.value) > -1
else else
return false return false
@@ -643,7 +645,7 @@ export default defineComponent({
try { try {
// myarr = optionsreal.value // myarr = optionsreal.value
myarr = [] myarr = []
if (mystr !== '' || props.filter_extra) if (mystr.value !== '' || props.filter_extra)
// myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}] // myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}]
/* /*
if (val === '1') { if (val === '1') {
@@ -654,7 +656,7 @@ export default defineComponent({
myarr.push({ _id: 2, comune: 'PROVA 2B', prov: 'AL' }) myarr.push({ _id: 2, comune: 'PROVA 2B', prov: 'AL' })
}*/ { // @ts-ignore }*/ { // @ts-ignore
myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.trim(), filter: props.filter_extra }) myarr = await globalStore.loadPickup({ table: props.tablesel, search: mystr.value.trim(), filter: props.filter_extra })
} }
if (myarr === null) { if (myarr === null) {
@@ -696,6 +698,8 @@ export default defineComponent({
if (props.multiselect_by_server) { if (props.multiselect_by_server) {
// console.log('@@@ VALORI CHANGED (3)', valori.value) // console.log('@@@ VALORI CHANGED (3)', valori.value)
} }
} else {
valori.value = []
} }
console.log('*** OUT: tablesel', props.tablesel, 'filterFn', myarr) console.log('*** OUT: tablesel', props.tablesel, 'filterFn', myarr)
@@ -818,6 +822,11 @@ export default defineComponent({
function clear() { function clear() {
emit('clear') emit('clear')
myvalue.value = '' myvalue.value = ''
mystr.value = ''
}
function searchOnGM(mystr: string) {
emit('searchOnGM', mystr)
} }
onMounted(mounted) onMounted(mounted)
@@ -839,6 +848,8 @@ export default defineComponent({
getLabelValue, getLabelValue,
getOptionLabel, getOptionLabel,
clear, clear,
mystr,
searchOnGM,
} }
} }
}) })

View File

@@ -36,7 +36,21 @@
</template> </template>
<template v-slot:no-option> <template v-slot:no-option>
<q-item> <q-item v-if="mystr">
<q-item-section class="text-grey">
<span
v-if="Number.isInteger(parseInt(mystr))"
@click="searchOnGM(mystr)"
class="clickable-text"
>
Clicca qui per cercarlo su GM
</span>
<span v-else>
Testo non trovato: '{{ mystr }}'
</span>
</q-item-section>
</q-item>
<q-item v-else>
<q-item-section class="text-grey"> Digita il testo da cercare </q-item-section> <q-item-section class="text-grey"> Digita il testo da cercare </q-item-section>
</q-item> </q-item>
</template> </template>
@@ -113,7 +127,21 @@
/> />
</template> </template>
<template v-slot:no-option> <template v-slot:no-option>
<q-item> <q-item v-if="mystr">
<q-item-section class="text-grey">
<span
v-if="Number.isInteger(parseInt(mystr))"
@click="searchOnGM(mystr)"
class="clickable-text text-blue"
>
Clicca qui per cercarlo su GM
</span>
<span v-else>
Testo non trovato: '{{ mystr }}'
</span>
</q-item-section>
</q-item>
<q-item v-else>
<q-item-section class="text-grey"> Digita il testo da cercare </q-item-section> <q-item-section class="text-grey"> Digita il testo da cercare </q-item-section>
</q-item> </q-item>
</template> </template>

View File

@@ -120,6 +120,7 @@ export default defineComponent({
{ name: "totVen", label: "Venduti", field: "totVen", align: "right" }, { name: "totVen", label: "Venduti", field: "totVen", align: "right" },
{ name: "totFat", label: "Fattur.", field: "totFat", align: "right" }, { name: "totFat", label: "Fattur.", field: "totFat", align: "right" },
{ name: "fatLast6M", label: "Fat 6M", field: "fatLast6M", align: "right" }, { name: "fatLast6M", label: "Fat 6M", field: "fatLast6M", align: "right" },
{ name: "fatLast1Y", label: "Fat Anno", field: "fatLast1Y", align: "right" },
{ name: "ult_ord", label: "Ult. Ordine", field: "ult_ord", align: "left" }, { name: "ult_ord", label: "Ult. Ordine", field: "ult_ord", align: "left" },
{ name: "quantity", label: "Magazz.", field: "quantity", align: "right" }, { name: "quantity", label: "Magazz.", field: "quantity", align: "right" },
{ name: "isbn", label: "ISBN", field: "isbn", align: "left" }, { name: "isbn", label: "ISBN", field: "isbn", align: "left" },

View File

@@ -149,6 +149,12 @@
> >
{{ element.productInfo?.fatLast6M }} {{ element.productInfo?.fatLast6M }}
</td> </td>
<td
v-if="isColumnVisible('fatLast1Y')"
style="text-align: right"
>
{{ element.productInfo?.fatLast1Y }}
</td>
<td v-if="isColumnVisible('ult_ord')">{{ tools.getstrDate(element.productInfo?.dataUltimoOrdine) }}</td> <td v-if="isColumnVisible('ult_ord')">{{ tools.getstrDate(element.productInfo?.dataUltimoOrdine) }}</td>
<!-- Quantità --> <!-- Quantità -->

View File

@@ -250,6 +250,11 @@ export default defineComponent({
let label = '' let label = ''
if (rec && rec.productInfo) { if (rec && rec.productInfo) {
label = `${rec.productInfo.name} - ${rec.productInfo.authors.map((a: any) => a.name + ' ' + a.surname).join(', ')}` label = `${rec.productInfo.name} - ${rec.productInfo.authors.map((a: any) => a.name + ' ' + a.surname).join(', ')}`
if (rec.productInfo.idStatoProdotto) {
if (!productStore.isPubblicatoById(rec.productInfo.idStatoProdotto))
label += ' (' + productStore.getDescrStatiProdottoByIdStatoProdotto(rec.productInfo.idStatoProdotto || '') + ')'
}
// console.log('Computed label:', label) // console.log('Computed label:', label)
} }
return label return label
@@ -271,6 +276,25 @@ export default defineComponent({
emit('updateproductmodif', element) emit('updateproductmodif', element)
} }
async function searchOnGM(mystr: string) {
// refreshSingleBookFromGM({usaDBGMLocale: false})
const options = {
}
const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: '', isbn: mystr, ...options })
if (ris) {
const id = getSearchId()
loadProduct(id)
updateproductmodif(myproduct.value)
// await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
// updatefromgm.value = false
}
}
onMounted(mounted) onMounted(mounted)
return { return {
@@ -301,6 +325,7 @@ export default defineComponent({
clickClose, clickClose,
saveSearch, saveSearch,
updateproductmodif, updateproductmodif,
searchOnGM,
} }
} }
}) })

View File

@@ -40,6 +40,7 @@
:filter="item.filter" :filter="item.filter"
:filter_extra="item.filter_extra" :filter_extra="item.filter_extra"
:useinput="item.useinput && item.type !== costanti.FieldType.select_by_server" :useinput="item.useinput && item.type !== costanti.FieldType.select_by_server"
@searchOnGM="searchOnGM"
@clear=" @clear="
item.value = ''; item.value = '';
myproduct = null; myproduct = null;

View File

@@ -189,6 +189,8 @@ export interface IProductsState {
subcatprods: ISubCatProd[] subcatprods: ISubCatProd[]
productInfos: IProductInfo[] productInfos: IProductInfo[]
userActive: IUserShort userActive: IUserShort
isPubblicatoById: (idStatoProdotto: number) => boolean;
} }
export interface IProducer { export interface IProducer {

View File

@@ -9815,7 +9815,7 @@ export const tools = {
}, },
getsearchList_Cataloghi() { getsearchList_Cataloghi() {
return [{ const lista = [{
visible: true, visible: true,
label: 'Editore', label: 'Editore',
table: 'lista_editori', table: 'lista_editori',
@@ -9825,11 +9825,15 @@ export const tools = {
keycookie: '', keycookie: '',
addall: true, addall: true,
arrvalue: [], arrvalue: [],
filter: () => { }, filter: null,
useinput: false, useinput: false,
icon: 'fas fa-user' icon: 'fas fa-user'
}] }]
console.log('getsearchList_Cataloghi', lista)
return lista
}, },
existProp(obj: any, prop: string) { existProp(obj: any, prop: string) {

View File

@@ -144,8 +144,8 @@ export const useProducts = defineStore('Products', {
return product.arrvariazioni[0].quantita <= 0 return product.arrvariazioni[0].quantita <= 0
}, },
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => { isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
switch (productInfo?.idStatoProdotto) { switch (idStatoProdotto) {
case 1: case 1:
case 4: case 4:
case 34: case 34:
@@ -158,6 +158,10 @@ export const useProducts = defineStore('Products', {
} }
}, },
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
return state.isPubblicatoById(productInfo.idStatoProdotto)
},
getDescrStatiProdottoByIdStatoProdotto: (state: IProductsState) => (idStatoProdotto: number): string => { getDescrStatiProdottoByIdStatoProdotto: (state: IProductsState) => (idStatoProdotto: number): string => {
const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto) const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto)
return (ctrec) ? ctrec.Descrizione : '' return (ctrec) ? ctrec.Descrizione : ''

View File

@@ -229,7 +229,7 @@ export const useUserStore = defineStore('UserStore', {
return (this.servercode === toolsext.ERR_SERVERFETCH) return (this.servercode === toolsext.ERR_SERVERFETCH)
}, },
getListaEditori: (state: IUserState) => { listaEditori: (state: IUserState): any => {
return state.lista_editori return state.lista_editori
}, },

View File

@@ -456,7 +456,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
else if (table === 'friends') else if (table === 'friends')
return userStore.my.profile.friends return userStore.my.profile.friends
else if (table === 'lista_editori') { else if (table === 'lista_editori') {
ris = userStore.getListaEditori ris = userStore.listaEditori
} else if (table === 'friendsandme') } else if (table === 'friendsandme')
return [{ username: userStore.my.username }, ...userStore.my.profile.friends] return [{ username: userStore.my.username }, ...userStore.my.profile.friends]
// else if (table === 'mygroups') // else if (table === 'mygroups')
@@ -2614,7 +2614,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
const options: IOptQueryGM = { const options: IOptQueryGM = {
nameTable: 'T_Web_Articoli', nameTable: 'T_Web_Articoli',
query: '', query: '',
where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = ' + isbn, where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = \'' + isbn + '\'',
showQtaDisponibile: false, showQtaDisponibile: false,
outhtml: false, outhtml: false,
cmd: shared_consts.CmdQueryMs.UPDATE, cmd: shared_consts.CmdQueryMs.UPDATE,

View File

@@ -34,6 +34,7 @@ import {
import { fieldsTable } from '@store/Modules/fieldsTable' import { fieldsTable } from '@store/Modules/fieldsTable'
import { useCatalogStore } from '@src/store/CatalogStore' import { useCatalogStore } from '@src/store/CatalogStore'
import { Catalogo } from '.'; import { Catalogo } from '.';
import Products from 'app/src/rootgen/admin/products/products.vue';
export default defineComponent({ export default defineComponent({
name: 'Catalogo', name: 'Catalogo',
@@ -471,6 +472,10 @@ export default defineComponent({
return false; return false;
} }
// il prodotto dev'essere disponibile
if (!productStore.isPubblicato(product))
return false
const lowerName = (product.productInfo.name || '').toLowerCase(); const lowerName = (product.productInfo.name || '').toLowerCase();
const lowerCode = (product.productInfo.code || '').toLowerCase(); const lowerCode = (product.productInfo.code || '').toLowerCase();
@@ -613,7 +618,7 @@ export default defineComponent({
title: 'Rigenera lista', title: 'Rigenera lista',
message: 'Sicuri di rigenerare questa lista di libri, perdendo l\'ordinamento attuale ?', message: 'Sicuri di rigenerare questa lista di libri, perdendo l\'ordinamento attuale ?',
cancel: true, cancel: true,
persistent: true persistent: false
}).onOk(() => { }).onOk(() => {
calcArrProducts(true) calcArrProducts(true)
}) })
@@ -790,8 +795,10 @@ export default defineComponent({
arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda) arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
indprod = 0 indprod = 0
} else { } else {
if (recscheda.scheda.sort_field!) { let sort_field = recscheda.scheda.sort_field! || optcatalogo.value.sort_field
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field, recscheda.scheda.sort_dir); let sort_dir = recscheda.scheda.sort_dir || optcatalogo.value.sort_dir
if (sort_field) {
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, sort_field, sort_dir);
indprod = 0 indprod = 0
} else { } else {
indprod = indprodGenerale indprod = indprodGenerale