This commit is contained in:
Joan Sanchez 2017-05-31 14:56:51 +02:00
commit ce728c2224
3 changed files with 15 additions and 9 deletions

View File

@ -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'),

View File

@ -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"
}