diff --git a/emails/admin/registration/it/html.pug b/emails/admin/registration/it/html.pug
index 23bf622..d1db15b 100644
--- a/emails/admin/registration/it/html.pug
+++ b/emails/admin/registration/it/html.pug
@@ -12,8 +12,6 @@ span Cellulare:
strong #{user.profile.intcode_cell} #{user.profile.cell}
span Nazionalità:
strong #{user.profile.nationality}
-span Username di chi lo ha Invitato:
- strong #{user.aportador_solidario}
p
Saluti
style(type="text/css").
diff --git a/src/server/models/extralist.js b/src/server/models/extralist.js
index c15d050..c302a43 100644
--- a/src/server/models/extralist.js
+++ b/src/server/models/extralist.js
@@ -78,6 +78,9 @@ var ExtraListSchema = new mongoose.Schema({
note: {
type: String,
},
+ contacted: {
+ type: Boolean,
+ },
col_b: {
type: Number,
},
@@ -87,17 +90,17 @@ var ExtraListSchema = new mongoose.Schema({
registered: {
type: Boolean,
default: false
- }
+ },
});
-ExtraListSchema.methods.toJSON = function () {
- const extralist = this;
- const userObject = extralist.toObject();
-
- return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
-};
-
+// ExtraListSchema.methods.toJSON = function () {
+// const extralist = this;
+// const userObject = extralist.toObject();
+//
+// return _.pick(userObject, ['_id', ...shared_consts.fieldsUserToChange()]);
+// };
+//
ExtraListSchema.statics.findByUsername = function (idapp, username) {
const ExtraList = this;
@@ -174,16 +177,30 @@ ExtraListSchema.statics.getDownlineNotRegisteredByNameSurname = function (idapp,
'aportador_solidario_name_surname': nameandsurname,
registered: false,
}, {
- username: 1,
+ ind_order: 1,
name: 1,
surname: 1,
- verified_email: 1,
- 'profile.teleg_id': 1,
- 'profile.saw_zoom_presentation': 1,
- made_gift: 1,
- email: 1,
- date_reg: 1,
- img: 1
+ cell_complete: 1,
+ num_invitati: 1,
+ nationality: 1,
+ }, (err, arrrec) => {
+ return arrrec
+ });
+};
+
+ExtraListSchema.statics.getUserNotRegisteredByNameSurname = function (idapp, nameandsurname) {
+ const ExtraList = this;
+
+ return ExtraList.findOne({
+ name_complete: nameandsurname,
+ registered: false,
+ }, {
+ ind_order: 1,
+ name: 1,
+ surname: 1,
+ cell_complete: 1,
+ num_invitati: 1,
+ nationality: 1,
}, (err, arrrec) => {
return arrrec
});
diff --git a/src/server/models/user.js b/src/server/models/user.js
index c257e69..f727020 100644
--- a/src/server/models/user.js
+++ b/src/server/models/user.js
@@ -7,6 +7,7 @@ const _ = require('lodash');
const tools = require('../tools/general');
const { Settings } = require('../models/settings');
+const { ExtraList } = require('../models/extralist');
const shared_consts = require('../tools/shared_nodejs');
const queryclass = require('../classes/queryclass');
@@ -328,6 +329,7 @@ UserSchema.statics.getUserShortDataByUsername = function (idapp, username) {
'idapp': idapp,
'username': username,
}, {
+ ind_order: 1,
username: 1,
name: 1,
surname: 1,
@@ -355,6 +357,8 @@ UserSchema.statics.getDownlineByUsername = function (idapp, username) {
'idapp': idapp,
'aportador_solidario': username,
}, {
+ aportador_solidario: 1,
+ ind_order: 1,
username: 1,
name: 1,
surname: 1,
@@ -700,7 +704,7 @@ UserSchema.statics.DuplicateAllRecords = async function (idapporig, idappdest) {
};
-UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, username) {
+UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, username, aportador_solidario_nome_completo) {
try {
// DATA: username, name, surname, email, intcode_cell, cell
@@ -709,14 +713,21 @@ UserSchema.statics.getDashboard = async function (idapp, aportador_solidario, us
downline: []
};
+ dashboard.myself = await User.getUserShortDataByUsername(idapp, username);
// Data of my Aportador
dashboard.aportador = await User.getUserShortDataByUsername(idapp, aportador_solidario);
+ if (dashboard.aportador === undefined ) {
+ dashboard.aportador = await ExtraList.getUserNotRegisteredByNameSurname(idapp, aportador_solidario_nome_completo);
+ }
+
// Data of my Downline
const arrap = await User.getDownlineByUsername(idapp, aportador_solidario);
dashboard.numpeople_aportador = arrap.length;
dashboard.downline = await User.getDownlineByUsername(idapp, username);
+ dashboard.downnotreg = await ExtraList.getDownlineNotRegisteredByNameSurname(idapp, dashboard.myself.name + ' ' + dashboard.myself.surname);
+
dashboard.downbyuser = {};
for (const down of dashboard.downline) {
diff --git a/src/server/router/dashboard_router.js b/src/server/router/dashboard_router.js
index f674039..d1caf5a 100644
--- a/src/server/router/dashboard_router.js
+++ b/src/server/router/dashboard_router.js
@@ -25,14 +25,23 @@ router.post('/', authenticate, async (req, res) => {
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
}
let aportador_solidario = req.user.aportador_solidario;
+ let aportador_solidario_nome_completo = req.user.aportador_solidario_nome_completo;
+
+ // if (User.isAdmin(req.user.perm) || User.isManager(req.user.perm)) {
+ // const recuser = await User.findByUsername(idapp, username);
+ // if (recuser) {
+ // aportador_solidario_nome_completo = recuser.name + ' ' + recuser.surname;
+ // }
+ // }
if (username) {
- aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username)
+ aportador_solidario = await User.getAportadorSolidarioByUsername(idapp, username);
+ aportador_solidario_nome_completo = await User.getNameSurnameByUsername(idapp, username);
} else {
username = req.user.username;
}
- const dashboard = await User.getDashboard(idapp, aportador_solidario, username);
+ const dashboard = await User.getDashboard(idapp, aportador_solidario, username, aportador_solidario_nome_completo);
if (dashboard)
res.send({ dashboard });
else
diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js
index e0760bd..e3307c0 100644
--- a/src/server/router/index_router.js
+++ b/src/server/router/index_router.js
@@ -258,6 +258,7 @@ router.post('/gettable', authenticate, (req, res) => {
router.patch('/chval', authenticate, (req, res) => {
// const idapp = req.body.idapp;
const id = req.body.data.id;
+ const idapp = req.body.idapp;
const mydata = req.body.data;
const mytable = getTableByTableName(mydata.table);
@@ -276,7 +277,12 @@ router.patch('/chval', authenticate, (req, res) => {
if (!rec) {
return res.status(404).send();
} else {
+ if (mydata.notifBot) {
+ // Send Notification to the BOT
+ telegrambot.sendMsgTelegram(idapp, mydata.notifBot.un, mydata.notifBot.txt)
+ }
res.send({ code: server_constants.RIS_CODE_OK, msg: '' });
+
}
}).catch((e) => {
@@ -625,7 +631,8 @@ router.post('/upload/:dir', authenticate, (req, res) => {
// Move in the folder application !
tools.move(file.path, newname, (err) => {
- console.log('err:', err);
+ if (err)
+ console.log('err:', err);
res.end();
});
diff --git a/src/server/router/users_router.js b/src/server/router/users_router.js
index a0cc653..dcf645d 100644
--- a/src/server/router/users_router.js
+++ b/src/server/router/users_router.js
@@ -285,7 +285,7 @@ router.post('/login', (req, res) => {
await tools.snooze(3000);
const msg = "Tentativo di Login ERRATO [" + body.username + ' , ' + body.password + ']\n' + '[IP: ' + tools.getiPAddressUser(req) + ']';
tools.mylogshow(msg);
- telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
+ // telegrambot.sendMsgTelegramToTheManagers(body.idapp, msg);
res.status(404).send({ code: server_constants.RIS_CODE_LOGIN_ERR });
}
return user
diff --git a/src/server/telegram/telegrambot.js b/src/server/telegram/telegrambot.js
index ef4b4d2..9973536 100644
--- a/src/server/telegram/telegrambot.js
+++ b/src/server/telegram/telegrambot.js
@@ -306,7 +306,7 @@ class Telegram {
let mystr = '';
if (rec.user) {
- const dashboard = await User.getDashboard(this.idapp, rec.user.aportador_solidario, rec.user.username);
+ const dashboard = await User.getDashboard(this.idapp, rec.user.aportador_solidario, rec.user.username, rec.user.aportador_solidario_name_surname);
let numpersone = (dashboard.downline) ? dashboard.downline.length : 0;
mystr = "";
@@ -336,12 +336,24 @@ class Telegram {
if (numpersone > 0) {
let index = 1;
dashboard.downline.forEach((user) => {
- mystr += emoji.get('star-struck') + ` ${index}°: ${user.username} (${user.name} ${user.surname})\n`;
+ mystr += emoji.get('star-struck') + ` ${index}°: ${user.name} ${user.surname} (${user.username})\n`;
index++;
});
}
+ if (dashboard.downnotreg) {
+ if (dashboard.downnotreg.length > 0) {
+ mystr += '\n' + emo.QUESTION_MARK + ' ' + tools.get__('NONREG', msg) + ':' + emo.QUESTION_MARK + '\n';
+ let index = 1;
+ dashboard.downnotreg.forEach((user) => {
+ mystr += ` - ${index}°: ${user.name} ${user.surname} (tel: ${user.cell_complete})\n`;
+ index++;
+ });
+ }
+ }
+
+
}
if (!!mystr)
await this.sendMsg(msg.chat.id, mystr);
diff --git a/src/server/tools/general.js b/src/server/tools/general.js
index 66334bc..125ee01 100644
--- a/src/server/tools/general.js
+++ b/src/server/tools/general.js
@@ -12,6 +12,8 @@ const Url = require('url-parse');
const { ObjectID } = require('mongodb');
+const shared_consts = require('../tools/shared_nodejs');
+
const mongoose = require('mongoose');
const Subscription = mongoose.model('subscribers');
@@ -43,7 +45,7 @@ textlang = {
"Nuova Registrazione": "Nuova Registrazione",
"Effettuata una Nuova Registrazione": "Effettuata una Nuova Registrazione",
"partecipanti": "partecipanti",
- 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
+ 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
'BENVENUTO': "Benvenuto",
'EMAIL_VERIF': "Email Verificata",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**
e clicca sul bottone **\"Verifica Registrazione\"**",
@@ -52,6 +54,7 @@ textlang = {
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
+ 'NONREG': 'Invitati non Registrati',
},
es: {
"L'Email è già stata Verificata": "L'Email è già stata Verificata",
@@ -59,7 +62,7 @@ textlang = {
"Effettuata una Nuova Registrazione": "Se ha realizado un nuevo registro",
"partecipanti": "participantes",
- 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
+ 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
'BENVENUTO': "Benvenuto",
'EMAIL_VERIF': "Email Verificata",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**
e clicca sul bottone **\"Verifica Registrazione\"**",
@@ -68,10 +71,11 @@ textlang = {
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
+ 'NONREG': 'Invitati non Registrati',
},
us: {
"partecipanti": "participants",
- 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità." ,
+ 'TESTO_ASSISTENZA': "Per entrare nel Sito AYNI:\nhttps://ayni.gifteconomy.app\n\nHai dimenticato la Password per accedere al sito?\nhttps://ayni.gifteconomy.app/requestresetpwd\n\nChat AYNI BOT (questa):\nhttps://t.me/notevoleaynibot\n\nChat AYNI-BiblioBacheca: https://t.me/joinchat/AL2qKExZKvenLgpVhOyefQ \n\nChat di Aiuto e Supporto: 'AYNI Help & Support'\nhttps://t.me/joinchat/C741mlVmB_RMcOUpNqWC8w\n1 - Poni il tuo quesito, chiedi assistenza.\n2 - Terminata l\'assistenza, uscirete da quella Chat.\nPotrete rientrare tutte le volte che ce ne sia necessità.",
'BENVENUTO': "Benvenuto",
'EMAIL_VERIF': "Email Verificata",
'EMAIL_NON_VERIF': "Email Non Verificata\nleggi la tua casella email e trova **\"Confermare la Registrazione a Ayni\"**
e clicca sul bottone **\"Verifica Registrazione\"**",
@@ -80,6 +84,7 @@ textlang = {
'ZOOM_PARTECIPATO': 'Partecipazione ad almeno 1 Conferenza (Zoom)',
'SCRITTO_SOGNO': 'Hai scritto il tuo Sogno',
'INVITATI': 'persone registrate che hai invitato',
+ 'NONREG': 'Invitati non Registrati',
}
};
@@ -517,7 +522,7 @@ module.exports = {
let query = [];
if (params.filter && params.fieldsearch) {
let myregexp = {};
- myregexp = new RegExp(params.filter.replace(' ', '|'), "ig");
+ myregexp = new RegExp(params.filter.trim().replace(' ', '|'), "ig");
const myfilters = [];
params.fieldsearch.forEach((field) => {
@@ -530,6 +535,54 @@ module.exports = {
{ $match: { $or: myfilters } },
]
}
+
+ let filtriadded = [];
+
+ // if (params.table === 'extralist') {
+ // if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_DELETED))
+ // filtriadded.push({ deleted: true });
+ // else
+ // filtriadded.push({ deleted: { $exists: false } });
+ // }
+
+ if (params.filterand) {
+
+ if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_NOT_REGISTERED))
+ filtriadded.push({ registered: false });
+
+ if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_NOT_CONTACTED)) {
+ filtriadded.push({ contacted: { $exists: false } });
+ }
+ if (params.filterand.includes(shared_consts.FILTER_EXTRALIST_WITH_NOTE))
+ filtriadded.push({
+ 'note': { $exists: true },
+ "$expr": { "$gt": [{ "$strLenCP": "$note" }, 1] }
+ });
+ if (params.filterand.includes(shared_consts.FILTER_USER_NO_ZOOM))
+ filtriadded.push({ 'profile.saw_zoom_presentation': false });
+ if (params.filterand.includes(shared_consts.FILTER_USER_NO_INVITANTE))
+ filtriadded.push({
+ aportador_solidario: { $exists: false }
+ });
+ if (params.filterand.includes(shared_consts.FILTER_USER_NO_TELEGRAM_ID))
+ filtriadded.push({ 'profile.teleg_id': { $lt: 1 } });
+ if (params.filterand.includes(shared_consts.FILTER_USER_CODICE_AUTH_TELEGRAM))
+ filtriadded.push({ 'profile.teleg_checkcode': { $gt: 1 } });
+ if (params.filterand.includes(shared_consts.FILTER_USER_NO_EMAIL_VERIFICATA))
+ filtriadded.push({ verified_email: false });
+ if (params.filterand.includes(shared_consts.FILTER_USER_NO_DREAM))
+ filtriadded.push({
+ 'profile.my_dream': {
+ $exists: false
+ }
+ });
+
+ }
+
+
+ if (filtriadded.length > 0)
+ query.push({ $match: { $and: filtriadded } });
+
if (idapp > 0) {
query.push({ $match: { idapp } });
}
@@ -837,10 +890,10 @@ module.exports = {
return namesurname
},
- getiPAddressUser (req) {
+ getiPAddressUser(req) {
try {
const striniziale = '::ffff:';
- if (req.ip.indexOf(striniziale) >= 0){
+ if (req.ip.indexOf(striniziale) >= 0) {
return req.ip.substring(striniziale.length)
} else {
return req.ip; // Express
diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js
index 45a1b6f..707fa96 100644
--- a/src/server/tools/shared_nodejs.js
+++ b/src/server/tools/shared_nodejs.js
@@ -1,5 +1,16 @@
module.exports = {
+ FILTER_EXTRALIST_NOT_REGISTERED: 1,
+ FILTER_EXTRALIST_NOT_CONTACTED: 2,
+ FILTER_EXTRALIST_WITH_NOTE: 4,
+ FILTER_USER_NO_ZOOM: 8,
+ FILTER_USER_NO_INVITANTE: 16,
+ FILTER_USER_NO_TELEGRAM_ID: 32,
+ FILTER_USER_CODICE_AUTH_TELEGRAM: 64,
+ FILTER_USER_NO_EMAIL_VERIFICATA: 128,
+ FILTER_USER_NO_DREAM: 256,
+ FILTER_EXTRALIST_DELETED: 512,
+
Permissions: {
Admin: 1,
Manager: 2,
@@ -12,7 +23,7 @@ module.exports = {
},
fieldsUserToChange() {
- return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift']
+ return ['_id', 'username', 'email', 'name', 'surname', 'perm', 'date_reg', 'date_temp_reg', 'verified_email', 'ipaddr', 'lasttimeonline', 'profile', 'calcstat', 'news_on', 'aportador_solidario', 'made_gift', 'ind_order']
}
};