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.$ = $scope;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
this.address = {
|
this.address = {
|
||||||
client: parseInt($state.params.id),
|
clientFk: parseInt($state.params.id),
|
||||||
enabled: true
|
enabled: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,11 @@ export default class Paging {
|
||||||
this.numItems = 0;
|
this.numItems = 0;
|
||||||
$scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated());
|
$scope.$watch('$ctrl.index.model.length', () => this.onModelUpdated());
|
||||||
}
|
}
|
||||||
$onChanges() {
|
$onChanges(changes) {
|
||||||
if (!this.index) return;
|
if (!this.index) return;
|
||||||
this.numPerPage = this.index.filter.size;
|
this.numPerPage = this.index.filter.size;
|
||||||
|
if(changes.total)
|
||||||
|
this.numItems = changes.total.currentValue;
|
||||||
}
|
}
|
||||||
onModelUpdated() {
|
onModelUpdated() {
|
||||||
let index = this.index;
|
let index = this.index;
|
||||||
|
@ -36,7 +38,8 @@ export const NAME = 'vnPaging';
|
||||||
export const COMPONENT = {
|
export const COMPONENT = {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
bindings: {
|
bindings: {
|
||||||
index: '<'
|
index: '<',
|
||||||
|
total: '<'
|
||||||
},
|
},
|
||||||
controller: Paging
|
controller: Paging
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Address",
|
"name": "Address",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "AgencyService",
|
"name": "AgencyService",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ClientObservation",
|
"name": "ClientObservation",
|
||||||
"description": "Notas de los clientes.",
|
"description": "Notas de los clientes.",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ContactChannel",
|
"name": "ContactChannel",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Country",
|
"name": "Country",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Employee",
|
"name": "Employee",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -25,6 +25,7 @@ module.exports = function(self) {
|
||||||
for(let method in disableMethods) {
|
for(let method in disableMethods) {
|
||||||
//this.disableRemoteMethod(method, disableMethods[method]);
|
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.installMethod = function(methodName, filterCb) {
|
self.installMethod = function(methodName, filterCb) {
|
||||||
|
@ -56,12 +57,13 @@ module.exports = function(self) {
|
||||||
this.filter = (params, cb) => {
|
this.filter = (params, cb) => {
|
||||||
let filter = removeEmpty(filterCb(params));
|
let filter = removeEmpty(filterCb(params));
|
||||||
this.find(filter, function(err, instances) {
|
this.find(filter, function(err, instances) {
|
||||||
if(!err) {
|
if(!err)
|
||||||
cb(null, instances);
|
cb(null, instances);
|
||||||
}
|
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeEmpty(o) {
|
function removeEmpty(o) {
|
||||||
|
@ -94,3 +96,4 @@ function removeEmpty(o) {
|
||||||
function isEmpty(value) {
|
function isEmpty(value) {
|
||||||
return value === undefined || value === "";
|
return value === undefined || value === "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "PayMethod",
|
"name": "PayMethod",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Province",
|
"name": "Province",
|
||||||
"base": "PersistedModel",
|
"base": "MyModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"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