- Fare LISTA MOVIMENTI più comprensibile

- Grafica Circuiti
This commit is contained in:
Surya Paolo
2024-10-02 03:46:33 +02:00
parent ff1344c06f
commit 03e5d2ed81
17 changed files with 218 additions and 84 deletions

36
docs/apache2/contatti.htm Normal file
View File

@@ -0,0 +1,36 @@
<!-- wp:themify-builder/canvas /-->
<!--themify_builder_static-->
<h3>Contattaci</h3>
<p><strong>Hai domande, consigli o suggerimenti da proporci?</strong><br />Inviaci un messaggio attraverso il form qui
sotto!</p>
<form action="https://www.fioredellavita.it/wp-admin/admin-ajax.php" class="builder-contact" id="tb_th9k520-form"
method="post" data-post-id="0" data-element-id="th9k520" data-orig-id=""> <label for="field_extra_tb_th9k520_0">
Invia a: <input type="hidden" name="field_extra_name_0" value="Invia a:"> * </label> <select
id="field_extra_tb_th9k520_0" name="field_extra_0" required>
<option value="Seleziona destinatario"> Seleziona destinatario </option>
<option value="ordiniweb@gruppomacro.com"> ordiniweb@gruppomacro.com </option>
</select> <label for="tb_th9k520-contact-subject">Oggetto richiesta: *</label> <input type="text"
name="contact-subject" placeholder="" id="tb_th9k520-contact-subject" value="" required> <label
for="tb_th9k520-contact-name">Nome *</label> <input type="text" name="contact-name" placeholder=""
id="tb_th9k520-contact-name" value="" required> <label for="field_extra_tb_th9k520_1"> Cognome <input
type="hidden" name="field_extra_name_1" value="Cognome"> * </label> <input type="text" name="field_extra_1"
id="field_extra_tb_th9k520_1" placeholder="" required> <label for="tb_th9k520-contact-email">E-mail *</label>
<input type="text" name="contact-email" placeholder="" id="tb_th9k520-contact-email" value="" required> <label
for="field_extra_tb_th9k520_2"> Telefono <input type="hidden" name="field_extra_name_2" value="Telefono">
</label> <input type="tel" name="field_extra_2" id="field_extra_tb_th9k520_2" placeholder=""> <label
for="tb_th9k520-contact-message">Descrivi la tua richiesta: </label> <textarea name="contact-message"
placeholder="" id="tb_th9k520-contact-message"></textarea> <label> <input type="checkbox" name="gdpr" value="1"
required> Ho letto l'Informativa sulla privacy nella pagina <a href="/contatti"> Privacy Policy</a> del Sito
e acconsento al trattamento dei dati inseriti. * </label> <label> Verifica antispam * </label> <button
type="submit">Invia</button> </form>
<h3>Dove siamo</h3>
<p><strong>Macro Società Cooperativa srl</strong><br />Via Giardino, 30 47522 Cesena (FC)</p>
<p>Fai click sulla mappa (OpenStreetMap) per trovare il percorso dal tuo indirizzo.</p>
<a
href="https://www.openstreetmap.org/search?query=Via%20Giardino%2C%2030%20%E2%80%93%2047522%20%E2%80%93%20Cesena%20(FC)#map=16/44.1525/12.2062">
<img decoding="async" loading="lazy" width="500" height="499"
src="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg" title="mappa-macro"
alt="mappa-macro"
srcset="https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro.jpg 500w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-300x300.jpg 300w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-150x150.jpg 150w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-320x319.jpg 320w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-100x100.jpg 100w, https://www.fioredellavita.it/wp-content/uploads/2022/10/mappa-macro-50x50.jpg 50w"
sizes="(max-width: 500px) 100vw, 500px" /> </a><!--/themify_builder_static-->

View File

@@ -1,8 +1,11 @@
p Ciao #{name},
p Hai ricevuto
strong #{qty} #{symbol}
| da parte di #{mittente} in data #{transactionDate} sul
strong #{nomecircuito} !
strong #{qty} #{symbol}
if groupDestoContoCom
| sul conto
strong #{groupDestoContoCom}
span da parte di #{mittente} in data #{transactionDate} sul
strong #{nomecircuito} !
if causale
p <br>
p Commento: #{causale}

