32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
var path = require('path');
|
|
var database = require(path.join(__dirname, '../../database.js'));
|
|
var format = require(path.join(__dirname, '../../util/format.js'));
|
|
|
|
module.exports = class PaymentUpdate {
|
|
getData(params, cb) {
|
|
let query = `SELECT pm.name AS payMethod, pm.id AS payMethodId, c.vencimiento AS payDay, c.CC AS accountAddress
|
|
FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?`;
|
|
database.pool.query(query, [params.userId], (error, result) => {
|
|
Object.assign(this, result[0]);
|
|
cb();
|
|
});
|
|
}
|
|
|
|
get paymentDay() {
|
|
if (this.payMethodId != 5) {
|
|
return `<div>${this._.paymentDay}: <strong style="font-size: 16px">${this.payDay} ${this._.everyMonth}</strong></div>`;
|
|
}
|
|
}
|
|
|
|
get paymentAdvice() {
|
|
switch (this.payMethodId) {
|
|
case 4:
|
|
return `${this._.accountPaymentAdviceBefore} ${format.partialAccountAddress(this.accountAddress)} ${this._.accountPaymentAdviceAfter}`;
|
|
case 5:
|
|
return this._.cardPaymentAdvice;
|
|
}
|
|
}
|
|
};
|
|
|
|
|