diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index 3c14014d..f1424e73 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -2407,6 +2407,7 @@ export const shared_consts = { { label: 'Venduti Ultimi 2 Anni', value: 'vLast2Y' }, { label: 'Fatturati Ultimi 3 Mesi', value: 'fatLast3M' }, { label: 'Fatturati Ultimi 6 Mesi', value: 'fatLast6M' }, + { label: 'Fatturati Ultimo Anno', value: 'fatLast1Y' }, { label: 'Data Ultimo Ordine', value: 'dataUltimoOrdine' }, ], diff --git a/src/components/CCatalogList/CCatalogList.ts b/src/components/CCatalogList/CCatalogList.ts index 266bd150..4db54b10 100755 --- a/src/components/CCatalogList/CCatalogList.ts +++ b/src/components/CCatalogList/CCatalogList.ts @@ -93,10 +93,6 @@ export default defineComponent({ const myCatRef = ref(null) - const searchList_Cataloghi = ref( - tools.getsearchList_Cataloghi() - ) - /* const idSectorServizi = computed(() => { let myval: any = null @@ -210,7 +206,6 @@ export default defineComponent({ clickButtBar, myCatRef, table, - searchList_Cataloghi, } }, }) diff --git a/src/components/CCatalogList/CCatalogList.vue b/src/components/CCatalogList/CCatalogList.vue index f46b0902..287e2abe 100755 --- a/src/components/CCatalogList/CCatalogList.vue +++ b/src/components/CCatalogList/CCatalogList.vue @@ -25,7 +25,7 @@ :noresultLabel="t('grid.nosearchfound')" :arrfilters="arrfilterand" :filtercustom="filtercustom" - :prop_searchList="searchList_Cataloghi" + :prop_searchList="tools.getsearchList_Cataloghi()" :defaultnewrec="tools.getdefaultnewrec(table)" labelBtnAddRow="NONE" :prop_SortFieldsAvailable="mySortFieldsAvailable()" diff --git a/src/components/CCatalogoCard/CCatalogoCard.ts b/src/components/CCatalogoCard/CCatalogoCard.ts index d4241cce..57e98494 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.ts +++ b/src/components/CCatalogoCard/CCatalogoCard.ts @@ -650,10 +650,11 @@ export default defineComponent({ field_updated_fromGM.value = '' const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!, myproduct.value.isbn) if (ris) { - field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') + // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') await updateproduct(false) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) + updatefromgm.value = false } loading.value = false } @@ -666,10 +667,11 @@ export default defineComponent({ 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 }) if (ris) { - field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') + // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') await updateproduct(false) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) + updatefromgm.value = false } loading.value = false } @@ -682,10 +684,11 @@ export default defineComponent({ field_updated_fromGM.value = '' const ris = await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options }) if (ris) { - field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') + // field_updated_fromGM.value = t('dbgm.updateLocalDb_OK') await updateproduct(false) tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK')) + updatefromgm.value = false } loading.value = false } diff --git a/src/components/CCatalogoCard/CCatalogoCard.vue b/src/components/CCatalogoCard/CCatalogoCard.vue index ca0e20b0..29a3d02f 100755 --- a/src/components/CCatalogoCard/CCatalogoCard.vue +++ b/src/components/CCatalogoCard/CCatalogoCard.vue @@ -676,7 +676,7 @@ nameTable: 'T_Web_Articoli', campispeciali: true, 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, outhtml: true, }" diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index f55bc817..e5cb14be 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -100,6 +100,7 @@ v-show="searchList" :class="$q.screen.lt.sm ? `` : `row` + ` text-blue `" > +
+
{ return updateArrOptions() }) @@ -596,7 +598,7 @@ export default defineComponent({ let myarr: any = [] - const mystr = val.toLocaleLowerCase() + mystr.value = val.toLocaleLowerCase() myarr = updateArrOptions() if (!fieldsTable.tableRemotePickup.includes(props.tablesel)) { @@ -618,7 +620,7 @@ export default defineComponent({ valori.value = myarr.filter((v: any) => { const mioval = tools.getRecordByField(optlab, v) if (mioval) - return mioval?.toLowerCase().indexOf(mystr) > -1 + return mioval?.toLowerCase().indexOf(mystr.value) > -1 else return false @@ -643,7 +645,7 @@ export default defineComponent({ try { // myarr = optionsreal.value myarr = [] - if (mystr !== '' || props.filter_extra) + if (mystr.value !== '' || props.filter_extra) // myarr = [{_id:1, prov: 'RN', descr: 'Rimini'}] /* if (val === '1') { @@ -654,7 +656,7 @@ export default defineComponent({ myarr.push({ _id: 2, comune: 'PROVA 2B', prov: 'AL' }) }*/ { // @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) { @@ -696,6 +698,8 @@ export default defineComponent({ if (props.multiselect_by_server) { // console.log('@@@ VALORI CHANGED (3)', valori.value) } + } else { + valori.value = [] } console.log('*** OUT: tablesel', props.tablesel, 'filterFn', myarr) @@ -818,6 +822,11 @@ export default defineComponent({ function clear() { emit('clear') myvalue.value = '' + mystr.value = '' + } + + function searchOnGM(mystr: string) { + emit('searchOnGM', mystr) } onMounted(mounted) @@ -839,6 +848,8 @@ export default defineComponent({ getLabelValue, getOptionLabel, clear, + mystr, + searchOnGM, } } }) diff --git a/src/components/CMySelect/CMySelect.vue b/src/components/CMySelect/CMySelect.vue index fb586419..2fa306ff 100755 --- a/src/components/CMySelect/CMySelect.vue +++ b/src/components/CMySelect/CMySelect.vue @@ -36,7 +36,21 @@ @@ -113,7 +127,21 @@ /> diff --git a/src/components/CProductTable/CProductTable.ts b/src/components/CProductTable/CProductTable.ts index d0ea8292..47159b99 100755 --- a/src/components/CProductTable/CProductTable.ts +++ b/src/components/CProductTable/CProductTable.ts @@ -120,6 +120,7 @@ export default defineComponent({ { name: "totVen", label: "Venduti", field: "totVen", align: "right" }, { name: "totFat", label: "Fattur.", field: "totFat", 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: "quantity", label: "Magazz.", field: "quantity", align: "right" }, { name: "isbn", label: "ISBN", field: "isbn", align: "left" }, diff --git a/src/components/CProductTable/CProductTable.vue b/src/components/CProductTable/CProductTable.vue index cb736fc6..4841b7c4 100755 --- a/src/components/CProductTable/CProductTable.vue +++ b/src/components/CProductTable/CProductTable.vue @@ -149,6 +149,12 @@ > {{ element.productInfo?.fatLast6M }} + + {{ element.productInfo?.fatLast1Y }} + {{ tools.getstrDate(element.productInfo?.dataUltimoOrdine) }} diff --git a/src/components/CSearchProduct/CSearchProduct.ts b/src/components/CSearchProduct/CSearchProduct.ts index 3e832dd5..8a501df6 100755 --- a/src/components/CSearchProduct/CSearchProduct.ts +++ b/src/components/CSearchProduct/CSearchProduct.ts @@ -250,6 +250,11 @@ export default defineComponent({ let label = '' if (rec && rec.productInfo) { 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) } return label @@ -271,6 +276,25 @@ export default defineComponent({ 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) return { @@ -301,6 +325,7 @@ export default defineComponent({ clickClose, saveSearch, updateproductmodif, + searchOnGM, } } }) diff --git a/src/components/CSearchProduct/CSearchProduct.vue b/src/components/CSearchProduct/CSearchProduct.vue index 4a137c9e..9ad6811f 100755 --- a/src/components/CSearchProduct/CSearchProduct.vue +++ b/src/components/CSearchProduct/CSearchProduct.vue @@ -40,6 +40,7 @@ :filter="item.filter" :filter_extra="item.filter_extra" :useinput="item.useinput && item.type !== costanti.FieldType.select_by_server" + @searchOnGM="searchOnGM" @clear=" item.value = ''; myproduct = null; diff --git a/src/model/Products.ts b/src/model/Products.ts index cc981a5c..7bb83f1a 100755 --- a/src/model/Products.ts +++ b/src/model/Products.ts @@ -189,6 +189,8 @@ export interface IProductsState { subcatprods: ISubCatProd[] productInfos: IProductInfo[] userActive: IUserShort + + isPubblicatoById: (idStatoProdotto: number) => boolean; } export interface IProducer { diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 331383e5..b58f4b49 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -9815,7 +9815,7 @@ export const tools = { }, getsearchList_Cataloghi() { - return [{ + const lista = [{ visible: true, label: 'Editore', table: 'lista_editori', @@ -9825,11 +9825,15 @@ export const tools = { keycookie: '', addall: true, arrvalue: [], - filter: () => { }, + filter: null, useinput: false, icon: 'fas fa-user' }] + console.log('getsearchList_Cataloghi', lista) + + return lista + }, existProp(obj: any, prop: string) { diff --git a/src/store/Products.ts b/src/store/Products.ts index ac043990..52d4a357 100755 --- a/src/store/Products.ts +++ b/src/store/Products.ts @@ -144,8 +144,8 @@ export const useProducts = defineStore('Products', { return product.arrvariazioni[0].quantita <= 0 }, - isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => { - switch (productInfo?.idStatoProdotto) { + isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => { + switch (idStatoProdotto) { case 1: case 4: 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 => { const ctrec = state.stati_prodotto.find((mystatus: T_Web_StatiProdotto) => mystatus.IdStatoProdotto === idStatoProdotto) return (ctrec) ? ctrec.Descrizione : '' diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index 932c19d0..a4e2088d 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -229,7 +229,7 @@ export const useUserStore = defineStore('UserStore', { return (this.servercode === toolsext.ERR_SERVERFETCH) }, - getListaEditori: (state: IUserState) => { + listaEditori: (state: IUserState): any => { return state.lista_editori }, diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 33442f6e..2b80fdc1 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -456,7 +456,7 @@ export const useGlobalStore = defineStore('GlobalStore', { else if (table === 'friends') return userStore.my.profile.friends else if (table === 'lista_editori') { - ris = userStore.getListaEditori + ris = userStore.listaEditori } else if (table === 'friendsandme') return [{ username: userStore.my.username }, ...userStore.my.profile.friends] // else if (table === 'mygroups') @@ -2614,7 +2614,7 @@ export const useGlobalStore = defineStore('GlobalStore', { const options: IOptQueryGM = { nameTable: 'T_Web_Articoli', query: '', - where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = ' + isbn, + where: 'T.IdArticolo =' + sku + ' AND T.Ean13 = \'' + isbn + '\'', showQtaDisponibile: false, outhtml: false, cmd: shared_consts.CmdQueryMs.UPDATE, diff --git a/src/views/ecommerce/catalogo/catalogo.ts b/src/views/ecommerce/catalogo/catalogo.ts index 13cd0bf1..1b6815c7 100755 --- a/src/views/ecommerce/catalogo/catalogo.ts +++ b/src/views/ecommerce/catalogo/catalogo.ts @@ -34,6 +34,7 @@ import { import { fieldsTable } from '@store/Modules/fieldsTable' import { useCatalogStore } from '@src/store/CatalogStore' import { Catalogo } from '.'; +import Products from 'app/src/rootgen/admin/products/products.vue'; export default defineComponent({ name: 'Catalogo', @@ -471,6 +472,10 @@ export default defineComponent({ return false; } + // il prodotto dev'essere disponibile + if (!productStore.isPubblicato(product)) + return false + const lowerName = (product.productInfo.name || '').toLowerCase(); const lowerCode = (product.productInfo.code || '').toLowerCase(); @@ -613,7 +618,7 @@ export default defineComponent({ title: 'Rigenera lista', message: 'Sicuri di rigenerare questa lista di libri, perdendo l\'ordinamento attuale ?', cancel: true, - persistent: true + persistent: false }).onOk(() => { calcArrProducts(true) }) @@ -790,8 +795,10 @@ export default defineComponent({ arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda) indprod = 0 } else { - if (recscheda.scheda.sort_field!) { - arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field, recscheda.scheda.sort_dir); + let sort_field = recscheda.scheda.sort_field! || optcatalogo.value.sort_field + let sort_dir = recscheda.scheda.sort_dir || optcatalogo.value.sort_dir + if (sort_field) { + arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, sort_field, sort_dir); indprod = 0 } else { indprod = indprodGenerale