- Creazione di un Nuovo Catalogo (e la sua relativa pagina), a partire da un modello ed un catalogo esistente.

- Aggiunta dei bottoni sul Ccatalogocard
This commit is contained in:
Surya Paolo
2025-06-12 23:49:13 +02:00
parent 2dac04fb16
commit 286cc4e3a7
23 changed files with 286736 additions and 1889 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -29,33 +29,33 @@
"postinstall": "quasar prepare" "postinstall": "quasar prepare"
}, },
"dependencies": { "dependencies": {
"@cubejs-client/core": "^1.2.26", "@cubejs-client/core": "^1.3.21",
"@quasar/extras": "^1.16.17", "@quasar/extras": "^1.17.0",
"@quasar/quasar-ui-qcalendar": "^4.1.2", "@quasar/quasar-ui-qcalendar": "^4.1.2",
"@types/jsbarcode": "^3.11.4", "@types/jsbarcode": "^3.11.4",
"@types/leaflet": "^1.9.17", "@types/leaflet": "^1.9.18",
"@vue/compat": "^3.5.13", "@vue/compat": "^3.5.16",
"@vue/compiler-sfc": "^3.5.13", "@vue/compiler-sfc": "^3.5.16",
"@vuelidate/core": "^2.0.3", "@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4", "@vuelidate/validators": "^2.0.4",
"acorn": "^8.14.1", "acorn": "^8.15.0",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"apexcharts": "^4.7.0", "apexcharts": "^4.7.0",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"axios": "^1.8.4", "axios": "^1.9.0",
"bcryptjs": "^3.0.2", "bcryptjs": "^3.0.2",
"chart.js": "^4.4.8", "chart.js": "^4.4.9",
"core-js": "^3.41.0", "core-js": "^3.43.0",
"crypto-browserify": "^3.12.1", "crypto-browserify": "^3.12.1",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"echarts": "5.6.0", "echarts": "5.6.0",
"eslint-plugin-n": "^17.16.2", "eslint-plugin-n": "^17.19.0",
"eslint-plugin-quasar": "^1.1.0", "eslint-plugin-quasar": "^1.1.0",
"gsap": "^3.12.7", "gsap": "^3.13.0",
"html2pdf.js": "^0.10.3", "html2pdf.js": "^0.10.3",
"jquery": "^3.7.1", "jquery": "^3.7.1",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"jsbarcode": "^3.11.6", "jsbarcode": "^3.12.1",
"leaflet": "^1.9.4", "leaflet": "^1.9.4",
"leaflet-routing-machine": "^3.2.12", "leaflet-routing-machine": "^3.2.12",
"leaflet.markercluster": "^1.5.3", "leaflet.markercluster": "^1.5.3",
@@ -63,21 +63,21 @@
"lodash": "^4.17.21", "lodash": "^4.17.21",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^3.0.1", "pinia": "^3.0.3",
"quasar": "^2.18.1", "quasar": "^2.18.1",
"quasar-extras": "^2.0.9", "quasar-extras": "^2.0.9",
"register-service-worker": "^1.7.2", "register-service-worker": "^1.7.2",
"scrollreveal": "^4.0.9", "scrollreveal": "^4.0.9",
"typescript-eslint": "^8.27.0", "typescript-eslint": "^8.34.0",
"vee-validate": "^4.15.0", "vee-validate": "^4.15.1",
"vue": "^3.5.13", "vue": "^3.5.16",
"vue-class-component": "^8.0.0-rc.1", "vue-class-component": "^8.0.0-rc.1",
"vue-country-code": "^1.1.3", "vue-country-code": "^1.1.3",
"vue-echarts": "^7.0.3", "vue-echarts": "^7.0.3",
"vue-i18n": "^11.1.2", "vue-i18n": "^11.1.5",
"vue-idb": "^0.2.0", "vue-idb": "^0.2.0",
"vue-property-decorator": "^10.0.0-rc.3", "vue-property-decorator": "^10.0.0-rc.3",
"vue-router": "^4.5.0", "vue-router": "^4.5.1",
"vue-scroll-reveal": "^2.1.0", "vue-scroll-reveal": "^2.1.0",
"vue-social-sharing": "^4.0.0-alpha4", "vue-social-sharing": "^4.0.0-alpha4",
"vue-svgicon": "^4.0.0-alpha.3", "vue-svgicon": "^4.0.0-alpha.3",
@@ -95,41 +95,41 @@
"workbox-window": "^7.3.0" "workbox-window": "^7.3.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.23.0", "@eslint/js": "^9.28.0",
"@intlify/unplugin-vue-i18n": "^6.0.5", "@intlify/unplugin-vue-i18n": "^6.0.8",
"@quasar/app-vite": "^2.1.4", "@quasar/app-vite": "^2.2.1",
"@types/google.maps": "^3.58.1", "@types/google.maps": "^3.58.1",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/node": "^22.13.11", "@types/node": "^24.0.1",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/vue-tel-input": "^2.1.7", "@types/vue-tel-input": "^2.1.7",
"@types/vuelidate": "^0.7.22", "@types/vuelidate": "^0.7.22",
"@vue/devtools": "^7.7.2", "@vue/devtools": "^7.7.6",
"@vue/eslint-config-prettier": "^10.2.0", "@vue/eslint-config-prettier": "^10.2.0",
"@vue/eslint-config-typescript": "^14.5.0", "@vue/eslint-config-typescript": "^14.5.0",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"eslint": "9", "eslint": "9",
"eslint-plugin-import": "^2.31.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-vue": "^10.0.0", "eslint-plugin-vue": "^10.2.0",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"globals": "^16.0.0", "globals": "^16.2.0",
"http-proxy-middleware": "^3.0.3", "http-proxy-middleware": "^3.0.5",
"jest": "^29.7.0", "jest": "^30.0.0",
"json-loader": "^0.5.7", "json-loader": "^0.5.7",
"nodemon": "^3.1.9", "nodemon": "^3.1.10",
"npm-check-updates": "^17.1.16", "npm-check-updates": "^18.0.1",
"parcel": "^2.14.1", "parcel": "^2.15.2",
"postcss": "^8.5.3", "postcss": "^8.5.5",
"postcss-loader": "^8.1.1", "postcss-loader": "^8.1.1",
"prettier": "3", "prettier": "3",
"strip-ansi": "=7.1.0", "strip-ansi": "=7.1.0",
"ts-jest": "^29.2.6", "ts-jest": "^29.4.0",
"typescript": "5.7.3", "typescript": "5.8.3",
"vite-plugin-checker": "^0.9.1", "vite-plugin-checker": "^0.9.3",
"vue-cli-plugin-element-ui": "^1.1.4", "vue-cli-plugin-element-ui": "^1.1.4",
"vue-eslint-parser": "^10.1.1", "vue-eslint-parser": "^10.1.3",
"vue-tsc": "^2.2.8", "vue-tsc": "^2.2.10",
"vueify": "^9.4.1", "vueify": "^9.4.1",
"workbox-build": "^7.3.0" "workbox-build": "^7.3.0"
}, },

