aggiornamento cataloghi, search
This commit is contained in:
@@ -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' },
|
||||
],
|
||||
|
||||
|
||||
@@ -93,10 +93,6 @@ export default defineComponent({
|
||||
|
||||
const myCatRef = ref(<any>null)
|
||||
|
||||
const searchList_Cataloghi = ref(<ISearchList[]>
|
||||
tools.getsearchList_Cataloghi()
|
||||
)
|
||||
|
||||
/*
|
||||
const idSectorServizi = computed(() => {
|
||||
let myval: any = null
|
||||
@@ -210,7 +206,6 @@ export default defineComponent({
|
||||
clickButtBar,
|
||||
myCatRef,
|
||||
table,
|
||||
searchList_Cataloghi,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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()"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}"
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
v-show="searchList"
|
||||
:class="$q.screen.lt.sm ? `` : `row` + ` text-blue `"
|
||||
>
|
||||
|
||||
<span v-for="(item, index) in searchList" :key="index">
|
||||
<div
|
||||
class="text-center q-my-xs"
|
||||
@@ -119,6 +120,7 @@
|
||||
"
|
||||
@click="showfilteradv = !showfilteradv"
|
||||
></q-btn>
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
||||
@@ -13,7 +13,7 @@ import { tools } from '@tools'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMySelect',
|
||||
emits: ['update:value', 'update:arrvalue', 'changeval', 'clear'],
|
||||
emits: ['update:value', 'update:arrvalue', 'changeval', 'clear', 'searchOnGM'],
|
||||
props: {
|
||||
options: {
|
||||
type: Array,
|
||||
@@ -177,6 +177,8 @@ export default defineComponent({
|
||||
const selectMultiple = ref(null)
|
||||
const selectGeneric = ref(null)
|
||||
|
||||
const mystr = ref('')
|
||||
|
||||
const valoriload = computed(() => {
|
||||
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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -36,7 +36,21 @@
|
||||
</template>
|
||||
|
||||
<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>
|
||||
</template>
|
||||
@@ -113,7 +127,21 @@
|
||||
/>
|
||||
</template>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -149,6 +149,12 @@
|
||||
>
|
||||
{{ element.productInfo?.fatLast6M }}
|
||||
</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>
|
||||
|
||||
<!-- Quantità -->
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -189,6 +189,8 @@ export interface IProductsState {
|
||||
subcatprods: ISubCatProd[]
|
||||
productInfos: IProductInfo[]
|
||||
userActive: IUserShort
|
||||
|
||||
isPubblicatoById: (idStatoProdotto: number) => boolean;
|
||||
}
|
||||
|
||||
export interface IProducer {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 : ''
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user