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>

View File

@@ -106,6 +106,7 @@ export default defineComponent({
}
function updateproductmodif(element: IProduct) {
console.log('CCONTAIER: updateproductmodif')
emit('updateproductmodif', element)
}

View File

@@ -1,29 +1,45 @@
<template>
<div class="q-gutter-y-xs column" style="min-width: 100px">
<div
class="q-gutter-y-xs column"
style="min-width: 100px"
>
<q-field
:label="label ? label : undefined"
:stack-label="!!label"
outlined
:dense="dense"
color="blue-6"
>
<template
v-if="copy"
v-slot:prepend
>
<template v-if="copy" v-slot:prepend>
<q-btn round dense flat icon="far fa-copy" @click="copytoclip"/>
<q-btn
round
dense
flat
icon="far fa-copy"
@click="copytoclip"
/>
</template>
<template v-slot:control>
<div class="self-center full-width no-outline" tabindex="0">
<span :class="class_text" :style="`color: ` + color " v-html="value"></span>
<div
class="self-center full-width no-outline"
tabindex="0"
>
<span
:class="class_text"
:style="`color: ` + color"
v-html="value"
></span>
<slot></slot>
</div>
</template>
</q-field>
</div>
</template>
<script lang="ts" src="./CLabel.ts">
</script>
<script lang="ts" src="./CLabel.ts"></script>
<style lang="scss" scoped>
@import './CLabel.scss';

View File

@@ -1863,7 +1863,7 @@
rounded
outlined
v-model="recscheda.scheda.linkIdTemplate"
:options="globalStore.SchedeOpt()"
:options="globalStore.getSchedeOpt()"
@update:model-value="modifElem"
label="Scheda collegata:"
style="width: 250px"
@@ -1879,7 +1879,7 @@
rounded
outlined
v-model="idSchedaDaCopiare"
:options="globalStore.SchedeOpt()"
:options="globalStore.getSchedeOpt()"
@update:model-value="modifElem"
label="Scegli Scheda"
style="width: 250px"

View File

@@ -240,6 +240,8 @@ export default defineComponent({
const loaded = ref(false)
const popupEditRef = ref(null)
const addstrrequired = ref('')
const col = ref(<IColGridTable>{
@@ -287,7 +289,6 @@ export default defineComponent({
if (props.filter)
col.value.filter = props.filter
col.value.fieldtype = props.type
col.value.label = props.title
if (props.type === costanti.FieldType.image) {
myImgGall.value = [{
@@ -412,6 +413,7 @@ export default defineComponent({
}
function changevalRecOrig(newval: any, subcol: string = '') {
console.log('changevalRec', newval)
// if (!props.insertMode || (props.insertMode && col.value.fieldtype !== costanti.FieldType.multioption)) {
if (col.value && col.value.allowchar === costanti.ALLOWCHAR_CODE) {
newval = tools.removespaces_slash(newval)
@@ -459,6 +461,7 @@ export default defineComponent({
if (props.isInModif)
OpenEdit()
emit('save', newval)
// }
}
@@ -908,6 +911,20 @@ export default defineComponent({
}
}
function handleCancel() {
// Gestisci la chiusura del q-popup-edit
console.log("Chiusura di q-popup-edit");
}
function handleKeydown(event) {
// Interrompi la propagazione del tasto ESC
if (event.key === "Escape") {
event.stopPropagation();
console.log("Tasto ESC intercettato e bloccato");
popupEditRef.value.hide();
}
}
onBeforeMount(mounted)
@@ -951,6 +968,10 @@ export default defineComponent({
mypath,
changeValRecCoordAddr,
addstrrequired,
t,
handleKeydown,
handleCancel,
popupEditRef,
}
}
})

View File

@@ -82,7 +82,7 @@
(col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && myvalue))
"
>
<span class="extrafield">{{ $t(col.extrafield) }}</span>
<span class="extrafield">{{ t(col.extrafield) }}</span>
</span>
</div>
<div v-if="canModify">
@@ -92,7 +92,7 @@
:minlength="col.minlength ? col.minlength : undefined"
v-model="myvalue"
@update:model-value="changevalRec"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : undefined"
:label="col.visulabel ? addstrrequired + t(col.label_trans) : undefined"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
@@ -205,7 +205,7 @@
@update:model-value="changevalRec"
autofocus
:rules="[(val) => !!val || !col.required || 'Campo richiesto']"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : col.label"
:label="col.visulabel ? addstrrequired + t(col.label_trans) : col.label"
>
</q-input>
<q-field v-if="col.showLinkResult && myvalue">
@@ -219,7 +219,7 @@
<CLabel
v-bind="$attrs"
:value="myvalue"
:label="$t(col.label_trans)"
:label="t(col.label_trans)"
/>
</div>
<div v-else>
@@ -290,10 +290,11 @@
<div v-else-if="col.fieldtype === costanti.FieldType.number || col.fieldtype === costanti.FieldType.currency">
<div v-if="canEdit || isInModif">
<div>
<CInput
v-model="myvalue"
:label="col.visulabel ? $t(col.label_trans) : visulabel ? addstrrequired + $t(col.label_trans) : undefined"
:label="
col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + t(col.label_trans) : undefined
"
:dense="dense"
@savedb="Savedb"
/>
@@ -304,7 +305,7 @@
:symbol="tools.getSymbolByCircuit(row)"
:color="tools.getColorByCircuit(row)"
v-model="myvalue"
:label="$t(col.label_trans)"
:label="t(col.label_trans)"
>
</CCurrencyValue>
</div>
@@ -331,13 +332,15 @@
</div>
<div v-else>
<CInput
v-model="myvalue"
:label="col.visulabel ? $t(col.label_trans) : visulabel ? addstrrequired + $t(col.label_trans) : undefined"
:dense="dense"
@savedb="changevalRec"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
/>
v-model="myvalue"
:label="
col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + t(col.label_trans) : undefined
"
:dense="dense"
@savedb="changevalRec"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
/>
</div>
</div>
<div
@@ -345,7 +348,7 @@
style="text-align: center"
>
<span class="text-h7 text-weight-bold row justify-center">
{{ $t(col.label_trans) }}
{{ t(col.label_trans) }}
</span>
<CGallery
:imagebak="
@@ -384,7 +387,7 @@
>
<div v-if="canEdit">
<span class="text-h7 text-weight-bold row justify-center">
{{ $t(col.label_trans ? col.label_trans : '') }}
{{ t(col.label_trans ? col.label_trans : '') }}
</span>
<CGallery
:imagebak="col.showpicprofile_ifnotset ? userStore.getImgByProfile(row['profile'], true) : ''"
@@ -441,7 +444,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.image_and_filename">
<div v-if="canEdit">
{{ $t('reg.photo') }}
{{ t('reg.photo') }}
<q-input
v-model="myvalue"
@update:value="changevalRec"
@@ -505,7 +508,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.imgcard">
<div v-if="canEdit">
{{ $t('reg.photo') }}
{{ t('reg.photo') }}
<CSelectImage
v-bind="$attrs"
:imagebak="col.showpicprofile_ifnotset ? userStore.getImgByProfile(row['profile'], true) : ''"
@@ -568,7 +571,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:tablesel="tablesel"
@@ -594,7 +597,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:tablesel="tablesel"
@@ -615,7 +618,11 @@
<div v-if="myvalue">
<CDateTime
:label="
col.label ? addstrrequired + col.label : col.label_trans ? addstrrequired + $t(col.label_trans) : undefined
col.label
? addstrrequired + col.label
: col.label_trans
? addstrrequired + t(col.label_trans)
: undefined
"
:class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue"
@@ -640,7 +647,11 @@
<div v-if="myvalue">
<CDateTime
:label="
col.label ? addstrrequired + col.label : col.label_trans ? addstrrequired + $t(col.label_trans) : undefined
col.label
? addstrrequired + col.label
: col.label_trans
? addstrrequired + t(col.label_trans)
: undefined
"
:class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue"
@@ -656,7 +667,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.binary">
<div v-if="isInModif">
<span v-if="insertMode"> {{ col.label ? col.label : $t(col.label_trans) }}: </span>
<span v-if="insertMode"> {{ col.label ? col.label : t(col.label_trans) }}: </span>
<CMyToggleList
:label="col.titlepopupedit ? col.titlepopupedit : undefined"
:options="globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)"
@@ -689,7 +700,7 @@
:row="row"
:multiple="true"
:withToggle="true"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
@@ -769,7 +780,7 @@
v-model="myvalue"
:inline="col.inline"
:type="col.typeobj"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
@update:model-value="changevalRec"
:options="globalStore.getTableJoinLabelValueByName(col)"
></q-option-group>
@@ -792,7 +803,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="myvalue"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:tablesel="col.fieldtype === costanti.FieldType.select_by_server ? tablesel : ''"
@@ -814,13 +825,13 @@
</div>
<div v-else>
<!--
rec: {{rec}}
row: {{row}}
col.jointable {{col.jointable}}
myvalue {{myvalue}}
opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)}}
val: {{fieldsTable.getKeyByTable(col.jointable)}}
lab: {{fieldsTable.getLabelByTable(col.jointable)}}-->
rec: {{rec}}<br><br>
row: {{row}}<br><br>
col.jointable {{col.jointable}}<br><br>
myvalue {{myvalue}}<br><br>
opt: {{globalStore.getTableJoinByName(col.jointable, col.addall, col.addnone, col.filter)}}<br><br>
val: {{fieldsTable.getKeyByTable(col.jointable)}}<br><br>
lab: {{fieldsTable.getLabelByTable(col.jointable)}}<br><br>-->
<CMyChipList
:rec="row"
myclass="text-center"
@@ -844,7 +855,7 @@
:col="col"
:row="row"
:multiselect_by_server="true"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:arrvalue="myvalue"
@update:arrvalue="changevalRec"
:addall="false"
@@ -873,7 +884,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="myvalue"
@update:value="changevalRec"
:filter_table="col.filter_table"
@@ -908,8 +919,8 @@
:dense="dense"
class="bg-primary text-white"
>
<span v-if="col.label_trans">{{ $t(col.label_trans) }}</span
><span v-else> {{ $t('event.testo_di_spiegazione') }}: </span>
<span v-if="col.label_trans">{{ t(col.label_trans) }}</span
><span v-else> {{ t('event.testo_di_spiegazione') }}: </span>
<q-space />
</q-bar>
<div v-if="!isFieldDb()">
@@ -1034,18 +1045,20 @@
</div>
<q-popup-edit
ref="popupEditRef"
v-if="!isInModif && canEdit && noPopupeditByCol(col)"
v-model="myvalue"
:disable="col.disable || disable || col.fieldtype === costanti.FieldType.image_and_filename"
:readonly="col.disable || disable"
:title="col.title ? col.title : col.titlepopupedit"
buttons
:label-set="$t('dialog.save')"
:label-cancel="$t('dialog.cancel')"
:label-set="t('dialog.save')"
:label-cancel="t('dialog.cancel')"
persistent
@save="SaveValueInt"
@show="OpenEdit"
v-slot="scope"
@cancel="handleCancel"
>
<div v-if="col.fieldtype === costanti.FieldType.boolean">
<q-checkbox
@@ -1065,9 +1078,10 @@
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : undefined"
:label="col.visulabel ? addstrrequired + t(col.label_trans) : undefined"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
@keydown="handleKeydown"
autofocus
:rules="[(val) => !!val || !col.required || 'Campo richiesto']"
>
@@ -1087,7 +1101,7 @@
debounce="1000"
:maxlength="col.maxlength ? col.maxlength : undefined"
autofocus
:label="col.visulabel ? $t(col.label_trans) : visulabel ? addstrrequired + col.label : undefined"
:label="col.visulabel ? t(col.label_trans) : visulabel ? addstrrequired + col.label : undefined"
>
</q-input>
</div>
@@ -1100,7 +1114,7 @@
:symbol="tools.getSymbolByCircuit(row)"
:color="tools.getColorByCircuit(row)"
v-model="scope.value"
:label="$t(col.label_trans)"
:label="t(col.label_trans)"
>
</CCurrencyValue>
</div>
@@ -1121,7 +1135,7 @@
autofocus
@update:model-value="changevalRec"
style="max-width: 100px"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
>
</q-input>
</div>
@@ -1162,7 +1176,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="scope.value"
:pickup="col.fieldtype === costanti.FieldType.select_by_server"
:addnone="col.addnone"
@@ -1186,7 +1200,7 @@
:col="col"
:row="row"
:multiselect_by_server="true"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:arrvalue="scope.value"
@update:arrvalue="changevalRec"
:addall="false"
@@ -1210,18 +1224,17 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.multiselect">
<CMySelect
v-if="scope.value"
:type_out="col.field_outtype"
:col="col"
:row="row"
:multiple="true"
:withToggle="true"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : col.label_trans ? t(col.label_trans) : ''"
:filter_table="col.filter_table"
:filter_field="col.filter_field"
:value_extra="value_extra"
v-model:arrvalue="scope.value"
@update:arrvalue="changevalRec"
:addall="false"
:addnone="false"
label-color="primary"
class="combowidth"
@@ -1288,7 +1301,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="scope.value"
@update:value="changevalRec"
:tablesel="tablesel"
@@ -1312,7 +1325,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="scope.value"
@update:value="changevalRec"
:tablesel="tablesel"
@@ -1329,7 +1342,11 @@
<div v-else-if="col.fieldtype === costanti.FieldType.date">
<CDateTime
:label="
col.label ? addstrrequired + col.label : col.label_trans ? addstrrequired + $t(col.label_trans) : undefined
col.label
? addstrrequired + col.label
: col.label_trans
? addstrrequired + t(col.label_trans)
: undefined
"
:class="{ 'cursor-pointer': canEdit }"
v-model:value="myvalue"
@@ -1343,7 +1360,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.onlydate">
<CDateTime
:label="col.label ? addstrrequired + col.label : addstrrequired + $t(col.label_trans)"
:label="col.label ? addstrrequired + col.label : addstrrequired + t(col.label_trans)"
:class="{ 'cursor-pointer': canEdit }"
:valueDate="myvalue"
v-model:value="myvalue"
@@ -1372,7 +1389,7 @@
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value"
:label="col.visulabel ? addstrrequired + $t(col.label_trans) : undefined"
:label="col.visulabel ? addstrrequired + t(col.label_trans) : undefined"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
@@ -1384,7 +1401,7 @@
:type_out="col.field_outtype"
:col="col"
:row="row"
:label="col.label ? col.label : $t(col.label_trans)"
:label="col.label ? col.label : t(col.label_trans)"
v-model:value="scope.value"
:optval="fieldsTable.getKeyByTable(col.jointable)"
:optlab="fieldsTable.getLabelByTable(col.jointable)"
@@ -1422,7 +1439,7 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.image_and_filename">
<div v-if="canEdit">
{{ $t('reg.photo') }}
{{ t('reg.photo') }}
<q-input
v-model="myvalue"
@update:value="changevalRec"

View File

@@ -21,10 +21,7 @@ export default defineComponent({
},
arrvalue: {
type: Array,
required: false,
default: () => {
return []
}
required: true,
},
value: [String, Number, Object],
label: {
@@ -268,7 +265,7 @@ export default defineComponent({
saveOptInCookie(newval)
// console.log(' ----- Myselect changeval Arrvalue', myarrvalue.value)
console.log(' ----- Myselect changeval Arrvalue', myarrvalue.value)
emit('update:arrvalue', myarrvalue.value)
emit('changeval', myarrvalue.value)
@@ -325,6 +322,7 @@ export default defineComponent({
}
function mounted() {
console.log('CMYSELECT: mounted')
optionsreal.value = props.options
if (props.focus) {
focusVisibleSelect()
@@ -352,7 +350,7 @@ export default defineComponent({
}
function update() {
// console.log('update', props.value, props)
console.log('update', props.value, props)
// console.log(' #### mounted myselect', props.options, 'arrvalue', myarrvalue.value)
let rec: any
if (optionsreal.value) {

View File

@@ -146,6 +146,11 @@ export default defineComponent({
required: false,
default: false,
},
showall: {
type: Boolean,
required: false,
default: false,
},
},
components: { CMyPopupEdit },
setup(props, { emit }) {
@@ -164,7 +169,10 @@ export default defineComponent({
console.log('showandsave CMyFieldDb', row, col, newval)
if (newval !== valinitial) {
return tools.saveInDBForTypes($q, props.mykey, newval, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey, props.specialField)
const ris = tools.saveInDBForTypes($q, props.mykey, newval, props.type, props.serv, props.table, props.mysubkey, props.id, props.indrec, props.mysubsubkey, props.specialField)
save(newval)
return ris
}
}

View File

@@ -50,6 +50,7 @@
:hint="title"
:title="title"
:field="mykey"
:showall="showall"
:filter="filter"
:subfield="mysubkey"
:specialField="specialField"

View File

@@ -6,6 +6,7 @@ import { tools } from '@tools'
import { useGlobalStore } from '@src/store/globalStore'
import { CMyValueDb } from '@src/components/CMyValueDb'
import { CSchedaProdotto } from '@src/components/CSchedaProdotto'
import { CSearchProduct } from '@src/components/CSearchProduct'
import { CMyDialog } from '@src/components/CMyDialog'
@@ -29,6 +30,7 @@ export default defineComponent({
emits: ["update:lista_prodotti", "update:optcatalogo"],
components: {
draggable, CSearchProduct, CMyDialog, CMyValueDb, CViewTable, CLabel,
CSchedaProdotto,
},
props: {
lista_prodotti: {
@@ -69,7 +71,6 @@ export default defineComponent({
const field_updated_fromGM = ref('')
const modifOn = ref(false)
const endload = ref(false)
const optionscatalogo = ref(<any>{maxlength: 0})
@@ -173,18 +174,6 @@ export default defineComponent({
.join(", ");
}
function formatCatProds(catprods: ICatProd[] | undefined | null): string {
if (!catprods || !Array.isArray(catprods)) {
return "";
}
// Estrai il nome e il cognome di ogni autore e uniscili con ', '
return catprods
.map((catprod) => `${catprod.name ?? ""}`.trim())
.filter((name) => name.length > 0) // Filtra eventuali nomi vuoti
.join(", ");
}
// Caricamento delle preferenze al mount del componente
onMounted(() => {
const savedColumns = tools.getCookie("selColCat");
@@ -269,7 +258,6 @@ export default defineComponent({
isColumnVisible,
internalProducts,
formatAuthors,
formatCatProds,
removeProduct,
modifyProduct,
tools,
@@ -290,7 +278,6 @@ export default defineComponent({
loading,
showQtaDisponibile,
modifOn,
endload,
updateproductmodif,
optionscatalogo,
t,

View File

@@ -82,11 +82,10 @@
</td>
<!-- Argomento -->
<td v-if="isColumnVisible('catprods')">{{ formatCatProds(element.productInfo?.catprods) }}</td>
<td v-if="isColumnVisible('catprods')">{{ tools.formatCatProds(element.productInfo?.catprods) }}</td>
<td v-if="isColumnVisible('date_pub')">{{ tools.getstrDate(element.productInfo?.date_pub) }}</td>
<td v-if="isColumnVisible('ranking')">{{ element.indiceRanking }}</td>
<td
v-if="isColumnVisible('rank3M')"
style="text-align: right"
@@ -189,13 +188,18 @@
maximized
>
<q-spinner
v-if="!endload"
v-if="loading"
color="primary"
size="3em"
:thickness="2"
/>
<div v-if="!!selProd && !!selProd.productInfo">
<CSchedaProdotto
v-model="selProd"
@updateproductmodif="updateproductmodif"
>
</CSchedaProdotto>
</div>
</q-dialog>
<q-dialog
@@ -216,7 +220,7 @@
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<q-spinner
v-if="!endload"
v-if="loading"
color="primary"
size="3em"
:thickness="2"

View File

@@ -17,11 +17,12 @@ import type {
import { shared_consts } from "app/src/common/shared_vuejs";
import { useProducts } from "app/src/store/Products";
import { useI18n } from "vue-i18n";
import { useQuasar } from "quasar";
export default defineComponent({
name: "CSchedaProdotto",
emits: [],
emits: ['updateproductmodif'],
components: {
CTableCupleLabelValue
},
@@ -37,14 +38,10 @@ export default defineComponent({
}),
},
updateproductmodif: {
type: Function as PropType<(element: any) => void>,
required: false,
default: () => () => { },
},
},
setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna
const $q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
@@ -52,6 +49,11 @@ export default defineComponent({
const mytab = ref('scheda')
const loading = ref(false)
const updatetogm = ref(false)
const field_updated_toGM = ref('')
const myproduct = ref<IProduct>({ ...props.modelValue })
watch(() => props.modelValue, (newVal) => {
@@ -95,6 +97,16 @@ export default defineComponent({
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Fatturati ultimi 6 Mesi",
table: "productinfos",
id: myproduct.value.productInfo._id,
rec: myproduct.value.productInfo,
mykey: "fatLast6M",
debounce: "1000",
type: costanti.FieldType.number,
},
{
editOn: false,
label: "Venduti",
@@ -172,17 +184,6 @@ export default defineComponent({
function getArrListDescrizioni(): IRecFields[] {
const arrlist: IRecFields[] = [
{
editOn: true,
label: "Descrizione breve macro",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "descrizione_breve_macro",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
},
{
editOn: true,
label: "Descrizione Trafiletto per Catalogo",
@@ -193,6 +194,19 @@ export default defineComponent({
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
showall: true,
},
{
editOn: true,
label: "Descrizione breve macro",
table: "productinfos",
id: myproduct.value.productInfo._id, // ID dinamico, da sostituire con il valore reale
rec: myproduct.value.productInfo, // Oggetto dinamico, da sostituire con il valore reale
mykey: "descrizione_breve_macro",
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
showall: true,
},
{
editOn: true,
@@ -205,6 +219,7 @@ export default defineComponent({
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
showall: true,
},
{
editOn: true,
@@ -216,6 +231,7 @@ export default defineComponent({
debounce: "1000",
type: costanti.FieldType.string,
dense: true,
showall: true,
},
]
@@ -258,6 +274,18 @@ export default defineComponent({
type: costanti.FieldType.onlydate,
dense: true,
},
{
editOn: true,
label: "Argomento",
table: "productinfos",
id: myproduct.value.productInfo?._id,
rec: myproduct.value.productInfo,
mykey: "idCatProds",
debounce: "1000",
type: costanti.FieldType.multiselect,
jointable: 'catprods',
dense: true,
},
{
editOn: true,
label: "Pagine",
@@ -334,6 +362,76 @@ export default defineComponent({
}
function updateproductmodif(element: any) {
console.log('CSCHEDAPRODOTTO updateproductmodif ', element)
emit('updateproductmodif', element)
}
async function updateFieldsDataToGM(data: any) {
if (myproduct.value) {
try {
loading.value = true; // Attiva lo stato di caricamento
updatetogm.value = true; // Indica che l'aggiornamento è in corso
// Ottieni lo SKU del prodotto corrente
const sku = myproduct.value.productInfo.sku;
if (!sku) {
throw new Error("SKU non disponibile per il prodotto.");
}
// Aggiorna il campo nel database utilizzando setGM_FieldOf_T_Web_Articoli
const result = await globalStore.setGM_FieldOf_T_Web_Articoli(
sku, // SKU del prodotto
data, // Nuovo valore per il campo
shared_consts.CmdQueryMs.SET // Comando per l'aggiornamento
);
console.log(`Record aggiornato con successo. Risultato:`, result);
} catch (error) {
console.error(`Errore durante l'aggiornamento del record:`, error.message);
throw new Error(`Errore durante l'aggiornamento del record: ${error.message}`);
} finally {
loading.value = false; // Disattiva lo stato di caricamento
updatetogm.value = false; // Indica che l'aggiornamento è terminato
}
} else {
console.warn("Nessun prodotto selezionato per l'aggiornamento.");
}
}
function updateRecordToGM() {
console.log('myproduct.value.productInfo.catprods', myproduct.value.productInfo.catprods)
let mydata = {
ListaArgomenti: products.getArrayidArgomentoByArridCatProds(myproduct.value.productInfo.idCatProds)
}
console.log('devo salvare mydata', mydata)
updateFieldsDataToGM(mydata)
}
async function updateproduct(load?: boolean) {
myproduct.value = await products.getProductById(myproduct.value._id, true)
}
async function refreshDataFromGM() {
if (myproduct.value) {
loading.value = true
const ris = await globalStore.updateLocalDbFromGM_T_Web_Articoli(myproduct.value.productInfo.sku!)
if (ris) {
await updateproduct(false)
tools.showPositiveNotif($q, t('dbgm.updateLocalDb_OK'))
}
loading.value = false
}
}
onMounted(mounted)
return {
@@ -348,6 +446,12 @@ export default defineComponent({
getArrListStat,
mytab,
myproduct,
updateproductmodif,
updatetogm,
field_updated_toGM,
loading,
updateRecordToGM,
refreshDataFromGM,
}
}
})

View File

@@ -11,53 +11,84 @@
></q-btn>
</q-toolbar>
<q-card-section class="q-pa-xs inset-shadow">
<q-tabs
v-model="mytab"
inline-label
class="text-blue shadow-2"
>
<q-tab
label="Scheda"
name="scheda"
icon="fas fa-file-alt"
></q-tab>
<q-tab
label="Descrizioni"
name="descr"
icon="fas fa-align-left"
></q-tab>
<q-tab
label="Statistiche"
name="stat"
icon="fas fa-stats"
></q-tab>
</q-tabs>
<q-tab-panels
v-model="mytab"
animated
>
<q-tab-panel name="scheda">
<CTableCupleLabelValue
:list="getArrListScheda()"
@updateproductmodif="updateproductmodif"
<div>
<q-inner-loading
id="spinner"
:showing="loading"
>
<q-spinner-tail
color="primary"
size="4em"
>
</CTableCupleLabelValue>
</q-tab-panel>
<q-tab-panel name="descr">
<CTableCupleLabelValue
:list="getArrListDescrizioni()"
@updateproductmodif="updateproductmodif"
>
</CTableCupleLabelValue>
</q-tab-panel>
<q-tab-panel name="stat">
<CTableCupleLabelValue
:list="getArrListStat()"
@updateproductmodif="updateproductmodif"
>
</CTableCupleLabelValue>
</q-tab-panel>
</q-tab-panels>
</q-spinner-tail>
</q-inner-loading>
<q-tabs
v-model="mytab"
inline-label
class="text-blue shadow-2"
>
<q-tab
label="Scheda"
name="scheda"
icon="fas fa-file-alt"
></q-tab>
<q-tab
label="Descrizioni"
name="descr"
icon="fas fa-align-left"
></q-tab>
<q-tab
label="Statistiche"
name="stat"
icon="fas fa-stats"
></q-tab>
</q-tabs>
<q-tab-panels
v-model="mytab"
animated
>
<q-tab-panel name="scheda">
<CTableCupleLabelValue
:list="getArrListScheda()"
@updateproductmodif="updateproductmodif"
>
</CTableCupleLabelValue>
</q-tab-panel>
<q-tab-panel name="descr">
<CTableCupleLabelValue
:list="getArrListDescrizioni()"
@updateproductmodif="updateproductmodif"
>
</CTableCupleLabelValue>
</q-tab-panel>
<q-tab-panel name="stat">
<CTableCupleLabelValue
:list="getArrListStat()"
@updateproductmodif="updateproductmodif"
>
</CTableCupleLabelValue>
</q-tab-panel>
</q-tab-panels>
</div>
<div class="">
<q-btn
rounded
class="q-ma-sm"
color="accent"
icon="fas fa-save"
label="Carica da GM"
@click="refreshDataFromGM"
></q-btn>
<q-btn
rounded
class="q-ma-sm"
color="accent"
icon="fas fa-save"
label="Aggiorna su GM"
@click="updateRecordToGM"
></q-btn>
</div>
</q-card-section>
</q-card>
</template>

View File

@@ -119,6 +119,7 @@ export default defineComponent({
async function loadProduct(id: string) {
// Carica il prodotto
console.log('loadProduct', id)
if (id) {
myproduct.value = await productStore.loadProductById(id)
@@ -192,7 +193,8 @@ export default defineComponent({
if (props.nameLinkTemplate) {
const linkIdTemplate = globalStore.getLinkIdTemplateByName(props.nameLinkTemplate)
optcatalogo.value.arrSchede[0].scheda.linkIdTemplate = linkIdTemplate
if (linkIdTemplate)
optcatalogo.value.arrSchede[0].scheda.linkIdTemplate = linkIdTemplate
} else {
optcatalogo.value.arrSchede[0].scheda.name = 'SEARCH_NEW'
}
@@ -265,6 +267,7 @@ export default defineComponent({
}
function updateproductmodif(element: IProduct) {
console.log('CSEARCHPRODUCT: updateproductmodif')
emit('updateproductmodif', element)
}

View File

@@ -23,6 +23,8 @@
:col="fieldsTable.getColByColumns(mycolumns, item.key)"
:label="item.value && item.value._id > 0 ? undefined : labelcombo(item)"
v-model:value="item.value"
v-model:arrvalue="item.arrvalue"
@update:arrvalue="updateproductmodif"
:addall="item.addall"
:addnone="item.addnone"
:focus="focus"
@@ -38,13 +40,17 @@
:filter="item.filter"
:filter_extra="item.filter_extra"
:useinput="item.useinput && item.type !== costanti.FieldType.select_by_server"
@clear="item.value = ''; myproduct = null; saveSearch()"
@clear="
item.value = '';
myproduct = null;
saveSearch();
"
>
</CMySelect>
</div>
<div
v-if="myproduct?._id"
v-if="myproduct?._id && optcatalogo.arrSchede?.length > 0"
class="row justify-center"
style="text-align: center"
>

View File

@@ -35,6 +35,7 @@ export default defineComponent({
}
function updateproductmodif(element: any) {
// console.log('CTABLECUPLE updateproductmodif ', element)
emit('updateproductmodif', element)
}

View File

@@ -18,8 +18,11 @@
:id="myrec.id"
:rec="myrec.rec"
:mykey="myrec.mykey"
:mysubkey="myrec.mysubkey"
:debounce="myrec.debounce"
:jointable="myrec.jointable"
:maxlength="myrec.maxlength"
:showall="myrec.showall"
:type="myrec.type"
:dense="myrec.dense ? myrec.dense : true"
@save="updateproductmodif"