diff --git a/.vscode/settings.json b/.vscode/settings.json index 1396806be..7197067d1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ // Coloque su configuración en este archivo para sobrescribir la configuración predeterminada y de usuario. { // Carácter predeterminado de final de línea. - "files.eol": "\n" + "files.eol": "\n", + "vsicons.presets.angular": true } \ No newline at end of file diff --git a/client/client/src/client.js b/client/client/src/client.js index 6964a22fc..087663d8f 100644 --- a/client/client/src/client.js +++ b/client/client/src/client.js @@ -28,5 +28,7 @@ export {NAME as CLIENT_CONFIRM_INDEX, COMPONENT as CLIENT_CONFIRM_INDEX_COMPONENT} from './confirm/index'; export {NAME as NEW_NOTE_INDEX, COMPONENT as NEW_NOTE_INDEX_COMPONENT} from './new-note/index'; +export {NAME as CLIENT_PAGING, + COMPONENT as CLIENT_PAGING_COMPONENT} from './index/index-paging'; import './web-access/index'; diff --git a/client/client/src/index/index-paging.html b/client/client/src/index/index-paging.html new file mode 100644 index 000000000..3219051ee --- /dev/null +++ b/client/client/src/index/index-paging.html @@ -0,0 +1,13 @@ +
+ + + + +
diff --git a/client/client/src/index/index-paging.js b/client/client/src/index/index-paging.js new file mode 100644 index 000000000..8766716dd --- /dev/null +++ b/client/client/src/index/index-paging.js @@ -0,0 +1,64 @@ +import template from './index-paging.html'; +import {module} from '../module'; + +export const NAME = 'vnPagingClient'; +export const COMPONENT = { + template: template, + bindings: { + filter: '<', + clients: '=' + }, + controllerAs: 'pagingClient', + controller: function($http) { + var self = this; + let queryStr = '/client/api/Clients'; + let where = this.filter; + let numPerPage = 3; + + this.$onChanges = function(changes) { + if (Object.keys(self.filter).length > 0){ + where = self.filter; + this.getClients(); + this.getNumPages(); + } + else { + where = ""; + this.currentPage = 1; + this.getAllClients(); + } + this.figureOutToDisplay(); + }; + + this.getNumPages = () => { + var nPages = self.clients.length / numPerPage; + this.numPages = Math.ceil(nPages); + }; + + this.figureOutToDisplay = () => { + var begin = ((this.currentPage - 1) * numPerPage); + this.getClients(begin); + }; + + this.getAllClients = () => { + $http.get(queryStr).then( + json => { + self.clients = json.data; + this.getNumPages(); + } + ); + }; + + this.getClients = function(end) { + var json = JSON.stringify({where: where, limit: numPerPage, skip: end}); + self.queryStr = `${queryStr}?filter=${json}`; + $http.get(self.queryStr).then( + json => { + self.clients = json.data; + } + ); + }; + } +}; + +COMPONENT.controller.$inject = ['$http']; +module.component(NAME, COMPONENT); diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html index 48a9511e1..3cc5d33a2 100644 --- a/client/client/src/index/index.html +++ b/client/client/src/index/index.html @@ -13,6 +13,7 @@ + diff --git a/client/client/src/index/index.js b/client/client/src/index/index.js index 5dea90cce..ce2814ae0 100644 --- a/client/client/src/index/index.js +++ b/client/client/src/index/index.js @@ -7,11 +7,10 @@ export const COMPONENT = { template: template, controllerAs: 'search', controller: function($http) { - this.clients = []; + var self = this; this.find = function() { - var where = null; + var where = {}; var filter = this.filter; - var queryStr = '/client/api/Clients'; var search = filter.search; if (search) where = {name: {ilike: search}}; @@ -31,19 +30,14 @@ export const COMPONENT = { if (partials[param]) where[param] = {ilike: params[param]}; else - where[param] = params[param]; + where[param] = params[param]; } filter.params = undefined; } if (where) { - let json = JSON.stringify({where: where}); - queryStr = `${queryStr}?filter=${json}`; + self.filter = where; } - - $http.get(queryStr).then( - json => this.clients = json.data - ); }; this.filter = {}; this.find(); diff --git a/client/client/src/index/item-client.html b/client/client/src/index/item-client.html index c3d2b77ce..408a72bf7 100644 --- a/client/client/src/index/item-client.html +++ b/client/client/src/index/item-client.html @@ -4,4 +4,4 @@
Teléfono: {{itemClient.client.phone}}
Población: {{itemClient.client.city}}
email: {{itemClient.client.email}}
-
\ No newline at end of file + diff --git a/db.json b/db.json index cea257b0e..02c2c54af 100644 --- a/db.json +++ b/db.json @@ -2,7 +2,7 @@ "ids": { "User": 2, "AccessToken": 2, - "Client": 20, + "Client": 21, "PaymentMethod": 4, "SalesPerson": 11, "Address": 83, @@ -24,7 +24,8 @@ "14": "{\"name\":\"Cliente 1\",\"id\":14,\"street\":\"Aaaaaaaaaa\",\"fi\":\"1234567890A\",\"socialName\":\"Cliente 1\",\"fax\":\"963242100\",\"dischargeDate\":\"01/01/2017\",\"telefono\":\"963242100\",\"salesPerson\":\"2\",\"email\":\"informatica@verdnatura.es\",\"city\":\"asdf\",\"postcode\":\"asdf\",\"phone\":\"asdf\",\"mobile\":\"asdf\",\"credit\":2345,\"cyc\":56,\"iban\":\"asdf\",\"dueDay\":345,\"gestdoc\":2435,\"surcharge\":true,\"navigate\":true}", "15": "{\"name\":\"Florsiteria Pepa\",\"fi\":\"12341234rasf\",\"socialName\":\"asdfasd\",\"dueDay\":5,\"id\":15,\"payMethod\":\"2\",\"salesPerson\":\"1\",\"modify\":\"BasicData\",\"iban\":\"sdfgsdfgsdfg\",\"email\":\"pepa@flores.es\"}", "16": "{\"name\":\"Floristeria Antonieta\",\"fi\":\"2345234523d\",\"socialName\":\"23452345assdfgsdfgt\",\"active\":true,\"dueDay\":5,\"id\":16,\"modify\":\"FiscalData\",\"email\":\"antonieta@gmail.com\",\"phone\":\"654654654\",\"mobile\":\"654456456\",\"fax\":\"456456456\",\"street\":\"asdfasdf\",\"salesPerson\":8}", - "19": "{\"name\":\"Planticas Eustaquio\",\"fi\":\"789456123B\",\"socialName\":\"Eustaquio Martinez\",\"active\":true,\"dueDay\":5,\"id\":19,\"email\":\"peustaquio@hotmail.es\"}" + "19": "{\"name\":\"Planticas Eustaquio\",\"fi\":\"789456123B\",\"socialName\":\"Eustaquio Martinez\",\"active\":true,\"dueDay\":5,\"id\":19,\"email\":\"peustaquio@hotmail.es\"}", + "20": "{\"name\":\"Vicente Falco\",\"fi\":\"73773536R\",\"socialName\":\"vicente falco\",\"active\":true,\"dueDay\":5,\"id\":20,\"phone\":\"963258073\",\"mobile\":\"636898196\",\"fax\":\"636898196\",\"email\":\"vicente.falco@gmail.com\"}" }, "PaymentMethod": { "1": "{\"name\":\"Tarjeta\",\"id\":1}", diff --git a/services/nginx/logs/error.log b/services/nginx/logs/error.log index 829a7a1c9..c55b819ca 100644 --- a/services/nginx/logs/error.log +++ b/services/nginx/logs/error.log @@ -53,3 +53,14 @@ 2017/01/16 08:26:22 [notice] 1256#3772: signal process started 2017/01/17 13:27:35 [notice] 7104#204: signal process started 2017/01/17 13:38:00 [notice] 1592#8484: signal process started +2017/02/03 11:15:49 [notice] 4528#1708: signal process started +2017/02/03 11:26:13 [notice] 11816#3532: signal process started +2017/02/03 11:29:20 [notice] 10596#10772: signal process started +2017/02/03 11:48:22 [notice] 11236#6496: signal process started +2017/02/06 12:27:21 [notice] 8676#5728: signal process started +2017/02/06 12:27:21 [error] 8676#5728: OpenEvent("Global\ngx_stop_6316") failed (2: FormatMessage() error:(15100)) +2017/02/06 12:28:24 [notice] 9840#6896: signal process started +2017/02/06 14:34:18 [notice] 6568#9564: signal process started +2017/02/07 07:05:55 [notice] 3804#4508: signal process started +2017/02/07 07:05:55 [error] 3804#4508: OpenEvent("Global\ngx_stop_6996") failed (2: FormatMessage() error:(15100)) +2017/02/07 12:56:15 [notice] 9668#8064: signal process started