kanban: asociar envío escrito con cambio de valor
This commit is contained in:
parent
11a402e18c
commit
528dcac06f
|
@ -5,7 +5,7 @@
|
|||
form="form"
|
||||
save="put">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="watcher.submit()" pad-medium>
|
||||
<form name="form" ng-submit="bill.checkChanges() && watcher.submit()" pad-medium>
|
||||
<vn-card margin-small-bottom>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Información de facturación</vn-title>
|
||||
|
@ -41,3 +41,17 @@
|
|||
<vn-submit label="Guardar"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
<vn-dialog
|
||||
vn-id="send-mail"
|
||||
on-response="bill.returnDialog(response)">
|
||||
<tpl-body>
|
||||
<vn-vertical>
|
||||
<vn-one text-center translate>Changed terms</vn-one>
|
||||
<vn-one text-center translate>Notify customer?</vn-one>
|
||||
</vn-vertical>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<button response="CANCEL" translate>No</button>
|
||||
<button response="ACCEPT" translate>Yes, notify</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
|
@ -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: '<'
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -27,3 +27,6 @@ vn-button-bar {
|
|||
display: block;
|
||||
margin-top: $margin-small;
|
||||
}
|
||||
html [text-center], .text-center {
|
||||
text-align: center;
|
||||
}
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue