Aggiornamento cataloghi...

This commit is contained in:
Surya Paolo
2025-04-11 18:49:42 +02:00
parent cea3bcfa0e
commit 3616e2ca0f
44 changed files with 593 additions and 206 deletions

View File

@@ -115,7 +115,9 @@ export default defineComponent({
const apriSchedaPDF = ref(false)
const visufromgm = ref(false)
const updatelocaldb = ref(false)
const updatefromgm = ref(false)
const updatetogm = ref(false)
const showQtaDisponibile = ref(false)
const field_updated_fromGM = ref('')
@@ -312,7 +314,7 @@ export default defineComponent({
if (carica) {
myproduct.value = null;
updateproductmodif()
updateproductmodif(null)
}
// products.updateQuantityAvailable(myproduct.value._id)
@@ -334,9 +336,9 @@ export default defineComponent({
console.log('CCATALOGOCARD: updateproductmodif')
try {
if (element?._id) {
myproduct.value = await products.getProductById(element?._id)
myproduct.value = await products.getProductById(element?._id, true)
} else {
myproduct.value = await products.getProductById(props.id)
myproduct.value = await products.getProductById(props.id, true)
}
updateLabel()
@@ -627,8 +629,8 @@ export default defineComponent({
function isProductBestseller() {
try {
//return myproduct.value!.productInfo.rank1Y! > 0 && (myproduct.value!.productInfo.rank1Y! < props.scheda.etichette?.bestseller?.primiNInClassifica!)
return myproduct.value!.indiceRanking! > 0 && (myproduct.value!.indiceRanking! < props.scheda.etichette?.bestseller?.primiNInClassifica)
// diventa un bestseller quando il rank6M è tra i primi 10 ordinandoli per rank6M
return myproduct.value!.productInfo.rank6M! > 0 && (myproduct.value!.productInfo.rank6M!)
} catch (e) {
return false
}
@@ -643,6 +645,19 @@ export default defineComponent({
}
async function refreshDataFromGM() {
if (myproduct.value) {
loading.value = true
updatefromgm.value = true
field_updated_fromGM.value = ''
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!)
if (ris) {
field_updated_fromGM.value = t('dbgm.updateLocalDb_OK')
await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
}
loading.value = false
}
}
async function refreshFieldFromGM(field: string) {
@@ -653,7 +668,6 @@ export default defineComponent({
field_updated_fromGM.value = await globalStore.getGM_FieldOf_T_Web_Articoli(myproduct.value.productInfo.sku!, field, shared_consts.CmdQueryMs.GET)
loading.value = false
}
}
onMounted(mounted)
@@ -728,8 +742,10 @@ export default defineComponent({
showQtaDisponibile,
field_updated_fromGM,
refreshFieldFromGM,
updatetogm,
refreshDataFromGM,
loading,
updatelocaldb,
}
}
})

View File

@@ -154,7 +154,7 @@
/>
</q-item-section>
<q-item-section>
<q-item-label>Aggiorna da GM</q-item-label>
<q-item-label>Carica da GM</q-item-label>
</q-item-section>
</q-item>
<q-item
@@ -209,6 +209,7 @@
@click="
showQtaDisponibile = true;
visufromgm = true;
updatelocaldb = false;
"
>
<q-item-section avatar>
@@ -575,6 +576,8 @@
@updateproductmodif="updateproductmodif"
>
</CSchedaProdotto>
updateFieldToGM
</q-dialog>
<q-dialog
v-if="visufromgm && myproduct"
@@ -638,6 +641,38 @@
</q-card-section>
</q-card>
</q-dialog>
<q-dialog
v-if="updatetogm && myproduct"
v-model="updatetogm"
>
<q-card class="dialog_card">
<q-toolbar class="bg-primary text-white">
<q-toolbar-title> Aggiorna su GM: </q-toolbar-title>
<q-btn
flat
round
color="white"
icon="close"
v-close-popup
></q-btn>
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<q-inner-loading
id="spinner"
:showing="loading"
>
<q-spinner-tail
color="primary"
size="4em"
>
</q-spinner-tail>
</q-inner-loading>
<br />
<br />
</q-card-section>
</q-card>
</q-dialog>
</div>
</template>