View File

@@ -330,3 +330,43 @@ Lun 30/09 ORE 22:58: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77
Saldi:
paoloar77: 20.99 RIS]
ElenaEspx: 29.41 RIS]
Mer 02/10 ORE 00:26: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a PiuCheBuono(GaseBottega) 2 RIS [causale: ]
Saldi:
paoloar77: 101.50 RIS]
PiuCheBuono(GaseBottega): -64.50 RIS]
Mer 02/10 ORE 00:51: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
Saldi:
paoloar77: 100.50 RIS]
TestTransazPao: 1.00 RIS]
Mer 02/10 ORE 02:07: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: dsadasdada]
Saldi:
paoloar77: 95.50 RIS]
TestTransazPao: 6.00 RIS]
Mer 02/10 ORE 02:10: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: DSDA Ciaoooooooo]
Saldi:
paoloar77: 88.50 RIS]
TestTransazPao: 13.00 RIS]
Mer 02/10 ORE 02:16: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 0.5 RIS [causale: Miaooooooooo]
Saldi:
paoloar77: 88.00 RIS]
TestTransazPao: 13.50 RIS]
Mer 02/10 ORE 02:19: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: AAAAA]
Saldi:
paoloar77: 86.00 RIS]
TestTransazPao: 15.50 RIS]
Mer 02/10 ORE 02:21: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 1 RIS [causale: ]
Saldi:
paoloar77: 85.00 RIS]
TestTransazPao: 16.50 RIS]
Mer 02/10 ORE 02:24: [<b>Circuito RIS Italia</b>]: Inviate Monete da paoloar77 a TestTransazPao 2 RIS [causale: ]
Saldi:
paoloar77: 83.00 RIS]
TestTransazPao: 18.50 RIS]
Mer 02/10 ORE 02:25: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 1 RIS [causale: ]
Saldi:
paoloar77: 19.99 RIS]
ElenaEspx: 30.41 RIS]
Mer 02/10 ORE 03:31: [<b>Circuito RIS Bologna</b>]: Inviate Monete da paoloar77 a ElenaEspx 3 RIS [causale: ]
Saldi:
paoloar77: 16.99 RIS]
ElenaEspx: 33.41 RIS]

View File

@@ -129,7 +129,7 @@ const AttivitaSchema = new Schema(
//**ADDFIELD_ATTIVITA
},
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
...tools.getFieldsForAnnunci()
}, { strict: false });
AttivitaSchema.index({ 'idapp': 1 });

View File

