- Impostato i Font giusti e la corretta disposizione del testo e dei suoi margini.
- L'immagine del libro, se è piccolo, viene adattato alla dimensione fissa (vedere se va bene).
This commit is contained in:
@@ -334,6 +334,37 @@ MyElemSchema.statics.findAllIdApp = async function (idapp) {
|
||||
return await MyElem.find(myfind).sort({ order: 1 });
|
||||
};
|
||||
|
||||
MyElemSchema.statics.findallSchedeTemplate = async function (idapp) {
|
||||
const MyElem = this;
|
||||
|
||||
try {
|
||||
|
||||
const ris = await MyElem.find({ idapp });
|
||||
|
||||
// Estrai le schede che hanno isTemplate = true
|
||||
const schedeTemplate = ris.flatMap(elem =>
|
||||
elem.catalogo && elem.catalogo.arrSchede ? elem.catalogo.arrSchede.filter(scheda => scheda.scheda.isTemplate) : []
|
||||
);
|
||||
|
||||
/*
|
||||
// Trova tutti i documenti in cui idapp corrisponde e contiene schede con isTemplate = true
|
||||
const ris = await MyElem.find(
|
||||
{ idapp },
|
||||
{ 'catalogo.arrSchede': { $elemMatch: { isTemplate: true } } }
|
||||
).populate('catalogo.arrSchede');
|
||||
|
||||
// Estrai solo le schede che hanno isTemplate = true
|
||||
const schedeTemplate = ris.flatMap(elem =>
|
||||
elem.catalogo.arrSchede.filter(scheda => scheda.isTemplate)
|
||||
);
|
||||
*/
|
||||
|
||||
return schedeTemplate;
|
||||
} catch (e) {
|
||||
console.error('Err', e);
|
||||
}
|
||||
};
|
||||
|
||||
const MyElem = mongoose.model('MyElem', MyElemSchema);
|
||||
|
||||
MyElem.createIndexes((err) => {
|
||||
|
||||
@@ -17,6 +17,7 @@ const ISize = new Schema({
|
||||
width: { type: String },
|
||||
height: { type: String },
|
||||
fit: { type: String },
|
||||
gap: { type: String },
|
||||
});
|
||||
const IFont = new Schema({
|
||||
name: { type: String },
|
||||
@@ -66,6 +67,7 @@ const IBarCode = new Schema(
|
||||
format: Number,
|
||||
size: ISize,
|
||||
font: IFont,
|
||||
widthlines: Number,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ const { Contribtype } = require('../models/contribtype');
|
||||
const { PaymentType } = require('../models/paymenttype');
|
||||
const { Discipline } = require('../models/discipline');
|
||||
const { MyElem } = require('../models/myelem');
|
||||
const { MySCheda } = require('../models/myscheda');
|
||||
const { Skill } = require('../models/skill');
|
||||
const { Good } = require('../models/good');
|
||||
const { StatusSkill } = require('../models/statusSkill');
|
||||
@@ -1543,6 +1542,7 @@ function load(req, res, version) {
|
||||
const paymenttype = PaymentType.findAllIdApp(idapp);
|
||||
const disciplines = Discipline.findAllIdApp(idapp);
|
||||
const myelems = MyElem.findAllIdApp(idapp);
|
||||
const myschedas = MyElem.findallSchedeTemplate(idapp);
|
||||
const settings = Settings.findAllIdApp(idapp, false, false);
|
||||
|
||||
const permissions = Permission.findAllIdApp();
|
||||
@@ -1684,6 +1684,7 @@ function load(req, res, version) {
|
||||
catAI,
|
||||
authors,
|
||||
publishers,
|
||||
myschedas,
|
||||
]).then((arrdata) => {
|
||||
// console.table(arrdata);
|
||||
let myuser = req.user;
|
||||
@@ -1778,6 +1779,7 @@ function load(req, res, version) {
|
||||
code: req.code,
|
||||
authors: arrdata[49],
|
||||
publishers: arrdata[50],
|
||||
myschedas: arrdata[51],
|
||||
});
|
||||
|
||||
const prova = 1;
|
||||
|
||||
Reference in New Issue
Block a user