From e061c019469dbd324f0ff973dd2fb92bef2f50dd Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 31 May 2017 13:47:40 +0200 Subject: [PATCH] =?UTF-8?q?mensajes=20de=20notificaci=C3=B3n=20enviada=20/?= =?UTF-8?q?=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/src/billing-data/billing-data.js | 18 +++++++++++------- client/client/src/billing-data/locale/es.json | 4 +++- .../src/components/searchbar/searchbar.js | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index c5b99cf09..1824a6091 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -3,10 +3,12 @@ import {module} from '../module'; export const NAME = 'vnClientBillingData'; class billingData { - constructor($scope, $http, $timeout) { + constructor($scope, $http, $timeout, vnAppLogger, $translate) { this.$ = $scope; this.http = $http; this.timeout = $timeout; + this.logger = vnAppLogger; + this.translate = $translate; this.payId = null; this.dueDay = null; this.copyData(); @@ -26,10 +28,9 @@ class billingData { checkChanges() { let payId = this.client.payMethodFk || null; let dueDay = this.client.dueDay || null; - let dialog = this.$.sendMail; - if (dialog && (this.payId !== payId || this.dueDay !== dueDay)) { - dialog.show(); + if (this.payId !== payId || this.dueDay !== dueDay) { + this.$.sendMail.show(); return false; } @@ -37,16 +38,19 @@ class billingData { } returnDialog(response) { if (response === 'ACCEPT') { - this.sendMail(); + this.sendMail().then( + () => this.logger.showMessage(this.translate.instant('Notification sent!')), + () => this.logger.showMessage(this.translate.instant('Notification error')) + ); } this.timeout(() => this.$.watcher.submit()); } sendMail() { - this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); + return this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); } } -billingData.$inject = ['$scope', '$http', '$timeout']; +billingData.$inject = ['$scope', '$http', '$timeout', 'vnAppLogger', '$translate']; export const COMPONENT = { template: require('./billing-data.html'), diff --git a/client/client/src/billing-data/locale/es.json b/client/client/src/billing-data/locale/es.json index df26aa228..f0b6a1213 100644 --- a/client/client/src/billing-data/locale/es.json +++ b/client/client/src/billing-data/locale/es.json @@ -2,5 +2,7 @@ "Changed terms": "Has modificado las condiciones de pago", "Notify customer?" : "¿Deseas notificar al cliente de dichos cambios?", "No": "No", - "Yes, notify": "Sí, notificar" + "Yes, notify": "Sí, notificar", + "Notification sent!": "¡Notificación enviada!", + "Notification error": "Error al enviar notificación" } \ No newline at end of file diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index a010e4b86..2773ef4b4 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -25,7 +25,7 @@ export default class Controller { Object.assign(this.index.filter, filter); this.onSubmit(); } - + onSubmit() { if (this.onSearch) this.onSearch();