11 Commits

Author SHA1 Message Date
Surya Paolo
8e42baf79e bottoni fiducia 2023-11-30 19:50:12 +01:00
Surya Paolo
e3ed2934ee Struttura Scheda Prodotti... 2023-11-30 14:27:37 +01:00
Surya Paolo
e895e7dae2 ignore 2023-11-30 01:49:51 +01:00
Surya Paolo
4a408b4ebd Riso: Ris Italia, altre modifiche grafiche
Lista Utenti da Verificare
2023-11-30 01:49:17 +01:00
Surya Paolo
0e3ba5ff87 agg 2023-11-28 15:04:17 +01:00
Surya Paolo
a66cd610dd Develop PDB 1 2023-11-28 14:20:22 +01:00
Surya Paolo
5aa6accfc5 Merge branch 'develop' of ssh://risosrv:5522/~/repository/freeplanet_serverside into develop 2023-11-27 16:42:52 +01:00
Surya Paolo
35178684af aaa 2023-11-27 16:42:44 +01:00
Surya Paolo
bba0df4302 aa 2023-11-27 14:43:13 +01:00
Surya Paolo
f1954d98d6 Merge branch 'develop' of ssh://risosrv:5522/~/repository/freeplanet_serverside into develop 2023-11-27 11:16:13 +01:00
Surya Paolo
34b00bdf98 ds 2023-11-27 11:16:09 +01:00
17 changed files with 336 additions and 140 deletions

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored
View File

@@ -28,3 +28,5 @@ src/server/.DS_Store
emails/.DS_Store emails/.DS_Store
.DS_Store .DS_Store
.DS_Store .DS_Store
.DS_Store
logtrans.txt

View File

@@ -97,3 +97,23 @@ Gio 12/10 ORE 08:06: [<b>Circuito RIS Rimini</b>]: Inviate Monete da paoloar77 a
Saldi: Saldi:
paoloar77: -18 RIS] paoloar77: -18 RIS]
SuryaArena2: 7 RIS] SuryaArena2: 7 RIS]
Mer 29/11 ORE 16:35: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 5 RIS [causale: Seconda]
Saldi:
SuryaArena: -5 RIS]
paoloar77: 5 RIS]
Mer 29/11 ORE 16:44: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 3 RIS [causale: Eccolo]
Saldi:
SuryaArena: -8 RIS]
paoloar77: 8 RIS]
Mer 29/11 ORE 16:50: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 3 RIS [causale: Ricevuto un bel massaggio]
Saldi:
SuryaArena: -11 RIS]
paoloar77: 11 RIS]
Mer 29/11 ORE 16:52: [<b>Circuito RIS Bologna</b>]: Inviate Monete da SuryaArena a paoloar77 4 RIS [causale: Un bel massaggio con olio caldo]
Saldi:
SuryaArena: -4 RIS]
paoloar77: 14 RIS]
Mer 29/11 ORE 17:14: [<b>Circuito RIS Italia</b>]: Inviate Monete da SuryaArena a paoloar77 2 RIS [causale: Massaggio !]
Saldi:
SuryaArena: -13 RIS]
paoloar77: 13 RIS]

View File