View File

@@ -19,11 +19,13 @@ import { useUserStore } from '@store/UserStore';
import { CTitlePage } from '@src/components/CTitlePage'; import { CTitlePage } from '@src/components/CTitlePage';
import { CGridTableRec } from '@src/components/CGridTableRec'; import { CGridTableRec } from '@src/components/CGridTableRec';
import type { ICatalog, IColGridTable, ISearchList } from 'model'; import type { ICatalog, IColGridTable, INewCatalog, ISearchList } from 'model';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toolsext } from '@store/Modules/toolsext'; import { toolsext } from '@store/Modules/toolsext';
import { fieldsTable } from '@store/Modules/fieldsTable'; import { fieldsTable } from '@store/Modules/fieldsTable';
import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router';
import { useCatalogStore } from 'app/src/store/CatalogStore';
export default defineComponent({ export default defineComponent({
name: 'CCatalogList', name: 'CCatalogList',
@@ -85,8 +87,11 @@ export default defineComponent({
const $q = useQuasar(); const $q = useQuasar();
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const userStore = useUserStore(); const userStore = useUserStore();
const catalogStore = useCatalogStore();
const $router = useRouter();
const table = ref('catalogs'); const table = ref('catalogs');
const caricamentodati = ref(false);
const arrfilterand: any = ref([]); const arrfilterand: any = ref([]);
const filtercustom: any = ref([]); const filtercustom: any = ref([]);
@@ -99,9 +104,12 @@ export default defineComponent({
const col_footer = ref(''); const col_footer = ref('');
const col_tabfooter = ref(''); const col_tabfooter = ref('');
const cataloghi = ref(<any[]>[]);
const modelli = ref(<any[]>[]);
const strextra = ref(''); const strextra = ref('');
const myoptions = ref(<any>[]); const myoptions = ref(<any>[]);
const newCatalog = ref(<any>{}); const newCatalog = ref(<INewCatalog>{});
const col = ref(<IColGridTable[]>[]); const col = ref(<IColGridTable[]>[]);
@@ -171,6 +179,17 @@ export default defineComponent({
filtercustom.value = []; filtercustom.value = [];
col.value = fieldsTable.getArrColsByTable(table.value); col.value = fieldsTable.getArrColsByTable(table.value);
modelli.value = globalStore.getMyPagesOptionsTemplate();
cataloghi.value = catalogStore.getCatalogsList();
if (modelli.value && modelli.value.length > 0) {
newCatalog.value.idPageTemplate = modelli.value[0].value;
}
if (cataloghi.value && cataloghi.value.length > 0) {
newCatalog.value.idCatalogToCopy = cataloghi.value[1].value;
}
} }
function mySortFieldsAvailable() { function mySortFieldsAvailable() {
@@ -198,22 +217,41 @@ export default defineComponent({
showFormAddNewCatalog.value = true; showFormAddNewCatalog.value = true;
} }
function addNewCatalogSave() { async function addNewCatalogSave() {
// Salva catalogo // Salva catalogo
caricamentodati.value = true;
const ris = await globalStore.addNewCatalog(newCatalog.value, $router);
if (ris.page) {
const newPagePath = ris.page.path;
const confirmNavigation = $q
.dialog({
message: t(t('mypages.catalogo_new', { title: ris.page.title })),
ok: { label: t('Sì'), push: true },
cancel: { label: t('No') },
title: t('mypages.confirm_nav'),
})
.onOk(() => {
$router.push({ path: `/${newPagePath}` });
});
} else {
tools.showNegativeNotif($q, t('mypages.catalogo_err'));
} }
function checkPathExist() { caricamentodati.value = false;
const mypageexist = globalStore.mypage.find(
(myrec) => myrec.path.toLowerCase() === newCatalog.path.toLowerCase()
);
if (mypageexist) {
$q.notify({
message: `La pagina ${newCatalog.path} esiste già`,
color: 'red',
position: 'top',
});
return;
} }
function checkPathAlreadyExist(path: string) {
const mypageexist = globalStore.mypage.find(
(myrec) => myrec?.path?.toLowerCase() === path?.toLowerCase()
);
return mypageexist;
}
function checkNameAlreadyExist(title: string) {
const mypageexist = globalStore.mypage.find(
(myrec) => myrec?.title?.toLowerCase() === title?.toLowerCase()
);
return mypageexist;
} }
onMounted(mounted); onMounted(mounted);
@@ -247,8 +285,12 @@ export default defineComponent({
showFormAddNewCatalog, showFormAddNewCatalog,
addNewCatalogSave, addNewCatalogSave,
newCatalog, newCatalog,
checkPathExist, checkPathAlreadyExist,
checkNameAlreadyExist,
globalStore, globalStore,
caricamentodati,
cataloghi,
modelli,
}; };
}, },
}); });

View File

@@ -65,32 +65,59 @@
filled filled
v-model="newCatalog.title" v-model="newCatalog.title"
label="Titolo del catalogo *" label="Titolo del catalogo *"
autofocus
@update:model-value="
newCatalog.path = tools.convertTitleToFileName(newCatalog.title)
"
lazy-rules lazy-rules
:rules="[(val) => (val && val.length > 0) || 'Inserire il titolo']" :rules="[
(val) => (val && val.length > 0) || 'Inserire il titolo',
(val) =>
!checkNameAlreadyExist(val) || 'Il titolo della pagina esiste già ',
]"
/> />
<q-input <q-input
filled filled
v-model="newCatalog.path" v-model="newCatalog.path"
label="Nome della pagina *" label="Nome della pagina *"
@update:model-value="checkPathExist"
lazy-rules lazy-rules
:rules="[(val) => (val && val.length > 0) || 'Inserire il nome della pagina']" :rules="[
(val) => (val && val.length > 0) || 'Inserire il nome della pagina',
(val) => !checkPathAlreadyExist(val) || 'Il nome della pagina esiste già ',
]"
/> />
<q-select <q-select
filled filled
v-model="newCatalog.template" v-model="newCatalog.idPageTemplate"
:options="globalStore.getMyPagesOptionsTemplate()" :options="modelli"
label="Modello *" label="Modello *"
emit-value emit-value
map-options map-options
:rules="[(val) => (val && val.length > 0) || 'Selezionare un modello']" :rules="[(val) => (val && val.length > 0) || 'Selezionare un modello']"
/> />
<q-select
filled
v-model="newCatalog.idCatalogToCopy"
:options="cataloghi"
label="Catalogo da copiare *"
emit-value
map-options
/>
<div class="row justify-center"> <div class="row justify-center">
<q-btn <q-btn
label="Aggiungi" label="Aggiungi"
type="submit" type="submit"
:disable="
!(
newCatalog.title &&
newCatalog.path &&
newCatalog.idPageTemplate &&
!checkPathAlreadyExist(newCatalog.path)
)
"
color="primary" color="primary"
/> />
<q-btn <q-btn
@@ -103,6 +130,15 @@
</div> </div>
</q-form> </q-form>
</q-card-section> </q-card-section>
<div
v-if="caricamentodati"
class="overlay"
>
<q-spinner-hourglass
color="primary"
size="50px"
/>
</div>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>

View File

@@ -141,7 +141,17 @@
> >
</q-img> </q-img>
</a> </a>
<div class="row no-wrap q-col-gutter-x-xs items-center semi-transparent" style="position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); z-index: 10"> <div
v-if="globalStore.showHeader"
class="row no-wrap q-col-gutter-x-xs items-center semi-transparent"
style="
position: absolute;
bottom: -5px;
left: 50%;
transform: translateX(-50%);
z-index: 10;
"
>
<div v-if="!optcatalogo.generazionePDFInCorso"> <div v-if="!optcatalogo.generazionePDFInCorso">
<q-btn <q-btn
icon="fas fa-external-link-alt" icon="fas fa-external-link-alt"

View File

@@ -7,10 +7,12 @@ import { useProducts } from '@store/Products';
import { CCopyBtn } from '@src/components/CCopyBtn'; import { CCopyBtn } from '@src/components/CCopyBtn';
import { CSingleCart } from '@src/components/CSingleCart'; import { CSingleCart } from '@src/components/CSingleCart';
import { CTitleBanner } from '@src/components/CTitleBanner'; import { CTitleBanner } from '@src/components/CTitleBanner';
import { tools } from '@store/Modules/tools';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import MixinUsers from '../../mixins/mixin-users'; import MixinUsers from '../../mixins/mixin-users';
import { useQuasar } from 'quasar';
export default defineComponent({ export default defineComponent({
name: 'CMyCart', name: 'CMyCart',
@@ -21,9 +23,14 @@ export default defineComponent({
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();
const productStore = useProducts(); const productStore = useProducts();
const { t } = useI18n(); const { t } = useI18n();
const $q = useQuasar();
const { getnumItemsCart } = MixinUsers(); const { getnumItemsCart } = MixinUsers();
const codice_sconto = ref('')
const descr_sconto = ref('')
const caricamentodati = ref(false)
const myCart = computed(() => productStore.cart); const myCart = computed(() => productStore.cart);
const myTotalPrice = computed(() => { const myTotalPrice = computed(() => {
if (productStore.cart) { if (productStore.cart) {
@@ -69,6 +76,43 @@ export default defineComponent({
return productStore.getNumOrders() > 0; return productStore.getNumOrders() > 0;
} }
async function applicaSconto(codice: string) {
try {
caricamentodati.value = true;
const rissconto = await productStore.ApplicaSconto({
cart_id: myCart.value._id,
codice_sconto: codice,
});
if (rissconto) {
if (rissconto.msg) {
tools.showNeutralNotif($q, `${rissconto.msg}`);
} else if (rissconto.valido && rissconto.mycart) {
tools.showPositiveNotif($q, 'Sconto Applicato!');
} else {
tools.showNegativeNotif($q, `${rissconto.errmsg}`);
}
codice_sconto.value = '';
descr_sconto.value = '';
if (rissconto.mycart) {
recOrderCart.value = rissconto.mycart
};
}
} catch (error) {
console.log('error ApplicaSconto', error);
tools.showNegativeNotif($q, `Sconto Non Applicato! ${error.message}`);
codice_sconto.value = '';
descr_sconto.value = '';
} finally {
caricamentodati.value = false;
}
}
async function confermaCodiceSconto() {
await applicaSconto(codice_sconto.value);
}
onMounted(mounted); onMounted(mounted);
return { return {
@@ -82,6 +126,10 @@ export default defineComponent({
existsOrders, existsOrders,
globalStore, globalStore,
t, t,
codice_sconto,
confermaCodiceSconto,
caricamentodati,
descr_sconto,
}; };
}, },
}); });

View File

@@ -136,6 +136,15 @@
</q-btn> </q-btn>
</div> </div>
</div> </div>
<div
v-if="caricamentodati"
class="overlay"
>
<q-spinner-hourglass
color="primary"
size="50px"
/>
</div>
</div> </div>
</template> </template>

View File

@@ -226,6 +226,7 @@ export default defineComponent({
showexportPage, showexportPage,
showimportPage, showimportPage,
hideHeader, hideHeader,
myidPage,
}; };
}, },
}); });

View File

@@ -27,7 +27,7 @@ import { CModifTrafiletto } from '@src/components/CModifTrafiletto';
import { costanti } from '@costanti'; import { costanti } from '@costanti';
import { IAuthor, ICatProd } from 'app/src/model'; import { IAuthor, ICatProd } from 'app/src/model';
import type { IMyScheda, IOptCatalogo, IProduct } from '@src/model'; import type { IMyScheda, IOptCatalogo, IOrderCart, IProduct } from '@src/model';
import { shared_consts } from 'app/src/common/shared_vuejs'; import { shared_consts } from 'app/src/common/shared_vuejs';
import { CViewTable } from '../CViewTable'; import { CViewTable } from '../CViewTable';
import { CLabel } from '../CLabel'; import { CLabel } from '../CLabel';
@@ -35,7 +35,7 @@ import { useI18n } from 'vue-i18n';
export default defineComponent({ export default defineComponent({
name: 'CProductTable', name: 'CProductTable',
emits: ['update:lista_prodotti', 'update:optcatalogo', 'rigenera'], emits: ['update:lista_prodotti', 'update:optcatalogo', 'rigenera', 'addtolist'],
components: { components: {
draggable, draggable,
CSearchProduct, CSearchProduct,
@@ -70,6 +70,11 @@ export default defineComponent({
required: false, required: false,
default: () => ({}), default: () => ({}),
}, },
options: {
type: Object,
required: false,
default: () => ({}),
}
}, },
setup(props, { emit }) { setup(props, { emit }) {
// Copia locale della lista_prodotti per manipolazione interna // Copia locale della lista_prodotti per manipolazione interna
@@ -106,7 +111,6 @@ export default defineComponent({
const addstr = ref(''); const addstr = ref('');
const optionscatalogo = ref(<any>{ maxlength: 0 }); const optionscatalogo = ref(<any>{ maxlength: 0 });
function handleUpdate(newList) { function handleUpdate(newList) {
@@ -136,7 +140,6 @@ export default defineComponent({
internalProducts.value.forEach((p: IProduct) => { internalProducts.value.forEach((p: IProduct) => {
p.myorder = ProductStore.createMyOrder(); p.myorder = ProductStore.createMyOrder();
}); });
} }
), ),
{ deep: true }; { deep: true };
@@ -264,6 +267,15 @@ export default defineComponent({
style: 'width: 50px', style: 'width: 50px',
notsortable: true, notsortable: true,
}, },
{
name: 'addtolist',
label: 'Add',
field: 'addtolist',
align: 'center',
noexp: true,
notsortable: true,
visu: costanti.VISUCAMPI.PER_EDITORE,
},
{ {
name: 'edit', name: 'edit',
label: 'Mod', label: 'Mod',
@@ -555,6 +567,7 @@ export default defineComponent({
case 'data_online_stampa': case 'data_online_stampa':
return tools.getstrDate(catalog.data_online_stampa); return tools.getstrDate(catalog.data_online_stampa);
case 'addtocart': case 'addtocart':
case 'addtolist':
return true; return true;
case 'image': case 'image':
return catalog.foto_collana?.imagefile return catalog.foto_collana?.imagefile
@@ -809,6 +822,7 @@ export default defineComponent({
? cookieValue ? cookieValue
: [ : [
'pos', 'pos',
'addtolist',
'drag', 'drag',
'edit', 'edit',
'validato', 'validato',
@@ -852,8 +866,13 @@ export default defineComponent({
const selectedColumns = ref([]); const selectedColumns = ref([]);
function isEditColumn(name: string): boolean {
const column = allColumns.value.find((col) => col.name === name);
return column ? column.edit : false;
};
// 3. Funzione per verificare se una colonna è visibile (isColumnVisible) // 3. Funzione per verificare se una colonna è visibile (isColumnVisible)
const isColumnVisible = (column, real?: boolean) => { const isColumnVisible = (column: string, real?: boolean) => {
if (column === 'actions' && !real) { if (column === 'actions' && !real) {
return false; return false;
} }
@@ -862,10 +881,20 @@ export default defineComponent({
return false; return false;
} }
} }
const ok = let ok =
allColumns.value.some((col) => col.name === column) && allColumns.value.some((col) => col.name === column) &&
(!props.optcatalogo.showListaArgomenti || (!props.optcatalogo.showListaArgomenti ||
(props.optcatalogo.showListaArgomenti && !column.edit)); (props.optcatalogo.showListaArgomenti && !isEditColumn(column)));
if (props.options?.showbuttAdd && column === 'addtolist') {
if (tools.isCollaboratore())
ok = true
}
if (!props.options?.showbuttAdd && column === 'addtolist') {
ok = false
}
return selectedColumns.value.includes(column) && ok; return selectedColumns.value.includes(column) && ok;
}; };
@@ -873,9 +902,8 @@ export default defineComponent({
const column = allColumns.value.find((col) => col.name === name); const column = allColumns.value.find((col) => col.name === name);
return column ? column.label : ''; return column ? column.label : '';
}; };
// Funzione per eliminare un prodotto // Funzione per eliminare un prodotto
const removeProduct = (product) => { const removeProduct = (product: IProduct) => {
return $q return $q
.dialog({ .dialog({
message: t('scheda.removeProduct'), message: t('scheda.removeProduct'),
@@ -1082,6 +1110,10 @@ export default defineComponent({
emit('rigenera'); emit('rigenera');
} }
function addtolist(element) {
emit('addtolist', element)
}
function getFieldClick(element: any, field: any): (() => void) | null { function getFieldClick(element: any, field: any): (() => void) | null {
switch (field.field) { switch (field.field) {
case 'trafiletto': case 'trafiletto':
@@ -1147,7 +1179,7 @@ export default defineComponent({
); );
} }
function getImageByElement(element) { function getImageByElement(element: any) {
let image = ''; let image = '';
if (props.table === shared_consts.TABLES_CATALOG) { if (props.table === shared_consts.TABLES_CATALOG) {
image = element.foto_collana?.imagefile; image = element.foto_collana?.imagefile;
@@ -1252,6 +1284,7 @@ export default defineComponent({
allColumnsComputed, allColumnsComputed,
addtoCart, addtoCart,
arrordersCart, arrordersCart,
addtolist,
}; };
}, },
}); });

View File

@@ -160,6 +160,17 @@
> >
</q-btn> </q-btn>
</td> </td>
<td v-else-if="field.name === 'addtolist' && isColumnVisible('addtolist')">
<q-btn
icon="fas fa-plus"
color="primary"
rounded
dense
size="sm"
@click="addtolist(element)"
>
</q-btn>
</td>
<!-- Immagine Piccola --> <!-- Immagine Piccola -->
<td v-else-if="field.name === 'image' && isColumnVisible('image')"> <td v-else-if="field.name === 'image' && isColumnVisible('image')">

View File

@@ -2,6 +2,13 @@ import type { IImg } from "./GlobalStore"
import type { ICollana, IProduct } from "./Products" import type { ICollana, IProduct } from "./Products"
export interface INewCatalog {
title: string
path: string
idPageTemplate: string
idCatalogToCopy?: string
}
export interface ICatalog { export interface ICatalog {
_id: string _id: string
idapp: string idapp: string
@@ -11,7 +18,7 @@ export interface ICatalog {
idCollane?: string[] idCollane?: string[]
argomenti?: string[] argomenti?: string[]
idTipoFormato?: number[] idTipoFormato?: number[]
condition_andor: number, condition_andor?: number,
editore?: string[] editore?: string[]
editore_escludi?: string[] editore_escludi?: string[]
collana_info?: ICollana collana_info?: ICollana

View File

@@ -513,7 +513,7 @@ export interface IGlobalState {
gallery: IGallery[], gallery: IGallery[],
mypage: IMyPage[], mypage: IMyPage[],
myelems: IMyElem[], myelems: IMyElem[],
lista_cron: IListaCron[], lista_cron?: IListaCron[],
myschedas: ISchedaSingola[], myschedas: ISchedaSingola[],
templemail: ITemplEmail[], templemail: ITemplEmail[],
destnewsletter?: IDestNewsletter[], destnewsletter?: IDestNewsletter[],

View File

@@ -1258,6 +1258,9 @@ const msg_it = {
date_updated: 'Ult. Aggiornamento', date_updated: 'Ult. Aggiornamento',
}, },
mypages: { mypages: {
catalogo_new: 'Vuoi andare al Catalogo "{title}" appena creato?',
confirm_nav: 'Conferma Navigazione',
catalogo_err: 'Catalogo non generato correttamente',
isTemplate: 'E\' un modello', isTemplate: 'E\' un modello',
catAI: 'Categorie AI', catAI: 'Categorie AI',
toolsAI: 'Strumenti AI', toolsAI: 'Strumenti AI',

View File

@@ -1,7 +1,16 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import type { ICatalogState } from '@src/model'; import type { ICatalogState } from '@src/model';
import { IAccount, ICircuit, ICatalog, IGlobalState, IGroupShort, IMyCircuit, IMyGroup, IUserFields } from '@src/model'; import {
IAccount,
ICircuit,
ICatalog,
IGlobalState,
IGroupShort,
IMyCircuit,
IMyGroup,
IUserFields,
} from '@src/model';
import { tools } from '@tools'; import { tools } from '@tools';
import translate from '@src/globalroutines/util'; import translate from '@src/globalroutines/util';
@@ -26,17 +35,27 @@ export const useCatalogStore = defineStore('CatalogStore', {
}), }),
getters: { getters: {
getCatalogById: (state) => (id: string): ICatalog => { getCatalogById:
(state) =>
(id: string): ICatalog => {
return state.catalogs.find((cat: ICatalog) => cat._id === id) || null; return state.catalogs.find((cat: ICatalog) => cat._id === id) || null;
}, },
getCatalogsList: (state) => (): {label: string, value: string}[] => { getCatalogsList: (state) => (): { label: string; value: string }[] => {
return state.catalogs.map((cat: ICatalog) => { return [
{ label: '[Nessuno]', value: '' },
...state.catalogs.map((cat: ICatalog) => {
return { label: cat.title, value: cat._id }; return { label: cat.title, value: cat._id };
}); }),
];
}, },
getCatalogByIdPageAssigned: (state) => (idPage: string): ICatalog => {
return state.catalogs.find((cat: ICatalog) => cat.idPageAssigned === idPage) || null; getCatalogByIdPageAssigned:
(state) =>
(idPage: string): ICatalog => {
return (
state.catalogs.find((cat: ICatalog) => cat.idPageAssigned === idPage) || null
);
}, },
}, },
@@ -72,13 +91,21 @@ export const useCatalogStore = defineStore('CatalogStore', {
}) })
.catch((error) => { .catch((error) => {
console.log('error loadCatalogById', error); console.log('error loadCatalogById', error);
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, toolsext.ERR_GENERICO, error); return new Types.AxiosError(
serv_constants.RIS_CODE_ERR,
null,
toolsext.ERR_GENERICO,
error
);
}); });
return ris; return ris;
}, },
async loadProductsOnlyByIdPageCatalog(idPage: string, forzacaricamento: boolean = false) { async loadProductsOnlyByIdPageCatalog(
idPage: string,
forzacaricamento: boolean = false
) {
// controlla se è stata già caricata in memoria // controlla se è stata già caricata in memoria
const productStore = useProducts(); const productStore = useProducts();
@@ -101,7 +128,9 @@ export const useCatalogStore = defineStore('CatalogStore', {
updateDataCatalog(catalog: ICatalog) { updateDataCatalog(catalog: ICatalog) {
if (catalog) { if (catalog) {
// Update catalog from server // Update catalog from server
const indelem = this.catalogs.findIndex((reccatalog: ICatalogCompleto) => reccatalog._id === catalog._id); const indelem = this.catalogs.findIndex(
(reccatalog: ICatalogCompleto) => reccatalog._id === catalog._id
);
if (indelem >= 0) { if (indelem >= 0) {
this.catalogs[indelem] = { ...catalog }; this.catalogs[indelem] = { ...catalog };
this.catalogs[indelem].prodotti_caricati_inmem = true; this.catalogs[indelem].prodotti_caricati_inmem = true;

View File

@@ -544,7 +544,7 @@ export const colmypage = [
AddCol({ name: 'order', label_trans: 'pages.order', fieldtype: costanti.FieldType.number }), AddCol({ name: 'order', label_trans: 'pages.order', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'active', label_trans: 'pages.active', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'active', label_trans: 'pages.active', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'inmenu', label_trans: 'pages.inmenu', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'inmenu', label_trans: 'pages.inmenu', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'isTemplate', label_trans: 'pages.isTemplate', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'isTemplate', label_trans: 'mypages.isTemplate', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'title', label_trans: 'pages.title' }), AddCol({ name: 'title', label_trans: 'pages.title' }),
AddCol({ name: 'subtitle', label_trans: 'pages.subtitle' }), AddCol({ name: 'subtitle', label_trans: 'pages.subtitle' }),
AddCol({ name: 'mainMenu', label_trans: 'pages.mainMenu', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'mainMenu', label_trans: 'pages.mainMenu', fieldtype: costanti.FieldType.boolean }),

View File

@@ -8978,6 +8978,9 @@ export const tools = {
} else if (table === toolsext.TABMYHOSPS) { } else if (table === toolsext.TABMYHOSPS) {
nome = rec ? rec.descr : ''; nome = rec ? rec.descr : '';
str = 'l\'Ospitalità "' + nome + '"'; str = 'l\'Ospitalità "' + nome + '"';
} else if (table === toolsext.TABCATALOGS) {
nome = rec ? rec.title : '';
str = 'il Catalogo "' + nome + '"';
} }
if (!str) { if (!str) {
@@ -10694,6 +10697,16 @@ export const tools = {
return this.removeFileExtension(filename) + `_compressed.pdf`; return this.removeFileExtension(filename) + `_compressed.pdf`;
}, },
convertTitleToFileName(title: string): string {
return title
.replace(/ /g, '_')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '')
.replace(/[^a-zA-Z0-9_]/g, '')
}
// FINE ! // FINE !
// getLocale() { // getLocale() {

View File

@@ -1509,7 +1509,7 @@ export const useProducts = defineStore('Products', {
codice_sconto, codice_sconto,
}: { }: {
cart_id: string; cart_id: string;
codice_sconto: number; codice_sconto: string;
}) { }) {
const userStore = useUserStore(); const userStore = useUserStore();
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();

View File

@@ -1694,6 +1694,7 @@ export const useUserStore = defineStore('UserStore', {
}); });
}, },
async setGlobal(router: Router, isLogged: boolean) { async setGlobal(router: Router, isLogged: boolean) {
const globalStore = useGlobalStore(); const globalStore = useGlobalStore();

View File

@@ -21,6 +21,8 @@ import type {
IProductInfo, IProductInfo,
IVariazione, IVariazione,
IDestNewsletter, IDestNewsletter,
ICatalog,
INewCatalog,
} from '@model'; } from '@model';
import { ICity, IMySkill, ISites, IMyScheda } from '@model'; import { ICity, IMySkill, ISites, IMyScheda } from '@model';
import { static_data } from '@src/db/static_data'; import { static_data } from '@src/db/static_data';
@@ -391,7 +393,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
getMyPagesOptionsTemplate: (state: IGlobalState) => (): any[] => { getMyPagesOptionsTemplate: (state: IGlobalState) => (): any[] => {
return state.mypage return state.mypage
.filter((page: IMyPage) => page.isTemplate === true) .filter((mypage: IMyPage) => mypage.isTemplate === true)
.map((page: IMyPage) => ({ .map((page: IMyPage) => ({
label: page.title, label: page.title,
value: page._id, value: page._id,
@@ -921,6 +923,10 @@ export const useGlobalStore = defineStore('GlobalStore', {
} }
}, },
async aggiornaMenu(router: Router) {
await this.addDynamicPages(router);
},
setPaoArray_Delete(state: IGlobalState) { setPaoArray_Delete(state: IGlobalState) {
state.testp1.mioarray.pop(); state.testp1.mioarray.pop();
}, },
@@ -2131,7 +2137,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
if (page.loadFirst) page.loaded = true; if (page.loadFirst) page.loaded = true;
} }
this.myelems = res.data.myelems ? [...res.data.myelems] : []; this.myelems = res.data.myelems ? [...res.data.myelems] : [];
this.crons = res.data.crons ? [...res.data.crons] : []; this.lista_cron = res.data.crons ? [...res.data.crons] : [];
this.myschedas = []; this.myschedas = [];
this.myschedas = res.data.myschedas ? [...res.data.myschedas] : []; this.myschedas = res.data.myschedas ? [...res.data.myschedas] : [];
// console.log('this.mypage', this.mypage) // console.log('this.mypage', this.mypage)
@@ -2236,6 +2242,67 @@ export const useGlobalStore = defineStore('GlobalStore', {
}); });
}, },
async addNewCatalog(newCatalog: INewCatalog, router: Router): Promise<any> {
const catalogStore = useCatalogStore();
return Api.SendReq('/catalogs/addnew', 'POST', { newCatalog })
.then((res: any) => {
let newPage: any = null;
let newCatalog: any = null;
let newElems: any = null;
// console.table(res)
if (res.data) {
newPage = res.data.data.newPage;
newElems = res.data.data.newElems;
newCatalog = res.data.data.newCatalog;
// aggiorna i dati su mypage e Catalog in memoria
if (newPage) {
const index = this.mypage.findIndex(
(rec: IMyPage) => rec._id === newPage._id
);
if (index >= 0) {
this.mypage[index] = newPage;
} else {
this.mypage.push(newPage);
}
}
if (newCatalog) {
const index = catalogStore.catalogs.findIndex(
(rec: ICatalog) => rec._id === newCatalog._id
);
if (index >= 0) {
catalogStore.catalogs[index] = newCatalog;
} else {
catalogStore.catalogs.push(newCatalog);
}
}
if (newElems && Array.isArray(newElems)) {
newElems.forEach((newElem) => {
const index = this.myelems.findIndex(
(rec: IMyElem) => rec._id === newElem._id
);
if (index >= 0) {
this.myelems[index] = newElem;
} else {
this.myelems.push(newElem);
}
});
}
this.aggiornaMenu(router);
}
return { page: newPage, catalog: newCatalog };
})
.catch((error: any) => {
console.log('error addNewCatalog', error);
return { page: null, catalog: null };
});
},
getArrStrByValueBinary(col: IColGridTable, val: any) { getArrStrByValueBinary(col: IColGridTable, val: any) {
const arr = this.getArrByValueBinary(null, col, val); const arr = this.getArrByValueBinary(null, col, val);
if (arr.length > 0) return arr.join(' - '); if (arr.length > 0) return arr.join(' - ');

View File

@@ -33,7 +33,6 @@ import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard';
import { CSelectUserActive } from '@src/components/CSelectUserActive'; import { CSelectUserActive } from '@src/components/CSelectUserActive';
import html2pdf from 'html2pdf.js'; import html2pdf from 'html2pdf.js';
import { PDFDocument } from 'pdf-lib';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import type { import type {
@@ -1118,7 +1117,7 @@ export default defineComponent({
if (!salva_listatemp) { if (!salva_listatemp) {
rigeneraLibri.value = false; rigeneraLibri.value = false;
} else { } else {
tabgen.value = 'generato' tabgen.value = 'generato';
} }
} }
@@ -1370,7 +1369,7 @@ export default defineComponent({
const trovatocatalogo = myCatalog.value; const trovatocatalogo = myCatalog.value;
let arrGeneraleProdotti = []; let arrGeneraleProdotti: IProduct[] = [];
if (usaprodottiSalvati && myCatalog.value?.lista_prodotti?.length > 0) { if (usaprodottiSalvati && myCatalog.value?.lista_prodotti?.length > 0) {
} else { } else {
@@ -1380,6 +1379,8 @@ export default defineComponent({
let indprod = 0; let indprod = 0;
const indprodGenerale = 0; const indprodGenerale = 0;
let indscheda = -1;
let indtotale = 0; let indtotale = 0;
let arrprod = []; let arrprod = [];
@@ -1387,6 +1388,7 @@ export default defineComponent({
let schedaprec = null; let schedaprec = null;
for (const recscheda of optcatalogo.value.arrSchede!) { for (const recscheda of optcatalogo.value.arrSchede!) {
indscheda++;
if (recscheda && recscheda.scheda) { if (recscheda && recscheda.scheda) {
const schedePerRiga = recscheda.scheda.numschede_perRiga || 1; const schedePerRiga = recscheda.scheda.numschede_perRiga || 1;
const schedePerCol = recscheda.scheda.numschede_perCol || 1; const schedePerCol = recscheda.scheda.numschede_perCol || 1;
@@ -1458,8 +1460,10 @@ export default defineComponent({
if (optcatalogo.value.maxnumlibri! > 0) { if (optcatalogo.value.maxnumlibri! > 0) {
if (indtotale > optcatalogo.value.maxnumlibri!) break; if (indtotale > optcatalogo.value.maxnumlibri!) break;
} else { } else {
// if (indtotale > 1000) if (indscheda > 10000) {
// break lastresultend = true;
break;
}
} }
} }
} }
@@ -1605,6 +1609,16 @@ export default defineComponent({
} }
} }
// Se la lista è vuota allora mostra il Tab Lista:
if (myCatalog.value && !showListaFiltrata.value) {
if (myCatalog.value.lista_prodotti.length === 0) {
tabcatalogo.value = 'lista'
}
}
optrigenera.value.visibilitaDisp = tools.getCookie( optrigenera.value.visibilitaDisp = tools.getCookie(
(showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_DISP', (showListaFiltrata.value ? 'INC_ES_' : '') + 'VIS_DISP',
costanti.DISP.DISPONIBILI costanti.DISP.DISPONIBILI
@@ -1800,7 +1814,7 @@ export default defineComponent({
}; };
function groupedPages(recscheda: ISchedaSingola) { function groupedPages(recscheda: ISchedaSingola) {
return recscheda.arrProdToShow; return recscheda.arrProdToShow?.slice(0, 50);
} }
function generateStyleCatalogo(optcatalogo: IOptCatalogo) { function generateStyleCatalogo(optcatalogo: IOptCatalogo) {
return {}; return {};
@@ -2328,7 +2342,8 @@ export default defineComponent({
myCatalog.value.lista_prodotti.length !== arr.length || myCatalog.value.lista_prodotti.length !== arr.length ||
!myCatalog.value.lista_prodotti.every( !myCatalog.value.lista_prodotti.every(
(prod, index) => prod._id === arr[index]._id (prod, index) => prod._id === arr[index]._id
) || aggiorna ) ||
aggiorna
) { ) {
myCatalog.value.lista_prodotti = [...arr]; myCatalog.value.lista_prodotti = [...arr];
@@ -2430,128 +2445,6 @@ export default defineComponent({
optcatalogo.value.areadistampa!.scalex = 1; optcatalogo.value.areadistampa!.scalex = 1;
optcatalogo.value.areadistampa!.scaley = 1; optcatalogo.value.areadistampa!.scaley = 1;
}; };
async function generateLargePDF(
instampa: boolean,
opt: any,
pagesSelector = '.page',
salvasufiledascaricare: boolean,
dir_out: string,
file_out: string
) {
const pages = document.querySelectorAll(pagesSelector);
const pdfs = [];
const TESTPAO = false;
let primapagina = 0;
let numpagine = pages.length;
if (TESTPAO) {
primapagina = 2;
numpagine = 1;
}
try {
for (let i = primapagina; i < numpagine; i++) {
const page = pages[i];
// Nascondi altre pagine
pages.forEach((p) => p.classList.add('hidden'));
page.classList.remove('hidden');
await new Promise((resolve) => setTimeout(resolve, 100));
// Genera singolo PDF
const pdfBlob = await new Promise<Blob | null>((resolve) => {
html2pdf()
.set(opt)
.from(page)
.toPdf()
.output('blob', { compress: true })
.then(resolve)
.catch(() => resolve(null));
});
if (pdfBlob) {
pdfs.push(pdfBlob);
}
}
// Unisci PDF
const finalPdf = await PDFDocument.create();
for (const blob of pdfs) {
const pdf = await PDFDocument.load(await blob.arrayBuffer());
const copiedPages = await finalPdf.copyPages(pdf, pdf.getPageIndices());
copiedPages.forEach((p) => finalPdf.addPage(p));
}
const finalPdfBytes = await finalPdf.save(); // Uint8Array
// ✅ Conversione in Blob
const blob = new Blob([finalPdfBytes], { type: 'application/pdf' });
// ✅ Download
if (salvasufiledascaricare) {
saveAs(blob, opt.filename);
} else {
// ✅ Crea un oggetto File da Blob
const pdfFile = new File([blob], 'report.pdf', {
type: 'application/pdf',
});
// Converti il file appena generato
const ris = await globalStore.convertPdf(
pdfFile,
salvasufiledascaricare,
widthpdf.value,
heightpdf.value,
optcatalogo.value.areadistampa.compress
? instampa
? compressionepdf.value
: 'printer'
: '',
instampa,
dir_out,
file_out,
true,
optcatalogo.value
);
if (ris) {
const catalog = myCatalog.value;
if (catalog) {
if (instampa) {
catalog.pdf_generato_stampa = ris.fileout;
catalog.pdf_generato_stampa_compressed = ris.fileout_compressed;
catalog.pdf_generato_stampa_size = ris.filesize;
catalog.pdf_generato_stampa_compr_size = ris.filesize_compressed;
catalog.data_generato_stampa = tools.getDateNow();
} else {
catalog.pdf_generato_compressed = ris.fileout_compressed;
catalog.pdf_generato = ris.fileout;
catalog.pdf_generato_size = ris.filesize;
catalog.pdf_generato_compr_size = ris.filesize_compressed;
catalog.data_generato = tools.getDateNow();
}
await saveCatalog();
} else {
strout.value = JSON.stringify(ris, null, 2);
}
}
}
// Ripristina visibilità
pages.forEach((p) => p.classList.remove('hidden'));
} catch (e) {
console.error('Err', e.message);
}
}
// Conversione da unità a pixel, con base 96 DPI // Conversione da unità a pixel, con base 96 DPI
function unitToPx(val: number, unit: string): number { function unitToPx(val: number, unit: string): number {
const dpi = shared_consts.PUNTI_PER_POLLICE; const dpi = shared_consts.PUNTI_PER_POLLICE;
@@ -2645,115 +2538,6 @@ export default defineComponent({
} }
} }
const generatePDF = async () => {
await nextTick();
const instampa = isStampa.value;
const msg = instampa ? 'stampa' : '';
console.log(`1) Generazione PDF ${msg} in corso, attendere ...`);
$q.loading.show({
message: `Generazione PDF ${msg} in corso, attendere ...`,
});
try {
const defaultMargin = 0;
const area = optcatalogo.value.areadistampa!;
const unit = area.unit;
const orientation = area.orientation;
const compress = area.compress;
let originalFormat =
(instampa ? area.format_printable : area.format) || A4_FORMAT_MM;
const scalex = tools.getScaleX(optcatalogo.value, null);
const scaley = tools.getScaleY(optcatalogo.value, null);
const scalecanvas = area.scalecanvas;
const pagina = optcatalogo.value.dimensioni_def.pagina;
// Calcola dimensioni effettive in mm (ajustate)
//const formatWidthMm = tools.pxToMm(pagina.size.width) * scalex * scalecanvas;
//const formatHeightMm = tools.pxToMm(pagina.size.height) * scaley * scalecanvas;
const formatWidthMm = originalFormat[0];
const formatHeightMm = originalFormat[1];
let mioformato = [formatWidthMm * scalex, formatHeightMm * scaley];
// Calcola dimensioni del PDF in pixel
const pdfWidthPx = unitToPx(originalFormat[0], unit);
const pdfHeightPx = unitToPx(originalFormat[1], unit);
// Ottieni contenuto HTML
const element = document.querySelector('.pdf-section');
if (!element) throw new Error('Elemento pdf-content non trovato');
const rect = element.getBoundingClientRect();
const contentWidthPx = rect.width * scalex;
const contentHeightPx = rect.height * scaley;
const scale2 = getBestFitScale(rect.width, rect.height, pdfWidthPx, pdfHeightPx);
// Se formato non valido, fallback ad A4
const myfile = getPdfFilename() + '.pdf';
const opt = {
margin: [defaultMargin, defaultMargin, defaultMargin, defaultMargin],
filename: myfile,
image: {
type: 'jpeg',
quality: 0.98,
},
html2canvas: {
scale: scalecanvas,
useCORS: true,
letterRendering: true,
},
jsPDF: {
unit,
format: mioformato,
orientation,
compress,
},
enableLinks: true,
pagebreak: { mode: 'avoid-all', before: '.card-page' },
};
console.log(
`📐 PDF: ${mioformato[0]} x ${mioformato[1]} mm | scalaX: ${scalex} scalaY: ${scaley}`,
opt
);
await generateLargePDF(
instampa,
opt,
'.pdf-section',
false,
'upload/cataloghi/',
myfile
);
optcatalogo.value.generazionePDFInCorso = false;
optcatalogo.value.areadistampa!.scalex = 1;
optcatalogo.value.areadistampa!.scaley = 1;
$q.loading.hide();
$q.notify({
color: 'positive',
message: 'PDF generato con successo!',
icon: 'check',
});
} catch (error) {
$q.loading.hide();
$q.notify({
color: 'negative',
message: 'Errore nella generazione del PDF',
icon: 'error',
});
console.error('Errore nella generazione del PDF:', error);
}
};
// Default formato A4 in mm // Default formato A4 in mm
const A4_FORMAT_MM = [210, 297]; const A4_FORMAT_MM = [210, 297];
@@ -2991,7 +2775,6 @@ export default defineComponent({
preparePDFStampa, preparePDFStampa,
terminaPDF, terminaPDF,
toggleDebug, toggleDebug,
generatePDF,
getPdfFilename, getPdfFilename,
filtroStrApplicato, filtroStrApplicato,
getCollane, getCollane,

View File

@@ -188,7 +188,10 @@
icon="fas fa-redo" icon="fas fa-redo"
label="Rigenera Lista" label="Rigenera Lista"
color="primary" color="primary"
@click="rigeneraLibri = true; tabgen = 'condizioni'" @click="
rigeneraLibri = true;
tabgen = 'condizioni';
"
></q-btn> ></q-btn>
<!--<q-bcctn <!--<q-bcctn
@@ -301,12 +304,6 @@
:label="`Termina Generazione`" :label="`Termina Generazione`"
@click="terminaPDF" @click="terminaPDF"
></q-btn> ></q-btn>
<q-btn
v-if="optcatalogo.pdf && optcatalogo.generazionePDFInCorso"
:label="`2) Genera PDF ` + getPdfFilename()"
@click="generatePDF()"
color="positive"
></q-btn>
<q-btn <q-btn
v-if="tools.isAdmin() && true" v-if="tools.isAdmin() && true"
label="Debug" label="Debug"
@@ -1285,7 +1282,9 @@
null, null,
optcatalogo.arrSchede[0], optcatalogo.arrSchede[0],
true true
) ) +
' ' +
pageIndex
" "
></div> ></div>
</div> </div>
@@ -1641,7 +1640,6 @@
:dense="false" :dense="false"
> >
</CMyValueDb> </CMyValueDb>
</div> </div>
<CMyValueDb <CMyValueDb
@@ -1710,20 +1708,18 @@
@click="rigeneraLibri = false" @click="rigeneraLibri = false"
></q-btn> ></q-btn>
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="generato"> <q-tab-panel name="generato">
<CProductTable <CProductTable
v-if="arrListaTemporanea?.length > 0" v-if="arrListaTemporanea?.length > 0"
:lista_prodotti="arrListaTemporanea" :lista_prodotti="arrListaTemporanea"
:options="{ showbuttAdd: true }"
:optcatalogo="optcatalogo" :optcatalogo="optcatalogo"
table="products" table="products"
@rigenera="generaListaLibri()" @rigenera="generaListaLibri()"
@addtolist="(elem) => addProductToList(elem, shared_consts.WHERE_INSERT.ONTOP)"
/> />
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</CMyDialog> </CMyDialog>

View File

@@ -22,7 +22,6 @@ import { CContainerCatalogoCard } from '@src/components/CContainerCatalogoCard';
import { CSelectUserActive } from '@src/components/CSelectUserActive'; import { CSelectUserActive } from '@src/components/CSelectUserActive';
import html2pdf from 'html2pdf.js'; import html2pdf from 'html2pdf.js';
import { PDFDocument } from 'pdf-lib';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
import type { import type {

3649
yarn.lock

File diff suppressed because it is too large Load Diff