- Cataloghi: qualita di stampa e margini

This commit is contained in:
Surya Paolo
2024-11-22 20:23:31 +01:00
parent b1b952d120
commit 479934a8fb
5 changed files with 31 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

View File

@@ -4,7 +4,7 @@ const Schema = mongoose.Schema;
const tools = require('../tools/general');
const { ObjectID, ObjectId } = require('mongodb');
const { MySchedaSchema, IDimensioni, IImg } = require('../models/myscheda');
const { MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa } = require('../models/myscheda');
mongoose.Promise = global.Promise;
mongoose.level = "F";
@@ -63,16 +63,9 @@ const catalogo = new Schema(
pdf_filename: { type: String },
printable: { type: Boolean },
first_page_img: { type: String },
first_page_html: { type: String },
first_page_width: { type: Number },
first_page_height: { type: Number },
last_page_img: { type: String },
last_page_html: { type: String },
last_page_height: { type: Number },
last_page_width: { type: Number },
imgsfondo_def: IImg,
first_page: IDimensioni,
last_page: IDimensioni,
areadistampa: IAreaDiStampa,
dimensioni_def: IElementiPagina,

View File

@@ -34,27 +34,40 @@ const IImg = new Schema({
fit: { type: String },
})
const IText = new Schema(
{
contenuto: String,
maxlength: Number,
font: IFont,
}
);
const IDimensioni = new Schema({
size: ISize,
margini: IBorders,
padding: IBorders,
imgsfondo: IImg,
text_html: IText,
});
const IAreaDiStampa = new Schema({
margini: IBorders,
unit: String,
format: [{ type: Number }],
orientation: String,
compress: Boolean,
scale: Number,
scalecanvas: Number,
});
const IBarCode = new Schema(
{
show: Boolean,
format: String,
format: Number,
size: ISize,
font: IFont,
}
);
const IText = new Schema(
{
contenuto: String,
maxlength: Number,
}
);
const IElementiScheda = new Schema({
pagina: IDimensioni,
@@ -70,6 +83,7 @@ const scheletroScheda = {
line_height: { type: Number },
numschede_perRiga: { type: Number },
numschede_perCol: { type: Number },
show_separatore: { type: Boolean },
testo_right: IText,
testo_bottom: IText,
posiz_text: { type: Number },
@@ -113,4 +127,4 @@ MyScheda.createIndexes((err) => {
if (err) throw err;
});
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg };
module.exports = { MyScheda, MySchedaSchema, IDimensioni, IImg, IText, IAreaDiStampa };

View File

@@ -827,7 +827,7 @@ router.post('/getpage', async (req, res) => {
});
async function duplicatePage(pageId) {
async function duplicatePage(pageId, newpath) {
try {
// Trova il record di Page da duplicare
const pageToDuplicate = await MyPage.findById(pageId);
@@ -841,8 +841,8 @@ async function duplicatePage(pageId) {
...pageToDuplicate.toObject(), // Converte il documento Moongose in oggetto
_id: new mongoose.Types.ObjectId(), // Genera un nuovo ID
// modifiche ai campi se necessario, per esempio:
path: `${pageToDuplicate.path}-copia`, // Modifica il campo path per identificare la copia
title: `${pageToDuplicate.title}-copia`, // Modifica il campo path per identificare la copia
path: newpath,
title: newpath,
date_updated: new Date()
});
@@ -878,12 +878,13 @@ router.post('/duppage', async (req, res) => {
const params = req.body;
const idapp = req.body.idapp;
const mypath = params.path;
const newpath = params.newpath;
try {
let found = await MyPage.findOne({ idapp, path: mypath })
.then(async (ris) => {
const result = await duplicatePage(ris._id);
const result = await duplicatePage(ris._id, newpath);
if (result) {
return res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
} else {