@@ -5,6 +5,9 @@
}, },
{ {
"path": "../../../newfreeplanet" "path": "../../../newfreeplanet"
},
{
"path": "../../../cnm"
} }
], ],
"settings": { "settings": {

View File

@@ -72,7 +72,7 @@
"CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal '%s'", "CIRCUIT_EXIT_USER": "❌ l'utente %s è uscito dal '%s'",
"CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal '%s'", "CIRCUIT_EXIT_USER_TO_ME": "❌ Sei uscito dal '%s'",
"CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal '%s' (da parte di %s)", "CIRCUIT_REMOVED_TO_ME": "❌ Sei stato rimosso dal '%s' (da parte di %s)",
"CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong> sul '%s'.", "CIRCUIT_SENDCOINSREQ": "%s ti sta inviando <strong>%s %s</strong> sul <strong>'%s'</strong>",
"COMUNITARIO": "Comunitario", "COMUNITARIO": "Comunitario",
"COLLETTIVO": "Gruppo", "COLLETTIVO": "Gruppo",
"CIRCUIT_SENDCOINSREQ_GROUP": "%s sta inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.", "CIRCUIT_SENDCOINSREQ_GROUP": "%s sta inviando <strong>%s %s</strong> al Conto %s '%s' sul '%s'.",
@@ -107,5 +107,11 @@
"DATEDAYONLY": "%s dalle %s alle %s", "DATEDAYONLY": "%s dalle %s alle %s",
"DATE_2DAYS": "%s dalle %s fino a %s alle %s", "DATE_2DAYS": "%s dalle %s fino a %s alle %s",
"SENDMSG_ENTRA_IN_RISO_ITALIA": "Ciao %s!<br>%s che appartiene al <em>%s</em> vuole inviarti dei RIS. Per poterli ricevere dovete entrambi utilizzare il <strong>Circuito RIS Italia</strong>.", "SENDMSG_ENTRA_IN_RISO_ITALIA": "Ciao %s!<br>%s che appartiene al <em>%s</em> vuole inviarti dei RIS. Per poterli ricevere dovete entrambi utilizzare il <strong>Circuito RIS Italia</strong>.",
"CLICCA_QUI": "CLICCA QUI" "CLICCA_QUI": "CLICCA QUI",
"✅ %s è stato Abilitato correttamente (da %s)!": "✅ %s è stato Abilitato correttamente (da %s)!",
"✅ Sei stato Abilitato correttamente da %s!": "✅ Sei stato Abilitato correttamente da %s!",
"🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!": "🚫 Hai rifiutato l'accesso alla App di RISO da parte di %s!",
"🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.": "🚫 Ti è stato rifiutato l'accesso. Probabilmente l'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l'Assistenza Tecnica.",
"🚫 %s ha rifiutato l'accesso alla App a %s !": "🚫 %s ha rifiutato l'accesso alla App a %s !",
"✅ Hai Abilitato l'accesso alla App a %s !": "✅ Hai Abilitato l'accesso alla App a %s !"
} }

View File

