diff --git a/modules/client/front/defaulter/index.js b/modules/client/front/defaulter/index.js index 48552f731..d8bf12bff 100644 --- a/modules/client/front/defaulter/index.js +++ b/modules/client/front/defaulter/index.js @@ -123,11 +123,33 @@ export default class Controller extends Section { } this.$http.post(`ClientObservations`, params) .then(() => { - this.vnApp.showMessage(this.$t('Observation saved!')); + this.vnApp.showSuccess(this.$t('Observation saved!')); + this.sendMail(); this.$state.reload(); }); } + sendMail() { + const params = []; + for (let defaulter of this.checked) { + const body = this.$t('Added observation', { + salesPersonName: defaulter.salesPersonName, + text: this.defaulter.observation + }); + + params.push({ + subject: this.$t('Comment added to client', {clientFk: defaulter.clientFk}), + body: body, + receiver: `${defaulter.salesPersonName}@verdnatura.es`, + replyTo: `${window.localStorage.lastUser}@verdnatura.es` + }); + } + + this.$http.post(`Mails`, params) .then(() => { + this.vnApp.showMessage(this.$t('Email sended!')); + }); + } + exprBuilder(param, value) { switch (param) { case 'creditInsurance': diff --git a/modules/client/front/defaulter/locale/es.yml b/modules/client/front/defaulter/locale/es.yml index c3e1d4e19..a301a50e0 100644 --- a/modules/client/front/defaulter/locale/es.yml +++ b/modules/client/front/defaulter/locale/es.yml @@ -6,4 +6,8 @@ Last observation: Última observación L. O. Date: Fecha Ú. O. Last observation date: Fecha última observación Search client: Buscar clientes -Worker who made the last observation: Trabajador que ha realizado la última observación \ No newline at end of file +Worker who made the last observation: Trabajador que ha realizado la última observación +Added observation: '{{salesPersonName}} añadió esta observacion: {{text}}' +Comment added to client: Observación añadida al cliente {{clientFk}} +Email sended!: Email enviado! +Observation saved!: Observación añadida!