ver: 1.1.21:
- Lista dei Cataloghi - Gestione Cataloghi in base alla configurazione
This commit is contained in:
@@ -2303,6 +2303,8 @@ export const shared_consts = {
|
||||
return add + 'grp' + add
|
||||
} else if (table === 'circuits') {
|
||||
return add + 'circuit' + add
|
||||
} else if (table === 'catalogs') {
|
||||
return add + 'catalogs' + add
|
||||
}
|
||||
|
||||
return ''
|
||||
|
||||
@@ -59,24 +59,25 @@ export default defineComponent({
|
||||
const tokenList = [
|
||||
{ label: '50 Token', value: 50 },
|
||||
{ label: '100 Token', value: 100 },
|
||||
{ label: '200 Token', value: 200 },
|
||||
{ label: '500 Token', value: 500 },
|
||||
{ label: '1000 Token', value: 1000 },
|
||||
{ label: '2500 Token', value: 2500 },
|
||||
{ label: '4000 Token', value: 4000 },
|
||||
{ label: '5000 Token', value: 5000 },
|
||||
{ label: '10000 Token', value: 10000 },
|
||||
{ label: '200 Token', value: 200 },
|
||||
{ label: '500 Token', value: 500 },
|
||||
{ label: '1000 Token', value: 1000 },
|
||||
{ label: '2500 Token', value: 2500 },
|
||||
{ label: '4000 Token', value: 4000 },
|
||||
{ label: '5000 Token', value: 5000 },
|
||||
{ label: '10000 Token', value: 10000 },
|
||||
]
|
||||
|
||||
const model = ref('deepseek-chat')
|
||||
const max_tokens = ref(100)
|
||||
const max_tokens = ref(50)
|
||||
const outputType = ref('')
|
||||
const temp = ref(0.3)
|
||||
const temperatura = ref(0.3)
|
||||
const stream = ref(false)
|
||||
const contestsystem = ref('')
|
||||
|
||||
const inputPrompt = ref('');
|
||||
const result = ref('');
|
||||
const outputvisibile = ref('');
|
||||
const isLoading = ref(false);
|
||||
const errorMessage = ref('');
|
||||
const finish_reason = ref('');
|
||||
@@ -95,56 +96,138 @@ export default defineComponent({
|
||||
|
||||
querylist.value = globalStore.getQueryAI()
|
||||
|
||||
outputType.value = outputTypeList[0].value
|
||||
model.value = tools.getCookie('AI_MOD', 'deepseek-chat')
|
||||
max_tokens.value = tools.getCookie('AI_MT', 50, true)
|
||||
withexplain.value = tools.getCookie('AI_WS', '0') === '1'
|
||||
outputType.value = tools.getCookie('AI_OT', outputTypeList[0].value)
|
||||
temperatura.value = tools.convstrToNum(tools.getCookie('AI_TEM', '0.3'))
|
||||
stream.value = tools.getCookie('AI_ST', '0') === '1'
|
||||
contestsystem.value = tools.getCookie('AI_CON', '')
|
||||
inputPrompt.value = tools.getCookie('AI_PRO', '')
|
||||
|
||||
}
|
||||
|
||||
function getInput() {
|
||||
return "Prompt:\n" + inputPrompt.value + '\n\nRisposta:\n'
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
isLoading.value = true;
|
||||
errorMessage.value = '';
|
||||
if (outputvisibile.value) {
|
||||
outputvisibile.value += '\n\n'
|
||||
}
|
||||
outputvisibile.value += getInput();
|
||||
result.value = '';
|
||||
finish_reason.value = '';
|
||||
|
||||
|
||||
tools.setCookie('AI_MOD', model.value)
|
||||
tools.setCookie('AI_MT', max_tokens.value.toString())
|
||||
tools.setCookie('AI_OT', outputType.value)
|
||||
tools.setCookie('AI_TEM', temperatura.value.toString())
|
||||
tools.setCookie('AI_ST', stream.value ? '1' : '0')
|
||||
tools.setCookie('AI_WE', withexplain.value ? '1' : '0')
|
||||
tools.setCookie('AI_CON', contestsystem.value)
|
||||
tools.setCookie('AI_PRO', inputPrompt.value)
|
||||
|
||||
options.value = {
|
||||
model: model.value,
|
||||
max_tokens: max_tokens.value,
|
||||
temp: temp.value,
|
||||
temp: temperatura.value,
|
||||
stream: stream.value,
|
||||
withexplain: withexplain.value,
|
||||
}
|
||||
outputType: outputType.value,
|
||||
};
|
||||
|
||||
try {
|
||||
if (options.value.stream) {
|
||||
// Modalità streaming
|
||||
const response = await globalStore.getQueryDS(inputPrompt.value, options.value);
|
||||
|
||||
const resdata = await globalStore.getQueryDS(inputPrompt.value, options.value)
|
||||
console.log('uscita da getQueryDS')
|
||||
|
||||
if (resdata.code === serv_constants.RIS_CODE_OK) {
|
||||
if (resdata.choice) {
|
||||
finish_reason.value = resdata.choice.finish_reason || ''
|
||||
isLoading.value = false;
|
||||
|
||||
// Leggi il flusso di dati
|
||||
const reader = response.data.getReader();
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
|
||||
// Decodifica il chunk e gestisci i dati
|
||||
const chunk = decoder.decode(value);
|
||||
console.log('Received chunk:', chunk); // Log del chunk ricevuto
|
||||
|
||||
const lines = chunk.split('\n\n').filter((line) => line.trim() !== '');
|
||||
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('data: ')) {
|
||||
const data = JSON.parse(line.slice(6)); // Rimuovi "data: " e parsifica il JSON
|
||||
if (data.choice && data.choice.delta && data.choice.delta.content) {
|
||||
result.value += data.choice.delta.content || ''
|
||||
outputvisibile.value += data.choice.delta.content || ''
|
||||
}
|
||||
|
||||
/*errorMessage.value = data.error;
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
icon: 'error',
|
||||
message: 'Errore durante la richiesta',
|
||||
caption: errorMessage.value,
|
||||
});
|
||||
break; // Interrompi il ciclo in caso di errore
|
||||
}*/
|
||||
} else if (line.startsWith('data: [DONE]')) {
|
||||
const data = JSON.parse(line.slice(12)); // Rimuovi "data: " e parsifica il JSON
|
||||
if (data.choice && data.choice.finish_reason) {
|
||||
finish_reason.value = data.choice.finish_reason;
|
||||
}
|
||||
inputPrompt.value = '';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (resdata.choice.message) {
|
||||
result.value = resdata.choice.message.content || ''
|
||||
} else {
|
||||
// Modalità non streaming
|
||||
const resdata = await globalStore.getQueryDS(inputPrompt.value, options.value);
|
||||
|
||||
if (resdata.code === serv_constants.RIS_CODE_OK) {
|
||||
inputPrompt.value = '';
|
||||
if (resdata.choice) {
|
||||
finish_reason.value = resdata.choice.finish_reason || '';
|
||||
}
|
||||
if (resdata.choice.message) {
|
||||
result.value = resdata.choice.message.content || '';
|
||||
outputvisibile.value += result.value
|
||||
}
|
||||
} else if (resdata.code === serv_constants.RIS_CODE_ERR) {
|
||||
errorMessage.value = resdata.error.message || resdata.error;
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
icon: 'error',
|
||||
message: 'Errore durante la richiesta',
|
||||
caption: errorMessage.value,
|
||||
});
|
||||
}
|
||||
} else if (resdata.code === serv_constants.RIS_CODE_ERR) {
|
||||
errorMessage.value = resdata.error.message || resdata.error;
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
icon: 'error',
|
||||
message: 'Errore durante la richiesta',
|
||||
caption: errorMessage.value
|
||||
});
|
||||
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
errorMessage.value = error.response?.data?.error || error.message;
|
||||
$q.notify({
|
||||
color: 'negative',
|
||||
icon: 'error',
|
||||
message: 'Errore durante la richiesta',
|
||||
caption: errorMessage.value
|
||||
caption: errorMessage.value,
|
||||
});
|
||||
}
|
||||
|
||||
isLoading.value = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
const copyToClipboard = () => {
|
||||
@@ -164,7 +247,14 @@ export default defineComponent({
|
||||
icon: 'error',
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function submitPrompt(event: any) {
|
||||
|
||||
if (inputPrompt.value.trim()) { // Controlla che l'input non sia vuoto
|
||||
handleSubmit(); // Inviare la richiesta
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(mount)
|
||||
|
||||
@@ -175,6 +265,7 @@ export default defineComponent({
|
||||
globalStore,
|
||||
inputPrompt,
|
||||
result,
|
||||
outputvisibile,
|
||||
isLoading,
|
||||
errorMessage,
|
||||
handleSubmit,
|
||||
@@ -193,6 +284,8 @@ export default defineComponent({
|
||||
withexplain,
|
||||
outputType,
|
||||
outputTypeList,
|
||||
temperatura,
|
||||
submitPrompt,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<q-page class="q-pa-md">
|
||||
<q-page class="q-mt-sm q-pa-sm">
|
||||
<div class="column text-center">
|
||||
<div class="row justify-center">
|
||||
<q-select
|
||||
@@ -60,10 +60,10 @@
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
outlined
|
||||
v-model="temp"
|
||||
v-model="temperatura"
|
||||
style="min-width: 200px"
|
||||
:options="tempList"
|
||||
:label="t('queryai.temp') + `:`"
|
||||
:label="t('queryai.temperatura') + `:`"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
@@ -76,7 +76,7 @@
|
||||
v-model="outputType"
|
||||
style="min-width: 200px"
|
||||
:options="outputTypeList"
|
||||
:label="t('queryai.numtoken') + `:`"
|
||||
:label="t('queryai.outputType') + `:`"
|
||||
emit-value
|
||||
map-options
|
||||
option-value="value"
|
||||
@@ -105,54 +105,35 @@
|
||||
<q-separator></q-separator>
|
||||
</div>
|
||||
|
||||
<div class="q-mt-md q-gutter-y-md">
|
||||
<q-form @submit.prevent="handleSubmit">
|
||||
<q-input
|
||||
v-model="inputPrompt"
|
||||
filled
|
||||
autogrow
|
||||
type="textarea"
|
||||
label="Inserisci la tua richiesta"
|
||||
hint="Scrivi qui il tuo prompt"
|
||||
class="q-mb-md"
|
||||
autofocus
|
||||
<q-card v-if="outputvisibile" class="q-mt-sm">
|
||||
<q-card-section>
|
||||
<q-scroll-area style="height: 300px">
|
||||
<pre class="response-content">{{ outputvisibile }}</pre>
|
||||
</q-scroll-area>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
label="Copia la Risposta"
|
||||
icon="content_copy"
|
||||
@click="copyToClipboard"
|
||||
v-tooltip="'Copia negli appunti'"
|
||||
/>
|
||||
<pre class="response-reason">Esito: {{ finish_reason }}</pre>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
:label="`Invia a ` + modelLabel"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:loading="isLoading"
|
||||
icon="send"
|
||||
/>
|
||||
</div>
|
||||
</q-form>
|
||||
|
||||
MARKDOWN:
|
||||
<q-markdown :content="`L'altezza \( h \) di un triangolo isoscele con base 10 è \( h = \sqrt{l^2 - 25} \), dove \( l \) è la lunghezza dei lati congruenti.`" />
|
||||
|
||||
<q-card v-if="result" class="q-mt-md">
|
||||
<q-card-section>
|
||||
<div class="text-h6 row items-center justify-between">
|
||||
<span>Risposta</span>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
icon="content_copy"
|
||||
@click="copyToClipboard"
|
||||
v-tooltip="'Copia negli appunti'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-markdown :content="result" />
|
||||
<q-scroll-area style="height: 300px">
|
||||
<pre class="response-content">{{ result }}</pre>
|
||||
</q-scroll-area>
|
||||
<pre class="response-reason">Esito: {{ finish_reason }}</pre>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<div class="q-mt-md q-gutter-y-md">
|
||||
<q-input
|
||||
v-model="inputPrompt"
|
||||
filled
|
||||
autogrow
|
||||
type="textarea"
|
||||
label="Inserisci la tua richiesta"
|
||||
class="q-mb-md"
|
||||
autofocus
|
||||
@keydown.enter.prevent="submitPrompt"
|
||||
/>
|
||||
|
||||
<q-banner
|
||||
v-if="errorMessage"
|
||||
@@ -162,6 +143,18 @@ MARKDOWN:
|
||||
{{ errorMessage }}
|
||||
</q-banner>
|
||||
|
||||
<div class="text-center">
|
||||
<q-btn
|
||||
:label="`Invia a ` + modelLabel"
|
||||
type="submit"
|
||||
color="primary"
|
||||
:disable="!inputPrompt"
|
||||
:loading="isLoading"
|
||||
icon="send"
|
||||
@click="handleSubmit"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-inner-loading :showing="isLoading">
|
||||
<q-spinner-gears size="50px" color="primary" />
|
||||
<div class="q-mt-sm">Elaborazione richiesta...</div>
|
||||
|
||||
@@ -40,19 +40,19 @@ export default defineComponent({
|
||||
default: false,
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
type: String,
|
||||
required: false,
|
||||
default: 100,
|
||||
default: '100',
|
||||
},
|
||||
gap: {
|
||||
type: Number,
|
||||
type: String,
|
||||
required: false,
|
||||
default: 0,
|
||||
default: '0',
|
||||
},
|
||||
fontsize: {
|
||||
type: Number,
|
||||
type: String,
|
||||
required: false,
|
||||
default: 16,
|
||||
default: '16',
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
@@ -68,14 +68,14 @@ export default defineComponent({
|
||||
JsBarcode("#C" + value.value, value.value, {
|
||||
format: format.value,
|
||||
width: widthlines.value,
|
||||
height: height.value,
|
||||
height: tools.convstrToNum(height.value),
|
||||
displayValue: true,
|
||||
lineColor: "#000",
|
||||
font: "monospace",
|
||||
margin: 0,
|
||||
textMargin: 0,
|
||||
marginTop: 0,
|
||||
fontSize: fontsize.value,
|
||||
fontSize: tools.convstrToNum(fontsize.value),
|
||||
textPosition: "bottom",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
:prop_searchList="searchList"
|
||||
:defaultnewrec="tools.getdefaultnewrec(table)"
|
||||
labelBtnAddRow="NONE"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable()"
|
||||
labelBtnAddExtra="Aggiungi Catalogo"
|
||||
:extraparams="tools.extraparams(table, { myrecfiltertoggle })"
|
||||
:prop_showMap="false"
|
||||
:heightcarousel="heightcarousel"
|
||||
@clickButtBar="clickButtBar"
|
||||
:opt="{rowclass: true, widthcard: '170px', heightcard: '170px'}"
|
||||
:opt="{rowclass: true, widthcard: $q.screen.gt.xs ? '300px' : '170px', heightcard: $q.screen.gt.xs ? '300px' : '170px'}"
|
||||
>
|
||||
</CGridTableRec>
|
||||
</div>
|
||||
|
||||
@@ -13,6 +13,11 @@ export default defineComponent({
|
||||
type: Object as PropType<IOptCatalogo>,
|
||||
required: true,
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<Catalogo v-model="localCatalogo" @updateCatalogo="updateCatalogoEmit()">
|
||||
<Catalogo v-model="localCatalogo" @updateCatalogo="updateCatalogoEmit()" :idPage="idPage">
|
||||
|
||||
</Catalogo>
|
||||
</div>
|
||||
|
||||
@@ -66,6 +66,11 @@ export default defineComponent({
|
||||
type: Object as PropType<IOptCatalogo>,
|
||||
required: true,
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
scheda: {
|
||||
type: Object as PropType<IMyScheda>,
|
||||
required: false,
|
||||
@@ -152,14 +157,16 @@ export default defineComponent({
|
||||
return products.replaceKeyWordsByProduct(
|
||||
optcatalogo.value,
|
||||
myproduct.value!,
|
||||
props.scheda!.testo_right!
|
||||
props.scheda!.testo_right!,
|
||||
props.idPage,
|
||||
)
|
||||
})
|
||||
const getTesto_Right_attaccato = computed(() => {
|
||||
return products.replaceKeyWordsByProduct(
|
||||
optcatalogo.value,
|
||||
myproduct.value!,
|
||||
props.scheda!.testo_right_attaccato!
|
||||
props.scheda!.testo_right_attaccato!,
|
||||
props.idPage,
|
||||
)
|
||||
})
|
||||
const getTesto_Debug = computed(() => {
|
||||
@@ -167,6 +174,7 @@ export default defineComponent({
|
||||
optcatalogo.value,
|
||||
myproduct.value!,
|
||||
{ contenuto: '{debug}', maxlength: 10000 },
|
||||
props.idPage,
|
||||
)
|
||||
})
|
||||
|
||||
@@ -174,7 +182,8 @@ export default defineComponent({
|
||||
return products.replaceKeyWordsByProduct(
|
||||
optcatalogo.value,
|
||||
myproduct.value!,
|
||||
props.scheda!.testo_bottom!
|
||||
props.scheda!.testo_bottom!,
|
||||
props.idPage,
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@
|
||||
:myproduct="myproduct"
|
||||
:optcatalogo="optcatalogo"
|
||||
:scheda="scheda"
|
||||
:idPage="idPage"
|
||||
>
|
||||
<div
|
||||
v-if="
|
||||
@@ -163,6 +164,8 @@
|
||||
:myproduct="myproduct"
|
||||
:optcatalogo="optcatalogo"
|
||||
:show_at_right="scheda.barcode.show_at_right"
|
||||
:scheda="scheda"
|
||||
:idPage="idPage"
|
||||
>
|
||||
<div class="row no-wrap items-center">
|
||||
<div v-if="scheda.barcode && scheda.barcode.show">
|
||||
@@ -241,6 +244,7 @@
|
||||
:optcatalogo="optcatalogo"
|
||||
:scheda="scheda"
|
||||
:show_at_right="scheda.barcode.show_at_right"
|
||||
:idPage="idPage"
|
||||
>
|
||||
<div class="row no-wrap items-center">
|
||||
<div v-if="scheda.barcode && scheda.barcode.show">
|
||||
@@ -320,6 +324,7 @@
|
||||
:scheda="scheda"
|
||||
:myproduct="myproduct"
|
||||
:optcatalogo="optcatalogo"
|
||||
:idPage="idPage"
|
||||
></CText>
|
||||
<!--<div v-if="optcatalogo.indebug">testo: "{{ getTesto_Bottom }}"</div>-->
|
||||
</div>
|
||||
@@ -456,7 +461,7 @@
|
||||
></iframe>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<q-card-actions align="bottom">
|
||||
<q-card-actions align="center">
|
||||
<q-btn color="primary" label="Chiudi" @click="apriSchedaPDF = false" />
|
||||
</q-card-actions>
|
||||
</q-dialog>
|
||||
|
||||
@@ -51,6 +51,11 @@ export default defineComponent({
|
||||
type: Object as PropType<IOptCatalogo>,
|
||||
required: true,
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
scheda: {
|
||||
type: Object as PropType<IMyScheda>,
|
||||
required: false,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
:id="id"
|
||||
:product="product"
|
||||
:complete="complete"
|
||||
:idPage="idPage"
|
||||
:cosa="cosa"
|
||||
:options="options"
|
||||
@selauthor="selauthor"
|
||||
@@ -33,6 +34,7 @@
|
||||
in_3d: true,
|
||||
}"
|
||||
v-model="optcatalogo"
|
||||
:idPage="idPage"
|
||||
@selauthor="selauthor"
|
||||
:scheda="scheda"
|
||||
>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
:prop_searchList="searchList"
|
||||
:defaultnewrec="tools.getdefaultnewrec(table)"
|
||||
labelBtnAddRow="NONE"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable()"
|
||||
:labelBtnAddExtra_OFF="noButtAdd ? `` : (ind >= 0) ? `Aggiungi ` + costanti.MAINCARDS[ind].strsingolo : ''"
|
||||
:labelBtnAddExtra="labelBtnAddExtra"
|
||||
:extraparams="tools.extraparams(table, {myrecfiltertoggle})"
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
:filtercustom="filtercustom"
|
||||
:prop_searchList="searchList"
|
||||
labelBtnAddRow="NONE"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable"
|
||||
:prop_SortFieldsAvailable="mySortFieldsAvailable()"
|
||||
labelBtnAddExtra=""
|
||||
:extraparams="tools.extraparams(table, { myrecfiltertoggle })"
|
||||
:prop_showMap="showMap"
|
||||
|
||||
@@ -274,8 +274,9 @@ export default defineComponent({
|
||||
default: 0,
|
||||
},
|
||||
defaultnewrec: {
|
||||
type: Function,
|
||||
type: Object,
|
||||
required: false,
|
||||
default: {},
|
||||
},
|
||||
col_title: {
|
||||
type: String,
|
||||
@@ -1722,7 +1723,7 @@ export default defineComponent({
|
||||
|
||||
|
||||
// @ts-ignore
|
||||
if (props.defaultnewrec) {
|
||||
if (!tools.isEmptyObject(props.defaultnewrec)) {
|
||||
// @ts-ignore
|
||||
newRecord.value = props.defaultnewrec
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,16 @@ export default defineComponent({
|
||||
required: true,
|
||||
default: '',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
class_text: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
copy: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</template>
|
||||
<template v-slot:control>
|
||||
<div class="self-center full-width no-outline" tabindex="0">
|
||||
{{ value }}
|
||||
<span :class="class_text" :style="`color: ` + color ">{{ value }}</span>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1640,6 +1640,14 @@
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
<q-toggle
|
||||
v-model="recscheda.scheda.isPagIntro"
|
||||
color="positive"
|
||||
icon="fas fa-file-pdf"
|
||||
:label="$t('scheda.isPagIntro')"
|
||||
@update:model-value="modifElem"
|
||||
>
|
||||
</q-toggle>
|
||||
<q-input
|
||||
label="Nome Template"
|
||||
@update:model-value="modifElem"
|
||||
|
||||
@@ -34,12 +34,18 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
maxlength: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 0,
|
||||
}
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
|
||||
const editorRef = ref(<any>null)
|
||||
const editor = ref('')
|
||||
const characterCount = ref(0)
|
||||
|
||||
//const myvalue = toRef(props, 'value')
|
||||
const myvalue = ref('')
|
||||
@@ -126,8 +132,16 @@ export default defineComponent({
|
||||
|
||||
})
|
||||
|
||||
function getTextLength(html: string) {
|
||||
// Crea un elemento temporaneo per convertire HTML in testo
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = html; // Imposta l'HTML
|
||||
return div.innerText.length; // Restituisce la lunghezza del testo
|
||||
}
|
||||
|
||||
function changeval(newval: any) {
|
||||
// console.log('myEditor: changeval', newval)
|
||||
characterCount.value = getTextLength(newval)
|
||||
emit('update:value', newval)
|
||||
}
|
||||
|
||||
@@ -186,6 +200,8 @@ export default defineComponent({
|
||||
myvalue.value = props.value
|
||||
|
||||
showtools.value = tools.getCookie('showtools', '0') === '1'
|
||||
|
||||
characterCount.value = getTextLength(myvalue.value)
|
||||
}
|
||||
|
||||
function onPaste (evt: any) {
|
||||
@@ -228,6 +244,7 @@ export default defineComponent({
|
||||
onPaste,
|
||||
editorRef,
|
||||
showtools,
|
||||
characterCount,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
<template>
|
||||
<div>
|
||||
<q-card class="dialog_card">
|
||||
<q-toolbar v-if="showButtons" class="bg-primary text-white" style="min-height: 30px;">
|
||||
<q-toolbar-title>
|
||||
Editor
|
||||
</q-toolbar-title>
|
||||
<q-btn flat round color="white" icon="close" v-close-popup @click="showeditor=false"></q-btn>
|
||||
<q-toolbar
|
||||
v-if="showButtons"
|
||||
class="bg-primary text-white"
|
||||
style="min-height: 30px"
|
||||
>
|
||||
<q-toolbar-title> Editor </q-toolbar-title>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="white"
|
||||
icon="close"
|
||||
v-close-popup
|
||||
@click="showeditor = false"
|
||||
></q-btn>
|
||||
</q-toolbar>
|
||||
<q-card-section class="inset-shadow" style="padding: 4px !important;">
|
||||
|
||||
<q-card-section class="inset-shadow" style="padding: 4px !important">
|
||||
<CTitleBanner v-if="title" :title="title"></CTitleBanner>
|
||||
<form
|
||||
autocapitalize="off"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
>
|
||||
|
||||
<q-toggle v-model="showtools" :label="showtools ? $t('editor.hidetool') : $t('editor.showtool')" @click="tools.setCookie('showtools', showtools ? '1' : '0')"></q-toggle>
|
||||
<br>
|
||||
<form autocapitalize="off" autocomplete="off" spellcheck="false">
|
||||
<q-toggle
|
||||
v-model="showtools"
|
||||
:label="showtools ? $t('editor.hidetool') : $t('editor.showtool')"
|
||||
@click="tools.setCookie('showtools', showtools ? '1' : '0')"
|
||||
></q-toggle>
|
||||
<br />
|
||||
<q-btn v-if="showtools" rounded size="sm" color="primary">
|
||||
<q-icon name="colorize" class="cursor-pointer">
|
||||
<q-popup-proxy>
|
||||
@@ -38,17 +45,35 @@
|
||||
@update:model-value="changeval"
|
||||
@paste="onPaste"
|
||||
@keyup.enter.stop
|
||||
v-model="myvalue">
|
||||
v-model="myvalue"
|
||||
>
|
||||
</q-editor>
|
||||
<div v-if="maxlength" class="text-gray text-italic">Caratteri: {{ characterCount }} / {{ maxlength }}</div>
|
||||
</form>
|
||||
</q-card-section>
|
||||
<q-card-actions v-if="showButtons" align="center">
|
||||
<q-btn v-if="canModify" :label="$t('dialog.ok')" color="primary" @click="saveval"></q-btn>
|
||||
<q-btn v-if="canModify" flat :label="$t('dialog.cancel')" color="primary" v-close-popup @click="annulla"></q-btn>
|
||||
<q-btn v-if="!canModify" :label="$t('dialog.ok')" color="primary" v-close-popup></q-btn>
|
||||
<q-btn
|
||||
v-if="canModify"
|
||||
:label="$t('dialog.ok')"
|
||||
color="primary"
|
||||
@click="saveval"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="canModify"
|
||||
flat
|
||||
:label="$t('dialog.cancel')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
@click="annulla"
|
||||
></q-btn>
|
||||
<q-btn
|
||||
v-if="!canModify"
|
||||
:label="$t('dialog.ok')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
></q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -87,6 +87,11 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
editOn: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
|
||||
@@ -667,6 +667,7 @@
|
||||
<div v-if="editOn" class="elemEdit">PRODOTTI CATALOGO:</div>
|
||||
<CCatalogo
|
||||
v-model="myel.catalogo"
|
||||
:idPage="idPage"
|
||||
@updateCatalogo="updateCatalogoEmit()"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
>
|
||||
<CMyElem
|
||||
:myelem="myelem"
|
||||
:idPage="rec._id"
|
||||
:editOn="editOn"
|
||||
:addOn="addOn"
|
||||
:path="!!rec.path ? rec.path : ''"
|
||||
@@ -123,6 +124,7 @@
|
||||
:myelem="myelem"
|
||||
:editOn="editOn"
|
||||
:addOn="addOn"
|
||||
:idPage="rec._id"
|
||||
:path="!!rec.path ? rec.path : ''"
|
||||
:selElem="selElem"
|
||||
@selElemClick="selElemClick"
|
||||
@@ -141,6 +143,7 @@
|
||||
:myelem="myelemVoid"
|
||||
:editOn="editOn"
|
||||
:addOn="addOn"
|
||||
:idPage="rec._id"
|
||||
:selElem="selElem"
|
||||
:path="rec.path"
|
||||
@selElemClick="selElemClick"
|
||||
|
||||
@@ -65,6 +65,7 @@
|
||||
:myelem="myelem"
|
||||
:editOn="editOn"
|
||||
:addOn="addOn"
|
||||
:idPage="rec._id"
|
||||
:path="rec.path"
|
||||
:selElem="selElem"
|
||||
@selElemClick="selElemClick"
|
||||
@@ -77,6 +78,7 @@
|
||||
:myelem="myelemVoid"
|
||||
:editOn="editOn"
|
||||
:addOn="addOn"
|
||||
:idPage="rec._id"
|
||||
:selElem="selElem"
|
||||
:path="rec.path"
|
||||
@selElemClick="selElemClick"
|
||||
|
||||
@@ -1609,6 +1609,7 @@
|
||||
:canModify="canModify"
|
||||
@update:value="changevalRec"
|
||||
@showandsave="Savedb"
|
||||
:maxlength="col.maxlength"
|
||||
>
|
||||
</CMyEditor>
|
||||
</div>
|
||||
|
||||
@@ -69,13 +69,15 @@
|
||||
/* Arrotonda gli angoli dello sfondo */
|
||||
}
|
||||
|
||||
.text-h6 {
|
||||
font-family: 'Arial', sans-serif;
|
||||
/* Scegli un font accattivante e comune */
|
||||
font-size: 1.15rem;
|
||||
/* Dimensione del font modificabile */
|
||||
color: #FFF;
|
||||
/* Colore del testo */
|
||||
margin-top: auto;
|
||||
/* Assicura che il titolo sia posizionato alla base della scheda */
|
||||
|
||||
.clickable-image {
|
||||
cursor: pointer;
|
||||
/* Cambia il cursore a puntatore quando si passa sopra */
|
||||
transition: transform 0.2s;
|
||||
/* Aggiunge una transizione dolce */
|
||||
}
|
||||
|
||||
.clickable-image:hover {
|
||||
transform: scale(1.05);
|
||||
/* Aumenta leggermente l'immagine al passaggio del mouse */
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineComponent, onMounted, PropType, ref, watch, computed } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { IImgGallery, IOptGrid, IUserFields, IUserProfile } from 'model'
|
||||
import { ICatalog, IImgGallery, IOptGrid, IUserFields, IUserProfile } from 'model'
|
||||
import { costanti } from '@costanti'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
@@ -8,14 +8,18 @@ import { tools } from '@store/Modules/tools'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { CLabel } from '@/components/CLabel'
|
||||
import { CMyCardPopup } from '@/components/CMyCardPopup'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useCalendarStore } from '@src/store/CalendarStore'
|
||||
import { useGlobalStore } from '@src/store/globalStore'
|
||||
|
||||
import { ICollana, IPublisher } from "@src/model/Products"
|
||||
import { useProducts } from '@src/store/Products'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMyRecCatalog',
|
||||
components: { CMyCardPopup },
|
||||
components: { CMyCardPopup, CLabel },
|
||||
emits: ['setCmd', 'cmdext'],
|
||||
props: {
|
||||
table: {
|
||||
@@ -53,12 +57,36 @@ export default defineComponent({
|
||||
const { t } = useI18n()
|
||||
const $router = useRouter()
|
||||
|
||||
const myrec = ref(<any>null)
|
||||
const myrec = ref(<ICatalog>{})
|
||||
|
||||
const statecolor = ref('negative')
|
||||
const apriInfo = ref(false)
|
||||
const collanestr = ref('')
|
||||
const editorestr = ref('')
|
||||
|
||||
const products = useProducts()
|
||||
|
||||
const visupage = ref(false)
|
||||
const disabilita = computed(() => {
|
||||
return props.table === shared_consts.TABLES_MYBACHECAS
|
||||
})
|
||||
})
|
||||
const esiste_descrintro = computed(() => {
|
||||
return myrec.value.descr_introduttiva && myrec.value.descr_introduttiva.length > 100
|
||||
})
|
||||
const pagina_collegata = computed(() => {
|
||||
|
||||
let linkpage = ''
|
||||
|
||||
let idpag = myrec.value.idPageAssigned
|
||||
if (idpag) {
|
||||
let mypage = globalStore.getPageById(idpag)
|
||||
if (mypage)
|
||||
linkpage = mypage.path!
|
||||
}
|
||||
|
||||
return linkpage
|
||||
|
||||
})
|
||||
|
||||
watch(() => props.prop_myrec, (newval, oldval) => {
|
||||
|
||||
@@ -70,6 +98,30 @@ export default defineComponent({
|
||||
if (props.prop_myrec) {
|
||||
myrec.value = props.prop_myrec
|
||||
}
|
||||
|
||||
collanestr.value = ''
|
||||
if (myrec.value.idCollane) {
|
||||
for (const idcollana of myrec.value.idCollane!) {
|
||||
const reccoll: ICollana = products.collane!.find((coll: ICollana) => coll.idCollana === idcollana)
|
||||
collanestr.value += reccoll.title + ' '
|
||||
}
|
||||
}
|
||||
editorestr.value = ''
|
||||
if (myrec.value.editore) {
|
||||
for (const receditore of myrec.value.editore!) {
|
||||
const rectrovato: IPublisher = products.publishers!.find((editore: IPublisher) => editore._id === receditore)
|
||||
editorestr.value += rectrovato!.name + ' '
|
||||
}
|
||||
}
|
||||
|
||||
statecolor.value = 'negative'
|
||||
|
||||
if (myrec.value.descr_introduttiva && myrec.value.img_bordata?.imagefile && myrec.value.img_intro?.imagefile) {
|
||||
statecolor.value = 'orange-8'
|
||||
if (myrec.value.pdf_generato) {
|
||||
statecolor.value = 'positive'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showBadge() {
|
||||
@@ -88,6 +140,8 @@ export default defineComponent({
|
||||
$router.push(path)
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setCmd($q: any, cmd: number, myusername: string, value: any, groupname: string) {
|
||||
emit('setCmd', $q, cmd, myusername, value, groupname)
|
||||
}
|
||||
@@ -138,6 +192,12 @@ export default defineComponent({
|
||||
disabilita,
|
||||
globalStore,
|
||||
computedWidth,
|
||||
statecolor,
|
||||
apriInfo,
|
||||
collanestr,
|
||||
editorestr,
|
||||
pagina_collegata,
|
||||
esiste_descrintro,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,76 +1,236 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="myrec"
|
||||
class="q-py-xs centermydiv cardrec back_img column justify-between"
|
||||
:style="{
|
||||
width: opt.widthcard,
|
||||
height: opt.heightcard,
|
||||
backgroundImage:
|
||||
`url(` +
|
||||
tools.getFullFileName(
|
||||
[myrec.foto_collana],
|
||||
table,
|
||||
myrec.username,
|
||||
myrec._id
|
||||
) +
|
||||
`)`,
|
||||
}"
|
||||
>
|
||||
<div class="flex-grow" />
|
||||
<!-- Questo elemento occupa spazio per separare l'immagine dal titolo -->
|
||||
<div class="title-container">
|
||||
<div class="text-h6 text-center">
|
||||
{{ myrec.title }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-pa-sm row items-start q-gutter-sm">
|
||||
<q-card
|
||||
v-if="myrec"
|
||||
flat
|
||||
bordered
|
||||
:style="`width: ` + opt.widthcard + `; height: 540px;`"
|
||||
>
|
||||
<!--<q-skeleton
|
||||
v-if="!myrec.foto_collana"
|
||||
type="QAvatar"
|
||||
:width="opt.widthcard"
|
||||
:height="opt.heightcard"
|
||||
/>-->
|
||||
<q-img
|
||||
:width="opt.widthcard"
|
||||
@click="apriInfo = true"
|
||||
:height="opt.heightcard"
|
||||
class="clickable-image"
|
||||
:src="
|
||||
tools.getFullFileName(
|
||||
[myrec.foto_collana],
|
||||
table,
|
||||
myrec.username,
|
||||
myrec._id
|
||||
)
|
||||
"
|
||||
>
|
||||
<template v-slot:error>
|
||||
<div class="absolute-full flex flex-center text-white">
|
||||
immagine non impostata
|
||||
</div>
|
||||
</template>
|
||||
<div class="text-h6 absolute-bottom text-left">
|
||||
{{ myrec.title }}
|
||||
</div>
|
||||
</q-img>
|
||||
|
||||
<q-item>
|
||||
<q-item-section side v-if="tools.canModifyThisRec(myrec, table) || editOn">
|
||||
<q-item-label>
|
||||
<q-btn rounded dense icon="fas fa-pencil-alt" color="blue">
|
||||
<q-menu>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="cmdExt(costanti.CMD_MODIFY, myrec._id, null)"
|
||||
>
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-pencil-alt" />
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('reg.edit') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="cmdExt(costanti.CMD_CLONE, myrec._id, null)"
|
||||
>
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-copy" />
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('event.duplicate') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<q-list style="min-width: 150px">
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="cmdExt(costanti.CMD_DELETE, myrec._id, null)"
|
||||
>
|
||||
<q-item-section side>
|
||||
<q-icon name="fas fa-trash-alt" />
|
||||
</q-item-section>
|
||||
<q-item-section>{{ $t('reg.elimina') }}</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-card-section>
|
||||
<div
|
||||
v-if="!myrec.foto_collana"
|
||||
class="q-mt-sm q-mb-xs"
|
||||
style="font-size: 1.15rem"
|
||||
>
|
||||
{{ myrec.title }}
|
||||
</div>
|
||||
<div class="text-caption text-h7 text-grey">
|
||||
<q-icon name="fas fa-user" /> Referente:
|
||||
<span
|
||||
v-if="myrec.referenti && myrec.referenti.length > 0"
|
||||
:class="
|
||||
`text-bold ` + myrec.referenti && myrec.referenti.length > 0
|
||||
? 'text-blue'
|
||||
: 'text-red'
|
||||
"
|
||||
>
|
||||
{{ myrec.referenti ? myrec.referenti.join(', ') : '' }}
|
||||
</span>
|
||||
<span v-else>
|
||||
<span class="text-red">[Nessuno]</span>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="collanestr" class="text-caption text-h7 text-grey">
|
||||
<q-icon name="fas fa-book" /> Collana:
|
||||
<span class="text-blue">{{ collanestr }}</span>
|
||||
</div>
|
||||
<div v-if="editorestr" class="text-caption text-h7 text-grey">
|
||||
<q-icon name="fas fa-book-open" /> Editore:
|
||||
<span class="text-blue">{{ editorestr }}</span>
|
||||
</div>
|
||||
<div v-if="!esiste_descrintro" class="text-caption text-h7 text-grey">
|
||||
<q-icon name="fas fa-pencil-alt" /> Testo descrittivo:
|
||||
<span :style="`color: ` + (esiste_descrintro ? 'green' : 'red')">{{
|
||||
esiste_descrintro ? 'Presente' : 'Mancante'
|
||||
}}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="!myrec.img_bordata?.imagefile"
|
||||
class="text-caption text-h7 text-grey"
|
||||
>
|
||||
<q-icon name="fas fa-image" /> Sfondo:
|
||||
<span
|
||||
:style="
|
||||
`color: ` + (myrec.img_bordata?.imagefile ? 'green' : 'red')
|
||||
"
|
||||
>{{ esiste_descrintro ? 'Presente' : 'Mancante' }}</span
|
||||
>
|
||||
</div>
|
||||
<div
|
||||
v-if="!myrec.img_intro?.imagefile"
|
||||
class="text-caption text-h7 text-grey"
|
||||
>
|
||||
<q-icon name="fas fa-image" /> Copertina:
|
||||
<span
|
||||
:style="`color: ` + (myrec.img_intro?.imagefile ? 'green' : 'red')"
|
||||
>{{ esiste_descrintro ? 'Presente' : 'Mancante' }}</span
|
||||
>
|
||||
</div>
|
||||
<div v-if="myrec.pdf_generato" class="text-caption text-h7 text-blue">
|
||||
<q-icon name="fas fa-book" /> -
|
||||
<a :href="myrec.pdf_generato" target="_blank">PDF Generato</a>
|
||||
(Data: {{tools.getstrDate(myrec.data_generato)}})
|
||||
</div>
|
||||
<div v-if="myrec.pdf_online" class="text-caption text-h7 text-blue">
|
||||
<q-icon name="fas fa-book" /> -
|
||||
<a :href="myrec.pdf_online" target="_blank">PDF ONLINE</a>
|
||||
(Data: {{tools.getstrDate(myrec.data_online)}})
|
||||
</div>
|
||||
<!--<div class="text-overline text-orange-9">{{collanestr}}</div>-->
|
||||
</q-card-section>
|
||||
|
||||
<q-card-actions>
|
||||
<div class="row justify-center">
|
||||
<q-fab
|
||||
color="primary"
|
||||
icon="fas fa-caret-down"
|
||||
label="Menu"
|
||||
direction="up"
|
||||
flat
|
||||
dense
|
||||
>
|
||||
<q-fab-action
|
||||
v-if="tools.canModifyThisRec(myrec, table) || editOn"
|
||||
@click="cmdExt(costanti.CMD_DELETE, myrec._id, null)"
|
||||
color="negative"
|
||||
:label="$t('reg.elimina')"
|
||||
icon="fas fa-trash-alt"
|
||||
/>
|
||||
<q-fab-action
|
||||
v-if="tools.canModifyThisRec(myrec, table) || editOn"
|
||||
@click="cmdExt(costanti.CMD_CLONE, myrec._id, null)"
|
||||
color="accent"
|
||||
:label="$t('event.duplicate')"
|
||||
icon="fas fa-copy"
|
||||
/>
|
||||
<q-fab-action
|
||||
color="positive"
|
||||
label="Gestisci"
|
||||
icon="fas fa-book-open"
|
||||
@click="naviga(pagina_collegata)"
|
||||
/>
|
||||
<q-fab-action
|
||||
v-if="tools.canModifyThisRec(myrec, table) || editOn"
|
||||
@click="cmdExt(costanti.CMD_MODIFY, myrec._id, null)"
|
||||
color="primary"
|
||||
:label="$t('reg.edit')"
|
||||
icon="fas fa-pencil-alt"
|
||||
/>
|
||||
</q-fab>
|
||||
<q-btn
|
||||
flat
|
||||
color="primary"
|
||||
label="Info"
|
||||
icon="fas fa-info"
|
||||
@click="apriInfo = true"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
:color="statecolor"
|
||||
label="PDF"
|
||||
icon="fas fa-book"
|
||||
:disable="!myrec.pdf_generato"
|
||||
@click="naviga(myrec.pdf_generato)"
|
||||
/>
|
||||
</div>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<q-dialog v-model="apriInfo">
|
||||
<q-card>
|
||||
<q-toolbar class="bg-primary text-white">
|
||||
<q-toolbar-title>
|
||||
{{ myrec.title }}
|
||||
</q-toolbar-title>
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
color="white"
|
||||
label="CHIUDI"
|
||||
icon="close"
|
||||
v-close-popup
|
||||
></q-btn>
|
||||
</q-toolbar>
|
||||
<q-card-section>
|
||||
<div class="row justify-center q-ma-sm q-pa-sm">
|
||||
<div style="width: 300px" class="q-ma-sm">
|
||||
<CLabel
|
||||
:value="
|
||||
myrec.referenti && myrec.referenti.length > 0
|
||||
? myrec.referenti.join(', ')
|
||||
: '[Non Assegnato]'
|
||||
"
|
||||
label="Referente/i:"
|
||||
:color="
|
||||
myrec.referenti && myrec.referenti.length > 0
|
||||
? 'text-blue'
|
||||
: 'text-red'
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div style="width: 300px" class="q-ma-sm">
|
||||
<CLabel v-if="collanestr" :value="collanestr" label="Collana/e:" />
|
||||
</div>
|
||||
<div style="width: 300px" class="q-ma-sm">
|
||||
<CLabel
|
||||
class_text="text-bold"
|
||||
:value="esiste_descrintro ? 'PRESENTE ' : 'MANCANTE !'"
|
||||
label="Testo descrittivo"
|
||||
:color="esiste_descrintro ? 'green' : 'red'"
|
||||
/>
|
||||
</div>
|
||||
<div style="width: 300px" class="q-ma-sm">
|
||||
<CLabel
|
||||
:value="myrec.pdf_generato || 'ancora non è stato generato'"
|
||||
label="PDF generato"
|
||||
:color="myrec.pdf_generato ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
<CLabel
|
||||
:value="myrec.pdf_online || 'ancora non è andato ONLINE'"
|
||||
label="PDF On-Line Ufficiale"
|
||||
:color="myrec.pdf_online ? 'green' : 'red'"
|
||||
:copy="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<q-card-actions align="center">
|
||||
<q-btn color="primary" label="Chiudi" @click="apriInfo = false" />
|
||||
</q-card-actions>
|
||||
</q-dialog>
|
||||
</template>
|
||||
<script lang="ts" src="./CMyRecCatalog.ts">
|
||||
</script>
|
||||
|
||||
@@ -48,6 +48,8 @@ export default defineComponent({
|
||||
|
||||
const sliderValue = computed({
|
||||
get: () => {
|
||||
if (!props.modelValue)
|
||||
return ''
|
||||
let mystr = props.modelValue + ''
|
||||
return mystr.replace(props.addstr, '')
|
||||
},
|
||||
|
||||
@@ -1031,7 +1031,7 @@
|
||||
></iframe>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
<q-card-actions align="bottom">
|
||||
<q-card-actions align="center">
|
||||
<q-btn color="primary" label="Chiudi" @click="apriSchedaPDF = false" />
|
||||
</q-card-actions>
|
||||
</q-dialog>
|
||||
|
||||
@@ -36,6 +36,11 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: false,
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { attrs, slots, emit }) {
|
||||
@@ -48,6 +53,7 @@ export default defineComponent({
|
||||
props.optcatalogo,
|
||||
props.myproduct,
|
||||
props.rectext,
|
||||
props.idPage,
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -905,6 +905,10 @@ h3 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.text-h7 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.text-h8 {
|
||||
font-size: 0.85rem !important;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<meta name="description" content="<%= productDescription %>">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="version" content="1.1.20">
|
||||
<meta name="version" content="1.1.21">
|
||||
<meta name="viewport"
|
||||
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover<% } %>">
|
||||
|
||||
|
||||
@@ -1,33 +1,28 @@
|
||||
import { IImg } from "./GlobalStore"
|
||||
import { ICollana } from "./Products"
|
||||
|
||||
export interface FotoCatalogo {
|
||||
imagefile: string
|
||||
alt: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface FilesCataloghi {
|
||||
per_web: string
|
||||
per_stampa: string
|
||||
}
|
||||
|
||||
export interface ICatalog {
|
||||
_id: string
|
||||
idapp: string
|
||||
active?: boolean
|
||||
versione_perstampa?: boolean
|
||||
title: string
|
||||
foto_collana?: FotoCatalogo,
|
||||
foto_collana?: IImg,
|
||||
idCollane?: number[]
|
||||
editore?: string[]
|
||||
collana_info?: ICollana
|
||||
descr_introduttiva?: string
|
||||
idPageAssigned?: string
|
||||
referenti?: string[]
|
||||
img_bordata_web?: FotoCatalogo,
|
||||
img_bordata_stampa?: FotoCatalogo,
|
||||
img_intro_web?: FotoCatalogo,
|
||||
img_intro_stampa?: FotoCatalogo,
|
||||
img_bordata?: IImg,
|
||||
img_intro?: IImg,
|
||||
pagina_introduttiva_sfondo_nero?: boolean
|
||||
|
||||
generati?: FilesCataloghi,
|
||||
online?: FilesCataloghi,
|
||||
pdf_generato?: string
|
||||
data_generato?: Date
|
||||
pdf_online?: string
|
||||
data_online?: Date
|
||||
|
||||
date_created?: Date,
|
||||
date_updated?: Date,
|
||||
|
||||
@@ -783,6 +783,7 @@ export interface IMyScheda {
|
||||
_id?: string,
|
||||
idapp?: string,
|
||||
isTemplate?: boolean,
|
||||
isPagIntro?: boolean,
|
||||
linkIdTemplate?: string,
|
||||
name?: string,
|
||||
numschede_perRiga?: number
|
||||
|
||||
@@ -286,4 +286,6 @@ export interface IUserState {
|
||||
countusers?: number
|
||||
lastparamquery?: any
|
||||
updateTables?: boolean
|
||||
|
||||
lista_editori?: IUserShort[]|null
|
||||
}
|
||||
|
||||
@@ -1673,7 +1673,7 @@ const msg_it = {
|
||||
},
|
||||
|
||||
myelems: {
|
||||
active: 'active',
|
||||
active: 'Attiva',
|
||||
img: 'img',
|
||||
image: 'Immagine:',
|
||||
path: 'Path',
|
||||
@@ -2014,10 +2014,20 @@ const msg_it = {
|
||||
cataloglist: {
|
||||
foto_collana: 'Foto Collana',
|
||||
referenti: 'Referenti',
|
||||
img_bordata_web: 'Foto Bordo per Web',
|
||||
img_bordata: 'Immagine di sfondo',
|
||||
img_intro: 'Immagine sfondo pagina introduttiva',
|
||||
pagina_introduttiva_sfondo_nero: 'Pagina intro a sfondo nero',
|
||||
collane: 'Collane',
|
||||
idPageAssigned: 'Pagina Assegnata',
|
||||
descr_introduttiva: 'Descrizione Introduttiva',
|
||||
descr_introduttiva: 'Descrizione Introduttiva (circa 1300 battute)',
|
||||
editore: 'Editori',
|
||||
versione_perstampa: 'Per Stampa',
|
||||
pdf_generato: 'Pdf generato',
|
||||
pdf_online: 'Pdf online Ufficiale',
|
||||
},
|
||||
|
||||
scheda: {
|
||||
isPagIntro: 'Pagina Introduttiva',
|
||||
},
|
||||
|
||||
queryai: {
|
||||
@@ -2032,6 +2042,7 @@ const msg_it = {
|
||||
contestsystem: 'Contesto',
|
||||
withexplain: 'Con Spiegazione',
|
||||
temperatura: 'Temperatura',
|
||||
outputType: 'Formato di Uscita',
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -4,12 +4,12 @@ import axios, {
|
||||
import { Api } from '@api'
|
||||
import * as Types from '@src/store/Api/ApiTypes'
|
||||
|
||||
async function sendRequest(url: string, method: string, mydata: any, myformdata?: any, responsedata?: any) {
|
||||
async function sendRequest(url: string, method: string, mydata: any, myformdata?: any, responsedata?: any, options?: any) {
|
||||
console.log('sendRequest', method, url, mydata)
|
||||
|
||||
let request
|
||||
if (method === 'GET') request = Api.get(url, mydata, responsedata)
|
||||
else if (method === 'POST') request = Api.post(url, mydata, responsedata)
|
||||
else if (method === 'POST') request = Api.post(url, mydata, responsedata, options)
|
||||
else if (method === 'postFormData') request = Api.postFormData(url, myformdata, responsedata)
|
||||
else if (method === 'DELETE') request = Api.Delete(url, mydata, responsedata)
|
||||
else if (method === 'PUT') request = Api.put(url, mydata, responsedata)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import axios, { AxiosInstance, AxiosResponse } from 'axios'
|
||||
import axios, { AxiosRequestConfig, AxiosInstance, AxiosResponse } from 'axios'
|
||||
|
||||
// import LoginModule from '../Modules/Auth/LoginStore'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -7,6 +8,9 @@ import { useUserStore } from '@store/UserStore'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import * as Types from './ApiTypes'
|
||||
|
||||
import { from, Observable } from 'rxjs';
|
||||
import { mergeMap, toArray } from 'rxjs/operators';
|
||||
|
||||
export let API_URL = ''
|
||||
export const axiosInstance: AxiosInstance = axios.create({
|
||||
baseURL: API_URL,
|
||||
@@ -15,6 +19,7 @@ export const axiosInstance: AxiosInstance = axios.create({
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
|
||||
(response) => {
|
||||
@@ -26,7 +31,7 @@ axiosInstance.interceptors.response.use(
|
||||
// console.log('error', error)
|
||||
if (error.response) {
|
||||
if (process.env.DEBUGGING === '1') console.log('Status = ', error.response.status)
|
||||
console.log('Request Error: ', error.response)
|
||||
console.log('Request Error: ', error.response)
|
||||
if (error.response.status !== 0) {
|
||||
globalStore.setStateConnection('online')
|
||||
} else {
|
||||
@@ -47,7 +52,64 @@ export const addAuthHeaders = () => {
|
||||
// delete axiosInstance.defaults.headers.Authorization
|
||||
//}
|
||||
|
||||
async function Request(type: string, path: string, payload: any, responsedata?: any): Promise<Types.AxiosSuccess | Types.AxiosError | undefined> {
|
||||
async function generateStream(path: string, payload: any, config?: RequestInit, options?: any): Promise<AsyncIterable<any>> {
|
||||
const userStore = useUserStore()
|
||||
|
||||
const mieiparam: any = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-auth': userStore.x_auth_token,
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
signal: options?.signal,
|
||||
...config
|
||||
}
|
||||
|
||||
console.log('marams: ', mieiparam)
|
||||
|
||||
const response = await fetch(
|
||||
path,
|
||||
mieiparam,
|
||||
);
|
||||
console.log('USCITA DA FETCH... !!!!!')
|
||||
if (response.status !== 200) throw new Error(response.status.toString());
|
||||
return getIterableStream(response);
|
||||
}
|
||||
|
||||
function getIterableStream(stream: NodeJS.ReadableStream): AsyncIterable<any> {
|
||||
return {
|
||||
[Symbol.asyncIterator](): AsyncIterator<any> {
|
||||
let buffer = '';
|
||||
return {
|
||||
async next(): Promise<IteratorResult<any>> {
|
||||
while (true) {
|
||||
const chunk = await new Promise<string>((resolve, reject) => {
|
||||
stream.once('data', (data: Buffer) => resolve(data.toString()));
|
||||
stream.once('error', (err) => reject(err));
|
||||
stream.once('end', () => resolve(''));
|
||||
});
|
||||
buffer += chunk;
|
||||
if (buffer.includes('\n\n')) {
|
||||
const event = buffer.slice(0, buffer.indexOf('\n\n'));
|
||||
buffer = buffer.slice(buffer.indexOf('\n\n') + 2);
|
||||
try {
|
||||
return { value: JSON.parse(event.slice('data: '.length)), done: false };
|
||||
} catch (error) {
|
||||
console.error('Error parsing event data:', error);
|
||||
}
|
||||
} else if (chunk === '') {
|
||||
return { value: undefined, done: true };
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function Request(type: string, path: string, payload: any, responsedata?: any, options?: any): Promise<Types.AxiosSuccess | Types.AxiosError | undefined> {
|
||||
|
||||
let ricevuto = false
|
||||
const userStore = useUserStore()
|
||||
@@ -57,59 +119,108 @@ async function Request(type: string, path: string, payload: any, responsedata?:
|
||||
try {
|
||||
if (tools.isDebug()) console.log('Axios Request', path, type, tools.notshowPwd(payload))
|
||||
let response: AxiosResponse
|
||||
const config: AxiosRequestConfig = {
|
||||
baseURL: globalStore.getServerHost(),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-auth': userStore.x_auth_token,
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
...responsedata,
|
||||
}
|
||||
|
||||
if (options?.stream) {
|
||||
config.responseType = 'stream';
|
||||
}
|
||||
|
||||
if (type === 'post' || type === 'put' || type === 'patch') {
|
||||
response = await axiosInstance[type](path, payload, {
|
||||
baseURL: globalStore.getServerHost(),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'x-auth': userStore.x_auth_token,
|
||||
'x-refrtok': userStore.refreshToken,
|
||||
},
|
||||
...responsedata,
|
||||
})
|
||||
ricevuto = true
|
||||
// console.log('Request Response: ', response)
|
||||
// console.log(new Types.AxiosSuccess(response.data, response.status))
|
||||
|
||||
const setAuthToken = (path === '/updatepwd') || (path === '/users/login')
|
||||
if (options?.stream) {
|
||||
console.log('GENERATESTREAM...')
|
||||
const stream = await generateStream(path, payload, config, options);
|
||||
console.log('USCITOOOOOOOOOOOOOOOOOOOOO ------------------------')
|
||||
|
||||
// console.log('--------- 0 ')
|
||||
return new Promise((resolve, reject) => {
|
||||
const events$: Observable<any> = from(stream);
|
||||
events$
|
||||
.pipe(
|
||||
mergeMap((event) => from([event])),
|
||||
toArray()
|
||||
)
|
||||
.subscribe(
|
||||
(data) => {
|
||||
console.log('Received data:', data);
|
||||
// Elabora i dati ricevuti
|
||||
resolve({ data, status: response.status, statusText: response.statusText, headers: response.headers, config: response.config });
|
||||
},
|
||||
(error) => {
|
||||
console.error('Stream error:', error);
|
||||
reject(error);
|
||||
},
|
||||
() => {
|
||||
console.log('Stream completed');
|
||||
}
|
||||
);
|
||||
|
||||
if (response && (response.status === 200)) {
|
||||
let x_auth_token = ''
|
||||
let refreshToken = ''
|
||||
try {
|
||||
if (setAuthToken || (path === '/users/login')) {
|
||||
x_auth_token = String(response.headers['x-auth'])
|
||||
refreshToken = String(response.headers['x-refrtok'])
|
||||
});
|
||||
/*
|
||||
console.log('Stream response received, processing...');
|
||||
return handleStreamResponse(response, (data) => {
|
||||
console.log('data...' + data.content)
|
||||
// Aggiorna lo stato dell'applicazione qui
|
||||
// Ad esempio:
|
||||
// outputVisible.value += data.content;
|
||||
});
|
||||
*/
|
||||
|
||||
if (x_auth_token === '') {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
}
|
||||
if (setAuthToken) {
|
||||
userStore.UpdatePwd(x_auth_token, refreshToken)
|
||||
} else {
|
||||
|
||||
response = await axiosInstance[type](path, payload, config)
|
||||
|
||||
ricevuto = true
|
||||
// console.log('Request Response: ', response)
|
||||
// console.log(new Types.AxiosSuccess(response.data, response.status))
|
||||
|
||||
const setAuthToken = (path === '/updatepwd') || (path === '/users/login')
|
||||
|
||||
// console.log('--------- 0 ')
|
||||
|
||||
if (response && (response.status === 200)) {
|
||||
let x_auth_token = ''
|
||||
let refreshToken = ''
|
||||
try {
|
||||
if (setAuthToken || (path === '/users/login')) {
|
||||
x_auth_token = String(response.headers['x-auth'])
|
||||
refreshToken = String(response.headers['x-refrtok'])
|
||||
|
||||
if (x_auth_token === '') {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
}
|
||||
if (setAuthToken) {
|
||||
userStore.UpdatePwd(x_auth_token, refreshToken)
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
|
||||
}
|
||||
|
||||
userStore.setAuth(x_auth_token, refreshToken)
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
|
||||
}
|
||||
|
||||
userStore.setAuth(x_auth_token, refreshToken)
|
||||
localStorage.setItem(toolsext.localStorage.token, x_auth_token)
|
||||
localStorage.setItem(toolsext.localStorage.refreshToken, refreshToken)
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
userStore.setServerCode(tools.OK)
|
||||
} catch (e) {
|
||||
if (setAuthToken) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
userStore.setAuth('', '')
|
||||
}
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
return Promise.reject(new Types.AxiosError(serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN, null, toolsext.ERR_AUTHENTICATION))
|
||||
}
|
||||
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
userStore.setServerCode(tools.OK)
|
||||
} catch (e) {
|
||||
if (setAuthToken) {
|
||||
userStore.setServerCode(toolsext.ERR_AUTHENTICATION)
|
||||
userStore.setAuth('', '')
|
||||
}
|
||||
globalStore.setStateConnection(ricevuto ? 'online' : 'offline')
|
||||
return Promise.reject(new Types.AxiosError(serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN, null, toolsext.ERR_AUTHENTICATION))
|
||||
}
|
||||
}
|
||||
|
||||
return new Types.AxiosSuccess(response.data, response.status)
|
||||
return new Types.AxiosSuccess(response.data, response.status)
|
||||
}
|
||||
} else if (type === 'get' || type === 'delete') {
|
||||
// @ts-ignore
|
||||
response = await axiosInstance[type](path, {
|
||||
@@ -172,4 +283,33 @@ async function Request(type: string, path: string, payload: any, responsedata?:
|
||||
}
|
||||
}
|
||||
|
||||
function handleStreamResponse(response: AxiosResponse, updateCallback: (data: any) => void): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// ... codice precedente ...
|
||||
|
||||
reader.on('data', (chunk: Buffer) => {
|
||||
// ... codice precedente ...
|
||||
if (line.startsWith('data: ')) {
|
||||
const eventData = line.slice(6);
|
||||
try {
|
||||
const parsedData = JSON.parse(eventData);
|
||||
console.log('Received data:', parsedData);
|
||||
updateCallback(parsedData); // Chiamata alla callback per aggiornare lo stato
|
||||
} catch (error) {
|
||||
console.error('Error parsing event data:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
reader.on('end', () => {
|
||||
console.log('Stream ended');
|
||||
resolve('Stream completed');
|
||||
});
|
||||
|
||||
reader.on('error', (error: Error) => {
|
||||
console.error('Stream error:', error);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
export default Request
|
||||
|
||||
@@ -37,11 +37,11 @@ function ReceiveResponsefromServer(tablesync: string, nametab: string, method: s
|
||||
|
||||
// const algoliaApi = new AlgoliaSearch()
|
||||
export const Api = {
|
||||
async post(path: string, payload?: any, responsedata?: any) {
|
||||
async post(path: string, payload?: any, responsedata?: any, options?: any) {
|
||||
const globalStore = useGlobalStore()
|
||||
globalStore.connData.downloading_server = 1
|
||||
globalStore.connData.uploading_server = 1
|
||||
return Request('post', path, payload, responsedata)
|
||||
return Request('post', path, payload, responsedata, options)
|
||||
},
|
||||
|
||||
async postFormData(path: string, payload?: any, responsedata?: any) {
|
||||
@@ -133,7 +133,6 @@ export const Api = {
|
||||
async checkTokenScaduto(status: number, evitaloop: boolean, resolve: any, reject: any, url: string, method: string, mydata: any, setAuthToken = false) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
|
||||
if (status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
try {
|
||||
@@ -146,6 +145,7 @@ export const Api = {
|
||||
return resolve(this.SendReq(url, method, mydata, setAuthToken, true));
|
||||
}
|
||||
} else {
|
||||
const $router = useRouter()
|
||||
$router.push('/signin')
|
||||
}
|
||||
} catch (err2: any) {
|
||||
@@ -162,7 +162,7 @@ export const Api = {
|
||||
|
||||
},
|
||||
|
||||
async SendReqBase(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, myformdata?: any, responsedata?: any): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
async SendReqBase(url: string, method: string, mydata: any, setAuthToken = false, evitaloop = false, myformdata?: any, responsedata?: any, options?: any): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
const mydataout = {
|
||||
...mydata,
|
||||
keyappid: process.env.PAO_APP_ID,
|
||||
@@ -176,7 +176,7 @@ export const Api = {
|
||||
userStore.setServerCode(tools.EMPTY)
|
||||
userStore.setResStatus(0)
|
||||
|
||||
return new Promise((resolve, reject) => sendRequest(url, method, mydataout, myformdata, responsedata)
|
||||
return new Promise((resolve, reject) => sendRequest(url, method, mydataout, myformdata, responsedata, options)
|
||||
.then(async (res) => {
|
||||
setTimeout( () => {
|
||||
if (method === 'get') {
|
||||
@@ -268,9 +268,10 @@ export const Api = {
|
||||
retryDelay = 5000,
|
||||
myformdata?: any,
|
||||
responsedata?: any,
|
||||
options?: any,
|
||||
): Promise<Types.AxiosSuccess | Types.AxiosError> {
|
||||
try {
|
||||
const response = await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata);
|
||||
const response = await this.SendReqBase(url, method, mydata, setAuthToken, evitaloop, myformdata, responsedata, options);
|
||||
return response;
|
||||
} catch (error: any) {
|
||||
let riprova = true
|
||||
|
||||
@@ -107,6 +107,10 @@ function AddCol(params: IColGridTable) {
|
||||
}
|
||||
}
|
||||
|
||||
export const colTablePublisher = [
|
||||
AddCol({ name: 'name', label_trans: 'reg.name' }),
|
||||
]
|
||||
|
||||
export const colmailinglist = [
|
||||
AddCol({ name: 'name', label_trans: 'reg.name' }),
|
||||
AddCol({ name: 'surname', label_trans: 'reg.surname' }),
|
||||
@@ -119,6 +123,7 @@ export const colmailinglist = [
|
||||
|
||||
export const colTableCatalogList = [
|
||||
AddCol({ name: 'active', label_trans: 'myelems.active', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'versione_perstampa', label_trans: 'cataloglist.versione_perstampa', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'title', label_trans: 'gallery.title' }),
|
||||
AddCol({
|
||||
name: 'foto_collana',
|
||||
@@ -134,6 +139,12 @@ export const colTableCatalogList = [
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'collanas',
|
||||
}),
|
||||
AddCol({
|
||||
name: 'editore',
|
||||
label_trans: 'cataloglist.editore',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'publishers',
|
||||
}),
|
||||
|
||||
AddCol({
|
||||
name: 'idPageAssigned',
|
||||
@@ -146,21 +157,39 @@ export const colTableCatalogList = [
|
||||
name: 'referenti',
|
||||
label_trans: 'cataloglist.referenti',
|
||||
fieldtype: costanti.FieldType.multiselect,
|
||||
jointable: 'friendsandme',
|
||||
field_outtype: costanti.FieldType.object,
|
||||
showWhen: costanti.showWhen.InView_OnlyifExist,
|
||||
jointable: 'lista_editori',
|
||||
}),
|
||||
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html }),
|
||||
AddCol({ name: 'descr_introduttiva', label_trans: 'cataloglist.descr_introduttiva', fieldtype: costanti.FieldType.html, maxlength: 1300 }),
|
||||
AddCol({ name: 'pagina_introduttiva_sfondo_nero', label_trans: 'cataloglist.pagina_introduttiva_sfondo_nero', fieldtype: costanti.FieldType.boolean }),
|
||||
|
||||
AddCol({
|
||||
name: 'img_bordata_web',
|
||||
label_trans: 'cataloglist.img_bordata_web',
|
||||
name: 'img_bordata',
|
||||
label_trans: 'cataloglist.img_bordata',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
}),
|
||||
AddCol({
|
||||
name: 'img_intro',
|
||||
label_trans: 'cataloglist.img_intro',
|
||||
fieldtype: costanti.FieldType.image,
|
||||
jointable: '',
|
||||
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
|
||||
isadvanced_field: false,
|
||||
}),
|
||||
|
||||
AddCol({
|
||||
name: 'pdf_generato',
|
||||
label_trans: 'cataloglist.pdf_generato',
|
||||
}),
|
||||
// AddCol({ name: 'data_generato', label_trans: 'dataloglist.data_generato', fieldtype: costanti.FieldType.date }),
|
||||
AddCol({
|
||||
name: 'pdf_online',
|
||||
label_trans: 'cataloglist.pdf_online',
|
||||
}),
|
||||
// AddCol({ name: 'data_online', label_trans: 'dataloglist.data_online', fieldtype: costanti.FieldType.date }),
|
||||
|
||||
AddCol(ModifRec),
|
||||
AddCol(DuplicateRec),
|
||||
AddCol(DeleteRec),
|
||||
@@ -225,6 +254,7 @@ export const colmyIImg = [
|
||||
export const colmyScheda = [
|
||||
AddCol({ name: 'name', label_trans: 'scheda.name', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'isTemplate', label_trans: 'scheda.isTemplate', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'isPagIntro', label_trans: 'scheda.isPagIntro', fieldtype: costanti.FieldType.boolean }),
|
||||
AddCol({ name: 'linkIdTemplate', label_trans: 'scheda.linkIdTemplate', fieldtype: costanti.FieldType.string }),
|
||||
AddCol({ name: 'widthscheda', label_trans: 'scheda.widthscheda', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'widthpag', label_trans: 'scheda.widthpag', fieldtype: costanti.FieldType.number }),
|
||||
@@ -573,8 +603,7 @@ export const colTableCatProd = [
|
||||
]
|
||||
export const colTableCollane = [
|
||||
AddCol({ name: 'idCollana', label_trans: 'collane.idCollana', fieldtype: costanti.FieldType.number }),
|
||||
AddCol({ name: 'descrizione', label_trans: 'collane.descrizione' }),
|
||||
AddCol({ name: 'descrizione_estesa', label_trans: 'collane.descrizione_estesa' }),
|
||||
AddCol({ name: 'title', label_trans: 'collane.title' }),
|
||||
AddCol(DeleteRec),
|
||||
AddCol(DuplicateRec),
|
||||
]
|
||||
@@ -4301,6 +4330,13 @@ export const fieldsTable = {
|
||||
colkey: 'idCollana',
|
||||
collabel: 'title',
|
||||
},
|
||||
{
|
||||
value: 'publishers',
|
||||
label: 'Nome',
|
||||
columns: colTablePublisher,
|
||||
colkey: '_id',
|
||||
collabel: 'name',
|
||||
},
|
||||
{
|
||||
value: 'catais',
|
||||
label: 'Categorie AI',
|
||||
@@ -4874,6 +4910,13 @@ export const fieldsTable = {
|
||||
colkey: 'username',
|
||||
collabel: 'username',
|
||||
},
|
||||
{
|
||||
value: 'lista_editori',
|
||||
label: 'Editori',
|
||||
columns: colTableUsersGeneric,
|
||||
colkey: 'username',
|
||||
collabel: 'username',
|
||||
},
|
||||
{
|
||||
value: 'mygroups',
|
||||
label: 'Organizzazioni',
|
||||
|
||||
@@ -8438,7 +8438,7 @@ export const tools = {
|
||||
} else if (table === toolsext.TABCATALOGS) {
|
||||
return tools.getdefaultnewrec_Catalog()
|
||||
}
|
||||
return null
|
||||
return {}
|
||||
},
|
||||
|
||||
getNomeTabellaStrByTable(table: string, rec: any) {
|
||||
@@ -9632,7 +9632,11 @@ export const tools = {
|
||||
console.error('Errore durante l\'elaborazione dell\'URL:', error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
isEmptyObject(obj: any) {
|
||||
return Object.keys(obj).length === 0;
|
||||
},
|
||||
|
||||
// FINE !
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo } from 'model'
|
||||
import { IBaseOrder, ICart, IOrder, IOrderCart, IProduct, IProductsState, IProductInfo, ICatProd, IUserShort, IGasordine, IAuthor, ISubCatProd, IText, IOptCatalogo, ICatalog } from 'model'
|
||||
|
||||
import { Api } from '@api'
|
||||
import { serv_constants } from '@src/store/Modules/serv_constants'
|
||||
@@ -13,6 +13,7 @@ import { useGlobalStore } from './globalStore'
|
||||
import { ref } from 'vue'
|
||||
|
||||
import translate from '@src/globalroutines/util'
|
||||
import { useCatalogStore } from './CatalogStore'
|
||||
|
||||
function getRecordOrdersCartEmpty(): IOrderCart {
|
||||
return {
|
||||
@@ -1295,7 +1296,7 @@ export const useProducts = defineStore('Products', {
|
||||
}
|
||||
},
|
||||
|
||||
replaceKeyWordsByProduct(optcatalogo: IOptCatalogo, myproduct: IProduct, testo: IText) {
|
||||
replaceKeyWordsByProduct(optcatalogo: IOptCatalogo, myproduct: IProduct, testo: IText, idPage?: string) {
|
||||
if (!myproduct || !testo.contenuto) {
|
||||
return testo.contenuto;
|
||||
}
|
||||
@@ -1363,11 +1364,10 @@ export const useProducts = defineStore('Products', {
|
||||
const prezzo_scontato = tools.arrotonda2Dec(myproduct.arrvariazioni![0].sale_price) || ''
|
||||
const categoria = this.getCatProdsStrByCatProds(myproduct.productInfo.catprods!)
|
||||
const sottocategoria = myproduct.productInfo.subcatprods && myproduct.productInfo.subcatprods.length > 0 ? myproduct.productInfo.subcatprods[0].name! : ''
|
||||
const descr_categoria = myproduct.productInfo.catprods ? this.getCatProdDescrStrByIdCatProd(myproduct.productInfo.catprods![0]) : ''
|
||||
const descr_categoria = myproduct.productInfo.catprods ? 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 pagine = myproduct.arrvariazioni![0].pagine || ''
|
||||
|
||||
const scale = optcatalogo.printable ? optcatalogo.areadistampa?.scale : 1
|
||||
// Crea una mappa di sostituzioni
|
||||
|
||||
@@ -39,7 +39,7 @@ import { Router } from 'vue-router'
|
||||
import { useProjectStore } from '@store/Projects'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
import { costanti } from '@costanti'
|
||||
import { IReaction, IBookmark, ISeen, IFavBook, IAttend, IFavorite, IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
||||
import { IReaction, IBookmark, ISeen, IFavBook, IAttend, IFavorite, IGroupShort, IMyGroup, IUserAdmins, IUserShort } from '@model/UserStore'
|
||||
|
||||
import globalroutines from '../globalroutines/index'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
@@ -214,6 +214,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
countusers: 0,
|
||||
lastparamquery: {},
|
||||
updateTables: false,
|
||||
lista_editori: null,
|
||||
}),
|
||||
|
||||
getters: {
|
||||
@@ -222,6 +223,10 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return (this.servercode === toolsext.ERR_SERVERFETCH)
|
||||
},
|
||||
|
||||
getListaEditori: (state: IUserState) => {
|
||||
return state.lista_editori
|
||||
},
|
||||
|
||||
getServerCode: (state: IUserState): number => (state.servercode ? state.servercode : 0),
|
||||
getMsg: (state: IUserState): string => (state.msg ? state.msg : ''),
|
||||
|
||||
@@ -2190,6 +2195,14 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
async loadListaEditori() {
|
||||
const globalStore = useGlobalStore();
|
||||
if (!this.lista_editori) {
|
||||
this.lista_editori = await globalStore.getObjOnServer('lista_editori');
|
||||
}
|
||||
return this.lista_editori
|
||||
},
|
||||
|
||||
},
|
||||
})
|
||||
|
||||
@@ -339,7 +339,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return !!rec ? rec.name + ' ' + rec.surname : ''
|
||||
},
|
||||
|
||||
getSchedeOpt(): any [] {
|
||||
getSchedeOpt(): any[] {
|
||||
const arrschede: ISchedaSingola[] = this.myschedas
|
||||
|
||||
let arr: any = []
|
||||
@@ -432,7 +432,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
return userStore.usersList
|
||||
else if (table === 'friends')
|
||||
return userStore.my.profile.friends
|
||||
else if (table === 'friendsandme')
|
||||
else if (table === 'lista_editori') {
|
||||
ris = userStore.getListaEditori
|
||||
} else if (table === 'friendsandme')
|
||||
return [{ username: userStore.my.username }, ...userStore.my.profile.friends]
|
||||
// else if (table === 'mygroups')
|
||||
// return userStore.groups
|
||||
@@ -1028,6 +1030,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
async loadAfterLogin() {
|
||||
const userStore = useUserStore()
|
||||
|
||||
// console.log('loadAfterLogin')
|
||||
this.clearDataAfterLoginOnlyIfActiveConnection()
|
||||
|
||||
@@ -1041,6 +1045,8 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
isok = true
|
||||
}
|
||||
|
||||
await userStore.loadListaEditori()
|
||||
|
||||
await globalroutines('readall', 'config', null)
|
||||
|
||||
if (tools.isLogged()) {
|
||||
@@ -1113,7 +1119,6 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
},
|
||||
|
||||
async loadTable(params: IParamsQuery) {
|
||||
// console.log('loadTable', params)
|
||||
const userStore = useUserStore()
|
||||
|
||||
return Api.SendReq('/gettable', 'POST', params)
|
||||
@@ -1132,6 +1137,23 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
})
|
||||
},
|
||||
|
||||
async getObjOnServer(cmd: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
return Api.SendReq('/getobj', 'POST', { cmd })
|
||||
.then((res) => {
|
||||
this.serverError = false
|
||||
return res.data.data
|
||||
})
|
||||
.catch((error) => {
|
||||
this.serverError = true
|
||||
this.serverMsgError = error
|
||||
console.log('error getObjOnServer', error)
|
||||
userStore.setErrorCatch(error)
|
||||
return null
|
||||
})
|
||||
},
|
||||
|
||||
async loadExp(params: any) {
|
||||
// console.log('loadTable', params)
|
||||
params.filtersearch2 = 'fdsgas1'
|
||||
@@ -2032,9 +2054,9 @@ export const useGlobalStore = defineStore('GlobalStore', {
|
||||
options,
|
||||
}
|
||||
|
||||
return Api.SendReq('/aitools/ds', 'POST', paramquery)
|
||||
return Api.SendReq('/aitools/ds', 'POST', paramquery, false, true, 1, 5000, null, null, options)
|
||||
.then((res) => {
|
||||
return res.data
|
||||
return res.data
|
||||
}).catch((error) => {
|
||||
return {}
|
||||
})
|
||||
|
||||
@@ -14,7 +14,7 @@ import { CProductCard } from '@src/components/CProductCard'
|
||||
import { CMySelect } from '@src/components/CMySelect'
|
||||
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard'
|
||||
import { CSelectUserActive } from '@src/components/CSelectUserActive'
|
||||
import { IOptCatalogo, IDimensioni, IFilterCatalogo, IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog } from 'model'
|
||||
import { IOptCatalogo, IDimensioni, IFilterCatalogo, IMyScheda, IProdView, IProduct, ISchedaSingola, ISearchList, ICatalog, IImg, IMyPage } from 'model'
|
||||
|
||||
|
||||
import { fieldsTable } from '@store/Modules/fieldsTable'
|
||||
@@ -29,6 +29,11 @@ export default defineComponent({
|
||||
type: Object as PropType<IOptCatalogo>,
|
||||
required: true,
|
||||
},
|
||||
idPage: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const userStore = useUserStore()
|
||||
@@ -81,6 +86,8 @@ export default defineComponent({
|
||||
|
||||
const mycolumns = ref([])
|
||||
|
||||
const catalogStore = useCatalogStore()
|
||||
|
||||
const tabvisu = ref('categorie')
|
||||
const tabcatalogo = ref('visu')
|
||||
|
||||
@@ -111,6 +118,33 @@ export default defineComponent({
|
||||
}
|
||||
})
|
||||
|
||||
const getTestoIntroduttivo = computed(() => (recscheda: ISchedaSingola) => {
|
||||
|
||||
let testo = recscheda.scheda!.dimensioni.pagina?.testo_up?.contenuto
|
||||
|
||||
if (recscheda.scheda!.isPagIntro) {
|
||||
|
||||
const catalogStore = useCatalogStore()
|
||||
const catalog = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
|
||||
if (catalog && catalog.descr_introduttiva) {
|
||||
// Cerca se la descrizione introduttiva è stata impostata
|
||||
testo = catalog.descr_introduttiva
|
||||
let clcol = ''
|
||||
if (catalog.pagina_introduttiva_sfondo_nero) {
|
||||
clcol = `text-white`
|
||||
}
|
||||
testo = `<span class="book-text-up ${clcol}">` + testo + `</span>`
|
||||
}
|
||||
}
|
||||
|
||||
return testo
|
||||
|
||||
})
|
||||
|
||||
const getCatalogoByMyPage = computed(() => {
|
||||
return catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned === props.idPage)
|
||||
})
|
||||
|
||||
// Register the scroll event on component mount
|
||||
const handleScroll = () => {
|
||||
const scrollTop = window.scrollY || document.documentElement.scrollTop;
|
||||
@@ -209,23 +243,91 @@ export default defineComponent({
|
||||
return lista && lista.value && lista.value.hasOwnProperty('name') ? lista.value.name : ''
|
||||
}
|
||||
|
||||
function getIdCollaneDaFiltrare() {
|
||||
function getImgIntroCatalogo(scheda: IMyScheda): IImg {
|
||||
let trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
let imagefile = ''
|
||||
let fit = ''
|
||||
|
||||
if (trovatocatalogo && scheda.isPagIntro) {
|
||||
const recimg = trovatocatalogo.img_intro
|
||||
if (recimg) {
|
||||
imagefile = recimg.imagefile!
|
||||
fit = recimg.fit! || 'contain'
|
||||
imagefile = imagefile ? `url(${costanti.DIR_UPLOAD + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})` : ''
|
||||
}
|
||||
}
|
||||
|
||||
return { imagefile, fit }
|
||||
}
|
||||
|
||||
function getSfondoImgCatalogo(scheda?: IMyScheda | null, mypage?: IDimensioni): IImg {
|
||||
let trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
let imagefile = ''
|
||||
let fit = ''
|
||||
|
||||
if (trovatocatalogo) {
|
||||
// Cerca prima se c'è un Immagine Introduttiva
|
||||
const recimgintro = getImgIntroCatalogo(scheda!)
|
||||
if (recimgintro.imagefile) {
|
||||
imagefile = recimgintro.imagefile!
|
||||
fit = recimgintro.fit! || 'contain'
|
||||
}
|
||||
|
||||
// Poi cerca se c'è l'immagine di sfondo
|
||||
const recimg = trovatocatalogo.img_bordata!
|
||||
if (!imagefile && recimg) {
|
||||
imagefile = recimg.imagefile!
|
||||
fit = recimg.fit! || 'contain'
|
||||
imagefile = imagefile ? `url(${costanti.DIR_UPLOAD + shared_consts.getDirectoryByTable(shared_consts.TABLES_CATALOG) + '/' + trovatocatalogo._id + '/' + imagefile})` : ''
|
||||
}
|
||||
}
|
||||
|
||||
if (!imagefile && scheda) {
|
||||
imagefile = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.imagefile!
|
||||
imagefile = imagefile ? `url(${costanti.DIR_UPLOAD + costanti.DIR_SCHEDA + imagefile})` : ''
|
||||
fit = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo!.fit!
|
||||
}
|
||||
if (!imagefile && mypage) {
|
||||
imagefile = mypage.imgsfondo!.imagefile!
|
||||
imagefile = imagefile ? `url(${costanti.DIR_UPLOAD + costanti.DIR_CATALOGO + imagefile})` : ''
|
||||
fit = mypage.imgsfondo!.fit!
|
||||
}
|
||||
|
||||
return { imagefile, fit }
|
||||
}
|
||||
|
||||
function getIdCollaneDaFiltrare(def_idCollane?: number[]) {
|
||||
let idCollane: number[] = []
|
||||
|
||||
const catalogStore = useCatalogStore()
|
||||
|
||||
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
|
||||
let trovato = catalogStore.catalogs?.find((catalog: ICatalog) => catalog.idPageAssigned)
|
||||
|
||||
if (trovato) {
|
||||
let trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
if (trovatocatalogo) {
|
||||
idCollane = trovatocatalogo.idCollane! || []
|
||||
} else {
|
||||
idCollane = optcatalogo.value.idCollane! || []
|
||||
idCollane = def_idCollane || []
|
||||
}
|
||||
|
||||
return idCollane
|
||||
}
|
||||
|
||||
function getEditoreDaFiltrare(def_editori?: string[]) {
|
||||
let editore: string[] = []
|
||||
|
||||
// Cerca se nella lista cataloghi c'è la Collana di questa Pagina !
|
||||
let trovatocatalogo = getCatalogoByMyPage.value
|
||||
|
||||
if (trovatocatalogo) {
|
||||
editore = trovatocatalogo.editore! || []
|
||||
} else {
|
||||
editore = def_editori || []
|
||||
}
|
||||
|
||||
return editore
|
||||
}
|
||||
|
||||
function calcArrProducts() {
|
||||
// console.log('calcArrProducts')
|
||||
|
||||
@@ -245,9 +347,11 @@ export default defineComponent({
|
||||
let boolfiltroVuotoProductTypes = (filtroProductTypes.length === 0 || (filtroProductTypes.length === 1 && (filtroProductTypes[0] === 0)))
|
||||
let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0
|
||||
|
||||
let filtroPublishers = optcatalogo.value.editore || []
|
||||
let editore = getEditoreDaFiltrare(optcatalogo.value.editore)
|
||||
let filtroPublishers = editore || []
|
||||
|
||||
let filtroCollane = getIdCollaneDaFiltrare()
|
||||
let idCollane = getIdCollaneDaFiltrare(optcatalogo.value.idCollane!)
|
||||
let filtroCollane = idCollane || []
|
||||
let boolfiltroVuotoEditore = (filtroPublishers.length === 0)
|
||||
let boolfiltroVuotoCollane = (filtroCollane.length === 0)
|
||||
|
||||
@@ -296,10 +400,10 @@ export default defineComponent({
|
||||
hasProductTypes = !optcatalogo.value.productTypes || (optcatalogo.value.productTypes && (product.productInfo.productTypes || []).some((item: any) => optcatalogo.value.productTypes!.includes(item)))
|
||||
}
|
||||
if (optcatalogo.value && !boolfiltroVuotoEditore) {
|
||||
hasPublished = !optcatalogo.value.editore || (optcatalogo.value.editore && optcatalogo.value.editore.includes(product.productInfo.idPublisher!))
|
||||
hasPublished = !editore || (editore && editore.includes(product.productInfo.idPublisher!))
|
||||
}
|
||||
if (optcatalogo.value && !boolfiltroVuotoCollane) {
|
||||
hasCollana = !optcatalogo.value.idCollane || (optcatalogo.value.idCollane && optcatalogo.value.idCollane.includes(product.productInfo.idCollana!))
|
||||
hasCollana = !idCollane || (idCollane && idCollane.includes(product.productInfo.idCollana!))
|
||||
}
|
||||
|
||||
if (optcatalogo.value && !boolfiltroVuotoExcludeProductTypes) {
|
||||
@@ -359,6 +463,7 @@ export default defineComponent({
|
||||
if (myschedatocopy) {
|
||||
myschedatocopy.scheda._id = origScheda.scheda?._id
|
||||
myschedatocopy.scheda.isTemplate = false
|
||||
myschedatocopy.scheda.isPagIntro = false
|
||||
myschedatocopy.scheda.name = precname
|
||||
myschedatocopy.scheda.linkIdTemplate = linkIdTemplate
|
||||
|
||||
@@ -370,6 +475,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function populateDataWithlinkIdTemplate() {
|
||||
console.log('populateDataWithlinkIdTemplate')
|
||||
|
||||
if (optcatalogo.value) {
|
||||
|
||||
@@ -402,8 +508,11 @@ export default defineComponent({
|
||||
let boolfiltroVuotoProductTypes = (filtroProductTypes.length === 0 || (filtroProductTypes.length === 1 && (filtroProductTypes[0] === 0)))
|
||||
let boolfiltroVuotoExcludeProductTypes = filtroExcludeProductTypes.length === 0
|
||||
|
||||
let filtroPublishers = scheda.editore || []
|
||||
let filtroCollane = getIdCollaneDaFiltrare()
|
||||
let editore = getEditoreDaFiltrare(scheda.editore)
|
||||
let filtroPublishers = editore || []
|
||||
|
||||
let idCollane = getIdCollaneDaFiltrare(scheda.idCollane)
|
||||
let filtroCollane = idCollane || []
|
||||
let boolfiltroVuotoEditore = (filtroPublishers.length === 0)
|
||||
let boolfiltroVuotoCollane = (filtroCollane.length === 0)
|
||||
|
||||
@@ -464,11 +573,11 @@ export default defineComponent({
|
||||
hasProductTypes = !scheda.productTypes || (scheda.productTypes && (product.productInfo.productTypes || []).some((item: any) => scheda.productTypes!.includes(item)))
|
||||
}
|
||||
if (!boolfiltroVuotoEditore) {
|
||||
hasPublished = !scheda.editore || (scheda.editore && scheda.editore.includes(product.productInfo.idPublisher!))
|
||||
hasPublished = !editore || (editore && editore.includes(product.productInfo.idPublisher!))
|
||||
}
|
||||
|
||||
if (optcatalogo.value && !boolfiltroVuotoCollane) {
|
||||
hasCollane = !optcatalogo.value.idCollane || (optcatalogo.value.idCollane && optcatalogo.value.idCollane.includes(product.productInfo.idCollana!))
|
||||
hasCollane = !idCollane || (idCollane && idCollane.includes(product.productInfo.idCollana!))
|
||||
}
|
||||
|
||||
if (!boolfiltroVuotoExcludeProductTypes) {
|
||||
@@ -566,85 +675,90 @@ export default defineComponent({
|
||||
function generatearrProdToViewSorted() {
|
||||
// console.log('generatearrProdToViewSorted', arrProducts.value)
|
||||
|
||||
// Svuota
|
||||
arrProdToView.value = []
|
||||
try {
|
||||
|
||||
// gia filtrati
|
||||
const arrGeneraleProdotti = arrProducts.value;
|
||||
// Svuota
|
||||
arrProdToView.value = []
|
||||
|
||||
let indprod = 0
|
||||
let indprodGenerale = 0
|
||||
// gia filtrati
|
||||
const arrGeneraleProdotti = arrProducts.value;
|
||||
|
||||
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||
if (recscheda && recscheda.scheda) {
|
||||
let schedePerRiga = recscheda.scheda.numschede_perRiga || 1
|
||||
let schedePerCol = recscheda.scheda.numschede_perCol || 1
|
||||
let schedePerPagina = schedePerRiga * schedePerCol
|
||||
let indprod = 0
|
||||
let indprodGenerale = 0
|
||||
|
||||
let arrProdFiltrati: IProduct[] = []
|
||||
for (const recscheda of optcatalogo.value.arrSchede!) {
|
||||
if (recscheda && recscheda.scheda) {
|
||||
let schedePerRiga = recscheda.scheda.numschede_perRiga || 1
|
||||
let schedePerCol = recscheda.scheda.numschede_perCol || 1
|
||||
let schedePerPagina = schedePerRiga * schedePerCol
|
||||
|
||||
if (recscheda.scheda.productTypes!.length > 0) {
|
||||
// Filtra i prodotti in base ai filtri impostati !
|
||||
arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
|
||||
indprod = 0
|
||||
} else {
|
||||
if (recscheda.scheda?.sort_field!) {
|
||||
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field!, recscheda.scheda.sort_dir!);
|
||||
let arrProdFiltrati: IProduct[] = []
|
||||
|
||||
if (recscheda.scheda.productTypes!.length > 0) {
|
||||
// Filtra i prodotti in base ai filtri impostati !
|
||||
arrProdFiltrati = getProductsFilteredByScheda(recscheda.scheda)
|
||||
indprod = 0
|
||||
} else {
|
||||
indprod = indprodGenerale
|
||||
arrProdFiltrati = arrGeneraleProdotti
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// console.log('arrProdFiltrati indiceRanking = ', arrProdFiltrati[0].indiceRanking)
|
||||
|
||||
let indadded = 0
|
||||
recscheda.arrProdToShow = []
|
||||
|
||||
for (let pagina = 0; pagina < 100; pagina++) {
|
||||
indadded = 0
|
||||
if (!recscheda.arrProdToShow[pagina]) {
|
||||
recscheda.arrProdToShow[pagina] = [];
|
||||
}
|
||||
|
||||
for (let giro = 0; giro < schedePerPagina; giro++) {
|
||||
// Aggiunge il prossimo prodotto che non è stato ancora inserito
|
||||
const result = addNextProductToTheView(arrProdFiltrati, indprod);
|
||||
if (result.end) {
|
||||
break; // Esci dal ciclo se non ci sono più prodotti disponibili
|
||||
if (recscheda.scheda?.sort_field!) {
|
||||
arrProdFiltrati = getProductsSorted(arrGeneraleProdotti, recscheda.scheda.sort_field!, recscheda.scheda.sort_dir!);
|
||||
indprod = 0
|
||||
} else {
|
||||
if (result.indprod)
|
||||
indprod = result.indprod // Aggiorna indprod per il prossimo giro
|
||||
if (result.myrec) {
|
||||
|
||||
let riga = Math.floor(indadded / schedePerCol)
|
||||
let col = indadded % schedePerCol
|
||||
|
||||
if (!recscheda.arrProdToShow[pagina][riga]) {
|
||||
recscheda.arrProdToShow[pagina][riga] = [];
|
||||
}
|
||||
|
||||
// console.log('RANKING: ', result.myrec.indiceRanking!)
|
||||
|
||||
recscheda.arrProdToShow[pagina][riga][col] = result.myrec
|
||||
|
||||
indadded++
|
||||
}
|
||||
indprod = indprodGenerale
|
||||
arrProdFiltrati = arrGeneraleProdotti
|
||||
}
|
||||
}
|
||||
|
||||
if (recscheda.numPagineMax! > 0) {
|
||||
if (pagina + 1 >= recscheda.numPagineMax!)
|
||||
break; // fine pagine
|
||||
let indadded = 0
|
||||
recscheda.arrProdToShow = []
|
||||
|
||||
for (let pagina = 0; pagina < 60; pagina++) {
|
||||
indadded = 0
|
||||
if (!recscheda.arrProdToShow[pagina]) {
|
||||
recscheda.arrProdToShow[pagina] = [];
|
||||
}
|
||||
|
||||
for (let giro = 0; giro < schedePerPagina; giro++) {
|
||||
// Aggiunge il prossimo prodotto che non è stato ancora inserito
|
||||
const result = addNextProductToTheView(arrProdFiltrati, indprod);
|
||||
if (result.end) {
|
||||
break; // Esci dal ciclo se non ci sono più prodotti disponibili
|
||||
} else {
|
||||
if (result.indprod)
|
||||
indprod = result.indprod // Aggiorna indprod per il prossimo giro
|
||||
if (result.myrec) {
|
||||
|
||||
let riga = Math.floor(indadded / schedePerCol)
|
||||
let col = indadded % schedePerCol
|
||||
|
||||
if (!recscheda.arrProdToShow[pagina][riga]) {
|
||||
recscheda.arrProdToShow[pagina][riga] = [];
|
||||
}
|
||||
|
||||
// console.log('RANKING: ', result.myrec.indiceRanking!)
|
||||
|
||||
recscheda.arrProdToShow[pagina][riga][col] = result.myrec
|
||||
|
||||
indadded++
|
||||
// console.log('indadded', indadded)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (recscheda.numPagineMax! > 0) {
|
||||
if (pagina + 1 >= recscheda.numPagineMax!)
|
||||
break; // fine pagine
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log('*** arrProdToShow', recscheda.arrProdToShow)
|
||||
}
|
||||
|
||||
// console.log('*** arrProdToShow', recscheda.arrProdToShow)
|
||||
// console.log('Fine Generazione')
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('Err', e)
|
||||
}
|
||||
|
||||
// console.log('Fine...')
|
||||
@@ -830,21 +944,11 @@ export default defineComponent({
|
||||
const paddingLeft = scheda.dimensioni?.pagina?.dimensioni?.padding?.left ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.left) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.left) || '')
|
||||
const paddingRight = scheda.dimensioni?.pagina?.dimensioni?.padding?.right ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.padding?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) || '')
|
||||
|
||||
|
||||
// Esiste un immagine di sfondo specifica della singola pagina ?
|
||||
let fileimg = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo?.imagefile
|
||||
let backgroundSize = scheda.dimensioni?.pagina?.dimensioni?.imgsfondo?.fit
|
||||
if (fileimg) {
|
||||
fileimg = fileimg ? `url(${costanti.DIR_UPLOAD + costanti.DIR_SCHEDA + fileimg})` : ''
|
||||
}
|
||||
|
||||
if (!fileimg) {
|
||||
// Esiste un immagine di sfondo uguali per tutte le pagine ?
|
||||
fileimg = optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
|
||||
backgroundSize = optcatalogo.dimensioni_def?.pagina.imgsfondo?.fit
|
||||
fileimg = fileimg ? `url(${costanti.DIR_UPLOAD + costanti.DIR_CATALOGO + fileimg})` : ''
|
||||
}
|
||||
|
||||
let backgroundImage = fileimg ?? ''
|
||||
let recimg = getSfondoImgCatalogo(scheda)
|
||||
let backgroundImage = recimg.imagefile! ?? ''
|
||||
let backgroundSize = recimg.fit
|
||||
|
||||
let width = scheda.dimensioni?.pagina?.dimensioni?.size?.width ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.width) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.width) ?? '')
|
||||
let height = scheda.dimensioni?.pagina?.dimensioni?.size?.height ? tools.adjustSize(optcatalogo, scheda.dimensioni?.pagina?.dimensioni?.size?.height) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.size?.height) ?? '')
|
||||
@@ -862,8 +966,8 @@ export default defineComponent({
|
||||
backgroundSize,
|
||||
'--width': width,
|
||||
'--height': height,
|
||||
...(width ? { width: `${width} !important;` } : {}),
|
||||
...(height ? { height: `${height} !important;` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
...((width && width !== '0px') ? { width: `${width} !important` } : {}),
|
||||
...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
};
|
||||
}
|
||||
|
||||
@@ -879,16 +983,14 @@ export default defineComponent({
|
||||
const paddingRight = mypage!.padding?.right ? tools.adjustSize(optcatalogo, mypage!.padding?.right) : (tools.adjustSize(optcatalogo, optcatalogo.dimensioni_def?.pagina?.padding?.right) ?? '')
|
||||
|
||||
// Esiste un immagine di sfondo specifica della singola pagina ?
|
||||
let fileimg = mypage!.imgsfondo?.imagefile
|
||||
let backgroundSize = mypage!.imgsfondo?.fit
|
||||
if (fileimg) {
|
||||
fileimg = fileimg ? `url(${costanti.DIR_UPLOAD + costanti.DIR_CATALOGO + fileimg})` : ''
|
||||
}
|
||||
let recimg = getSfondoImgCatalogo(null, mypage)
|
||||
let fileimg = recimg.imagefile! ?? ''
|
||||
let backgroundSize = recimg.fit
|
||||
|
||||
if (!fileimg) {
|
||||
// Esiste un immagine di sfondo uguali per tutte le pagine ?
|
||||
fileimg = optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile
|
||||
backgroundSize = optcatalogo.dimensioni_def?.pagina.imgsfondo?.fit
|
||||
fileimg = optcatalogo.dimensioni_def?.pagina.imgsfondo?.imagefile!
|
||||
backgroundSize = optcatalogo.dimensioni_def?.pagina.imgsfondo?.fit!
|
||||
fileimg = fileimg ? `url(${costanti.DIR_UPLOAD + costanti.DIR_CATALOGO + fileimg})` : ''
|
||||
}
|
||||
|
||||
@@ -910,8 +1012,8 @@ export default defineComponent({
|
||||
backgroundSize,
|
||||
'--width': width,
|
||||
'--height': height,
|
||||
...(width ? { width: `${width} !important;` } : {}),
|
||||
...(height ? { height: `${height} !important;` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
...((width && width !== '0px') ? { width: `${width} !important` } : {}),
|
||||
...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
};
|
||||
}
|
||||
|
||||
@@ -936,7 +1038,7 @@ export default defineComponent({
|
||||
const placeContent = 'center';
|
||||
|
||||
const width = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.size?.width) ?? '';
|
||||
const height = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.size?.height);
|
||||
const height = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.size?.height) ?? '';
|
||||
|
||||
const marginTop = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.top) || '0';
|
||||
const marginBottom = tools.adjustSize(optcatalogo.value, recscheda.scheda?.dimensioni?.riga?.margini?.bottom) || '0';
|
||||
@@ -950,17 +1052,19 @@ export default defineComponent({
|
||||
|
||||
let out: any = {
|
||||
placeContent,
|
||||
flex: `0 1 ${width} !important;`,
|
||||
flex: `0 1 ${width} !important`,
|
||||
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
|
||||
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`
|
||||
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`,
|
||||
...((width && width !== '0px') ? { width: `${width} !important` } : {}),
|
||||
...((height && height !== '0px') ? { height: `${height} !important` } : {})
|
||||
}
|
||||
|
||||
if (width) {
|
||||
out.width = `${width} !important;`
|
||||
/*if (width) {
|
||||
out.width = `${width} !important`
|
||||
}
|
||||
if (height) {
|
||||
out.height = `${height} !important;`
|
||||
}
|
||||
out.height = `${height} !important`
|
||||
}*/
|
||||
|
||||
return out
|
||||
|
||||
@@ -985,10 +1089,10 @@ export default defineComponent({
|
||||
return {
|
||||
placeContent,
|
||||
alignSelf: 'flex-start',
|
||||
flex: `0 1 ${width} !important;`,
|
||||
flex: `0 1 ${width} !important`,
|
||||
margin: `${marginTop} ${marginRight} ${marginBottom} ${marginLeft}`,
|
||||
padding: `${paddingTop} ${paddingRight} ${paddingBottom} ${paddingLeft}`,
|
||||
...(height ? { height: `${height} !important;` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
...((height && height !== '0px') ? { height: `${height} !important` } : {}) // Aggiungi l'altezza solo se è valorizzata
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1047,6 +1151,7 @@ export default defineComponent({
|
||||
containsProducts,
|
||||
updateOptCatalogo,
|
||||
optcatalogo,
|
||||
getTestoIntroduttivo,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -253,6 +253,7 @@
|
||||
:complete="false"
|
||||
:cosa="cosa"
|
||||
v-model="optcatalogo"
|
||||
:idPage="idPage"
|
||||
:options="{
|
||||
show_short_descr: false,
|
||||
show_price: false,
|
||||
@@ -321,8 +322,7 @@
|
||||
>
|
||||
<div
|
||||
v-html="
|
||||
recscheda.scheda.dimensioni.pagina?.testo_up
|
||||
?.contenuto
|
||||
getTestoIntroduttivo(recscheda)
|
||||
"
|
||||
style="display: flex; flex-direction: row"
|
||||
></div>
|
||||
@@ -355,6 +355,7 @@
|
||||
:complete="false"
|
||||
:cosa="cosa"
|
||||
v-model="optcatalogo"
|
||||
:idPage="idPage"
|
||||
:scheda="recscheda.scheda"
|
||||
:options="{
|
||||
show_short_descr: false,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
:id="id"
|
||||
:cosa="cosa"
|
||||
:complete="true"
|
||||
:idPage="idPage"
|
||||
:options="{
|
||||
show_short_descr: true,
|
||||
show_price: true,
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
:prop_searchList="searchList"
|
||||
:showType="costanti.SHOW_GROUPINFO"
|
||||
:showCol="false"
|
||||
:defaultnewrec="getdefaultnewrec"
|
||||
:defaultnewrec="getdefaultnewrec()"
|
||||
:extraparams="extraparams()">
|
||||
|
||||
</CGridTableRec>
|
||||
|
||||
Reference in New Issue
Block a user