From 528dcac06fdcc3b60f753537c8308743b1bd5b10 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 31 May 2017 12:56:37 +0200 Subject: [PATCH] =?UTF-8?q?kanban:=20asociar=20env=C3=ADo=20escrito=20con?= =?UTF-8?q?=20cambio=20de=20valor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/src/billing-data/billing-data.html | 18 ++++++- .../client/src/billing-data/billing-data.js | 48 +++++++++++++++++++ client/client/src/billing-data/locale/es.json | 6 +++ client/salix/src/styles/misc.scss | 3 ++ services/mailer/Application/router.js | 2 +- 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 client/client/src/billing-data/locale/es.json diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index a001ba49e..74180d36e 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -5,7 +5,7 @@ form="form" save="put"> -
+ Información de facturación @@ -40,4 +40,18 @@ - \ No newline at end of file + + + + + Changed terms + Notify customer? + + + + + + + \ No newline at end of file diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 7c70b46af..c5b99cf09 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -1,8 +1,56 @@ import {module} from '../module'; export const NAME = 'vnClientBillingData'; + +class billingData { + constructor($scope, $http, $timeout) { + this.$ = $scope; + this.http = $http; + this.timeout = $timeout; + this.payId = null; + this.dueDay = null; + this.copyData(); + } + + $onChanges(changes) { + this.copyData(); + } + + copyData() { + if (this.client) { + this.payId = this.client.payMethod ? this.client.payMethod.id : null; + this.dueDay = this.client.dueDay ? this.client.dueDay : null; + } + } + + 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(); + return false; + } + + return true; + } + returnDialog(response) { + if (response === 'ACCEPT') { + this.sendMail(); + } + this.timeout(() => this.$.watcher.submit()); + } + + sendMail() { + this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); + } +} +billingData.$inject = ['$scope', '$http', '$timeout']; + export const COMPONENT = { template: require('./billing-data.html'), + controller: billingData, controllerAs: 'bill', bindings: { client: '<' diff --git a/client/client/src/billing-data/locale/es.json b/client/client/src/billing-data/locale/es.json new file mode 100644 index 000000000..5c4e720d7 --- /dev/null +++ b/client/client/src/billing-data/locale/es.json @@ -0,0 +1,6 @@ +{ + "Changed terms": "Has modificado las condiciones de pago", + "Notify customer?" : "¿Deseas notificar al cliente con dichos cambios?", + "No": "No", + "Yes, notify": "Sí, notificar" +} \ No newline at end of file diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 6b8523aab..1146d9c0f 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -26,4 +26,7 @@ html [fixed-bottom-right] { vn-button-bar { display: block; margin-top: $margin-small; +} +html [text-center], .text-center { + text-align: center; } \ No newline at end of file diff --git a/services/mailer/Application/router.js b/services/mailer/Application/router.js index 6bc5e60bf..c18f908a9 100644 --- a/services/mailer/Application/router.js +++ b/services/mailer/Application/router.js @@ -4,7 +4,7 @@ var settings = require('./settings.js'); // Página por defecto router.get('/', function(request, response) { - response.send(Settings.name + ' v' + settings.version); + response.send(settings.name + ' v' + settings.version); }); // Rutas de los escritos.