notes: Crear
This commit is contained in:
parent
5e66bef50c
commit
4bc1cf455b
|
@ -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')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue