Merge branch 'dev' of ssh://git.verdnatura.es:/var/lib/git/salix into dev
This commit is contained in:
commit
c4cb0906ad
|
@ -5,7 +5,7 @@ class Controller {
|
|||
this.$ = $scope;
|
||||
this.$state = $state;
|
||||
this.address = {
|
||||
client: parseInt($state.params.id),
|
||||
clientFk: parseInt($state.params.id),
|
||||
enabled: true
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ export default class Paging {
|
|||
this.numItems = 0;
|
||||
$scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated());
|
||||
}
|
||||
$onChanges() {
|
||||
$onChanges(changes) {
|
||||
if (!this.index) return;
|
||||
this.numPerPage = this.index.filter.size;
|
||||
if(changes.total)
|
||||
this.numItems = changes.total.currentValue;
|
||||
}
|
||||
onModelUpdated() {
|
||||
let index = this.index;
|
||||
|
@ -36,7 +38,8 @@ export const NAME = 'vnPaging';
|
|||
export const COMPONENT = {
|
||||
template: require('./index.html'),
|
||||
bindings: {
|
||||
index: '<'
|
||||
index: '<',
|
||||
total: '<'
|
||||
},
|
||||
controller: Paging
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Address",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "AgencyService",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "ClientObservation",
|
||||
"description": "Notas de los clientes.",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ContactChannel",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Country",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Employee",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -25,6 +25,7 @@ module.exports = function(self) {
|
|||
for(let method in disableMethods) {
|
||||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
self.installMethod = function(methodName, filterCb) {
|
||||
|
@ -52,16 +53,17 @@ module.exports = function(self) {
|
|||
path: `/${methodName}`
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.filter = (params, cb) => {
|
||||
let filter = removeEmpty(filterCb(params));
|
||||
this.find(filter, function(err, instances) {
|
||||
if(!err) {
|
||||
cb(null, instances);
|
||||
}
|
||||
})
|
||||
};
|
||||
let filter = removeEmpty(filterCb(params));
|
||||
this.find(filter, function(err, instances) {
|
||||
if(!err)
|
||||
cb(null, instances);
|
||||
})
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function removeEmpty(o) {
|
||||
|
@ -94,3 +96,4 @@ function removeEmpty(o) {
|
|||
function isEmpty(value) {
|
||||
return value === undefined || value === "";
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "PayMethod",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Province",
|
||||
"base": "PersistedModel",
|
||||
"base": "MyModel",
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = function(app) {
|
||||
|
||||
/*function modifyResponse(ctx, model, next) {
|
||||
var result = ctx.result;
|
||||
var status = ctx.res.statusCode;
|
||||
if(Array.isArray(result)){
|
||||
/*app.models.Client.count(null, function (err, count) {
|
||||
if(!err) {
|
||||
ctx.res.set('Count-elements', count);
|
||||
}
|
||||
})
|
||||
ctx.res.set('Count-elements', 3);
|
||||
ctx.res.status(status).next();
|
||||
}
|
||||
}
|
||||
|
||||
app.models.Client.afterRemote('**', modifyResponse);*/
|
||||
|
||||
};
|
Loading…
Reference in New Issue