- scheda prodotto migliorata
- aggiornamento filtri
This commit is contained in:
@@ -299,7 +299,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateproduct(atload: boolean) {
|
async function updateproduct(atload: boolean, forza?: boolean) {
|
||||||
|
|
||||||
let carica = true
|
let carica = true
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
if (carica) {
|
if (carica) {
|
||||||
myproduct.value = null;
|
myproduct.value = null;
|
||||||
updateproductmodif(null)
|
updateproductmodif(null, forza)
|
||||||
}
|
}
|
||||||
|
|
||||||
// products.updateQuantityAvailable(myproduct.value._id)
|
// products.updateQuantityAvailable(myproduct.value._id)
|
||||||
@@ -331,13 +331,13 @@ export default defineComponent({
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateproductmodif(element: any) {
|
async function updateproductmodif(element: any, forza?: boolean) {
|
||||||
console.log('CCATALOGOCARD: updateproductmodif')
|
console.log('CCATALOGOCARD: updateproductmodif')
|
||||||
try {
|
try {
|
||||||
if (element?._id) {
|
if (element?._id) {
|
||||||
myproduct.value = await products.getProductById(element?._id, true)
|
myproduct.value = await products.getProductById(element?._id, forza)
|
||||||
} else {
|
} else {
|
||||||
myproduct.value = await products.getProductById(props.id, true)
|
myproduct.value = await products.getProductById(props.id, forza)
|
||||||
}
|
}
|
||||||
|
|
||||||
updateLabel()
|
updateLabel()
|
||||||
@@ -458,7 +458,7 @@ export default defineComponent({
|
|||||||
async function load() {
|
async function load() {
|
||||||
indvariazSel.value = -1
|
indvariazSel.value = -1
|
||||||
initproduct()
|
initproduct()
|
||||||
await updateproduct(true)
|
await updateproduct(true, true)
|
||||||
labelDataArrivoMerce.value = ''
|
labelDataArrivoMerce.value = ''
|
||||||
labelDataRitiro.value = ''
|
labelDataRitiro.value = ''
|
||||||
|
|
||||||
@@ -643,7 +643,7 @@ export default defineComponent({
|
|||||||
return optcatalogo.value.areadistampa!.scale
|
return optcatalogo.value.areadistampa!.scale
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshDataFromGM() {
|
/*async function refreshDataFromGM() {
|
||||||
if (myproduct.value) {
|
if (myproduct.value) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
updatefromgm.value = true
|
updatefromgm.value = true
|
||||||
@@ -659,8 +659,9 @@ export default defineComponent({
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
async function refreshAllDataBookFromGM(options: any) {
|
|
||||||
|
/*async function refreshAllDataBookFromGM(options: any) {
|
||||||
if (myproduct.value) {
|
if (myproduct.value) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
updatefromgm.value = true
|
updatefromgm.value = true
|
||||||
@@ -669,14 +670,15 @@ export default defineComponent({
|
|||||||
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, false)
|
||||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||||
updatefromgm.value = false
|
updatefromgm.value = false
|
||||||
}
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
async function refreshSingleBookFromGM(options: any) {
|
async function refreshSingleBookFromGM(options: any) {
|
||||||
if (myproduct.value) {
|
if (myproduct.value) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -686,8 +688,13 @@ export default defineComponent({
|
|||||||
if (ris) {
|
if (ris) {
|
||||||
// field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
|
// field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
|
||||||
|
|
||||||
await updateproduct(false)
|
if (ris.error) {
|
||||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
tools.showNegativeNotif($q, ris.error)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
await updateproduct(false, false)
|
||||||
|
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||||
|
}
|
||||||
updatefromgm.value = false
|
updatefromgm.value = false
|
||||||
}
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@@ -777,8 +784,8 @@ export default defineComponent({
|
|||||||
field_updated_fromGM,
|
field_updated_fromGM,
|
||||||
refreshFieldFromGM,
|
refreshFieldFromGM,
|
||||||
updatetogm,
|
updatetogm,
|
||||||
refreshDataFromGM,
|
// refreshDataFromGM,
|
||||||
refreshAllDataBookFromGM,
|
// refreshAllDataBookFromGM,
|
||||||
refreshSingleBookFromGM,
|
refreshSingleBookFromGM,
|
||||||
loading,
|
loading,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>
|
||||||
|
|
||||||
<q-item
|
<!--<q-item
|
||||||
v-if="
|
v-if="
|
||||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||||
"
|
"
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
<q-item-section>
|
<q-item-section>
|
||||||
<q-item-label>Carica da GM</q-item-label>
|
<q-item-label>Carica da GM</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
</q-item>
|
</q-item>-->
|
||||||
<q-item
|
<q-item
|
||||||
v-if="
|
v-if="
|
||||||
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ export default defineComponent({
|
|||||||
const draftValue = ref(props.modelValue)
|
const draftValue = ref(props.modelValue)
|
||||||
const editing = ref(false)
|
const editing = ref(false)
|
||||||
|
|
||||||
|
watch(toRef(props, 'modelValue'), (newVal) => {
|
||||||
|
draftValue.value = newVal;
|
||||||
|
})
|
||||||
|
|
||||||
function copytoclip() {
|
function copytoclip() {
|
||||||
tools.copyStringToClipboard($q, draftValue.value.toString(), true)
|
tools.copyStringToClipboard($q, draftValue.value.toString(), true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
watch(() => props.rec, (newval, oldval) => {
|
watch(() => props.rec, (newval, oldval) => {
|
||||||
refresh()
|
refresh()
|
||||||
})
|
}, { deep: true })
|
||||||
|
|
||||||
const myrow = ref(<any>null)
|
const myrow = ref(<any>null)
|
||||||
const mypath = ref('')
|
const mypath = ref('')
|
||||||
@@ -480,11 +480,13 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mounted() {
|
function mounted() {
|
||||||
// console.log('mounted CMyPopupEdit')
|
console.log('mounted CMyPopupEdit')
|
||||||
|
|
||||||
|
|
||||||
myrow.value = props.rec && props.isrec ? { ...props.rec } : { ...props.row }
|
myrow.value = props.rec && props.isrec ? { ...props.rec } : { ...props.row }
|
||||||
|
|
||||||
|
console.log('myrow', myrow.value?.arrvariazioni?.[0])
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)
|
// console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { shared_consts } from '@src/common/shared_vuejs'
|
|||||||
import type { IColGridTable } from 'model';
|
import type { IColGridTable } from 'model';
|
||||||
import { IOperators } from 'model'
|
import { IOperators } from 'model'
|
||||||
import { tools } from '@tools'
|
import { tools } from '@tools'
|
||||||
|
import { useProducts } from 'app/src/store/Products';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'CMySelect',
|
name: 'CMySelect',
|
||||||
@@ -177,6 +178,8 @@ export default defineComponent({
|
|||||||
const selectMultiple = ref(null)
|
const selectMultiple = ref(null)
|
||||||
const selectGeneric = ref(null)
|
const selectGeneric = ref(null)
|
||||||
|
|
||||||
|
const productStore = useProducts()
|
||||||
|
|
||||||
const mystr = ref('')
|
const mystr = ref('')
|
||||||
|
|
||||||
const valoriload = computed(() => {
|
const valoriload = computed(() => {
|
||||||
@@ -829,6 +832,20 @@ export default defineComponent({
|
|||||||
emit('searchOnGM', mystr)
|
emit('searchOnGM', mystr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function applyLabelColorBasedOnProductStatus(myrec: any) {
|
||||||
|
let classi = ''
|
||||||
|
if (props.tablesel === 'products') {
|
||||||
|
if (productStore.isNonVendibile(myrec)) {
|
||||||
|
classi = 'bg-grey'
|
||||||
|
}
|
||||||
|
if (!productStore.isDisponibile(myrec)) {
|
||||||
|
classi = 'bg-red-1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return classi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|
||||||
|
|
||||||
@@ -850,6 +867,7 @@ export default defineComponent({
|
|||||||
clear,
|
clear,
|
||||||
mystr,
|
mystr,
|
||||||
searchOnGM,
|
searchOnGM,
|
||||||
|
applyLabelColorBasedOnProductStatus,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -147,8 +147,9 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-slot:option="scope">
|
<template v-slot:option="scope">
|
||||||
<q-item v-bind="scope.itemProps">
|
<q-item v-bind="scope.itemProps">
|
||||||
<q-item-section>
|
<q-item-section :class="applyLabelColorBasedOnProductStatus(scope.opt)">
|
||||||
<q-item-label>
|
<q-item-label >
|
||||||
|
|
||||||
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
|
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
|
||||||
</q-item-label>
|
</q-item-label>
|
||||||
</q-item-section>
|
</q-item-section>
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ export default defineComponent({
|
|||||||
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
|
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
|
||||||
{ name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
|
{ name: "idCollana", label: "Collana", field: "idCollana", align: "left" },
|
||||||
{ name: "stato", label: "Stato", field: "stato", align: "left" },
|
{ name: "stato", label: "Stato", field: "stato", align: "left" },
|
||||||
|
{ name: "tipologia", label: "Tipologia", field: "tipologia", align: "left" },
|
||||||
{ name: "date_pub", label: "Pubblicato", field: "date_pub", align: "left" },
|
{ name: "date_pub", label: "Pubblicato", field: "date_pub", align: "left" },
|
||||||
{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
|
{ name: "ranking", label: "Class.", field: "ranking", align: "right" },
|
||||||
{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right" },
|
{ name: "rank3M", label: "Class. 3M", field: "rank3M", align: "right" },
|
||||||
@@ -245,9 +246,6 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshDataFromGM() {
|
|
||||||
|
|
||||||
}
|
|
||||||
async function refreshFieldFromGM(field: string) {
|
async function refreshFieldFromGM(field: string) {
|
||||||
if (selProd.value) {
|
if (selProd.value) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
@@ -312,7 +310,6 @@ export default defineComponent({
|
|||||||
updateProduct,
|
updateProduct,
|
||||||
field_updated_fromGM,
|
field_updated_fromGM,
|
||||||
refreshFieldFromGM,
|
refreshFieldFromGM,
|
||||||
refreshDataFromGM,
|
|
||||||
updatefromgm,
|
updatefromgm,
|
||||||
visufromgm,
|
visufromgm,
|
||||||
loading,
|
loading,
|
||||||
|
|||||||
@@ -56,10 +56,11 @@
|
|||||||
<tr
|
<tr
|
||||||
:key="element._id"
|
:key="element._id"
|
||||||
:class="{
|
:class="{
|
||||||
|
'text-white bg-purple': products.isProssimaUscita(element.productInfo),
|
||||||
'bg-yellow': products.isPubblicato(element.productInfo) && products.isQtaLimitata(element),
|
'bg-yellow': products.isPubblicato(element.productInfo) && products.isQtaLimitata(element),
|
||||||
'bg-orange': products.isPubblicato(element.productInfo) && products.isInEsaurendo(element),
|
'bg-orange': products.isPubblicato(element.productInfo) && products.isInEsaurendo(element),
|
||||||
'text-white bg-red-10': products.isPubblicato(element.productInfo) && products.isEsaurito(element),
|
'text-white bg-red-10': products.isPubblicato(element.productInfo) && products.isEsaurito(element),
|
||||||
'bg-grey': !products.isPubblicato(element.productInfo),
|
'bg-grey': products.isNonVendibile(element.productInfo),
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<!-- Icona Drag Handle -->
|
<!-- Icona Drag Handle -->
|
||||||
@@ -115,6 +116,12 @@
|
|||||||
<td v-if="isColumnVisible('stato')">
|
<td v-if="isColumnVisible('stato')">
|
||||||
{{ products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo.idStatoProdotto || '') }}
|
{{ products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo.idStatoProdotto || '') }}
|
||||||
</td>
|
</td>
|
||||||
|
<td v-if="isColumnVisible('tipologia')">
|
||||||
|
{{ products.getDescrByIdTipologia(element.arrvariazioni[0].idTipologia || '') }}
|
||||||
|
</td>
|
||||||
|
<td v-if="isColumnVisible('tipoformato')">
|
||||||
|
{{ products.getDescrByIdTipoFormato(element.arrvariazioni[0].idTipoFormato || '') }}
|
||||||
|
</td>
|
||||||
|
|
||||||
<td v-if="isColumnVisible('date_pub')">{{ tools.getstrDate(element.productInfo?.date_pub) }}</td>
|
<td v-if="isColumnVisible('date_pub')">{{ tools.getstrDate(element.productInfo?.date_pub) }}</td>
|
||||||
|
|
||||||
|
|||||||
@@ -274,6 +274,18 @@ export default defineComponent({
|
|||||||
type: costanti.FieldType.onlydate,
|
type: costanti.FieldType.onlydate,
|
||||||
dense: true,
|
dense: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
editOn: false,
|
||||||
|
label: "Stato",
|
||||||
|
table: "productinfos",
|
||||||
|
id: myproduct.value.productInfo._id,
|
||||||
|
rec: myproduct.value.productInfo,
|
||||||
|
mykey: "idStatoProdotto",
|
||||||
|
debounce: "1000",
|
||||||
|
type: costanti.FieldType.select,
|
||||||
|
jointable: 't_web_statiprodottos',
|
||||||
|
dense: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
editOn: true,
|
editOn: true,
|
||||||
label: "Argomento",
|
label: "Argomento",
|
||||||
@@ -309,6 +321,30 @@ export default defineComponent({
|
|||||||
type: costanti.FieldType.string,
|
type: costanti.FieldType.string,
|
||||||
dense: true,
|
dense: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
editOn: false,
|
||||||
|
label: "Tipologia",
|
||||||
|
table: "arrvariazioni",
|
||||||
|
id: myproduct.value._id,
|
||||||
|
rec: myproduct.value,
|
||||||
|
mykey: "idTipologia",
|
||||||
|
debounce: "1000",
|
||||||
|
type: costanti.FieldType.select,
|
||||||
|
jointable: 't_web_tipologies',
|
||||||
|
dense: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
editOn: false,
|
||||||
|
label: "Formato",
|
||||||
|
table: "arrvariazioni",
|
||||||
|
id: myproduct.value._id,
|
||||||
|
rec: myproduct.value,
|
||||||
|
mykey: "idTipoFormato",
|
||||||
|
debounce: "1000",
|
||||||
|
type: costanti.FieldType.select,
|
||||||
|
jointable: 't_web_tipiformatos',
|
||||||
|
dense: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
editOn: true,
|
editOn: true,
|
||||||
label: "Formato",
|
label: "Formato",
|
||||||
@@ -412,11 +448,11 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateproduct(load?: boolean) {
|
async function updateproduct(load?: boolean) {
|
||||||
myproduct.value = await products.getProductById(myproduct.value._id, true)
|
myproduct.value = await products.getProductById(myproduct.value._id, load)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refreshDataFromGM() {
|
/*async function refreshDataFromGM() {
|
||||||
if (myproduct.value) {
|
if (myproduct.value) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
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)
|
||||||
@@ -429,9 +465,31 @@ export default defineComponent({
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
async function refreshSingleBookFromGM(options: any) {
|
||||||
|
if (myproduct.value) {
|
||||||
|
loading.value = true
|
||||||
|
await globalStore.updateAllBookFromGM_T_Web_Articoli({ sku: myproduct.value.productInfo.sku!, isbn: myproduct.value.productInfo.code, ...options })
|
||||||
|
.then((ris) => {
|
||||||
|
if (ris) {
|
||||||
|
if (ris.error) {
|
||||||
|
tools.showNegativeNotif($q, ris.error)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
updateproduct(false)
|
||||||
|
// console.log('product AGGIORNATO:', myproduct.value)
|
||||||
|
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||||
|
}
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onMounted(mounted)
|
onMounted(mounted)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -451,7 +509,8 @@ export default defineComponent({
|
|||||||
field_updated_toGM,
|
field_updated_toGM,
|
||||||
loading,
|
loading,
|
||||||
updateRecordToGM,
|
updateRecordToGM,
|
||||||
refreshDataFromGM,
|
refreshSingleBookFromGM,
|
||||||
|
// refreshDataFromGM,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -77,8 +77,8 @@
|
|||||||
class="q-ma-sm"
|
class="q-ma-sm"
|
||||||
color="accent"
|
color="accent"
|
||||||
icon="fas fa-save"
|
icon="fas fa-save"
|
||||||
label="Carica da GM"
|
label="Riaggiorna da GM"
|
||||||
@click="refreshDataFromGM"
|
@click="refreshSingleBookFromGM({usaDBGMLocale: false})"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
<q-btn
|
<q-btn
|
||||||
rounded
|
rounded
|
||||||
@@ -86,6 +86,7 @@
|
|||||||
color="accent"
|
color="accent"
|
||||||
icon="fas fa-save"
|
icon="fas fa-save"
|
||||||
label="Aggiorna su GM"
|
label="Aggiorna su GM"
|
||||||
|
:disabled="true"
|
||||||
@click="updateRecordToGM"
|
@click="updateRecordToGM"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -292,7 +292,12 @@ async function searchOnGM(mystr: string) {
|
|||||||
updateproductmodif(myproduct.value)
|
updateproductmodif(myproduct.value)
|
||||||
|
|
||||||
// await updateproduct(false)
|
// await updateproduct(false)
|
||||||
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
if (ris.error) {
|
||||||
|
tools.showNegativeNotif($q, ris.error)
|
||||||
|
} else {
|
||||||
|
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
|
||||||
|
}
|
||||||
|
|
||||||
// updatefromgm.value = false
|
// updatefromgm.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ export interface IVariazione {
|
|||||||
misure?: string
|
misure?: string
|
||||||
pagine?: number
|
pagine?: number
|
||||||
tipologia?: string
|
tipologia?: string
|
||||||
|
idTipologia?: number
|
||||||
|
idTipoFormato?: number
|
||||||
edizione?: string
|
edizione?: string
|
||||||
preOrderDate?: Date
|
preOrderDate?: Date
|
||||||
addtocart_link?: string
|
addtocart_link?: string
|
||||||
@@ -180,6 +182,8 @@ export interface IProductsState {
|
|||||||
authors: IAuthor[]
|
authors: IAuthor[]
|
||||||
publishers: IPublisher[]
|
publishers: IPublisher[]
|
||||||
stati_prodotto?: T_Web_StatiProdotto[]
|
stati_prodotto?: T_Web_StatiProdotto[]
|
||||||
|
tipologie?: T_Web_Tipologie[]
|
||||||
|
tipoformato?: T_WEB_TipiFormato[]
|
||||||
cart: ICart
|
cart: ICart
|
||||||
orders: IOrderCart[]
|
orders: IOrderCart[]
|
||||||
catprods: ICatProd[]
|
catprods: ICatProd[]
|
||||||
@@ -191,6 +195,7 @@ export interface IProductsState {
|
|||||||
userActive: IUserShort
|
userActive: IUserShort
|
||||||
|
|
||||||
isPubblicatoById?: (idStatoProdotto: number) => boolean;
|
isPubblicatoById?: (idStatoProdotto: number) => boolean;
|
||||||
|
isProssimaUscitaById?: (idStatoProdotto: number) => boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IProducer {
|
export interface IProducer {
|
||||||
@@ -280,6 +285,20 @@ export interface T_Web_StatiProdotto {
|
|||||||
enabled?: boolean
|
enabled?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface T_Web_Tipologie {
|
||||||
|
IdTipologia: number
|
||||||
|
Descrizione: string
|
||||||
|
dataora?: Date,
|
||||||
|
enabled?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface T_WEB_TipiFormato {
|
||||||
|
IdTipoFormato: number
|
||||||
|
Descrizione: string
|
||||||
|
dataora?: Date,
|
||||||
|
enabled?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
export interface IStorehouse {
|
export interface IStorehouse {
|
||||||
_id?: any
|
_id?: any
|
||||||
idapp?: string
|
idapp?: string
|
||||||
|
|||||||
@@ -646,6 +646,24 @@ export const colTableCatProd = [
|
|||||||
AddCol(DeleteRec),
|
AddCol(DeleteRec),
|
||||||
AddCol(DuplicateRec),
|
AddCol(DuplicateRec),
|
||||||
]
|
]
|
||||||
|
export const colTableStatiProdotto = [
|
||||||
|
AddCol({ name: 'IdTipologia', label_trans: 'statoprod.IdTipologia' }),
|
||||||
|
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||||
|
AddCol(DeleteRec),
|
||||||
|
AddCol(DuplicateRec),
|
||||||
|
]
|
||||||
|
export const colTableTipoFormato = [
|
||||||
|
AddCol({ name: 'IdTipoFormato', label_trans: 'statoprod.IdTipologia' }),
|
||||||
|
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||||
|
AddCol(DeleteRec),
|
||||||
|
AddCol(DuplicateRec),
|
||||||
|
]
|
||||||
|
export const colTableTipologie = [
|
||||||
|
AddCol({ name: 'IdStatoProdotto', label_trans: 'statoprod.IdStatoProdotto' }),
|
||||||
|
AddCol({ name: 'Descrizione', label_trans: 'statoprod.Descrizione' }),
|
||||||
|
AddCol(DeleteRec),
|
||||||
|
AddCol(DuplicateRec),
|
||||||
|
]
|
||||||
export const colTableCollane = [
|
export const colTableCollane = [
|
||||||
AddCol({ name: 'idCollana', label_trans: 'collane.idCollana', fieldtype: costanti.FieldType.number }),
|
AddCol({ name: 'idCollana', label_trans: 'collane.idCollana', fieldtype: costanti.FieldType.number }),
|
||||||
AddCol({ name: 'title', label_trans: 'collane.title' }),
|
AddCol({ name: 'title', label_trans: 'collane.title' }),
|
||||||
@@ -4372,6 +4390,27 @@ export const fieldsTable = {
|
|||||||
colkey: '_id',
|
colkey: '_id',
|
||||||
collabel: 'name',
|
collabel: 'name',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: 't_web_statiprodottos',
|
||||||
|
label: 'Stati Prodotto',
|
||||||
|
columns: colTableStatiProdotto,
|
||||||
|
colkey: 'IdStatoProdotto',
|
||||||
|
collabel: 'Descrizione',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 't_web_tipiformatos',
|
||||||
|
label: 'Tipo Formato',
|
||||||
|
columns: colTableTipoFormato,
|
||||||
|
colkey: 'IdTipoFormato',
|
||||||
|
collabel: 'Descrizione',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 't_web_tipologies',
|
||||||
|
label: 'Tipologie',
|
||||||
|
columns: colTableTipologie,
|
||||||
|
colkey: 'IdStatoProdotto',
|
||||||
|
collabel: 'Descrizione',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: 'collanas',
|
value: 'collanas',
|
||||||
label: 'Collane',
|
label: 'Collane',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda, T_Web_StatiProdotto } from 'model'
|
import type { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog, ICatPrTotali, ISingleProductOrdered, ISchedaSingola, IMyScheda, IElementiScheda, T_Web_StatiProdotto, T_Web_Tipologie, T_WEB_TipiFormato } from 'model'
|
||||||
|
|
||||||
import { Api } from '@api'
|
import { Api } from '@api'
|
||||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||||
@@ -130,6 +130,10 @@ export const useProducts = defineStore('Products', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
isDisponibile: (state: IProductsState) => (product: IProduct): boolean => {
|
||||||
|
return product?.arrvariazioni?.[0]?.quantita > 1
|
||||||
|
},
|
||||||
|
|
||||||
|
isDisponibilitaOk: (state: IProductsState) => (product: IProduct): boolean => {
|
||||||
return product?.arrvariazioni?.[0]?.quantita > 100
|
return product?.arrvariazioni?.[0]?.quantita > 100
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -146,11 +150,9 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
isPubblicatoById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
||||||
switch (idStatoProdotto) {
|
switch (idStatoProdotto) {
|
||||||
case 1:
|
case 1: // In Commercio
|
||||||
case 4:
|
case 45: // In Commercio
|
||||||
case 34:
|
case 46: // 2023 in commercio
|
||||||
case 45:
|
|
||||||
case 46:
|
|
||||||
case undefined:
|
case undefined:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@@ -158,16 +160,41 @@ export const useProducts = defineStore('Products', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isProssimaUscitaById: (state: IProductsState) => (idStatoProdotto: number): boolean => {
|
||||||
|
// 4 - Prossima uscita
|
||||||
|
// 34 - In Prevendita
|
||||||
|
return (idStatoProdotto === 4) || (idStatoProdotto === 34)
|
||||||
|
},
|
||||||
|
|
||||||
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
isPubblicato: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||||
return state.isPubblicatoById(productInfo.idStatoProdotto)
|
return state.isPubblicatoById(productInfo.idStatoProdotto)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isNonVendibile: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||||
|
return !state.isPubblicatoById(productInfo.idStatoProdotto) && !state.isProssimaUscitaById(productInfo.idStatoProdotto)
|
||||||
|
},
|
||||||
|
|
||||||
|
isProssimaUscita: (state: IProductsState) => (productInfo: IProductInfo): boolean => {
|
||||||
|
return state.isProssimaUscitaById(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 : ''
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
getDescrByIdTipologia: (state: IProductsState) => (idTipologia: number): string => {
|
||||||
|
const ctrec = state.tipologie.find((mystatus: T_Web_Tipologie) => mystatus.IdTipologia === idTipologia)
|
||||||
|
return (ctrec) ? ctrec.Descrizione : ''
|
||||||
|
},
|
||||||
|
|
||||||
|
getDescrByIdTipoFormato: (state: IProductsState) => (idTipoFormato: number): string => {
|
||||||
|
const ctrec = state.tipoformato.find((mystatus: T_WEB_TipiFormato) => mystatus.IdTipoFormato === idTipoFormato)
|
||||||
|
return (ctrec) ? ctrec.Descrizione : ''
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
||||||
const myarr: string[] = []
|
const myarr: string[] = []
|
||||||
for (const idCatProd of arridCatProds) {
|
for (const idCatProd of arridCatProds) {
|
||||||
@@ -1426,114 +1453,158 @@ export const useProducts = defineStore('Products', {
|
|||||||
return testo.contenuto;
|
return testo.contenuto;
|
||||||
}
|
}
|
||||||
|
|
||||||
const autori = this.getAutoriByArrayAuthors(myproduct.productInfo.authors)
|
const replacements: { [key: string]: any } = {};
|
||||||
const collana = tools.formatCollane(myproduct.productInfo.idCollana)
|
|
||||||
|
if (testo.contenuto.includes('{autore}')) {
|
||||||
|
replacements['{autore}'] = this.getAutoriByArrayAuthors(myproduct.productInfo.authors) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testo.contenuto.includes('{collana}')) {
|
||||||
|
replacements['{collana}'] = tools.formatCollane(myproduct.productInfo.idCollana) || '';
|
||||||
|
}
|
||||||
|
|
||||||
const maxDescriptionLength = testo.maxlength ?? 100;
|
const maxDescriptionLength = testo.maxlength ?? 100;
|
||||||
const description = myproduct.productInfo.short_descr || '';
|
|
||||||
const long_descr = myproduct.productInfo.description || '';
|
|
||||||
const date_pub = tools.getstrDateShort(myproduct.productInfo.date_pub) || '';
|
|
||||||
const fatLast3M = myproduct.productInfo.fatLast3M! || 0;
|
|
||||||
const fatLast6M = myproduct.productInfo.fatLast6M! || 0;
|
|
||||||
const vLast3M = myproduct.productInfo.vLast3M! || 0;
|
|
||||||
const vLast6M = myproduct.productInfo.vLast6M! || 0;
|
|
||||||
const ranking_globale = myproduct.productInfo.rank3M! || 0;
|
|
||||||
const venduti = myproduct.productInfo.totVen! || 0;
|
|
||||||
const fatturati = myproduct.productInfo.totFat! || 0;
|
|
||||||
|
|
||||||
const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + venduti + '</a>'
|
if (testo.contenuto.includes('{descrizione_da_fdv}')) {
|
||||||
const linkfatturati = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + fatturati + '</a>'
|
const description = myproduct.productInfo.short_descr || '';
|
||||||
const debugstr = this.getkeyValStr('Pub:', date_pub) +
|
replacements['{descrizione_da_fdv}'] = description.length > maxDescriptionLength
|
||||||
this.getkeyValStr('fat6M', fatLast6M) +
|
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||||
// this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
: description;
|
||||||
this.getkeyValStr('Ven:', linkvenduti) +
|
|
||||||
this.getkeyValStr('v3M', vLast3M) +
|
|
||||||
this.getkeyValStr('v6M', vLast6M) +
|
|
||||||
this.getkeyValStr('Fatt:', linkfatturati) +
|
|
||||||
this.getkeyValStr('fat3M', fatLast3M)
|
|
||||||
|
|
||||||
const truncatedDescription = description.length > maxDescriptionLength
|
|
||||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
|
||||||
: description;
|
|
||||||
|
|
||||||
const truncatedlongDescription = long_descr.length > maxDescriptionLength
|
|
||||||
? long_descr.substring(0, long_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
|
||||||
: long_descr;
|
|
||||||
|
|
||||||
let addtesto = false
|
|
||||||
|
|
||||||
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
|
||||||
if (long_descr_macro.length > maxDescriptionLength) {
|
|
||||||
addtesto = true
|
|
||||||
}
|
|
||||||
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>'
|
|
||||||
|
|
||||||
let descrizione_completa_macro = addtesto
|
|
||||||
? long_descr_macro.substring(0, long_descr_macro.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
|
||||||
: long_descr_macro;
|
|
||||||
|
|
||||||
if (addtesto) {
|
|
||||||
descrizione_completa_macro += addstrcontinua
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const descr_trafiletto_catalogo = myproduct.productInfo.descr_trafiletto_catalogo || '';
|
if (testo.contenuto.includes('{descrizione_estesa_fdv}')) {
|
||||||
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
|
const long_descr = myproduct.productInfo.description || '';
|
||||||
const descrizione_breve_macro = short_descr.length > maxDescriptionLength
|
replacements['{descrizione_estesa_fdv}'] = long_descr.length > maxDescriptionLength
|
||||||
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
? long_descr.substring(0, long_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||||
: short_descr;
|
: long_descr;
|
||||||
|
}
|
||||||
|
|
||||||
const sottotitolo = myproduct.productInfo.sottotitolo || '';
|
if (testo.contenuto.includes('{descrizione_estesa}')) {
|
||||||
const link_macro = myproduct.productInfo.link_macro || '';
|
let addtesto = false;
|
||||||
|
const long_descr_macro = myproduct.productInfo.descrizione_completa_macro || '';
|
||||||
|
if (long_descr_macro.length > maxDescriptionLength) {
|
||||||
|
addtesto = true;
|
||||||
|
}
|
||||||
|
const addstrcontinua = '<span class="book-link">👉🏻 <a href="{link_macro}" target="_blank">continua a leggere</a></span>';
|
||||||
|
let descrizione_completa_macro = addtesto
|
||||||
|
? long_descr_macro.substring(0, long_descr_macro.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||||
|
: long_descr_macro;
|
||||||
|
|
||||||
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || ''
|
if (addtesto) {
|
||||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || ''
|
descrizione_completa_macro += addstrcontinua;
|
||||||
const categoria = this.getCatProdsStrByCatProds(myproduct.productInfo.catprods!)
|
}
|
||||||
const sottocategoria = myproduct.productInfo.subcatprods && myproduct.productInfo.subcatprods.length > 0 ? myproduct.productInfo.subcatprods[0].name! : ''
|
replacements['{descrizione_estesa}'] = descrizione_completa_macro || '';
|
||||||
const descr_categoria = myproduct.productInfo.catprods && myproduct.productInfo.catprods.length > 0 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0].name) : ''
|
}
|
||||||
const misure = myproduct.arrvariazioni![0].misure || ''
|
|
||||||
const formato = myproduct.arrvariazioni![0].formato || ''
|
|
||||||
const pagine = myproduct.arrvariazioni![0].pagine || ''
|
|
||||||
const qta = myproduct.arrvariazioni![0].quantita || ''
|
|
||||||
const isbn = myproduct.productInfo.code || ''
|
|
||||||
const image_link = myproduct.productInfo.image_link || ''
|
|
||||||
const imagefile = myproduct.productInfo.imagefile || ''
|
|
||||||
const stato = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '')
|
|
||||||
|
|
||||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
if (testo.contenuto.includes('{descrizione_breve_macro}')) {
|
||||||
// Crea una mappa di sostituzioni
|
const short_descr = myproduct.productInfo.descrizione_breve_macro || '';
|
||||||
const replacements = {
|
replacements['{descrizione_breve_macro}'] = short_descr.length > maxDescriptionLength
|
||||||
'{autore}': autori || '',
|
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||||
'{titolo}': myproduct.productInfo.name || '',
|
: short_descr;
|
||||||
'{sottotitolo}': (sottotitolo) || '',
|
}
|
||||||
'{descrizione_da_fdv}': truncatedDescription || '',
|
|
||||||
'{descrizione_estesa_fdv}': truncatedlongDescription || '',
|
|
||||||
'{descrizione_estesa}': descrizione_completa_macro || '',
|
|
||||||
'{debug}': (debugstr) || '',
|
|
||||||
'{categoria}': (categoria) || '',
|
|
||||||
'{sottocategoria}': (sottocategoria) || '',
|
|
||||||
'{descr_categoria}': (descr_categoria) || '',
|
|
||||||
'{pagine}': (pagine) || '',
|
|
||||||
'{isbn}': (isbn) || '',
|
|
||||||
'{misure}': misure || '',
|
|
||||||
'{argomento}': categoria || '',
|
|
||||||
'{date_pub}': date_pub || '',
|
|
||||||
'{ranking_globale}': ranking_globale || '',
|
|
||||||
'{venduti}': venduti || '',
|
|
||||||
'{formato}': formato || '',
|
|
||||||
'{stato}': stato || '',
|
|
||||||
'{collana}': collana ? collana || '' : '',
|
|
||||||
'{prezzo}': prezzo || '',
|
|
||||||
'{scale}': scale || '',
|
|
||||||
'{prezzo_scontato}': prezzo_scontato || '',
|
|
||||||
'{descrizione_completa_macro}': descrizione_completa_macro || '',
|
|
||||||
'{descrizione_breve_macro}': descrizione_breve_macro || '',
|
|
||||||
'{descr_trafiletto_catalogo}': descr_trafiletto_catalogo || '',
|
|
||||||
'{link_macro}': link_macro || '',
|
|
||||||
'{qta}': qta || '',
|
|
||||||
'{image_link}': image_link || '',
|
|
||||||
'{imagefile}': imagefile || '',
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if (testo.contenuto.includes('{descr_trafiletto_catalogo}')) {
|
||||||
|
const short_descr = myproduct.productInfo.descr_trafiletto_catalogo || '';
|
||||||
|
replacements['{descr_trafiletto_catalogo}'] = short_descr.length > maxDescriptionLength
|
||||||
|
? short_descr.substring(0, short_descr.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||||
|
: short_descr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (testo.contenuto.includes('{prezzo}') || testo.contenuto.includes('{prezzo_scontato}')) {
|
||||||
|
const prezzo = tools.arrotonda2Dec(myproduct.arrvariazioni![0].price) || '';
|
||||||
|
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || '';
|
||||||
|
replacements['{prezzo}'] = prezzo;
|
||||||
|
replacements['{prezzo_scontato}'] = prezzo_scontato;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Additional replacements based on the content
|
||||||
|
const keysToCheck = [
|
||||||
|
'{titolo}', '{sottotitolo}', '{categoria}', '{sottocategoria}', '{descr_categoria}',
|
||||||
|
'{pagine}', '{isbn}', '{misure}', '{argomento}', '{date_pub}', '{ranking_globale}',
|
||||||
|
'{venduti}', '{formato}', '{tipologia}', '{stato}', '{scale}', '{descr_trafiletto_catalogo}',
|
||||||
|
'{link_macro}', '{qta}', '{image_link}', '{imagefile}', '{debug}'
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const key of keysToCheck) {
|
||||||
|
if (testo.contenuto.includes(key)) {
|
||||||
|
switch (key) {
|
||||||
|
case '{titolo}':
|
||||||
|
replacements[key] = myproduct.productInfo.name || '';
|
||||||
|
break;
|
||||||
|
case '{sottotitolo}':
|
||||||
|
replacements[key] = myproduct.productInfo.sottotitolo || '';
|
||||||
|
break;
|
||||||
|
case '{sottocategoria}':
|
||||||
|
replacements[key] = myproduct.productInfo.subcatprods && myproduct.productInfo.subcatprods.length > 0 ? myproduct.productInfo.subcatprods[0].name! : '';
|
||||||
|
break;
|
||||||
|
case '{descr_categoria}':
|
||||||
|
replacements[key] = myproduct.productInfo.catprods && myproduct.productInfo.catprods.length > 0 ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0].name) : '';
|
||||||
|
break;
|
||||||
|
case '{pagine}':
|
||||||
|
replacements[key] = myproduct.arrvariazioni![0].pagine || '';
|
||||||
|
break;
|
||||||
|
case '{isbn}':
|
||||||
|
replacements[key] = myproduct.productInfo.code || '';
|
||||||
|
break;
|
||||||
|
case '{misure}':
|
||||||
|
replacements[key] = myproduct.arrvariazioni![0].misure || '';
|
||||||
|
break;
|
||||||
|
case '{argomento}':
|
||||||
|
replacements[key] = this.getCatProdsStrByCatProds(myproduct.productInfo.catprods!) || '';
|
||||||
|
break;
|
||||||
|
case '{date_pub}':
|
||||||
|
replacements[key] = tools.getstrDateShort(myproduct.productInfo.date_pub) || '';
|
||||||
|
break;
|
||||||
|
case '{ranking_globale}':
|
||||||
|
replacements[key] = myproduct.productInfo.rank3M! || '0';
|
||||||
|
break;
|
||||||
|
case '{venduti}':
|
||||||
|
replacements[key] = myproduct.productInfo.totVen! || '0';
|
||||||
|
break;
|
||||||
|
case '{formato}':
|
||||||
|
replacements[key] = this.getDescrByIdTipoFormato(myproduct.arrvariazioni[0].idTipoFormato || 0)
|
||||||
|
break;
|
||||||
|
case '{tipologia}':
|
||||||
|
replacements[key] = this.getDescrByIdTipologia(myproduct.arrvariazioni[0].idTipologia || 0);
|
||||||
|
break;
|
||||||
|
case '{stato}':
|
||||||
|
replacements[key] = this.getDescrStatiProdottoByIdStatoProdotto(myproduct.productInfo.idStatoProdotto || '');
|
||||||
|
break;
|
||||||
|
case '{scale}':
|
||||||
|
replacements[key] = optcatalogo.printable ? optcatalogo.areadistampa?.scale : '1';
|
||||||
|
break;
|
||||||
|
case '{link_macro}':
|
||||||
|
replacements[key] = myproduct.productInfo.link_macro || '';
|
||||||
|
break;
|
||||||
|
case '{qta}':
|
||||||
|
replacements[key] = myproduct.arrvariazioni![0].quantita || '';
|
||||||
|
break;
|
||||||
|
case '{image_link}':
|
||||||
|
replacements[key] = myproduct.productInfo.image_link || '';
|
||||||
|
break;
|
||||||
|
case '{imagefile}':
|
||||||
|
replacements[key] = myproduct.productInfo.imagefile || '';
|
||||||
|
break;
|
||||||
|
case '{debug}':
|
||||||
|
const date_pub = replacements['{date_pub}'] || '';
|
||||||
|
const fatLast6M = myproduct.productInfo.fatLast6M! || 0;
|
||||||
|
const linkvenduti = `<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/${myproduct.productInfo.sku}" target="_blank">${replacements['{venduti}']}</a>`;
|
||||||
|
const vLast3M = myproduct.productInfo.vLast3M! || 0;
|
||||||
|
const vLast6M = myproduct.productInfo.vLast6M! || 0;
|
||||||
|
const linkfatturati = `<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/${myproduct.productInfo.sku}" target="_blank">${myproduct.productInfo.totFat! || 0}</a>`;
|
||||||
|
const fatLast3M = myproduct.productInfo.fatLast3M! || 0;
|
||||||
|
|
||||||
|
replacements[key] = this.getkeyValStr('Pub:', date_pub) +
|
||||||
|
this.getkeyValStr('fat6M', fatLast6M) +
|
||||||
|
this.getkeyValStr('Ven:', linkvenduti) +
|
||||||
|
this.getkeyValStr('v3M', vLast3M) +
|
||||||
|
this.getkeyValStr('v6M', vLast6M) +
|
||||||
|
this.getkeyValStr('Fatt:', linkfatturati) +
|
||||||
|
this.getkeyValStr('fat3M', fatLast3M);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Esegue le sostituzioni
|
// Esegue le sostituzioni
|
||||||
let result = testo.contenuto;
|
let result = testo.contenuto;
|
||||||
@@ -1541,7 +1612,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
result = result.replace(new RegExp(key, 'g'), value);
|
result = result.replace(new RegExp(key, 'g'), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.trim()
|
return result.trim();
|
||||||
},
|
},
|
||||||
|
|
||||||
getSubCatStrByProduct(myproductInfo: IProductInfo): string {
|
getSubCatStrByProduct(myproductInfo: IProductInfo): string {
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ import type {
|
|||||||
StateConnection,
|
StateConnection,
|
||||||
ISchedaSingola,
|
ISchedaSingola,
|
||||||
IOptQueryGM,
|
IOptQueryGM,
|
||||||
IOptCatalogo
|
IOptCatalogo,
|
||||||
|
IProduct,
|
||||||
|
IProductInfo,
|
||||||
|
IVariazione
|
||||||
} from '@model';
|
} from '@model';
|
||||||
import {
|
import {
|
||||||
ICity, IMySkill,
|
ICity, IMySkill,
|
||||||
@@ -442,6 +445,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
else if (table === 'authors') ris = Products.authors
|
else if (table === 'authors') ris = Products.authors
|
||||||
else if (table === 'publishers') ris = Products.publishers
|
else if (table === 'publishers') ris = Products.publishers
|
||||||
else if (table === 't_web_statiprodottos') ris = Products.stati_prodotto
|
else if (table === 't_web_statiprodottos') ris = Products.stati_prodotto
|
||||||
|
else if (table === 't_web_tipologies') ris = Products.tipologie
|
||||||
|
else if (table === 't_web_tipiformatos') ris = Products.tipoformato
|
||||||
else if (table === 'catais') ris = state.catAI
|
else if (table === 'catais') ris = state.catAI
|
||||||
else if (table === 'queryais') ris = state.queryAIList
|
else if (table === 'queryais') ris = state.queryAIList
|
||||||
else if (table === 'sharewithus') ris = state.sharewithus
|
else if (table === 'sharewithus') ris = state.sharewithus
|
||||||
@@ -1829,6 +1834,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
Products.collane = (res.data.collane) ? [...res.data.collane] : []
|
Products.collane = (res.data.collane) ? [...res.data.collane] : []
|
||||||
Products.subcatprods = (res.data.subcatprods) ? [...res.data.subcatprods] : []
|
Products.subcatprods = (res.data.subcatprods) ? [...res.data.subcatprods] : []
|
||||||
Products.stati_prodotto = (res.data.stati_prodotto) ? [...res.data.stati_prodotto] : []
|
Products.stati_prodotto = (res.data.stati_prodotto) ? [...res.data.stati_prodotto] : []
|
||||||
|
Products.tipologie = (res.data.tipologie) ? [...res.data.tipologie] : []
|
||||||
|
Products.tipoformato = (res.data.tipoformato) ? [...res.data.tipoformato] : []
|
||||||
Products.catprods_gas = (res.data.catprods_gas) ? [...res.data.catprods_gas] : []
|
Products.catprods_gas = (res.data.catprods_gas) ? [...res.data.catprods_gas] : []
|
||||||
Products.authors = (res.data.authors) ? [...res.data.authors] : []
|
Products.authors = (res.data.authors) ? [...res.data.authors] : []
|
||||||
Products.publishers = (res.data.publishers) ? [...res.data.publishers] : []
|
Products.publishers = (res.data.publishers) ? [...res.data.publishers] : []
|
||||||
@@ -2676,15 +2683,41 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async updateTablesInMemory(data: any) {
|
||||||
|
|
||||||
|
const table = data.table
|
||||||
|
const id = data.idRecUpdated
|
||||||
|
|
||||||
|
if (!id)
|
||||||
|
return
|
||||||
|
|
||||||
|
const productStore = useProducts()
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (table === 'products') {
|
||||||
|
await productStore.loadProductById(id)
|
||||||
|
} else if (table === 'productinfos') {
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Errore durante l'aggiornamento della tabella in memoria:", error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
async updateAllBookTableContent(options: any) {
|
async updateAllBookTableContent(options: any) {
|
||||||
try {
|
try {
|
||||||
// aggiungi idapp ad options
|
// aggiungi idapp ad options
|
||||||
options.idapp = tools.getEnv('VITE_APP_ID')
|
options.idapp = tools.getEnv('VITE_APP_ID')
|
||||||
return Api.SendReq('/apisqlsrv/updateAllBook', 'POST', { options })
|
return await Api.SendReq('/apisqlsrv/updateAllBook', 'POST', { options })
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
|
if (res?.data?.data?.logerror) {
|
||||||
|
return { error: 'Errore ' + res?.data?.data?.logerror }
|
||||||
|
}
|
||||||
|
await this.updateTablesInMemory(res.data.data)
|
||||||
return res.data.data
|
return res.data.data
|
||||||
}).catch((error: any) => {
|
}).catch((error: any) => {
|
||||||
console.error('Error fetchTableContent: ', error)
|
console.error('Error fetchTableContent: ', error)
|
||||||
|
return { error: 'Errore ' + error }
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Errore nel recupero della tabella:", error);
|
console.error("Errore nel recupero della tabella:", error);
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
color="positive"
|
color="positive"
|
||||||
@click="EseguiFunz('UpdateStatFatturato')"
|
@click="EseguiFunz('UpdateStatFatturato')"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
|
<q-btn
|
||||||
|
label="Aggiorna Categorie (Elimina quelli vuoti)"
|
||||||
|
color="positive"
|
||||||
|
@click="EseguiFunz('UpdateCatDeleteEmpty')"
|
||||||
|
></q-btn>
|
||||||
<br><br>
|
<br><br>
|
||||||
<q-btn
|
<q-btn
|
||||||
label="Riaggiorna TUTTI gli ARTICOLI da GM SERVER"
|
label="Riaggiorna TUTTI gli ARTICOLI da GM SERVER"
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ 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 Products from 'app/src/rootgen/admin/products/products.vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'Catalogo',
|
name: 'Catalogo',
|
||||||
@@ -109,7 +107,7 @@ export default defineComponent({
|
|||||||
const catalogStore = useCatalogStore()
|
const catalogStore = useCatalogStore()
|
||||||
|
|
||||||
const tabvisu = ref('categorie')
|
const tabvisu = ref('categorie')
|
||||||
const tabcatalogo = ref()
|
const tabcatalogo = ref('lista')
|
||||||
|
|
||||||
const searchList = ref([] as ISearchList[])
|
const searchList = ref([] as ISearchList[])
|
||||||
|
|
||||||
@@ -995,7 +993,8 @@ export default defineComponent({
|
|||||||
const arrcat = productStore.getCatProds(cosa.value)
|
const arrcat = productStore.getCatProds(cosa.value)
|
||||||
const riscat: any = [{ label: 'Tutti', value: '', icon: undefined, color: undefined }]
|
const riscat: any = [{ label: 'Tutti', value: '', icon: undefined, color: undefined }]
|
||||||
for (const rec of arrcat) {
|
for (const rec of arrcat) {
|
||||||
riscat.push({ label: rec.name, value: rec._id, icon: rec.icon, color: rec.color })
|
const label = rec.name + ' (' + productStore.getTotaliProdottiByIdCatProd(rec._id) + ')'
|
||||||
|
riscat.push({ label, value: rec._id, icon: rec.icon, color: rec.color })
|
||||||
}
|
}
|
||||||
|
|
||||||
return riscat
|
return riscat
|
||||||
|
|||||||
@@ -12,19 +12,19 @@
|
|||||||
dense
|
dense
|
||||||
class="bg-green text-white"
|
class="bg-green text-white"
|
||||||
>
|
>
|
||||||
<q-tab
|
<q-tab
|
||||||
name="visu"
|
|
||||||
icon="fas fa-eye"
|
|
||||||
label="Visualizza"
|
|
||||||
>
|
|
||||||
</q-tab>
|
|
||||||
<q-tab
|
|
||||||
v-if="lista_prodotti"
|
v-if="lista_prodotti"
|
||||||
name="lista"
|
name="lista"
|
||||||
icon="fas fa-list"
|
icon="fas fa-list"
|
||||||
label="Lista"
|
label="Lista"
|
||||||
>
|
>
|
||||||
</q-tab>
|
</q-tab>
|
||||||
|
<q-tab
|
||||||
|
name="visu"
|
||||||
|
icon="fas fa-eye"
|
||||||
|
label="Catalogo"
|
||||||
|
>
|
||||||
|
</q-tab>
|
||||||
<q-tab
|
<q-tab
|
||||||
v-if="tools.isGrafico()"
|
v-if="tools.isGrafico()"
|
||||||
name="sfondo"
|
name="sfondo"
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
>
|
>
|
||||||
</q-tab>
|
</q-tab>
|
||||||
<q-tab
|
<q-tab
|
||||||
|
v-if="tools.isAdmin()"
|
||||||
name="opzioni"
|
name="opzioni"
|
||||||
icon="fas fa-save"
|
icon="fas fa-save"
|
||||||
label="Avanzati"
|
label="Avanzati"
|
||||||
|
|||||||
Reference in New Issue
Block a user