diff --git a/front/core/components/snackbar/snackbar.js b/front/core/components/snackbar/snackbar.js index 14d920211..e68c22f3f 100644 --- a/front/core/components/snackbar/snackbar.js +++ b/front/core/components/snackbar/snackbar.js @@ -34,7 +34,7 @@ export default class Controller extends Component { button.addEventListener('click', () => this.onButtonClick(shape)); element.appendChild(button); - let buttonText = shape.actionText || this.$t('Hide'); + let buttonText = '✖'; buttonText = document.createTextNode(buttonText); button.appendChild(buttonText); diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index 465c53851..23e8223e5 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -19,7 +19,7 @@ vn-snackbar .shape { border-radius: 3px; margin-bottom: 15px; color: white; - padding: 12px; + padding: 12px 25px 12px 12px; & > .text { text-align: center; @@ -55,13 +55,13 @@ vn-snackbar .shape { & > button { background-color: transparent; text-transform: uppercase; - margin-left: 8px; font-weight: bold; cursor: pointer; color: $color-main; - float: right; + position: absolute; border: none; - padding: 8px; - margin: -8px; + padding: 5px; + top: 0; + right: 0 } } \ No newline at end of file diff --git a/modules/supplier/back/models/supplier.json b/modules/supplier/back/models/supplier.json index 4ec568c8b..867ac4f33 100644 --- a/modules/supplier/back/models/supplier.json +++ b/modules/supplier/back/models/supplier.json @@ -149,6 +149,11 @@ "type": "belongsTo", "model": "SageWithholding", "foreignKey": "sageWithholdingFk" + }, + "contacts": { + "type": "hasMany", + "model": "SupplierContact", + "foreignKey": "supplierFk" } }, "acls": [ diff --git a/modules/supplier/front/consumption/index.js b/modules/supplier/front/consumption/index.js index 9e1357a9f..21a30929d 100644 --- a/modules/supplier/front/consumption/index.js +++ b/modules/supplier/front/consumption/index.js @@ -37,7 +37,27 @@ class Controller extends Section { } 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) { diff --git a/modules/supplier/front/consumption/locale/es.yml b/modules/supplier/front/consumption/locale/es.yml index dd052696c..6ef67ab2b 100644 --- a/modules/supplier/front/consumption/locale/es.yml +++ b/modules/supplier/front/consumption/locale/es.yml @@ -1,2 +1,3 @@ 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 \ No newline at end of file