- scheda prodotto migliorata

- aggiornamento filtri
This commit is contained in:
Surya Paolo
2025-04-24 01:03:20 +02:00
parent fc015404a6
commit 8d6c53803e
18 changed files with 420 additions and 152 deletions

View File

@@ -299,7 +299,7 @@ export default defineComponent({
}
async function updateproduct(atload: boolean) {
async function updateproduct(atload: boolean, forza?: boolean) {
let carica = true
@@ -313,7 +313,7 @@ export default defineComponent({
if (carica) {
myproduct.value = null;
updateproductmodif(null)
updateproductmodif(null, forza)
}
// 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')
try {
if (element?._id) {
myproduct.value = await products.getProductById(element?._id, true)
myproduct.value = await products.getProductById(element?._id, forza)
} else {
myproduct.value = await products.getProductById(props.id, true)
myproduct.value = await products.getProductById(props.id, forza)
}
updateLabel()
@@ -458,7 +458,7 @@ export default defineComponent({
async function load() {
indvariazSel.value = -1
initproduct()
await updateproduct(true)
await updateproduct(true, true)
labelDataArrivoMerce.value = ''
labelDataRitiro.value = ''
@@ -643,7 +643,7 @@ export default defineComponent({
return optcatalogo.value.areadistampa!.scale
}
async function refreshDataFromGM() {
/*async function refreshDataFromGM() {
if (myproduct.value) {
loading.value = true
updatefromgm.value = true
@@ -659,8 +659,9 @@ export default defineComponent({
loading.value = false
}
}
async function refreshAllDataBookFromGM(options: any) {
}*/
/*async function refreshAllDataBookFromGM(options: any) {
if (myproduct.value) {
loading.value = true
updatefromgm.value = true
@@ -669,14 +670,15 @@ export default defineComponent({
if (ris) {
// field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false)
await updateproduct(false, false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
updatefromgm.value = false
}
loading.value = false
}
}
}*/
async function refreshSingleBookFromGM(options: any) {
if (myproduct.value) {
loading.value = true
@@ -686,8 +688,13 @@ export default defineComponent({
if (ris) {
// field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
if (ris.error) {
tools.showNegativeNotif($q, ris.error)
} else {
await updateproduct(false, false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
}
updatefromgm.value = false
}
loading.value = false
@@ -777,8 +784,8 @@ export default defineComponent({
field_updated_fromGM,
refreshFieldFromGM,
updatetogm,
refreshDataFromGM,
refreshAllDataBookFromGM,
// refreshDataFromGM,
// refreshAllDataBookFromGM,
refreshSingleBookFromGM,
loading,
}

View File

@@ -138,7 +138,7 @@
</q-item-section>
</q-item>
<q-item
<!--<q-item
v-if="
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)
"
@@ -156,7 +156,7 @@
<q-item-section>
<q-item-label>Carica da GM</q-item-label>
</q-item-section>
</q-item>
</q-item>-->
<q-item
v-if="
tools.isManager() && !optcatalogo.generazionePDFInCorso && (editOn || options.show_edit_book)

View File

@@ -37,6 +37,10 @@ export default defineComponent({
const draftValue = ref(props.modelValue)
const editing = ref(false)
watch(toRef(props, 'modelValue'), (newVal) => {
draftValue.value = newVal;
})
function copytoclip() {
tools.copyStringToClipboard($q, draftValue.value.toString(), true)
}

View File

@@ -264,7 +264,7 @@ export default defineComponent({
watch(() => props.rec, (newval, oldval) => {
refresh()
})
}, { deep: true })
const myrow = ref(<any>null)
const mypath = ref('')
@@ -480,11 +480,13 @@ export default defineComponent({
}
function mounted() {
// console.log('mounted CMyPopupEdit')
console.log('mounted CMyPopupEdit')
myrow.value = props.rec && props.isrec ? { ...props.rec } : { ...props.row }
console.log('myrow', myrow.value?.arrvariazioni?.[0])
try {
// console.log('mounted', 'isFieldDb()', myrow.value, 'sub', props.subfield, 'field', props.field)

View File

@@ -10,6 +10,7 @@ import { shared_consts } from '@src/common/shared_vuejs'
import type { IColGridTable } from 'model';
import { IOperators } from 'model'
import { tools } from '@tools'
import { useProducts } from 'app/src/store/Products';
export default defineComponent({
name: 'CMySelect',
@@ -177,6 +178,8 @@ export default defineComponent({
const selectMultiple = ref(null)
const selectGeneric = ref(null)
const productStore = useProducts()
const mystr = ref('')
const valoriload = computed(() => {
@@ -829,6 +832,20 @@ export default defineComponent({
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)
@@ -850,6 +867,7 @@ export default defineComponent({
clear,
mystr,
searchOnGM,
applyLabelColorBasedOnProductStatus,
}
}
})

View File

@@ -147,8 +147,9 @@
</template>
<template v-slot:option="scope">
<q-item v-bind="scope.itemProps">
<q-item-section>
<q-item-label>
<q-item-section :class="applyLabelColorBasedOnProductStatus(scope.opt)">
<q-item-label >
{{ tools.getValueByFunzOrVal(scope.opt, optlab) }}
</q-item-label>
</q-item-section>

View File

@@ -115,6 +115,7 @@ export default defineComponent({
{ name: "catprods", label: "Argomento", field: "catprods", align: "left" },
{ name: "idCollana", label: "Collana", field: "idCollana", 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: "ranking", label: "Class.", field: "ranking", 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) {
if (selProd.value) {
loading.value = true
@@ -312,7 +310,6 @@ export default defineComponent({
updateProduct,
field_updated_fromGM,
refreshFieldFromGM,
refreshDataFromGM,
updatefromgm,
visufromgm,
loading,

View File

@@ -56,10 +56,11 @@
<tr
:key="element._id"
:class="{
'text-white bg-purple': products.isProssimaUscita(element.productInfo),
'bg-yellow': products.isPubblicato(element.productInfo) && products.isQtaLimitata(element),
'bg-orange': products.isPubblicato(element.productInfo) && products.isInEsaurendo(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 -->
@@ -115,6 +116,12 @@
<td v-if="isColumnVisible('stato')">
{{ products.getDescrStatiProdottoByIdStatoProdotto(element.productInfo.idStatoProdotto || '') }}
</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>

View File

@@ -274,6 +274,18 @@ export default defineComponent({
type: costanti.FieldType.onlydate,
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,
label: "Argomento",
@@ -309,6 +321,30 @@ export default defineComponent({
type: costanti.FieldType.string,
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,
label: "Formato",
@@ -412,11 +448,11 @@ export default defineComponent({
}
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) {
loading.value = true
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
}
}*/
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)
return {
@@ -451,7 +509,8 @@ export default defineComponent({
field_updated_toGM,
loading,
updateRecordToGM,
refreshDataFromGM,
refreshSingleBookFromGM,
// refreshDataFromGM,
}
}
})

View File

@@ -77,8 +77,8 @@
class="q-ma-sm"
color="accent"
icon="fas fa-save"
label="Carica da GM"
@click="refreshDataFromGM"
label="Riaggiorna da GM"
@click="refreshSingleBookFromGM({usaDBGMLocale: false})"
></q-btn>
<q-btn
rounded
@@ -86,6 +86,7 @@
color="accent"
icon="fas fa-save"
label="Aggiorna su GM"
:disabled="true"
@click="updateRecordToGM"
></q-btn>
</div>

View File

@@ -292,7 +292,12 @@ async function searchOnGM(mystr: string) {
updateproductmodif(myproduct.value)
// 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
}