@@ -9,16 +9,16 @@ const CartSchema = new Schema({
idapp: { idapp: {
type: String, type: String,
}, },
userId: {type: Schema.Types.ObjectId, ref: 'User'}, userId: { type: Schema.Types.ObjectId, ref: 'User' },
totalQty: {type: Number, default: 0}, totalQty: { type: Number, default: 0 },
totalPrice: {type: Number, default: 0}, totalPrice: { type: Number, default: 0 },
department: { department: {
type: String, ref: 'Department', type: String, ref: 'Department',
}, },
items: [ items: [
{ {
order: order:
{type: Schema.Types.ObjectId, ref: 'Order'}, { type: Schema.Types.ObjectId, ref: 'Order' },
}, },
], ],
note: { note: {
@@ -31,14 +31,15 @@ const CartSchema = new Schema({
var Cart = module.exports = mongoose.model('Cart', CartSchema); var Cart = module.exports = mongoose.model('Cart', CartSchema);
module.exports.findAllIdApp = async function(idapp, userId) { module.exports.findAllIdApp = async function (idapp, userId) {
const myfind = {idapp, userId}; const myfind = { idapp, userId };
return await Cart.findOne(myfind).lean(); return await Cart.findOne(myfind).lean();
}; };
module.exports.getCartByUserId = async function(uid, idapp) { module.exports.getCartByUserId = async function (uid, idapp) {
let query = {userId: uid, idapp}; try {
let query = { userId: uid, idapp };
const mycart = await Cart.findOne(query).lean(); const mycart = await Cart.findOne(query).lean();
if (!!mycart) { if (!!mycart) {
@@ -60,18 +61,21 @@ module.exports.getCartByUserId = async function(uid, idapp) {
return mycart; return mycart;
} }
return null; return null;
} catch (e) {
console.log('getCartByUserId err', e);
}
}; };
module.exports.updateCartByUserId = function(userId, newCart, callback) { module.exports.updateCartByUserId = function (userId, newCart, callback) {
let query = {userId: userId}; let query = { userId: userId };
Cart.find(query, function(err, c) { Cart.find(query, function (err, c) {
if (err) throw err; if (err) throw err;
//exist cart in databse //exist cart in databse
if (c.length > 0) { if (c.length > 0) {
Cart.findOneAndUpdate( Cart.findOneAndUpdate(
{userId: userId}, { userId: userId },
{ {
$set: { $set: {
items: newCart.items, items: newCart.items,
@@ -80,7 +84,7 @@ module.exports.updateCartByUserId = function(userId, newCart, callback) {
userId: userId, userId: userId,
}, },
}, },
{new: true}, { new: true },
callback, callback,
); );
} else { } else {
@@ -90,7 +94,7 @@ module.exports.updateCartByUserId = function(userId, newCart, callback) {
}); });
}; };
module.exports.updateCartByCartId = async function(cartId, newCart) { module.exports.updateCartByCartId = async function (cartId, newCart) {
// delete newCart._doc._id; // delete newCart._doc._id;
const items = newCart.items; const items = newCart.items;
const totalQty = newCart.totalQty; const totalQty = newCart.totalQty;
@@ -98,14 +102,14 @@ module.exports.updateCartByCartId = async function(cartId, newCart) {
const modify_at = new Date(); const modify_at = new Date();
return await Cart.findOneAndUpdate({_id: cartId}, { return await Cart.findOneAndUpdate({ _id: cartId }, {
$set: { $set: {
items, items,
totalPrice, totalPrice,
totalQty, totalQty,
modify_at, modify_at,
}, },
}, {new: false}).lean().then((ris) => { }, { new: false }).lean().then((ris) => {
return ris; return ris;
}).catch(err => { }).catch(err => {
console.log('err', err); console.log('err', err);
@@ -114,11 +118,11 @@ module.exports.updateCartByCartId = async function(cartId, newCart) {
}; };
module.exports.deleteCartByCartId = async function(cartId) { module.exports.deleteCartByCartId = async function (cartId) {
return await Cart.remove({_id: cartId}); return await Cart.remove({ _id: cartId });
}; };
module.exports.createCart = async function(newCart) { module.exports.createCart = async function (newCart) {
return await newCart.save(); return await newCart.save();
}; };

View File

@@ -1,9 +1,11 @@
const mongoose = require('mongoose').set('debug', false) const mongoose = require('mongoose').set('debug', false)
const Schema = mongoose.Schema; const Schema = mongoose.Schema;
mongoose.Promise = global.Promise; mongoose.Promise = global.Promise;
mongoose.level = "F"; mongoose.level = "F";
const tools = require('../tools/general');
// Resolving error Unknown modifier: $pushAll // Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => { mongoose.plugin(schema => {
@@ -11,20 +13,41 @@ mongoose.plugin(schema => {
}); });
const CategorySchema = new Schema({ const CategorySchema = new Schema({
idapp: {
type: String,
},
name: { name: {
type: String, type: String,
unique: true, unique: true,
index: true, index: true,
lowercase: true },
} img: {
type: String,
},
}); });
module.exports.getAllCategories = function (callback) { CategorySchema.statics.getAllCategories = function (callback) {
Category.find(callback) Category.find(callback)
} }
module.exports.getCategoryById = function (id, callback) { CategorySchema.statics.getCategoryById = function (id, callback) {
Category.findById(id, callback); Category.findById(id, callback);
} }
module.exports = mongoose.model('Category', CategorySchema); CategorySchema.statics.getFieldsForSearch = function () {
return [{ field: 'name', type: tools.FieldType.string }]
};
CategorySchema.statics.executeQueryTable = function (idapp, params) {
return tools.executeQueryTable(this, idapp, params);
};
CategorySchema.statics.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Category.find(myfind);
};
const Category = mongoose.model('Category', CategorySchema);
module.exports = { Category };

View File

@@ -51,6 +51,9 @@ const orderSchema = new Schema({
weight: { weight: {
type: Number type: Number
}, },
unit: {
type: Number
},
stars: { stars: {
type: Number type: Number
}, },

View File

@@ -27,7 +27,6 @@ const productSchema = new Schema({
], ],
code: { code: {
type: String, type: String,
lowercase: true
}, },
name: { name: {
type: String, type: String,
@@ -39,8 +38,13 @@ const productSchema = new Schema({
type: String, ref: 'Department' type: String, ref: 'Department'
}, },
category: { category: {
type: String, ref: 'Category' type: Array,
// type: String },
prezzo_ivato: { // Con IVA
type: Number
},
perc_iva: { // 4, 10, 22 &
type: Number
}, },
price: { price: {
type: Number type: Number
@@ -57,6 +61,9 @@ const productSchema = new Schema({
weight: { weight: {
type: Number type: Number
}, },
unit: {
type: Number
},
quantityAvailable: { quantityAvailable: {
type: Number type: Number
}, },
@@ -183,6 +190,9 @@ module.exports.getProductByID = function (id, callback) {
Product.findById(id, callback); Product.findById(id, callback);
} }
// const Product = mongoose.model('Product', ProductSchema); // const Product = mongoose.model('Product', ProductSchema);
// module.exports = { Product }; // module.exports = { Product };
// PROVA

View File

@@ -1011,7 +1011,6 @@ sendNotifSchema.statics.sendToTheDestinations = async function (myrecnotifpass,
arrcircuits.push(await City.getCircuitNameBystrProv(prov)); arrcircuits.push(await City.getCircuitNameBystrProv(prov));
} }
if (myrecnotifpass.tablerec === shared_consts.TABLES_MYGOODS) { if (myrecnotifpass.tablerec === shared_consts.TABLES_MYGOODS) {
idSector = myrectableorig.idSectorGood; idSector = myrectableorig.idSectorGood;
} else { } else {

View File

@@ -4,6 +4,7 @@ const validator = require('validator');
const jwt = require('jsonwebtoken'); const jwt = require('jsonwebtoken');
const _ = require('lodash'); const _ = require('lodash');
const printf = require('util').format;
const tools = require('../tools/general'); const tools = require('../tools/general');
const { Settings } = require('../models/settings'); const { Settings } = require('../models/settings');
@@ -2057,21 +2058,55 @@ UserSchema.statics.setFriendsCmd = async function (req, idapp, usernameOrig, use
req = tools.getReqByPar(idapp, usernameOrig); req = tools.getReqByPar(idapp, usernameOrig);
} }
let userDest = null;
if (usernameDest)
userDest = await User.getUserShortDataByUsername(idapp, usernameDest);
const username_action = req.user.username; const username_action = req.user.username;
let username_worked = usernameDest; let username_worked = usernameDest;
let ris = null; let ris = null;
let lang = '';
let user = null;
if (usernameOrig) {
user = await User.getUserShortDataByUsername(idapp, usernameOrig);
}
lang = user ? user.lang : '';
let update = {}; let update = {};
try { try {
if (cmd === shared_consts.FRIENDSCMD.SETTRUST) { if (cmd === shared_consts.FRIENDSCMD.SETTRUST) {
let msgOrig = '';
let msgDest = '';
// Aggiorna true se lo accetti e false se non lo accetti
const ris = await User.updateOne({ idapp, username: usernameDest },
{ $set: { verified_by_aportador: value, trust_modified: new Date() } },
{ new: false });
if (value) {
// Aggiungi alle amicizie // Aggiungi alle amicizie
await this.setFriendsCmd(req, idapp, usernameOrig, usernameDest, await this.setFriendsCmd(req, idapp, usernameOrig, usernameDest,
shared_consts.FRIENDSCMD.SETFRIEND, value); shared_consts.FRIENDSCMD.SETFRIEND, value);
return await User.updateOne({ idapp, username: usernameDest }, msgOrig = i18n.__({ phrase: '✅ Hai Abilitato l\'accesso alla App a %s !', locale: userDest.lang }, userDest.username);
{ $set: { verified_by_aportador: value, trust_modified: new Date() } }, msgDest = i18n.__({ phrase: '✅ Sei stato Abilitato correttamente da %s!', locale: lang }, usernameOrig);
{ new: false }); msgAdmin = i18n.__({ phrase: '✅ %s è stato Abilitato correttamente (da %s)!', locale: userDest.lang }, userDest.username, usernameOrig);
} else {
msgOrig = i18n.__({ phrase: '🚫 Hai rifiutato l\'accesso alla App di RISO da parte di %s!', locale: userDest.lang }, userDest.username);
msgDest = i18n.__({ phrase: '🚫 Ti è stato rifiutato l\'accesso. Probabilmente l\'username con cui ti sei registrato non ti conosce. (%s) !<br>Contatta l\'Assistenza Tecnica.', locale: lang }, usernameOrig);
msgAdmin = i18n.__({ phrase: '🚫 %s ha rifiutato l\'accesso alla App a %s !', locale: userDest.lang }, usernameOrig, userDest.username);
}
await telegrambot.sendMsgTelegram(idapp, usernameOrig, msgOrig);
await telegrambot.sendMsgTelegram(idapp, userDest.username, msgDest);
// Invia questo msg anche all'Admin
await telegrambot.sendMsgTelegramToTheAdmin(idapp, msgAdmin, true);
// telegrambot.askConfirmationUser(user.idapp, shared_consts.CallFunz.REGISTRATION, user, '', '', '', '');
return ris;
} else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) { } else if (cmd === shared_consts.FRIENDSCMD.SETFRIEND) {
// Aggiungo l'Amicizia a me // Aggiungo l'Amicizia a me
@@ -3125,6 +3160,20 @@ UserSchema.statics.getAskedFriendsByUsername = async function (idapp, username)
}; };
UserSchema.statics.getUsersToVerify = async function (idapp, username) {
const whatToShow_Unknown = getWhatToShow(idapp, username);
let usersToVerify = await User.find({
idapp, aportador_solidario: username,
verified_by_aportador: { $exists: false },
$or: [
{ deleted: { $exists: false } },
{ deleted: { $exists: true, $eq: false } }],
}, whatToShow_Unknown).lean();
return usersToVerify;
};
UserSchema.statics.getFriendsByUsername = async function (idapp, username) { UserSchema.statics.getFriendsByUsername = async function (idapp, username) {
if (!username) { if (!username) {
@@ -4076,7 +4125,7 @@ UserSchema.statics.getUsersDreams = async function (idapp) {
UserSchema.statics.getLastUsers = async function (idapp) { UserSchema.statics.getLastUsers = async function (idapp) {
const User = this; const User = this;
const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_USERS', 10); const lastn = await Settings.getValDbSettings(idapp, 'SHOW_LAST_N_USERS', 20);
return await User.find( return await User.find(
{ {
@@ -4090,6 +4139,7 @@ UserSchema.statics.getLastUsers = async function (idapp) {
name: 1, name: 1,
surname: 1, surname: 1,
lasttimeonline: 1, lasttimeonline: 1,
verified_by_aportador: 1,
'profile.img': 1, 'profile.img': 1,
date_reg: 1, date_reg: 1,
index: 1, index: 1,
@@ -5024,6 +5074,8 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
recUser.profile.reaction = await Reaction.find({ idapp, username: recUser.username }).lean(); recUser.profile.reaction = await Reaction.find({ idapp, username: recUser.username }).lean();
recUser.profile.userstoverify = await User.getUsersToVerify(idapp, recUser.username);
recUser.profile.manage_mygroups = listManageGroups recUser.profile.manage_mygroups = listManageGroups
? listManageGroups ? listManageGroups
: []; : [];

View File

@@ -30,17 +30,20 @@ const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart'); const OrdersCart = require('../models/orderscart');
//GET cart //GET cart
router.get('/:userId', authenticate, function (req, res, next) { router.get('/:userId', authenticate, async function (req, res, next) {
let userId = req.body.userId let userId = req.params.userId
let idapp = req.body.idapp let idapp = req.user.idapp
Cart.getCartByUserId(userId, idapp, function (err, cart) { return await Cart.getCartByUserId(userId, idapp)
if (err) return next(err) .then((cart) => {
if (cart) if (cart)
res.send({ code: server_constants.RIS_CODE_OK, cart }); return res.send({ code: server_constants.RIS_CODE_OK, cart });
else else
res.status(400).send(e); return res.status(400).send(e);
}) }).catch((err) => {
console.error('Err', err);
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null });
});
}) })
//POST cart //POST cart
@@ -51,6 +54,8 @@ router.post('/:userId', authenticate, async function (req, res, next) {
let subqty = req.body.subqty; let subqty = req.body.subqty;
let order = req.body.order; let order = req.body.order;
try {
const mycart = await Cart.getCartByUserId(userId, idapp); const mycart = await Cart.getCartByUserId(userId, idapp);
// const myorder = Order.getOrderByID(order._id); // const myorder = Order.getOrderByID(order._id);
@@ -91,6 +96,12 @@ router.post('/:userId', authenticate, async function (req, res, next) {
}) })
*/ */
} catch (e) {
return res.send({ code: server_constants.RIS_CODE_ERR, cart: 0 });
}
}) })
router.delete('/:userId', authenticate, async function (req, res) { router.delete('/:userId', authenticate, async function (req, res) {
@@ -122,14 +133,17 @@ router.delete('/:userId', authenticate, async function (req, res) {
//PUT cart //PUT cart
router.put('/:userId', authenticate, function (req, res, next) { router.put('/:userId', authenticate, async function (req, res, next) {
let userId = req.params.userId let userId = req.params.userId
let requestProduct = req.body let requestProduct = req.body
let { productId, color, size } = requestProduct.product let { productId, color, size } = requestProduct.product
Cart.getCartByUserId(userId, function (err, c) { try {
await Cart.getCartByUserId(userId, function (err, c) {
if (err) return next(err) if (err) return next(err)
let oldCart = new CartClass(c[0] || {}) let oldCart = new CartClass(c[0] || {})
Product.getProductByID(productId, function (err, p) { Product.getProductByID(productId, function (err, p) {
if (err) return next(err) if (err) return next(err)
let newCart = oldCart.add(p, productId, { color, size }) let newCart = oldCart.add(p, productId, { color, size })
@@ -163,6 +177,12 @@ router.put('/:userId', authenticate, function (req, res, next) {
} }
}) })
}) })
return res.send({ code: server_constants.RIS_CODE_OK });
} catch (e) {
return res.send({ code: server_constants.RIS_CODE_ERR, status: 0 });
}
}) })
//POST cart //POST cart

View File

@@ -66,6 +66,7 @@ const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart'); const OrdersCart = require('../models/orderscart');
const Storehouse = require('../models/storehouse'); const Storehouse = require('../models/storehouse');
const Department = require('../models/department'); const Department = require('../models/department');
const { Category } = require('../models/category');
const Group = require('../models/group'); const Group = require('../models/group');
const tools = require('../tools/general'); const tools = require('../tools/general');
@@ -373,6 +374,7 @@ router.post('/settable', authenticate, async (req, res) => {
if ((mydata['_id'] === undefined || mydata['_id'] === '' || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined || mytablerec._id === '0')) { if ((mydata['_id'] === undefined || mydata['_id'] === '' || (mytablerec.isNew && mydata['_id'] === 0)) && (mytablerec._id === undefined || mytablerec._id === '0')) {
mytablerec._id = new ObjectID(); mytablerec._id = new ObjectID();
mydata._id = new ObjectID(); mydata._id = new ObjectID();
mytablerec.isNew = true;
} }
} }
@@ -1403,6 +1405,7 @@ function load(req, res, version) {
let workers = User.getusersWorkersList(idapp); let workers = User.getusersWorkersList(idapp);
let storehouses = Storehouse.findAllIdApp(idapp); let storehouses = Storehouse.findAllIdApp(idapp);
let departments = Department.findAllIdApp(idapp); let departments = Department.findAllIdApp(idapp);
let categories = Category.findAllIdApp(idapp);
// SKILLS: // SKILLS:
let levels = Level.findAllIdApp(idapp); let levels = Level.findAllIdApp(idapp);
@@ -1486,6 +1489,7 @@ function load(req, res, version) {
mygroups, mygroups,
listcircuits, // 37 listcircuits, // 37
myelems, // 38 myelems, // 38
categories, // 39
]).then((arrdata) => { ]).then((arrdata) => {
// console.table(arrdata); // console.table(arrdata);
let myuser = req.user; let myuser = req.user;
@@ -1567,7 +1571,10 @@ function load(req, res, version) {
mygroups: arrdata[36], mygroups: arrdata[36],
listcircuits: arrdata[37], listcircuits: arrdata[37],
myelems: arrdata[38], myelems: arrdata[38],
categories: arrdata[39],
}); });
const prova = 1;
} }
}).catch((e) => { }).catch((e) => {

View File

@@ -27,6 +27,8 @@ const shared_consts = require('./tools/shared_nodejs');
const {User} = require('./models/user'); const {User} = require('./models/user');
const { MsgTemplate } = require('./models/msg_template');
const transport_preview = nodemailer.createTransport({ const transport_preview = nodemailer.createTransport({
jsonTransport: true, jsonTransport: true,
}); });
@@ -168,6 +170,9 @@ module.exports = {
// console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp)); // console.log('idapp', idapp, tools.getNomeAppByIdApp(idapp));
// ++ estrai l'html da mettere sulla email:
// const msghtml = await MsgTemplate.getMsgByLang(idapp, user, shared_consts.TypeMsgTemplate.MSG_BENV_REGISTRATO, user.lang);
let mylocalsconf = { let mylocalsconf = {
idapp, idapp,
dataemail: await this.getdataemail(idapp), dataemail: await this.getdataemail(idapp),

View File

@@ -893,6 +893,8 @@ const MyTelegramBot = {
}, */ }, */
]); ]);
} }
send_notif = true;
} else if (myfunc === shared_consts.CallFunz.RICHIESTA_GRUPPO) { } else if (myfunc === shared_consts.CallFunz.RICHIESTA_GRUPPO) {
domanda = printf(getstr(langdest, 'MSG_ACCEPT_NEWENTRY_INGROUP'), name) + '<br>' + struserinfomsg; domanda = printf(getstr(langdest, 'MSG_ACCEPT_NEWENTRY_INGROUP'), name) + '<br>' + struserinfomsg;
@@ -924,6 +926,8 @@ const MyTelegramBot = {
groupid + tools.SEP + groupname, groupid + tools.SEP + groupname,
},*/ },*/
]); ]);
send_notif = true;
} else { } else {
domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name) + '<br>' + struserinfomsg; domanda = i18n.__({ phrase: 'CIRCUIT_ACCEPT_NEWENTRY', locale: langdest }, myuser.username, name) + '<br>' + struserinfomsg;
@@ -939,6 +943,7 @@ const MyTelegramBot = {
groupid, groupid,
}, */ }, */
]); ]);
send_notif = true;
} }
} }

View File

@@ -61,6 +61,7 @@ const Cart = require('../models/cart');
const OrdersCart = require('../models/orderscart'); const OrdersCart = require('../models/orderscart');
const Storehouse = require('../models/storehouse'); const Storehouse = require('../models/storehouse');
const Department = require('../models/department'); const Department = require('../models/department');
const { Category } = require('../models/category');
const ShareWithUs = require('../models/sharewithus'); const ShareWithUs = require('../models/sharewithus');
const Site = require('../models/site'); const Site = require('../models/site');
const IscrittiConacreis = require('../models/iscrittiConacreis'); const IscrittiConacreis = require('../models/iscrittiConacreis');
@@ -105,6 +106,8 @@ module.exports = {
mytable = Storehouse; mytable = Storehouse;
else if (tablename === 'departments') else if (tablename === 'departments')
mytable = Department; mytable = Department;
else if (tablename === 'categorys')
mytable = Category;
else if (tablename === 'sharewithus') else if (tablename === 'sharewithus')
mytable = ShareWithUs; mytable = ShareWithUs;
else if (tablename === 'sites') else if (tablename === 'sites')

View File

@@ -326,6 +326,38 @@ module.exports = {
OPZ1_2: 2, OPZ1_2: 2,
}, },
UNITS_OF_MEASURE: {
NESSUNO: 0,
GRAMMI: 1,
CHILI: 2,
LITRI: 3,
PEZZI: 4,
},
Units_Of_Measure_ListBox: [
{
label: '[Nessuno]',
value: 0,
},
{
label: 'Grammi (g)',
value: 1,
},
{
label: 'Chili (kg)',
value: 2,
},
{
label: 'Litri (l)',
value: 3,
},
{
label: 'Pezzi (p)',
value: 4,
},
],
CallFunz: { CallFunz: {
SOSTITUISCI: 345, SOSTITUISCI: 345,
AGGIUNGI_NUOVO_IMBARCO: 380, AGGIUNGI_NUOVO_IMBARCO: 380,
@@ -379,6 +411,7 @@ module.exports = {
TypeMsgTemplate: { TypeMsgTemplate: {
MSG_BENVENUTO: 2010, MSG_BENVENUTO: 2010,
MS_SHARE_LINK: 2000, MS_SHARE_LINK: 2000,
MSG_BENV_REGISTRATO: 2020,
}, },
TypeSend: { TypeSend: {
@@ -757,6 +790,7 @@ module.exports = {
myreact: 1, myreact: 1,
mycities: 1, mycities: 1,
lang: 1, lang: 1,
verified_by_aportador: 1,
'profile.img': 1, 'profile.img': 1,
'profile.mygroups': 1, 'profile.mygroups': 1,
'profile.mycircuits': 1, 'profile.mycircuits': 1,