diff --git a/public/upload/catalogo/PrimaPagina.png b/public/upload/catalogo/PrimaPagina.png new file mode 100644 index 0000000..882628a Binary files /dev/null and b/public/upload/catalogo/PrimaPagina.png differ diff --git a/public/upload/imgs/background_stampa.jpg b/public/upload/imgs/background_stampa.jpg new file mode 100644 index 0000000..7247483 Binary files /dev/null and b/public/upload/imgs/background_stampa.jpg differ diff --git a/src/server/models/myelem.js b/src/server/models/myelem.js index 8e635d8..3810bc2 100755 --- a/src/server/models/myelem.js +++ b/src/server/models/myelem.js @@ -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, diff --git a/src/server/models/myscheda.js b/src/server/models/myscheda.js index 943c0bb..a3a888e 100755 --- a/src/server/models/myscheda.js +++ b/src/server/models/myscheda.js @@ -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 }; diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js index 2b5aa60..59d4ea5 100755 --- a/src/server/router/index_router.js +++ b/src/server/router/index_router.js @@ -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 {