2727 - Send consumption report to an email address
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2021-04-30 13:50:41 +02:00
parent b4f1e293e2
commit 07dbeaf515
5 changed files with 33 additions and 7 deletions

View File

@ -34,7 +34,7 @@ export default class Controller extends Component {
button.addEventListener('click', () => this.onButtonClick(shape)); button.addEventListener('click', () => this.onButtonClick(shape));
element.appendChild(button); element.appendChild(button);
let buttonText = shape.actionText || this.$t('Hide'); let buttonText = '✖';
buttonText = document.createTextNode(buttonText); buttonText = document.createTextNode(buttonText);
button.appendChild(buttonText); button.appendChild(buttonText);

View File

@ -19,7 +19,7 @@ vn-snackbar .shape {
border-radius: 3px; border-radius: 3px;
margin-bottom: 15px; margin-bottom: 15px;
color: white; color: white;
padding: 12px; padding: 12px 25px 12px 12px;
& > .text { & > .text {
text-align: center; text-align: center;
@ -55,13 +55,13 @@ vn-snackbar .shape {
& > button { & > button {
background-color: transparent; background-color: transparent;
text-transform: uppercase; text-transform: uppercase;
margin-left: 8px;
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
color: $color-main; color: $color-main;
float: right; position: absolute;
border: none; border: none;
padding: 8px; padding: 5px;
margin: -8px; top: 0;
right: 0
} }
} }

View File

@ -149,6 +149,11 @@
"type": "belongsTo", "type": "belongsTo",
"model": "SageWithholding", "model": "SageWithholding",
"foreignKey": "sageWithholdingFk" "foreignKey": "sageWithholdingFk"
},
"contacts": {
"type": "hasMany",
"model": "SupplierContact",
"foreignKey": "supplierFk"
} }
}, },
"acls": [ "acls": [

View File

@ -37,7 +37,27 @@ class Controller extends Section {
} }
sendEmail() { sendEmail() {
this.vnEmail.send('supplier-campaign-metrics', this.reportParams); const params = {
filter: {
where: {
supplierFk: this.$params.id,
email: {neq: null}
},
limit: 1
}
};
this.$http.get('SupplierContacts', params).then(({data}) => {
if (data.length) {
const contact = data[0];
const params = Object.assign({
recipient: contact.email
}, this.reportParams);
this.vnEmail.send('supplier-campaign-metrics', params);
} else {
const message = this.$t(`This supplier doesn't have a contact with an email address`);
this.vnApp.showError(message);
}
});
} }
getTotal(entry) { getTotal(entry) {

View File

@ -1,2 +1,3 @@
Total entry: Total entrada Total entry: Total entrada
This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email