notes: Crear

This commit is contained in:
Vicente Falco 2017-03-10 11:18:16 +01:00
parent 5e66bef50c
commit 4bc1cf455b
3 changed files with 7 additions and 8 deletions

View File

@ -11,7 +11,7 @@ class Controller {
}; };
} }
onSubmit() { onSubmit() {
this.element.querySelector('vn-watcher').$ctrl.submit().then ( this.element.querySelector('vn-watcher').$ctrl.submit().then(
() => this.$state.go('clientCard.notes') () => this.$state.go('clientCard.notes')
); );
} }

View File

@ -1,12 +1,11 @@
module.exports = function(ClientObservation) { module.exports = function(ClientObservation) {
ClientObservation.validate('text', isEnabled, {message: 'Se debe rellenar el campo de texto'});
ClientObservation.validate('text',isEnabled,{message: 'Se debe rellenar el campo de texto'});
function isEnabled(err) { function isEnabled(err) {
if (!this.text) err(); if (!this.text) err();
} }
ClientObservation.observe('before save', function (ctx, next) { ClientObservation.observe('before save', function(ctx, next) {
ctx.instance.creationDate = Date(); ctx.instance.creationDate = Date();
next(); next();
}); });
}; };

View File

@ -24,9 +24,9 @@
"model": "SalesPerson", "model": "SalesPerson",
"foreignKey": "id" "foreignKey": "id"
}, },
"client": { "clients": {
"type": "hasOne",
"model": "Client", "model": "Client",
"type": "belongsTo",
"foreignKey": "id" "foreignKey": "id"
} }
} }