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();