Merge branch 'dev' into 8251-engTemplates
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
6282e3105d
|
@ -29,35 +29,34 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.sendToSupport = async(ctx, reason, additionalData) => {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const emailUser =
|
||||
await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']});
|
||||
await Self.app.models.EmailUser.findById(userId, {fields: ['email']});
|
||||
|
||||
let html = `<strong>Motivo</strong>:<br/>${reason}<br/>`;
|
||||
html += `<strong>Usuario</strong>:<br/>${ctx.req.accessToken.userId} ${emailUser.email}<br/>`;
|
||||
let html = `<h2>Motivo: ${reason}</h2>`;
|
||||
html += `<h3>Usuario: ${userId} ${emailUser.email}</h3>`;
|
||||
html += `<h3>Additional Data:</h3>`;
|
||||
html += '<ul>';
|
||||
for (const [key, val] of Object.entries(additionalData)) {
|
||||
if (key !== 'config') html += `<li>${key}: ${parse(val)}</li>`;
|
||||
else {
|
||||
html += `<li>${key}:</li><ul style="list-style-type: square;">`;
|
||||
for (const [confKey, confVal] of Object.entries(val))
|
||||
html += `<li>${confKey}: ${parse(confVal)}</li>`;
|
||||
html += '</ul>';
|
||||
}
|
||||
}
|
||||
html += '</ul>';
|
||||
|
||||
delete additionalData.backError.config.headers.Authorization;
|
||||
const httpRequest = JSON.parse(additionalData?.httpRequest);
|
||||
|
||||
if (httpRequest)
|
||||
delete httpRequest.config.headers.Authorization;
|
||||
additionalData.httpRequest = httpRequest;
|
||||
|
||||
for (const data in additionalData)
|
||||
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
|
||||
|
||||
const subjectReason = httpRequest?.data?.error;
|
||||
const {message, path, name} = additionalData;
|
||||
await smtp.send({
|
||||
to: `${config.app.reportEmail}, ${emailUser.email}`,
|
||||
subject:
|
||||
'[Support-Salix] ' +
|
||||
additionalData?.frontPath + ' ' +
|
||||
subjectReason?.name + ':' +
|
||||
subjectReason?.message,
|
||||
subject: `[Support-Salix] ${path} ${name}: ${message}`,
|
||||
html
|
||||
});
|
||||
};
|
||||
|
||||
function tryParse(value) {
|
||||
function parse(value) {
|
||||
try {
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE vn.`zone` MODIFY COLUMN `price` DECIMAL(10,2);
|
||||
|
|
@ -27,18 +27,6 @@ export default class Controller extends Component {
|
|||
setTimeout(() => element.classList.add('shown'), 30);
|
||||
shape.element = element;
|
||||
|
||||
if (data.additionalData && this.vnToken.token) {
|
||||
this.additionalData = data.additionalData;
|
||||
let supportButton = document.createElement('i');
|
||||
supportButton.setAttribute('class', 'material-icons clickable');
|
||||
supportButton.addEventListener('click', () => this.$.supportDialog.show());
|
||||
element.appendChild(supportButton);
|
||||
|
||||
let buttonIcon = 'support_agent';
|
||||
buttonIcon = document.createTextNode(buttonIcon);
|
||||
supportButton.appendChild(buttonIcon);
|
||||
}
|
||||
|
||||
if (shape.type)
|
||||
element.classList.add(shape.type);
|
||||
|
||||
|
|
|
@ -9,13 +9,6 @@ export default class Controller extends Dialog {
|
|||
responseHandler(response) {
|
||||
if (response !== 'accept')
|
||||
return super.responseHandler(response);
|
||||
|
||||
this.$http.post('Ostickets/send-to-support', {
|
||||
reason: this.reason,
|
||||
additionalData: this.additionalData
|
||||
})
|
||||
.then(() => super.responseHandler(response))
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Email sended!')));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,5 +247,7 @@
|
|||
"The raid information is not correct": "The raid information is not correct",
|
||||
"Payment method is required": "Payment method is required",
|
||||
"Sales already moved": "Sales already moved",
|
||||
"Holidays to past days not available": "Holidays to past days not available"
|
||||
"Holidays to past days not available": "Holidays to past days not available",
|
||||
"There are tickets to be invoiced": "There are tickets to be invoiced for this zone, please delete them first",
|
||||
"Price cannot be blank": "Price cannot be blank"
|
||||
}
|
||||
|
|
|
@ -388,10 +388,10 @@
|
|||
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
|
||||
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
||||
"The web user's email already exists": "El correo del usuario web ya existe",
|
||||
"Sales already moved": "Ya han sido transferidas",
|
||||
"The raid information is not correct": "La información de la redada no es correcta",
|
||||
"There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero",
|
||||
"Sales already moved": "Ya han sido transferidas",
|
||||
"The raid information is not correct": "La información de la redada no es correcta",
|
||||
"There are tickets to be invoiced": "Hay tickets para esta zona, borralos primero",
|
||||
"Price cannot be blank": "Price cannot be blank",
|
||||
"An item type with the same code already exists": "Un tipo con el mismo código ya existe",
|
||||
"Holidays to past days not available": "Las vacaciones a días pasados no están disponibles"
|
||||
}
|
||||
|
||||
|
|
|
@ -14,4 +14,18 @@ module.exports = Self => {
|
|||
Self.validatesPresenceOf('agencyModeFk', {
|
||||
message: `Agency cannot be blank`
|
||||
});
|
||||
|
||||
Self.validatesPresenceOf('price', {
|
||||
message: 'Price cannot be blank'
|
||||
});
|
||||
Self.validateAsync('price', priceIsValid, {
|
||||
message: 'Price must be greater than 0'
|
||||
});
|
||||
|
||||
async function priceIsValid(err, done) {
|
||||
if (this.price <= 0)
|
||||
err();
|
||||
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue