diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html
index 2ead0c2b4..ce695e038 100644
--- a/client/client/src/index/index.html
+++ b/client/client/src/index/index.html
@@ -13,9 +13,9 @@
-
+
-
+
diff --git a/client/core/src/paging/index.js b/client/core/src/paging/index.js
index 3df147c2c..fd17b994e 100644
--- a/client/core/src/paging/index.js
+++ b/client/core/src/paging/index.js
@@ -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
};
diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json
index f779be6d8..73bf81c7a 100644
--- a/services/client/common/models/Address.json
+++ b/services/client/common/models/Address.json
@@ -1,6 +1,6 @@
{
"name": "Address",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/AgencyService.json
index 57c2b51ac..98f742f64 100644
--- a/services/client/common/models/AgencyService.json
+++ b/services/client/common/models/AgencyService.json
@@ -1,6 +1,6 @@
{
"name": "AgencyService",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json
index 59f86dcc9..ed4a46d8d 100644
--- a/services/client/common/models/ClientObservation.json
+++ b/services/client/common/models/ClientObservation.json
@@ -1,7 +1,7 @@
{
"name": "ClientObservation",
"description": "Notas de los clientes.",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/ContactChannel.json b/services/client/common/models/ContactChannel.json
index bfacd0926..980de5ccc 100644
--- a/services/client/common/models/ContactChannel.json
+++ b/services/client/common/models/ContactChannel.json
@@ -1,6 +1,6 @@
{
"name": "ContactChannel",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json
index d695b24bd..09b96d858 100644
--- a/services/client/common/models/Country.json
+++ b/services/client/common/models/Country.json
@@ -1,6 +1,6 @@
{
"name": "Country",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/Employee.json b/services/client/common/models/Employee.json
index 3218933d8..58ebf605a 100644
--- a/services/client/common/models/Employee.json
+++ b/services/client/common/models/Employee.json
@@ -1,6 +1,6 @@
{
"name": "Employee",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/MyModel.js b/services/client/common/models/MyModel.js
index 6bf440d1a..d21be2697 100644
--- a/services/client/common/models/MyModel.js
+++ b/services/client/common/models/MyModel.js
@@ -25,6 +25,12 @@ module.exports = function(self) {
for(let method in disableMethods) {
//this.disableRemoteMethod(method, disableMethods[method]);
}
+
+ var find = self.find;
+ self.find = function(filter,cb){
+ cb(null,'This is a overridden method')
+ }
+ console.log(self.find);
}
self.installMethod = function(methodName, filterCb) {
@@ -55,9 +61,30 @@ module.exports = function(self) {
this.filter = (params, cb) => {
let filter = removeEmpty(filterCb(params));
+ data = {};
+ function check () {
+ if (data.count && data.instances)
+ cb(null, data);
+ }
+ function error(){
+ cb(null, data);
+ }
+ this.count(filter, function (err, count) {
+ if(!err) {
+ data.count = count;
+ check();
+ }
+ else{
+ error();
+ }
+ })
this.find(filter, function(err, instances) {
if(!err) {
- cb(null, instances);
+ data.instances = instances;
+ check();
+ }
+ else{
+ error();
}
})
};
@@ -94,3 +121,4 @@ function removeEmpty(o) {
function isEmpty(value) {
return value === undefined || value === "";
}
+
diff --git a/services/client/common/models/PayMethod.json b/services/client/common/models/PayMethod.json
index 2ead866a0..c55589137 100644
--- a/services/client/common/models/PayMethod.json
+++ b/services/client/common/models/PayMethod.json
@@ -1,6 +1,6 @@
{
"name": "PayMethod",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {
diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json
index 777f34310..b285bd419 100644
--- a/services/client/common/models/Province.json
+++ b/services/client/common/models/Province.json
@@ -1,6 +1,6 @@
{
"name": "Province",
- "base": "PersistedModel",
+ "base": "MyModel",
"validateUpsert": true,
"properties": {
"id": {