corretto bug GruppoMacro la lista veniva salvata ma anche aggiornata in memoria con solo gli ID... in questo caso TABLES_NON_AGGIORNARE_IN_MEMORIA_PERCHE_DIVERSA_STRUTTURA gli dice che alcune tabelle non devono essere aggiornate in memoria.
This commit is contained in:
@@ -32,9 +32,6 @@ import { CSearchProduct } from '@src/components/CSearchProduct';
|
||||
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard';
|
||||
import { CSelectUserActive } from '@src/components/CSelectUserActive';
|
||||
|
||||
import html2pdf from 'html2pdf.js';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
import type {
|
||||
IOptCatalogo,
|
||||
IDimensioni,
|
||||
@@ -1206,7 +1203,7 @@ export default defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
function arraysEqual(arr1, arr2) {
|
||||
function arraysEqual(arr1: any, arr2: any) {
|
||||
return (
|
||||
Array.isArray(arr1) &&
|
||||
Array.isArray(arr2) &&
|
||||
@@ -1300,10 +1297,6 @@ export default defineComponent({
|
||||
sort_dir: number
|
||||
): IProduct[] {
|
||||
if (sort_field) {
|
||||
// console.log('--- Primi 10 elementi INIZIALI:');
|
||||
/*arrprod.slice(0, 15).forEach((product, index) => {
|
||||
console.log(`${index + 1}. ${product.productInfo?.name} (${product.productInfo?.date_pub})`);
|
||||
});*/
|
||||
|
||||
// Crea una copia dell'array per non modificare l'originale
|
||||
const sortedArr = [...arrprod].sort((a: IProduct, b: IProduct) => {
|
||||
@@ -1367,7 +1360,7 @@ export default defineComponent({
|
||||
return { end: true };
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { rec: null, indprod };
|
||||
return { indprod };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1384,17 +1377,17 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
function generatearrProdToViewSorted(
|
||||
async function generatearrProdToViewSorted(
|
||||
usaprodottiSalvati?: boolean,
|
||||
salva?: boolean,
|
||||
salvasudb?: boolean
|
||||
) {
|
||||
/*console.log(
|
||||
console.log(
|
||||
'generatearrProdToViewSorted... usaprodottiSalvati=',
|
||||
usaprodottiSalvati,
|
||||
' salva=',
|
||||
salva
|
||||
);*/
|
||||
);
|
||||
|
||||
try {
|
||||
// Svuota
|
||||
@@ -1533,7 +1526,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if (salvasudb) {
|
||||
salvaListaProdotti(false);
|
||||
await salvaListaProdotti(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1544,7 +1537,7 @@ export default defineComponent({
|
||||
// console.log('Fine...')
|
||||
}
|
||||
|
||||
function salvaListaProdotti(ricarica: boolean) {
|
||||
async function salvaListaProdotti(ricarica: boolean) {
|
||||
// Estrai solo gli ID dei prodotti filtrati
|
||||
const myarr = [...myCatalog.value.lista_prodotti];
|
||||
const productIds = myarr.map((product) => product._id);
|
||||
@@ -1556,7 +1549,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
// Salva gli ID dei prodotti nel catalogo
|
||||
tools.saveFieldToServer(
|
||||
await tools.saveFieldToServer(
|
||||
$q,
|
||||
'catalogs',
|
||||
myCatalog.value._id,
|
||||
@@ -1566,7 +1559,7 @@ export default defineComponent({
|
||||
);
|
||||
|
||||
if (ricarica) {
|
||||
generatearrProdToViewSorted(true, false);
|
||||
await generatearrProdToViewSorted(true, false);
|
||||
}
|
||||
|
||||
// lista_Aggiornata();
|
||||
@@ -2376,7 +2369,8 @@ export default defineComponent({
|
||||
router.push(path);
|
||||
}
|
||||
|
||||
function updateProducts(arr: any, aggiorna?: boolean) {
|
||||
async function updateProducts(arr: any, aggiorna?: boolean) {
|
||||
console.log('UpdateProducts', arr.length)
|
||||
if (myCatalog.value && myCatalog.value?.lista_prodotti) {
|
||||
if (
|
||||
myCatalog.value.lista_prodotti?.length !== arr.length ||
|
||||
@@ -2387,13 +2381,16 @@ export default defineComponent({
|
||||
) {
|
||||
myCatalog.value.lista_prodotti = [...arr];
|
||||
|
||||
if (!showListaFiltrata.value && !tools.isUtente()) salvaListaProdotti(true);
|
||||
else generatearrProdToViewSorted(true, false);
|
||||
if (!showListaFiltrata.value && !tools.isUtente()) {
|
||||
await salvaListaProdotti(true);
|
||||
} else {
|
||||
await generatearrProdToViewSorted(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addProductToList(element: IProduct, where: string) {
|
||||
async function addProductToList(element: IProduct, where: string) {
|
||||
console.log('addProductToList', element)
|
||||
|
||||
if (element) {
|
||||
@@ -2407,7 +2404,7 @@ export default defineComponent({
|
||||
if (where === shared_consts.WHERE_INSERT.ONTOP) arr.unshift(element);
|
||||
else if (where === shared_consts.WHERE_INSERT.ONBOTTOM) arr.push(element);
|
||||
|
||||
updateProducts(arr, true);
|
||||
await updateProducts(arr, true);
|
||||
|
||||
addnewProd.value = false;
|
||||
}
|
||||
@@ -2697,9 +2694,9 @@ export default defineComponent({
|
||||
});
|
||||
}
|
||||
|
||||
function convertiProps(obj?: Record<string, string | undefined>, props: string[]) {
|
||||
function convertiProps(obj: Record<string, string | undefined>, myprops: string[]) {
|
||||
if (!obj) return;
|
||||
props.forEach((prop) => {
|
||||
myprops.forEach((prop) => {
|
||||
if (obj[prop] !== undefined) obj[prop] = converti(obj[prop]!);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,9 +29,6 @@ import { CSearchProduct } from '@src/components/CSearchProduct';
|
||||
import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard';
|
||||
import { CSelectUserActive } from '@src/components/CSelectUserActive';
|
||||
|
||||
import html2pdf from 'html2pdf.js';
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
import type {
|
||||
IOptCatalogo,
|
||||
IDimensioni,
|
||||
|
||||
12
src/views/login/invitoreg/invitoreg.scss
Executable file
12
src/views/login/invitoreg/invitoreg.scss
Executable file
@@ -0,0 +1,12 @@
|
||||
.signup {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
max-width: 450px;
|
||||
}
|
||||
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
39
src/views/login/invitoreg/invitoreg.ts
Executable file
39
src/views/login/invitoreg/invitoreg.ts
Executable file
@@ -0,0 +1,39 @@
|
||||
import { computed, defineComponent, ref, watch } from 'vue'
|
||||
import { CSignUp } from '../../../components/CSignUp'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { tools } from '@tools'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'SignUp',
|
||||
components: { CSignUp },
|
||||
props: {},
|
||||
setup() {
|
||||
const $route = useRoute()
|
||||
|
||||
const adult = ref(false)
|
||||
const invited = computed(() => $route.params.invited)
|
||||
const regexpire = computed(() => $route.params.regexpire)
|
||||
|
||||
// @ts-ignore
|
||||
watch(() => invited, (newval, oldval) => {
|
||||
console.log('$route.params.invited')
|
||||
adult.value = !!$route.params.invited
|
||||
})
|
||||
|
||||
function created() {
|
||||
if (!tools.getCookie(tools.APORTADOR_SOLIDARIO, '')) {
|
||||
// @ts-ignore
|
||||
tools.setCookie(tools.APORTADOR_SOLIDARIO, $route.params.invited ? $route.params.invited : '')
|
||||
}
|
||||
}
|
||||
|
||||
created()
|
||||
|
||||
return {
|
||||
regexpire
|
||||
}
|
||||
},
|
||||
})
|
||||
13
src/views/login/invitoreg/invitoreg.vue
Executable file
13
src/views/login/invitoreg/invitoreg.vue
Executable file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<q-page padding class="signup">
|
||||
<CSignUp :showcell="false" :showaportador="true" :show_namesurname="true" :need_Telegram="true" :regexpire="regexpire" :token="token">
|
||||
|
||||
</CSignUp>
|
||||
</q-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./invitoreg.ts">
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './invitoreg.scss';
|
||||
</style>
|
||||
Reference in New Issue
Block a user