@@ -394,7 +394,7 @@ CircuitSchema.statics.getWhatToShow_Unknown = function (idapp, username) {
};
};
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user) {
CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, user, nummovTodownload) {
try {
const { User } = require('../models/user');
@@ -442,12 +442,15 @@ CircuitSchema.statics.getCircuitsByUsername = async function (idapp, username, u
{ deleted: { $exists: true, $eq: false } }],
}, whatToShow_Unknown).sort({ status: -1 }).lean();
const last_my_transactions = await Movement.getLastN_Transactions(idapp, nummovTodownload, username, '');
return {
listcircuits,
asked_circuits,
refused_circuits,
manage_mycircuits,
mycircuits: user.profile.mycircuits,
last_my_transactions,
};
} catch (e) {
@@ -664,6 +667,8 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
const { User } = require('../models/user');
const { MyGroup } = require('./mygroup');
const sendemail = require('../sendemail');
let ris = {
@@ -785,10 +790,13 @@ CircuitSchema.statics.sendCoins = async function (onlycheck, idapp, usernameOrig
await sendemail.sendEmail_RisRicevuti(myuserDest.lang, myuserDest, myuserDest.email, idapp, paramsrec);
} else if (extrarec.groupdest || extrarec.contoComDest) {
const groupDestoContoCom = extrarec.groupdest ? extrarec.groupdest : (extrarec && extrarec.contoComDest ? extrarec.contoComDest : '');
let arrusers = await MyGroup.getListAdminsByGroupName(idapp, groupDestoContoCom);
if (arrusers.length <= 0)
arrusers = await Circuit.getListAdminsByCircuitPath(idapp, groupDestoContoCom);
paramsrec.groupDestoContoCom = groupDestoContoCom;
for (let i = 0; i < arrusers.length; i++) {
let myuserDest = await User.getUserByUsername(idapp, arrusers[i].username);

View File

@@ -137,6 +137,8 @@ MovementSchema.statics.getQueryMovsByCircuitId = async function (idapp, username
}
const myaccount = await Account.getAccountByUsernameAndCircuitId(idapp, username, circuitId, false, true, groupname, contocom);
if (myaccount) {
let aggr1 = [
@@ -741,24 +743,48 @@ MovementSchema.statics.checkIfCoinsAlreadySent = async function (notifId) {
};
MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz = 10) {
MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz = 10, username = '', groupname = '', contocom = '') {
const MyMovement = this;
// get last "numtransaz" transactions
let abilitaquerypersingolo = (username || groupname || contocom);
let querym2 = null;
if (abilitaquerypersingolo) {
let v1 = [];
if (username) {
v1.push({ 'userfrom.username': username },
{ 'userto.username': username });
}
if (groupname) {
v1.push({ 'groupfrom.groupname': groupname },
{ 'groupto.groupname': groupname });
}
if (contocom) {
v1.push({ 'contocomfrom.name': contocom },
{ 'contocomto.name': contocom });
}
querym2 = {
$match:
{ $or: v1 }
};
};
let aggr1 = [
{
$match: {
idapp,
},
$match: { idapp },
},
{
$sort: {
transactionDate: -1,
}
},
{ $limit: numtransaz },
{
$lookup: {
from: 'accounts',
@@ -968,40 +994,46 @@ MovementSchema.statics.getLastN_Transactions = async function (idapp, numtransaz
preserveNullAndEmptyArrays: true,
},
},
{
$project:
{
transactionDate: 1,
amount: 1,
causal: 1,
notifId: 1,
'circuitfrom.symbol': 1,
'circuitfrom.name': 1,
'circuitto.symbol': 1,
'circuitto.name': 1,
'userfrom.verified_by_aportador': 1,
'userfrom.username': 1,
'userfrom.profile.img': 1,
'userto.username': 1,
'userto.profile.img': 1,
'userto.verified_by_aportador': 1,
'groupfrom.groupname': 1,
'groupfrom.verified_by_aportador': 1,
'groupfrom.title': 1,
'groupfrom.photos': 1,
'groupto.groupname': 1,
'groupto.title': 1,
'groupto.photos': 1,
'groupto.verified_by_aportador': 1,
'contocomfrom.path': 1,
'contocomfrom.name': 1,
'contocomto.path': 1,
'contocomto.name': 1,
},
},
];
if (querym2)
aggr1.push(querym2);
if (numtransaz)
aggr1.push({ $limit: numtransaz });
aggr1.push({
$project:
{
transactionDate: 1,
amount: 1,
causal: 1,
notifId: 1,
'circuitfrom.symbol': 1,
'circuitfrom.name': 1,
'circuitto.symbol': 1,
'circuitto.name': 1,
'userfrom.verified_by_aportador': 1,
'userfrom.username': 1,
'userfrom.profile.img': 1,
'userto.username': 1,
'userto.profile.img': 1,
'userto.verified_by_aportador': 1,
'groupfrom.groupname': 1,
'groupfrom.verified_by_aportador': 1,
'groupfrom.title': 1,
'groupfrom.photos': 1,
'groupto.groupname': 1,
'groupto.title': 1,
'groupto.photos': 1,
'groupto.verified_by_aportador': 1,
'contocomfrom.path': 1,
'contocomfrom.name': 1,
'contocomto.path': 1,
'contocomto.name': 1,
},
});
const lastNtransac = await MyMovement.aggregate(aggr1);
/*

View File

@@ -120,7 +120,7 @@ const MyBachecaSchema = new Schema({
},
},
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
...tools.getFieldsForAnnunci()
});
MyBachecaSchema.pre('save', async function (next) {

View File

@@ -92,7 +92,7 @@ const MyGoodSchema = new Schema({
},
},
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
...tools.getFieldsForAnnunci()
});
MyGoodSchema.pre('save', async function (next) {

View File

@@ -66,7 +66,6 @@ const MyGroupSchema = new Schema({
type: String,
default: '',
},
//**ADDFIELD_MYGROUPS
visibility: [
{
type: Number,
@@ -125,11 +124,9 @@ const MyGroupSchema = new Schema({
lastdate_reqRisGroup: {
type: Date,
},
//**ADDFIELD_MYGROUPS
idMyGroup: {
type: String,
},
// **ADDFIELD_MYGROUPS
...tools.getFieldsForAnnunci(),
});
@@ -252,7 +249,6 @@ MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
photos: 1,
idCity: 1,
website: 1,
//**ADDFIELD_MYGROUPS
link_telegram: 1,
note: 1,
admins: 1,
@@ -264,6 +260,7 @@ MyGroupSchema.statics.getWhatToShow = function (idapp, username) {
date_updated: 1,
mycircuits: 1,
lastdate_reqRisGroup: 1,
//**ADDFIELD_MYGROUPS
};
whatToShow = { ...whatToShow, ...shared_consts.ANNUNCI_FIELDS };
@@ -663,17 +660,6 @@ MyGroupSchema.statics.setReceiveRisGroup = async function (idapp, groupname) {
};
MyGroupSchema.statics.getFieldsForAnnunci = function () {
let annunciFields = {
idMyGroup: {
type: String,
},
// **ADDFIELD_MYGROUPS
};
return annunciFields;
};
const MyGroup = mongoose.model('MyGroup', MyGroupSchema);
MyGroup.createIndexes((err) => {

View File

@@ -99,7 +99,7 @@ const MyHospSchema = new Schema({
},
},
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
...tools.getFieldsForAnnunci()
});
MyHospSchema.pre('save', async function (next) {

View File

@@ -99,7 +99,7 @@ const MySkillSchema = new Schema(
},
},
...Reaction.getFieldsForReactions(),
...MyGroup.getFieldsForAnnunci()
...tools.getFieldsForAnnunci()
}, { strict: false });
MySkillSchema.index({ 'idapp': 1 });

View File

@@ -15,6 +15,9 @@ const { Settings } = require('../models/settings');
const shared_consts = require('../tools/shared_nodejs');
const { ObjectID } = require('mongodb');
var ObjectId = mongoose.Types.ObjectId;
// Resolving error Unknown modifier: $pushAll
mongoose.plugin(schema => {
schema.options.usePushEach = true;
@@ -68,8 +71,8 @@ StatSchema.statics.updateStats = async function (datastat) {
datastat.last_transactions.forEach(function (mov) {
let ris = tools.getStringaConto(mov)
mov.myfrom = ris.myfrom
mov.myto = ris.myto
mov.userfrom = ris.userfrom
mov.userto = ris.userto
mov.tipocontofrom = ris.tipocontofrom
mov.tipocontoto = ris.tipocontoto
});
@@ -113,11 +116,12 @@ StatSchema.statics.calculateStats = async function (idapp) {
};
// Trova il record di oggi:
const trova_se_oggi = await Stat.findOne({ idapp, date_created: { $gte: new Date(new Date().setHours(0, 0, 0, 0)) } });
const trova_se_oggi = await Stat.findOne({ idapp, date_created: { $gte: new Date(new Date().setHours(0, 0, 0, 0)) } }).lean();
if (trova_se_oggi) {
// Aggiorna il record di oggi:
await Stat.updateOne({ _id: trova_se_oggi._id }, { $set: datastat });
const ris = await Stat.findOneAndUpdate({ _id: trova_se_oggi._id }, { $set: datastat }, { new: true });
console.log('ris', ris);
} else {
// Aggiungi un nuovo record:
await Stat.insertMany([datastat]);

View File

@@ -5614,7 +5614,7 @@ UserSchema.statics.addExtraInfo = async function (idapp, recUser, recUserSave, v
// Circuit>
const circuitobj = await Circuit.getCircuitsByUsername(idapp, recUser.username, recUser);
const circuitobj = await Circuit.getCircuitsByUsername(idapp, recUser.username, recUser, 5);
const useraccounts = await Account.getUserAccounts(idapp, recUser.username);

View File

@@ -890,8 +890,9 @@ router.post('/circuits', authenticate, (req, res) => {
const username = req.user.username;
idapp = req.body.idapp;
locale = req.body.locale;
nummovTodownload = req.body.nummovTodownload;
return Circuit.getCircuitsByUsername(idapp, username, req.user).then((ris) => {
return Circuit.getCircuitsByUsername(idapp, username, req.user, nummovTodownload).then((ris) => {
res.send(ris);
}).catch((e) => {
tools.mylog('ERRORE IN circuits: ' + e.message);

View File

@@ -319,6 +319,7 @@ module.exports = {
transactionDate: tools.getstrDate_DD_MM_YYYY(myrec.transactionDate),
symbol: myrec.symbol,
causale: myrec.causale,
groupDestoContoCom: myrec.groupDestoContoCom,
};
mylocalsconf = this.setParamsForTemplate(userDest, mylocalsconf);

View File

@@ -5609,39 +5609,44 @@ module.exports = {
getStringaConto(mov) {
let mystr = ''
let myfrom = ''
let myto = ''
let userfrom = ''
let userto = ''
let profilefrom = null
let profileto = null
let tipocontofrom = shared_consts.AccountType.USER
let tipocontoto = shared_consts.AccountType.USER
if (mov.contocomfrom && mov.contocomfrom.name) {
myfrom += mov.contocomfrom.name + ' '
userfrom += mov.contocomfrom.name
tipocontofrom = shared_consts.AccountType.COMMUNITY_ACCOUNT
}
if (mov.groupfrom) {
myfrom += mov.groupfrom.groupname + ' '
userfrom += mov.groupfrom.groupname
tipocontofrom = shared_consts.AccountType.COLLECTIVE_ACCOUNT
}
if (mov.userfrom) {
myfrom += mov.userfrom.username + ' '
userfrom += mov.userfrom.username
profilefrom = mov.userfrom.profile
}
if (mov.contocomto && mov.contocomto.name) {
myto += mov.contocomto.name + ' '
userto += mov.contocomto.name
tipocontoto = shared_consts.AccountType.COMMUNITY_ACCOUNT
}
if (mov.groupto) {
myto += mov.groupto.groupname + ' '
userto += mov.groupto.groupname
tipocontoto = shared_consts.AccountType.COLLECTIVE_ACCOUNT
}
if (mov.userto) {
myto += mov.userto.username + ' '
userto += mov.userto.username
profileto = mov.userto.profile
}
// mystr = t('movement.from') + myfrom + ' ' + t('movement.to') + myto
// mystr = t('movement.from') + userfrom + ' ' + t('movement.to') + userto
return { myfrom, myto, tipocontofrom, tipocontoto }
return { userfrom: {profile: profilefrom, username: userfrom}, userto: {profile: profileto, username: userto}, tipocontofrom, tipocontoto }
},
ImageDownloader,
@@ -5685,5 +5690,21 @@ module.exports = {
return 'it';
},
getFieldsForAnnunci() {
let annunciFields = {
idMyGroup: {
type: String,
},
expiryDateAdv: {
type: Date,
},
enableExpiringAdv: {
type: Boolean,
},
// **ADDFIELD_ANNUNCI
};
return annunciFields;
},
};

View File

@@ -177,7 +177,9 @@ module.exports = {
ANNUNCI_FIELDS: {
idMyGroup: 1,
// **ADDFIELD_MYGROUPS
expiryDateAdvert: 1,
// **ADDFIELD_ANNUNCI
},
// Condivise