From 27d086843ff5daafd472e4c91fcc57356d45dd96 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Thu, 11 May 2017 12:07:33 +0200 Subject: [PATCH 001/391] Jenkins - Docker --- Jenkinsfile | 68 ++++++++++++++++++++++++++++++++++++++ services/auth/Dockerfile | 4 ++- services/client/Dockerfile | 4 ++- services/nginx/Dockerfile | 6 ++-- services/salix/Dockerfile | 4 ++- 5 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..c4d8b09406 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,68 @@ +#!groovy + +def image; +def branchName = "${env.BRANCH_NAME}"; +def branchNameTest = "preprod"; +def branchNameProd = "master"; +def prefixDocker = "test"; +def dockerNginxName = "nginx"; +def dockerAuthName = "auth"; +def dockerSalixName = "salix" +def dockerClientName = "client" +def buildNumber = "${env.BUILD_NUMBER}"; +String[] dockers = [dockerNginxName, dockerAuthName, dockerSalixName, dockerClientName]; + +node { + + if (branchName == branchNameProd) + prefixDocker = "prod"; + + stage ('Checkout') { + checkout scm + } + + stage ('build Project Salix'){ + sh "gulp build" + } + + for (int i = 0; i < dockers.size(); i++) + { + def element = dockers[i]; + stage ("docker ${element}") + { + stage ("Stopping ${prefixDocker}-${element} actual") + { + try + { + def returnDocker = sh (script: "docker stop ${prefixDocker}-${element}", returnStdout: true).trim(); + echo "${returnDocker}"; + returnDocker = sh (script: "docker rm ${prefixDocker}-${element}", returnStdout: true).trim(); + echo "${returnDocker}"; + returnDocker = sh (script: "docker -force rmi ${prefixDocker}-${element}:${buildNumber-1}", returnStdout: true).trim(); + echo "${returnDocker}"; + }catch(Exception _){ + echo "Error Stage Stopping" + } + } + stage ("Create Docker Image ${element}") { + dir("./services/${element}"){ + stage ("Install modules service ${element}"){ + if (fileExists('./package.json')) + sh "npm i" + } + stage("Build image ${element}"){ + image = docker.build("${prefixDocker}-${element}:${buildNumber}", ".") + } + } + } + stage ("Run Docker ${element}"){ + image.run ("--name ${prefixDocker}-${element}") + } + /* + stage('docker registry'){ + docker.withServer('tcp://harbor.verdnatura.es','docker-registry') + } + */ + } + } +} \ No newline at end of file diff --git a/services/auth/Dockerfile b/services/auth/Dockerfile index 9c80229536..ef4e55eb26 100644 --- a/services/auth/Dockerfile +++ b/services/auth/Dockerfile @@ -6,4 +6,6 @@ WORKDIR /app RUN npm install -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] + +EXPOSE 3000:3000 diff --git a/services/client/Dockerfile b/services/client/Dockerfile index afb62ac9aa..69792567db 100644 --- a/services/client/Dockerfile +++ b/services/client/Dockerfile @@ -6,4 +6,6 @@ WORKDIR /app RUN npm install -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] + +EXPOSE 3002:3002 \ No newline at end of file diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index ff059ad87f..bd0d86399b 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -4,6 +4,8 @@ RUN rm /etc/nginx/nginx.conf RUN rm /etc/nginx/conf.d/default.conf -COPY conf-prod.conf /etc/nginx/nginx.conf +COPY conf-prod.conf /etc/nginx/nginx.conf -COPY build /etc/nginx \ No newline at end of file +COPY static /usr/share/nginx/html + +EXPOSE 80:8080 \ No newline at end of file diff --git a/services/salix/Dockerfile b/services/salix/Dockerfile index afb62ac9aa..41cc0e1a2a 100644 --- a/services/salix/Dockerfile +++ b/services/salix/Dockerfile @@ -6,4 +6,6 @@ WORKDIR /app RUN npm install -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] + +EXPOSE 3001:3001 \ No newline at end of file From 8ce3325f064d3bbb57ab68d5821761edbff3662d Mon Sep 17 00:00:00 2001 From: nelo Date: Thu, 11 May 2017 14:19:43 +0200 Subject: [PATCH 002/391] Renombrado Chanel a ContactChannel --- client/client/src/basic-data/index.html | 4 ++-- client/client/src/notes/index.html | 2 +- services/client/common/models/Client.json | 4 ++-- .../client/common/models/{Chanel.json => ContactChannel.json} | 2 +- services/client/server/model-config.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename services/client/common/models/{Chanel.json => ContactChannel.json} (93%) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index a97fa3b842..885018df8a 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -29,8 +29,8 @@ label="Comercial"> diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html index c276409fd5..39116d95b1 100644 --- a/client/client/src/notes/index.html +++ b/client/client/src/notes/index.html @@ -4,7 +4,7 @@
{{n.creationTime | date:'dd/MM/yyyy HH:mm'}}
-
{{n.employeeFk}}
+
{{n.employeeFk.name}}
{{n.text}}
diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index d961bbe4c0..4d621b0830 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -147,8 +147,8 @@ }, "chanelFK":{ "type": "hasOne", - "model": "Chanel", - "foreignKey": "chanelFK" + "model": "ContactChannel", + "foreignKey": "contactChannelFk" } }, "acls": [ diff --git a/services/client/common/models/Chanel.json b/services/client/common/models/ContactChannel.json similarity index 93% rename from services/client/common/models/Chanel.json rename to services/client/common/models/ContactChannel.json index ec2edcacbe..bfacd0926e 100644 --- a/services/client/common/models/Chanel.json +++ b/services/client/common/models/ContactChannel.json @@ -1,5 +1,5 @@ { - "name": "Chanel", + "name": "ContactChannel", "base": "PersistedModel", "validateUpsert": true, "properties": { diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index b2190fdaac..61816602b7 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -70,7 +70,7 @@ "dataSource": "vn", "public": true }, - "Chanel": { + "ContactChannel": { "dataSource": "vn", "public": true } From b7fb0bca982e0144812e7eeced32c969c0b6e22a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 May 2017 11:14:55 +0200 Subject: [PATCH 003/391] Relaciones arregladas --- services/client/common/models/Address.json | 25 +++----- .../client/common/models/AgencyService.json | 18 ++++-- services/client/common/models/Client.json | 61 +++++++++---------- .../common/models/ClientObservation.json | 16 ++--- services/client/common/models/Country.json | 12 +++- services/client/common/models/Employee.json | 9 ++- services/client/common/models/Province.json | 23 +++---- services/client/server/model-config.json | 10 +-- 8 files changed, 88 insertions(+), 86 deletions(-) diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json index 648487eb03..1bdf0b7717 100644 --- a/services/client/common/models/Address.json +++ b/services/client/common/models/Address.json @@ -8,9 +8,6 @@ "id": true, "description": "Identifier" }, - "clientFk": { - "type": "Number" - }, "consignee": { "type": "string", "required": true @@ -26,9 +23,6 @@ "postcode": { "type": "string" }, - "provinceFk": { - "type": "Number" - }, "phone": { "type": "string" }, @@ -41,9 +35,6 @@ "default": { "type": "boolean" }, - "defaultAgencyFk": { - "type": "Number" - }, "longitude": { "type": "Number" }, @@ -53,20 +44,20 @@ }, "validations": [], "relations": { - "countryFk": { - "type": "hasOne", - "model": "Country", - "foreignKey": "id" + "provinceFk": { + "type": "belongsTo", + "model": "Province", + "foreignKey": "provinceFk" }, "clientFk": { - "type": "hasOne", + "type": "belongsTo", "model": "Client", - "foreignKey": "id" + "foreignKey": "clientFk" }, "defaultAgencyFk": { - "type": "hasOne", + "type": "belongsTo", "model": "Agency", - "foreignKey": "id" + "foreignKey": "defaultAgencyFk" } }, "acls": [ diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/AgencyService.json index 392c5b9d72..94e6a31985 100644 --- a/services/client/common/models/AgencyService.json +++ b/services/client/common/models/AgencyService.json @@ -15,15 +15,9 @@ "description": { "type": "string" }, - "agencyTypeFk": { - "type": "Number" - }, "m3": { "type": "Number" }, - "agencyFk": { - "type": "Number" - }, "inflation": { "type": "Number" }, @@ -31,6 +25,18 @@ "type": "string" } }, + "relations": { + "agencyFk": { + "type": "belongsTo", + "model": "Agency", + "foreignKey": "agencyFk" + }, + "agencyTypeFk": { + "type": "belongsTo", + "model": "AgencyType", + "foreignKey": "agencyTypeFk" + } + }, "acls": [ { "accessType": "*", diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 4d621b0830..74fadc828d 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -1,13 +1,6 @@ { "name": "Client", "base": "MyModel", - "scopes": { - "test": { - "where": { - "name": "Verdnatura" - } - } - }, "validateUpsert": true, "properties": { "id": { @@ -41,12 +34,6 @@ "postcode": { "type": "string" }, - "provinceFk": { - "type": "Number" - }, - "countryFk": { - "type": "Number" - }, "email": { "type": "string" }, @@ -86,15 +73,6 @@ "type": "boolean", "description": "Send invoices by email" }, - "payMethodFk": { - "type": "Number" - }, - "salesPersonFk": { - "type": "Number" - }, - "contactChannelFk": { - "type": "Number" - }, "sepaVnl": { "type": "boolean" }, @@ -126,29 +104,39 @@ "validations": [], "relations": { "accountFk": { - "type": "hasOne", + "type": "belongsTo", "model": "Account", "foreignKey": "id" }, "payMethodFk": { - "type": "hasOne", + "type": "belongsTo", "model": "PayMethod", - "foreignKey": "id" + "foreignKey": "payMethodFk" }, "salesPersonFk": { - "type": "hasOne", + "type": "belongsTo", "model": "Employee", - "foreignKey": "id" + "foreignKey": "salesPersonFk" + }, + "provinceFk":{ + "type": "belongsTo", + "model": "Province", + "foreignKey": "provinceFk" + }, + "countryFk":{ + "type": "belongsTo", + "model": "Country", + "foreignKey": "countryFk" + }, + "contactChannelFk":{ + "type": "belongsTo", + "model": "ContactChannel", + "foreignKey": "contactChannelFk" }, "addressesFk": { "type": "hasMany", "model": "Address", "foreignKey": "clientFk" - }, - "chanelFK":{ - "type": "hasOne", - "model": "ContactChannel", - "foreignKey": "contactChannelFk" } }, "acls": [ @@ -159,5 +147,12 @@ "permission": "ALLOW" } ], - "methods": {} + "methods": {}, + "scopes": { + "test": { + "where": { + "name": "Verdnatura" + } + } + } } diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index 1895b03466..0acabaa6bf 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -12,28 +12,28 @@ "clientFk": { "type": "Number" }, - "employeeFk": { - "type": "Number" - }, "text": { "type": "string", "description": "Text" }, + "employeeFk": { + "type": "Number" + }, "creationTime": { "type": "date", "description": "Creation date and time" } }, "relations": { - "employeeFk": { - "type": "hasOne", - "model": "Employee", - "foreignKey": "id" - }, "clientFk": { "type": "hasOne", "model": "Client", "foreignKey": "id" + }, + "employeeFk": { + "type": "hasOne", + "model": "Employee", + "foreignKey": "id" } }, "acls": [ diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json index 7305d94fd0..60d295c402 100644 --- a/services/client/common/models/Country.json +++ b/services/client/common/models/Country.json @@ -17,12 +17,18 @@ }, "code": { "type": "string" - }, + } + }, + "relations": { "currencyFk": { - "type": "Number" + "type": "belongsTo", + "model": "Currency", + "foreignKey": "currencyFk" }, "realCountryFk": { - "type": "Number" + "type": "belongsTo", + "model": "Country", + "foreignKey": "realCountryFk" } }, "acls": [ diff --git a/services/client/common/models/Employee.json b/services/client/common/models/Employee.json index d464e9bfcb..482cdf0170 100644 --- a/services/client/common/models/Employee.json +++ b/services/client/common/models/Employee.json @@ -11,10 +11,13 @@ "name": { "type": "string", "required": true - }, + } + }, + "relations": { "userFk": { - "type": "Number", - "required": true + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" } }, "acls": [ diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json index d8dfab67e0..b04ecd7977 100644 --- a/services/client/common/models/Province.json +++ b/services/client/common/models/Province.json @@ -11,22 +11,23 @@ "name": { "type": "string", "required": true - }, - "countryFk": { - "type": "Number" - }, - "warehouseFk": { - "type": "Number" - }, - "zoneFk": { - "type": "Number" } }, "relations": { "countryFk": { - "type": "hasOne", + "type": "belongsTo", "model": "Country", - "foreignKey": "id" + "foreignKey": "countryFk" + }, + "warehouseFk": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "zoneFk": { + "type": "belongsTo", + "model": "Zone", + "foreignKey": "zoneFk" } }, "acls": [ diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 61816602b7..e88f5a3b84 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -42,7 +42,7 @@ "dataSource": "vn", "public": true }, - "Employee": { + "ClientObservation": { "dataSource": "vn", "public": true }, @@ -62,10 +62,6 @@ "dataSource": "vn", "public": true }, - "ClientObservation": { - "dataSource": "vn", - "public": true - }, "Account": { "dataSource": "vn", "public": true @@ -73,5 +69,9 @@ "ContactChannel": { "dataSource": "vn", "public": true + }, + "Employee": { + "dataSource": "vn", + "public": true } } From 89f397da2ca708e5018e372533734ab04fa480d5 Mon Sep 17 00:00:00 2001 From: nelo Date: Fri, 12 May 2017 11:20:32 +0200 Subject: [PATCH 004/391] Arreglado ClientObservation --- .../common/models/ClientObservation.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index 0acabaa6bf..373eeb8214 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -16,24 +16,21 @@ "type": "string", "description": "Text" }, - "employeeFk": { - "type": "Number" - }, "creationTime": { "type": "date", "description": "Creation date and time" } }, "relations": { + "employeeFk": { + "type": "belongsTo", + "model": "Employee", + "foreignKey": "employeeFk" + }, "clientFk": { "type": "hasOne", "model": "Client", "foreignKey": "id" - }, - "employeeFk": { - "type": "hasOne", - "model": "Employee", - "foreignKey": "id" } }, "acls": [ @@ -43,5 +40,8 @@ "principalId": "$everyone", "permission": "ALLOW" } - ] + ], + "scope": { + "include": "employeeFk" + } } From d93c6e18853e572c097b9f8fee4885b6ab17ebae Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Fri, 12 May 2017 12:41:35 +0200 Subject: [PATCH 005/391] Jenkins - Docker --- Jenkinsfile | 29 ++++++++++++++++++----------- services/auth/Dockerfile | 2 +- services/client/Dockerfile | 2 +- services/nginx/Dockerfile | 2 +- services/salix/Dockerfile | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4d8b09406..3f08d4f5d8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,20 @@ -#!groovy +#!/usr/bin/env groovy + +import groovy.json.*; def image; def branchName = "${env.BRANCH_NAME}"; def branchNameTest = "preprod"; def branchNameProd = "master"; def prefixDocker = "test"; -def dockerNginxName = "nginx"; -def dockerAuthName = "auth"; -def dockerSalixName = "salix" -def dockerClientName = "client" +def dockerNginxName = ["nginx", "-p 80:8080 --link test-auth:auth --link test-salix:salix --link test-client:client"] +def dockerAuthName = ["auth", "-p 3000:3000"] +def dockerSalixName = ["salix", "-p 3001:3001"] +def dockerClientName = ["client", "-p 3002:3002"] + def buildNumber = "${env.BUILD_NUMBER}"; -String[] dockers = [dockerNginxName, dockerAuthName, dockerSalixName, dockerClientName]; + +def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerNginxName] node { @@ -25,9 +29,11 @@ node { sh "gulp build" } - for (int i = 0; i < dockers.size(); i++) + for (int i = 0; i < dockers.size(); i++) { - def element = dockers[i]; + def element = dockers[i][0] + def ports = dockers[i][1] + stage ("docker ${element}") { stage ("Stopping ${prefixDocker}-${element} actual") @@ -38,8 +44,9 @@ node { echo "${returnDocker}"; returnDocker = sh (script: "docker rm ${prefixDocker}-${element}", returnStdout: true).trim(); echo "${returnDocker}"; - returnDocker = sh (script: "docker -force rmi ${prefixDocker}-${element}:${buildNumber-1}", returnStdout: true).trim(); - echo "${returnDocker}"; + //returnDocker = sh (script: "docker rmi ${prefixDocker}-${element}:${buildNumber-3}", returnStdout: true).trim(); + echo "borran ${prefixDocker}-${element}:${buildNumber-3}"; + //echo "${returnDocker}"; }catch(Exception _){ echo "Error Stage Stopping" } @@ -56,7 +63,7 @@ node { } } stage ("Run Docker ${element}"){ - image.run ("--name ${prefixDocker}-${element}") + image.run ("${ports} --name ${prefixDocker}-${element}") } /* stage('docker registry'){ diff --git a/services/auth/Dockerfile b/services/auth/Dockerfile index ef4e55eb26..c7f1590cc1 100644 --- a/services/auth/Dockerfile +++ b/services/auth/Dockerfile @@ -8,4 +8,4 @@ RUN npm install CMD ["npm", "start"] -EXPOSE 3000:3000 +EXPOSE 3000 diff --git a/services/client/Dockerfile b/services/client/Dockerfile index 69792567db..865de516e2 100644 --- a/services/client/Dockerfile +++ b/services/client/Dockerfile @@ -8,4 +8,4 @@ RUN npm install CMD ["npm", "start"] -EXPOSE 3002:3002 \ No newline at end of file +EXPOSE 3002 \ No newline at end of file diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index bd0d86399b..727770d37e 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -8,4 +8,4 @@ COPY conf-prod.conf /etc/nginx/nginx.conf COPY static /usr/share/nginx/html -EXPOSE 80:8080 \ No newline at end of file +EXPOSE 8080 \ No newline at end of file diff --git a/services/salix/Dockerfile b/services/salix/Dockerfile index 41cc0e1a2a..9addf39cb5 100644 --- a/services/salix/Dockerfile +++ b/services/salix/Dockerfile @@ -8,4 +8,4 @@ RUN npm install CMD ["npm", "start"] -EXPOSE 3001:3001 \ No newline at end of file +EXPOSE 3001 \ No newline at end of file From a9212721f148f675f702fe82bfeb369afc40d2fb Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Fri, 12 May 2017 13:14:52 +0200 Subject: [PATCH 006/391] docker nginx conf --- services/nginx/conf-prod.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index e0c9529b1d..c2a028fa85 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -25,15 +25,15 @@ http { } location ~ ^/auth(?:/(.*))?$ { - proxy_pass http://192.168.99.100:3000/$1$is_args$args; + proxy_pass http://test-auth:3000/$1$is_args$args; } location ~ ^/salix(?:/(.*))?$ { - proxy_pass http://192.168.99.100:3001/$1$is_args$args; + proxy_pass http://test-salix:3001/$1$is_args$args; } location ~ ^/client(?:/(.*))?$ { - proxy_pass http://192.168.99.100:3002/$1$is_args$args; + proxy_pass http://test-client:3002/$1$is_args$args; } } } \ No newline at end of file From ebb59d1eefb51d66af80ee4a3dd3f117c4c12cbf Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 May 2017 13:36:12 +0200 Subject: [PATCH 007/391] Errores en relaciones solucionados --- client/client/src/card/index.js | 2 +- services/client/common/models/Address.json | 6 ++--- .../client/common/models/AgencyService.json | 4 ++-- services/client/common/models/Client.json | 22 ++++++++++--------- .../common/models/ClientObservation.json | 4 ++-- services/client/common/models/Country.json | 4 ++-- services/client/common/models/Employee.json | 2 +- services/client/common/models/Province.json | 6 ++--- 8 files changed, 26 insertions(+), 24 deletions(-) diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js index aa61f87706..514950de79 100644 --- a/client/client/src/card/index.js +++ b/client/client/src/card/index.js @@ -7,7 +7,7 @@ export const COMPONENT = { controllerAs: 'card', controller: function($http, $stateParams) { this.client = null; - $http.get(`/client/api/Clients/${$stateParams.id}?filter[include][accountFk]`).then( + $http.get(`/client/api/Clients/${$stateParams.id}?filter[include][account]`).then( json => this.client = json.data ); diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json index 1bdf0b7717..f779be6d87 100644 --- a/services/client/common/models/Address.json +++ b/services/client/common/models/Address.json @@ -44,17 +44,17 @@ }, "validations": [], "relations": { - "provinceFk": { + "province": { "type": "belongsTo", "model": "Province", "foreignKey": "provinceFk" }, - "clientFk": { + "client": { "type": "belongsTo", "model": "Client", "foreignKey": "clientFk" }, - "defaultAgencyFk": { + "defaultAgency": { "type": "belongsTo", "model": "Agency", "foreignKey": "defaultAgencyFk" diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/AgencyService.json index 94e6a31985..57c2b51ac5 100644 --- a/services/client/common/models/AgencyService.json +++ b/services/client/common/models/AgencyService.json @@ -26,12 +26,12 @@ } }, "relations": { - "agencyFk": { + "agency": { "type": "belongsTo", "model": "Agency", "foreignKey": "agencyFk" }, - "agencyTypeFk": { + "agencyType": { "type": "belongsTo", "model": "AgencyType", "foreignKey": "agencyTypeFk" diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 74fadc828d..c350ea2245 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -94,46 +94,48 @@ "isRelevant": { "type": "boolean" }, - "typeFk": { - "type": "Number" - }, "accountingAccount": { "type": "string" } }, "validations": [], "relations": { - "accountFk": { + "account": { "type": "belongsTo", "model": "Account", "foreignKey": "id" }, - "payMethodFk": { + "payMethod": { "type": "belongsTo", "model": "PayMethod", "foreignKey": "payMethodFk" }, - "salesPersonFk": { + "salesPerson": { "type": "belongsTo", "model": "Employee", "foreignKey": "salesPersonFk" }, - "provinceFk":{ + "province":{ "type": "belongsTo", "model": "Province", "foreignKey": "provinceFk" }, - "countryFk":{ + "country":{ "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, - "contactChannelFk":{ + "contactChannel":{ "type": "belongsTo", "model": "ContactChannel", "foreignKey": "contactChannelFk" }, - "addressesFk": { + "type": { + "type": "belongsTo", + "model": "ClientType", + "foreignKey": "typeFk" + }, + "addresses": { "type": "hasMany", "model": "Address", "foreignKey": "clientFk" diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index 373eeb8214..ed39aaccaf 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -22,12 +22,12 @@ } }, "relations": { - "employeeFk": { + "employee": { "type": "belongsTo", "model": "Employee", "foreignKey": "employeeFk" }, - "clientFk": { + "client": { "type": "hasOne", "model": "Client", "foreignKey": "id" diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json index 60d295c402..d695b24bd0 100644 --- a/services/client/common/models/Country.json +++ b/services/client/common/models/Country.json @@ -20,12 +20,12 @@ } }, "relations": { - "currencyFk": { + "currency": { "type": "belongsTo", "model": "Currency", "foreignKey": "currencyFk" }, - "realCountryFk": { + "realCountry": { "type": "belongsTo", "model": "Country", "foreignKey": "realCountryFk" diff --git a/services/client/common/models/Employee.json b/services/client/common/models/Employee.json index 482cdf0170..3218933d87 100644 --- a/services/client/common/models/Employee.json +++ b/services/client/common/models/Employee.json @@ -14,7 +14,7 @@ } }, "relations": { - "userFk": { + "user": { "type": "belongsTo", "model": "Account", "foreignKey": "userFk" diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json index b04ecd7977..777f343106 100644 --- a/services/client/common/models/Province.json +++ b/services/client/common/models/Province.json @@ -14,17 +14,17 @@ } }, "relations": { - "countryFk": { + "country": { "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, - "warehouseFk": { + "warehouse": { "type": "belongsTo", "model": "Warehouse", "foreignKey": "warehouseFk" }, - "zoneFk": { + "zone": { "type": "belongsTo", "model": "Zone", "foreignKey": "zoneFk" From 88992438e225fbf171767ec54bf2f794f6b84c94 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 May 2017 13:58:08 +0200 Subject: [PATCH 008/391] Errores solucionados --- client/client/src/new-note/index.js | 2 +- client/client/src/notes/index.html | 2 +- services/client/common/models/ClientObservation.js | 1 + services/client/common/models/ClientObservation.json | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/client/src/new-note/index.js b/client/client/src/new-note/index.js index e4001c6889..d69fa470e5 100644 --- a/client/client/src/new-note/index.js +++ b/client/client/src/new-note/index.js @@ -6,7 +6,7 @@ class Controller { this.element = $element[0]; this.$state = $state; this.note = { - client: $state.params.id, + clientFk: $state.params.id, text: null }; } diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html index 39116d95b1..3a1f6df4a9 100644 --- a/client/client/src/notes/index.html +++ b/client/client/src/notes/index.html @@ -4,7 +4,7 @@
{{n.creationTime | date:'dd/MM/yyyy HH:mm'}}
-
{{n.employeeFk.name}}
+
{{n.employee.name}}
{{n.text}}
diff --git a/services/client/common/models/ClientObservation.js b/services/client/common/models/ClientObservation.js index 046baf646f..84ddbc9d3b 100644 --- a/services/client/common/models/ClientObservation.js +++ b/services/client/common/models/ClientObservation.js @@ -6,6 +6,7 @@ module.exports = function(ClientObservation) { ClientObservation.observe('before save', function(ctx, next) { ctx.instance.creationDate = Date(); + ctx.instance.employeeFk = 20; next(); }); }; diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index ed39aaccaf..af4b60d42b 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -42,6 +42,6 @@ } ], "scope": { - "include": "employeeFk" + "include": "employee" } } From fbd3f4c623d59c2e6d7961c0d6b5567b637e7cfe Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 May 2017 14:46:19 +0200 Subject: [PATCH 009/391] Errores solucionados --- client/client/src/basic-data/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index 885018df8a..8e089af4b6 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -29,7 +29,7 @@ label="Comercial">
Date: Fri, 12 May 2017 14:47:15 +0200 Subject: [PATCH 010/391] Jenkinsfile --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3f08d4f5d8..6e864b77f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,6 +25,10 @@ node { checkout scm } + stage ('install modules'){ + sh "npm install" + } + stage ('build Project Salix'){ sh "gulp build" } From af49f03e19727e6956e23d6a5a39cf39e6f4499a Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Fri, 12 May 2017 14:52:44 +0200 Subject: [PATCH 011/391] merge --- client/client/src/basic-data/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index 885018df8a..8e089af4b6 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -29,7 +29,7 @@ label="Comercial"> Date: Fri, 12 May 2017 15:21:37 +0200 Subject: [PATCH 012/391] Campos renombrados --- client/client/src/notes/index.html | 2 +- client/client/src/notes/index.js | 2 +- services/client/common/models/Client.json | 6 +++--- services/client/common/models/ClientObservation.js | 2 +- services/client/common/models/ClientObservation.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html index 3a1f6df4a9..f93b183c39 100644 --- a/client/client/src/notes/index.html +++ b/client/client/src/notes/index.html @@ -3,7 +3,7 @@ Notas -
{{n.creationTime | date:'dd/MM/yyyy HH:mm'}}
+
{{n.created | date:'dd/MM/yyyy HH:mm'}}
{{n.employee.name}}
{{n.text}}
diff --git a/client/client/src/notes/index.js b/client/client/src/notes/index.js index 4594701670..7f3fffa90d 100644 --- a/client/client/src/notes/index.js +++ b/client/client/src/notes/index.js @@ -17,7 +17,7 @@ export const COMPONENT = { }; this.getObservation = function(clientId) { - let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'creationTime DESC'}); + let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); $http.get(`/client/api/clientObservations?filter=${json}`).then( json => { this.observations = json.data; diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index c350ea2245..c61676656a 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -19,9 +19,6 @@ "socialName": { "type": "string" }, - "creationTime": { - "type": "string" - }, "contact": { "type": "string" }, @@ -96,6 +93,9 @@ }, "accountingAccount": { "type": "string" + }, + "created": { + "type": "date" } }, "validations": [], diff --git a/services/client/common/models/ClientObservation.js b/services/client/common/models/ClientObservation.js index 84ddbc9d3b..150595f5c6 100644 --- a/services/client/common/models/ClientObservation.js +++ b/services/client/common/models/ClientObservation.js @@ -5,7 +5,7 @@ module.exports = function(ClientObservation) { } ClientObservation.observe('before save', function(ctx, next) { - ctx.instance.creationDate = Date(); + ctx.instance.created = Date(); ctx.instance.employeeFk = 20; next(); }); diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index af4b60d42b..59f86dcc95 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -16,7 +16,7 @@ "type": "string", "description": "Text" }, - "creationTime": { + "created": { "type": "date", "description": "Creation date and time" } From d5da337d52478de57105cc3cf891f6e2098453d6 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 07:53:06 +0200 Subject: [PATCH 013/391] Jenkins - docker nginx --- Jenkinsfile | 2 +- services/nginx/Dockerfile | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6e864b77f6..15a019eb49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ def branchName = "${env.BRANCH_NAME}"; def branchNameTest = "preprod"; def branchNameProd = "master"; def prefixDocker = "test"; -def dockerNginxName = ["nginx", "-p 80:8080 --link test-auth:auth --link test-salix:salix --link test-client:client"] +def dockerNginxName = ["nginx", "-p 80:8080 --cap-add NET_ADMIN --link test-auth:auth --link test-salix:salix --link test-client:client"] def dockerAuthName = ["auth", "-p 3000:3000"] def dockerSalixName = ["salix", "-p 3001:3001"] def dockerClientName = ["client", "-p 3002:3002"] diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 727770d37e..0f88e31f25 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -8,4 +8,8 @@ COPY conf-prod.conf /etc/nginx/nginx.conf COPY static /usr/share/nginx/html +RUN apt-get update && apt-get -y install vim dnsmasq + +RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d + EXPOSE 8080 \ No newline at end of file From 8a9d8c83b64fbc3401600a99937ad7c96be2bd66 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 08:07:30 +0200 Subject: [PATCH 014/391] docker --- services/nginx/Dockerfile | 2 +- services/nginx/conf-prod.conf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 0f88e31f25..ad45cd0831 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -10,6 +10,6 @@ COPY static /usr/share/nginx/html RUN apt-get update && apt-get -y install vim dnsmasq -RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d +RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf EXPOSE 8080 \ No newline at end of file diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index c2a028fa85..a06efe5c1d 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -25,15 +25,15 @@ http { } location ~ ^/auth(?:/(.*))?$ { - proxy_pass http://test-auth:3000/$1$is_args$args; + proxy_pass http://auth:3000/$1$is_args$args; } location ~ ^/salix(?:/(.*))?$ { - proxy_pass http://test-salix:3001/$1$is_args$args; + proxy_pass http://salix:3001/$1$is_args$args; } location ~ ^/client(?:/(.*))?$ { - proxy_pass http://test-client:3002/$1$is_args$args; + proxy_pass http://client:3002/$1$is_args$args; } } } \ No newline at end of file From 77d8a8f0907b4587c4df1143cc10869f659245e3 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 08:33:51 +0200 Subject: [PATCH 015/391] Jenkins --- Jenkinsfile | 2 +- services/nginx/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15a019eb49..7cecefe16c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ def branchName = "${env.BRANCH_NAME}"; def branchNameTest = "preprod"; def branchNameProd = "master"; def prefixDocker = "test"; -def dockerNginxName = ["nginx", "-p 80:8080 --cap-add NET_ADMIN --link test-auth:auth --link test-salix:salix --link test-client:client"] +def dockerNginxName = ["nginx", "-p 80:8080 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"] def dockerAuthName = ["auth", "-p 3000:3000"] def dockerSalixName = ["salix", "-p 3001:3001"] def dockerClientName = ["client", "-p 3002:3002"] diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index ad45cd0831..1ce39be8ea 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -8,7 +8,7 @@ COPY conf-prod.conf /etc/nginx/nginx.conf COPY static /usr/share/nginx/html -RUN apt-get update && apt-get -y install vim dnsmasq +RUN apt-get update && apt-get -y install vim dnsmasq dnsutils RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf From 6a4235a9a23a83066acf2b63389c59de74b4ed65 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 08:47:58 +0200 Subject: [PATCH 016/391] Ajustes conf --- services/nginx/Dockerfile | 2 ++ services/nginx/conf-prod.conf | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 1ce39be8ea..251230964c 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -12,4 +12,6 @@ RUN apt-get update && apt-get -y install vim dnsmasq dnsutils RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf +RUN service dnsmasq restart + EXPOSE 8080 \ No newline at end of file diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index a06efe5c1d..5706e3390b 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -9,7 +9,7 @@ http { sendfile on; gzip on; default_type application/octet-stream; - + resolver 127.0.0.1; include /etc/nginx/mime.types; server { From eacd133d00b5e2a54bae7e74c8b27f145d00dd2c Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 09:03:05 +0200 Subject: [PATCH 017/391] Docker nginx --- services/nginx/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 251230964c..1ce39be8ea 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -12,6 +12,4 @@ RUN apt-get update && apt-get -y install vim dnsmasq dnsutils RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf -RUN service dnsmasq restart - EXPOSE 8080 \ No newline at end of file From d8df17ad0718c8fd2047ded6a054dff1bba71e66 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 15 May 2017 10:44:19 +0200 Subject: [PATCH 018/391] salix routes static --- services/nginx/conf-prod.conf | 2 +- services/salix/client/index.ejs | 2 +- services/salix/server/boot/routes.js | 15 --------------- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index 5706e3390b..490284cab6 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -20,7 +20,7 @@ http { root /usr/share/nginx/html; location /static { - alias public; + alias /usr/share/nginx/html; autoindex on; } diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs index 43239d5afd..83060a29a5 100644 --- a/services/salix/client/index.ejs +++ b/services/salix/client/index.ejs @@ -7,7 +7,7 @@ @@ -16,8 +16,7 @@ src="/static/bundle.vendor.js"> diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 9d2b46078a..7d2bf17e08 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -59,7 +59,8 @@ function encodeUri(object) { if (object[key]) { if (uri.length > 0) uri += '&'; - uri += encodeURIComponent(key) + '=' + encodeURIComponent(object[key]); + uri += encodeURIComponent(key) + '='; + uri += encodeURIComponent(object[key]); } return uri; } From 778ff9a5ecdd42a811be64f84d22e610a1969ebc Mon Sep 17 00:00:00 2001 From: repository Date: Mon, 22 May 2017 07:29:13 +0200 Subject: [PATCH 039/391] intento de commit dani --- client/client/src/index/index.html | 2 +- client/client/src/notes/index.html | 2 +- client/core/src/components.js | 1 + client/core/src/repeat/index.js | 21 +++++++++++++++++++ .../src/components/left-menu/actions.html | 2 +- 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 client/core/src/repeat/index.js diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html index 2ead0c2b4c..df95e637f7 100644 --- a/client/client/src/index/index.html +++ b/client/client/src/index/index.html @@ -13,7 +13,7 @@
- + diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html index a671a353e6..9bbafeca19 100644 --- a/client/client/src/notes/index.html +++ b/client/client/src/notes/index.html @@ -1,7 +1,7 @@ Notas - +
{{n.created | date:'dd/MM/yyyy HH:mm'}}
{{n.employee.name}}
diff --git a/client/core/src/components.js b/client/core/src/components.js index 7a258fd3be..5c21585bac 100644 --- a/client/core/src/components.js +++ b/client/core/src/components.js @@ -12,6 +12,7 @@ import './confirm/index'; import './title/index'; import './subtitle/index'; import './spinner/index'; +import './repeat/index'; export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; diff --git a/client/core/src/repeat/index.js b/client/core/src/repeat/index.js new file mode 100644 index 0000000000..66979daa2d --- /dev/null +++ b/client/core/src/repeat/index.js @@ -0,0 +1,21 @@ +import { module as _module } from '../module'; +import * as constant from '../lib/constants'; +import * as util from '../lib/util'; + +const _NAME = 'repeat'; +export const NAME = util.getName(_NAME); + +directive.$inject = ['$compile', '$timeout']; +function directive($compile, $timeout) { + return { + restrict: 'A', + priority: 9999, + link: function(scope, element, attrs) { + element.removeAttr(`${constant.PREFIX}-${_NAME}`); + element.attr('ng-repeat', attrs[NAME]); + $compile(element)(scope); + } + }; +} + +_module.directive(NAME, directive); diff --git a/client/salix/src/components/left-menu/actions.html b/client/salix/src/components/left-menu/actions.html index b794c7faa9..328efb51ee 100644 --- a/client/salix/src/components/left-menu/actions.html +++ b/client/salix/src/components/left-menu/actions.html @@ -1,5 +1,5 @@
    - +
From cfa1b7d9b57d78472401f980adc09740dff639bd Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 22 May 2017 08:11:53 +0200 Subject: [PATCH 040/391] ng-repeat --- client/client/src/index/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html index df95e637f7..2dbe426e92 100644 --- a/client/client/src/index/index.html +++ b/client/client/src/index/index.html @@ -13,7 +13,7 @@
- + From 04d5f9cf5d5971048408f76339c6056955f6b3c8 Mon Sep 17 00:00:00 2001 From: repository Date: Mon, 22 May 2017 08:23:51 +0200 Subject: [PATCH 041/391] eliminado vn-repeat --- client/client/src/index/index.html | 2 +- client/client/src/notes/index.html | 2 +- client/core/src/components.js | 2 +- client/core/src/repeat/index.js | 4 +- .../src/components/left-menu/actions.html | 2 +- core-util-is/LICENSE | 19 + core-util-is/README.md | 3 + core-util-is/float.patch | 604 ++++++++++++++++++ core-util-is/lib/util.js | 107 ++++ core-util-is/package.json | 95 +++ core-util-is/test.js | 68 ++ services/salix/package.json | 7 +- 12 files changed, 906 insertions(+), 9 deletions(-) create mode 100644 core-util-is/LICENSE create mode 100644 core-util-is/README.md create mode 100644 core-util-is/float.patch create mode 100644 core-util-is/lib/util.js create mode 100644 core-util-is/package.json create mode 100644 core-util-is/test.js diff --git a/client/client/src/index/index.html b/client/client/src/index/index.html index df95e637f7..2dbe426e92 100644 --- a/client/client/src/index/index.html +++ b/client/client/src/index/index.html @@ -13,7 +13,7 @@ - + diff --git a/client/client/src/notes/index.html b/client/client/src/notes/index.html index 9bbafeca19..a671a353e6 100644 --- a/client/client/src/notes/index.html +++ b/client/client/src/notes/index.html @@ -1,7 +1,7 @@ Notas - +
{{n.created | date:'dd/MM/yyyy HH:mm'}}
{{n.employee.name}}
diff --git a/client/core/src/components.js b/client/core/src/components.js index 5c21585bac..121b149ca6 100644 --- a/client/core/src/components.js +++ b/client/core/src/components.js @@ -12,7 +12,7 @@ import './confirm/index'; import './title/index'; import './subtitle/index'; import './spinner/index'; -import './repeat/index'; +// import './repeat/index'; export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; diff --git a/client/core/src/repeat/index.js b/client/core/src/repeat/index.js index 66979daa2d..4a7f3f79de 100644 --- a/client/core/src/repeat/index.js +++ b/client/core/src/repeat/index.js @@ -5,8 +5,8 @@ import * as util from '../lib/util'; const _NAME = 'repeat'; export const NAME = util.getName(_NAME); -directive.$inject = ['$compile', '$timeout']; -function directive($compile, $timeout) { +directive.$inject = ['$compile']; +function directive($compile) { return { restrict: 'A', priority: 9999, diff --git a/client/salix/src/components/left-menu/actions.html b/client/salix/src/components/left-menu/actions.html index 328efb51ee..b794c7faa9 100644 --- a/client/salix/src/components/left-menu/actions.html +++ b/client/salix/src/components/left-menu/actions.html @@ -1,5 +1,5 @@
    - +
diff --git a/core-util-is/LICENSE b/core-util-is/LICENSE new file mode 100644 index 0000000000..d8d7f9437d --- /dev/null +++ b/core-util-is/LICENSE @@ -0,0 +1,19 @@ +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/core-util-is/README.md b/core-util-is/README.md new file mode 100644 index 0000000000..5a76b4149c --- /dev/null +++ b/core-util-is/README.md @@ -0,0 +1,3 @@ +# core-util-is + +The `util.is*` functions introduced in Node v0.12. diff --git a/core-util-is/float.patch b/core-util-is/float.patch new file mode 100644 index 0000000000..a06d5c05f7 --- /dev/null +++ b/core-util-is/float.patch @@ -0,0 +1,604 @@ +diff --git a/lib/util.js b/lib/util.js +index a03e874..9074e8e 100644 +--- a/lib/util.js ++++ b/lib/util.js +@@ -19,430 +19,6 @@ + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + +-var formatRegExp = /%[sdj%]/g; +-exports.format = function(f) { +- if (!isString(f)) { +- var objects = []; +- for (var i = 0; i < arguments.length; i++) { +- objects.push(inspect(arguments[i])); +- } +- return objects.join(' '); +- } +- +- var i = 1; +- var args = arguments; +- var len = args.length; +- var str = String(f).replace(formatRegExp, function(x) { +- if (x === '%%') return '%'; +- if (i >= len) return x; +- switch (x) { +- case '%s': return String(args[i++]); +- case '%d': return Number(args[i++]); +- case '%j': +- try { +- return JSON.stringify(args[i++]); +- } catch (_) { +- return '[Circular]'; +- } +- default: +- return x; +- } +- }); +- for (var x = args[i]; i < len; x = args[++i]) { +- if (isNull(x) || !isObject(x)) { +- str += ' ' + x; +- } else { +- str += ' ' + inspect(x); +- } +- } +- return str; +-}; +- +- +-// Mark that a method should not be used. +-// Returns a modified function which warns once by default. +-// If --no-deprecation is set, then it is a no-op. +-exports.deprecate = function(fn, msg) { +- // Allow for deprecating things in the process of starting up. +- if (isUndefined(global.process)) { +- return function() { +- return exports.deprecate(fn, msg).apply(this, arguments); +- }; +- } +- +- if (process.noDeprecation === true) { +- return fn; +- } +- +- var warned = false; +- function deprecated() { +- if (!warned) { +- if (process.throwDeprecation) { +- throw new Error(msg); +- } else if (process.traceDeprecation) { +- console.trace(msg); +- } else { +- console.error(msg); +- } +- warned = true; +- } +- return fn.apply(this, arguments); +- } +- +- return deprecated; +-}; +- +- +-var debugs = {}; +-var debugEnviron; +-exports.debuglog = function(set) { +- if (isUndefined(debugEnviron)) +- debugEnviron = process.env.NODE_DEBUG || ''; +- set = set.toUpperCase(); +- if (!debugs[set]) { +- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { +- var pid = process.pid; +- debugs[set] = function() { +- var msg = exports.format.apply(exports, arguments); +- console.error('%s %d: %s', set, pid, msg); +- }; +- } else { +- debugs[set] = function() {}; +- } +- } +- return debugs[set]; +-}; +- +- +-/** +- * Echos the value of a value. Trys to print the value out +- * in the best way possible given the different types. +- * +- * @param {Object} obj The object to print out. +- * @param {Object} opts Optional options object that alters the output. +- */ +-/* legacy: obj, showHidden, depth, colors*/ +-function inspect(obj, opts) { +- // default options +- var ctx = { +- seen: [], +- stylize: stylizeNoColor +- }; +- // legacy... +- if (arguments.length >= 3) ctx.depth = arguments[2]; +- if (arguments.length >= 4) ctx.colors = arguments[3]; +- if (isBoolean(opts)) { +- // legacy... +- ctx.showHidden = opts; +- } else if (opts) { +- // got an "options" object +- exports._extend(ctx, opts); +- } +- // set default options +- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; +- if (isUndefined(ctx.depth)) ctx.depth = 2; +- if (isUndefined(ctx.colors)) ctx.colors = false; +- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; +- if (ctx.colors) ctx.stylize = stylizeWithColor; +- return formatValue(ctx, obj, ctx.depth); +-} +-exports.inspect = inspect; +- +- +-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +-inspect.colors = { +- 'bold' : [1, 22], +- 'italic' : [3, 23], +- 'underline' : [4, 24], +- 'inverse' : [7, 27], +- 'white' : [37, 39], +- 'grey' : [90, 39], +- 'black' : [30, 39], +- 'blue' : [34, 39], +- 'cyan' : [36, 39], +- 'green' : [32, 39], +- 'magenta' : [35, 39], +- 'red' : [31, 39], +- 'yellow' : [33, 39] +-}; +- +-// Don't use 'blue' not visible on cmd.exe +-inspect.styles = { +- 'special': 'cyan', +- 'number': 'yellow', +- 'boolean': 'yellow', +- 'undefined': 'grey', +- 'null': 'bold', +- 'string': 'green', +- 'date': 'magenta', +- // "name": intentionally not styling +- 'regexp': 'red' +-}; +- +- +-function stylizeWithColor(str, styleType) { +- var style = inspect.styles[styleType]; +- +- if (style) { +- return '\u001b[' + inspect.colors[style][0] + 'm' + str + +- '\u001b[' + inspect.colors[style][1] + 'm'; +- } else { +- return str; +- } +-} +- +- +-function stylizeNoColor(str, styleType) { +- return str; +-} +- +- +-function arrayToHash(array) { +- var hash = {}; +- +- array.forEach(function(val, idx) { +- hash[val] = true; +- }); +- +- return hash; +-} +- +- +-function formatValue(ctx, value, recurseTimes) { +- // Provide a hook for user-specified inspect functions. +- // Check that value is an object with an inspect function on it +- if (ctx.customInspect && +- value && +- isFunction(value.inspect) && +- // Filter out the util module, it's inspect function is special +- value.inspect !== exports.inspect && +- // Also filter out any prototype objects using the circular check. +- !(value.constructor && value.constructor.prototype === value)) { +- var ret = value.inspect(recurseTimes, ctx); +- if (!isString(ret)) { +- ret = formatValue(ctx, ret, recurseTimes); +- } +- return ret; +- } +- +- // Primitive types cannot have properties +- var primitive = formatPrimitive(ctx, value); +- if (primitive) { +- return primitive; +- } +- +- // Look up the keys of the object. +- var keys = Object.keys(value); +- var visibleKeys = arrayToHash(keys); +- +- if (ctx.showHidden) { +- keys = Object.getOwnPropertyNames(value); +- } +- +- // Some type of object without properties can be shortcutted. +- if (keys.length === 0) { +- if (isFunction(value)) { +- var name = value.name ? ': ' + value.name : ''; +- return ctx.stylize('[Function' + name + ']', 'special'); +- } +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } +- if (isDate(value)) { +- return ctx.stylize(Date.prototype.toString.call(value), 'date'); +- } +- if (isError(value)) { +- return formatError(value); +- } +- } +- +- var base = '', array = false, braces = ['{', '}']; +- +- // Make Array say that they are Array +- if (isArray(value)) { +- array = true; +- braces = ['[', ']']; +- } +- +- // Make functions say that they are functions +- if (isFunction(value)) { +- var n = value.name ? ': ' + value.name : ''; +- base = ' [Function' + n + ']'; +- } +- +- // Make RegExps say that they are RegExps +- if (isRegExp(value)) { +- base = ' ' + RegExp.prototype.toString.call(value); +- } +- +- // Make dates with properties first say the date +- if (isDate(value)) { +- base = ' ' + Date.prototype.toUTCString.call(value); +- } +- +- // Make error with message first say the error +- if (isError(value)) { +- base = ' ' + formatError(value); +- } +- +- if (keys.length === 0 && (!array || value.length == 0)) { +- return braces[0] + base + braces[1]; +- } +- +- if (recurseTimes < 0) { +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } else { +- return ctx.stylize('[Object]', 'special'); +- } +- } +- +- ctx.seen.push(value); +- +- var output; +- if (array) { +- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); +- } else { +- output = keys.map(function(key) { +- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); +- }); +- } +- +- ctx.seen.pop(); +- +- return reduceToSingleString(output, base, braces); +-} +- +- +-function formatPrimitive(ctx, value) { +- if (isUndefined(value)) +- return ctx.stylize('undefined', 'undefined'); +- if (isString(value)) { +- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') +- .replace(/'/g, "\\'") +- .replace(/\\"/g, '"') + '\''; +- return ctx.stylize(simple, 'string'); +- } +- if (isNumber(value)) { +- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, +- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . +- if (value === 0 && 1 / value < 0) +- return ctx.stylize('-0', 'number'); +- return ctx.stylize('' + value, 'number'); +- } +- if (isBoolean(value)) +- return ctx.stylize('' + value, 'boolean'); +- // For some reason typeof null is "object", so special case here. +- if (isNull(value)) +- return ctx.stylize('null', 'null'); +-} +- +- +-function formatError(value) { +- return '[' + Error.prototype.toString.call(value) + ']'; +-} +- +- +-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { +- var output = []; +- for (var i = 0, l = value.length; i < l; ++i) { +- if (hasOwnProperty(value, String(i))) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- String(i), true)); +- } else { +- output.push(''); +- } +- } +- keys.forEach(function(key) { +- if (!key.match(/^\d+$/)) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- key, true)); +- } +- }); +- return output; +-} +- +- +-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { +- var name, str, desc; +- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; +- if (desc.get) { +- if (desc.set) { +- str = ctx.stylize('[Getter/Setter]', 'special'); +- } else { +- str = ctx.stylize('[Getter]', 'special'); +- } +- } else { +- if (desc.set) { +- str = ctx.stylize('[Setter]', 'special'); +- } +- } +- if (!hasOwnProperty(visibleKeys, key)) { +- name = '[' + key + ']'; +- } +- if (!str) { +- if (ctx.seen.indexOf(desc.value) < 0) { +- if (isNull(recurseTimes)) { +- str = formatValue(ctx, desc.value, null); +- } else { +- str = formatValue(ctx, desc.value, recurseTimes - 1); +- } +- if (str.indexOf('\n') > -1) { +- if (array) { +- str = str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n').substr(2); +- } else { +- str = '\n' + str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n'); +- } +- } +- } else { +- str = ctx.stylize('[Circular]', 'special'); +- } +- } +- if (isUndefined(name)) { +- if (array && key.match(/^\d+$/)) { +- return str; +- } +- name = JSON.stringify('' + key); +- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { +- name = name.substr(1, name.length - 2); +- name = ctx.stylize(name, 'name'); +- } else { +- name = name.replace(/'/g, "\\'") +- .replace(/\\"/g, '"') +- .replace(/(^"|"$)/g, "'"); +- name = ctx.stylize(name, 'string'); +- } +- } +- +- return name + ': ' + str; +-} +- +- +-function reduceToSingleString(output, base, braces) { +- var numLinesEst = 0; +- var length = output.reduce(function(prev, cur) { +- numLinesEst++; +- if (cur.indexOf('\n') >= 0) numLinesEst++; +- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; +- }, 0); +- +- if (length > 60) { +- return braces[0] + +- (base === '' ? '' : base + '\n ') + +- ' ' + +- output.join(',\n ') + +- ' ' + +- braces[1]; +- } +- +- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +-} +- +- + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { +@@ -522,166 +98,10 @@ function isPrimitive(arg) { + exports.isPrimitive = isPrimitive; + + function isBuffer(arg) { +- return arg instanceof Buffer; ++ return Buffer.isBuffer(arg); + } + exports.isBuffer = isBuffer; + + function objectToString(o) { + return Object.prototype.toString.call(o); +-} +- +- +-function pad(n) { +- return n < 10 ? '0' + n.toString(10) : n.toString(10); +-} +- +- +-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', +- 'Oct', 'Nov', 'Dec']; +- +-// 26 Feb 16:19:34 +-function timestamp() { +- var d = new Date(); +- var time = [pad(d.getHours()), +- pad(d.getMinutes()), +- pad(d.getSeconds())].join(':'); +- return [d.getDate(), months[d.getMonth()], time].join(' '); +-} +- +- +-// log is just a thin wrapper to console.log that prepends a timestamp +-exports.log = function() { +- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +-}; +- +- +-/** +- * Inherit the prototype methods from one constructor into another. +- * +- * The Function.prototype.inherits from lang.js rewritten as a standalone +- * function (not on Function.prototype). NOTE: If this file is to be loaded +- * during bootstrapping this function needs to be rewritten using some native +- * functions as prototype setup using normal JavaScript does not work as +- * expected during bootstrapping (see mirror.js in r114903). +- * +- * @param {function} ctor Constructor function which needs to inherit the +- * prototype. +- * @param {function} superCtor Constructor function to inherit prototype from. +- */ +-exports.inherits = function(ctor, superCtor) { +- ctor.super_ = superCtor; +- ctor.prototype = Object.create(superCtor.prototype, { +- constructor: { +- value: ctor, +- enumerable: false, +- writable: true, +- configurable: true +- } +- }); +-}; +- +-exports._extend = function(origin, add) { +- // Don't do anything if add isn't an object +- if (!add || !isObject(add)) return origin; +- +- var keys = Object.keys(add); +- var i = keys.length; +- while (i--) { +- origin[keys[i]] = add[keys[i]]; +- } +- return origin; +-}; +- +-function hasOwnProperty(obj, prop) { +- return Object.prototype.hasOwnProperty.call(obj, prop); +-} +- +- +-// Deprecated old stuff. +- +-exports.p = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- console.error(exports.inspect(arguments[i])); +- } +-}, 'util.p: Use console.error() instead'); +- +- +-exports.exec = exports.deprecate(function() { +- return require('child_process').exec.apply(this, arguments); +-}, 'util.exec is now called `child_process.exec`.'); +- +- +-exports.print = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(String(arguments[i])); +- } +-}, 'util.print: Use console.log instead'); +- +- +-exports.puts = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(arguments[i] + '\n'); +- } +-}, 'util.puts: Use console.log instead'); +- +- +-exports.debug = exports.deprecate(function(x) { +- process.stderr.write('DEBUG: ' + x + '\n'); +-}, 'util.debug: Use console.error instead'); +- +- +-exports.error = exports.deprecate(function(x) { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stderr.write(arguments[i] + '\n'); +- } +-}, 'util.error: Use console.error instead'); +- +- +-exports.pump = exports.deprecate(function(readStream, writeStream, callback) { +- var callbackCalled = false; +- +- function call(a, b, c) { +- if (callback && !callbackCalled) { +- callback(a, b, c); +- callbackCalled = true; +- } +- } +- +- readStream.addListener('data', function(chunk) { +- if (writeStream.write(chunk) === false) readStream.pause(); +- }); +- +- writeStream.addListener('drain', function() { +- readStream.resume(); +- }); +- +- readStream.addListener('end', function() { +- writeStream.end(); +- }); +- +- readStream.addListener('close', function() { +- call(); +- }); +- +- readStream.addListener('error', function(err) { +- writeStream.end(); +- call(err); +- }); +- +- writeStream.addListener('error', function(err) { +- readStream.destroy(); +- call(err); +- }); +-}, 'util.pump(): Use readableStream.pipe() instead'); +- +- +-var uv; +-exports._errnoException = function(err, syscall) { +- if (isUndefined(uv)) uv = process.binding('uv'); +- var errname = uv.errname(err); +- var e = new Error(syscall + ' ' + errname); +- e.code = errname; +- e.errno = errname; +- e.syscall = syscall; +- return e; +-}; ++} \ No newline at end of file diff --git a/core-util-is/lib/util.js b/core-util-is/lib/util.js new file mode 100644 index 0000000000..ff4c851c07 --- /dev/null +++ b/core-util-is/lib/util.js @@ -0,0 +1,107 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} diff --git a/core-util-is/package.json b/core-util-is/package.json new file mode 100644 index 0000000000..32af6e0d9d --- /dev/null +++ b/core-util-is/package.json @@ -0,0 +1,95 @@ +{ + "_args": [ + [ + { + "raw": "core-util-is@1.0.2", + "scope": null, + "escapedName": "core-util-is", + "name": "core-util-is", + "rawSpec": "1.0.2", + "spec": "1.0.2", + "type": "version" + }, + "C:\\Users\\dherrero\\Proyectos\\salix\\services\\salix\\node_modules\\hsts" + ] + ], + "_from": "core-util-is@1.0.2", + "_id": "core-util-is@1.0.2", + "_inCache": true, + "_location": "/core-util-is", + "_nodeVersion": "4.0.0", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "_npmVersion": "3.3.2", + "_phantomChildren": {}, + "_requested": { + "raw": "core-util-is@1.0.2", + "scope": null, + "escapedName": "core-util-is", + "name": "core-util-is", + "rawSpec": "1.0.2", + "spec": "1.0.2", + "type": "version" + }, + "_requiredBy": [ + "/hsts", + "/readable-stream" + ], + "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", + "_shrinkwrap": null, + "_spec": "core-util-is@1.0.2", + "_where": "C:\\Users\\dherrero\\Proyectos\\salix\\services\\salix\\node_modules\\hsts", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "dependencies": {}, + "description": "The `util.is*` functions introduced in Node v0.12.", + "devDependencies": { + "tap": "^2.3.0" + }, + "directories": {}, + "dist": { + "shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", + "tarball": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" + }, + "gitHead": "a177da234df5638b363ddc15fa324619a38577c8", + "homepage": "https://github.com/isaacs/core-util-is#readme", + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "license": "MIT", + "main": "lib/util.js", + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "name": "core-util-is", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is.git" + }, + "scripts": { + "test": "tap test.js" + }, + "version": "1.0.2" +} diff --git a/core-util-is/test.js b/core-util-is/test.js new file mode 100644 index 0000000000..1a490c65ac --- /dev/null +++ b/core-util-is/test.js @@ -0,0 +1,68 @@ +var assert = require('tap'); + +var t = require('./lib/util'); + +assert.equal(t.isArray([]), true); +assert.equal(t.isArray({}), false); + +assert.equal(t.isBoolean(null), false); +assert.equal(t.isBoolean(true), true); +assert.equal(t.isBoolean(false), true); + +assert.equal(t.isNull(null), true); +assert.equal(t.isNull(undefined), false); +assert.equal(t.isNull(false), false); +assert.equal(t.isNull(), false); + +assert.equal(t.isNullOrUndefined(null), true); +assert.equal(t.isNullOrUndefined(undefined), true); +assert.equal(t.isNullOrUndefined(false), false); +assert.equal(t.isNullOrUndefined(), true); + +assert.equal(t.isNumber(null), false); +assert.equal(t.isNumber('1'), false); +assert.equal(t.isNumber(1), true); + +assert.equal(t.isString(null), false); +assert.equal(t.isString('1'), true); +assert.equal(t.isString(1), false); + +assert.equal(t.isSymbol(null), false); +assert.equal(t.isSymbol('1'), false); +assert.equal(t.isSymbol(1), false); +assert.equal(t.isSymbol(Symbol()), true); + +assert.equal(t.isUndefined(null), false); +assert.equal(t.isUndefined(undefined), true); +assert.equal(t.isUndefined(false), false); +assert.equal(t.isUndefined(), true); + +assert.equal(t.isRegExp(null), false); +assert.equal(t.isRegExp('1'), false); +assert.equal(t.isRegExp(new RegExp()), true); + +assert.equal(t.isObject({}), true); +assert.equal(t.isObject([]), true); +assert.equal(t.isObject(new RegExp()), true); +assert.equal(t.isObject(new Date()), true); + +assert.equal(t.isDate(null), false); +assert.equal(t.isDate('1'), false); +assert.equal(t.isDate(new Date()), true); + +assert.equal(t.isError(null), false); +assert.equal(t.isError({ err: true }), false); +assert.equal(t.isError(new Error()), true); + +assert.equal(t.isFunction(null), false); +assert.equal(t.isFunction({ }), false); +assert.equal(t.isFunction(function() {}), true); + +assert.equal(t.isPrimitive(null), true); +assert.equal(t.isPrimitive(''), true); +assert.equal(t.isPrimitive(0), true); +assert.equal(t.isPrimitive(new Date()), false); + +assert.equal(t.isBuffer(null), false); +assert.equal(t.isBuffer({}), false); +assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/services/salix/package.json b/services/salix/package.json index f8361d598f..2eaa676a0b 100644 --- a/services/salix/package.json +++ b/services/salix/package.json @@ -11,12 +11,13 @@ "compression": "^1.0.3", "cors": "^2.5.2", "helmet": "^1.3.0", + "loopback": "^2.22.0", "loopback-boot": "^2.6.5", "loopback-component-explorer": "^2.4.0", - "serve-favicon": "^2.0.1", - "strong-error-handler": "^1.0.1", + "loopback-connector-mysql": "^4.1.0", "loopback-datasource-juggler": "^2.39.0", - "loopback": "^2.22.0" + "serve-favicon": "^2.0.1", + "strong-error-handler": "^1.0.1" }, "devDependencies": { "eslint": "^2.13.1", From 9cce1e18a6c783499bb58861f6392c8f2080e165 Mon Sep 17 00:00:00 2001 From: repository Date: Mon, 22 May 2017 08:37:11 +0200 Subject: [PATCH 042/391] cabecera sin altura fija --- client/salix/src/components/app/style.scss | 2 +- client/salix/src/components/topbar/style.css | 6 ++++++ client/salix/src/components/topbar/topbar.html | 2 +- client/salix/src/components/topbar/topbar.js | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 client/salix/src/components/topbar/style.css diff --git a/client/salix/src/components/app/style.scss b/client/salix/src/components/app/style.scss index 3fa9c4840f..75ed084775 100644 --- a/client/salix/src/components/app/style.scss +++ b/client/salix/src/components/app/style.scss @@ -7,7 +7,7 @@ vn-app { height: 100%; vn-topbar { - overflow: hidden; + /*overflow: hidden;*/ .logo { float: left; diff --git a/client/salix/src/components/topbar/style.css b/client/salix/src/components/topbar/style.css new file mode 100644 index 0000000000..f2341ef32c --- /dev/null +++ b/client/salix/src/components/topbar/style.css @@ -0,0 +1,6 @@ +header{ + width: 100%; + float: left; + clear: both; + color: #ffffff; +} \ No newline at end of file diff --git a/client/salix/src/components/topbar/topbar.html b/client/salix/src/components/topbar/topbar.html index 1db5913ae4..0a0498ca6f 100644 --- a/client/salix/src/components/topbar/topbar.html +++ b/client/salix/src/components/topbar/topbar.html @@ -1,2 +1,2 @@ -
+
\ No newline at end of file diff --git a/client/salix/src/components/topbar/topbar.js b/client/salix/src/components/topbar/topbar.js index 72e6765878..6eccf2daa7 100644 --- a/client/salix/src/components/topbar/topbar.js +++ b/client/salix/src/components/topbar/topbar.js @@ -1,4 +1,5 @@ import {module} from '../../module'; +import './style.css'; export const NAME = 'vnTopbar'; export const COMPONENT = { From c56368460c7838c73095798709e7b0e33bc00252 Mon Sep 17 00:00:00 2001 From: repository Date: Mon, 22 May 2017 09:23:21 +0200 Subject: [PATCH 043/391] uso de flex en topBar --- client/salix/src/components/topbar/style.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/salix/src/components/topbar/style.css b/client/salix/src/components/topbar/style.css index f2341ef32c..2513a37bd2 100644 --- a/client/salix/src/components/topbar/style.css +++ b/client/salix/src/components/topbar/style.css @@ -1,6 +1,6 @@ header{ - width: 100%; - float: left; - clear: both; + display: flex; + flex-direction: row; + flex: 1; color: #ffffff; } \ No newline at end of file From ac3f7c2da0fa7b73d3c421d6222d837c463da183 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 22 May 2017 11:04:37 +0200 Subject: [PATCH 044/391] =?UTF-8?q?Autenticaci=C3=B3n:=20errores=20solucio?= =?UTF-8?q?nados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/auth/common/models/Account.json | 10 ++++++++++ services/auth/server/boot/routes.js | 7 +++++-- services/client/common/models/Account.json | 10 ++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/services/auth/common/models/Account.json b/services/auth/common/models/Account.json index 1691ef1308..4b2bbf0dc2 100644 --- a/services/auth/common/models/Account.json +++ b/services/auth/common/models/Account.json @@ -17,6 +17,16 @@ }, "active": { "type": "boolean" + }, + "email": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" } }, "acls": [ diff --git a/services/auth/server/boot/routes.js b/services/auth/server/boot/routes.js index 032d2cfdaf..8ef324235a 100644 --- a/services/auth/server/boot/routes.js +++ b/services/auth/server/boot/routes.js @@ -52,11 +52,14 @@ module.exports = function(app) { return; } - let where = {username: user}; + let where = {id: instance.id}; let userData = { + id: instance.id, username: user, password: password, - email: `${user}@verdnatura.es` + email: instance.email, + created: instance.created, + updated: instance.updated }; User.upsertWithWhere(where, userData, login); } diff --git a/services/client/common/models/Account.json b/services/client/common/models/Account.json index 1691ef1308..4b2bbf0dc2 100644 --- a/services/client/common/models/Account.json +++ b/services/client/common/models/Account.json @@ -17,6 +17,16 @@ }, "active": { "type": "boolean" + }, + "email": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" } }, "acls": [ From 3f8423061903ed81f258c93b9b7288c9361aa5dd Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 22 May 2017 11:31:06 +0200 Subject: [PATCH 045/391] =?UTF-8?q?Autenticaci=C3=B3n=20por=20email=20o=20?= =?UTF-8?q?usuario?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/auth/server/boot/routes.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/services/auth/server/boot/routes.js b/services/auth/server/boot/routes.js index 8ef324235a..1c49fa0f7a 100644 --- a/services/auth/server/boot/routes.js +++ b/services/auth/server/boot/routes.js @@ -13,19 +13,23 @@ module.exports = function(app) { let user = req.body.user; let password = req.body.password; let syncOnFail = true; + let usesEmail = user.indexOf('@') !== -1; login(); function login() { - let loginInfo = { - username: user, - password: password - }; + let loginInfo = {password: password}; + + if (usesEmail) + loginInfo.email = user; + else + loginInfo.username = user; + User.login(loginInfo, 'user', loginCb); } function loginCb(err, token) { if (err) { - if(syncOnFail) { + if(syncOnFail && !usesEmail) { syncOnFail = false; let filter = {where: {name: user}}; app.models.Account.findOne(filter, findCb); From 4857fce33e2b18a22b4fbff5b384f19a2644a2cf Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Mon, 22 May 2017 12:33:06 +0200 Subject: [PATCH 046/391] =?UTF-8?q?A=C3=B1adido=20logoutSessionsOnSensitiv?= =?UTF-8?q?eChanges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/auth/server/config.json | 49 ++++++++++++++++--------------- services/salix/server/config.json | 49 ++++++++++++++++--------------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/services/auth/server/config.json b/services/auth/server/config.json index 143394d68d..7701262650 100644 --- a/services/auth/server/config.json +++ b/services/auth/server/config.json @@ -1,24 +1,25 @@ -{ - "restApiRoot": "/api", - "host": "0.0.0.0", - "port": 3000, - "aclErrorStatus": 403, - "remoting": { - "context": false, - "rest": { - "normalizeHttpPath": false, - "xml": false - }, - "json": { - "strict": false, - "limit": "100kb" - }, - "urlencoded": { - "extended": true, - "limit": "100kb" - }, - "cors": false, - "handleErrors": false - }, - "legacyExplorer": false -} +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3000, + "aclErrorStatus": 403, + "logoutSessionsOnSensitiveChanges": true, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + }, + "legacyExplorer": false +} diff --git a/services/salix/server/config.json b/services/salix/server/config.json index 29cfe0246a..7f322dd59d 100644 --- a/services/salix/server/config.json +++ b/services/salix/server/config.json @@ -1,24 +1,25 @@ -{ - "restApiRoot": "/api", - "host": "0.0.0.0", - "port": 3001, - "aclErrorStatus": 403, - "remoting": { - "context": false, - "rest": { - "normalizeHttpPath": false, - "xml": false - }, - "json": { - "strict": false, - "limit": "100kb" - }, - "urlencoded": { - "extended": true, - "limit": "100kb" - }, - "cors": false, - "handleErrors": false - }, - "legacyExplorer": false -} +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3001, + "aclErrorStatus": 403, + "logoutSessionsOnSensitiveChanges": true, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + }, + "legacyExplorer": false +} From aabc190c08b986fdd8aa5b01514d9efa8d232ef6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 22 May 2017 12:39:36 +0200 Subject: [PATCH 047/391] crlf -> lf --- services/auth/server/config.json | 50 +++++++++++++++---------------- services/salix/server/config.json | 50 +++++++++++++++---------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/services/auth/server/config.json b/services/auth/server/config.json index 7701262650..4fa37a5390 100644 --- a/services/auth/server/config.json +++ b/services/auth/server/config.json @@ -1,25 +1,25 @@ -{ - "restApiRoot": "/api", - "host": "0.0.0.0", - "port": 3000, - "aclErrorStatus": 403, - "logoutSessionsOnSensitiveChanges": true, - "remoting": { - "context": false, - "rest": { - "normalizeHttpPath": false, - "xml": false - }, - "json": { - "strict": false, - "limit": "100kb" - }, - "urlencoded": { - "extended": true, - "limit": "100kb" - }, - "cors": false, - "handleErrors": false - }, - "legacyExplorer": false -} +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3000, + "aclErrorStatus": 403, + "logoutSessionsOnSensitiveChanges": true, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + }, + "legacyExplorer": false +} diff --git a/services/salix/server/config.json b/services/salix/server/config.json index 7f322dd59d..bbd3a32450 100644 --- a/services/salix/server/config.json +++ b/services/salix/server/config.json @@ -1,25 +1,25 @@ -{ - "restApiRoot": "/api", - "host": "0.0.0.0", - "port": 3001, - "aclErrorStatus": 403, - "logoutSessionsOnSensitiveChanges": true, - "remoting": { - "context": false, - "rest": { - "normalizeHttpPath": false, - "xml": false - }, - "json": { - "strict": false, - "limit": "100kb" - }, - "urlencoded": { - "extended": true, - "limit": "100kb" - }, - "cors": false, - "handleErrors": false - }, - "legacyExplorer": false -} +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3001, + "aclErrorStatus": 403, + "logoutSessionsOnSensitiveChanges": true, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + }, + "legacyExplorer": false +} From c1acd51d964557e7dfc9b9a795cf2ef7f9e69f88 Mon Sep 17 00:00:00 2001 From: dherrero Date: Mon, 22 May 2017 13:31:24 +0200 Subject: [PATCH 048/391] eliminado overflow hidden en vnTopbar --- client/salix/src/components/app/style.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/client/salix/src/components/app/style.scss b/client/salix/src/components/app/style.scss index 3fa9c4840f..e843aa932b 100644 --- a/client/salix/src/components/app/style.scss +++ b/client/salix/src/components/app/style.scss @@ -7,7 +7,6 @@ vn-app { height: 100%; vn-topbar { - overflow: hidden; .logo { float: left; From bda48488fc7bebb0de19aca6ee06f25ca17fde56 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 23 May 2017 09:20:21 +0200 Subject: [PATCH 049/391] =?UTF-8?q?Client=20card,=20uso=20de=20mgCrud.=20R?= =?UTF-8?q?outes:=20a=C3=B1adido=20estado=20abstract?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/routes.json | 1 + client/client/src/card/index.html | 1 + client/client/src/card/index.js | 30 +++++++++++++++--------------- client/salix/src/configroutes.js | 3 +++ package.json | 2 +- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/client/client/routes.json b/client/client/routes.json index 0b1273ea18..bf686e6e16 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -8,6 +8,7 @@ }, { "url": "/clients/:id", "state": "clientCard", + "abstract": true, "component": "vn-client-card" }, { "url": "/basic-data", diff --git a/client/client/src/card/index.html b/client/client/src/card/index.html index 0adc9a5130..0b89766167 100644 --- a/client/client/src/card/index.html +++ b/client/client/src/card/index.html @@ -1,4 +1,5 @@ + diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js index a3c21dca4d..270d95c212 100644 --- a/client/client/src/card/index.js +++ b/client/client/src/card/index.js @@ -5,22 +5,22 @@ export const NAME = 'vnClientCard'; export const COMPONENT = { template: require('./index.html'), controllerAs: 'card', - controller: function($http, $stateParams) { - this.client = null; - $http.get(`/client/api/Clients/${$stateParams.id}/card`).then( - json => this.client = json.data - ); + controller: function() { + var self = this; + self.client = null; + self.items = []; - this.items = []; - routes.client.routes.forEach(i => { - if (i.description) - this.items.push({ - description: i.description, - icon: i.icon, - href: i.state - }); - }); + self.$onInit = function() { + routes.client.routes.forEach(i => { + if (i.description) + self.items.push({ + description: i.description, + icon: i.icon, + href: i.state + }); + }); + }; } }; -COMPONENT.controller.$inject = ['$http', '$stateParams']; + module.component(NAME, COMPONENT); diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index 939d92207d..f80a70e751 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -29,6 +29,8 @@ function config($stateProvider, $urlRouterProvider) { return temporalParams.join(' '); } + $urlRouterProvider.otherwise('/'); + for (let file in routes) { let fileRoutes = routes[file].routes; let moduleName = routes[file].module; @@ -36,6 +38,7 @@ function config($stateProvider, $urlRouterProvider) { fileRoutes.forEach(function(route) { $stateProvider.state(route.state, { url: route.url, + abstract: route.abstract || false, template: `<${route.component} ${getParams(route)}>`, resolve: { loader: loader(moduleName) diff --git a/package.json b/package.json index 4d38ac2c9b..34809a942e 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "devDependencies": { "babel": "^6.5.2", "babel-core": "^6.22.1", - "babel-loader": "^6.2.10", + "babel-loader": "^6.4.1", "babel-preset-es2015": "^6.22.0", "cors": "^2.8.1", "css-loader": "^0.25.0", From 434002b308e9d9f3aafa6e46495600f7ccc54c96 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 23 May 2017 10:58:17 +0200 Subject: [PATCH 050/391] =?UTF-8?q?separda=20la=20facturaci=C3=B3n=20en=20?= =?UTF-8?q?2=20modulos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/routes.json | 11 +++++- client/client/src/billing-data/index.html | 41 +++++++++++++++++++++ client/client/src/billing-data/index.js | 11 ++++++ client/client/src/card/index.js | 43 ++++++++++++----------- client/client/src/client.js | 2 ++ client/client/src/fiscal-data/index.html | 33 +---------------- 6 files changed, 88 insertions(+), 53 deletions(-) create mode 100644 client/client/src/billing-data/index.html create mode 100644 client/client/src/billing-data/index.js diff --git a/client/client/routes.json b/client/client/routes.json index bf686e6e16..b1f7c7ffdc 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -19,13 +19,22 @@ }, "description": "Datos básicos", "icon": "person" - }, { + }, { "url": "/fiscal-data", "state": "clientCard.fiscalData", "component": "vn-client-fiscal-data", "params": { "client": "card.client" }, + "description": "Datos fiscales", + "icon": "account_balance" + }, { + "url": "/billing-data", + "state": "clientCard.billingData", + "component": "vn-client-billing-data", + "params": { + "client": "card.client" + }, "description": "Datos facturación", "icon": "assignment" }, { diff --git a/client/client/src/billing-data/index.html b/client/client/src/billing-data/index.html new file mode 100644 index 0000000000..ef4d9fc476 --- /dev/null +++ b/client/client/src/billing-data/index.html @@ -0,0 +1,41 @@ + + + +
+ + + Información de facturación + + + + + + + + + + + + + + + + Documentación + + + + + + + + + + + +
\ No newline at end of file diff --git a/client/client/src/billing-data/index.js b/client/client/src/billing-data/index.js new file mode 100644 index 0000000000..7c6c6ffeb1 --- /dev/null +++ b/client/client/src/billing-data/index.js @@ -0,0 +1,11 @@ +import {module} from '../module'; + +export const NAME = 'vnClientBillingData'; +export const COMPONENT = { + template: require('./index.html'), + controllerAs: 'bill', + bindings: { + client: '<' + } +}; +module.component(NAME, COMPONENT); diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js index 270d95c212..0c40677506 100644 --- a/client/client/src/card/index.js +++ b/client/client/src/card/index.js @@ -2,25 +2,28 @@ import {module} from '../module'; import './style.css'; export const NAME = 'vnClientCard'; -export const COMPONENT = { + +export default class vnClientCard { + constructor() { + this.client = null; + this.items = []; + this.init(); + } + + init() { + routes.client.routes.forEach(i => { + if (i.description) + this.items.push({ + description: i.description, + icon: i.icon, + href: i.state + }); + }); + } +} + +module.component(NAME, { template: require('./index.html'), controllerAs: 'card', - controller: function() { - var self = this; - self.client = null; - self.items = []; - - self.$onInit = function() { - routes.client.routes.forEach(i => { - if (i.description) - self.items.push({ - description: i.description, - icon: i.icon, - href: i.state - }); - }); - }; - } -}; - -module.component(NAME, COMPONENT); + controller: vnClientCard +}); diff --git a/client/client/src/client.js b/client/client/src/client.js index d65eedb9ef..4bc8220597 100644 --- a/client/client/src/client.js +++ b/client/client/src/client.js @@ -6,6 +6,8 @@ export {NAME as CLIENTS, COMPONENT as CLIENTS_COMPONENT} from './index/index'; export {NAME as CLIENT_FISCAL_DATA_INDEX, COMPONENT as CLIENT_FISCAL_DATA_INDEX_COMPONENT} from './fiscal-data/index'; +export {NAME as CLIENT_BILLING_DATA_INDEX, + COMPONENT as CLIENT_BILLINGL_DATA_INDEX_COMPONENT} from './billing-data/index'; export {NAME as CLIENT_DESCRIPTOR, COMPONENT as CLIENT_DESCRIPTOR_COMPONENT} from './descriptor/index'; export {NAME as CLIENT_NOTES, diff --git a/client/client/src/fiscal-data/index.html b/client/client/src/fiscal-data/index.html index 8cf20d74eb..7e9b2a7e99 100644 --- a/client/client/src/fiscal-data/index.html +++ b/client/client/src/fiscal-data/index.html @@ -38,38 +38,7 @@
- - - Información de facturación - - - - - - - - - - - - - - - - Documentación - - - - - - - + From 5b9fcf868a094f520eba3570d29c4cca07b0c778 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 23 May 2017 14:05:26 +0200 Subject: [PATCH 051/391] 401 redirecciona a login, vnAutocomplete: campos seleccionados --- client/client/src/billing-data/index.html | 24 +++++---- client/core/src/autocomplete/index.js | 66 +++++++++++++++-------- client/salix/src/components/app/app.js | 7 ++- services/client/common/models/Client.json | 2 +- 4 files changed, 62 insertions(+), 37 deletions(-) diff --git a/client/client/src/billing-data/index.html b/client/client/src/billing-data/index.html index ef4d9fc476..a001ba49e0 100644 --- a/client/client/src/billing-data/index.html +++ b/client/client/src/billing-data/index.html @@ -1,21 +1,24 @@ + vn-id="watcher" + data="bill.client" + form="form" + save="put">
Información de facturación - - - - + + + + @@ -34,7 +37,6 @@ - diff --git a/client/core/src/autocomplete/index.js b/client/core/src/autocomplete/index.js index 4acf3c7904..9a99ef2a4b 100644 --- a/client/core/src/autocomplete/index.js +++ b/client/core/src/autocomplete/index.js @@ -12,20 +12,25 @@ export default class Autocomplete extends Component { this.item = null; this.data = null; this.popover = null; - this.popoverData = null; + this.displayData = null; this.timeoutId = null; this.lastSearch = null; this.lastRequest = null; this.currentRequest = null; this.moreData = false; this.activeOption = -1; - this.maxRows = 10; - this.requestDelay = 350; this.locked = false; this.$http = $http; this.$scope = $scope; this.vnPopover = vnPopover; + Object.assign(this, { + maxRows: 10, + requestDelay: 350, + showField: 'name', + valueField: 'id' + }); + componentHandler.upgradeElement($element[0].firstChild); } set field(value) { @@ -36,13 +41,23 @@ export default class Autocomplete extends Component { get field() { return this.value; } - set initialValue(value) { + set initialData(value) { if (value) { if (!this.data) this.data = []; this.data.push(value); } } + set selectFields(value) { + this._selectFields = []; + + if (!value) + return; + + let res = value.split(','); + for (let i of res) + this._selectFields.push(i.trim()); + } mdlUpdate() { let mdlField = this.element.firstChild.MaterialTextfield; if (mdlField) @@ -52,7 +67,7 @@ export default class Autocomplete extends Component { textFilter = textFilter ? textFilter : ''; if (this.lastSearch === textFilter) { - this.popoverDataReady(); + this.showPopoverIfFocus(); return; } @@ -72,6 +87,11 @@ export default class Autocomplete extends Component { let fields = {}; fields[this.valueField] = true; fields[this.showField] = true; + + if (this._selectFields) + for (let field of this._selectFields) + fields[field] = true; + return fields; } requestData(textFilter, append) { @@ -112,28 +132,30 @@ export default class Autocomplete extends Component { else this.data = this.data.concat(data); - this.setPopoverData(this.data); + this.setDisplayData(this.data); } localFilter(textFilter) { let regex = new RegExp(textFilter, 'i'); let data = this.data.filter(item => { return regex.test(item[this.showField]); }); - this.setPopoverData(data); + this.setDisplayData(data); } - setPopoverData(data) { - this.popoverData = data; - this.popoverDataReady(); + setDisplayData(data) { + this.displayData = data; + this.showPopoverIfFocus(); } - popoverDataReady() { + showPopoverIfFocus() { if (this.hasFocus) this.showPopover(); } showPopover() { - if (!this.data) return; + let data = this.displayData; + + if (!data) + return; let fragment = this.document.createDocumentFragment(); - let data = this.popoverData; for (let i = 0; i < data.length; i++) { let li = this.document.createElement('li'); @@ -171,8 +193,8 @@ export default class Autocomplete extends Component { } selectPopoverOption(index) { if (!this.popover || index === -1) return; - if (index < this.popoverData.length) { - this.selectOptionByDataIndex(this.popoverData, index); + if (index < this.displayData.length) { + this.selectOptionByDataIndex(this.displayData, index); this.hidePopover(); } else this.requestData(this.lastRequest, true); @@ -276,7 +298,7 @@ export default class Autocomplete extends Component { let popover = this.popover; let childs = popover.childNodes; - let len = this.popoverData.length; + let len = this.displayData.length; if (this.activeOption >= 0) childs[this.activeOption].className = ''; @@ -332,11 +354,8 @@ export default class Autocomplete extends Component { this.showItem(item); let value = item ? item[this.valueField] : undefined; - if (!this.locked) { + if (!this.locked) this.value = value; - setTimeout( - () => this.$scope.$apply()); - } } showItem(item) { this.input.value = item ? item[this.showField] : ''; @@ -350,9 +369,10 @@ module.component('vnAutocomplete', { template: require('./index.html'), bindings: { url: '@', - showField: '@', - valueField: '@', - initialValue: '<', + showField: '@?', + valueField: '@?', + selectFields: '@?', + initialData: ' Date: Tue, 23 May 2017 14:36:54 +0200 Subject: [PATCH 052/391] =?UTF-8?q?leftMenu=20:=20estado=20activo,=20Route?= =?UTF-8?q?s.json:=20nueva=20jerarqu=C3=ADa=20de=20rutas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/routes.json | 34 ++++++++++++------- client/client/src/addresses/index.html | 4 +-- client/client/src/notes/index.js | 2 +- .../salix/src/components/left-menu/actions.js | 28 ++++++++++++++- .../src/components/left-menu/menu-item.html | 2 +- .../salix/src/components/left-menu/style.css | 3 ++ 6 files changed, 56 insertions(+), 17 deletions(-) diff --git a/client/client/routes.json b/client/client/routes.json index b1f7c7ffdc..bac7d2ffe5 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -37,15 +37,28 @@ }, "description": "Datos facturación", "icon": "assignment" - }, { + },{ "url": "/addresses", "state": "clientCard.addresses", + "component": "ui-view", + "abstract": true + }, { + "url": "/list", + "state": "clientCard.addresses.list", "component": "vn-client-addresses", "params": { "client": "card.client" }, "description": "Consignatarios", "icon": "local_shipping" + }, { + "url": "/create", + "state": "clientCard.addresses.create", + "component": "vn-address-create" + }, { + "url": "/:addressId/edit", + "state": "clientCard.addresses.edit", + "component": "vn-address-edit" }, { "url": "/web-access", "state": "clientCard.webAccess", @@ -55,9 +68,14 @@ }, "description": "Acceso web", "icon": "language" - }, { + },{ "url": "/notes", "state": "clientCard.notes", + "component": "ui-view", + "abstract": true + }, { + "url": "/list", + "state": "clientCard.notes.list", "component": "vn-client-notes", "params": { "client": "card.client" @@ -65,21 +83,13 @@ "description": "Notas", "icon": "insert_drive_file" }, { - "url": "/new-note", - "state": "clientCard.newNote", + "url": "/create", + "state": "clientCard.notes.create", "component": "vn-new-note" },{ "url": "/create", "state": "create", "component": "vn-client-create" - }, { - "url": "/address/create", - "state": "clientCard.addressCreate", - "component": "vn-address-create" - }, { - "url": "/address/:addressId", - "state": "clientCard.addressEdit", - "component": "vn-address-edit" } ] } diff --git a/client/client/src/addresses/index.html b/client/client/src/addresses/index.html index 197c7ace50..1b11b19317 100644 --- a/client/client/src/addresses/index.html +++ b/client/client/src/addresses/index.html @@ -15,7 +15,7 @@
{{i.city}}, {{i.province}}
{{i.phone}}, {{i.mobile}}
- + @@ -26,7 +26,7 @@ diff --git a/client/client/src/notes/index.js b/client/client/src/notes/index.js index 7f3fffa90d..d7fc78bf1d 100644 --- a/client/client/src/notes/index.js +++ b/client/client/src/notes/index.js @@ -26,7 +26,7 @@ export const COMPONENT = { }; this.newObservation = () => { - $state.go("clientCard.newNote", {id: this.client.id}); + $state.go("clientCard.notes.create", {id: this.client.id}); }; } }; diff --git a/client/salix/src/components/left-menu/actions.js b/client/salix/src/components/left-menu/actions.js index 54d72cb7c3..096c090490 100644 --- a/client/salix/src/components/left-menu/actions.js +++ b/client/salix/src/components/left-menu/actions.js @@ -1,8 +1,34 @@ import ngModule from '../../module'; +export default class MenuActions { + constructor($state, $transitions) { + this.$state = $state; + this.deregisterCallback = $transitions.onSuccess({}, + transition => this.switchItem()); + } + switchItem() { + if (!this.items || !this.items.length) return; + + let stateName = this.$state.current.name.replace('create', 'list').replace('edit', 'list'); + + for (let i = 0; i < this.items.length; i++) { + this.items[i].active = (this.items[i].href === stateName); + } + } + $onInit() { + this.switchItem(); + } + $onDestroy() { + this.deregisterCallback(); + } + +} +MenuActions.$inject = ['$state', '$transitions']; + ngModule.component('vnActions', { template: require('./actions.html'), bindings: { items: '<' - } + }, + controller: MenuActions }); diff --git a/client/salix/src/components/left-menu/menu-item.html b/client/salix/src/components/left-menu/menu-item.html index be1519e93c..b3315b2fac 100644 --- a/client/salix/src/components/left-menu/menu-item.html +++ b/client/salix/src/components/left-menu/menu-item.html @@ -1,4 +1,4 @@ -
  • +
  • keyboard_arrow_right {{$ctrl.item.icon}} diff --git a/client/salix/src/components/left-menu/style.css b/client/salix/src/components/left-menu/style.css index 31f3d8578c..8d44e4a707 100644 --- a/client/salix/src/components/left-menu/style.css +++ b/client/salix/src/components/left-menu/style.css @@ -2,3 +2,6 @@ vn-menu-item a:hover { color: white !important; background-color: #424242; } +vn-menu-item li.active{ + background-color: #E6E6E6; +} From 345f2e55a5345f18597eadd08f04564da142e898 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 24 May 2017 13:24:32 +0200 Subject: [PATCH 053/391] vnAutocomplete: Acepta plantillas --- client/client/src/basic-data/index.html | 4 ++ client/client/src/index/index.js | 6 +-- client/core/src/autocomplete/index.js | 48 ++++++++++++++++++--- services/client/common/models/Employee.json | 4 ++ 4 files changed, 53 insertions(+), 9 deletions(-) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index 9fad9255b6..8829d89b2e 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -27,7 +27,11 @@ url="/client/api/Employees" show-field="name" value-field="id" + select-fields="surname" label="Comercial"> + + {{::i.name}} {{::i.surname}} + { + scope[this.itemAs] = data[i]; + li.appendChild(clone[0]); + this.scopes[i] = scope; + }, null, 'itemTemplate'); + } else { + let text = this.document.createTextNode(data[i][this.showField]); + li.appendChild(text); + } } if (this.moreData) { @@ -189,6 +211,7 @@ export default class Autocomplete extends Component { if (!this.popover) return; this.activeOption = -1; this.vnPopover.hide(); + this.destroyScopes(); this.popover = null; } selectPopoverOption(index) { @@ -200,9 +223,17 @@ export default class Autocomplete extends Component { this.requestData(this.lastRequest, true); } onPopoverClick(event) { + let target = event.target; let childs = this.popover.childNodes; + + if (target === this.popover) + return; + + while (target.parentNode !== this.popover) + target = target.parentNode; + for (let i = 0; i < childs.length; i++) - if (childs[i] === event.target) { + if (childs[i] === target) { this.selectPopoverOption(i); break; } @@ -362,8 +393,11 @@ export default class Autocomplete extends Component { this.item = item; this.mdlUpdate(); } + $onDestroy() { + this.destroyScopes(); + } } -Autocomplete.$inject = ['$element', '$scope', '$http', 'vnPopover']; +Autocomplete.$inject = ['$element', '$scope', '$http', 'vnPopover', '$transclude']; module.component('vnAutocomplete', { template: require('./index.html'), @@ -373,8 +407,12 @@ module.component('vnAutocomplete', { valueField: '@?', selectFields: '@?', initialData: ' Date: Thu, 25 May 2017 07:21:36 +0200 Subject: [PATCH 054/391] primera version de ACL --- services/salix/client/index.ejs | 1 + services/salix/server/boot/routes.js | 53 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs index 6217c3a452..f5e210f3f3 100644 --- a/services/salix/client/index.ejs +++ b/services/salix/client/index.ejs @@ -3,6 +3,7 @@ Salix + diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 7d2bf17e08..1ff4fbe231 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -9,6 +9,17 @@ module.exports = function (app) { }); }); + app.get('/acl', function(req, res){ + let token = req.cookies.vnToken; + validateToken(token, function(isValid) { + if (isValid) + sendUserRole(res); + else + sendACL(res, {}); + }); + + }); + app.get('/login', function (req, res) { let token = req.query.token; let continueUrl = req.query.continue; @@ -33,6 +44,9 @@ module.exports = function (app) { function validateToken(tokenId, cb) { app.models.AccessToken.findById(tokenId, function(err, token) { if (token) { + if(token.userId){ + app.currentUser = {id: token.userId}; + } token.validate (function (err, isValid) { cb(isValid === true); }); @@ -42,6 +56,39 @@ module.exports = function (app) { }); } + function sendUserRole(res){ + if(app.currentUser && app.currentUser.id){ + let query = { + "where": { + "principalId": `${app.currentUser.id}`, + "principalType": "USER" + }, + "include": { + "relation": "role", + "scope": { + "fields": ["name"] + } + } + }; + app.models.RoleMapping.find(query, function(err, roles){ + if(roles){ + let acl = {}; + Object.keys(roles).forEach(function(_, i){ + if(roles[i].roleId){ + let rol = roles[i].role(); + acl[rol.name] = true; + } + }); + sendACL(res, acl); + } + else + sendACL(res, {}); + }); + } + else + sendACL(res, {}); + } + function redirectToAuth (res, continueUrl) { let authUrl = app.get('url auth'); let params = { @@ -51,6 +98,12 @@ module.exports = function (app) { res.clearCookie ('vnToken'); res.redirect(`${authUrl}/?${encodeUri(params)}`); } + + function sendACL(res, acl){ + let aclStr = JSON.stringify(acl); + res.header('Content-Type', 'application/javascript; charset=UTF-8'); + res.send(`(function(window){window.Salix = window.Salix || {}; window.Salix.acl = window.Salix.acl || {}; window.Salix.acl = ${aclStr}; })(window)`); + } }; function encodeUri(object) { From 81f9de098daf4495fa22d9fccff40ace5639386a Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 25 May 2017 11:48:10 +0200 Subject: [PATCH 055/391] ACLs , permisos a nivel de rutas, menu y componentes --- client/client/routes.json | 41 ++++++++++++------- client/client/src/basic-data/index.html | 2 +- client/client/src/card/index.html | 2 +- client/client/src/card/index.js | 14 +------ client/core/src/directives/acl.js | 23 +++++++++++ client/core/src/directives/index.js | 1 + client/salix/src/components/app/app.js | 26 ++++++++++++ .../src/components/left-menu/left-menu.js | 28 +++++++++++-- client/salix/src/configroutes.js | 27 +++++++----- services/salix/server/boot/routes.js | 19 +++++++-- 10 files changed, 136 insertions(+), 47 deletions(-) create mode 100644 client/core/src/directives/acl.js diff --git a/client/client/routes.json b/client/client/routes.json index bac7d2ffe5..91eae4c989 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -17,26 +17,32 @@ "params": { "client": "card.client" }, - "description": "Datos básicos", - "icon": "person" + "menu": { + "description": "Datos básicos", + "icon": "person" + } }, { "url": "/fiscal-data", "state": "clientCard.fiscalData", "component": "vn-client-fiscal-data", "params": { "client": "card.client" - }, - "description": "Datos fiscales", - "icon": "account_balance" + }, + "menu": { + "description": "Datos fiscales", + "icon": "account_balance" + } }, { "url": "/billing-data", "state": "clientCard.billingData", "component": "vn-client-billing-data", "params": { "client": "card.client" - }, - "description": "Datos facturación", - "icon": "assignment" + }, + "menu": { + "description": "Datos facturación", + "icon": "assignment" + } },{ "url": "/addresses", "state": "clientCard.addresses", @@ -49,8 +55,10 @@ "params": { "client": "card.client" }, - "description": "Consignatarios", - "icon": "local_shipping" + "menu": { + "description": "Consignatarios", + "icon": "local_shipping" + } }, { "url": "/create", "state": "clientCard.addresses.create", @@ -66,8 +74,10 @@ "params": { "client": "card.client" }, - "description": "Acceso web", - "icon": "language" + "menu": { + "description": "Acceso web", + "icon": "language" + } },{ "url": "/notes", "state": "clientCard.notes", @@ -80,8 +90,11 @@ "params": { "client": "card.client" }, - "description": "Notas", - "icon": "insert_drive_file" + "menu": { + "description": "Notas", + "icon": "insert_drive_file" + } + }, { "url": "/create", "state": "clientCard.notes.create", diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index 8829d89b2e..d13580cc99 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -10,7 +10,7 @@ Datos básicos - + diff --git a/client/client/src/card/index.html b/client/client/src/card/index.html index 0b89766167..589deb1525 100644 --- a/client/client/src/card/index.html +++ b/client/client/src/card/index.html @@ -2,7 +2,7 @@ - + diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js index 0c40677506..107aa9815a 100644 --- a/client/client/src/card/index.js +++ b/client/client/src/card/index.js @@ -6,22 +6,10 @@ export const NAME = 'vnClientCard'; export default class vnClientCard { constructor() { this.client = null; - this.items = []; - this.init(); - } - - init() { - routes.client.routes.forEach(i => { - if (i.description) - this.items.push({ - description: i.description, - icon: i.icon, - href: i.state - }); - }); } } + module.component(NAME, { template: require('./index.html'), controllerAs: 'card', diff --git a/client/core/src/directives/acl.js b/client/core/src/directives/acl.js new file mode 100644 index 0000000000..b6c4bc162b --- /dev/null +++ b/client/core/src/directives/acl.js @@ -0,0 +1,23 @@ +import {module} from '../module'; + +function vnAcl(aclService, $compile) { + return { + restrict: 'A', + link: function(scope, element, attrs) { + let acls = attrs.vnAcl.split(','); + let action = attrs.vnAclAction || 'disabled'; + if (!aclService.aclPermission(acls)) { + if (action === 'disabled') { + let input = element[0].querySelector('input'); + input.setAttribute("ng-disabled", "true"); + $compile(input)(scope); + } else { + element.remove(); + } + } + } + }; +} +vnAcl.$inject = ['aclService', '$compile']; + +module.directive('vnAcl', vnAcl); diff --git a/client/core/src/directives/index.js b/client/core/src/directives/index.js index 6f42e0ec72..4bd512eb0b 100644 --- a/client/core/src/directives/index.js +++ b/client/core/src/directives/index.js @@ -2,3 +2,4 @@ import './id'; import './focus'; import './dialog'; import './validation'; +import './acl'; diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index 66b197067c..8e417a491d 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -75,3 +75,29 @@ function interceptorConfig($httpProvider) { $httpProvider.interceptors.push('vnAppInterceptor'); } ngModule.config(interceptorConfig); + +function aclService() { + this.roles = window.Salix.acl.roles; + this.routeHasPermission = function(route) { + let hasPermission; + if (!route.acl) + hasPermission = true; + else if (!this.roles || !Object.keys(this.roles).length) + hasPermission = false; + else + hasPermission = this.aclPermission(route.acl); + return hasPermission; + }; + this.aclPermission = function(aclCollection) { + let hasPermission = false; + let total = aclCollection.length; + for (let i = 0; i < total; i++) { + if (this.roles[aclCollection[i]]) { + hasPermission = true; + break; + } + } + return hasPermission; + }; +} +ngModule.service('aclService', aclService); diff --git a/client/salix/src/components/left-menu/left-menu.js b/client/salix/src/components/left-menu/left-menu.js index ec605667bd..77626fe33c 100644 --- a/client/salix/src/components/left-menu/left-menu.js +++ b/client/salix/src/components/left-menu/left-menu.js @@ -1,9 +1,31 @@ import ngModule from '../../module'; import './style.css'; +export default class vnLeftMenu { + constructor(aclService, $state) { + this.aclService = aclService; + this.$state = $state; + this.items = []; + this.init(); + } + + init() { + let station = this.$state.current.data.station || 'default'; + if (routes[station]) { + routes[station].routes.forEach(i => { + if (i.menu && this.aclService.routeHasPermission(i)) + this.items.push({ + description: i.menu.description, + icon: i.menu.icon, + href: i.state + }); + }); + } + } +} +vnLeftMenu.$inject = ['aclService', '$state']; + ngModule.component('vnLeftMenu', { template: require('./left-menu.html'), - bindings: { - items: '<' - } + controller: vnLeftMenu }); diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index f80a70e751..7d18d2b779 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -11,9 +11,10 @@ function loader(moduleName) { return load; } -config.$inject = ['$stateProvider', '$urlRouterProvider']; -function config($stateProvider, $urlRouterProvider) { +config.$inject = ['$stateProvider', '$urlRouterProvider', 'aclServiceProvider']; +function config($stateProvider, $urlRouterProvider, aclServiceProvider) { splitingRegister.registerGraph(deps); + let aclService = aclServiceProvider.$get(); function getParams(route) { let params = ''; @@ -34,16 +35,20 @@ function config($stateProvider, $urlRouterProvider) { for (let file in routes) { let fileRoutes = routes[file].routes; let moduleName = routes[file].module; - fileRoutes.forEach(function(route) { - $stateProvider.state(route.state, { - url: route.url, - abstract: route.abstract || false, - template: `<${route.component} ${getParams(route)}>`, - resolve: { - loader: loader(moduleName) - } - }); + if (aclService.routeHasPermission(route)) { + $stateProvider.state(route.state, { + url: route.url, + abstract: route.abstract || false, + template: `<${route.component} ${getParams(route)}>`, + resolve: { + loader: loader(moduleName) + }, + data: { + station: file + } + }); + } }); } } diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 1ff4fbe231..10ce5dd4bd 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -63,20 +63,31 @@ module.exports = function (app) { "principalId": `${app.currentUser.id}`, "principalType": "USER" }, - "include": { + "include": [{ "relation": "role", "scope": { "fields": ["name"] } - } + }, + { + "relation": "user", + "scope": { + "fields": ["id", "username"] + } + }] }; + app.models.RoleMapping.belongsTo(app.models.User, {foreignKey: 'principalId', as: 'user'}); app.models.RoleMapping.find(query, function(err, roles){ if(roles){ - let acl = {}; + let acl = { + userProfile: {}, + roles: {} + }; + acl.userProfile = roles[0].user(); Object.keys(roles).forEach(function(_, i){ if(roles[i].roleId){ let rol = roles[i].role(); - acl[rol.name] = true; + acl.roles[rol.name] = true; } }); sendACL(res, acl); From fd3dd5654279f5855dace1f8e2ae549f7c212d6c Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 25 May 2017 11:52:53 +0200 Subject: [PATCH 056/391] Separado aclService en fichero propio --- client/salix/src/aclService.js | 28 ++++++++++++++++++++++++++ client/salix/src/app.js | 1 + client/salix/src/components/app/app.js | 26 +----------------------- 3 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 client/salix/src/aclService.js diff --git a/client/salix/src/aclService.js b/client/salix/src/aclService.js new file mode 100644 index 0000000000..aeb8b0129a --- /dev/null +++ b/client/salix/src/aclService.js @@ -0,0 +1,28 @@ +import ngModule from './module'; + +function aclService() { + this.roles = window.Salix.acl.roles; + this.routeHasPermission = function(route) { + let hasPermission; + if (!route.acl) + hasPermission = true; + else if (!this.roles || !Object.keys(this.roles).length) + hasPermission = false; + else + hasPermission = this.aclPermission(route.acl); + return hasPermission; + }; + this.aclPermission = function(aclCollection) { + let hasPermission = false; + let total = aclCollection.length; + for (let i = 0; i < total; i++) { + if (this.roles[aclCollection[i]]) { + hasPermission = true; + break; + } + } + return hasPermission; + }; +} + +ngModule.service('aclService', aclService); diff --git a/client/salix/src/app.js b/client/salix/src/app.js index 0f5d3edb51..8ec2c5df70 100644 --- a/client/salix/src/app.js +++ b/client/salix/src/app.js @@ -1,5 +1,6 @@ import './module'; import './spliting'; +import './aclService'; import './configroutes'; import './config'; import './run'; diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index 8e417a491d..c20c448ee3 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -76,28 +76,4 @@ function interceptorConfig($httpProvider) { } ngModule.config(interceptorConfig); -function aclService() { - this.roles = window.Salix.acl.roles; - this.routeHasPermission = function(route) { - let hasPermission; - if (!route.acl) - hasPermission = true; - else if (!this.roles || !Object.keys(this.roles).length) - hasPermission = false; - else - hasPermission = this.aclPermission(route.acl); - return hasPermission; - }; - this.aclPermission = function(aclCollection) { - let hasPermission = false; - let total = aclCollection.length; - for (let i = 0; i < total; i++) { - if (this.roles[aclCollection[i]]) { - hasPermission = true; - break; - } - } - return hasPermission; - }; -} -ngModule.service('aclService', aclService); + From f12c66027b1dec85ba3445c20f98011fc2bd3666 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 25 May 2017 11:56:34 +0200 Subject: [PATCH 057/391] =?UTF-8?q?Eliminada=20prueba=20de=20directiva=20v?= =?UTF-8?q?nAcl=20en=20=C3=BAltimo=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/src/basic-data/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index d13580cc99..8829d89b2e 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -10,7 +10,7 @@ Datos básicos - + From 6f4e51cee69009f1ffe8406c1b290e44171f1a85 Mon Sep 17 00:00:00 2001 From: Joan Date: Thu, 25 May 2017 12:34:03 +0200 Subject: [PATCH 058/391] Dependencia con uirouter actualizada --- client/vendor/src/angular-ui-router.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/vendor/src/angular-ui-router.js b/client/vendor/src/angular-ui-router.js index deb6ff07c8..cb0d4a321a 100644 --- a/client/vendor/src/angular-ui-router.js +++ b/client/vendor/src/angular-ui-router.js @@ -1,4 +1,4 @@ -import 'angular-ui-router'; +import '@uirouter/angularjs'; export const angularUiRouter = { name: 'ui.router' diff --git a/package.json b/package.json index 34809a942e..fbbcc1bcea 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "url": "http://git.verdnatura.es:/salix" }, "dependencies": { + "@uirouter/angularjs": "^1.0.3", "angular": "^1.6.4", "angular-cookies": "^1.6.4", "angular-paging": "^2.2.2", "angular-translate": "^2.13.1", "angular-translate-loader-partial": "^2.13.1", - "angular-ui-router": "^1.0.0-beta.3", "material-design-lite": "^1.3.0", "mg-crud": "^1.1.2", "oclazyload": "^0.6.3", From 1482b842bdac7ae3cc6f60d5910a4b4245e655c6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 25 May 2017 12:52:38 +0200 Subject: [PATCH 059/391] Errores solucionados --- client/client/src/basic-data/index.html | 8 +++----- client/client/src/web-access/index.html | 8 ++++---- client/core/src/autocomplete/index.js | 6 +++--- client/core/src/confirm/index.html | 18 ++++++++-------- client/core/src/confirm/index.js | 6 +----- client/core/src/confirm/style.css | 2 +- client/core/src/dialog/index.html | 19 +++++++++-------- client/core/src/dialog/index.js | 26 ++++++++++++------------ client/core/src/dialog/style.scss | 21 +++++++++++++++++++ client/core/src/icon/index.mdl.html | 2 +- client/core/src/icon/style.css | 1 + client/core/src/locale/en.json | 4 +++- client/core/src/locale/es.json | 4 +++- client/core/src/textfield/index.js | 1 + client/core/src/textfield/index.mdl.html | 5 ++--- services/client/common/models/Client.js | 1 - 16 files changed, 76 insertions(+), 56 deletions(-) diff --git a/client/client/src/basic-data/index.html b/client/client/src/basic-data/index.html index 8829d89b2e..4a4e7c3919 100644 --- a/client/client/src/basic-data/index.html +++ b/client/client/src/basic-data/index.html @@ -29,16 +29,14 @@ value-field="id" select-fields="surname" label="Comercial"> - + {{::i.name}} {{::i.surname}} - + diff --git a/client/client/src/web-access/index.html b/client/client/src/web-access/index.html index 71185cf0c7..1c708b6e84 100644 --- a/client/client/src/web-access/index.html +++ b/client/client/src/web-access/index.html @@ -23,7 +23,7 @@ vn-id="change-pass" on-open="$ctrl.onPassOpen()" on-response="$ctrl.onPassChange(response)"> - + - - + + - + diff --git a/client/core/src/autocomplete/index.js b/client/core/src/autocomplete/index.js index 973462c753..2cd088c9bc 100644 --- a/client/core/src/autocomplete/index.js +++ b/client/core/src/autocomplete/index.js @@ -167,7 +167,7 @@ export default class Autocomplete extends Component { this.destroyScopes(); this.scopes = []; - let hasTemplate = this.$transclude.isSlotFilled('itemTemplate'); + let hasTemplate = this.$transclude.isSlotFilled('tplItem'); for (let i = 0; i < data.length; i++) { let li = this.document.createElement('li'); @@ -178,7 +178,7 @@ export default class Autocomplete extends Component { scope[this.itemAs] = data[i]; li.appendChild(clone[0]); this.scopes[i] = scope; - }, null, 'itemTemplate'); + }, null, 'tplItem'); } else { let text = this.document.createTextNode(data[i][this.showField]); li.appendChild(text); @@ -412,7 +412,7 @@ module.component('vnAutocomplete', { label: '@' }, transclude: { - itemTemplate: '?itemTemplate' + tplItem: '?tplItem' }, controller: Autocomplete }); diff --git a/client/core/src/confirm/index.html b/client/core/src/confirm/index.html index 1b8decb228..82b58f59a8 100644 --- a/client/core/src/confirm/index.html +++ b/client/core/src/confirm/index.html @@ -1,25 +1,23 @@
    -
    - -
    - + +
    - +
    {{$ctrl.question}}
    {{$ctrl.message}}
    -
    +
    - + - +
    diff --git a/client/core/src/confirm/index.js b/client/core/src/confirm/index.js index 4f63e8a55b..0d7c56cc0d 100644 --- a/client/core/src/confirm/index.js +++ b/client/core/src/confirm/index.js @@ -2,11 +2,7 @@ import {module} from '../module'; import Dialog from '../dialog/index'; import './style.css'; -export default class Confirm extends Dialog { - constructor($element) { - super($element); - } -} +export default class Confirm extends Dialog {} Dialog.$inject = ['$element']; module.component('vnConfirm', { diff --git a/client/core/src/confirm/style.css b/client/core/src/confirm/style.css index dc8f595c9c..7177560fdc 100644 --- a/client/core/src/confirm/style.css +++ b/client/core/src/confirm/style.css @@ -1,5 +1,5 @@ -vn-dialog .dialog-title { +vn-confirm .dialog-title { color:#424242; font-family: raleway-bold; } diff --git a/client/core/src/dialog/index.html b/client/core/src/dialog/index.html index f491e02496..4ccb39e008 100644 --- a/client/core/src/dialog/index.html +++ b/client/core/src/dialog/index.html @@ -1,10 +1,13 @@
    -
    -
    -
    -
    -
    + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/client/core/src/dialog/index.js b/client/core/src/dialog/index.js index 431c41df6b..e45f66b930 100644 --- a/client/core/src/dialog/index.js +++ b/client/core/src/dialog/index.js @@ -29,13 +29,13 @@ export default class Dialog extends Component { let width = this.dialog.offsetWidth; let height = this.dialog.offsetHeight; - if(width + screenMargin > innerWidth) { + if (width + screenMargin > innerWidth) { width = innerWidth - dblMargin; - style.width = width +'px'; + style.width = width + 'px'; } - if(height + screenMargin > innerHeight) { + if (height + screenMargin > innerHeight) { height = innerHeight - dblMargin; - style.height = height +'px'; + style.height = height + 'px'; } this.keypressHandler = @@ -44,7 +44,7 @@ export default class Dialog extends Component { this.keypressHandler); this.element.style.display = 'block'; - if(this.onOpen) + if (this.onOpen) this.onOpen(); } /** @@ -59,7 +59,7 @@ export default class Dialog extends Component { */ fireResponse(response) { let cancel = false; - if(this.onResponse) + if (this.onResponse) cancel = this.onResponse({response: response}); return cancel; } @@ -71,17 +71,17 @@ export default class Dialog extends Component { } onButtonClick(event) { let buttonBar = this.element.querySelector('.button-bar'); - let buttons = buttonBar.querySelector('buttons'); + let buttons = buttonBar.querySelector('tpl-buttons'); let node = event.target; - while(node.parentNode != buttons) { - if(node == buttonBar) return; + while (node.parentNode != buttons) { + if (node == buttonBar) return; node = node.parentNode; } let response = node.getAttribute('response'); let cancel = this.fireResponse(response); - if(cancel !== false) this.realHide(); + if (cancel !== false) this.realHide(); } onDialogMouseDown(event) { this.lastEvent = event; @@ -91,7 +91,7 @@ export default class Dialog extends Component { this.hide(); } onKeypress(event) { - if(event.keyCode == 27) // Esc + if (event.keyCode == 27) // Esc this.hide(); } } @@ -100,8 +100,8 @@ Dialog.$inject = ['$element']; module.component('vnDialog', { template: require('./index.html'), transclude: { - dbody: 'dbody', - buttons: 'buttons' + tplBody: 'tplBody', + tplButtons: 'tplButtons' }, bindings: { onOpen: '&', diff --git a/client/core/src/dialog/style.scss b/client/core/src/dialog/style.scss index 659cdb4904..1b30f5e982 100644 --- a/client/core/src/dialog/style.scss +++ b/client/core/src/dialog/style.scss @@ -8,6 +8,27 @@ width: 100%; background-color: rgba(1,1,1,.4); + button.close { + position: absolute; + top: 0; + right: 0; + border-style: none; + background-color: transparent; + padding: .3em; + cursor: pointer; + + vn-icon { + display: block; + + i { + display: block; + } + } + + &:hover { + background-color: rgba(0, 0, 0, .1); + } + } & > div { position: relative; box-shadow: 0 0 .4em rgba(1,1,1,.4); diff --git a/client/core/src/icon/index.mdl.html b/client/core/src/icon/index.mdl.html index f4b1888dd8..865296d9bc 100644 --- a/client/core/src/icon/index.mdl.html +++ b/client/core/src/icon/index.mdl.html @@ -1 +1 @@ -*[icon]* +*[icon]* diff --git a/client/core/src/icon/style.css b/client/core/src/icon/style.css index fc4dacc93b..064195cd9a 100644 --- a/client/core/src/icon/style.css +++ b/client/core/src/icon/style.css @@ -3,5 +3,6 @@ vn-icon { font-size: 18pt; } vn-icon > i { + display: block; font-size: inherit !important; } \ No newline at end of file diff --git a/client/core/src/locale/en.json b/client/core/src/locale/en.json index f2c3b62b94..5a7186a182 100644 --- a/client/core/src/locale/en.json +++ b/client/core/src/locale/en.json @@ -1,4 +1,6 @@ { "Accept": "Accept", - "Cancel": "Cancel" + "Cancel": "Cancel", + "Close": "Close", + "Clear": "Clear" } \ No newline at end of file diff --git a/client/core/src/locale/es.json b/client/core/src/locale/es.json index cd2b7eea12..96c2c716a0 100644 --- a/client/core/src/locale/es.json +++ b/client/core/src/locale/es.json @@ -1,4 +1,6 @@ { "Accept": "Aceptar", - "Cancel": "Cancelar" + "Cancel": "Cancelar", + "Close": "Cerrar", + "Clear": "Borrar" } \ No newline at end of file diff --git a/client/core/src/textfield/index.js b/client/core/src/textfield/index.js index c7c6731c1e..d556779067 100644 --- a/client/core/src/textfield/index.js +++ b/client/core/src/textfield/index.js @@ -45,6 +45,7 @@ export default class Textfield extends Component { this.showClear(this.input.value); } showClear(show) { + show = document.activeElement === this.input; let clearButton = this.element.querySelector('button'); clearButton.style.visibility = show ? 'visible' : 'hidden'; } diff --git a/client/core/src/textfield/index.mdl.html b/client/core/src/textfield/index.mdl.html index 0a7e31296b..fc4ab00bfb 100644 --- a/client/core/src/textfield/index.mdl.html +++ b/client/core/src/textfield/index.mdl.html @@ -5,13 +5,12 @@ name="*[name]*" ng-model="*[model]*" vn-validation="*[rule]*" - ng-disabled="*[disable]*" - *[enabled]*/> + ng-disabled="*[disable]*"/> diff --git a/services/client/common/models/Client.js b/services/client/common/models/Client.js index 06e78bce77..976f3aaaa6 100644 --- a/services/client/common/models/Client.js +++ b/services/client/common/models/Client.js @@ -66,5 +66,4 @@ module.exports = function(Client) { limit: p.size }; } - }; \ No newline at end of file From 571692f4ca20bd47470c75219f57c7c2affc96be Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 25 May 2017 14:23:19 +0200 Subject: [PATCH 060/391] =?UTF-8?q?A=C3=B1adidos=20estilos=20a=20elementos?= =?UTF-8?q?=20desabilitados,=20mejora=20de=20directiva=20vnAcl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/client/src/web-access/index.html | 2 +- client/core/src/directives/acl.js | 21 ++++++++++++++------- client/salix/src/styles/display.css | 12 +++++++++--- services/salix/client/index.ejs | 4 ++-- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/client/client/src/web-access/index.html b/client/client/src/web-access/index.html index 1c708b6e84..d2e0390248 100644 --- a/client/client/src/web-access/index.html +++ b/client/client/src/web-access/index.html @@ -38,5 +38,5 @@ - + diff --git a/client/core/src/directives/acl.js b/client/core/src/directives/acl.js index b6c4bc162b..bb7657a089 100644 --- a/client/core/src/directives/acl.js +++ b/client/core/src/directives/acl.js @@ -3,16 +3,23 @@ import {module} from '../module'; function vnAcl(aclService, $compile) { return { restrict: 'A', - link: function(scope, element, attrs) { - let acls = attrs.vnAcl.split(','); - let action = attrs.vnAclAction || 'disabled'; + link: function($scope, $element, $attrs) { + let acls = $attrs.vnAcl.split(','); + let action = $attrs.vnAclAction || 'disabled'; if (!aclService.aclPermission(acls)) { if (action === 'disabled') { - let input = element[0].querySelector('input'); - input.setAttribute("ng-disabled", "true"); - $compile(input)(scope); + let input = $element[0]; + let selector = 'input, textarea, button, submit'; + + if (!input.matches(selector)) + input = input.querySelector(selector); + + if (input) { + input.setAttribute("ng-disabled", "true"); + $compile(input)($scope); + } } else { - element.remove(); + $element.remove(); } } } diff --git a/client/salix/src/styles/display.css b/client/salix/src/styles/display.css index 1e5c718cc7..9ead8140db 100644 --- a/client/salix/src/styles/display.css +++ b/client/salix/src/styles/display.css @@ -1,4 +1,4 @@ -.display-block{ +.display-block { display: block; } .well { @@ -15,12 +15,12 @@ } /* Label del popover */ -.popover-button{ +.popover-button { padding: 3px 3px 3px 0px; height: auto; min-width: auto; } -.popover-label{ +.popover-label { font-weight: bold; color: black; padding-top:5px; @@ -32,3 +32,9 @@ height: 46px; line-height: 0px; } +input:disabled, button:disabled { + cursor: not-allowed !important; +} +input[type="submit"]:disabled, button:disabled { + opacity: 0.7; +} \ No newline at end of file diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs index f5e210f3f3..9caf8950e3 100644 --- a/services/salix/client/index.ejs +++ b/services/salix/client/index.ejs @@ -1,11 +1,11 @@ - + Salix - + + diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 993e16eb62..235b134aa2 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -27,7 +27,7 @@ module.exports = function (app) { validateToken(token, function(isValid) { if (isValid) { res.cookie('vnToken', token/*, {httpOnly: true}*/); - res.redirect(continueUrl ? continueUrl : '/salix'); + res.redirect(continueUrl ? continueUrl : '/'); } else redirectToAuth(res); From 64dea096e0f71a8b275297f68984592cbc24c50a Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 2 Jun 2017 14:17:57 +0200 Subject: [PATCH 122/391] test cambio https --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 436c5eb3eb..0c6b38577b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,8 +2,8 @@ var gulp = require('gulp'); var gutil = require('gulp-util'); var wrap = require('gulp-wrap'); var concat = require('gulp-concat'); -var extend = require('gulp-extend'); var merge = require('merge-stream'); +var extend = require('gulp-extend'); var del = require('del'); var fs = require('fs'); var webpack = require('webpack'); From f9842000d3b4a202a91e76449ede410613b34439 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2017 15:23:19 +0200 Subject: [PATCH 123/391] =?UTF-8?q?Codigo=20gulp=20reorganizado,=20errores?= =?UTF-8?q?=20redirecci=C3=B3n=20solucionados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/salix/src/components/app/app.js | 8 +++++-- gulpfile.js | 29 ++++++++++---------------- services/nginx/conf-dev.conf | 14 +++++-------- services/nginx/conf-prod.conf | 12 ++++------- 4 files changed, 26 insertions(+), 37 deletions(-) diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index 18742e9f4f..5c9af143a7 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -60,8 +60,12 @@ function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies) else error = `${rejection.status}: ${rejection.statusText}`; - if (rejection.status === 401) - $window.location = '/auth'; + if (rejection.status === 401) { + let location = $window.location; + let continueUrl = location.pathname + location.search + location.hash; + continueUrl = encodeURIComponent(continueUrl); + $window.location = `/auth?continue=${continueUrl}`; + } logger.showError(error); return $q.reject(rejection); diff --git a/gulpfile.js b/gulpfile.js index 436c5eb3eb..8b2d73349e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,18 +20,25 @@ var webpackConfig = require('./webpack.config.js'); // Main tasks +gulp.task('default', function() { + return gulp.start('services', 'client'); +}); + gulp.task('build', ['clean'], function() { return gulp.start('routes', 'locales', 'webpack'); }); -gulp.task('default', ['clean'], function() { - return gulp.start('services', 'watch', 'routes', 'locales', 'webpack-dev-server'); -}); - gulp.task('client', ['clean'], function() { return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server'); }); +gulp.task('services', function() { + require('./services/auth/server/server.js').start(); + require('./services/client/server/server.js').start(); + require('./services/salix/server/server.js').start(); + require('./services/mailer/server.js').start(); +}); + gulp.task('clean', function() { return del(`${buildDir}/*`, {force: true}); }); @@ -151,17 +158,3 @@ gulp.task('watch', function() { gulp.watch(routeFiles, ['routes']); gulp.watch(localeFiles, ['locales']); }); - -// Services - -gulp.task('services', function() { - var auth = require('./services/auth/server/server.js'); - var client = require('./services/client/server/server.js'); - var server = require('./services/salix/server/server.js'); - var mailer = require('./services/mailer/server.js'); - - auth.start(); - client.start(); - server.start(); - mailer.start(); -}); diff --git a/services/nginx/conf-dev.conf b/services/nginx/conf-dev.conf index 157091514c..3bec6e4639 100644 --- a/services/nginx/conf-dev.conf +++ b/services/nginx/conf-dev.conf @@ -25,23 +25,19 @@ http { server_name localhost; autoindex off; - location ~ ^/static/(?:(.*))?$ { + location ~ ^/static(?:/(.*))?$ { proxy_pass http://127.0.0.1:8081/$1$is_args$args; } - - location ~ ^/auth/(?:(.*))?$ { + location ~ ^/auth(?:/(.*))?$ { proxy_pass http://127.0.0.1:3000/$1$is_args$args; } - - location ~ ^/client/(?:(.*))?$ { + location ~ ^/client(?:/(.*))?$ { proxy_pass http://127.0.0.1:3002/$1$is_args$args; } - - location ~ ^/mailer/(?:(.*))?$ { + location ~ ^/mailer(?:/(.*))?$ { proxy_pass http://127.0.0.1:3003/$1$is_args$args; } - - location ~ ^/(?:(.*))?$ { + location ~ ^(?:/(.*))?$ { proxy_pass http://127.0.0.1:3001/$1$is_args$args; } } diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index 4e3af4c0c4..ac814c46f3 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -23,20 +23,16 @@ http { alias /usr/share/nginx/html; autoindex on; } - - location ~ ^/auth/(?:(.*))?$ { + location ~ ^/auth(?:/(.*))?$ { proxy_pass http://auth:3000/$1$is_args$args; } - - location ~ ^/client/(?:(.*))?$ { + location ~ ^/client(?:/(.*))?$ { proxy_pass http://client:3002/$1$is_args$args; } - - location ~ ^/mailer/(?:(.*))?$ { + location ~ ^/mailer(?:/(.*))?$ { proxy_pass http://mailer:3003/$1$is_args$args; } - - location ~ ^/(?:(.*))?$ { + location ~ ^(?:/(.*))?$ { proxy_pass http://salix:3001/$1$is_args$args; } } From 8cd312e1452ed2c0c5d3ca2b92b9a47edfd7f64d Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 2 Jun 2017 15:39:16 +0200 Subject: [PATCH 124/391] Errores solucionados --- client/salix/src/components/app/app.js | 2 +- services/salix/server/boot/routes.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index 5c9af143a7..c9a828daef 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -64,7 +64,7 @@ function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies) let location = $window.location; let continueUrl = location.pathname + location.search + location.hash; continueUrl = encodeURIComponent(continueUrl); - $window.location = `/auth?continue=${continueUrl}`; + $window.location = `/auth/?apiKey=salix&continue=${continueUrl}`; } logger.showError(error); diff --git a/services/salix/server/boot/routes.js b/services/salix/server/boot/routes.js index 235b134aa2..aa509b0345 100644 --- a/services/salix/server/boot/routes.js +++ b/services/salix/server/boot/routes.js @@ -1,4 +1,6 @@ module.exports = function (app) { + let models = app.models; + app.get('/', function (req, res) { let token = req.cookies.vnToken; validateToken(token, function(isValid) { @@ -36,13 +38,13 @@ module.exports = function (app) { app.get('/logout', function (req, res) { let token = req.cookies.vnToken; - app.models.User.logout(token, function(err) { + models.User.logout(token, function() { redirectToAuth(res); }); }); function validateToken(tokenId, cb) { - app.models.AccessToken.findById(tokenId, function(err, token) { + models.AccessToken.findById(tokenId, function(err, token) { if (token) { token.validate (function (err, isValid) { cb(isValid === true, token); @@ -67,7 +69,7 @@ module.exports = function (app) { } }] }; - app.models.RoleMapping.find(query, function(err, roles){ + models.RoleMapping.find(query, function(_, roles){ if(roles){ var acl = { userProfile: {}, @@ -79,7 +81,7 @@ module.exports = function (app) { acl.roles[rol.name] = true; } }); - app.models.User.findById(token.userId, function(_, userProfile){ + models.User.findById(token.userId, function(_, userProfile){ //acl.userProfile = userProfile; acl.userProfile.id = userProfile.id; acl.userProfile.username = userProfile.username; From b4273611564b15eb968d598d9d83e5f8490eb6f0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Sat, 3 Jun 2017 13:01:47 +0200 Subject: [PATCH 125/391] Loopback 3, Errores solucionados --- client/client/routes.json | 17 +++--- .../src/address-create/address-create.html | 2 +- .../src/address-create/address-create.js | 21 ++----- .../client/src/address-edit/address-edit.html | 22 +++---- .../client/src/address-edit/address-edit.js | 21 ++----- client/client/src/addresses/addresses.js | 7 +-- client/client/src/basic-data/basic-data.html | 4 +- client/client/src/basic-data/basic-data.js | 7 +-- .../client/src/billing-data/billing-data.html | 32 +++++----- .../client/src/billing-data/billing-data.js | 20 ++----- client/client/src/card/card.html | 12 +++- client/client/src/card/card.js | 13 ++--- client/client/src/client.js | 33 ++++------- client/client/src/create/create.js | 13 ++--- client/client/src/descriptor/descriptor.html | 8 +-- client/client/src/descriptor/descriptor.js | 34 ++++++----- .../client/src/fiscal-data/fiscal-data.html | 24 ++++---- client/client/src/fiscal-data/fiscal-data.js | 9 +-- client/client/src/index/index.js | 10 ++-- client/client/src/index/item-client.html | 12 ++-- client/client/src/index/item-client.js | 9 +-- client/client/src/module.js | 3 +- client/client/src/new-note/new-note.js | 27 --------- .../note-create.html} | 6 +- client/client/src/note-create/note-create.js | 16 +++++ client/client/src/notes/notes.html | 6 +- client/client/src/notes/notes.js | 58 +++++++++---------- .../client/src/search-panel/search-panel.html | 4 +- .../client/src/search-panel/search-panel.js | 55 ++++++++++-------- client/client/src/web-access/web-access.js | 16 ++--- client/core/src/dialog/dialog.js | 3 + client/core/src/lib/crud.js | 8 +++ client/core/src/popover/popover.js | 18 ++++-- client/core/src/watcher/watcher.js | 12 +++- services/auth/package.json | 18 +++--- .../{scopes => methods}/client/activate.js | 0 .../{scopes => methods}/client/addresses.js | 0 .../{scopes => methods}/client/before-save.js | 0 .../common/{scopes => methods}/client/card.js | 5 +- .../client/common/methods/client/card.json | 33 +++++++++++ .../{scopes => methods}/client/filter.js | 3 +- services/client/common/models/Client.js | 13 +++-- .../client/common/scopes/client/card.json | 57 ------------------ services/client/package.json | 19 +++--- services/salix/package.json | 23 ++++---- webpack.config.js | 2 +- 46 files changed, 348 insertions(+), 387 deletions(-) delete mode 100644 client/client/src/new-note/new-note.js rename client/client/src/{new-note/new-note.html => note-create/note-create.html} (61%) create mode 100644 client/client/src/note-create/note-create.js rename services/client/common/{scopes => methods}/client/activate.js (100%) rename services/client/common/{scopes => methods}/client/addresses.js (100%) rename services/client/common/{scopes => methods}/client/before-save.js (100%) rename services/client/common/{scopes => methods}/client/card.js (89%) create mode 100644 services/client/common/methods/client/card.json rename services/client/common/{scopes => methods}/client/filter.js (95%) delete mode 100644 services/client/common/scopes/client/card.json diff --git a/client/client/routes.json b/client/client/routes.json index bd49efb494..ecfdc4ea78 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -7,6 +7,10 @@ "url": "/clients", "state": "clients", "component": "vn-client-index" + }, { + "url": "/create", + "state": "create", + "component": "vn-client-create" }, { "url": "/clients/:id", "state": "clientCard", @@ -23,7 +27,7 @@ "description": "Datos básicos", "icon": "person" } - }, { + }, { "url": "/fiscal-data", "state": "clientCard.fiscalData", "component": "vn-client-fiscal-data", @@ -45,7 +49,7 @@ "description": "Datos facturación", "icon": "assignment" } - },{ + }, { "url": "/addresses", "state": "clientCard.addresses", "component": "ui-view", @@ -80,7 +84,7 @@ "description": "Acceso web", "icon": "language" } - },{ + }, { "url": "/notes", "state": "clientCard.notes", "component": "ui-view", @@ -96,15 +100,10 @@ "description": "Notas", "icon": "insert_drive_file" } - }, { "url": "/create", "state": "clientCard.notes.create", - "component": "vn-new-note" - },{ - "url": "/create", - "state": "create", - "component": "vn-client-create" + "component": "vn-note-create" } ] } diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index f014ceb364..caf042a212 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -5,7 +5,7 @@ data="$ctrl.address" form="form"> -
    + Consignatario diff --git a/client/client/src/address-create/address-create.js b/client/client/src/address-create/address-create.js index 8e23af6ea0..6c3e4521b3 100644 --- a/client/client/src/address-create/address-create.js +++ b/client/client/src/address-create/address-create.js @@ -1,25 +1,16 @@ -import {module} from '../module'; +import ngModule from '../module'; -class Controller { - constructor($scope, $state) { - this.$ = $scope; - this.$state = $state; +export default class Controller { + constructor($state) { this.address = { clientFk: parseInt($state.params.id), enabled: true }; } - onSubmit() { - this.$.watcher.submit().then( - () => this.$state.go('clientCard.addresses') - ); - } } -Controller.$inject = ['$scope', '$state']; +Controller.$inject = ['$state']; -export const NAME = 'vnAddressCreate'; -export const COMPONENT = { +ngModule.component('vnAddressCreate', { template: require('./address-create.html'), controller: Controller -}; -module.component(NAME, COMPONENT); +}); diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index c2086ff2a0..a34dddee0f 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -3,7 +3,7 @@ get="true" url="/client/api/Addresses" id-field="id" - data="addressData.address" + data="$ctrl.address" form="form"> @@ -11,18 +11,18 @@ Consignatario - - + + - - + + - - + + - - + + diff --git a/client/client/src/address-edit/address-edit.js b/client/client/src/address-edit/address-edit.js index 1e4fdb6001..0605a3c026 100644 --- a/client/client/src/address-edit/address-edit.js +++ b/client/client/src/address-edit/address-edit.js @@ -1,18 +1,5 @@ -import {module} from '../module'; +import ngModule from '../module'; -class Controller { - constructor($stateParams) { - this.address = { - id: $stateParams.addressId - }; - } -} -Controller.$inject = ['$stateParams']; - -export const NAME = 'vnAddressEdit'; -export const COMPONENT = { - template: require('./address-edit.html'), - controllerAs: 'addressData', - controller: Controller -}; -module.component(NAME, COMPONENT); +ngModule.component('vnAddressEdit', { + template: require('./address-edit.html') +}); diff --git a/client/client/src/addresses/addresses.js b/client/client/src/addresses/addresses.js index be0e6f3989..12c2c380e5 100644 --- a/client/client/src/addresses/addresses.js +++ b/client/client/src/addresses/addresses.js @@ -1,6 +1,5 @@ -import {module} from '../module'; +import ngModule from '../module'; -export const component = { +ngModule.component('vnClientAddresses', { template: require('./addresses.html') -}; -module.component('vnClientAddresses', component); +}); diff --git a/client/client/src/basic-data/basic-data.html b/client/client/src/basic-data/basic-data.html index 0283320b3d..5563d1e7d9 100644 --- a/client/client/src/basic-data/basic-data.html +++ b/client/client/src/basic-data/basic-data.html @@ -1,9 +1,9 @@ - + + save="patch"> diff --git a/client/client/src/basic-data/basic-data.js b/client/client/src/basic-data/basic-data.js index de05dd81ab..e7d877432e 100644 --- a/client/client/src/basic-data/basic-data.js +++ b/client/client/src/basic-data/basic-data.js @@ -1,9 +1,8 @@ -import {module} from '../module'; +import ngModule from '../module'; -export const component = { +ngModule.component('vnClientBasicData', { template: require('./basic-data.html'), bindings: { client: '<' } -}; -module.component('vnClientBasicData', component); +}); diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index 5d37e4f3a3..f43f41e767 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -1,30 +1,30 @@ - + + save="patch"> - + Información de facturación - - + + - - - - + + + + @@ -32,9 +32,9 @@ Documentación - - - + + + @@ -44,7 +44,7 @@
    + on-response="$ctrl.returnDialog(response)"> Changed terms diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 813aa79b13..8fe8062c69 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -1,8 +1,6 @@ -import {module} from '../module'; +import ngModule from '../module'; -export const NAME = 'vnClientBillingData'; - -class billingData { +export default class Controller { constructor($scope, $http, $timeout, vnAppLogger, $translate) { this.$ = $scope; this.http = $http; @@ -13,18 +11,15 @@ class billingData { this.dueDay = null; this.copyData(); } - $onChanges(changes) { this.copyData(); } - copyData() { if (this.client) { this.payId = this.client.payMethodFk || null; this.dueDay = this.client.dueDay ? this.client.dueDay : null; } } - checkChanges() { let payId = this.client.payMethodFk || null; let dueDay = this.client.dueDay || null; @@ -45,19 +40,16 @@ class billingData { } this.timeout(() => this.$.watcher.submit()); } - sendMail() { return this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); } } -billingData.$inject = ['$scope', '$http', '$timeout', 'vnAppLogger', '$translate']; +Controller.$inject = ['$scope', '$http', '$timeout', 'vnAppLogger', '$translate']; -export const COMPONENT = { +ngModule.component('vnClientBillingData', { template: require('./billing-data.html'), - controller: billingData, - controllerAs: 'bill', + controller: Controller, bindings: { client: '<' } -}; -module.component(NAME, COMPONENT); +}); diff --git a/client/client/src/card/card.html b/client/client/src/card/card.html index 589deb1525..0319c72fd6 100644 --- a/client/client/src/card/card.html +++ b/client/client/src/card/card.html @@ -1,7 +1,15 @@ - + + - + + diff --git a/client/client/src/card/card.js b/client/client/src/card/card.js index 43d19facf5..06689a697f 100644 --- a/client/client/src/card/card.js +++ b/client/client/src/card/card.js @@ -1,17 +1,14 @@ -import {module} from '../module'; +import ngModule from '../module'; import './style.css'; -export const NAME = 'vnClientCard'; - -export default class vnClientCard { +export default class Controller { constructor() { this.client = null; } } - -module.component(NAME, { +ngModule.component('vnClientCard', { template: require('./card.html'), - controllerAs: 'card', - controller: vnClientCard + controller: Controller, + controllerAs: 'card' }); diff --git a/client/client/src/client.js b/client/client/src/client.js index 1ae857fa45..6dc0de725e 100644 --- a/client/client/src/client.js +++ b/client/client/src/client.js @@ -1,27 +1,16 @@ export * from './module'; -export {NAME as CLIENT_CARD, - COMPONENT as CLIENT_CARD_COMPONENT} from './card/card'; -export {NAME as CLIENTS, - COMPONENT as CLIENTS_COMPONENT} from './index/index'; -export {NAME as CLIENT_FISCAL_DATA_INDEX, - COMPONENT as CLIENT_FISCAL_DATA_INDEX_COMPONENT} from './fiscal-data/fiscal-data'; -export {NAME as CLIENT_BILLING_DATA_INDEX, - COMPONENT as CLIENT_BILLINGL_DATA_INDEX_COMPONENT} from './billing-data/billing-data'; -export {NAME as CLIENT_DESCRIPTOR, - COMPONENT as CLIENT_DESCRIPTOR_COMPONENT} from './descriptor/descriptor'; -export {NAME as CLIENT_NOTES, - COMPONENT as CLIENT_NOTES_COMPONENT} from './notes/notes'; -export {NAME as CLIENT_SEARCH_PANEL, - COMPONENT as CLIENT_SEARCH_PANEL_COMPONENT} from './search-panel/search-panel'; -export {NAME as CLIENT_CREATE, - COMPONENT as CLIENT_CREATE_COMPONENT} from './create/create'; -export {NAME as CLIENT_ADDRESS_EDIT_INDEX, - COMPONENT as CLIENT_ADDRESS_EDIT_INDEX_COMPONENT} from './address-edit/address-edit'; -export {NAME as NEW_NOTE_INDEX, - COMPONENT as NEW_NOTE_INDEX_COMPONENT} from './new-note/new-note'; - +import './index/index'; +import './card/card'; +import './create/create'; +import './basic-data/basic-data'; +import './fiscal-data/fiscal-data'; +import './billing-data/billing-data'; +import './descriptor/descriptor'; +import './search-panel/search-panel'; import './addresses/addresses'; import './address-create/address-create'; -import './basic-data/basic-data'; +import './address-edit/address-edit'; +import './notes/notes'; +import './note-create/note-create'; import './web-access/web-access'; diff --git a/client/client/src/create/create.js b/client/client/src/create/create.js index bdf8254818..601bab71bb 100644 --- a/client/client/src/create/create.js +++ b/client/client/src/create/create.js @@ -1,23 +1,22 @@ -import {module} from '../module'; +import ngModule from '../module'; -class Controller { +export default class Controller { constructor($scope, $state) { - this.$scope = $scope; + this.$ = $scope; this.$state = $state; this.client = { active: true }; } onSubmit() { - this.$scope.watcher.submit().then( + this.$.watcher.submit().then( json => this.$state.go('clientCard.basicData', {id: json.data.id}) ); } } Controller.$inject = ['$scope', '$state']; -export const component = { +ngModule.component('vnClientCreate', { template: require('./create.html'), controller: Controller -}; -module.component('vnClientCreate', component); +}); diff --git a/client/client/src/descriptor/descriptor.html b/client/client/src/descriptor/descriptor.html index 3338030516..48a8782213 100644 --- a/client/client/src/descriptor/descriptor.html +++ b/client/client/src/descriptor/descriptor.html @@ -5,10 +5,10 @@ person -
    {{descriptor.client.id}}
    -
    {{descriptor.client.name}}
    -
    {{descriptor.client.phone}}
    - +
    {{$ctrl.client.id}}
    +
    {{$ctrl.client.name}}
    +
    {{$ctrl.client.phone}}
    +
    diff --git a/client/client/src/descriptor/descriptor.js b/client/client/src/descriptor/descriptor.js index a9c5722ecd..b8c2092a99 100644 --- a/client/client/src/descriptor/descriptor.js +++ b/client/client/src/descriptor/descriptor.js @@ -1,21 +1,27 @@ -import {module} from '../module'; +import ngModule from '../module'; import './style.css'; -export const NAME = 'vnDescriptor'; -export const COMPONENT = { +export default class Controller { + constructor($scope, $http) { + this.$http = $http; + } + $onChanges(changes) { + let active = changes.active; + let sendPut = active + && !active.isFirstChange() + && active.previousValue !== active.currentValue; + + if (sendPut) + $http.put(`/client/api/Clients/${this.client.id}/activate`); + } +} +Controller.$inject = ['$scope', '$http']; + +ngModule.component('vnDescriptor', { template: require('./descriptor.html'), - controllerAs: 'descriptor', + controller: Controller, bindings: { client: '<', active: '<' - }, - controller: function($http, $scope) { - var self = this; - $scope.$watch('descriptor.active', function(newValue, oldValue) { - if (oldValue !== undefined) - $http.put(`/client/api/Clients/${self.client.id}/activate`); - }); } -}; -COMPONENT.controller.$inject = ['$http', '$scope']; -module.component(NAME, COMPONENT); +}); diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 7e9b2a7e99..8dc48b5e8d 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -1,35 +1,35 @@ - + + save="patch">
    Datos fiscales y de facturación - - + + - - + + - + -
    {{itemClient.client.name}}
    -
    Id Cliente: {{itemClient.client.id}}
    -
    Teléfono: {{itemClient.client.phone | phone}}
    -
    Población: {{itemClient.client.city}}
    -
    email: {{itemClient.client.email}}
    +
    +
    {{$ctrl.client.name}}
    +
    Id Cliente: {{$ctrl.client.id}}
    +
    Teléfono: {{$ctrl.client.phone | phone}}
    +
    Población: {{$ctrl.client.city}}
    +
    email: {{$ctrl.client.email}}
    diff --git a/client/client/src/index/item-client.js b/client/client/src/index/item-client.js index 0c666fd7b6..ea664d09c9 100644 --- a/client/client/src/index/item-client.js +++ b/client/client/src/index/item-client.js @@ -1,11 +1,8 @@ -import {module} from '../module'; +import ngModule from '../module'; -export const NAME = 'vnItemClient'; -export const COMPONENT = { +ngModule.component('vnItemClient', { template: require('./item-client.html'), - controllerAs: 'itemClient', bindings: { client: '<' } -}; -module.component(NAME, COMPONENT); +}); diff --git a/client/client/src/module.js b/client/client/src/module.js index 431ebee0bc..1f9ed97680 100644 --- a/client/client/src/module.js +++ b/client/client/src/module.js @@ -1,4 +1,5 @@ import {ng} from 'vendor'; import 'core'; -export const module = ng.module('client', []); +const ngModule = ng.module('client', []); +export default ngModule; diff --git a/client/client/src/new-note/new-note.js b/client/client/src/new-note/new-note.js deleted file mode 100644 index 8138990b51..0000000000 --- a/client/client/src/new-note/new-note.js +++ /dev/null @@ -1,27 +0,0 @@ -import template from './new-note.html'; -import {module} from '../module'; - -class Controller { - constructor($element, $state) { - this.element = $element[0]; - this.$state = $state; - this.note = { - clientFk: $state.params.id, - text: null - }; - } - onSubmit() { - this.element.querySelector('vn-watcher').$ctrl.submit().then( - () => this.$state.go('clientCard.notes') - ); - } -} -Controller.$inject = ['$element', '$state']; - -export const NAME = 'vnNewNote'; -export const COMPONENT = { - template: template, - controllerAs: 'newNote', - controller: Controller -}; -module.component(NAME, COMPONENT); diff --git a/client/client/src/new-note/new-note.html b/client/client/src/note-create/note-create.html similarity index 61% rename from client/client/src/new-note/new-note.html rename to client/client/src/note-create/note-create.html index 2e05ec2442..4a0617c3a1 100644 --- a/client/client/src/new-note/new-note.html +++ b/client/client/src/note-create/note-create.html @@ -2,14 +2,14 @@ vn-id="watcher" url="/client/api/ClientObservations" id-field="id" - data="newNote.note" + data="$ctrl.note" form="form"> - + Nueva nota - + diff --git a/client/client/src/note-create/note-create.js b/client/client/src/note-create/note-create.js new file mode 100644 index 0000000000..3f5c68ce2d --- /dev/null +++ b/client/client/src/note-create/note-create.js @@ -0,0 +1,16 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($state) { + this.note = { + clientFk: parseInt($state.params.id), + text: null + }; + } +} +Controller.$inject = ['$state']; + +ngModule.component('vnNoteCreate', { + template: require('./note-create.html'), + controller: Controller +}); diff --git a/client/client/src/notes/notes.html b/client/client/src/notes/notes.html index a671a353e6..aad8a06e32 100644 --- a/client/client/src/notes/notes.html +++ b/client/client/src/notes/notes.html @@ -1,7 +1,7 @@ - + Notas - +
    {{n.created | date:'dd/MM/yyyy HH:mm'}}
    {{n.employee.name}}
    @@ -12,6 +12,6 @@
    \ No newline at end of file diff --git a/client/client/src/notes/notes.js b/client/client/src/notes/notes.js index d5482bcb10..e482bd2761 100644 --- a/client/client/src/notes/notes.js +++ b/client/client/src/notes/notes.js @@ -1,34 +1,34 @@ +import ngModule from '../module'; import './style.css'; -import template from './notes.html'; -import {module} from '../module'; -export const NAME = 'vnClientNotes'; -export const COMPONENT = { - template: template, - controllerAs: 'observation', +export default class Controller { + constructor($http, $state) { + this.$http = $http; + this.$state = $state; + } + $onChanges(changes) { + if (this.client) { + this.getObservation(this.client.id); + } + } + getObservation(clientId) { + let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); + this.$http.get(`/client/api/clientObservations?filter=${json}`).then( + json => { + this.observations = json.data; + } + ); + } + newObservation() { + this.$state.go("clientCard.notes.create", {id: this.client.id}); + } +} +Controller.$inject = ['$http', '$state']; + +ngModule.component('vnClientNotes', { + template: require('./notes.html'), + controller: Controller, bindings: { client: '<' - }, - controller: function($http, $state) { - this.$onChanges = function(changes) { - if (this.client) { - this.getObservation(this.client.id); - } - }; - - this.getObservation = function(clientId) { - let json = JSON.stringify({where: {clientFk: this.client.id}, order: 'created DESC'}); - $http.get(`/client/api/clientObservations?filter=${json}`).then( - json => { - this.observations = json.data; - } - ); - }; - - this.newObservation = () => { - $state.go("clientCard.notes.create", {id: this.client.id}); - }; } -}; -COMPONENT.controller.$inject = ['$http', '$state']; -module.component(NAME, COMPONENT); +}); diff --git a/client/client/src/search-panel/search-panel.html b/client/client/src/search-panel/search-panel.html index 60385efc56..43ab1c73ec 100644 --- a/client/client/src/search-panel/search-panel.html +++ b/client/client/src/search-panel/search-panel.html @@ -1,5 +1,5 @@ -
    - +
    + diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index c809bc6151..7d15301fec 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -1,28 +1,35 @@ -import {module} from '../module'; +import ngModule from '../module'; -export const NAME = 'vnClientSearchPanel'; -export const COMPONENT = { - template: require('./search-panel.html'), - controller: function($scope, $window) { - this.filter = {id: null, fi: null, name: null, socialName: null, city: null, postcode: null, email: null, phone: null}; - this.formVisibility = true; - this.onSearch = () => { - this.setStorageValue(); - this.onSubmit(this.filter); - }; - this.getKeyPressed = function(event) { - if (event.which === 27) - this.formVisibility = false; - }; - this.$onChanges = () => { - var value = JSON.parse($window.sessionStorage.getItem('filter')); - if (value !== undefined) - this.filter = value; - }; - this.setStorageValue = () => { - $window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); +export default class Controller { + constructor($window) { + this.$window = $window; + this.filter = { + id: null, + fi: null, + name: null, + socialName: null, + city: null, + postcode: null, + email: null, + phone: null }; } -}; + onSearch() { + this.setStorageValue(); + this.onSubmit(this.filter); + } + $onChanges() { + var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); + if (value !== undefined) + this.filter = value; + } + setStorageValue() { + this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); + } +} +Controller.$inject = ['$window']; -module.component(NAME, COMPONENT); +ngModule.component('vnClientSearchPanel', { + template: require('./search-panel.html'), + controller: Controller +}); diff --git a/client/client/src/web-access/web-access.js b/client/client/src/web-access/web-access.js index 413d80059b..6a2eedecb7 100644 --- a/client/client/src/web-access/web-access.js +++ b/client/client/src/web-access/web-access.js @@ -1,8 +1,8 @@ -import {module} from '../module'; +import ngModule from '../module'; -class Controller { +export default class Controller { constructor($scope, $http, vnAppLogger) { - this.$scope = $scope; + this.$ = $scope; this.$http = $http; this.vnAppLogger = vnAppLogger; } @@ -13,7 +13,7 @@ class Controller { onPassOpen() { this.newPassword = ''; this.repeatPassword = ''; - this.$scope.$apply(); + this.$.$apply(); } onPassChange(response) { if (response == 'ACCEPT') @@ -26,7 +26,7 @@ class Controller { password: this.newPassword }; - this.$http.put(`/client/api/Accounts/${this.client.id}`, account); + this.$http.patch(`/client/api/Accounts/${this.client.id}`, account); } catch (e) { this.vnAppLogger.showError(e.message); return false; @@ -37,10 +37,10 @@ class Controller { } Controller.$inject = ['$scope', '$http', 'vnAppLogger']; -module.component('vnClientWebAccess', { +ngModule.component('vnClientWebAccess', { template: require('./web-access.html'), + controller: Controller, bindings: { client: '<' - }, - controller: Controller + } }); diff --git a/client/core/src/dialog/dialog.js b/client/core/src/dialog/dialog.js index e2be657991..6f2c7d3c7f 100644 --- a/client/core/src/dialog/dialog.js +++ b/client/core/src/dialog/dialog.js @@ -56,6 +56,9 @@ export default class Dialog extends Component { } /** * Calls the response handler. + * + * @param {String} response The response code + * @return {Boolean} %true if response was canceled, %false otherwise */ fireResponse(response) { let cancel = false; diff --git a/client/core/src/lib/crud.js b/client/core/src/lib/crud.js index 5bddebfb8a..f515009b57 100644 --- a/client/core/src/lib/crud.js +++ b/client/core/src/lib/crud.js @@ -24,6 +24,14 @@ function put(mgPut) { } module.factory('vnPut', put); +put.$inject = ['mgPatch']; +function patch(mgPatch) { + return Object.assign({}, mgPatch, { + success: 'vnSuccessFactoryCreate' + }); +} +module.factory('vnPatch', patch); + post.$inject = ['mgCreate']; function post(mgCreate) { return Object.assign({}, mgCreate, { diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index 30a56a633f..f04cb3d090 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -2,12 +2,12 @@ import {module} from '../module'; import './style.css'; directive.$inject = ['vnPopover']; -export function directive(popover) { +export function directive(vnPopover) { return { restrict: 'A', link: function($scope, $element, $attrs) { $element.on('click', function(event) { - popover.showComponent($attrs.vnDialog, $scope, $element); + vnPopover.showComponent($attrs.vnDialog, $scope, $element); event.preventDefault(); }); } @@ -24,7 +24,7 @@ export class Popover { let popover = this.document.createElement('div'); popover.className = 'vn-popover'; popover.addEventListener('mousedown', - event => this.onPopoverMouseDown(event)); + e => this.onPopoverMouseDown(e)); popover.appendChild(childElement); this.popover = popover; @@ -70,8 +70,12 @@ export class Popover { } this.document.body.appendChild(popover); - this.docMouseDownHandler = event => this.onDocMouseDown(event); + + this.docMouseDownHandler = e => this.onDocMouseDown(e); this.document.addEventListener('mousedown', this.docMouseDownHandler); + + this.docKeyDownHandler = e => this.onDocKeyDown(e); + this.document.addEventListener('keydown', this.docKeyDownHandler); } showComponent(childComponent, $scope, parent) { let childElement = this.document.createElement(childComponent); @@ -81,15 +85,21 @@ export class Popover { hide() { if (!this.popover) return; this.document.removeEventListener('mousedown', this.docMouseDownHandler); + this.document.removeEventListener('keydown', this.docKeyDownHandler); this.document.body.removeChild(this.popover); this.popover = null; this.lastEvent = null; this.docMouseDownHandler = null; + this.docKeyDownHandler = null; } onDocMouseDown(event) { if (event != this.lastEvent) this.hide(); } + onDocKeyDown(event) { + if (event.keyCode === 27) + this.hide(); + } onPopoverMouseDown(event) { this.lastEvent = event; } diff --git a/client/core/src/watcher/watcher.js b/client/core/src/watcher/watcher.js index aec3bc0a8d..e4b5c23058 100644 --- a/client/core/src/watcher/watcher.js +++ b/client/core/src/watcher/watcher.js @@ -54,6 +54,16 @@ export default class Watcher extends Component { () => this.window.history.back() ); } + /** + * Submits the data and goes another state. + * + * @param {String} state The state name + */ + submitGo(state) { + this.submit().then( + () => this.$state.go(state) + ); + } /** * Submits the data to the server. * @@ -91,7 +101,7 @@ export default class Watcher extends Component { if (id) { return new Promise((resolve, reject) => { - this.$http.put(`${this.url}/${id}`, changedData).then( + this.$http.patch(`${this.url}/${id}`, changedData).then( json => this.writeData(json, resolve), json => reject(json) ); diff --git a/services/auth/package.json b/services/auth/package.json index cc2ba6428b..bc6233e613 100644 --- a/services/auth/package.json +++ b/services/auth/package.json @@ -1,5 +1,5 @@ { - "name": "login", + "name": "vn-auth", "version": "1.0.0", "main": "server/server.js", "scripts": { @@ -11,14 +11,14 @@ "compression": "^1.0.3", "cors": "^2.5.2", "helmet": "^1.3.0", - "loopback": "^2.22.0", - "loopback-boot": "^2.6.5", - "loopback-component-explorer": "^2.4.0", + "loopback": "^3.8.0", + "loopback-boot": "^2.24.0", + "loopback-component-explorer": "^4.2.0", "loopback-connector-mysql": "^3.0.0", - "loopback-datasource-juggler": "^2.39.0", + "loopback-context": "^3.1.0", "md5": "^2.2.1", "serve-favicon": "^2.0.1", - "strong-error-handler": "^1.0.1" + "strong-error-handler": "^2.1.0" }, "devDependencies": { "eslint": "^2.13.1", @@ -27,8 +27,8 @@ }, "repository": { "type": "git", - "url": "http://git.verdnatura.es:/salix" + "url": "https://git.verdnatura.es/salix" }, - "license": "UNLICENSED", - "description": "app" + "license": "GPL-3.0", + "description": "Authentication service" } diff --git a/services/client/common/scopes/client/activate.js b/services/client/common/methods/client/activate.js similarity index 100% rename from services/client/common/scopes/client/activate.js rename to services/client/common/methods/client/activate.js diff --git a/services/client/common/scopes/client/addresses.js b/services/client/common/methods/client/addresses.js similarity index 100% rename from services/client/common/scopes/client/addresses.js rename to services/client/common/methods/client/addresses.js diff --git a/services/client/common/scopes/client/before-save.js b/services/client/common/methods/client/before-save.js similarity index 100% rename from services/client/common/scopes/client/before-save.js rename to services/client/common/methods/client/before-save.js diff --git a/services/client/common/scopes/client/card.js b/services/client/common/methods/client/card.js similarity index 89% rename from services/client/common/scopes/client/card.js rename to services/client/common/methods/client/card.js index 74023ee316..34dd7a280c 100644 --- a/services/client/common/scopes/client/card.js +++ b/services/client/common/methods/client/card.js @@ -1,7 +1,4 @@ module.exports = function(Client) { - // Validations - var card = require('./card.json'); - Client.remoteMethod('card', { description: 'Get client for card call', accepts: { @@ -27,7 +24,7 @@ module.exports = function(Client) { where: { id: id }, - include: card + include: require('./card.json') }; Client.find(filter, function(err, instances) { diff --git a/services/client/common/methods/client/card.json b/services/client/common/methods/client/card.json new file mode 100644 index 0000000000..05b86ea6f7 --- /dev/null +++ b/services/client/common/methods/client/card.json @@ -0,0 +1,33 @@ +[ + { + "relation": "salesPerson", + "scope": { + "fields": ["id", "name"] + } + }, { + "relation": "contactChannel", + "scope": { + "fields": ["id", "name"] + } + }, { + "relation": "province", + "scope": { + "fields": ["id", "name"] + } + }, { + "relation": "country", + "scope": { + "fields": ["id", "name"] + } + }, { + "relation": "payMethod", + "scope": { + "fields": ["id", "name"] + } + }, { + "relation": "account", + "scope": { + "fields": ["id", "name", "active"] + } + } +] \ No newline at end of file diff --git a/services/client/common/scopes/client/filter.js b/services/client/common/methods/client/filter.js similarity index 95% rename from services/client/common/scopes/client/filter.js rename to services/client/common/methods/client/filter.js index d60f4c21c9..8080b70579 100644 --- a/services/client/common/scopes/client/filter.js +++ b/services/client/common/methods/client/filter.js @@ -1,7 +1,8 @@ module.exports = function(Client){ Client.installMethod('filter', filterClients); + function filterClients(p) { - if(p.search && p.search !== "") + if(p.search) return searchWhere(p); return andWhere(p); } diff --git a/services/client/common/models/Client.js b/services/client/common/models/Client.js index d358d5b56b..5061a5a436 100644 --- a/services/client/common/models/Client.js +++ b/services/client/common/models/Client.js @@ -5,11 +5,11 @@ module.exports = function(Client) { // Methods - require('../scopes/client/card.js')(Client); - require('../scopes/client/activate.js')(Client); - require('../scopes/client/addresses.js')(Client); - require('../scopes/client/filter.js')(Client); - require('../scopes/client/before-save.js')(Client); + require('../methods/client/card.js')(Client); + require('../methods/client/activate.js')(Client); + require('../methods/client/addresses.js')(Client); + require('../methods/client/filter.js')(Client); + require('../methods/client/before-save.js')(Client); // Validations @@ -62,7 +62,7 @@ module.exports = function(Client) { done(); }); } - +/* Client.validateAsync('credit', validateCredit, { message: 'No tienes privilegios para modificar el crédito' }); @@ -137,4 +137,5 @@ module.exports = function(Client) { done(); } } +*/ }; \ No newline at end of file diff --git a/services/client/common/scopes/client/card.json b/services/client/common/scopes/client/card.json deleted file mode 100644 index 332a0409b3..0000000000 --- a/services/client/common/scopes/client/card.json +++ /dev/null @@ -1,57 +0,0 @@ -[ - { - "relation": "salesPerson", - "scope": { - "fields": [ - "id", - "name" - ] - } - }, - { - "relation": "contactChannel", - "scope": { - "fields": [ - "id", - "name" - ] - } - }, - { - "relation": "province", - "scope": { - "fields": [ - "id", - "name" - ] - } - }, - { - "relation": "country", - "scope": { - "fields": [ - "id", - "name" - ] - } - }, - { - "relation": "payMethod", - "scope": { - "fields": [ - "id", - "name" - ] - } - }, - { - "relation": "account", - "scope": { - "fields": [ - "id", - "name", - "active" - ] - } - } -] \ No newline at end of file diff --git a/services/client/package.json b/services/client/package.json index 4bfb667231..bb21bcb061 100644 --- a/services/client/package.json +++ b/services/client/package.json @@ -1,5 +1,5 @@ { - "name": "client", + "name": "vn-client", "version": "1.0.0", "main": "server/server.js", "scripts": { @@ -12,14 +12,13 @@ "cors": "^2.5.2", "helmet": "^1.3.0", "i18n": "^0.8.3", - "loopback": "^2.38.3", - "loopback-boot": "^2.6.5", - "loopback-component-explorer": "^2.7.0", + "loopback": "^3.8.0", + "loopback-boot": "^2.24.0", + "loopback-component-explorer": "^4.2.0", "loopback-connector-mysql": "^3.0.0", "loopback-context": "^3.1.0", - "loopback-datasource-juggler": "^2.54.1", "serve-favicon": "^2.0.1", - "strong-error-handler": "^1.2.1" + "strong-error-handler": "^2.1.0" }, "devDependencies": { "eslint": "^2.13.1", @@ -27,9 +26,9 @@ "nsp": "^2.1.0" }, "repository": { - "type": "", - "url": "" + "type": "git", + "url": "https://git.verdnatura.es/salix" }, - "license": "UNLICENSED", - "description": "client" + "license": "GPL-3.0", + "description": "Client service" } diff --git a/services/salix/package.json b/services/salix/package.json index 2eaa676a0b..d4c0099c4c 100644 --- a/services/salix/package.json +++ b/services/salix/package.json @@ -1,5 +1,5 @@ { - "name": "app", + "name": "salix", "version": "1.0.0", "main": "server/server.js", "scripts": { @@ -9,15 +9,16 @@ }, "dependencies": { "compression": "^1.0.3", + "cookie-parser": "^1.4.3", "cors": "^2.5.2", "helmet": "^1.3.0", - "loopback": "^2.22.0", - "loopback-boot": "^2.6.5", - "loopback-component-explorer": "^2.4.0", - "loopback-connector-mysql": "^4.1.0", - "loopback-datasource-juggler": "^2.39.0", + "loopback": "^3.8.0", + "loopback-boot": "^2.24.0", + "loopback-component-explorer": "^4.2.0", + "loopback-connector-mysql": "^3.0.0", + "loopback-context": "^3.1.0", "serve-favicon": "^2.0.1", - "strong-error-handler": "^1.0.1" + "strong-error-handler": "^2.1.0" }, "devDependencies": { "eslint": "^2.13.1", @@ -25,9 +26,9 @@ "nsp": "^2.1.0" }, "repository": { - "type": "", - "url": "" + "type": "git", + "url": "https://git.verdnatura.es/salix" }, - "license": "UNLICENSED", - "description": "app" + "license": "GPL-3.0", + "description": "Salix application service" } diff --git a/webpack.config.js b/webpack.config.js index c4e78fced0..d5166e84fc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -57,7 +57,7 @@ var config = { names: ['bundle.vendor', 'bundle.manifest'] }) ], - devtool: 'source-map' + devtool: 'eval-source-map' }; if (!devMode) { From 609c9844268e9c18f0349e6d4d020d55ab2841b0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 5 Jun 2017 09:01:21 +0200 Subject: [PATCH 126/391] Loopback 3, errores solucionados, codigo reorganizado --- .../src/address-create/address-create.html | 2 +- .../client/src/billing-data/billing-data.js | 10 +- client/client/src/descriptor/descriptor.js | 14 +-- .../client/src/note-create/note-create.html | 2 +- .../client/src/search-panel/search-panel.html | 3 +- .../client/src/search-panel/search-panel.js | 10 -- client/client/src/web-access/web-access.js | 8 +- client/core/src/lib/app.js | 23 +++++ client/core/src/lib/index.js | 2 + client/core/src/lib/interceptor.js | 53 +++++++++++ client/core/src/lib/interpolate.js | 52 ++++------ .../core/src/lib/resolveDefaultComponents.js | 51 ++++------ client/core/src/lib/splitingRegister.js | 11 ++- client/core/src/lib/string.js | 6 +- client/core/src/watcher/watcher.js | 10 +- client/salix/src/components/app/app.html | 6 +- client/salix/src/components/app/app.js | 95 +++---------------- client/salix/src/components/app/style.scss | 1 - client/salix/src/components/home/home.js | 14 +-- .../salix/src/components/left-menu/actions.js | 4 +- .../src/components/left-menu/left-menu.js | 7 +- .../src/components/main-menu/main-menu.html | 20 ++-- .../src/components/main-menu/main-menu.js | 6 +- .../src/components/searchbar/searchbar.js | 1 + client/salix/src/config.js | 17 +++- client/salix/src/locale/en.json | 1 + client/salix/src/locale/es.json | 1 + client/salix/src/module.js | 3 +- .../models/{Account.json => account.json} | 0 services/auth/common/models/user.json | 11 +++ services/auth/server/datasources.json | 4 +- services/auth/server/model-config.json | 11 ++- .../models/{Account.json => account.json} | 0 .../common/models/{Address.js => address.js} | 0 .../models/{Address.json => address.json} | 0 ...AgencyService.json => agency-service.json} | 0 ...ditLimit.json => client-credit-limit.json} | 0 .../{ClientCredit.json => client-credit.json} | 0 ...ntObservation.js => client-observation.js} | 0 ...servation.json => client-observation.json} | 0 .../common/models/{Client.js => client.js} | 0 .../models/{Client.json => client.json} | 0 ...ntactChannel.json => contact-channel.json} | 0 .../models/{Country.json => country.json} | 0 .../models/{Employee.json => employee.json} | 0 .../common/models/{MyModel.js => my-model.js} | 0 .../models/{MyModel.json => my-model.json} | 0 .../{PayMethod.json => pay-method.json} | 0 .../models/{Province.json => province.json} | 0 services/client/common/models/user.json | 11 +++ services/client/server/datasources.json | 8 +- services/client/server/model-config.json | 13 ++- services/salix/common/models/user.json | 11 +++ services/salix/server/datasources.json | 4 +- services/salix/server/model-config.json | 13 ++- webpack.config.js | 2 +- 56 files changed, 282 insertions(+), 239 deletions(-) create mode 100644 client/core/src/lib/app.js create mode 100644 client/core/src/lib/interceptor.js rename services/auth/common/models/{Account.json => account.json} (100%) create mode 100644 services/auth/common/models/user.json rename services/client/common/models/{Account.json => account.json} (100%) rename services/client/common/models/{Address.js => address.js} (100%) rename services/client/common/models/{Address.json => address.json} (100%) rename services/client/common/models/{AgencyService.json => agency-service.json} (100%) rename services/client/common/models/{ClientCreditLimit.json => client-credit-limit.json} (100%) rename services/client/common/models/{ClientCredit.json => client-credit.json} (100%) rename services/client/common/models/{ClientObservation.js => client-observation.js} (100%) rename services/client/common/models/{ClientObservation.json => client-observation.json} (100%) rename services/client/common/models/{Client.js => client.js} (100%) rename services/client/common/models/{Client.json => client.json} (100%) rename services/client/common/models/{ContactChannel.json => contact-channel.json} (100%) rename services/client/common/models/{Country.json => country.json} (100%) rename services/client/common/models/{Employee.json => employee.json} (100%) rename services/client/common/models/{MyModel.js => my-model.js} (100%) rename services/client/common/models/{MyModel.json => my-model.json} (100%) rename services/client/common/models/{PayMethod.json => pay-method.json} (100%) rename services/client/common/models/{Province.json => province.json} (100%) create mode 100644 services/client/common/models/user.json create mode 100644 services/salix/common/models/user.json diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index caf042a212..f76a89a8d4 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -5,7 +5,7 @@ data="$ctrl.address" form="form"> - + Consignatario diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 8fe8062c69..9537b5590f 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -1,11 +1,11 @@ import ngModule from '../module'; export default class Controller { - constructor($scope, $http, $timeout, vnAppLogger, $translate) { + constructor($scope, $http, $timeout, vnApp, $translate) { this.$ = $scope; this.http = $http; this.timeout = $timeout; - this.logger = vnAppLogger; + this.vnApp = vnApp; this.translate = $translate; this.payId = null; this.dueDay = null; @@ -34,8 +34,8 @@ export default class Controller { returnDialog(response) { if (response === 'ACCEPT') { this.sendMail().then( - () => this.logger.showMessage(this.translate.instant('Notification sent!')), - () => this.logger.showMessage(this.translate.instant('Notification error')) + () => this.vnApp.showMessage(this.translate.instant('Notification sent!')), + () => this.vnApp.showMessage(this.translate.instant('Notification error')) ); } this.timeout(() => this.$.watcher.submit()); @@ -44,7 +44,7 @@ export default class Controller { return this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); } } -Controller.$inject = ['$scope', '$http', '$timeout', 'vnAppLogger', '$translate']; +Controller.$inject = ['$scope', '$http', '$timeout', 'vnApp', '$translate']; ngModule.component('vnClientBillingData', { template: require('./billing-data.html'), diff --git a/client/client/src/descriptor/descriptor.js b/client/client/src/descriptor/descriptor.js index b8c2092a99..ae19d96c4b 100644 --- a/client/client/src/descriptor/descriptor.js +++ b/client/client/src/descriptor/descriptor.js @@ -5,14 +5,14 @@ export default class Controller { constructor($scope, $http) { this.$http = $http; } - $onChanges(changes) { - let active = changes.active; - let sendPut = active - && !active.isFirstChange() - && active.previousValue !== active.currentValue; + set active(value) { + if (this._active !== value && this._active !== undefined) + this.$http.put(`/client/api/Clients/${this.client.id}/activate`); - if (sendPut) - $http.put(`/client/api/Clients/${this.client.id}/activate`); + this._active = value; + } + get active() { + return this._active; } } Controller.$inject = ['$scope', '$http']; diff --git a/client/client/src/note-create/note-create.html b/client/client/src/note-create/note-create.html index 4a0617c3a1..4331bb4643 100644 --- a/client/client/src/note-create/note-create.html +++ b/client/client/src/note-create/note-create.html @@ -5,7 +5,7 @@ data="$ctrl.note" form="form"> - + Nueva nota diff --git a/client/client/src/search-panel/search-panel.html b/client/client/src/search-panel/search-panel.html index 43ab1c73ec..f17828f6a2 100644 --- a/client/client/src/search-panel/search-panel.html +++ b/client/client/src/search-panel/search-panel.html @@ -1,5 +1,5 @@
    - + @@ -23,4 +23,3 @@
    - diff --git a/client/client/src/search-panel/search-panel.js b/client/client/src/search-panel/search-panel.js index 7d15301fec..12b368c798 100644 --- a/client/client/src/search-panel/search-panel.js +++ b/client/client/src/search-panel/search-panel.js @@ -3,16 +3,6 @@ import ngModule from '../module'; export default class Controller { constructor($window) { this.$window = $window; - this.filter = { - id: null, - fi: null, - name: null, - socialName: null, - city: null, - postcode: null, - email: null, - phone: null - }; } onSearch() { this.setStorageValue(); diff --git a/client/client/src/web-access/web-access.js b/client/client/src/web-access/web-access.js index 6a2eedecb7..aa1f5d8787 100644 --- a/client/client/src/web-access/web-access.js +++ b/client/client/src/web-access/web-access.js @@ -1,10 +1,10 @@ import ngModule from '../module'; export default class Controller { - constructor($scope, $http, vnAppLogger) { + constructor($scope, $http, vnApp) { this.$ = $scope; this.$http = $http; - this.vnAppLogger = vnAppLogger; + this.vnApp = vnApp; } $onChanges() { if (this.client) @@ -28,14 +28,14 @@ export default class Controller { this.$http.patch(`/client/api/Accounts/${this.client.id}`, account); } catch (e) { - this.vnAppLogger.showError(e.message); + this.vnApp.showError(e.message); return false; } return true; } } -Controller.$inject = ['$scope', '$http', 'vnAppLogger']; +Controller.$inject = ['$scope', '$http', 'vnApp']; ngModule.component('vnClientWebAccess', { template: require('./web-access.html'), diff --git a/client/core/src/lib/app.js b/client/core/src/lib/app.js new file mode 100644 index 0000000000..78afdbf0bf --- /dev/null +++ b/client/core/src/lib/app.js @@ -0,0 +1,23 @@ +import {module} from '../module'; + +/** + * The main application class. + * + * @property {String} name The application name. + * @property {Snackbar} snackbar The main object to show messages. + */ +export default class App { + show(message) { + if (this.snackbar) + this.snackbar.show({message: message}); + else + console.log(message); + } + showMessage(message) { + this.show(message); + } + showError(message) { + this.show(`Error: ${message}`); + } +} +module.service('vnApp', App); diff --git a/client/core/src/lib/index.js b/client/core/src/lib/index.js index 806c6cfde6..c911e09a3b 100644 --- a/client/core/src/lib/index.js +++ b/client/core/src/lib/index.js @@ -2,6 +2,8 @@ import './moduleLoader'; import './crud'; import './template'; import './getTemplate'; +import './app'; +import './interceptor'; export * from './util'; export {default as splitingRegister} from './splitingRegister'; diff --git a/client/core/src/lib/interceptor.js b/client/core/src/lib/interceptor.js new file mode 100644 index 0000000000..9cd97d78af --- /dev/null +++ b/client/core/src/lib/interceptor.js @@ -0,0 +1,53 @@ +import {module} from '../module'; + +interceptor.$inject = ['$q', '$rootScope', '$window', 'vnApp', '$translate', '$cookies']; +function interceptor($q, $rootScope, $window, vnApp, $translate, $cookies) { + $rootScope.loading = false; + return { + request: function(config) { + $rootScope.loading = true; + let token = $cookies.get('vnToken'); + + if (token) + config.headers.Authorization = token; + + return config; + }, + requestError: function(rejection) { + return $q.reject(rejection); + }, + response: function(response) { + switch (response.config.method) { + case 'PUT': + case 'POST': + case 'PATCH': + vnApp.showMessage($translate.instant('Data saved!')); + } + $rootScope.loading = false; + return response; + }, + responseError: function(rejection) { + $rootScope.loading = false; + let data = rejection.data; + let error; + + if (data && data.error instanceof Object) + error = data.error.message; + else if (rejection.status === -1) + error = $translate.instant(`Can't contact with server`); + else + error = `${rejection.status}: ${rejection.statusText}`; + + if (rejection.status === 401) { + let location = $window.location; + let continueUrl = location.pathname + location.search + location.hash; + continueUrl = encodeURIComponent(continueUrl); + $window.location = `/auth/?apiKey=${vnApp.name}&continue=${continueUrl}`; + } + + vnApp.showError(error); + return $q.reject(rejection); + } + }; +} +module.factory('vnInterceptor', interceptor); diff --git a/client/core/src/lib/interpolate.js b/client/core/src/lib/interpolate.js index d961a6a415..c14a2079b7 100644 --- a/client/core/src/lib/interpolate.js +++ b/client/core/src/lib/interpolate.js @@ -4,8 +4,6 @@ import * as util from './util'; export const NAME = util.getProviderName('interpolate'); -function minErr() {} - function stringify(value) { if (value === null) { // null || undefined return ''; @@ -89,9 +87,8 @@ function $get($parse, $exceptionHandler, $sce) { while (index < textLength) { if (((startIndex = text.indexOf(self._startSymbol, index)) !== -1) && ((endIndex = text.indexOf(self._endSymbol, startIndex + startSymbolLength)) !== -1)) { - if (index !== startIndex) { - concat.push(unescapeText(text.substring(index, startIndex))); - } + if (index !== startIndex) + concat.push(unescapeText(text.substring(index, startIndex))); exp = text.substring(startIndex + startSymbolLength, endIndex); expressions.push(exp); parseFns.push($parse(exp, parseStringifyInterceptor)); @@ -100,9 +97,8 @@ function $get($parse, $exceptionHandler, $sce) { concat.push(''); } else { // we did not find an interpolation, so we have to add the remainder to the separators array - if (index !== textLength) { - concat.push(unescapeText(text.substring(index))); - } + if (index !== textLength) + concat.push(unescapeText(text.substring(index))); break; } } @@ -114,9 +110,9 @@ function $get($parse, $exceptionHandler, $sce) { if (!mustHaveExpression || expressions.length) { var compute = function(values) { for (var i = 0, ii = expressions.length; i < ii; i++) { - if (allOrNothing && isUndefined(values[i])) return; - concat[expressionPositions[i]] = values[i]; - } + if (allOrNothing && isUndefined(values[i])) return; + concat[expressionPositions[i]] = values[i]; + } return concat.join(''); }; @@ -132,19 +128,19 @@ function $get($parse, $exceptionHandler, $sce) { var values = new Array(ii); try { - for (; i < ii; i++) { - values[i] = parseFns[i](context); - } - - return compute(values); - } catch (err) { - $exceptionHandler($interpolateMinErr.interr(text, err)); + for (; i < ii; i++) { + values[i] = parseFns[i](context); } + + return compute(values); + } catch (err) { + $exceptionHandler($interpolateMinErr.interr(text, err)); + } }, { - // all of these properties are undocumented for now - exp: text, // just for compatibility with regular watchers created via $watch - expressions: expressions - }); + // all of these properties are undocumented for now + exp: text, // just for compatibility with regular watchers created via $watch + expressions: expressions + }); } function parseStringifyInterceptor(value) { @@ -170,31 +166,25 @@ function $get($parse, $exceptionHandler, $sce) { $get.$inject = ['$parse', '$exceptionHandler', '$sce']; -export class Interpolate -{ +export class Interpolate { constructor() { this._startSymbol = '*['; this._endSymbol = ']*'; } - set startSymbol(value) { if (value) { this._startSymbol = value; return this; - } else { - return this._startSymbol; } + return this._startSymbol; } - set endSymbol(value) { if (value) { this._endSymbol = value; return this; - } else { - return this._endSymbol; } + return this._endSymbol; } - } Interpolate.prototype.$get = $get; diff --git a/client/core/src/lib/resolveDefaultComponents.js b/client/core/src/lib/resolveDefaultComponents.js index 312bf8ca22..58be1f72a4 100644 --- a/client/core/src/lib/resolveDefaultComponents.js +++ b/client/core/src/lib/resolveDefaultComponents.js @@ -1,39 +1,28 @@ import {module} from '../module'; import * as util from './util'; -import constant from './constants'; -import Interpolate from './interpolate'; -export const NAME = util.getProviderName('ResolveDefaultComponent'); +export const NAME = 'vnComponentResolver'; -function $get($injector, vnInterpolate) { - return { - getTemplate: function(name, attrs) { - this._frameworkName = 'Mdl'; - let _name = util.getFactoryName(name + this._frameworkName); - let defaultfactory = $injector.has(_name) ? $injector.get(_name) : undefined; - - if (!defaultfactory) { - throw new Error("factory is not defined"); - } - - let defaultValues = defaultfactory.default; - let template = defaultfactory.template; - let scope = Object.assign({}, defaultValues || {}, attrs || {}); - return template && vnInterpolate(template)(scope); - } - }; -} -$get.$inject = ['$injector', 'vnInterpolate']; - -export class ResolveDefaultComponent { - constructor() { - this._frameworkName = 'Mdl'; +export default class ComponentResolver { + constructor($injector, vnInterpolate) { + this.$injector = $injector; + this.vnInterpolate = vnInterpolate; + this.frameworkName = 'Mdl'; } - set frameworkName(value) { - this._frameworkName = value; + getTemplate(name, attrs) { + let factoryName = util.getFactoryName(name + this.frameworkName); + let factory = this.$injector.has(factoryName) ? + this.$injector.get(factoryName) : undefined; + + if (!factory) + throw new Error(`ComponentResolver: Factory '${factoryName}' is not defined`); + + let defaultValues = factory.default; + let template = factory.template; + let scope = Object.assign({}, defaultValues || {}, attrs || {}); + return template && this.vnInterpolate(template)(scope); } } +ComponentResolver.$inject = ['$injector', 'vnInterpolate']; -ResolveDefaultComponent.prototype.$get = $get; -var resolve = new ResolveDefaultComponent(); -module.provider(NAME, () => resolve); +module.service('vnComponentResolver', ComponentResolver); diff --git a/client/core/src/lib/splitingRegister.js b/client/core/src/lib/splitingRegister.js index 28daae0623..60c52f0bcf 100644 --- a/client/core/src/lib/splitingRegister.js +++ b/client/core/src/lib/splitingRegister.js @@ -12,14 +12,15 @@ class SplitingRegister { array.push(dependency); var first = this._graph[dependency]; - while (first && first.length > 0) { - dependency = first.shift(); - array = array.concat(this.getDependencies(dependency)); - } + if (first) + while (first.length > 0) { + dependency = first.shift(); + array = array.concat(this.getDependencies(dependency)); + } return array; } registerGraph(graph) { - this._graph = graph; + this._graph = graph; } register(moduleName, loader) { this._modules[moduleName] = loader; diff --git a/client/core/src/lib/string.js b/client/core/src/lib/string.js index e48bd082b9..c2128cd029 100644 --- a/client/core/src/lib/string.js +++ b/client/core/src/lib/string.js @@ -1,12 +1,12 @@ /** * Transforms a kebab-case string to camelCase. A kebab-case string * is a string with hyphen character as word separator. - * + * * @param {String} str The hyphenized string * @return {String} The camelized string */ export function kebabToCamel(str) { - var camelCased = str.replace (/-([a-z])/, function(g) { + var camelCased = str.replace(/-([a-z])/, function(g) { return g[1].toUpperCase(); }); return camelCased; @@ -14,7 +14,7 @@ export function kebabToCamel(str) { /** * Transforms the first letter of a string to uppercase. - * + * * @param {String} str The input string * @return {String} The transformed string */ diff --git a/client/core/src/watcher/watcher.js b/client/core/src/watcher/watcher.js index e4b5c23058..c50ea94c39 100644 --- a/client/core/src/watcher/watcher.js +++ b/client/core/src/watcher/watcher.js @@ -11,13 +11,13 @@ import isEqual from '../lib/equals'; * properties are provided. */ export default class Watcher extends Component { - constructor($element, $scope, $state, $transitions, $http, vnAppLogger, $translate) { + constructor($element, $scope, $state, $transitions, $http, vnApp, $translate) { super($element); this.$scope = $scope; this.$state = $state; this.$http = $http; this.$translate = $translate; - this.vnAppLogger = vnAppLogger; + this.vnApp = vnApp; this.state = null; this.deregisterCallback = $transitions.onStart({}, @@ -121,13 +121,13 @@ export default class Watcher extends Component { resolve(json); } noChanges(resolve) { - this.vnAppLogger.showMessage( + this.vnApp.showMessage( this.$translate.instant('No changes to save') ); resolve(); } invalidForm(resolve) { - this.vnAppLogger.showMessage( + this.vnApp.showMessage( this.$translate.instant('Some fields are invalid') ); resolve(); @@ -156,7 +156,7 @@ export default class Watcher extends Component { } } } -Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnAppLogger', '$translate']; +Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnApp', '$translate']; module.component('vnWatcher', { template: require('./watcher.html'), diff --git a/client/salix/src/components/app/app.html b/client/salix/src/components/app/app.html index 7d27da5c1a..959cf42823 100644 --- a/client/salix/src/components/app/app.html +++ b/client/salix/src/components/app/app.html @@ -1,11 +1,13 @@ - + + + - + \ No newline at end of file diff --git a/client/salix/src/components/app/app.js b/client/salix/src/components/app/app.js index c9a828daef..2368fdef2c 100644 --- a/client/salix/src/components/app/app.js +++ b/client/salix/src/components/app/app.js @@ -1,85 +1,18 @@ -import ngModule, {appName} from '../../module'; +import ngModule from '../../module'; import './style.scss'; -export const NAME = 'vnApp'; -export const COMPONENT = { - template: require('./app.html') -}; -ngModule.component(NAME, COMPONENT); - -vnAppLogger.$inject = ['$document']; -function vnAppLogger($document) { - return { - showMessage: function(message) { - let snackbar = $document.find('vn-snackbar').controller('vnSnackbar'); - snackbar.show({message: message}); - }, - showError: function(message) { - this.showMessage(`Error: ${message}`); - } - }; +export default class App { + constructor($scope, vnApp) { + this.$ = $scope; + this.vnApp = vnApp; + } + $postLink() { + this.vnApp.snackbar = this.$.snackbar; + } } -ngModule.provider('vnAppLogger', function() { - this.$get = vnAppLogger; +App.$inject = ['$scope', 'vnApp']; + +ngModule.component('vnApp', { + template: require('./app.html'), + controller: App }); - -vnAppInterceptor.$inject = ['$q', '$rootScope', '$window', 'vnAppLogger', '$translate', '$cookies']; -function vnAppInterceptor($q, $rootScope, $window, logger, $translate, $cookies) { - $rootScope.loading = false; - return { - request: function(config) { - $rootScope.loading = true; - let token = $cookies.get('vnToken'); - - if (token) - config.headers.Authorization = token; - - return config; - }, - requestError: function(rejection) { - return $q.reject(rejection); - }, - response: function(response) { - switch (response.config.method) { - case 'PUT': - case 'POST': - logger.showMessage($translate.instant('Data saved!')); - } - $rootScope.loading = false; - return response; - }, - responseError: function(rejection) { - $rootScope.loading = false; - let data = rejection.data; - let error; - - if (data && data.error instanceof Object) - error = data.error.message; - else if (rejection.status === -1) - error = $translate.instant(`Can't contact with server`); - else - error = `${rejection.status}: ${rejection.statusText}`; - - if (rejection.status === 401) { - let location = $window.location; - let continueUrl = location.pathname + location.search + location.hash; - continueUrl = encodeURIComponent(continueUrl); - $window.location = `/auth/?apiKey=salix&continue=${continueUrl}`; - } - - logger.showError(error); - return $q.reject(rejection); - } - }; -} -ngModule.factory('vnAppInterceptor', vnAppInterceptor); - -interceptorConfig.$inject = ['$httpProvider']; -function interceptorConfig($httpProvider) { - $httpProvider.interceptors.push('vnAppInterceptor'); -} -ngModule.config(interceptorConfig); - -var acl = window[appName] ? window[appName].acl : {}; -ngModule.constant('aclConstant', acl); - diff --git a/client/salix/src/components/app/style.scss b/client/salix/src/components/app/style.scss index 3c7c383997..61c1dee7b5 100644 --- a/client/salix/src/components/app/style.scss +++ b/client/salix/src/components/app/style.scss @@ -7,7 +7,6 @@ vn-app { height: 100%; vn-topbar { - .logo { float: left; height: 30px; diff --git a/client/salix/src/components/home/home.js b/client/salix/src/components/home/home.js index 66002ae9fc..d24fc4eaf6 100644 --- a/client/salix/src/components/home/home.js +++ b/client/salix/src/components/home/home.js @@ -1,19 +1,15 @@ import ngModule from '../../module'; import './style.scss'; -export const NAME = 'vnHome'; - -export default class vnHome { +export default class Home { constructor(modulesFactory, $state) { this.modules = modulesFactory.getModules(); this.state = $state; } } -vnHome.$inject = ['modulesFactory', '$state']; +Home.$inject = ['modulesFactory', '$state']; -export const COMPONENT = { +ngModule.component('vnHome', { template: require('./home.html'), - controller: vnHome -}; - -ngModule.component(NAME, COMPONENT); + controller: Home +}); diff --git a/client/salix/src/components/left-menu/actions.js b/client/salix/src/components/left-menu/actions.js index 096c090490..4d4d6ee6d8 100644 --- a/client/salix/src/components/left-menu/actions.js +++ b/client/salix/src/components/left-menu/actions.js @@ -27,8 +27,8 @@ MenuActions.$inject = ['$state', '$transitions']; ngModule.component('vnActions', { template: require('./actions.html'), + controller: MenuActions, bindings: { items: '<' - }, - controller: MenuActions + } }); diff --git a/client/salix/src/components/left-menu/left-menu.js b/client/salix/src/components/left-menu/left-menu.js index 77626fe33c..235c299d46 100644 --- a/client/salix/src/components/left-menu/left-menu.js +++ b/client/salix/src/components/left-menu/left-menu.js @@ -1,14 +1,13 @@ import ngModule from '../../module'; import './style.css'; -export default class vnLeftMenu { +export default class LeftMenu { constructor(aclService, $state) { this.aclService = aclService; this.$state = $state; this.items = []; this.init(); } - init() { let station = this.$state.current.data.station || 'default'; if (routes[station]) { @@ -23,9 +22,9 @@ export default class vnLeftMenu { } } } -vnLeftMenu.$inject = ['aclService', '$state']; +LeftMenu.$inject = ['aclService', '$state']; ngModule.component('vnLeftMenu', { template: require('./left-menu.html'), - controller: vnLeftMenu + controller: LeftMenu }); diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html index da5047c633..7902c4b72b 100644 --- a/client/salix/src/components/main-menu/main-menu.html +++ b/client/salix/src/components/main-menu/main-menu.html @@ -6,16 +6,16 @@
    diff --git a/client/salix/src/components/main-menu/main-menu.js b/client/salix/src/components/main-menu/main-menu.js index 113c940b8f..ce36593ced 100644 --- a/client/salix/src/components/main-menu/main-menu.js +++ b/client/salix/src/components/main-menu/main-menu.js @@ -1,7 +1,7 @@ import ngModule from '../../module'; import './style.scss'; -export default class Controller { +export default class MainMenu { constructor($translate, $window, modulesFactory) { this.$translate = $translate; this.$window = $window; @@ -16,9 +16,9 @@ export default class Controller { console.log(`Locale changed: ${lang}`); } } -Controller.$inject = ['$translate', '$window', 'modulesFactory']; +MainMenu.$inject = ['$translate', '$window', 'modulesFactory']; ngModule.component('vnMainMenu', { template: require('./main-menu.html'), - controller: Controller + controller: MainMenu }); diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 2773ef4b4c..081f566f18 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -16,6 +16,7 @@ export default class Controller { // XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente? var childCtrl = angular.element(child).isolateScope().$ctrl; + childCtrl.filter = Object.assign({}, this.index.filter); childCtrl.onSubmit = filter => this.onChildSubmit(filter); event.preventDefault(); diff --git a/client/salix/src/config.js b/client/salix/src/config.js index 877d167301..f4ceea3923 100644 --- a/client/salix/src/config.js +++ b/client/salix/src/config.js @@ -1,13 +1,20 @@ -import ngModule, {appName} from './module'; +import ngModule from './module'; -config.$inject = ['$translatePartialLoaderProvider']; -export function config($translatePartialLoaderProvider) { +export const appName = 'salix'; + +var acl = window[appName] ? window[appName].acl : {}; +ngModule.constant('aclConstant', acl); + +config.$inject = ['$translatePartialLoaderProvider', '$httpProvider']; +export function config($translatePartialLoaderProvider, $httpProvider) { $translatePartialLoaderProvider.addPart(appName); + $httpProvider.interceptors.push('vnInterceptor'); } ngModule.config(config); -run.$inject = ['$window', '$rootScope']; -export function run($window, $rootScope) { +run.$inject = ['$window', '$rootScope', 'vnApp']; +export function run($window, $rootScope, vnApp) { $window.validations = {}; + vnApp.name = appName; } ngModule.run(run); diff --git a/client/salix/src/locale/en.json b/client/salix/src/locale/en.json index 70dabcc3a9..d24ba5e4d1 100644 --- a/client/salix/src/locale/en.json +++ b/client/salix/src/locale/en.json @@ -1,5 +1,6 @@ { "Applications": "Applications", + "Home": "Home", "Notifications":"Notifications", "Logout": "Logout", "Change language": "Change language", diff --git a/client/salix/src/locale/es.json b/client/salix/src/locale/es.json index 5ff53c91d3..f2bc551fc0 100644 --- a/client/salix/src/locale/es.json +++ b/client/salix/src/locale/es.json @@ -1,5 +1,6 @@ { "Applications": "Aplicaciones", + "Home": "Inicio", "Notifications":"Notificaciones", "Logout": "Cerrar sesión", "Change language": "Cambiar idioma", diff --git a/client/salix/src/module.js b/client/salix/src/module.js index 568a43d69b..d0c4657a96 100644 --- a/client/salix/src/module.js +++ b/client/salix/src/module.js @@ -1,6 +1,5 @@ import {ng} from 'vendor'; import 'core'; -export const appName = 'salix'; -const ngModule = ng.module(appName, ['vnCore']); +const ngModule = ng.module('salix', ['vnCore']); export default ngModule; diff --git a/services/auth/common/models/Account.json b/services/auth/common/models/account.json similarity index 100% rename from services/auth/common/models/Account.json rename to services/auth/common/models/account.json diff --git a/services/auth/common/models/user.json b/services/auth/common/models/user.json new file mode 100644 index 0000000000..0fe53764b0 --- /dev/null +++ b/services/auth/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} diff --git a/services/auth/server/datasources.json b/services/auth/server/datasources.json index 562cd0e62b..fe38540f0a 100644 --- a/services/auth/server/datasources.json +++ b/services/auth/server/datasources.json @@ -12,6 +12,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/auth/server/model-config.json b/services/auth/server/model-config.json index 7aafa7b3fe..a35d7196f6 100644 --- a/services/auth/server/model-config.json +++ b/services/auth/server/model-config.json @@ -13,11 +13,18 @@ "./mixins" ] }, - "User": { + "user": { "dataSource": "auth" }, "AccessToken": { - "dataSource": "auth" + "dataSource": "auth", + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth" diff --git a/services/client/common/models/Account.json b/services/client/common/models/account.json similarity index 100% rename from services/client/common/models/Account.json rename to services/client/common/models/account.json diff --git a/services/client/common/models/Address.js b/services/client/common/models/address.js similarity index 100% rename from services/client/common/models/Address.js rename to services/client/common/models/address.js diff --git a/services/client/common/models/Address.json b/services/client/common/models/address.json similarity index 100% rename from services/client/common/models/Address.json rename to services/client/common/models/address.json diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/agency-service.json similarity index 100% rename from services/client/common/models/AgencyService.json rename to services/client/common/models/agency-service.json diff --git a/services/client/common/models/ClientCreditLimit.json b/services/client/common/models/client-credit-limit.json similarity index 100% rename from services/client/common/models/ClientCreditLimit.json rename to services/client/common/models/client-credit-limit.json diff --git a/services/client/common/models/ClientCredit.json b/services/client/common/models/client-credit.json similarity index 100% rename from services/client/common/models/ClientCredit.json rename to services/client/common/models/client-credit.json diff --git a/services/client/common/models/ClientObservation.js b/services/client/common/models/client-observation.js similarity index 100% rename from services/client/common/models/ClientObservation.js rename to services/client/common/models/client-observation.js diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/client-observation.json similarity index 100% rename from services/client/common/models/ClientObservation.json rename to services/client/common/models/client-observation.json diff --git a/services/client/common/models/Client.js b/services/client/common/models/client.js similarity index 100% rename from services/client/common/models/Client.js rename to services/client/common/models/client.js diff --git a/services/client/common/models/Client.json b/services/client/common/models/client.json similarity index 100% rename from services/client/common/models/Client.json rename to services/client/common/models/client.json diff --git a/services/client/common/models/ContactChannel.json b/services/client/common/models/contact-channel.json similarity index 100% rename from services/client/common/models/ContactChannel.json rename to services/client/common/models/contact-channel.json diff --git a/services/client/common/models/Country.json b/services/client/common/models/country.json similarity index 100% rename from services/client/common/models/Country.json rename to services/client/common/models/country.json diff --git a/services/client/common/models/Employee.json b/services/client/common/models/employee.json similarity index 100% rename from services/client/common/models/Employee.json rename to services/client/common/models/employee.json diff --git a/services/client/common/models/MyModel.js b/services/client/common/models/my-model.js similarity index 100% rename from services/client/common/models/MyModel.js rename to services/client/common/models/my-model.js diff --git a/services/client/common/models/MyModel.json b/services/client/common/models/my-model.json similarity index 100% rename from services/client/common/models/MyModel.json rename to services/client/common/models/my-model.json diff --git a/services/client/common/models/PayMethod.json b/services/client/common/models/pay-method.json similarity index 100% rename from services/client/common/models/PayMethod.json rename to services/client/common/models/pay-method.json diff --git a/services/client/common/models/Province.json b/services/client/common/models/province.json similarity index 100% rename from services/client/common/models/Province.json rename to services/client/common/models/province.json diff --git a/services/client/common/models/user.json b/services/client/common/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/client/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file diff --git a/services/client/server/datasources.json b/services/client/server/datasources.json index 99577e1927..ba7db7577e 100644 --- a/services/client/server/datasources.json +++ b/services/client/server/datasources.json @@ -12,7 +12,9 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 }, "vn": { "name": "mysql", @@ -22,6 +24,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 4bf5b47a7e..986f3b4df6 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -13,13 +13,18 @@ "./mixins" ] }, - "User": { - "dataSource": "auth", - "public": false + "user": { + "dataSource": "auth" }, "AccessToken": { "dataSource": "auth", - "public": false + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth", diff --git a/services/salix/common/models/user.json b/services/salix/common/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/salix/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file diff --git a/services/salix/server/datasources.json b/services/salix/server/datasources.json index ea04dddf1c..967e6cbe85 100644 --- a/services/salix/server/datasources.json +++ b/services/salix/server/datasources.json @@ -11,6 +11,8 @@ "host": "localhost", "port": 3306, "username": "root", - "password": "" + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } diff --git a/services/salix/server/model-config.json b/services/salix/server/model-config.json index 8cef8e4581..fc5e58edca 100644 --- a/services/salix/server/model-config.json +++ b/services/salix/server/model-config.json @@ -13,13 +13,18 @@ "./mixins" ] }, - "User": { - "dataSource": "auth", - "public": false + "user": { + "dataSource": "auth" }, "AccessToken": { "dataSource": "auth", - "public": false + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { "dataSource": "auth", diff --git a/webpack.config.js b/webpack.config.js index d5166e84fc..c4e78fced0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -57,7 +57,7 @@ var config = { names: ['bundle.vendor', 'bundle.manifest'] }) ], - devtool: 'eval-source-map' + devtool: 'source-map' }; if (!devMode) { From 622884d31cf8138988e9e603e400f227f07f59f5 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 5 Jun 2017 09:22:36 +0200 Subject: [PATCH 127/391] Docker nginx --- services/nginx/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/nginx/Dockerfile b/services/nginx/Dockerfile index 06443e5965..178fc0fba1 100644 --- a/services/nginx/Dockerfile +++ b/services/nginx/Dockerfile @@ -10,6 +10,8 @@ COPY static /usr/share/nginx/html RUN apt-get update && apt-get -y install vim dnsmasq dnsutils +RUN rm -fr /usr/share/dns + RUN echo listen-address=127.0.0.1 > /etc/dnsmasq.d/dnsmasq.conf CMD service dnsmasq restart && nginx -g "daemon off;" From 47f9d29686587028462c4f88c3d8f6b0a15441c4 Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 6 Jun 2017 08:21:38 +0200 Subject: [PATCH 128/391] servicio production creado --- services/production/.editorconfig | 13 +++++ services/production/.eslintignore | 1 + services/production/.eslintrc | 3 ++ services/production/.gitignore | 19 +++++++ services/production/.yo-rc.json | 3 ++ services/production/README.md | 3 ++ services/production/client/README.md | 3 ++ services/production/common/models/Ticket.json | 20 ++++++++ services/production/package.json | 34 +++++++++++++ .../production/server/boot/authentication.js | 6 +++ services/production/server/boot/root.js | 8 +++ .../production/server/component-config.json | 5 ++ services/production/server/config.json | 22 ++++++++ services/production/server/datasources.json | 6 +++ .../server/middleware.development.json | 10 ++++ services/production/server/middleware.json | 50 +++++++++++++++++++ services/production/server/model-config.json | 35 +++++++++++++ services/production/server/server.js | 29 +++++++++++ 18 files changed, 270 insertions(+) create mode 100644 services/production/.editorconfig create mode 100644 services/production/.eslintignore create mode 100644 services/production/.eslintrc create mode 100644 services/production/.gitignore create mode 100644 services/production/.yo-rc.json create mode 100644 services/production/README.md create mode 100644 services/production/client/README.md create mode 100644 services/production/common/models/Ticket.json create mode 100644 services/production/package.json create mode 100644 services/production/server/boot/authentication.js create mode 100644 services/production/server/boot/root.js create mode 100644 services/production/server/component-config.json create mode 100644 services/production/server/config.json create mode 100644 services/production/server/datasources.json create mode 100644 services/production/server/middleware.development.json create mode 100644 services/production/server/middleware.json create mode 100644 services/production/server/model-config.json create mode 100644 services/production/server/server.js diff --git a/services/production/.editorconfig b/services/production/.editorconfig new file mode 100644 index 0000000000..3ee22e5d3d --- /dev/null +++ b/services/production/.editorconfig @@ -0,0 +1,13 @@ +# EditorConfig helps developers define and maintain consistent +# coding styles between different editors and IDEs +# http://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/services/production/.eslintignore b/services/production/.eslintignore new file mode 100644 index 0000000000..44f397018c --- /dev/null +++ b/services/production/.eslintignore @@ -0,0 +1 @@ +/client/ \ No newline at end of file diff --git a/services/production/.eslintrc b/services/production/.eslintrc new file mode 100644 index 0000000000..a6e52975a0 --- /dev/null +++ b/services/production/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "loopback" +} \ No newline at end of file diff --git a/services/production/.gitignore b/services/production/.gitignore new file mode 100644 index 0000000000..aff1045b47 --- /dev/null +++ b/services/production/.gitignore @@ -0,0 +1,19 @@ +*.csv +*.dat +*.iml +*.log +*.out +*.pid +*.seed +*.sublime-* +*.swo +*.swp +*.tgz +*.xml +.DS_Store +.idea +.project +.strong-pm +coverage +node_modules +npm-debug.log diff --git a/services/production/.yo-rc.json b/services/production/.yo-rc.json new file mode 100644 index 0000000000..02f3fc17be --- /dev/null +++ b/services/production/.yo-rc.json @@ -0,0 +1,3 @@ +{ + "generator-loopback": {} +} \ No newline at end of file diff --git a/services/production/README.md b/services/production/README.md new file mode 100644 index 0000000000..866baed5e0 --- /dev/null +++ b/services/production/README.md @@ -0,0 +1,3 @@ +# My Application + +The project is generated by [LoopBack](http://loopback.io). \ No newline at end of file diff --git a/services/production/client/README.md b/services/production/client/README.md new file mode 100644 index 0000000000..dd00c9e9cd --- /dev/null +++ b/services/production/client/README.md @@ -0,0 +1,3 @@ +## Client + +This is the place for your application front-end files. diff --git a/services/production/common/models/Ticket.json b/services/production/common/models/Ticket.json new file mode 100644 index 0000000000..16d5e07a59 --- /dev/null +++ b/services/production/common/models/Ticket.json @@ -0,0 +1,20 @@ +{ + "name": "Ticket", + "base": "PersistedModel", + "validateUpsert": true, + "properties": {}, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/production/package.json b/services/production/package.json new file mode 100644 index 0000000000..0c2dfa9708 --- /dev/null +++ b/services/production/package.json @@ -0,0 +1,34 @@ +{ + "name": "vn-production", + "version": "1.0.0", + "main": "server/server.js", + "scripts": { + "lint": "eslint .", + "start": "node .", + "posttest": "npm run lint && nsp check" + }, + "dependencies": { + "compression": "^1.0.3", + "cors": "^2.5.2", + "helmet": "^1.3.0", + "i18n": "^0.8.3", + "loopback": "^3.8.0", + "loopback-boot": "^2.24.0", + "loopback-component-explorer": "^4.2.0", + "loopback-connector-mysql": "^3.0.0", + "loopback-context": "^3.1.0", + "serve-favicon": "^2.0.1", + "strong-error-handler": "^2.1.0" + }, + "devDependencies": { + "eslint": "^2.13.1", + "eslint-config-loopback": "^4.0.0", + "nsp": "^2.1.0" + }, + "repository": { + "type": "git", + "url": "https://git.verdnatura.es/salix" + }, + "license": "GPL-3.0", + "description": "vn-production" +} diff --git a/services/production/server/boot/authentication.js b/services/production/server/boot/authentication.js new file mode 100644 index 0000000000..8e88d4b555 --- /dev/null +++ b/services/production/server/boot/authentication.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = function enableAuthentication(server) { + // enable authentication + server.enableAuth(); +}; diff --git a/services/production/server/boot/root.js b/services/production/server/boot/root.js new file mode 100644 index 0000000000..6adce90ad3 --- /dev/null +++ b/services/production/server/boot/root.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function(server) { + // Install a `/` route that returns server status + var router = server.loopback.Router(); + router.get('/', server.loopback.status()); + server.use(router); +}; diff --git a/services/production/server/component-config.json b/services/production/server/component-config.json new file mode 100644 index 0000000000..f36959a488 --- /dev/null +++ b/services/production/server/component-config.json @@ -0,0 +1,5 @@ +{ + "loopback-component-explorer": { + "mountPath": "/explorer" + } +} diff --git a/services/production/server/config.json b/services/production/server/config.json new file mode 100644 index 0000000000..e5eff24654 --- /dev/null +++ b/services/production/server/config.json @@ -0,0 +1,22 @@ +{ + "restApiRoot": "/api", + "host": "0.0.0.0", + "port": 3000, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false, + "handleErrors": false + } +} diff --git a/services/production/server/datasources.json b/services/production/server/datasources.json new file mode 100644 index 0000000000..d6caf56d44 --- /dev/null +++ b/services/production/server/datasources.json @@ -0,0 +1,6 @@ +{ + "db": { + "name": "db", + "connector": "memory" + } +} diff --git a/services/production/server/middleware.development.json b/services/production/server/middleware.development.json new file mode 100644 index 0000000000..071c11a30e --- /dev/null +++ b/services/production/server/middleware.development.json @@ -0,0 +1,10 @@ +{ + "final:after": { + "strong-error-handler": { + "params": { + "debug": true, + "log": true + } + } + } +} diff --git a/services/production/server/middleware.json b/services/production/server/middleware.json new file mode 100644 index 0000000000..fbfff8165d --- /dev/null +++ b/services/production/server/middleware.json @@ -0,0 +1,50 @@ +{ + "initial:before": { + "loopback#favicon": {} + }, + "initial": { + "compression": {}, + "cors": { + "params": { + "origin": true, + "credentials": true, + "maxAge": 86400 + } + }, + "helmet#xssFilter": {}, + "helmet#frameguard": { + "params": [ + "deny" + ] + }, + "helmet#hsts": { + "params": { + "maxAge": 0, + "includeSubdomains": true + } + }, + "helmet#hidePoweredBy": {}, + "helmet#ieNoOpen": {}, + "helmet#noSniff": {}, + "helmet#noCache": { + "enabled": false + } + }, + "session": {}, + "auth": {}, + "parse": {}, + "routes": { + "loopback#rest": { + "paths": [ + "${restApiRoot}" + ] + } + }, + "files": {}, + "final": { + "loopback#urlNotFound": {} + }, + "final:after": { + "strong-error-handler": {} + } +} diff --git a/services/production/server/model-config.json b/services/production/server/model-config.json new file mode 100644 index 0000000000..8a1204120d --- /dev/null +++ b/services/production/server/model-config.json @@ -0,0 +1,35 @@ +{ + "_meta": { + "sources": [ + "loopback/common/models", + "loopback/server/models", + "../common/models", + "./models" + ], + "mixins": [ + "loopback/common/mixins", + "loopback/server/mixins", + "../common/mixins", + "./mixins" + ] + }, + "User": { + "dataSource": "db" + }, + "AccessToken": { + "dataSource": "db", + "public": false + }, + "ACL": { + "dataSource": "db", + "public": false + }, + "RoleMapping": { + "dataSource": "db", + "public": false + }, + "Role": { + "dataSource": "db", + "public": false + } +} diff --git a/services/production/server/server.js b/services/production/server/server.js new file mode 100644 index 0000000000..ef738abce2 --- /dev/null +++ b/services/production/server/server.js @@ -0,0 +1,29 @@ +'use strict'; + +var loopback = require('loopback'); +var boot = require('loopback-boot'); + +var app = module.exports = loopback(); + +app.start = function() { + // start the web server + return app.listen(function() { + app.emit('started'); + var baseUrl = app.get('url').replace(/\/$/, ''); + console.log('Web server listening at: %s', baseUrl); + if (app.get('loopback-component-explorer')) { + var explorerPath = app.get('loopback-component-explorer').mountPath; + console.log('Browse your REST API at %s%s', baseUrl, explorerPath); + } + }); +}; + +// Bootstrap the application, configure models, datasources and middleware. +// Sub-apps like REST API are mounted via boot scripts. +boot(app, __dirname, function(err) { + if (err) throw err; + + // start the server if `$ node server.js` + if (require.main === module) + app.start(); +}); From 9fcdb28d141b97f2019f66a02517d3275ba34a07 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 6 Jun 2017 13:06:47 +0200 Subject: [PATCH 129/391] cambio en routes e interfaz localizador al 5% --- client/core/src/lib/moduleLoader.js | 17 +++--- client/production/index.js | 1 + client/production/routes.json | 12 ++++ client/production/src/index/index.html | 29 +++++++++ client/production/src/index/index.js | 13 ++++ client/production/src/locale/en.json | 1 + client/production/src/locale/es.json | 1 + client/production/src/module.js | 5 ++ client/production/src/production.js | 5 ++ client/salix/src/components/home/home.html | 2 +- client/salix/src/components/home/style.scss | 61 +++++++++++-------- .../src/components/left-menu/left-menu.js | 6 +- client/salix/src/configroutes.js | 2 +- gulpfile.js | 16 +---- spliting/modules.json | 5 +- 15 files changed, 124 insertions(+), 52 deletions(-) create mode 100644 client/production/index.js create mode 100644 client/production/routes.json create mode 100644 client/production/src/index/index.html create mode 100644 client/production/src/index/index.js create mode 100644 client/production/src/locale/en.json create mode 100644 client/production/src/locale/es.json create mode 100644 client/production/src/module.js create mode 100644 client/production/src/production.js diff --git a/client/core/src/lib/moduleLoader.js b/client/core/src/lib/moduleLoader.js index 62fe2c3fdc..2adfa20ad3 100644 --- a/client/core/src/lib/moduleLoader.js +++ b/client/core/src/lib/moduleLoader.js @@ -8,7 +8,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q this._loadedModules = {}; } load(moduleName) { - if(this._loadedModules[moduleName]) + if (this._loadedModules[moduleName]) return; this._loadedModules[moduleName] = true; @@ -17,18 +17,19 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q let modules = splitingRegister.modules; let promises = []; - for(let dep of deps) { + for (let dep of deps) { this._loadedModules[dep] = true; promises.push(modules[dep]()); promises.push(new Promise(resolve => { $http.get(`/${dep}/validations`).then( - json => this.onValidationsReady(json, resolve) + json => this.onValidationsReady(json, resolve), + json => resolve() ); })); $translatePartialLoader.addPart(dep); // FIXME: https://github.com/angular-translate/angular-translate/pull/1674 - //promises.push($translate.refresh()); + // promises.push($translate.refresh()); setTimeout (() => $translate.refresh(), 500); } @@ -41,7 +42,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q }); } parseValidation(val) { - switch(val.validation) { + switch (val.validation) { case 'custom': // TODO: Reemplazar eval val.customValidator = eval(`(${val.customValidator})`); @@ -53,11 +54,11 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q } onValidationsReady(json, resolve) { let entities = json.data; - for(let entity in entities) { + for (let entity in entities) { let fields = entities[entity].validations; - for(let field in fields) { + for (let field in fields) { let validations = fields[field]; - for(let validation of validations) + for (let validation of validations) this.parseValidation(validation); } } diff --git a/client/production/index.js b/client/production/index.js new file mode 100644 index 0000000000..4cbd2fb45c --- /dev/null +++ b/client/production/index.js @@ -0,0 +1 @@ +export * from './src/production'; diff --git a/client/production/routes.json b/client/production/routes.json new file mode 100644 index 0000000000..38ab36dc01 --- /dev/null +++ b/client/production/routes.json @@ -0,0 +1,12 @@ +{ + "module": "production", + "name": "Production", + "icon": "group_work", + "routes": [ + { + "url": "/production", + "state": "production", + "component": "vn-production-index" + } + ] +} \ No newline at end of file diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html new file mode 100644 index 0000000000..7141b2a3f3 --- /dev/null +++ b/client/production/src/index/index.html @@ -0,0 +1,29 @@ + + + + + Localizador + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js new file mode 100644 index 0000000000..3c0e9cfafb --- /dev/null +++ b/client/production/src/index/index.js @@ -0,0 +1,13 @@ +import ngModule from '../module'; + +export default class ProductionIndex { + search(index) { + index.filter.search = this.model.search; + index.accept(); + } +} + +ngModule.component('vnProductionIndex', { + template: require('./index.html'), + controller: ProductionIndex +}); diff --git a/client/production/src/locale/en.json b/client/production/src/locale/en.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/client/production/src/locale/en.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/client/production/src/locale/es.json b/client/production/src/locale/es.json new file mode 100644 index 0000000000..9e26dfeeb6 --- /dev/null +++ b/client/production/src/locale/es.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/client/production/src/module.js b/client/production/src/module.js new file mode 100644 index 0000000000..1427bd898e --- /dev/null +++ b/client/production/src/module.js @@ -0,0 +1,5 @@ +import {ng} from 'vendor'; +import 'core'; + +const ngModule = ng.module('production', []); +export default ngModule; diff --git a/client/production/src/production.js b/client/production/src/production.js new file mode 100644 index 0000000000..80e65aacee --- /dev/null +++ b/client/production/src/production.js @@ -0,0 +1,5 @@ +export * from './module'; + + +// import components +import './index/index'; diff --git a/client/salix/src/components/home/home.html b/client/salix/src/components/home/home.html index b92bedb4d5..ddb636ee41 100644 --- a/client/salix/src/components/home/home.html +++ b/client/salix/src/components/home/home.html @@ -2,7 +2,7 @@
    - + diff --git a/client/salix/src/components/home/style.scss b/client/salix/src/components/home/style.scss index 76c6cd4020..732f8752a5 100644 --- a/client/salix/src/components/home/style.scss +++ b/client/salix/src/components/home/style.scss @@ -10,32 +10,45 @@ vn-home { a:link{ text-decoration: none; } - .vn-module{ + vn-module-container{ display: flex; - flex: none; - padding: 2em; - border-radius: 4px; - box-sizing: border-box; - transition: opacity 0.7s ease; - h4{ - text-transform: capitalize; - } - vn-one{ - text-align: center; - } + flex: 1; + flex-direction: row; + justify-content: center; - i{ - font-size: 50px !important; - margin: 0 auto; + .vn-module{ + display: flex; + flex: none; + padding: 2em; + margin: 10px; + border-radius: 4px; + box-sizing: border-box; + transition: opacity 0.7s ease; + h4{ + text-transform: capitalize; + font-size: 16pt; + } + vn-one{ + text-align: center; + } + + i{ + font-size: 50px !important; + margin: 0 auto; + } + &:hover{ + opacity: 0.7; + } + + &.Clients{ + background-color: #ffa410; + color: #ffffff; + } + &.Production{ + background-color: #95d600; + color: #ffffff; + } + } - &:hover{ - opacity: 0.7; - } - - &.Clients{ - background-color: #ffa410; - color: #ffffff; - } - } } \ No newline at end of file diff --git a/client/salix/src/components/left-menu/left-menu.js b/client/salix/src/components/left-menu/left-menu.js index 235c299d46..586752a1bf 100644 --- a/client/salix/src/components/left-menu/left-menu.js +++ b/client/salix/src/components/left-menu/left-menu.js @@ -9,9 +9,9 @@ export default class LeftMenu { this.init(); } init() { - let station = this.$state.current.data.station || 'default'; - if (routes[station]) { - routes[station].routes.forEach(i => { + let routes = this.$state.current.data.routes || []; + if (routes.length) { + routes.forEach(i => { if (i.menu && this.aclService.routeHasPermission(i)) this.items.push({ description: i.menu.description, diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index 40aa1b9987..c6a5a34023 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -50,7 +50,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) { loader: loader(moduleName) }, data: { - station: file + routes: fileRoutes } }); } diff --git a/gulpfile.js b/gulpfile.js index 523378fc8e..8b5a5fa6ff 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -114,7 +114,7 @@ gulp.task('webpack-dev-server', ['spliting'], function() { // Locale -var localeFiles = `./${srcDir}/**/locale/*.json`; +var localeFiles = `${srcDir}/**/locale/*.json`; gulp.task('locales', function() { var streams = []; @@ -132,22 +132,12 @@ gulp.task('locales', function() { // Routes -var routeFiles = `./${srcDir}/**/routes.json`; +var routeFiles = `${srcDir}/**/routes.json`; gulp.task('routes', function() { - function cb(file) { - var relative = file.relative.replace(/\\/g, '/'); - var dirname = relative.match(/^(.*)\/routes\.json$/)[1]; - return { - dirname: dirname, - json: file.contents - }; - } - return gulp.src(routeFiles) - .pipe(wrap('\n"<%=dirname%>": <%=json%>', cb)) .pipe(concat('routes.js', {newLine: ','})) - .pipe(wrap('var routes = {<%=contents%>\n};')) + .pipe(wrap('var routes = [<%=contents%>\n];')) .pipe(gulp.dest(buildDir)); }); diff --git a/spliting/modules.json b/spliting/modules.json index be5adbca50..3efb5f977e 100644 --- a/spliting/modules.json +++ b/spliting/modules.json @@ -1,6 +1,7 @@ { - "salix": ["client"], + "salix": ["client", "production"], "auth": [], "core": [], - "client": [] + "client": [], + "production": [] } From be6fa25001783a622c54ec4bb2ed374099a046c3 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Tue, 6 Jun 2017 14:00:30 +0200 Subject: [PATCH 130/391] Jenkins --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7cecefe16c..3d33de37b8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ def branchName = "${env.BRANCH_NAME}"; def branchNameTest = "preprod"; def branchNameProd = "master"; def prefixDocker = "test"; -def dockerNginxName = ["nginx", "-p 80:8080 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"] +def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"] def dockerAuthName = ["auth", "-p 3000:3000"] def dockerSalixName = ["salix", "-p 3001:3001"] def dockerClientName = ["client", "-p 3002:3002"] From fb4c0db6c5884946c188770e072062f00c67579f Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Tue, 6 Jun 2017 14:35:31 +0200 Subject: [PATCH 131/391] Jenkins webpack --- Jenkinsfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3d33de37b8..954598dbe4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,6 +25,10 @@ node { checkout scm } + stage ('webpack'){ + sh "webpack" + } + stage ('install modules'){ sh "npm install" } From 9eaae2269b2dffcfa31e4021ffd0bafc6ad110b6 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 6 Jun 2017 15:02:03 +0200 Subject: [PATCH 132/391] client: localizador al 6% --- .../src/filter-panel/filter-panel.html | 23 +++++++++++ .../src/filter-panel/filter-panel.js | 25 +++++++++++ client/production/src/index/index.html | 41 +++++++++++-------- client/production/src/production.js | 1 + 4 files changed, 73 insertions(+), 17 deletions(-) create mode 100644 client/production/src/filter-panel/filter-panel.html create mode 100644 client/production/src/filter-panel/filter-panel.js diff --git a/client/production/src/filter-panel/filter-panel.html b/client/production/src/filter-panel/filter-panel.html new file mode 100644 index 0000000000..2bb03ead06 --- /dev/null +++ b/client/production/src/filter-panel/filter-panel.html @@ -0,0 +1,23 @@ +
    +
    + + + + + + + + + + + + + +
    +
    \ No newline at end of file diff --git a/client/production/src/filter-panel/filter-panel.js b/client/production/src/filter-panel/filter-panel.js new file mode 100644 index 0000000000..c432b3b08f --- /dev/null +++ b/client/production/src/filter-panel/filter-panel.js @@ -0,0 +1,25 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($window) { + this.$window = $window; + } + onSearch() { + this.setStorageValue(); + this.onSubmit(this.filter); + } + $onChanges() { + var value = JSON.parse(this.$window.sessionStorage.getItem('production')); + if (value !== undefined) + this.filter = value; + } + setStorageValue() { + this.$window.sessionStorage.setItem('production', JSON.stringify(this.filter)); + } +} +Controller.$inject = ['$window']; + +ngModule.component('vnProductionFilterPanel', { + template: require('./filter-panel.html'), + controller: Controller +}); diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 7141b2a3f3..4cf14099c8 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,27 +1,34 @@ + - - Localizador - - - - - - - - - - - - - - + Localizador + + + + + + + + + - + + + + diff --git a/client/production/src/production.js b/client/production/src/production.js index 80e65aacee..f36e961565 100644 --- a/client/production/src/production.js +++ b/client/production/src/production.js @@ -3,3 +3,4 @@ export * from './module'; // import components import './index/index'; +import './filter-panel/filter-panel'; From 63fe545b758d134b54fa717ccc670edced5e03e9 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Wed, 7 Jun 2017 07:08:40 +0200 Subject: [PATCH 133/391] Jenkins --- Jenkinsfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 954598dbe4..3d33de37b8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,10 +25,6 @@ node { checkout scm } - stage ('webpack'){ - sh "webpack" - } - stage ('install modules'){ sh "npm install" } From ce256b395e008e2eabf09debb5e88d8822c49e43 Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 7 Jun 2017 08:38:48 +0200 Subject: [PATCH 134/391] tarea gula para copiar los ficheros comunes puerto 3004 para production --- gulpfile.js | 22 ++- gulpfiles/services.json | 14 ++ .../production/common/models/account.json | 46 +++++++ services/production/common/models/my-model.js | 125 ++++++++++++++++++ .../production/common/models/my-model.json | 4 + services/production/common/models/user.json | 11 ++ services/production/server/config.json | 2 +- services/service/models/account.json | 46 +++++++ services/service/models/my-model.js | 125 ++++++++++++++++++ services/service/models/my-model.json | 4 + services/service/models/user.json | 11 ++ 11 files changed, 407 insertions(+), 3 deletions(-) create mode 100644 gulpfiles/services.json create mode 100644 services/production/common/models/account.json create mode 100644 services/production/common/models/my-model.js create mode 100644 services/production/common/models/my-model.json create mode 100644 services/production/common/models/user.json create mode 100644 services/service/models/account.json create mode 100644 services/service/models/my-model.js create mode 100644 services/service/models/my-model.json create mode 100644 services/service/models/user.json diff --git a/gulpfile.js b/gulpfile.js index 523378fc8e..56290d15dc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,6 +9,8 @@ var fs = require('fs'); var webpack = require('webpack'); var WebpackDevServer = require('webpack-dev-server'); +var services = require("./gulpfiles/services.json"); + // Configuration var srcDir = './client'; @@ -32,11 +34,27 @@ gulp.task('client', ['clean'], function() { return gulp.start('watch', 'routes', 'locales', 'webpack-dev-server'); }); -gulp.task('services', function() { +gulp.task('copy', function() { + var streams = []; + for (i=0; i < services.services.length; i++) { + var service = services.services[i]; + for (j=0; j < services.files.length; j++) { + var file = services.files[j]; + streams.push(gulp.src("./services/service/models/" + file) + .pipe(gulp.dest(service + "/common/models/"))); + } + } + return merge(streams); +}); + +gulp.task('services', ['copy'], function() { require('./services/auth/server/server.js').start(); - require('./services/client/server/server.js').start(); require('./services/salix/server/server.js').start(); require('./services/mailer/server.js').start(); + + for (i=0; i < services.services.length; i++) { + require(services.services[i] + "/server/server.js").start(); + } }); gulp.task('clean', function() { diff --git a/gulpfiles/services.json b/gulpfiles/services.json new file mode 100644 index 0000000000..7c183dfad7 --- /dev/null +++ b/gulpfiles/services.json @@ -0,0 +1,14 @@ +{ + "services": [ + "./services/client", + "./services/production" + ], + "files":[ + "account.json", + "my-model.js", + "my-model.json", + "user.json" + ] + +} + diff --git a/services/production/common/models/account.json b/services/production/common/models/account.json new file mode 100644 index 0000000000..7b3fd0739a --- /dev/null +++ b/services/production/common/models/account.json @@ -0,0 +1,46 @@ +{ + "name": "Account", + "base": "PersistedModel", + "validateUpsert": true, + "properties": { + "id": { + "type": "number", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "password": { + "type": "string", + "required": true + }, + "active": { + "type": "boolean" + }, + "email": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/production/common/models/my-model.js b/services/production/common/models/my-model.js new file mode 100644 index 0000000000..009b025f36 --- /dev/null +++ b/services/production/common/models/my-model.js @@ -0,0 +1,125 @@ + +module.exports = function(self) { + self.setup = function() { + self.super_.setup.call(this); + + let disableMethods = { + 'create': true, + 'replaceOrCreate': true, + 'patchOrCreate': true, + 'upsert': true, + 'updateOrCreate': true, + 'exists': true, + 'find': true, + 'findOne': true, + 'findById': true, + 'deleteById': true, + 'replaceById': true, + 'updateAttributes': false, + 'createChangeStream': true, + 'updateAll': true, + 'upsertWithWhere': true, + 'count': true + }; + + for(let method in disableMethods) { + //this.disableRemoteMethod(method, disableMethods[method]); + } + } + + self.installMethod = function(methodName, filterCb) { + this.remoteMethod(methodName, { + description: 'List items using a filter', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + required: true, + description: 'Filter defining where', + http: function(ctx) { + return ctx.req.query; + } + } + ], + returns: { + arg: 'data', + type: [this.modelName], + root: true + }, + http: { + verb: 'get', + path: `/${methodName}` + } + }); + + this[methodName] = (params, cb) => { + let filter = removeEmpty(filterCb(params)); + var response = {} + + function returnValues(){ + if(response.instances !== undefined && response.count !== undefined) + cb(null, response); + } + + function error(){ + cb(null, response); + } + + this.find(filter, function(err, instances) { + if(!err){ + response.instances = instances; + returnValues(); + } + else{ + error(); + } + + }) + + this.count(filter.where, function(err, totalCount){ + if(!err){ + response.count = totalCount; + returnValues(); + } + else{ + error(); + } + + }) + }; + + }; +} + +function removeEmpty(o) { + if(Array.isArray(o)) { + let array = []; + for(let item of o) { + let i = removeEmpty(item); + if(!isEmpty(item)) + array.push(item); + }; + if(array.length > 0) + return array; + } + else if (typeof o === 'object') { + let object = {}; + for(let key in o) { + let i = removeEmpty(o[key]); + if(!isEmpty(i)) + object[key] = i; + } + if(Object.keys(object).length > 0) + return object; + } + else if (!isEmpty(o)) + return o; + + return undefined; +} + +function isEmpty(value) { + return value === undefined || value === ""; +} + diff --git a/services/production/common/models/my-model.json b/services/production/common/models/my-model.json new file mode 100644 index 0000000000..7a0a975bbc --- /dev/null +++ b/services/production/common/models/my-model.json @@ -0,0 +1,4 @@ +{ + "name": "MyModel", + "base": "PersistedModel" +} diff --git a/services/production/common/models/user.json b/services/production/common/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/production/common/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file diff --git a/services/production/server/config.json b/services/production/server/config.json index e5eff24654..f85f9904c0 100644 --- a/services/production/server/config.json +++ b/services/production/server/config.json @@ -1,7 +1,7 @@ { "restApiRoot": "/api", "host": "0.0.0.0", - "port": 3000, + "port": 3004, "remoting": { "context": false, "rest": { diff --git a/services/service/models/account.json b/services/service/models/account.json new file mode 100644 index 0000000000..7b3fd0739a --- /dev/null +++ b/services/service/models/account.json @@ -0,0 +1,46 @@ +{ + "name": "Account", + "base": "PersistedModel", + "validateUpsert": true, + "properties": { + "id": { + "type": "number", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "password": { + "type": "string", + "required": true + }, + "active": { + "type": "boolean" + }, + "email": { + "type": "string", + "required": true + }, + "created": { + "type": "date" + }, + "updated": { + "type": "date" + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/service/models/my-model.js b/services/service/models/my-model.js new file mode 100644 index 0000000000..009b025f36 --- /dev/null +++ b/services/service/models/my-model.js @@ -0,0 +1,125 @@ + +module.exports = function(self) { + self.setup = function() { + self.super_.setup.call(this); + + let disableMethods = { + 'create': true, + 'replaceOrCreate': true, + 'patchOrCreate': true, + 'upsert': true, + 'updateOrCreate': true, + 'exists': true, + 'find': true, + 'findOne': true, + 'findById': true, + 'deleteById': true, + 'replaceById': true, + 'updateAttributes': false, + 'createChangeStream': true, + 'updateAll': true, + 'upsertWithWhere': true, + 'count': true + }; + + for(let method in disableMethods) { + //this.disableRemoteMethod(method, disableMethods[method]); + } + } + + self.installMethod = function(methodName, filterCb) { + this.remoteMethod(methodName, { + description: 'List items using a filter', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + required: true, + description: 'Filter defining where', + http: function(ctx) { + return ctx.req.query; + } + } + ], + returns: { + arg: 'data', + type: [this.modelName], + root: true + }, + http: { + verb: 'get', + path: `/${methodName}` + } + }); + + this[methodName] = (params, cb) => { + let filter = removeEmpty(filterCb(params)); + var response = {} + + function returnValues(){ + if(response.instances !== undefined && response.count !== undefined) + cb(null, response); + } + + function error(){ + cb(null, response); + } + + this.find(filter, function(err, instances) { + if(!err){ + response.instances = instances; + returnValues(); + } + else{ + error(); + } + + }) + + this.count(filter.where, function(err, totalCount){ + if(!err){ + response.count = totalCount; + returnValues(); + } + else{ + error(); + } + + }) + }; + + }; +} + +function removeEmpty(o) { + if(Array.isArray(o)) { + let array = []; + for(let item of o) { + let i = removeEmpty(item); + if(!isEmpty(item)) + array.push(item); + }; + if(array.length > 0) + return array; + } + else if (typeof o === 'object') { + let object = {}; + for(let key in o) { + let i = removeEmpty(o[key]); + if(!isEmpty(i)) + object[key] = i; + } + if(Object.keys(object).length > 0) + return object; + } + else if (!isEmpty(o)) + return o; + + return undefined; +} + +function isEmpty(value) { + return value === undefined || value === ""; +} + diff --git a/services/service/models/my-model.json b/services/service/models/my-model.json new file mode 100644 index 0000000000..7a0a975bbc --- /dev/null +++ b/services/service/models/my-model.json @@ -0,0 +1,4 @@ +{ + "name": "MyModel", + "base": "PersistedModel" +} diff --git a/services/service/models/user.json b/services/service/models/user.json new file mode 100644 index 0000000000..f13d4c1686 --- /dev/null +++ b/services/service/models/user.json @@ -0,0 +1,11 @@ +{ + "name": "user", + "base": "User", + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + } +} \ No newline at end of file From 5d789b0e71eb6a551d827aa38aca1bc4e687a005 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 7 Jun 2017 08:39:40 +0200 Subject: [PATCH 135/391] Locales --- .../src/address-create/address-create.html | 22 ++++++++--------- .../client/src/address-create/locale/es.json | 12 ++++++++++ .../client/src/address-edit/address-edit.html | 24 +++++++++---------- .../client/src/address-edit/address-edit.js | 12 +++++++++- client/client/src/address-edit/locale/es.json | 3 +++ client/client/src/addresses/addresses.html | 13 +++++----- client/client/src/addresses/locale/es.json | 3 +++ client/client/src/basic-data/basic-data.html | 18 +++++++------- client/client/src/basic-data/locale/es.json | 12 ++++++++++ client/client/src/descriptor/descriptor.html | 2 +- client/client/src/index/item-client.html | 8 +++---- client/client/src/index/locale/es.json | 7 ++++++ client/client/src/locale/en.json | 5 +++- client/client/src/locale/es.json | 5 +++- client/client/src/note-create/locale/es.json | 4 ++++ .../client/src/note-create/note-create.html | 6 ++--- client/client/src/notes/locale/es.json | 3 +++ client/client/src/notes/notes.html | 8 +++---- client/client/src/search-panel/locale/es.json | 10 ++++++++ .../client/src/search-panel/search-panel.html | 14 +++++------ client/client/src/web-access/locale/es.json | 2 ++ client/client/src/web-access/web-access.html | 8 +++---- client/core/src/locale/en.json | 5 +++- client/core/src/locale/es.json | 5 +++- client/core/src/title/title.html | 2 +- 25 files changed, 146 insertions(+), 67 deletions(-) create mode 100644 client/client/src/address-create/locale/es.json create mode 100644 client/client/src/address-edit/locale/es.json create mode 100644 client/client/src/addresses/locale/es.json create mode 100644 client/client/src/basic-data/locale/es.json create mode 100644 client/client/src/index/locale/es.json create mode 100644 client/client/src/note-create/locale/es.json create mode 100644 client/client/src/notes/locale/es.json create mode 100644 client/client/src/search-panel/locale/es.json diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index f76a89a8d4..7ba5444632 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -8,23 +8,23 @@
    - Consignatario + Address - + - - + + - - + + + label="Province"> @@ -33,14 +33,14 @@ url="/client/api/AgencyServices" show-field="name" value-field="id" - label="Agencia"> + label="Agency"> - - + + - +
    diff --git a/client/client/src/address-create/locale/es.json b/client/client/src/address-create/locale/es.json new file mode 100644 index 0000000000..b152c77a62 --- /dev/null +++ b/client/client/src/address-create/locale/es.json @@ -0,0 +1,12 @@ +{ + "Address": "Consignatario", + "Default": "Predeterminado", + "Consignee": "Consignatario", + "Street": "Dirección", + "Postcode": "Código postal", + "City": "Municipio", + "Province": "Provincia", + "Agency": "Agencia", + "Phone": "Teléfono", + "Mobile": "Móvil" +} \ No newline at end of file diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index a34dddee0f..7b6a5d5e80 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -9,24 +9,24 @@
    - Consignatario + Address - - + + - - + + - - + + + label="Province"> @@ -35,14 +35,14 @@ url="/client/api/AgencyServices" show-field="name" value-field="id" - label="Agencia"> + label="Agency"> - - + + - +
    diff --git a/client/client/src/address-edit/address-edit.js b/client/client/src/address-edit/address-edit.js index 0605a3c026..caad023e29 100644 --- a/client/client/src/address-edit/address-edit.js +++ b/client/client/src/address-edit/address-edit.js @@ -1,5 +1,15 @@ import ngModule from '../module'; +export default class Controller { + constructor($state) { + this.address = { + id: parseInt($state.params.addressId) + }; + } +} +Controller.$inject = ['$state']; + ngModule.component('vnAddressEdit', { - template: require('./address-edit.html') + template: require('./address-edit.html'), + controller: Controller }); diff --git a/client/client/src/address-edit/locale/es.json b/client/client/src/address-edit/locale/es.json new file mode 100644 index 0000000000..8598f616cc --- /dev/null +++ b/client/client/src/address-edit/locale/es.json @@ -0,0 +1,3 @@ +{ + "Enabled": "Activo" +} \ No newline at end of file diff --git a/client/client/src/addresses/addresses.html b/client/client/src/addresses/addresses.html index 1b11b19317..0df5820f30 100644 --- a/client/client/src/addresses/addresses.html +++ b/client/client/src/addresses/addresses.html @@ -3,17 +3,17 @@ - Consignatario + Addresses -
    {{i.consignee}}
    -
    {{i.street}}
    -
    {{i.city}}, {{i.province}}
    -
    {{i.phone}}, {{i.mobile}}
    +
    {{::i.consignee}}
    +
    {{::i.street}}
    +
    {{::i.city}}, {{::i.province}}
    +
    {{::i.phone}}, {{::i.mobile}}
    @@ -27,6 +27,7 @@ + icon="add" + label="Add"> diff --git a/client/client/src/addresses/locale/es.json b/client/client/src/addresses/locale/es.json new file mode 100644 index 0000000000..5240a65631 --- /dev/null +++ b/client/client/src/addresses/locale/es.json @@ -0,0 +1,3 @@ +{ + "Addresses": "Consignatarios" +} \ No newline at end of file diff --git a/client/client/src/basic-data/basic-data.html b/client/client/src/basic-data/basic-data.html index 5563d1e7d9..072aa036ab 100644 --- a/client/client/src/basic-data/basic-data.html +++ b/client/client/src/basic-data/basic-data.html @@ -8,15 +8,15 @@
    - Datos básicos + Basic data - - - + + + - - + + @@ -28,7 +28,7 @@ show-field="name" value-field="id" select-fields="surname" - label="Comercial"> + label="Salesperson"> {{::i.name}} {{::i.surname}} @@ -37,12 +37,12 @@ initial-value="$ctrl.client.contactChannel" field="$ctrl.client.contactChannelFk" url="/client/api/ContactChannels" - label="Canal"> + label="Channel"> - +
    diff --git a/client/client/src/basic-data/locale/es.json b/client/client/src/basic-data/locale/es.json new file mode 100644 index 0000000000..24e0d09d6b --- /dev/null +++ b/client/client/src/basic-data/locale/es.json @@ -0,0 +1,12 @@ +{ + "Basic data": "Datos básicos", + "Name": "Nombre", + "Tax number": "NIF/CIF", + "Social name": "Razón social", + "Phone": "Teléfono", + "Mobile": "Móvil", + "Fax": "Fax", + "Email": "Correo electrónico", + "Salesperson": "Comercial", + "Channel": "Canal" +} \ No newline at end of file diff --git a/client/client/src/descriptor/descriptor.html b/client/client/src/descriptor/descriptor.html index 48a8782213..8659bec6ef 100644 --- a/client/client/src/descriptor/descriptor.html +++ b/client/client/src/descriptor/descriptor.html @@ -5,7 +5,7 @@ person -
    {{$ctrl.client.id}}
    +
    {{::$ctrl.client.id}}
    {{$ctrl.client.name}}
    {{$ctrl.client.phone}}
    diff --git a/client/client/src/index/item-client.html b/client/client/src/index/item-client.html index 49ef314d03..e03dc63df3 100644 --- a/client/client/src/index/item-client.html +++ b/client/client/src/index/item-client.html @@ -1,7 +1,7 @@
    {{$ctrl.client.name}}
    -
    Id Cliente: {{$ctrl.client.id}}
    -
    Teléfono: {{$ctrl.client.phone | phone}}
    -
    Población: {{$ctrl.client.city}}
    -
    email: {{$ctrl.client.email}}
    +
    Client id: {{$ctrl.client.id}}
    +
    Phone: {{$ctrl.client.phone | phone}}
    +
    City: {{$ctrl.client.city}}
    +
    Email: {{$ctrl.client.email}}
    diff --git a/client/client/src/index/locale/es.json b/client/client/src/index/locale/es.json new file mode 100644 index 0000000000..e8575f06b3 --- /dev/null +++ b/client/client/src/index/locale/es.json @@ -0,0 +1,7 @@ +{ + "Client id": "Id cliente", + "Phone": "Teléfono", + "City": "Población", + "Email": "Correo electrónico", + "Create client": "Crear cliente" +} \ No newline at end of file diff --git a/client/client/src/locale/en.json b/client/client/src/locale/en.json index 9e26dfeeb6..78e01b9291 100644 --- a/client/client/src/locale/en.json +++ b/client/client/src/locale/en.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "Client": "Client", + "Clients": "Clients" +} \ No newline at end of file diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json index 9e26dfeeb6..8056809f68 100644 --- a/client/client/src/locale/es.json +++ b/client/client/src/locale/es.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "Client": "Cliente", + "Clients": "Clientes" +} \ No newline at end of file diff --git a/client/client/src/note-create/locale/es.json b/client/client/src/note-create/locale/es.json new file mode 100644 index 0000000000..ed49b6323f --- /dev/null +++ b/client/client/src/note-create/locale/es.json @@ -0,0 +1,4 @@ +{ + "New note": "Nueva nota", + "Note": "Nota" +} \ No newline at end of file diff --git a/client/client/src/note-create/note-create.html b/client/client/src/note-create/note-create.html index 4331bb4643..f01397cb55 100644 --- a/client/client/src/note-create/note-create.html +++ b/client/client/src/note-create/note-create.html @@ -8,11 +8,11 @@
    - Nueva nota - + New note + - +
    \ No newline at end of file diff --git a/client/client/src/notes/locale/es.json b/client/client/src/notes/locale/es.json new file mode 100644 index 0000000000..28b37f5a81 --- /dev/null +++ b/client/client/src/notes/locale/es.json @@ -0,0 +1,3 @@ +{ + "Notes": "Notas" +} \ No newline at end of file diff --git a/client/client/src/notes/notes.html b/client/client/src/notes/notes.html index aad8a06e32..ecea1d668c 100644 --- a/client/client/src/notes/notes.html +++ b/client/client/src/notes/notes.html @@ -1,11 +1,11 @@ - Notas + Notes -
    {{n.created | date:'dd/MM/yyyy HH:mm'}}
    -
    {{n.employee.name}}
    -
    {{n.text}}
    +
    {{::n.created | date:'dd/MM/yyyy HH:mm'}}
    +
    {{::n.employee.name}}
    +
    {{::n.text}}
    diff --git a/client/client/src/search-panel/locale/es.json b/client/client/src/search-panel/locale/es.json new file mode 100644 index 0000000000..cd31f963bd --- /dev/null +++ b/client/client/src/search-panel/locale/es.json @@ -0,0 +1,10 @@ +{ + "Client id": "Id cliente", + "Tax number": "NIF/CIF", + "Name": "Nombre", + "Social name": "Razon social", + "City": "Población", + "Postcode": "Código postal", + "Email": "Correo electrónico", + "Phone": "Teléfono" +} \ No newline at end of file diff --git a/client/client/src/search-panel/search-panel.html b/client/client/src/search-panel/search-panel.html index f17828f6a2..4e299c3cec 100644 --- a/client/client/src/search-panel/search-panel.html +++ b/client/client/src/search-panel/search-panel.html @@ -1,22 +1,22 @@
    - - + + - + - + - - + + - + diff --git a/client/client/src/web-access/locale/es.json b/client/client/src/web-access/locale/es.json index 9ca7219586..82652f89f0 100644 --- a/client/client/src/web-access/locale/es.json +++ b/client/client/src/web-access/locale/es.json @@ -1,4 +1,6 @@ { + "User": "Usuario", + "Enable web access": "Habilitar acceso web", "Web access": "Acceso web", "New password": "Nueva contraseña", "Repeat password": "Repetir contraseña", diff --git a/client/client/src/web-access/web-access.html b/client/client/src/web-access/web-access.html index d2e0390248..7274cd5d20 100644 --- a/client/client/src/web-access/web-access.html +++ b/client/client/src/web-access/web-access.html @@ -10,13 +10,13 @@ Web access - - + + - - + + +

    \ No newline at end of file From 00dd05ba6d1bfdfceb1b16c42138d85955eb32d9 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Wed, 7 Jun 2017 08:43:25 +0200 Subject: [PATCH 136/391] Docker --- Jenkinsfile | 5 +++-- services/mailer/Dockerfile | 11 +++++++++++ services/nginx/conf-dev.conf | 7 +++++-- services/nginx/conf-prod.conf | 9 ++++++--- services/production/Dockerfile | 11 +++++++++++ 5 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 services/mailer/Dockerfile create mode 100644 services/production/Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 3d33de37b8..aaced7ee8e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,14 +7,15 @@ def branchName = "${env.BRANCH_NAME}"; def branchNameTest = "preprod"; def branchNameProd = "master"; def prefixDocker = "test"; -def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"] +def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client --link test-mailer:mailer"] def dockerAuthName = ["auth", "-p 3000:3000"] def dockerSalixName = ["salix", "-p 3001:3001"] def dockerClientName = ["client", "-p 3002:3002"] +def dockerMailerName = ["mailer", "-p 3003:3003"] def buildNumber = "${env.BUILD_NUMBER}"; -def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerNginxName] +def dockers = [dockerAuthName, dockerSalixName, dockerClientName, dockerMailerName, dockerNginxName] node { diff --git a/services/mailer/Dockerfile b/services/mailer/Dockerfile new file mode 100644 index 0000000000..1f9574a645 --- /dev/null +++ b/services/mailer/Dockerfile @@ -0,0 +1,11 @@ +FROM node:6.9.1 + +COPY . /app + +WORKDIR /app + +RUN npm install + +CMD ["npm", "start"] + +EXPOSE 3003 diff --git a/services/nginx/conf-dev.conf b/services/nginx/conf-dev.conf index 3bec6e4639..51d72c315f 100644 --- a/services/nginx/conf-dev.conf +++ b/services/nginx/conf-dev.conf @@ -31,14 +31,17 @@ http { location ~ ^/auth(?:/(.*))?$ { proxy_pass http://127.0.0.1:3000/$1$is_args$args; } + location ~ ^(?:/(.*))?$ { + proxy_pass http://127.0.0.1:3001/$1$is_args$args; + } location ~ ^/client(?:/(.*))?$ { proxy_pass http://127.0.0.1:3002/$1$is_args$args; } location ~ ^/mailer(?:/(.*))?$ { proxy_pass http://127.0.0.1:3003/$1$is_args$args; } - location ~ ^(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3001/$1$is_args$args; + location ~ ^/production(?:/(.*))?$ { + proxy_pass http://127.0.0.1:3004/$1$is_args$args; } } diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index ac814c46f3..9ba46e97ee 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -19,21 +19,24 @@ http { root /usr/share/nginx/html; - location /static { + location ~ ^/static(?:/(.*))?$ { alias /usr/share/nginx/html; autoindex on; } location ~ ^/auth(?:/(.*))?$ { proxy_pass http://auth:3000/$1$is_args$args; } + location ~ ^(?:/(.*))?$ { + proxy_pass http://salix:3001/$1$is_args$args; + } location ~ ^/client(?:/(.*))?$ { proxy_pass http://client:3002/$1$is_args$args; } location ~ ^/mailer(?:/(.*))?$ { proxy_pass http://mailer:3003/$1$is_args$args; } - location ~ ^(?:/(.*))?$ { - proxy_pass http://salix:3001/$1$is_args$args; + location ~ ^/production(?:/(.*))?$ { + proxy_pass http://production:3004/$1$is_args$args; } } } diff --git a/services/production/Dockerfile b/services/production/Dockerfile new file mode 100644 index 0000000000..7c672f9a69 --- /dev/null +++ b/services/production/Dockerfile @@ -0,0 +1,11 @@ +FROM node:6.9.1 + +COPY . /app + +WORKDIR /app + +RUN npm install + +CMD ["npm", "start"] + +EXPOSE 3004 From 7ec66e862c8a9c39877215da368825c312390ea3 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Wed, 7 Jun 2017 09:07:58 +0200 Subject: [PATCH 137/391] nginx --- services/nginx/conf-dev.conf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/services/nginx/conf-dev.conf b/services/nginx/conf-dev.conf index 51d72c315f..8eb6bc2ece 100644 --- a/services/nginx/conf-dev.conf +++ b/services/nginx/conf-dev.conf @@ -31,9 +31,7 @@ http { location ~ ^/auth(?:/(.*))?$ { proxy_pass http://127.0.0.1:3000/$1$is_args$args; } - location ~ ^(?:/(.*))?$ { - proxy_pass http://127.0.0.1:3001/$1$is_args$args; - } + location ~ ^/client(?:/(.*))?$ { proxy_pass http://127.0.0.1:3002/$1$is_args$args; } @@ -43,6 +41,10 @@ http { location ~ ^/production(?:/(.*))?$ { proxy_pass http://127.0.0.1:3004/$1$is_args$args; } + # Este tiene que ser el último + location ~ ^(?:/(.*))?$ { + proxy_pass http://127.0.0.1:3001/$1$is_args$args; + } } types { From 3ffa0205647bcf11c93e1c19d82b1d0a8c1d8353 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Wed, 7 Jun 2017 09:09:35 +0200 Subject: [PATCH 138/391] nginx docker --- services/nginx/conf-dev.conf | 1 - services/nginx/conf-prod.conf | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/nginx/conf-dev.conf b/services/nginx/conf-dev.conf index 8eb6bc2ece..f5af8b9f6a 100644 --- a/services/nginx/conf-dev.conf +++ b/services/nginx/conf-dev.conf @@ -31,7 +31,6 @@ http { location ~ ^/auth(?:/(.*))?$ { proxy_pass http://127.0.0.1:3000/$1$is_args$args; } - location ~ ^/client(?:/(.*))?$ { proxy_pass http://127.0.0.1:3002/$1$is_args$args; } diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index 9ba46e97ee..3e9f9f7c0a 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -26,9 +26,6 @@ http { location ~ ^/auth(?:/(.*))?$ { proxy_pass http://auth:3000/$1$is_args$args; } - location ~ ^(?:/(.*))?$ { - proxy_pass http://salix:3001/$1$is_args$args; - } location ~ ^/client(?:/(.*))?$ { proxy_pass http://client:3002/$1$is_args$args; } @@ -38,5 +35,9 @@ http { location ~ ^/production(?:/(.*))?$ { proxy_pass http://production:3004/$1$is_args$args; } + # Este tiene que ser el último + location ~ ^(?:/(.*))?$ { + proxy_pass http://salix:3001/$1$is_args$args; + } } } From 51a700b6ce111ac02945412c32ebbbd1d2f2326b Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 7 Jun 2017 13:27:57 +0200 Subject: [PATCH 139/391] date-picker v1 --- client/core/src/date-picker/date-picker.js | 28 ++++++++++++++----- .../src/filter-panel/filter-panel.html | 4 +-- client/production/src/index/index.html | 2 +- client/vendor/src/flatpickr.js | 6 ++++ package.json | 1 + 5 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 client/vendor/src/flatpickr.js diff --git a/client/core/src/date-picker/date-picker.js b/client/core/src/date-picker/date-picker.js index 8b02d12365..9f4a1647bb 100644 --- a/client/core/src/date-picker/date-picker.js +++ b/client/core/src/date-picker/date-picker.js @@ -2,12 +2,13 @@ import {module as _module} from '../module'; import * as resolveFactory from '../lib/resolveDefaultComponents'; import * as normalizerFactory from '../lib/inputAttrsNormalizer'; import * as util from '../lib/util'; +import Flatpickr from 'vendor/src/flatpickr'; const _NAME = 'datePicker'; export const NAME = util.getName(_NAME); -directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME]; -export function directive(resolve, normalizer) { +directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate']; +export function directive(resolve, normalizer, $translate) { return { restrict: 'E', template: function(_, attrs) { @@ -15,12 +16,25 @@ export function directive(resolve, normalizer) { return resolve.getTemplate(_NAME, attrs); }, link: function(scope, element, attrs) { - scope.$watch(attrs.model, () => { - let mdlField = element[0].firstChild.MaterialTextfield; - if (mdlField) - mdlField.updateClasses_(); + let input = element[0]; + let vp; + let initOptions = {}; + + if (attrs.iniOpts) + initOptions = scope.$eval(attrs.iniOpts); + + if (!initOptions.locale) + initOptions.locale = $translate.use(); + + if (!input.matches('input')) + input = input.querySelector('input'); + + if (input) + vp = new Flatpickr(input, initOptions); + + element.on('$destroy', function() { + vp.destroy(); }); - componentHandler.upgradeElement(element[0].firstChild); } }; } diff --git a/client/production/src/filter-panel/filter-panel.html b/client/production/src/filter-panel/filter-panel.html index 2bb03ead06..aa47f90665 100644 --- a/client/production/src/filter-panel/filter-panel.html +++ b/client/production/src/filter-panel/filter-panel.html @@ -2,7 +2,7 @@
    - + - + diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 4cf14099c8..bdc2da7eab 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,5 +1,5 @@ - + Localizador diff --git a/client/vendor/src/flatpickr.js b/client/vendor/src/flatpickr.js new file mode 100644 index 0000000000..8637b3b6a4 --- /dev/null +++ b/client/vendor/src/flatpickr.js @@ -0,0 +1,6 @@ +import Flatpickr from 'flatpickr'; +import 'flatpickr/dist/flatpickr.min.css'; +import 'flatpickr/dist/themes/material_orange.css'; +import localeEs from 'flatpickr/dist/l10n/es'; +Flatpickr.l10ns.es = localeEs.es; +export default Flatpickr; diff --git a/package.json b/package.json index fbbcc1bcea..2050ddab2b 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "angular-paging": "^2.2.2", "angular-translate": "^2.13.1", "angular-translate-loader-partial": "^2.13.1", + "flatpickr": "^2.6.3", "material-design-lite": "^1.3.0", "mg-crud": "^1.1.2", "oclazyload": "^0.6.3", From 6123278945f1a84d83427b3e1eee7fc1b196d4ef Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 7 Jun 2017 15:03:12 +0200 Subject: [PATCH 140/391] =?UTF-8?q?en=20progreso:=20interfaz=20gr=C3=A1fic?= =?UTF-8?q?a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/production/src/index/index.html | 43 +++++++++++++++++++++++--- client/production/src/index/index.js | 5 +++ client/production/src/index/style.scss | 26 ++++++++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 client/production/src/index/style.scss diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index bdc2da7eab..7ab9356a23 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,5 +1,5 @@ - + Localizador @@ -23,14 +23,49 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + {{::item.id}} + {{::item.agency.id}} + {{::item.employee.name}} + {{::item.hour}} + {{::item.state.name}} + {{::item.lines}} + {{::item.meters}} + {{::item.boxes}} + + + + \ No newline at end of file diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 3c0e9cfafb..73a40ed8b0 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -1,6 +1,11 @@ import ngModule from '../module'; +import './style.scss'; export default class ProductionIndex { + constructor() { + this.model = {}; + this.checkAll = false; + } search(index) { index.filter.search = this.model.search; index.accept(); diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss new file mode 100644 index 0000000000..d6f8d50e07 --- /dev/null +++ b/client/production/src/index/style.scss @@ -0,0 +1,26 @@ +vn-production-index { + button { + height: 20px; + padding: 0 6px; + } + + .list-header{ + border-bottom: 3px solid #9D9D9D; + font-weight: bold; + } + + .list-footer{ + border-top: 3px solid #9D9D9D; + font-weight: bold; + } + .list > vn-one{ + text-align: center; + } + .list > [vn-one]{ + text-align: center; + } + .list-body{ + padding: 4px 0px; + border-bottom: 1px solid #9D9D9D; + } +} \ No newline at end of file From 73c5f5581f69b714ce4b04cda5c85f3c219b3a03 Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 7 Jun 2017 15:28:42 +0200 Subject: [PATCH 141/391] Cambios en servicio mailer --- .../client/src/billing-data/billing-data.html | 2 +- .../client/src/billing-data/billing-data.js | 29 +++--- services/mailer/application/config/smtp.json | 3 + services/mailer/application/database.js | 6 +- services/mailer/application/language.js | 24 ----- .../language/es.paymentUpdate.json | 8 -- services/mailer/application/locale.js | 26 ++++++ services/mailer/application/mail.js | 36 +++----- .../mailer/application/route/manuscript.js | 28 +++--- services/mailer/application/router.js | 23 ++++- services/mailer/application/template.js | 86 +++++++++++++----- .../{images/download.png => image/action.png} | Bin 3061 -> 3225 bytes .../template/{images => image}/facebook.png | Bin .../template/{images => image}/header.png | Bin .../{images/chat.png => image/info.png} | Bin 3033 -> 3045 bytes .../template/{images => image}/instagram.png | Bin .../template/{images => image}/linkedin.png | Bin .../template/{images => image}/pinterest.png | Bin .../template/{images => image}/twitter.png | Bin .../template/{images => image}/youtube.png | Bin .../application/template/images/arrow.png | Bin 3486 -> 0 bytes .../template/payment-update/attachment.json | 1 + .../template/payment-update/locale/es.json | 9 ++ .../payment-update/payment-update.css | 0 .../payment-update/payment-update.html | 80 ++++++++++++++++ .../template/payment-update/payment-update.js | 26 ++++++ .../application/template/paymentUpdate.html | 74 --------------- services/mailer/server.js | 9 +- 28 files changed, 277 insertions(+), 193 deletions(-) delete mode 100644 services/mailer/application/language.js delete mode 100644 services/mailer/application/language/es.paymentUpdate.json create mode 100644 services/mailer/application/locale.js rename services/mailer/application/template/{images/download.png => image/action.png} (83%) rename services/mailer/application/template/{images => image}/facebook.png (100%) rename services/mailer/application/template/{images => image}/header.png (100%) rename services/mailer/application/template/{images/chat.png => image/info.png} (88%) rename services/mailer/application/template/{images => image}/instagram.png (100%) rename services/mailer/application/template/{images => image}/linkedin.png (100%) rename services/mailer/application/template/{images => image}/pinterest.png (100%) rename services/mailer/application/template/{images => image}/twitter.png (100%) rename services/mailer/application/template/{images => image}/youtube.png (100%) delete mode 100644 services/mailer/application/template/images/arrow.png create mode 100644 services/mailer/application/template/payment-update/attachment.json create mode 100644 services/mailer/application/template/payment-update/locale/es.json create mode 100644 services/mailer/application/template/payment-update/payment-update.css create mode 100644 services/mailer/application/template/payment-update/payment-update.html create mode 100644 services/mailer/application/template/payment-update/payment-update.js delete mode 100644 services/mailer/application/template/paymentUpdate.html diff --git a/client/client/src/billing-data/billing-data.html b/client/client/src/billing-data/billing-data.html index f43f41e767..43010880ec 100644 --- a/client/client/src/billing-data/billing-data.html +++ b/client/client/src/billing-data/billing-data.html @@ -5,7 +5,7 @@ form="form" save="patch"> - + Información de facturación diff --git a/client/client/src/billing-data/billing-data.js b/client/client/src/billing-data/billing-data.js index 9537b5590f..f45f22c1c4 100644 --- a/client/client/src/billing-data/billing-data.js +++ b/client/client/src/billing-data/billing-data.js @@ -3,11 +3,11 @@ import ngModule from '../module'; export default class Controller { constructor($scope, $http, $timeout, vnApp, $translate) { this.$ = $scope; - this.http = $http; + this.$http = $http; this.timeout = $timeout; this.vnApp = vnApp; this.translate = $translate; - this.payId = null; + this.payMethodFk = null; this.dueDay = null; this.copyData(); } @@ -16,32 +16,27 @@ export default class Controller { } copyData() { if (this.client) { - this.payId = this.client.payMethodFk || null; + this.payMethodFk = this.client.payMethodFk || null; this.dueDay = this.client.dueDay ? this.client.dueDay : null; } } - checkChanges() { - let payId = this.client.payMethodFk || null; + submit() { + this.$.watcher.submit().then( + () => this.checkPaymentChanges()); + } + checkPaymentChanges() { + let payMethodFk = this.client.payMethodFk || null; let dueDay = this.client.dueDay || null; - if (this.payId !== payId || this.dueDay !== dueDay) { + if (this.payMethodFk !== payMethodFk || this.dueDay !== dueDay) this.$.sendMail.show(); - return false; - } - - return true; } returnDialog(response) { if (response === 'ACCEPT') { - this.sendMail().then( - () => this.vnApp.showMessage(this.translate.instant('Notification sent!')), - () => this.vnApp.showMessage(this.translate.instant('Notification error')) + this.$http.post(`/mailer/manuscript/${this.client.id}/payment-update`).then( + () => this.vnApp.showMessage(this.translate.instant('Notification sent!')) ); } - this.timeout(() => this.$.watcher.submit()); - } - sendMail() { - return this.http.post(`/mailer/manuscript/paymentUpdate`, {user: this.client.id}); } } Controller.$inject = ['$scope', '$http', '$timeout', 'vnApp', '$translate']; diff --git a/services/mailer/application/config/smtp.json b/services/mailer/application/config/smtp.json index a6579d067b..e4953c14d6 100644 --- a/services/mailer/application/config/smtp.json +++ b/services/mailer/application/config/smtp.json @@ -5,5 +5,8 @@ "auth": { "user": "noreply", "pass": "" + }, + "tls": { + "rejectUnauthorized": false } } \ No newline at end of file diff --git a/services/mailer/application/database.js b/services/mailer/application/database.js index 528cb1be68..6c33999ff4 100644 --- a/services/mailer/application/database.js +++ b/services/mailer/application/database.js @@ -15,9 +15,9 @@ module.exports = { this.pool.getConnection(function(error, connection) { if (error) { - console.log('No se ha podido establecer la conexión con la base de datos. ' + error.code); - } else { - console.log('Conexión con la base de datos establecida'); + throw new Error('Can\'t connect to database: ' + error.code); + } else if (settings.app().debug) { + console.log('Database connection stablished'); } }); } diff --git a/services/mailer/application/language.js b/services/mailer/application/language.js deleted file mode 100644 index 960f3fde9a..0000000000 --- a/services/mailer/application/language.js +++ /dev/null @@ -1,24 +0,0 @@ -var fs = require('fs'); -var settings = require('./settings.js'); -var path = require('path'); - -module.exports = { - /** - * Devuelve las claves de idioma de una plantilla - * @param {String} templateName - Nombre de la plantilla - * @param {String} langCode - Código de idioma - * @return {Object} Devuelve el objeto con las claves de idioma - */ - load: function(templateName, langCode) { - var localeFile = path.join(__dirname, 'language', `${langCode}.${templateName}.json`); - var defaultLocaleFile = path.join(__dirname, 'language', `${settings.defaultLanguage}.${templateName}.json`); - - if (fs.existsSync(localeFile)) { - return require(localeFile); - } else if (fs.existsSync(defaultLocaleFile)) { - return require(defaultLocaleFile); - } - - throw new Error('No se ha encontrado ninguna traducción para la plantilla ' + templateName + '.'); - } -}; diff --git a/services/mailer/application/language/es.paymentUpdate.json b/services/mailer/application/language/es.paymentUpdate.json deleted file mode 100644 index 493e3bbfbf..0000000000 --- a/services/mailer/application/language/es.paymentUpdate.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "subject": "Cambios en las condiciones de pago", - "title": "Cambio en las condiciones", - "dear": "Estimado cliente", - "bodyDescription": "Le enviamos este email para comunicarle que las condiciones de pago han cambiado. Le indicamos las nuevas condiciones a continuación.", - "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", - "privacy": "Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado." -} \ No newline at end of file diff --git a/services/mailer/application/locale.js b/services/mailer/application/locale.js new file mode 100644 index 0000000000..bcd9d452b8 --- /dev/null +++ b/services/mailer/application/locale.js @@ -0,0 +1,26 @@ +var fs = require('fs'); +var settings = require('./settings.js'); +var path = require('path'); + +module.exports = { + /** + * Devuelve las claves de idioma de una plantilla + * @param {String} template - Nombre de la plantilla + * @param {String} countryCode - Código de idioma + * @param {Object} cb - Callback + */ + load: function(template, countryCode, cb) { + var localeFile = path.join(__dirname, 'template', `${template}`, 'locale', `${countryCode}.json`); + var defaultLocaleFile = path.join(__dirname, 'template', `${template}`, 'locale', `${settings.app().defaultLanguage}.json`); + + fs.stat(localeFile, (error, stats) => { + if (error) + fs.stat(defaultLocaleFile, (error, stats) => { + if (error) + cb(null, 'Translation not found for template ' + template + '.'); + return cb(require(defaultLocaleFile)); + }); + return cb(require(localeFile)); + }); + } +}; diff --git a/services/mailer/application/mail.js b/services/mailer/application/mail.js index 7e5a20456f..674b05b2fa 100644 --- a/services/mailer/application/mail.js +++ b/services/mailer/application/mail.js @@ -17,9 +17,9 @@ module.exports = { this.transporter.verify(function(error, success) { if (error) { - console.log(error); - } else { - console.log('Conexión SMTP establecida'); + throw new Error(error); + } else if (settings.app().debug) { + console.log('SMTP connection stablished'); } }); }, @@ -28,33 +28,21 @@ module.exports = { * Envia un email con los datos recibidos desde un vector. * @param {Object} data - Datos para el envío del email */ - send: function(data) { - var filePath = 'Template/images/'; + send: function(recipient, subject, body, attachments, cb) { let mailOptions = { from: '"' + settings.app().senderName + '" <' + settings.app().senderMail + '>', - to: data.recipient, - subject: data.subject, - html: data.body, - attachments: [ - {filename: 'header.png', path: path.join(__dirname, filePath, 'header.png'), cid: 'header'}, - {filename: 'arrow.png', path: path.join(__dirname, filePath, 'arrow.png'), cid: 'arrow'}, - {filename: 'chat.png', path: path.join(__dirname, filePath, 'chat.png'), cid: 'chat'}, - {filename: 'facebook.png', path: path.join(__dirname, filePath, 'facebook.png'), cid: 'facebook'}, - {filename: 'twitter.png', path: path.join(__dirname, filePath, 'twitter.png'), cid: 'twitter'}, - {filename: 'youtube.png', path: path.join(__dirname, filePath, 'youtube.png'), cid: 'youtube'}, - {filename: 'pinterest.png', path: path.join(__dirname, filePath, 'pinterest.png'), cid: 'pinterest'}, - {filename: 'instagram.png', path: path.join(__dirname, filePath, 'instagram.png'), cid: 'instagram'}, - {filename: 'linkedin.png', path: path.join(__dirname, filePath, 'linkedin.png'), cid: 'linkedin'} - ] + to: recipient, + subject: subject, + html: body, + attachments }; - + console.log(recipient); this.transporter.sendMail(mailOptions, (error, info) => { if (error) { - console.log(error); + return cb(null, 'Email not sent: ' + error); } else if (settings.app().debug) { - console.log('Se ha enviado el email ' + info.messageId + ' [' + info.response + ']'); - - return true; + console.log('Mail sent ' + info.messageId + ' [' + info.response + ']'); + cb(); } }); } diff --git a/services/mailer/application/route/manuscript.js b/services/mailer/application/route/manuscript.js index 0c51be6cb3..6c351fad5a 100644 --- a/services/mailer/application/route/manuscript.js +++ b/services/mailer/application/route/manuscript.js @@ -5,19 +5,21 @@ var database = require('../database.js'); var template = require('../template.js'); // Escrito de cambios en méto de pago del cliente -router.post('/paymentUpdate', function(request, response) { - database.pool.query('SELECT Cliente, `e-mail` AS email FROM Clientes WHERE Id_Cliente = ?', [request.body.user], function(error, rs) { - // Datos del escrito - var params = { - clientName: rs[0].Cliente - }; - // Obtener plantilla y enviar - template.getTemplate('paymentUpdate', 'es', params, function(tplResult) { - if (mail.send({recipient: rs[0].email, subject: tplResult.subject, body: tplResult.body})) { - response.json({status: "OK"}); - } else { - response.json({status: "ERROR"}); - } +router.post('/:userId/:template', function(request, response, next) { + database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) { + if (qryRs.length == 0) + return response.json({data: {message: 'Client not found'}}); + + template.getTemplate(request.params.template, qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { + if (error) + return response.json({data: {message: error}}); + + mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => { + if (error) + return response.json({data: {message: error}}); + + return response.json({data: {message: 'Mail sent'}}); + }); }); }); }); diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index 64f91c2d2c..a624eba0f7 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -2,15 +2,32 @@ var express = require('express'); var router = new express.Router(); var settings = require('./settings.js'); -// Página por defecto +// Mailer default page router.get('/', function(request, response) { response.send(settings.app().name + ' v' + settings.app().version); }); -// Rutas de los escritos. +// Manuscripts router.use('/manuscript', require('./route/manuscript.js')); -// Rutas de las notificaciones. +// Notifications router.use('/notification', require('./route/notification.js')); +/*// Load template route +router.post('/:userId/:template', function(request, response, next) { + database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) { + if (qryRs.length == 0) + return response.json({data: {message: 'Client not found'}}); + template.getTemplate(request.params.template, qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { + if (error) + return response.json({data: {message: error}}); + + mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => { + if (error) + return response.json({data: {message: error}}); + }); + }); + }); +}); +*/ module.exports = router; diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js index 7589e632a7..b03fd47359 100644 --- a/services/mailer/application/template.js +++ b/services/mailer/application/template.js @@ -1,32 +1,39 @@ var fs = require('fs'); var mustache = require('mustache'); -var database = require('./database.js'); -var language = require('./language.js'); +var locale = require('./locale.js'); var path = require('path'); -var Template = { +module.exports = { /** * Obtiene la plantilla. - * @param {String} templateName - Nombre de la plantilla - * @param {Object} langCode - Código del idioma + * @param {String} template - Nombre de la plantilla + * @param {Object} countryCode - Código del idioma * @param {Object} params - Datos a reemplazar. - * @param {Object} callback - Callback + * @param {Object} cb - Callback */ - getTemplate: function(templateName, langCode, params, callback) { - database.pool.query('SELECT name, attachmentPath FROM vn.mailTemplates WHERE name = ?', [templateName], function(error, rs) { - // Comprobamos que exista la plantilla - if (rs.length == 0) - throw new Error('La plantilla ' + templateName + ' no existe'); + getTemplate: function(template, countryCode, params, cb) { + var templatePath = path.join(__dirname, 'template', `${template}`, `${template}.html`); + var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); - var langParams = language.load(templateName, langCode); - params = Object.assign({}, langParams, params); - var templatePath = path.join(__dirname, 'template', `${rs[0].name}.html`); + fs.stat(templatePath, (error, stat) => { + if (error) + return cb(null, 'Template ' + template + ' not found'); - if (!fs.existsSync(templatePath)) - throw new Error('No se ha podido cargar la plantilla ' + templateName + '.html'); + let TemplateClass = require(classPath); + let instance = new TemplateClass(); - Template.render(templatePath, params, function(tplBody) { - callback({subject: params.subject, body: tplBody}); + instance.getData(params, data => { + locale.load(template, countryCode, (rs, error) => { + data = Object.assign({}, rs, data); + + this.render(templatePath, data, body => { + var titleSubject = body.match(new RegExp('(.*?)', 'i'))[1]; + + this.getAttachments(template, body, attachments => { + cb({body: body, subject: titleSubject, attachments: attachments}); + }); + }); + }); }); }); }, @@ -34,15 +41,46 @@ var Template = { /** * Renderiza las plantillas * @param {String} path - Ruta de la plantilla - * @param {Object} params - Listado de parámetros a remplazar - * @param {Object} callback - Callback + * @param {Object} data - Listado de parámetros a remplazar + * @param {Object} cb - Callback */ - render: function(path, params, callback) { + render: function(path, data, cb) { fs.readFile(path, 'utf8', function(error, body) { mustache.parse(body); - callback(mustache.render(body, params)); + cb(mustache.render(body, data)); + }); + }, + + /** + * Obtiene todos los ficheros adjuntos de la plantilla + * @param {String} template - Nombre de la plantilla + * @param {String} body - html de la plantilla + * @param {Object} cb - Callback + */ + getAttachments: function(template, body, cb) { + var attachments = []; + var tplAttachments = body.match(new RegExp('src="cid:(.*?)"', 'ig')); + + for (var i = 0; i < tplAttachments.length; i++) { + var name = tplAttachments[i].replace('src="cid:', '').replace('"', ''); + var attachmentPath = path.join(__dirname, 'template/image', name); + + attachments.push({filename: name, path: attachmentPath, cid: name}); + } + + var attachmentsPath = path.join(__dirname, 'template', `${template}`, 'attachment.json'); + + fs.stat(attachmentsPath, (error, stats) => { + if (error) return cb(null, 'Could not load attachments from template ' + template); + + var attachObj = require(attachmentsPath); + + for (var i = 0; i < attachObj.length; i++) { + var attachmentPath = path.join(__dirname, 'template', `${template}`, 'attachment', attachObj[i]); + attachments.push({filename: attachObj[i], path: attachmentPath, cid: attachObj[i]}); + } + + cb(attachments); }); } }; - -module.exports = Template; diff --git a/services/mailer/application/template/images/download.png b/services/mailer/application/template/image/action.png similarity index 83% rename from services/mailer/application/template/images/download.png rename to services/mailer/application/template/image/action.png index d1817417797a99e1036af85cdd0c6bd00a462e81..2cd16c453d66b10611f90ee01deba70edbd7113e 100644 GIT binary patch delta 519 zcmV+i0{H#)7nvC$iBL{Q4GJ0x0000DNk~Le0000U0000U2nGNE06Q?QqOl>L3V*~& zL_t(|+Pv4hYE?lL#_^var;vbA&?qVx5eY#NY+?}wjTbag@rD*YgD+s?OW4|(!n=4E zFA+3?Hi8f&g+xKcD{4S26pzh1AYtZ^oa}K`oAojL_cwd?T5IOi>vdCOV}F0+u>+@Z z4X3mak48t6`SvDj+He+w*oR4+Q-4vkW%3JgCZLTN#AHmW3OlC@or&YFC=97K_&J8Ahy delta 354 zcmV-o0iFJt8TA(-iBL{Q4GJ0x0000DNk~Le0000j0000j2nGNE06H4tnz13D3V$F; zL_t(|+U(iS4Z$}f`-^LAoFpOq2qZ!R;Ml+hxjCN!@Q*!P+-)$26 zZUXvxS8l$5QK(kLn0EXEw@5jVci^^#!97&pi$mI-jm{k4J@Q!DE`y|BQYQ0P&T$C1sfJU;qFB07*qoM6N<$f{AdL Ar~m)} diff --git a/services/mailer/application/template/images/facebook.png b/services/mailer/application/template/image/facebook.png similarity index 100% rename from services/mailer/application/template/images/facebook.png rename to services/mailer/application/template/image/facebook.png diff --git a/services/mailer/application/template/images/header.png b/services/mailer/application/template/image/header.png similarity index 100% rename from services/mailer/application/template/images/header.png rename to services/mailer/application/template/image/header.png diff --git a/services/mailer/application/template/images/chat.png b/services/mailer/application/template/image/info.png similarity index 88% rename from services/mailer/application/template/images/chat.png rename to services/mailer/application/template/image/info.png index 0bec1ab86dcd44f14e10118e5f846eb49e9778c8..fb75cbc4efe4308149fcf4a7a7d0f6cba170c5e5 100644 GIT binary patch delta 338 zcmV-Y0j>Vo7v&criBL{Q4GJ0x0000DNk~Le0000U0000U2nGNE06Q?QqOl>L3V#qu zL_t(|+U(XnN&`_8hT&(DYfL353L=c|BW}Uo!hj1<3o(K_5b+0VOVJ&;6E|RQqp=7k zn%LZti-^_C*vwa*b8hk8bM6mcw%O~=;~YC^t5%=5$8o>~_SL5YWC8tHm|=)9LdmcX zbg+O7{SXTxbPG=vf!FYW6?6h7$$$JG@mkS{pA*)kl`Ldftnh4?@Xc%aCpF*(+<+T! z18%^nUN9|^@W)10qX(OoXaox0T=)SU#`qMwC4)Oyj`=tRk0N*vCl!zVE(O2i7TYm@ zOPonr8mIQQP>zilU*RmqWq9o@y4X>?WWp~O>l#OOJf~TbU*fQ?cic@n9VgWJfpl?G kSEq&A>v^uuP78ev0Qt%=oFl1pvj6}907*qoM6N<$f}jtPj{pDw delta 326 zcmaDVep6hrGr-TCmrII^fq{Y7)59eQNb7F!Z>}ij zF$D@7`)Gfgm+$U`HmM6Y%<=_o8J11^!lI$WWnl4VUPJMeCHWe{K zQ&QWR=W3E4Pd_`rb_@$v=TI&8fr|<{<4?Hg}ET3s;aKOr#?H*IN$gb5Jg${5@xJ;~Fb@}kE7^ch8 zP5gmRp3iz8$n;p_Q}$E;)hzR!SF_G{TFtin!mER&TR1-$-s1ToEuYK9^TC|q(nPPV U>}s~JfkDII>FVdQ&MBb@0G;EBc>n+a diff --git a/services/mailer/application/template/images/instagram.png b/services/mailer/application/template/image/instagram.png similarity index 100% rename from services/mailer/application/template/images/instagram.png rename to services/mailer/application/template/image/instagram.png diff --git a/services/mailer/application/template/images/linkedin.png b/services/mailer/application/template/image/linkedin.png similarity index 100% rename from services/mailer/application/template/images/linkedin.png rename to services/mailer/application/template/image/linkedin.png diff --git a/services/mailer/application/template/images/pinterest.png b/services/mailer/application/template/image/pinterest.png similarity index 100% rename from services/mailer/application/template/images/pinterest.png rename to services/mailer/application/template/image/pinterest.png diff --git a/services/mailer/application/template/images/twitter.png b/services/mailer/application/template/image/twitter.png similarity index 100% rename from services/mailer/application/template/images/twitter.png rename to services/mailer/application/template/image/twitter.png diff --git a/services/mailer/application/template/images/youtube.png b/services/mailer/application/template/image/youtube.png similarity index 100% rename from services/mailer/application/template/images/youtube.png rename to services/mailer/application/template/image/youtube.png diff --git a/services/mailer/application/template/images/arrow.png b/services/mailer/application/template/images/arrow.png deleted file mode 100644 index 66e5de8338c5c0dafb1367794342c8d9b392175b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3486 zcmV;P4Po+$P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0008XNklQn)Dy+5&g~DIIgUDsz2+)(L{-lO0&GKgzvs^TY^aCZJ8z={n4MbSQ4B)fCNY!7x zz@s2iXh?Jr=>^LFsP6+x^@bN6;0|DPmD&N|UZXwft3Xpq&0r9@)kx@0;GLuHTD{<@ z=tT7!(2@auy&*PYqWTqR1wJ~;hx3LPvV=wZk_NyjaU!ov6+O zCx8_P{8$i=rP>Pzcm+7M z9&k<2L1aHLYw4B-?n+drqrRG2ip@B{zkqWV@9~;|AhHLTw=_!w_a&+mQQNH`vKyFl zfB`O9oX2ZygUC)B*lc%{4<@RkQAY?iVVZM-hZ5EMQHM1_WE=jG*o~|sv6`cU$W}Wg zJm8y&YOW(+&zFE^J0 + + + {{subject}} + + + +
    + +
    + VerdNatura +
    + + + +
    +

    {{title}}

    +
    + + + +
    +

    {{dear}},

    +

    {{bodyDescription}}

    +

    +

    Forma de pago: {{paymentMethod}}
    +
    Día de pago: {{paymentDay}} de cada mes
    +

    +

    {{paymentAdvice}}

    +

    En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial.

    +
    + + + + + + + + + + + +
    +

    {{fiscalAddress}}

    +

    {{privacy}}

    +

    {{privacyLaw}}

    +
    + +
    + + \ No newline at end of file diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js new file mode 100644 index 0000000000..8ac60c155b --- /dev/null +++ b/services/mailer/application/template/payment-update/payment-update.js @@ -0,0 +1,26 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); + +module.exports = class PaymentUpdate { + getData(params, cb) { + database.pool.query('SELECT pm.name AS paymentMethod, pm.id AS paymentMethodId, vencimiento AS paymentDay FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?', [params.userId], (error, result) => { + cb({ + paymentMethod: result[0].paymentMethod, + paymentDay: result[0].paymentDay, + paymentAdvice: this.getPaymentAdvice(result[0].paymentMethodId) + }); + }); + } + _(string) { + return string; + } + getPaymentAdvice(paymentMethod) { + if (paymentMethod == 4) { + return 'Su modo de pago actual implica que se le pasará un cargo a la cuenta ESXXXX **** **** **** **** por el importe pendiente, al vencimiento establecido en las condiciones.'; + } else if (paymentMethod == 5) { + return 'Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.'; + } + } +}; + + diff --git a/services/mailer/application/template/paymentUpdate.html b/services/mailer/application/template/paymentUpdate.html deleted file mode 100644 index a61bfcaf70..0000000000 --- a/services/mailer/application/template/paymentUpdate.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - {{subject}} - - - -
    - -
    - VerdNatura -
    - -
    -

    {{title}}

    -
    - - - -
    -

    {{dear}} {{clientName}},

    -

    {{bodyDescription}}

    - -

    ??

    -

    ??

    -
    - - - - - - - - - - - -
    -

    {{fiscalAddress}}

    -

    - AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.

    -

    En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.

    -
    - -
    - - \ No newline at end of file diff --git a/services/mailer/server.js b/services/mailer/server.js index f7d5bc571b..ee15c67f1a 100644 --- a/services/mailer/server.js +++ b/services/mailer/server.js @@ -15,14 +15,19 @@ app.use(bodyParser.urlencoded({extended: true})); // Cargar rutas app.use('/', require('./application/router.js')); +app.use(function(err, req, res, next) { + console.error(err.message); + res.status(500).send('Something broke!'); +}); + // Iniciar escucha del servidor app.start = function() { return app.listen(settings.app().port, function() { mail.init(); database.init(); - console.log('Servidor de correo iniciado en el puerto ' + settings.app().port); + console.log('Mailer started at port:' + settings.app().port); if (settings.app().debug) { - console.log('El modo debug está activado'); + console.log('Debug mode enabled'); } }); }; From e178bd8676b792ce8c61e6691a6af5854d2988fa Mon Sep 17 00:00:00 2001 From: Joan Date: Wed, 7 Jun 2017 19:29:16 +0200 Subject: [PATCH 142/391] =?UTF-8?q?Traducciones=20de=20plantillas=20y=20mo?= =?UTF-8?q?strar=20nuevos=20datos=20de=20facturaci=C3=B3n=20en=20servicio?= =?UTF-8?q?=20mailer.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/mailer/application/mail.js | 2 +- .../mailer/application/route/notification.js | 2 +- services/mailer/application/router.js | 17 --------- services/mailer/application/template.js | 19 +++++----- .../template/payment-update/locale/es.json | 9 +++++ .../payment-update/payment-update.html | 24 ++++++------- .../template/payment-update/payment-update.js | 26 +++++++------- services/mailer/application/util/format.js | 35 +++++++++++++++++++ 8 files changed, 80 insertions(+), 54 deletions(-) create mode 100644 services/mailer/application/util/format.js diff --git a/services/mailer/application/mail.js b/services/mailer/application/mail.js index 674b05b2fa..6ba40ff903 100644 --- a/services/mailer/application/mail.js +++ b/services/mailer/application/mail.js @@ -36,7 +36,7 @@ module.exports = { html: body, attachments }; - console.log(recipient); + this.transporter.sendMail(mailOptions, (error, info) => { if (error) { return cb(null, 'Email not sent: ' + error); diff --git a/services/mailer/application/route/notification.js b/services/mailer/application/route/notification.js index 5ec515dd1a..a7f9904a2d 100644 --- a/services/mailer/application/route/notification.js +++ b/services/mailer/application/route/notification.js @@ -1,6 +1,6 @@ var express = require('express'); var router = new express.Router(); - +var format = require('../util/format.js'); router.get('/test', function(request, response) { response.send("test"); }); diff --git a/services/mailer/application/router.js b/services/mailer/application/router.js index a624eba0f7..2015486322 100644 --- a/services/mailer/application/router.js +++ b/services/mailer/application/router.js @@ -12,22 +12,5 @@ router.use('/manuscript', require('./route/manuscript.js')); // Notifications router.use('/notification', require('./route/notification.js')); -/*// Load template route -router.post('/:userId/:template', function(request, response, next) { - database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) { - if (qryRs.length == 0) - return response.json({data: {message: 'Client not found'}}); - template.getTemplate(request.params.template, qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { - if (error) - return response.json({data: {message: error}}); - - mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => { - if (error) - return response.json({data: {message: error}}); - }); - }); - }); -}); -*/ module.exports = router; diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js index b03fd47359..d484393c97 100644 --- a/services/mailer/application/template.js +++ b/services/mailer/application/template.js @@ -22,18 +22,19 @@ module.exports = { let TemplateClass = require(classPath); let instance = new TemplateClass(); - instance.getData(params, data => { - locale.load(template, countryCode, (rs, error) => { - data = Object.assign({}, rs, data); + let getDataCb = () => { + this.render(templatePath, instance, body => { + var titleSubject = body.match(new RegExp('(.*?)', 'i'))[1]; - this.render(templatePath, data, body => { - var titleSubject = body.match(new RegExp('(.*?)', 'i'))[1]; - - this.getAttachments(template, body, attachments => { - cb({body: body, subject: titleSubject, attachments: attachments}); - }); + this.getAttachments(template, body, attachments => { + cb({body: body, subject: titleSubject, attachments: attachments}); }); }); + }; + + locale.load(template, countryCode, (translations, error) => { + instance._ = translations; + instance.getData(params, () => getDataCb()); }); }); }, diff --git a/services/mailer/application/template/payment-update/locale/es.json b/services/mailer/application/template/payment-update/locale/es.json index ecf908f924..144cdc3464 100644 --- a/services/mailer/application/template/payment-update/locale/es.json +++ b/services/mailer/application/template/payment-update/locale/es.json @@ -3,6 +3,15 @@ "title": "Cambio en las condiciones", "dear": "Estimado cliente", "bodyDescription": "Le informamos que han cambiado las condiciones de pago de su cuenta. A continuación le indicamos las nuevas condiciones:", + "paymentMethod": "Método de pago", + "paymentDay": "Día de pago", + "everyMonth": "de cada mes", + "cardPaymentAdvice": "Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.", + "accountPaymentAdviceBefore": "Su modo de pago actual implica que se le pasará un cargo a la cuenta", + "accountPaymentAdviceAfter": "por el importe pendiente, al vencimiento establecido en las condiciones.", + "notifyError": "En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial.", + "actionButton": "Visita nuestra Web", + "infoButton": "Ayúdanos a mejorar", "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." diff --git a/services/mailer/application/template/payment-update/payment-update.html b/services/mailer/application/template/payment-update/payment-update.html index 81086327a7..a943ca94cd 100644 --- a/services/mailer/application/template/payment-update/payment-update.html +++ b/services/mailer/application/template/payment-update/payment-update.html @@ -1,7 +1,7 @@ - {{subject}} + {{_.subject}} @@ -14,32 +14,32 @@
    -

    {{title}}

    +

    {{_.title}}

    -

    {{dear}},

    -

    {{bodyDescription}}

    +

    {{_.dear}},

    +

    {{_.bodyDescription}}

    -

    Forma de pago: {{paymentMethod}}
    -
    Día de pago: {{paymentDay}} de cada mes
    +
    {{_.paymentMethod}}: {{payMethod}}
    +
    {{_.paymentDay}}: {{paymentDay}} {{_.everyMonth}}

    {{paymentAdvice}}

    -

    En el caso de detectar algún error en los datos indicados o para cualquier aclaración, debe dirigirse a su comercial.

    +

    {{_.notifyError}}

    @@ -70,9 +70,9 @@
    -

    {{fiscalAddress}}

    -

    {{privacy}}

    -

    {{privacyLaw}}

    +

    {{_.fiscalAddress}}

    +

    {{_.privacy}}

    +

    {{_.privacyLaw}}

    diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js index 8ac60c155b..9034a2dd96 100644 --- a/services/mailer/application/template/payment-update/payment-update.js +++ b/services/mailer/application/template/payment-update/payment-update.js @@ -1,24 +1,22 @@ var path = require('path'); var database = require(path.join(__dirname, '../../database.js')); +var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PaymentUpdate { getData(params, cb) { - database.pool.query('SELECT pm.name AS paymentMethod, pm.id AS paymentMethodId, vencimiento AS paymentDay FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?', [params.userId], (error, result) => { - cb({ - paymentMethod: result[0].paymentMethod, - paymentDay: result[0].paymentDay, - paymentAdvice: this.getPaymentAdvice(result[0].paymentMethodId) - }); + let query = `SELECT pm.name AS payMethod, pm.id AS payMethodId, c.vencimiento AS paymentDay, c.CC AS accountAddress + FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?`; + database.pool.query(query, [params.userId], (error, result) => { + Object.assign(this, result[0]); + cb(); }); } - _(string) { - return string; - } - getPaymentAdvice(paymentMethod) { - if (paymentMethod == 4) { - return 'Su modo de pago actual implica que se le pasará un cargo a la cuenta ESXXXX **** **** **** **** por el importe pendiente, al vencimiento establecido en las condiciones.'; - } else if (paymentMethod == 5) { - return 'Su modo de pago actual implica que deberá abonar el importe de los pedidos realizados en el mismo día para que se puedan enviar.'; + get paymentAdvice() { + switch (this.payMethodId) { + case 4: + return `${this._.accountPaymentAdviceBefore} ${format.partialAccountAddress(this.accountAddress)} ${this._.accountPaymentAdviceAfter}`; + case 5: + return this._.cardPaymentAdvice; } } }; diff --git a/services/mailer/application/util/format.js b/services/mailer/application/util/format.js new file mode 100644 index 0000000000..e166062c7b --- /dev/null +++ b/services/mailer/application/util/format.js @@ -0,0 +1,35 @@ +let database = require('../database.js'); + +module.exports = { + + /** + * Devuelve el iban + * @param {String} addressNumber - Dirección de cuenta bancaria + * @param {Object} cb - Callback + */ + accountAddressIban: function(addressNumber, cb) { + database.pool.query('SELECT vn2008.cc_to_iban(?) AS iban', [addressNumber], function(error, result) { + cb(result[0].iban); + }); + }, + + /** + * Obtiene el numero de cuenta completo incluyendo iban + * @param {String} addressNumber - Dirección de cuenta bancaria + * @return {String} Cuenta bancaria formateada + */ + accountAddress: function(addressNumber) { + var formattedAccountAddress = addressNumber.replace(/(.{4})/g, '$1-'); + return formattedAccountAddress.substring(0, formattedAccountAddress.length - 1); + }, + + /** + * Devuelve el numero de cuenta mostrando únicamente los últimos 4 dígitos. + * @param {String} addressNumber - Dirección de cuenta bancaria + * @return {String} Cuenta bancaria formateada + */ + partialAccountAddress: function(addressNumber) { + let address = this.accountAddress(addressNumber); + return address.substring(0, 19).replace(/[0-9]/g, 'X') + address.substring(19, 24); + } +}; From 3806e9e5917dafc970f07074de20378c61d45435 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 8 Jun 2017 09:29:03 +0200 Subject: [PATCH 143/391] nueva directiva vn-tooltip --- client/core/src/components.js | 1 + client/core/src/tooltip/style.css | 61 +++++++++++++++++++++ client/core/src/tooltip/tooltip.js | 74 ++++++++++++++++++++++++++ client/production/src/index/index.html | 17 +++++- client/production/src/index/style.scss | 9 ++-- gulpfile.js | 9 ++-- 6 files changed, 162 insertions(+), 9 deletions(-) create mode 100644 client/core/src/tooltip/style.css create mode 100644 client/core/src/tooltip/tooltip.js diff --git a/client/core/src/components.js b/client/core/src/components.js index 2c8a096300..fc5c92d344 100644 --- a/client/core/src/components.js +++ b/client/core/src/components.js @@ -14,6 +14,7 @@ import './title/title'; import './subtitle/subtitle'; import './spinner/spinner'; import './snackbar/snackbar'; +import './tooltip/tooltip'; export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; diff --git a/client/core/src/tooltip/style.css b/client/core/src/tooltip/style.css new file mode 100644 index 0000000000..a85131357a --- /dev/null +++ b/client/core/src/tooltip/style.css @@ -0,0 +1,61 @@ +[vn-tooltip]{ + cursor: help; +} +.tooltip { + display: none; + position: fixed; + background-color: #fff; + padding: 15px; + max-width: 250px; + color: #222; + z-index: 999; + border: 2px solid #A7A7A7; + border-radius: 5px; + text-align: justify; +} + +.tooltip-show { + display: inherit; +} + +.tooltip-arrow { + position: absolute; + width: 0; + height: 0; +} + +.tooltip-down .tooltip-arrow { + top: -15px; + left: 50%; + margin-left: -10px; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-bottom: 15px solid #A7A7A7; +} + +.tooltip-up .tooltip-arrow { + bottom: -15px; + left: 50%; + margin-left: -10px; + border-left: 10px solid transparent; + border-right: 10px solid transparent; + border-top: 15px solid #A7A7A7; +} + +.tooltip-right .tooltip-arrow { + left: -15px; + top: 50%; + margin-top: -10px; + border-top: 10px solid transparent; + border-bottom: 10px solid transparent; + border-right: 15px solid #A7A7A7; +} + +.tooltip-left .tooltip-arrow { + right: -15px; + top: 50%; + margin-top: -10px; + border-top: 10px solid transparent; + border-bottom: 10px solid transparent; + border-left: 15px solid #A7A7A7; +} \ No newline at end of file diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js new file mode 100644 index 0000000000..e84836f6e5 --- /dev/null +++ b/client/core/src/tooltip/tooltip.js @@ -0,0 +1,74 @@ +import {module} from '../module'; +import './style.css'; + +tooltip.$inject = ['$document', '$compile']; +function tooltip($document, $compile) { + return { + restrict: 'A', + scope: true, + link: function(scope, element, attrs) { + var tip = $compile('
    {{ text }}
    ')(scope); + var tipClassName = 'tooltip'; + var tipActiveClassName = 'tooltip-show'; + + scope.tipClass = [tipClassName]; + scope.text = attrs.vnTooltip; + + if (attrs.tooltipPosition) { + scope.tipClass.push('tooltip-' + attrs.tooltipPosition); + } else { + scope.tipClass.push('tooltip-down'); + } + + $document.find('body').append(tip); + + element.bind('mouseover', function(e) { + tip.addClass(tipActiveClassName); + + let pos = e.target.getBoundingClientRect(); + let tipPos = tip[0].getBoundingClientRect(); + let offset = {top: 0, left: 0}; + let tipWidth = tipPos.width || tipPos.right - tipPos.left; + let tipHeight = tipPos.height || tipPos.bottom - tipPos.top; + let elWidth = pos.width || pos.right - pos.left; + let elHeight = pos.height || pos.bottom - pos.top; + let tipOffset = 10; + + if (tip.hasClass('tooltip-right')) { + offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); + offset.left = pos.right + tipOffset; + } else if (tip.hasClass('tooltip-left')) { + offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); + offset.left = pos.left - tipWidth - tipOffset; + } else if (tip.hasClass('tooltip-down')) { + offset.top = pos.top + elHeight + tipOffset; + offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); + } else { + offset.top = pos.top - tipHeight - tipOffset; + offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); + } + + tip.css('top', offset.top + 'px'); + tip.css('left', offset.left + 'px'); + }); + + element.bind('mouseout', function() { + tip.removeClass(tipActiveClassName); + }); + + tip.bind('mouseover', function() { + tip.addClass(tipActiveClassName); + }); + + tip.bind('mouseout', function() { + tip.removeClass(tipActiveClassName); + }); + + element.on('$destroy', function() { + tip.remove(); + }); + } + }; +} + +module.directive('vnTooltip', tooltip); diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 7ab9356a23..9d9a62bf6c 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -51,7 +51,9 @@
    - + + + @@ -66,6 +68,19 @@ + + : + {{index.model.length}} + + + + + + + + + + \ No newline at end of file diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index d6f8d50e07..b4013d5106 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -13,14 +13,15 @@ vn-production-index { border-top: 3px solid #9D9D9D; font-weight: bold; } - .list > vn-one{ - text-align: center; - } - .list > [vn-one]{ + .list > vn-one, .list > [vn-one], .list > [vn-two], .list > vn-two{ text-align: center; } .list-body{ padding: 4px 0px; border-bottom: 1px solid #9D9D9D; + + i { + color: #ffa410; + } } } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 07d99c1827..b1a8968c0f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -36,9 +36,9 @@ gulp.task('client', ['clean'], function() { gulp.task('copy', function() { var streams = []; - for (i=0; i < services.services.length; i++) { + for (i = 0; i < services.services.length; i++) { var service = services.services[i]; - for (j=0; j < services.files.length; j++) { + for (j = 0; j < services.files.length; j++) { var file = services.files[j]; streams.push(gulp.src("./services/service/models/" + file) .pipe(gulp.dest(service + "/common/models/"))); @@ -52,14 +52,15 @@ gulp.task('services', ['copy'], function() { require('./services/salix/server/server.js').start(); require('./services/mailer/server.js').start(); - for (i=0; i < services.services.length; i++) { + for (i = 0; i < services.services.length; i++) { require(services.services[i] + "/server/server.js").start(); } }); +/* Nota (dani): Comentado para que no me borre el mock del Localizador gulp.task('clean', function() { return del(`${buildDir}/*`, {force: true}); -}); +}); */ // Spliting From 491241398a60cd1b73fa6c935b2dcc173b14ea1c Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 8 Jun 2017 10:05:11 +0200 Subject: [PATCH 144/391] localizador y tooltip arreglo estilos --- client/core/src/tooltip/style.css | 5 ++--- client/core/src/tooltip/tooltip.js | 2 +- client/production/src/index/index.html | 26 +++++++++++++------------- client/production/src/index/index.js | 1 + client/production/src/index/style.scss | 4 +++- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/client/core/src/tooltip/style.css b/client/core/src/tooltip/style.css index a85131357a..943a92c9ce 100644 --- a/client/core/src/tooltip/style.css +++ b/client/core/src/tooltip/style.css @@ -7,10 +7,9 @@ background-color: #fff; padding: 15px; max-width: 250px; - color: #222; + color: #424242; z-index: 999; - border: 2px solid #A7A7A7; - border-radius: 5px; + border: 1px solid #A7A7A7; text-align: justify; } diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js index e84836f6e5..1ea5df24a2 100644 --- a/client/core/src/tooltip/tooltip.js +++ b/client/core/src/tooltip/tooltip.js @@ -7,7 +7,7 @@ function tooltip($document, $compile) { restrict: 'A', scope: true, link: function(scope, element, attrs) { - var tip = $compile('
    {{ text }}
    ')(scope); + var tip = $compile('
    {{ text }}
    ')(scope); var tipClassName = 'tooltip'; var tipActiveClassName = 'tooltip-show'; diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 9d9a62bf6c..49c24f3bf9 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,5 +1,5 @@ - + Localizador @@ -50,27 +50,27 @@ - + - + - + - {{::item.id}} - {{::item.agency.id}} - {{::item.employee.name}} - {{::item.hour}} - {{::item.state.name}} - {{::item.lines}} - {{::item.meters}} - {{::item.boxes}} + {{ticket.id}} + {{ticket.agency.id}} + {{ticket.employee.name}} + {{ticket.hour}} + {{ticket.state.name}} + {{ticket.lines}} + {{ticket.meters}} + {{ticket.boxes}} : - {{index.model.length}} + {{$ctrl.tickets.length}} diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 73a40ed8b0..a901c863c9 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -5,6 +5,7 @@ export default class ProductionIndex { constructor() { this.model = {}; this.checkAll = false; + this.tickets = []; } search(index) { index.filter.search = this.model.search; diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index b4013d5106..0571afb44e 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -3,7 +3,9 @@ vn-production-index { height: 20px; padding: 0 6px; } - + .icon-square{ + height: 36px; + } .list-header{ border-bottom: 3px solid #9D9D9D; font-weight: bold; From dbb163263276aafa904059bf46d58b772f1bd34b Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Thu, 8 Jun 2017 11:08:45 +0200 Subject: [PATCH 145/391] nginx docker --- services/nginx/conf-prod.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/nginx/conf-prod.conf b/services/nginx/conf-prod.conf index 3e9f9f7c0a..a1204c7a5f 100644 --- a/services/nginx/conf-prod.conf +++ b/services/nginx/conf-prod.conf @@ -20,7 +20,7 @@ http { root /usr/share/nginx/html; location ~ ^/static(?:/(.*))?$ { - alias /usr/share/nginx/html; + alias /usr/share/nginx/html/$1; autoindex on; } location ~ ^/auth(?:/(.*))?$ { From f274335997e1e9b9940a8f6d6c27fe4f1b59bcae Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 8 Jun 2017 14:57:23 +0200 Subject: [PATCH 146/391] =?UTF-8?q?interfaz=20gr=C3=A1fica=20y=20correccio?= =?UTF-8?q?nes=20varias?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/core/src/date-picker/date-picker.js | 11 +++- client/core/src/popover/popover.js | 3 + client/core/src/tooltip/tooltip.js | 6 +- .../src/filter-panel/filter-panel.html | 10 +++- .../src/filter-panel/filter-panel.js | 8 ++- client/production/src/filter-panel/style.scss | 6 ++ client/production/src/index/index.html | 16 +++-- client/production/src/index/index.js | 59 +++++++++++++++++-- client/production/src/index/style.scss | 11 ++++ .../src/components/searchbar/searchbar.js | 4 +- client/salix/src/styles/misc.scss | 6 ++ 11 files changed, 114 insertions(+), 26 deletions(-) create mode 100644 client/production/src/filter-panel/style.scss diff --git a/client/core/src/date-picker/date-picker.js b/client/core/src/date-picker/date-picker.js index 9f4a1647bb..b60f204094 100644 --- a/client/core/src/date-picker/date-picker.js +++ b/client/core/src/date-picker/date-picker.js @@ -7,8 +7,8 @@ import Flatpickr from 'vendor/src/flatpickr'; const _NAME = 'datePicker'; export const NAME = util.getName(_NAME); -directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate']; -export function directive(resolve, normalizer, $translate) { +directive.$inject = [resolveFactory.NAME, normalizerFactory.NAME, '$translate', '$document', '$transitions']; +export function directive(resolve, normalizer, $translate, $document, $transitions) { return { restrict: 'E', template: function(_, attrs) { @@ -32,6 +32,13 @@ export function directive(resolve, normalizer, $translate) { if (input) vp = new Flatpickr(input, initOptions); + scope.$watch(attrs.model, () => { + let mdlField = element[0].firstChild.MaterialCheckbox; + if (mdlField) + mdlField.updateClasses_(); + }); + componentHandler.upgradeElement(element[0].firstChild); + element.on('$destroy', function() { vp.destroy(); }); diff --git a/client/core/src/popover/popover.js b/client/core/src/popover/popover.js index f04cb3d090..46e772681c 100644 --- a/client/core/src/popover/popover.js +++ b/client/core/src/popover/popover.js @@ -21,6 +21,7 @@ export class Popover { this.$compile = $compile; } show(childElement, parent) { + this.childElement = childElement; let popover = this.document.createElement('div'); popover.className = 'vn-popover'; popover.addEventListener('mousedown', @@ -81,6 +82,7 @@ export class Popover { let childElement = this.document.createElement(childComponent); this.$compile(childElement)($scope); this.show(childElement, parent); + return childElement; } hide() { if (!this.popover) return; @@ -91,6 +93,7 @@ export class Popover { this.lastEvent = null; this.docMouseDownHandler = null; this.docKeyDownHandler = null; + angular.element(this.childElement).remove(); } onDocMouseDown(event) { if (event != this.lastEvent) diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js index 1ea5df24a2..d7620e41c2 100644 --- a/client/core/src/tooltip/tooltip.js +++ b/client/core/src/tooltip/tooltip.js @@ -52,15 +52,15 @@ function tooltip($document, $compile) { tip.css('left', offset.left + 'px'); }); - element.bind('mouseout', function() { + element.on('mouseout', function() { tip.removeClass(tipActiveClassName); }); - tip.bind('mouseover', function() { + tip.on('mouseover', function() { tip.addClass(tipActiveClassName); }); - tip.bind('mouseout', function() { + tip.on('mouseout', function() { tip.removeClass(tipActiveClassName); }); diff --git a/client/production/src/filter-panel/filter-panel.html b/client/production/src/filter-panel/filter-panel.html index aa47f90665..8ee87823c1 100644 --- a/client/production/src/filter-panel/filter-panel.html +++ b/client/production/src/filter-panel/filter-panel.html @@ -13,11 +13,19 @@ value-field="id" label="Provincia"> - + + + + + + + + +
    \ No newline at end of file diff --git a/client/production/src/filter-panel/filter-panel.js b/client/production/src/filter-panel/filter-panel.js index c432b3b08f..907df7f145 100644 --- a/client/production/src/filter-panel/filter-panel.js +++ b/client/production/src/filter-panel/filter-panel.js @@ -1,20 +1,24 @@ import ngModule from '../module'; +import './style.scss'; export default class Controller { constructor($window) { this.$window = $window; } + /* $onDestroy() { + console.log('panel destruido'); + }*/ onSearch() { this.setStorageValue(); this.onSubmit(this.filter); } $onChanges() { - var value = JSON.parse(this.$window.sessionStorage.getItem('production')); + var value = JSON.parse(this.$window.sessionStorage.getItem('filter')); if (value !== undefined) this.filter = value; } setStorageValue() { - this.$window.sessionStorage.setItem('production', JSON.stringify(this.filter)); + this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter)); } } Controller.$inject = ['$window']; diff --git a/client/production/src/filter-panel/style.scss b/client/production/src/filter-panel/style.scss new file mode 100644 index 0000000000..f943570873 --- /dev/null +++ b/client/production/src/filter-panel/style.scss @@ -0,0 +1,6 @@ +vn-production-filter-panel { + button { + color: #ffa410 !important; + background-color: white !important; + } +} \ No newline at end of file diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index 49c24f3bf9..b768aab801 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,13 +1,13 @@ + - Localizador @@ -18,9 +18,7 @@ url="/client/api/ContactChannels" label="Almacen"> - - - + @@ -58,7 +56,7 @@ {{ticket.id}} - {{ticket.agency.id}} + {{ticket.agency.name}} {{ticket.employee.name}} {{ticket.hour}} {{ticket.state.name}} @@ -77,8 +75,8 @@ - - + {{$ctrl.lines}} + {{$ctrl.meters}} diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index a901c863c9..97c5c1d5c0 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -2,16 +2,63 @@ import ngModule from '../module'; import './style.scss'; export default class ProductionIndex { - constructor() { - this.model = {}; - this.checkAll = false; + constructor($element, $scope) { + this.$element = $element; + this.$ = $scope; + this.filter = {}; + this._checkAll = false; this.tickets = []; + this.lines = 0; + this.meters = 0; } - search(index) { - index.filter.search = this.model.search; - index.accept(); + get checkAll() { + return this._checkAll; + } + set checkAll(value) { + this._checkAll = value; + this.switchChecks(); + } + switchChecks() { + let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]'); + checks.forEach( + (el, i) => { + el.checked = this._checkAll; + this.tickets[i].cheched = this._checkAll; + } + ); + } + doAction(action) { + let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]:checked'); + if (checks.length) { + let ids = []; + checks.forEach( + (_, i) => { + ids.push(this.tickets[i].id); + } + ); + // TODO: call action -> endPoint with tickets's Ids + } else { + // TODO: dialog with no items selected + } + } + sumTickets() { + let lines = 0; + let meters = 0; + this.tickets.forEach( + val => { + lines += parseFloat(val.lines); + meters += parseFloat(val.meters); + } + ); + this.lines = lines; + this.meters = meters.toFixed(2); + } + onSearch() { + this.$.index.filter = this.filter; + this.$.index.accept(); } } +ProductionIndex.$inject = ['$element', '$scope']; ngModule.component('vnProductionIndex', { template: require('./index.html'), diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index 0571afb44e..13bd38bbfb 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -3,6 +3,17 @@ vn-production-index { height: 20px; padding: 0 6px; } + vn-searchbar { + vn-icon{ + padding-top: 20px; + } + vn-icon-button{ + padding-top: 10px; + } + } + [pad-ten-top] { + padding-top: 10px; + } .icon-square{ height: 36px; } diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 081f566f18..aac912788c 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -10,9 +10,7 @@ export default class Controller { this.$window = $window; } onClick(event) { - var child = this.$document[0].createElement(this.popover); - this.$compile(child)(this.$scope); - this.vnPopover.show(child, this.element); + var child = this.vnPopover.showComponent(this.popover, this.$scope, this.element); // XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente? var childCtrl = angular.element(child).isolateScope().$ctrl; diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 1146d9c0fd..c3712646e6 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -29,4 +29,10 @@ vn-button-bar { } html [text-center], .text-center { text-align: center; +} +html [vn-right], .vn-right{ + float: right; +} +html [vn-left], .vn-left{ + float: left; } \ No newline at end of file From 9aa549cfc5e769e83f21473527c0a1b07496ee0f Mon Sep 17 00:00:00 2001 From: Joan Date: Thu, 8 Jun 2017 16:53:10 +0200 Subject: [PATCH 147/391] No mostrar dia de pago en metodo de pago por tarjeta. --- gulpfile.js | 3 +-- .../template/payment-update/payment-update.html | 2 +- .../template/payment-update/payment-update.js | 9 ++++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b1a8968c0f..5722981c0a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -57,10 +57,9 @@ gulp.task('services', ['copy'], function() { } }); -/* Nota (dani): Comentado para que no me borre el mock del Localizador gulp.task('clean', function() { return del(`${buildDir}/*`, {force: true}); -}); */ +}); // Spliting diff --git a/services/mailer/application/template/payment-update/payment-update.html b/services/mailer/application/template/payment-update/payment-update.html index a943ca94cd..99d3a5e8b6 100644 --- a/services/mailer/application/template/payment-update/payment-update.html +++ b/services/mailer/application/template/payment-update/payment-update.html @@ -24,7 +24,7 @@

    {{_.bodyDescription}}

    {{_.paymentMethod}}: {{payMethod}}
    -
    {{_.paymentDay}}: {{paymentDay}} {{_.everyMonth}}
    + {{{paymentDay}}}

    {{paymentAdvice}}

    {{_.notifyError}}

    diff --git a/services/mailer/application/template/payment-update/payment-update.js b/services/mailer/application/template/payment-update/payment-update.js index 9034a2dd96..0bbf8b7840 100644 --- a/services/mailer/application/template/payment-update/payment-update.js +++ b/services/mailer/application/template/payment-update/payment-update.js @@ -4,13 +4,20 @@ var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class PaymentUpdate { getData(params, cb) { - let query = `SELECT pm.name AS payMethod, pm.id AS payMethodId, c.vencimiento AS paymentDay, c.CC AS accountAddress + let query = `SELECT pm.name AS payMethod, pm.id AS payMethodId, c.vencimiento AS payDay, c.CC AS accountAddress FROM Clientes AS c JOIN pay_met AS pm ON pm.id = c.pay_met_id WHERE Id_Cliente = ?`; database.pool.query(query, [params.userId], (error, result) => { Object.assign(this, result[0]); cb(); }); } + + get paymentDay() { + if (this.payMethodId != 5) { + return `
    ${this._.paymentDay}: ${this.payDay} ${this._.everyMonth}
    `; + } + } + get paymentAdvice() { switch (this.payMethodId) { case 4: From e4f94206971b133a0450c8356c1b45761539bc3d Mon Sep 17 00:00:00 2001 From: Joan Date: Mon, 12 Jun 2017 13:41:02 +0200 Subject: [PATCH 148/391] Parser de estilos en plantillas para el servicio mailer. --- .../mailer/application/route/manuscript.js | 4 +- .../mailer/application/route/notification.js | 26 +++- services/mailer/application/template.js | 33 ++++- .../template/notice/attachment.json | 1 + .../template/notice/locale/es.json | 11 ++ .../application/template/notice/notice.css | 0 .../application/template/notice/notice.html | 74 ++++++++++ .../application/template/notice/notice.js | 14 ++ .../payment-update/payment-update.css | 92 ++++++++++++ .../payment-update/payment-update.html | 132 +++++++++--------- services/mailer/package.json | 1 + services/mailer/server.js | 9 +- 12 files changed, 320 insertions(+), 77 deletions(-) create mode 100644 services/mailer/application/template/notice/attachment.json create mode 100644 services/mailer/application/template/notice/locale/es.json create mode 100644 services/mailer/application/template/notice/notice.css create mode 100644 services/mailer/application/template/notice/notice.html create mode 100644 services/mailer/application/template/notice/notice.js diff --git a/services/mailer/application/route/manuscript.js b/services/mailer/application/route/manuscript.js index 6c351fad5a..7c88498f54 100644 --- a/services/mailer/application/route/manuscript.js +++ b/services/mailer/application/route/manuscript.js @@ -5,12 +5,12 @@ var database = require('../database.js'); var template = require('../template.js'); // Escrito de cambios en méto de pago del cliente -router.post('/:userId/:template', function(request, response, next) { +router.post('/:userId/payment-update', function(request, response, next) { database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) { if (qryRs.length == 0) return response.json({data: {message: 'Client not found'}}); - template.getTemplate(request.params.template, qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { + template.getTemplate('payment-update', qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { if (error) return response.json({data: {message: error}}); diff --git a/services/mailer/application/route/notification.js b/services/mailer/application/route/notification.js index a7f9904a2d..2c3a427434 100644 --- a/services/mailer/application/route/notification.js +++ b/services/mailer/application/route/notification.js @@ -1,8 +1,28 @@ var express = require('express'); var router = new express.Router(); -var format = require('../util/format.js'); -router.get('/test', function(request, response) { - response.send("test"); +var mail = require('../mail.js'); +var database = require('../database.js'); +var template = require('../template.js'); + +router.get('/:userId/notice', function(request, response) { + database.pool.query('SELECT `e-mail` AS email, LOWER(p.Codigo) AS countryCode FROM Clientes AS c JOIN Paises AS p ON p.id = c.Id_Pais WHERE Id_Cliente = ?', [request.params.userId], function(error, qryRs) { + if (qryRs.length == 0) + return response.json({data: {message: 'Client not found'}}); + + template.getTemplate('notice', qryRs[0].countryCode, {userId: request.params.userId}, function(tplRs, error) { + if (error) + return response.json({data: {message: error}}); + + mail.send(qryRs[0].email, tplRs.subject, tplRs.body, tplRs.attachments, (mailrs, error) => { + if (error) + return response.json({data: {message: error}}); + + return response.json({data: {message: 'Mail sent'}}); + }); + }); + }); + + response.send(request.params.userid); }); module.exports = router; diff --git a/services/mailer/application/template.js b/services/mailer/application/template.js index d484393c97..172aa2bd18 100644 --- a/services/mailer/application/template.js +++ b/services/mailer/application/template.js @@ -2,6 +2,7 @@ var fs = require('fs'); var mustache = require('mustache'); var locale = require('./locale.js'); var path = require('path'); +var inlineCss = require('inline-css'); module.exports = { /** @@ -14,6 +15,7 @@ module.exports = { getTemplate: function(template, countryCode, params, cb) { var templatePath = path.join(__dirname, 'template', `${template}`, `${template}.html`); var classPath = path.join(__dirname, 'template', `${template}`, `${template}.js`); + var stylePath = path.join(__dirname, 'template', `${template}`, `${template}.css`); fs.stat(templatePath, (error, stat) => { if (error) @@ -22,16 +24,19 @@ module.exports = { let TemplateClass = require(classPath); let instance = new TemplateClass(); - let getDataCb = () => { - this.render(templatePath, instance, body => { + let getRenderedStyles = body => { + this.renderStyles(stylePath, body, body => { var titleSubject = body.match(new RegExp('(.*?)', 'i'))[1]; - this.getAttachments(template, body, attachments => { cb({body: body, subject: titleSubject, attachments: attachments}); }); }); }; + let getDataCb = () => { + this.render(templatePath, instance, body => getRenderedStyles(body)); + }; + locale.load(template, countryCode, (translations, error) => { instance._ = translations; instance.getData(params, () => getDataCb()); @@ -52,6 +57,28 @@ module.exports = { }); }, + /** + * Renderiza los estilos de las plantillas. + * @param {String} path - Ruta de la hoja de estilos + * @param {String} body - Html renderizado + * @param {Object} cb - Callback + */ + renderStyles: function(path, html, cb) { + fs.stat(path, error => { + if (error) return cb(null, 'Template stylesheet not found'); + fs.readFile(path, 'utf8', (error, css) => { + let style = ''; + let body = style + html; + let options = {url: ' '}; + + inlineCss(body, options) + .then(function(body) { + cb(body); + }); + }); + }); + }, + /** * Obtiene todos los ficheros adjuntos de la plantilla * @param {String} template - Nombre de la plantilla diff --git a/services/mailer/application/template/notice/attachment.json b/services/mailer/application/template/notice/attachment.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/services/mailer/application/template/notice/attachment.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/services/mailer/application/template/notice/locale/es.json b/services/mailer/application/template/notice/locale/es.json new file mode 100644 index 0000000000..b4a98a2f43 --- /dev/null +++ b/services/mailer/application/template/notice/locale/es.json @@ -0,0 +1,11 @@ +{ + "subject": "Has recibido una nueva notificación", + "title": "Nueva notificación", + "hello": "Hola", + "bodyDescription": "test", + "actionButton": "Visita nuestra Web", + "infoButton": "Ayúdanos a mejorar", + "fiscalAddress": "VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla _ www.verdnatura.es _ clientes@verdnatura.es", + "privacy": "- AVISO - Este mensaje es privado y confidencial, y debe ser utilizado exclusivamente por la persona destinataria del mismo. Si usted ha recibido este mensaje por error, le rogamos lo comunique al remitente y borre dicho mensaje y cualquier documento adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.", + "privacyLaw": "En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación." +} \ No newline at end of file diff --git a/services/mailer/application/template/notice/notice.css b/services/mailer/application/template/notice/notice.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/services/mailer/application/template/notice/notice.html b/services/mailer/application/template/notice/notice.html new file mode 100644 index 0000000000..f9990d2d2f --- /dev/null +++ b/services/mailer/application/template/notice/notice.html @@ -0,0 +1,74 @@ + + + + {{_.subject}} + + + +
    + +
    + VerdNatura +
    + + + +
    +

    {{_.title}}

    +
    + + + +
    +

    Hola, {{username}}

    +

    {{_.bodyDescription}}

    +
    + + + + + + + + + + + +
    +

    {{_.fiscalAddress}}

    +

    {{_.privacy}}

    +

    {{_.privacyLaw}}

    +
    + +
    + + \ No newline at end of file diff --git a/services/mailer/application/template/notice/notice.js b/services/mailer/application/template/notice/notice.js new file mode 100644 index 0000000000..c81d05e7aa --- /dev/null +++ b/services/mailer/application/template/notice/notice.js @@ -0,0 +1,14 @@ +var path = require('path'); +var database = require(path.join(__dirname, '../../database.js')); + +module.exports = class Notice { + getData(params, cb) { + let query = `SELECT c. Cliente FROM Clientes AS c WHERE Id_Cliente = ?`; + database.pool.query(query, [params.userId], (error, result) => { + Object.assign(this, result[0]); + cb(); + }); + } +}; + + diff --git a/services/mailer/application/template/payment-update/payment-update.css b/services/mailer/application/template/payment-update/payment-update.css index e69de29bb2..83fe2dd6da 100644 --- a/services/mailer/application/template/payment-update/payment-update.css +++ b/services/mailer/application/template/payment-update/payment-update.css @@ -0,0 +1,92 @@ +img { + margin: 0 +} + +.wrapper { + background-color: #EEE +} + +.container { + font-family: arial, sans-serif; + max-width: 600px; + min-width: 320px; + font-size: 16px; + margin: 0 auto; + color: #555 +} + +.banner img { + width: 100% +} + +.title { + background-color: #95d831; + text-align: center; + padding: 35px 0 +} + +.title h1 { + font-size: 32px; + color: #333; + margin: 0 +} + +.body { + background-color:#FFF; + padding: 20px +} + +.buttons { + background-color: #FFF; + text-align: center; + width: 100% +} + +.buttons a { + text-decoration: none; + font-size: 18px; + color: #fff +} + +.buttons .btn { + background-color: #333; + min-width: 300px; + height: 72px; + display: inline-block; + text-align: center +} + +.buttons .btn .text { + display: inline-block; + padding-top: 22px +} + +.buttons .btn .icon { + background-color: #95d831; + text-align: center; + padding-top: 22px; + float: right; + height: 50px; + width: 70px +} + +.footer { + background-color: #555; + text-align: center; + padding: 20px 0 +} + +.footer a { + text-decoration: none; + margin-right: 5px +} + +.footer a img { + margin: 0 +} + +.privacy { + padding: 20px 0; + font-size: 10px; + font-weight: 100 +} \ No newline at end of file diff --git a/services/mailer/application/template/payment-update/payment-update.html b/services/mailer/application/template/payment-update/payment-update.html index 99d3a5e8b6..c1586225e4 100644 --- a/services/mailer/application/template/payment-update/payment-update.html +++ b/services/mailer/application/template/payment-update/payment-update.html @@ -5,76 +5,76 @@ -
    - -
    - VerdNatura -
    - +
    +
    + + + - -
    -

    {{_.title}}

    -
    - + +
    +

    {{_.title}}

    +
    + - -
    -

    {{_.dear}},

    -

    {{_.bodyDescription}}

    -

    -

    {{_.paymentMethod}}: {{payMethod}}
    - {{{paymentDay}}} -

    -

    {{paymentAdvice}}

    -

    {{_.notifyError}}

    -
    - + +
    +

    {{_.dear}},

    +

    {{_.bodyDescription}}

    +

    +

    {{_.paymentMethod}}: {{payMethod}}
    + {{{paymentDay}}} +

    +

    {{paymentAdvice}}

    +

    {{_.notifyError}}

    +
    + + + + + - - - + + + - -
    - - Visita nuestro Facebook - - - Visita nuestro Twitter - - - Visita nuestro canal de Youtube - - - Visita nuestro Pinterest - - - Visita nuestro Instagram - - - Visita nuestro Linkedin - + +
    +

    {{_.fiscalAddress}}

    +

    {{_.privacy}}

    +

    {{_.privacyLaw}}

    +
    + +
    - - - -
    -

    {{_.fiscalAddress}}

    -

    {{_.privacy}}

    -

    {{_.privacyLaw}}

    -
    - -
    \ No newline at end of file diff --git a/services/mailer/package.json b/services/mailer/package.json index 2cdcf26f10..6061d7b7c7 100644 --- a/services/mailer/package.json +++ b/services/mailer/package.json @@ -6,6 +6,7 @@ "dependencies": { "body-parser": "^1.17.2", "express": "^4.15.3", + "inline-css": "^2.2.2", "mustache": "^2.3.0", "mysql": "^2.13.0", "nodemailer": "^4.0.1", diff --git a/services/mailer/server.js b/services/mailer/server.js index ee15c67f1a..cb4d1a435e 100644 --- a/services/mailer/server.js +++ b/services/mailer/server.js @@ -22,14 +22,17 @@ app.use(function(err, req, res, next) { // Iniciar escucha del servidor app.start = function() { - return app.listen(settings.app().port, function() { + var listener = app.listen(settings.app().port, function() { + var servicePath = 'http://' + listener.address().address + ':' + listener.address().port; mail.init(); database.init(); - console.log('Mailer started at port:' + settings.app().port); + console.log('Web service ' + settings.app().name.toUpperCase() + ' listening at: ' + servicePath); + console.log('Browse your REST API at: ' + servicePath + '/mailer'); if (settings.app().debug) { - console.log('Debug mode enabled'); + console.log(settings.app().name.toUpperCase() + ' service debug mode enabled'); } }); + return listener; }; if (require.main === module) { From c24c12673430809fe62f5d437e31e978518b5455 Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 13 Jun 2017 08:44:40 +0200 Subject: [PATCH 149/391] fake son de tickets my model tiene el meted raw sql --- services/client/common/models/my-model.js | 10 +- .../common/methods/ticket/list-fake.json | 1012 +++++++++++++++++ .../production/common/methods/ticket/list.js | 44 + services/production/common/models/Ticket.json | 10 +- services/production/common/models/my-model.js | 10 +- services/production/common/models/state.json | 30 + .../common/models/ticket-state.json | 47 + services/production/common/models/ticket.js | 9 + services/production/server/model-config.json | 35 +- services/service/models/my-model.js | 10 +- 10 files changed, 1205 insertions(+), 12 deletions(-) create mode 100644 services/production/common/methods/ticket/list-fake.json create mode 100644 services/production/common/methods/ticket/list.js create mode 100644 services/production/common/models/state.json create mode 100644 services/production/common/models/ticket-state.json create mode 100644 services/production/common/models/ticket.js diff --git a/services/client/common/models/my-model.js b/services/client/common/models/my-model.js index 009b025f36..4d98e7f62b 100644 --- a/services/client/common/models/my-model.js +++ b/services/client/common/models/my-model.js @@ -1,5 +1,6 @@ module.exports = function(self) { + self.setup = function() { self.super_.setup.call(this); @@ -25,7 +26,14 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } - } + + }; + + self.rawSql = function(query, params, cb) { + this.dataSource.connector.execute(query, params, function(error, response) { + cb(error, response); + }); + }; self.installMethod = function(methodName, filterCb) { this.remoteMethod(methodName, { diff --git a/services/production/common/methods/ticket/list-fake.json b/services/production/common/methods/ticket/list-fake.json new file mode 100644 index 0000000000..34c5e714e3 --- /dev/null +++ b/services/production/common/methods/ticket/list-fake.json @@ -0,0 +1,1012 @@ +[ + { + "Ticket": 1532629, + "Agency": "REC_MADRID", + "Worker": "LOLI LOZANO RAEZ", + "Hout": 20, + "State": "OK", + "Lines": 2, + "m3": 0.03, + "Boxes": 0 + }, + { + "Ticket": 1532645, + "Agency": "CORREOSEXPRESS", + "Worker": "COMPUTER SYSTEM", + "Hout": 17, + "State": "Libre", + "Lines": 9, + "m3": 0.21, + "Boxes": 0 + }, + { + "Ticket": 1532656, + "Agency": "ZONA 32", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 35, + "m3": 0.42, + "Boxes": 0 + }, + { + "Ticket": 1532690, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "OK", + "Lines": 4, + "m3": 0.21, + "Boxes": 0 + }, + { + "Ticket": 1532729, + "Agency": "ZONA 25", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 17, + "m3": 0.45, + "Boxes": 0 + }, + { + "Ticket": 1532742, + "Agency": "CORREOSEXPRESS", + "Worker": "DEMBA SAKHO", + "Hout": 17, + "State": "Encajado", + "Lines": 13, + "m3": 0.27, + "Boxes": 0 + }, + { + "Ticket": 1532792, + "Agency": "ZONA 25", + "Worker": "JUAN BAUTISTA PASTOR REDONDO", + "Hout": 20, + "State": "OK", + "Lines": 10, + "m3": 0.26, + "Boxes": 0 + }, + { + "Ticket": 1532803, + "Agency": "ZONA 31", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 12, + "m3": 0.49, + "Boxes": 0 + }, + { + "Ticket": 1532812, + "Agency": "ZELERIS", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 17, + "State": "Arreglar", + "Lines": 19, + "m3": 0.67, + "Boxes": 0 + }, + { + "Ticket": 1532879, + "Agency": "ZONA 20", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 20, + "State": "OK", + "Lines": 1, + "m3": 0.41, + "Boxes": 0 + }, + { + "Ticket": 1532880, + "Agency": "ZONA 20", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 8, + "m3": 0.08, + "Boxes": 0 + }, + { + "Ticket": 1532923, + "Agency": "ZONA 20", + "Worker": "JESUS DANIEL VALLES PEREZ", + "Hout": 20, + "State": "OK", + "Lines": 30, + "m3": 0.63, + "Boxes": 1 + }, + { + "Ticket": 1532995, + "Agency": "ZONA 20", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 20, + "State": "Arreglar", + "Lines": 54, + "m3": 1.62, + "Boxes": 0 + }, + { + "Ticket": 1533009, + "Agency": "ZONA 25", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 20, + "State": "Sin Acabar", + "Lines": 38, + "m3": 0.78, + "Boxes": 0 + }, + { + "Ticket": 1533051, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "Sin Acabar", + "Lines": 19, + "m3": 0.91, + "Boxes": 2 + }, + { + "Ticket": 1533064, + "Agency": "MRW 24h", + "Worker": "JOSE JAVIER ECHEVARRIA", + "Hout": 17, + "State": "OK", + "Lines": 11, + "m3": 0.22, + "Boxes": 0 + }, + { + "Ticket": 1533102, + "Agency": "MRW 24h", + "Worker": "LOLI LOZANO RAEZ", + "Hout": 17, + "State": "OK", + "Lines": 9, + "m3": 0.35, + "Boxes": 0 + }, + { + "Ticket": 1533151, + "Agency": "ZONA 32", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 7, + "m3": 0.05, + "Boxes": 0 + }, + { + "Ticket": 1533182, + "Agency": "ZONA 25", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 20, + "State": "OK", + "Lines": 20, + "m3": 0.26, + "Boxes": 0 + }, + { + "Ticket": 1533257, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "OK", + "Lines": 14, + "m3": 0.07, + "Boxes": 0 + }, + { + "Ticket": 1533279, + "Agency": "ZONA 46", + "Worker": "RICARD SENDRA", + "Hout": 15, + "State": "Impreso", + "Lines": 50, + "m3": 1.05, + "Boxes": 2 + }, + { + "Ticket": 1533284, + "Agency": "ZONA 20", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 20, + "State": "OK", + "Lines": 18, + "m3": 0.21, + "Boxes": 0 + }, + { + "Ticket": 1533314, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "OK", + "Lines": 3, + "m3": 0.05, + "Boxes": 0 + }, + { + "Ticket": 1533316, + "Agency": "ZONA 25", + "Worker": "LOLI LOZANO RAEZ", + "Hout": 20, + "State": "OK", + "Lines": 17, + "m3": 0.49, + "Boxes": 0 + }, + { + "Ticket": 1533319, + "Agency": "ZONA 25", + "Worker": "ELENA BASCUÑANA TORNERO", + "Hout": 20, + "State": "OK", + "Lines": 2, + "m3": 0.04, + "Boxes": 0 + }, + { + "Ticket": 1533327, + "Agency": "ZONA 25", + "Worker": "FRAN NATEK ECHEVARRIA", + "Hout": 20, + "State": "OK", + "Lines": 13, + "m3": 0.32, + "Boxes": 0 + }, + { + "Ticket": 1533339, + "Agency": "ZONA 20", + "Worker": "ELENA BASCUÑANA TORNERO", + "Hout": 20, + "State": "OK", + "Lines": 9, + "m3": 0.17, + "Boxes": 0 + }, + { + "Ticket": 1533340, + "Agency": "ZONA 25", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 20, + "State": "Arreglar", + "Lines": 48, + "m3": 1.59, + "Boxes": 4.5 + }, + { + "Ticket": 1533345, + "Agency": "ZONA 31", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 56, + "m3": 0.79, + "Boxes": 0 + }, + { + "Ticket": 1533349, + "Agency": "ZONA 20", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 12, + "m3": 0.34, + "Boxes": 0 + }, + { + "Ticket": 1533353, + "Agency": "ZONA 11", + "Worker": "COMPUTER SYSTEM", + "Hout": 21, + "State": "Libre", + "Lines": 10, + "m3": 0.08, + "Boxes": 0 + }, + { + "Ticket": 1533359, + "Agency": "ZONA 20", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 20, + "State": "OK", + "Lines": 9, + "m3": 0.52, + "Boxes": 0 + }, + { + "Ticket": 1533369, + "Agency": "INTEGRA2", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 17, + "State": "OK", + "Lines": 7, + "m3": 0.1, + "Boxes": 0 + }, + { + "Ticket": 1533392, + "Agency": "ZONA 25", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 16, + "m3": 0.35, + "Boxes": 0 + }, + { + "Ticket": 1533403, + "Agency": "ZONA 31", + "Worker": "Mª CARMEN SERRANO BAU", + "Hout": 19, + "State": "OK", + "Lines": 1, + "m3": 2.04, + "Boxes": 0 + }, + { + "Ticket": 1533412, + "Agency": "ZELERIS", + "Worker": "CARLOS BORRAS MARTINEZ", + "Hout": 17, + "State": "OK", + "Lines": 5, + "m3": 0.04, + "Boxes": 0 + }, + { + "Ticket": 1533425, + "Agency": "INTEGRA2", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 17, + "State": "OK", + "Lines": 11, + "m3": 0.14, + "Boxes": 0 + }, + { + "Ticket": 1533429, + "Agency": "ZONA 25", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 20, + "State": "OK", + "Lines": 43, + "m3": 0.6, + "Boxes": 0 + }, + { + "Ticket": 1533438, + "Agency": "ZELERIS", + "Worker": "MIGUEL ANGEL LORITE", + "Hout": 17, + "State": "Preparación", + "Lines": 10, + "m3": 0.17, + "Boxes": 0 + }, + { + "Ticket": 1533482, + "Agency": "ZONA 25", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 20, + "State": "Sin Acabar", + "Lines": 30, + "m3": 0.42, + "Boxes": 0 + }, + { + "Ticket": 1533486, + "Agency": "DHL", + "Worker": "JOSE JAVIER ECHEVARRIA", + "Hout": 17, + "State": "OK", + "Lines": 28, + "m3": 0.25, + "Boxes": 0 + }, + { + "Ticket": 1533495, + "Agency": "REC_VILASSAR", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 16, + "m3": 0.08, + "Boxes": 0 + }, + { + "Ticket": 1533507, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "OK", + "Lines": 16, + "m3": 0.39, + "Boxes": 0 + }, + { + "Ticket": 1533557, + "Agency": "ZONA 11", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 21, + "State": "OK", + "Lines": 50, + "m3": 1.16, + "Boxes": 0 + }, + { + "Ticket": 1533566, + "Agency": "ZONA 10", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 23, + "State": "Sin Acabar", + "Lines": 14, + "m3": 0.18, + "Boxes": 0 + }, + { + "Ticket": 1533570, + "Agency": "MRW 24h", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 17, + "State": "OK", + "Lines": 13, + "m3": 0.17, + "Boxes": 0 + }, + { + "Ticket": 1533580, + "Agency": "ZELERIS_10", + "Worker": "DEMBA SAKHO", + "Hout": 17, + "State": "Encajado", + "Lines": 4, + "m3": 0.13, + "Boxes": 0 + }, + { + "Ticket": 1533584, + "Agency": "ZONA 20", + "Worker": "JESUS DANIEL VALLES PEREZ", + "Hout": 20, + "State": "OK", + "Lines": 20, + "m3": 0.67, + "Boxes": 0 + }, + { + "Ticket": 1533585, + "Agency": "ZELERIS_10", + "Worker": "FRAN NATEK ECHEVARRIA", + "Hout": 17, + "State": "Sin Acabar", + "Lines": 1, + "m3": 0.01, + "Boxes": 0 + }, + { + "Ticket": 1533591, + "Agency": "ZONA 46", + "Worker": "JUANLU GALLETERO", + "Hout": 15, + "State": "Revisado", + "Lines": 16, + "m3": 0.3, + "Boxes": 0 + }, + { + "Ticket": 1533641, + "Agency": "ZONA 25", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 28, + "m3": 0.75, + "Boxes": 0 + }, + { + "Ticket": 1533685, + "Agency": "ZONA 20", + "Worker": "Mª CARMEN SERRANO BAU", + "Hout": 20, + "State": "OK", + "Lines": 39, + "m3": 0.78, + "Boxes": 1 + }, + { + "Ticket": 1533688, + "Agency": "ZONA 20", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 7, + "m3": 0.19, + "Boxes": 0 + }, + { + "Ticket": 1533795, + "Agency": "ZONA 25", + "Worker": "MANOLI PULIDO", + "Hout": 20, + "State": "OK", + "Lines": 16, + "m3": 0.3, + "Boxes": 0 + }, + { + "Ticket": 1533797, + "Agency": "ZONA 25", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 20, + "m3": 0.33, + "Boxes": 0 + }, + { + "Ticket": 1533807, + "Agency": "ZONA 25", + "Worker": "ESDENKA CALERO PEREZ", + "Hout": 20, + "State": "Arreglar", + "Lines": 16, + "m3": 0.14, + "Boxes": 0 + }, + { + "Ticket": 1533815, + "Agency": "ZELERIS_10", + "Worker": "RODRIGO HALABI ROCHA", + "Hout": 17, + "State": "OK", + "Lines": 15, + "m3": 0.2, + "Boxes": 0 + }, + { + "Ticket": 1533849, + "Agency": "MRW 24h", + "Worker": "JUAN CARLOS LORENZO SANCHEZ", + "Hout": 17, + "State": "OK", + "Lines": 18, + "m3": 0.25, + "Boxes": 0 + }, + { + "Ticket": 1533852, + "Agency": "MRW 24h", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 17, + "State": "OK", + "Lines": 17, + "m3": 0.68, + "Boxes": 0 + }, + { + "Ticket": 1533854, + "Agency": "ZONA 20", + "Worker": "MANOLI PULIDO", + "Hout": 20, + "State": "OK", + "Lines": 11, + "m3": 0.13, + "Boxes": 0 + }, + { + "Ticket": 1533863, + "Agency": "ZELERIS_10", + "Worker": "DEMBA SAKHO", + "Hout": 17, + "State": "Encajado", + "Lines": 6, + "m3": 0.16, + "Boxes": 0 + }, + { + "Ticket": 1533882, + "Agency": "ZONA 20", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 20, + "State": "OK", + "Lines": 9, + "m3": 0.44, + "Boxes": 0 + }, + { + "Ticket": 1533889, + "Agency": "MRW 24h", + "Worker": "ELENA BASCUÑANA TORNERO", + "Hout": 17, + "State": "OK", + "Lines": 10, + "m3": 0.5, + "Boxes": 0 + }, + { + "Ticket": 1533893, + "Agency": "ZONA 32", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 2, + "m3": 0.13, + "Boxes": 0 + }, + { + "Ticket": 1533915, + "Agency": "CORREOSEXPRESS", + "Worker": "JUAN BAUTISTA PASTOR REDONDO", + "Hout": 17, + "State": "OK", + "Lines": 9, + "m3": 0.36, + "Boxes": 0 + }, + { + "Ticket": 1533919, + "Agency": "ZONA 20", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 20, + "State": "Arreglar", + "Lines": 16, + "m3": 0.23, + "Boxes": 0 + }, + { + "Ticket": 1533983, + "Agency": "ZONA 11", + "Worker": "MANOLI PULIDO", + "Hout": 21, + "State": "OK", + "Lines": 30, + "m3": 1.92, + "Boxes": 0 + }, + { + "Ticket": 1533992, + "Agency": "ZONA 25", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 32, + "m3": 0.23, + "Boxes": 0 + }, + { + "Ticket": 1534032, + "Agency": "MRW 24h", + "Worker": "JESUS DANIEL VALLES PEREZ", + "Hout": 17, + "State": "Sin Acabar", + "Lines": 4, + "m3": 0.04, + "Boxes": 0 + }, + { + "Ticket": 1534033, + "Agency": "ZONA 31", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 14, + "m3": 0.65, + "Boxes": 0 + }, + { + "Ticket": 1534055, + "Agency": "ZONA 32", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 42, + "m3": 1.09, + "Boxes": 0 + }, + { + "Ticket": 1534076, + "Agency": "REC_VILASSAR", + "Worker": "CRISTINA SANCHEZ BARRUGUER", + "Hout": 19, + "State": "OK", + "Lines": 4, + "m3": 0.03, + "Boxes": 0 + }, + { + "Ticket": 1534101, + "Agency": "CORREOSEXPRESS", + "Worker": "JESUS DANIEL VALLES PEREZ", + "Hout": 17, + "State": "Sin Acabar", + "Lines": 1, + "m3": 0.02, + "Boxes": 0 + }, + { + "Ticket": 1534186, + "Agency": "ZONA 32", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 16, + "m3": 0.4, + "Boxes": 0 + }, + { + "Ticket": 1534187, + "Agency": "ZONA 46", + "Worker": "MIGUEL ANGEL LORITE", + "Hout": 15, + "State": "Preparado", + "Lines": 3, + "m3": 0.17, + "Boxes": 0 + }, + { + "Ticket": 1534212, + "Agency": "ZELERIS_10", + "Worker": "RODRIGO HALABI ROCHA", + "Hout": 17, + "State": "Bloqueado", + "Lines": 2, + "m3": 0.07, + "Boxes": 0 + }, + { + "Ticket": 1534223, + "Agency": "ZONA 10", + "Worker": "JESUS DANIEL VALLES PEREZ", + "Hout": 23, + "State": "Sin Acabar", + "Lines": 4, + "m3": 0.05, + "Boxes": 0 + }, + { + "Ticket": 1534236, + "Agency": "REC_MADRID", + "Worker": "COMPUTER SYSTEM", + "Hout": 20, + "State": "Libre", + "Lines": 5, + "m3": 0.04, + "Boxes": 0 + }, + { + "Ticket": 1534240, + "Agency": "ZONA 46", + "Worker": "MARIA JOSE LAMELA FELIPE", + "Hout": 15, + "State": "OK", + "Lines": 47, + "m3": 0.91, + "Boxes": 1 + }, + { + "Ticket": 1534252, + "Agency": "VIAEXPRESS Interdia", + "Worker": "DEMBA SAKHO", + "Hout": 12, + "State": "Encajado", + "Lines": 2, + "m3": 0.02, + "Boxes": 0 + }, + { + "Ticket": 1534258, + "Agency": "ZONA 20", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 20, + "State": "OK", + "Lines": 5, + "m3": 0.18, + "Boxes": 0 + }, + { + "Ticket": 1534261, + "Agency": "REC_VILASSAR", + "Worker": "COMPUTER SYSTEM", + "Hout": 19, + "State": "Libre", + "Lines": 5, + "m3": 0.18, + "Boxes": 0 + }, + { + "Ticket": 1534264, + "Agency": "ZONA 20", + "Worker": "JOSE VICENTE DOMINGO SANCHEZ", + "Hout": 20, + "State": "Sin Acabar", + "Lines": 2, + "m3": 0.37, + "Boxes": 2 + }, + { + "Ticket": 1534300, + "Agency": "ZONA 20", + "Worker": "RODRIGO HALABI ROCHA", + "Hout": 20, + "State": "Sin Acabar", + "Lines": 1, + "m3": 0.02, + "Boxes": 0 + }, + { + "Ticket": 1534302, + "Agency": "ZONA 25", + "Worker": "LOLI LOZANO RAEZ", + "Hout": 20, + "State": "OK", + "Lines": 19, + "m3": 1.11, + "Boxes": 0 + }, + { + "Ticket": 1534311, + "Agency": "ZONA 32", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 19, + "State": "Arreglar", + "Lines": 43, + "m3": 0.8, + "Boxes": 0 + }, + { + "Ticket": 1534315, + "Agency": "ZONA 20", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 20, + "State": "Asignado", + "Lines": 6, + "m3": 0.34, + "Boxes": 0 + }, + { + "Ticket": 1534327, + "Agency": "ZONA 43", + "Worker": "COMPUTER SYSTEM", + "Hout": 14, + "State": "Libre", + "Lines": 23, + "m3": 0.41, + "Boxes": 0 + }, + { + "Ticket": 1534354, + "Agency": "ZONA 46", + "Worker": "MARIA DEL MAR GIRBES FERRUS", + "Hout": 15, + "State": "Asignado", + "Lines": 23, + "m3": 1.67, + "Boxes": 0 + }, + { + "Ticket": 1534359, + "Agency": "ZELERIS", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 17, + "State": "Arreglar", + "Lines": 3, + "m3": 0.06, + "Boxes": 0 + }, + { + "Ticket": 1534366, + "Agency": "REC_SILLA", + "Worker": "COMPUTER SYSTEM", + "Hout": 23, + "State": "Libre", + "Lines": 23, + "m3": 0.4, + "Boxes": 0 + }, + { + "Ticket": 1534385, + "Agency": "ZELERIS", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 17, + "State": "OK", + "Lines": 4, + "m3": 0.12, + "Boxes": 0 + }, + { + "Ticket": 1534397, + "Agency": "ZONA 20", + "Worker": "JUAN CARLOS LORENZO SANCHEZ", + "Hout": 20, + "State": "OK", + "Lines": 14, + "m3": 0.21, + "Boxes": 0 + }, + { + "Ticket": 1534428, + "Agency": "ZELERIS", + "Worker": "FRAN NATEK ECHEVARRIA", + "Hout": 17, + "State": "OK", + "Lines": 9, + "m3": 0.3, + "Boxes": 0 + }, + { + "Ticket": 1534467, + "Agency": "MRW 24h", + "Worker": "COMPUTER SYSTEM", + "Hout": 17, + "State": "Libre", + "Lines": 15, + "m3": 0.12, + "Boxes": 0 + }, + { + "Ticket": 1534477, + "Agency": "ZONA 11", + "Worker": "CRISTINA SANCHEZ BARRUGUER", + "Hout": 21, + "State": "OK", + "Lines": 8, + "m3": 0.09, + "Boxes": 0 + }, + { + "Ticket": 1534490, + "Agency": "ZONA 43", + "Worker": "JULIA LLOPIS CASTELL", + "Hout": 14, + "State": "Arreglar", + "Lines": 38, + "m3": 1.15, + "Boxes": 0 + }, + { + "Ticket": 1534500, + "Agency": "ZONA 20", + "Worker": "CARLOS LOPEZ AMORES", + "Hout": 20, + "State": "OK", + "Lines": 10, + "m3": 0.35, + "Boxes": 0 + }, + { + "Ticket": 1534504, + "Agency": "ZONA 20", + "Worker": "LOLI LOZANO RAEZ", + "Hout": 20, + "State": "OK", + "Lines": 18, + "m3": 0.18, + "Boxes": 0 + }, + { + "Ticket": 1534505, + "Agency": "ZONA 20", + "Worker": "JUAN BAUTISTA PASTOR REDONDO", + "Hout": 20, + "State": "OK", + "Lines": 5, + "m3": 0.23, + "Boxes": 0 + }, + { + "Ticket": 1534533, + "Agency": "ZONA 45", + "Worker": "DANIEL YAREHAM PALOMO", + "Hout": 24, + "State": "OK", + "Lines": 2, + "m3": 0.25, + "Boxes": 2 + } +] \ No newline at end of file diff --git a/services/production/common/methods/ticket/list.js b/services/production/common/methods/ticket/list.js new file mode 100644 index 0000000000..79dad23b95 --- /dev/null +++ b/services/production/common/methods/ticket/list.js @@ -0,0 +1,44 @@ +var json = require("./list-fake.json"); + +module.exports = function(Ticket) { + Ticket.remoteMethod('list', { + description: 'List tickets for production', + /*accepts: { + arg: 'id', + type: 'number', + required: true, + description: 'Model id', + http: {source: 'path'} + },*/ + returns: { + arg: 'tickets', + type: 'object' + }, + http: { + verb: 'get', + path: '/list' + } + }); + + Ticket.list = function(cb) { + //list(); + return fake(cb); + }; + + var fake = function(cb){ + cb(null, json); + } + + var list = function(){ + var params = [1, 0]; + + var query = "CALL production_control_source(?, ?)" + + var cb = function(error, res){ + if(error) console.log(error); + else console.log(res); + }; + + Ticket.rawSql(query, params, cb); + } +} \ No newline at end of file diff --git a/services/production/common/models/Ticket.json b/services/production/common/models/Ticket.json index 16d5e07a59..4ae89da102 100644 --- a/services/production/common/models/Ticket.json +++ b/services/production/common/models/Ticket.json @@ -1,8 +1,14 @@ { "name": "Ticket", - "base": "PersistedModel", + "base": "MyModel", "validateUpsert": true, - "properties": {}, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + } + }, "acls": [ { "accessType": "*", diff --git a/services/production/common/models/my-model.js b/services/production/common/models/my-model.js index 009b025f36..4d98e7f62b 100644 --- a/services/production/common/models/my-model.js +++ b/services/production/common/models/my-model.js @@ -1,5 +1,6 @@ module.exports = function(self) { + self.setup = function() { self.super_.setup.call(this); @@ -25,7 +26,14 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } - } + + }; + + self.rawSql = function(query, params, cb) { + this.dataSource.connector.execute(query, params, function(error, response) { + cb(error, response); + }); + }; self.installMethod = function(methodName, filterCb) { this.remoteMethod(methodName, { diff --git a/services/production/common/models/state.json b/services/production/common/models/state.json new file mode 100644 index 0000000000..97e2eecf33 --- /dev/null +++ b/services/production/common/models/state.json @@ -0,0 +1,30 @@ +{ + "name": "State", + "base": "MyModel", + "validateUpsert": true, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "name": { + "type": "String", + "required": false + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/production/common/models/ticket-state.json b/services/production/common/models/ticket-state.json new file mode 100644 index 0000000000..5f919ff2ac --- /dev/null +++ b/services/production/common/models/ticket-state.json @@ -0,0 +1,47 @@ +{ + "name": "TicketState", + "base": "MyModel", + "validateUpsert": true, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "updated": { + "type": "Date", + "required": false + } + }, + "relations": { + "ticket": { + "type": "belongsTo", + "model": "Ticket", + "foreignKey": "ticketFk" + }, + "state": { + "type": "belongsTo", + "model": "State", + "foreignKey": "stateFk" + }, + "employee": { + "type": "belongsTo", + "model": "Employee", + "foreignKey": "employeeFk" + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/production/common/models/ticket.js b/services/production/common/models/ticket.js new file mode 100644 index 0000000000..ab62f63090 --- /dev/null +++ b/services/production/common/models/ticket.js @@ -0,0 +1,9 @@ +var app = require('../../server/server'); + +module.exports = function(Ticket) { + var models = app.models; + + // Methods + + require('../methods/ticket/list.js')(Ticket); +}; \ No newline at end of file diff --git a/services/production/server/model-config.json b/services/production/server/model-config.json index 8a1204120d..7f29155b0a 100644 --- a/services/production/server/model-config.json +++ b/services/production/server/model-config.json @@ -13,23 +13,44 @@ "./mixins" ] }, - "User": { - "dataSource": "db" + "user": { + "dataSource": "auth" }, "AccessToken": { - "dataSource": "db", - "public": false + "dataSource": "auth", + "relations": { + "user": { + "type": "belongsTo", + "model": "user", + "foreignKey": "userId" + } + } }, "ACL": { - "dataSource": "db", + "dataSource": "auth", "public": false }, "RoleMapping": { - "dataSource": "db", + "dataSource": "auth", "public": false }, "Role": { - "dataSource": "db", + "dataSource": "auth", "public": false + }, + "Account": { + "dataSource": "auth" + }, + "Ticket": { + "dataSource": "vn", + "public": true + }, + "State":{ + "dataSource": "vn", + "public": true + }, + "TicketState":{ + "dataSource": "vn", + "public": true } } diff --git a/services/service/models/my-model.js b/services/service/models/my-model.js index 009b025f36..4d98e7f62b 100644 --- a/services/service/models/my-model.js +++ b/services/service/models/my-model.js @@ -1,5 +1,6 @@ module.exports = function(self) { + self.setup = function() { self.super_.setup.call(this); @@ -25,7 +26,14 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } - } + + }; + + self.rawSql = function(query, params, cb) { + this.dataSource.connector.execute(query, params, function(error, response) { + cb(error, response); + }); + }; self.installMethod = function(methodName, filterCb) { this.remoteMethod(methodName, { From ecf347e7e22ac9321ae09a67d9a9135d69033ea8 Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 13 Jun 2017 09:07:14 +0200 Subject: [PATCH 150/391] modificaciones fake --- .../common/methods/ticket/list-fake.json | 404 +++++++++--------- 1 file changed, 202 insertions(+), 202 deletions(-) diff --git a/services/production/common/methods/ticket/list-fake.json b/services/production/common/methods/ticket/list-fake.json index 34c5e714e3..f8fcce9f8b 100644 --- a/services/production/common/methods/ticket/list-fake.json +++ b/services/production/common/methods/ticket/list-fake.json @@ -3,1010 +3,1010 @@ "Ticket": 1532629, "Agency": "REC_MADRID", "Worker": "LOLI LOZANO RAEZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 2, - "m3": 0.03, + "M3": 0.03, "Boxes": 0 }, { "Ticket": 1532645, "Agency": "CORREOSEXPRESS", "Worker": "COMPUTER SYSTEM", - "Hout": 17, + "Hour": 17, "State": "Libre", "Lines": 9, - "m3": 0.21, + "M3": 0.21, "Boxes": 0 }, { "Ticket": 1532656, "Agency": "ZONA 32", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 35, - "m3": 0.42, + "M3": 0.42, "Boxes": 0 }, { "Ticket": 1532690, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 4, - "m3": 0.21, + "M3": 0.21, "Boxes": 0 }, { "Ticket": 1532729, "Agency": "ZONA 25", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 17, - "m3": 0.45, + "M3": 0.45, "Boxes": 0 }, { "Ticket": 1532742, "Agency": "CORREOSEXPRESS", "Worker": "DEMBA SAKHO", - "Hout": 17, + "Hour": 17, "State": "Encajado", "Lines": 13, - "m3": 0.27, + "M3": 0.27, "Boxes": 0 }, { "Ticket": 1532792, "Agency": "ZONA 25", "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 10, - "m3": 0.26, + "M3": 0.26, "Boxes": 0 }, { "Ticket": 1532803, "Agency": "ZONA 31", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 12, - "m3": 0.49, + "M3": 0.49, "Boxes": 0 }, { "Ticket": 1532812, "Agency": "ZELERIS", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 17, + "Hour": 17, "State": "Arreglar", "Lines": 19, - "m3": 0.67, + "M3": 0.67, "Boxes": 0 }, { "Ticket": 1532879, "Agency": "ZONA 20", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 1, - "m3": 0.41, + "M3": 0.41, "Boxes": 0 }, { "Ticket": 1532880, "Agency": "ZONA 20", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 8, - "m3": 0.08, + "M3": 0.08, "Boxes": 0 }, { "Ticket": 1532923, "Agency": "ZONA 20", "Worker": "JESUS DANIEL VALLES PEREZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 30, - "m3": 0.63, + "M3": 0.63, "Boxes": 1 }, { "Ticket": 1532995, "Agency": "ZONA 20", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 20, + "Hour": 20, "State": "Arreglar", "Lines": 54, - "m3": 1.62, + "M3": 1.62, "Boxes": 0 }, { "Ticket": 1533009, "Agency": "ZONA 25", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 20, + "Hour": 20, "State": "Sin Acabar", "Lines": 38, - "m3": 0.78, + "M3": 0.78, "Boxes": 0 }, { "Ticket": 1533051, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "Sin Acabar", "Lines": 19, - "m3": 0.91, + "M3": 0.91, "Boxes": 2 }, { "Ticket": 1533064, "Agency": "MRW 24h", "Worker": "JOSE JAVIER ECHEVARRIA", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 11, - "m3": 0.22, + "M3": 0.22, "Boxes": 0 }, { "Ticket": 1533102, "Agency": "MRW 24h", "Worker": "LOLI LOZANO RAEZ", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 9, - "m3": 0.35, + "M3": 0.35, "Boxes": 0 }, { "Ticket": 1533151, "Agency": "ZONA 32", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 7, - "m3": 0.05, + "M3": 0.05, "Boxes": 0 }, { "Ticket": 1533182, "Agency": "ZONA 25", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 20, - "m3": 0.26, + "M3": 0.26, "Boxes": 0 }, { "Ticket": 1533257, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 14, - "m3": 0.07, + "M3": 0.07, "Boxes": 0 }, { "Ticket": 1533279, "Agency": "ZONA 46", "Worker": "RICARD SENDRA", - "Hout": 15, + "Hour": 15, "State": "Impreso", "Lines": 50, - "m3": 1.05, + "M3": 1.05, "Boxes": 2 }, { "Ticket": 1533284, "Agency": "ZONA 20", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 18, - "m3": 0.21, + "M3": 0.21, "Boxes": 0 }, { "Ticket": 1533314, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 3, - "m3": 0.05, + "M3": 0.05, "Boxes": 0 }, { "Ticket": 1533316, "Agency": "ZONA 25", "Worker": "LOLI LOZANO RAEZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 17, - "m3": 0.49, + "M3": 0.49, "Boxes": 0 }, { "Ticket": 1533319, "Agency": "ZONA 25", "Worker": "ELENA BASCUÑANA TORNERO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 2, - "m3": 0.04, + "M3": 0.04, "Boxes": 0 }, { "Ticket": 1533327, "Agency": "ZONA 25", "Worker": "FRAN NATEK ECHEVARRIA", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 13, - "m3": 0.32, + "M3": 0.32, "Boxes": 0 }, { "Ticket": 1533339, "Agency": "ZONA 20", "Worker": "ELENA BASCUÑANA TORNERO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 9, - "m3": 0.17, + "M3": 0.17, "Boxes": 0 }, { "Ticket": 1533340, "Agency": "ZONA 25", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 20, + "Hour": 20, "State": "Arreglar", "Lines": 48, - "m3": 1.59, + "M3": 1.59, "Boxes": 4.5 }, { "Ticket": 1533345, "Agency": "ZONA 31", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 56, - "m3": 0.79, + "M3": 0.79, "Boxes": 0 }, { "Ticket": 1533349, "Agency": "ZONA 20", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 12, - "m3": 0.34, + "M3": 0.34, "Boxes": 0 }, { "Ticket": 1533353, "Agency": "ZONA 11", "Worker": "COMPUTER SYSTEM", - "Hout": 21, + "Hour": 21, "State": "Libre", "Lines": 10, - "m3": 0.08, + "M3": 0.08, "Boxes": 0 }, { "Ticket": 1533359, "Agency": "ZONA 20", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 9, - "m3": 0.52, + "M3": 0.52, "Boxes": 0 }, { "Ticket": 1533369, "Agency": "INTEGRA2", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 7, - "m3": 0.1, + "M3": 0.1, "Boxes": 0 }, { "Ticket": 1533392, "Agency": "ZONA 25", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 16, - "m3": 0.35, + "M3": 0.35, "Boxes": 0 }, { "Ticket": 1533403, "Agency": "ZONA 31", "Worker": "Mª CARMEN SERRANO BAU", - "Hout": 19, + "Hour": 19, "State": "OK", "Lines": 1, - "m3": 2.04, + "M3": 2.04, "Boxes": 0 }, { "Ticket": 1533412, "Agency": "ZELERIS", "Worker": "CARLOS BORRAS MARTINEZ", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 5, - "m3": 0.04, + "M3": 0.04, "Boxes": 0 }, { "Ticket": 1533425, "Agency": "INTEGRA2", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 11, - "m3": 0.14, + "M3": 0.14, "Boxes": 0 }, { "Ticket": 1533429, "Agency": "ZONA 25", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 43, - "m3": 0.6, + "M3": 0.6, "Boxes": 0 }, { "Ticket": 1533438, "Agency": "ZELERIS", "Worker": "MIGUEL ANGEL LORITE", - "Hout": 17, + "Hour": 17, "State": "Preparación", "Lines": 10, - "m3": 0.17, + "M3": 0.17, "Boxes": 0 }, { "Ticket": 1533482, "Agency": "ZONA 25", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 20, + "Hour": 20, "State": "Sin Acabar", "Lines": 30, - "m3": 0.42, + "M3": 0.42, "Boxes": 0 }, { "Ticket": 1533486, "Agency": "DHL", "Worker": "JOSE JAVIER ECHEVARRIA", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 28, - "m3": 0.25, + "M3": 0.25, "Boxes": 0 }, { "Ticket": 1533495, "Agency": "REC_VILASSAR", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 16, - "m3": 0.08, + "M3": 0.08, "Boxes": 0 }, { "Ticket": 1533507, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 16, - "m3": 0.39, + "M3": 0.39, "Boxes": 0 }, { "Ticket": 1533557, "Agency": "ZONA 11", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 21, + "Hour": 21, "State": "OK", "Lines": 50, - "m3": 1.16, + "M3": 1.16, "Boxes": 0 }, { "Ticket": 1533566, "Agency": "ZONA 10", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 23, + "Hour": 23, "State": "Sin Acabar", "Lines": 14, - "m3": 0.18, + "M3": 0.18, "Boxes": 0 }, { "Ticket": 1533570, "Agency": "MRW 24h", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 13, - "m3": 0.17, + "M3": 0.17, "Boxes": 0 }, { "Ticket": 1533580, "Agency": "ZELERIS_10", "Worker": "DEMBA SAKHO", - "Hout": 17, + "Hour": 17, "State": "Encajado", "Lines": 4, - "m3": 0.13, + "M3": 0.13, "Boxes": 0 }, { "Ticket": 1533584, "Agency": "ZONA 20", "Worker": "JESUS DANIEL VALLES PEREZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 20, - "m3": 0.67, + "M3": 0.67, "Boxes": 0 }, { "Ticket": 1533585, "Agency": "ZELERIS_10", "Worker": "FRAN NATEK ECHEVARRIA", - "Hout": 17, + "Hour": 17, "State": "Sin Acabar", "Lines": 1, - "m3": 0.01, + "M3": 0.01, "Boxes": 0 }, { "Ticket": 1533591, "Agency": "ZONA 46", "Worker": "JUANLU GALLETERO", - "Hout": 15, + "Hour": 15, "State": "Revisado", "Lines": 16, - "m3": 0.3, + "M3": 0.3, "Boxes": 0 }, { "Ticket": 1533641, "Agency": "ZONA 25", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 28, - "m3": 0.75, + "M3": 0.75, "Boxes": 0 }, { "Ticket": 1533685, "Agency": "ZONA 20", "Worker": "Mª CARMEN SERRANO BAU", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 39, - "m3": 0.78, + "M3": 0.78, "Boxes": 1 }, { "Ticket": 1533688, "Agency": "ZONA 20", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 7, - "m3": 0.19, + "M3": 0.19, "Boxes": 0 }, { "Ticket": 1533795, "Agency": "ZONA 25", "Worker": "MANOLI PULIDO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 16, - "m3": 0.3, + "M3": 0.3, "Boxes": 0 }, { "Ticket": 1533797, "Agency": "ZONA 25", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 20, - "m3": 0.33, + "M3": 0.33, "Boxes": 0 }, { "Ticket": 1533807, "Agency": "ZONA 25", "Worker": "ESDENKA CALERO PEREZ", - "Hout": 20, + "Hour": 20, "State": "Arreglar", "Lines": 16, - "m3": 0.14, + "M3": 0.14, "Boxes": 0 }, { "Ticket": 1533815, "Agency": "ZELERIS_10", "Worker": "RODRIGO HALABI ROCHA", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 15, - "m3": 0.2, + "M3": 0.2, "Boxes": 0 }, { "Ticket": 1533849, "Agency": "MRW 24h", "Worker": "JUAN CARLOS LORENZO SANCHEZ", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 18, - "m3": 0.25, + "M3": 0.25, "Boxes": 0 }, { "Ticket": 1533852, "Agency": "MRW 24h", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 17, - "m3": 0.68, + "M3": 0.68, "Boxes": 0 }, { "Ticket": 1533854, "Agency": "ZONA 20", "Worker": "MANOLI PULIDO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 11, - "m3": 0.13, + "M3": 0.13, "Boxes": 0 }, { "Ticket": 1533863, "Agency": "ZELERIS_10", "Worker": "DEMBA SAKHO", - "Hout": 17, + "Hour": 17, "State": "Encajado", "Lines": 6, - "m3": 0.16, + "M3": 0.16, "Boxes": 0 }, { "Ticket": 1533882, "Agency": "ZONA 20", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 9, - "m3": 0.44, + "M3": 0.44, "Boxes": 0 }, { "Ticket": 1533889, "Agency": "MRW 24h", "Worker": "ELENA BASCUÑANA TORNERO", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 10, - "m3": 0.5, + "M3": 0.5, "Boxes": 0 }, { "Ticket": 1533893, "Agency": "ZONA 32", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 2, - "m3": 0.13, + "M3": 0.13, "Boxes": 0 }, { "Ticket": 1533915, "Agency": "CORREOSEXPRESS", "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 9, - "m3": 0.36, + "M3": 0.36, "Boxes": 0 }, { "Ticket": 1533919, "Agency": "ZONA 20", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 20, + "Hour": 20, "State": "Arreglar", "Lines": 16, - "m3": 0.23, + "M3": 0.23, "Boxes": 0 }, { "Ticket": 1533983, "Agency": "ZONA 11", "Worker": "MANOLI PULIDO", - "Hout": 21, + "Hour": 21, "State": "OK", "Lines": 30, - "m3": 1.92, + "M3": 1.92, "Boxes": 0 }, { "Ticket": 1533992, "Agency": "ZONA 25", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 32, - "m3": 0.23, + "M3": 0.23, "Boxes": 0 }, { "Ticket": 1534032, "Agency": "MRW 24h", "Worker": "JESUS DANIEL VALLES PEREZ", - "Hout": 17, + "Hour": 17, "State": "Sin Acabar", "Lines": 4, - "m3": 0.04, + "M3": 0.04, "Boxes": 0 }, { "Ticket": 1534033, "Agency": "ZONA 31", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 14, - "m3": 0.65, + "M3": 0.65, "Boxes": 0 }, { "Ticket": 1534055, "Agency": "ZONA 32", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 42, - "m3": 1.09, + "M3": 1.09, "Boxes": 0 }, { "Ticket": 1534076, "Agency": "REC_VILASSAR", "Worker": "CRISTINA SANCHEZ BARRUGUER", - "Hout": 19, + "Hour": 19, "State": "OK", "Lines": 4, - "m3": 0.03, + "M3": 0.03, "Boxes": 0 }, { "Ticket": 1534101, "Agency": "CORREOSEXPRESS", "Worker": "JESUS DANIEL VALLES PEREZ", - "Hout": 17, + "Hour": 17, "State": "Sin Acabar", "Lines": 1, - "m3": 0.02, + "M3": 0.02, "Boxes": 0 }, { "Ticket": 1534186, "Agency": "ZONA 32", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 16, - "m3": 0.4, + "M3": 0.4, "Boxes": 0 }, { "Ticket": 1534187, "Agency": "ZONA 46", "Worker": "MIGUEL ANGEL LORITE", - "Hout": 15, + "Hour": 15, "State": "Preparado", "Lines": 3, - "m3": 0.17, + "M3": 0.17, "Boxes": 0 }, { "Ticket": 1534212, "Agency": "ZELERIS_10", "Worker": "RODRIGO HALABI ROCHA", - "Hout": 17, + "Hour": 17, "State": "Bloqueado", "Lines": 2, - "m3": 0.07, + "M3": 0.07, "Boxes": 0 }, { "Ticket": 1534223, "Agency": "ZONA 10", "Worker": "JESUS DANIEL VALLES PEREZ", - "Hout": 23, + "Hour": 23, "State": "Sin Acabar", "Lines": 4, - "m3": 0.05, + "M3": 0.05, "Boxes": 0 }, { "Ticket": 1534236, "Agency": "REC_MADRID", "Worker": "COMPUTER SYSTEM", - "Hout": 20, + "Hour": 20, "State": "Libre", "Lines": 5, - "m3": 0.04, + "M3": 0.04, "Boxes": 0 }, { "Ticket": 1534240, "Agency": "ZONA 46", "Worker": "MARIA JOSE LAMELA FELIPE", - "Hout": 15, + "Hour": 15, "State": "OK", "Lines": 47, - "m3": 0.91, + "M3": 0.91, "Boxes": 1 }, { "Ticket": 1534252, "Agency": "VIAEXPRESS Interdia", "Worker": "DEMBA SAKHO", - "Hout": 12, + "Hour": 12, "State": "Encajado", "Lines": 2, - "m3": 0.02, + "M3": 0.02, "Boxes": 0 }, { "Ticket": 1534258, "Agency": "ZONA 20", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 5, - "m3": 0.18, + "M3": 0.18, "Boxes": 0 }, { "Ticket": 1534261, "Agency": "REC_VILASSAR", "Worker": "COMPUTER SYSTEM", - "Hout": 19, + "Hour": 19, "State": "Libre", "Lines": 5, - "m3": 0.18, + "M3": 0.18, "Boxes": 0 }, { "Ticket": 1534264, "Agency": "ZONA 20", "Worker": "JOSE VICENTE DOMINGO SANCHEZ", - "Hout": 20, + "Hour": 20, "State": "Sin Acabar", "Lines": 2, - "m3": 0.37, + "M3": 0.37, "Boxes": 2 }, { "Ticket": 1534300, "Agency": "ZONA 20", "Worker": "RODRIGO HALABI ROCHA", - "Hout": 20, + "Hour": 20, "State": "Sin Acabar", "Lines": 1, - "m3": 0.02, + "M3": 0.02, "Boxes": 0 }, { "Ticket": 1534302, "Agency": "ZONA 25", "Worker": "LOLI LOZANO RAEZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 19, - "m3": 1.11, + "M3": 1.11, "Boxes": 0 }, { "Ticket": 1534311, "Agency": "ZONA 32", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 19, + "Hour": 19, "State": "Arreglar", "Lines": 43, - "m3": 0.8, + "M3": 0.8, "Boxes": 0 }, { "Ticket": 1534315, "Agency": "ZONA 20", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 20, + "Hour": 20, "State": "Asignado", "Lines": 6, - "m3": 0.34, + "M3": 0.34, "Boxes": 0 }, { "Ticket": 1534327, "Agency": "ZONA 43", "Worker": "COMPUTER SYSTEM", - "Hout": 14, + "Hour": 14, "State": "Libre", "Lines": 23, - "m3": 0.41, + "M3": 0.41, "Boxes": 0 }, { "Ticket": 1534354, "Agency": "ZONA 46", "Worker": "MARIA DEL MAR GIRBES FERRUS", - "Hout": 15, + "Hour": 15, "State": "Asignado", "Lines": 23, - "m3": 1.67, + "M3": 1.67, "Boxes": 0 }, { "Ticket": 1534359, "Agency": "ZELERIS", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 17, + "Hour": 17, "State": "Arreglar", "Lines": 3, - "m3": 0.06, + "M3": 0.06, "Boxes": 0 }, { "Ticket": 1534366, "Agency": "REC_SILLA", "Worker": "COMPUTER SYSTEM", - "Hout": 23, + "Hour": 23, "State": "Libre", "Lines": 23, - "m3": 0.4, + "M3": 0.4, "Boxes": 0 }, { "Ticket": 1534385, "Agency": "ZELERIS", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 4, - "m3": 0.12, + "M3": 0.12, "Boxes": 0 }, { "Ticket": 1534397, "Agency": "ZONA 20", "Worker": "JUAN CARLOS LORENZO SANCHEZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 14, - "m3": 0.21, + "M3": 0.21, "Boxes": 0 }, { "Ticket": 1534428, "Agency": "ZELERIS", "Worker": "FRAN NATEK ECHEVARRIA", - "Hout": 17, + "Hour": 17, "State": "OK", "Lines": 9, - "m3": 0.3, + "M3": 0.3, "Boxes": 0 }, { "Ticket": 1534467, "Agency": "MRW 24h", "Worker": "COMPUTER SYSTEM", - "Hout": 17, + "Hour": 17, "State": "Libre", "Lines": 15, - "m3": 0.12, + "M3": 0.12, "Boxes": 0 }, { "Ticket": 1534477, "Agency": "ZONA 11", "Worker": "CRISTINA SANCHEZ BARRUGUER", - "Hout": 21, + "Hour": 21, "State": "OK", "Lines": 8, - "m3": 0.09, + "M3": 0.09, "Boxes": 0 }, { "Ticket": 1534490, "Agency": "ZONA 43", "Worker": "JULIA LLOPIS CASTELL", - "Hout": 14, + "Hour": 14, "State": "Arreglar", "Lines": 38, - "m3": 1.15, + "M3": 1.15, "Boxes": 0 }, { "Ticket": 1534500, "Agency": "ZONA 20", "Worker": "CARLOS LOPEZ AMORES", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 10, - "m3": 0.35, + "M3": 0.35, "Boxes": 0 }, { "Ticket": 1534504, "Agency": "ZONA 20", "Worker": "LOLI LOZANO RAEZ", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 18, - "m3": 0.18, + "M3": 0.18, "Boxes": 0 }, { "Ticket": 1534505, "Agency": "ZONA 20", "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hout": 20, + "Hour": 20, "State": "OK", "Lines": 5, - "m3": 0.23, + "M3": 0.23, "Boxes": 0 }, { "Ticket": 1534533, "Agency": "ZONA 45", "Worker": "DANIEL YAREHAM PALOMO", - "Hout": 24, + "Hour": 24, "State": "OK", "Lines": 2, - "m3": 0.25, + "M3": 0.25, "Boxes": 2 } ] \ No newline at end of file From cbc364db3827bcc8df8a8e8fa197bdc90c6edb39 Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 13 Jun 2017 11:26:54 +0200 Subject: [PATCH 151/391] get states production --- .../production/common/methods/state/find.js | 31 +++++++++++++++++++ services/production/common/models/state.js | 9 ++++++ services/production/common/models/state.json | 14 ++++++++- .../common/models/ticket-state.json | 2 +- services/production/server/datasources.json | 27 +++++++++++++++- 5 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 services/production/common/methods/state/find.js create mode 100644 services/production/common/models/state.js diff --git a/services/production/common/methods/state/find.js b/services/production/common/methods/state/find.js new file mode 100644 index 0000000000..f40937891c --- /dev/null +++ b/services/production/common/methods/state/find.js @@ -0,0 +1,31 @@ +module.exports = function(State) { + State.remoteMethod('productionStates', { + description: 'Get production states', + returns: { + arg: 'states', + type: 'object' + }, + http: { + verb: 'get', + path: '/productionStates' + } + }); + + State.productionStates = function(cb) { + State.find(where(), function(err, states) { + if(!err){ + cb(null, states); + } + }); + }; + + function where() { + return { + where: { + "order": {gt: 0} + }, + order: "order, name" + } + } + +} \ No newline at end of file diff --git a/services/production/common/models/state.js b/services/production/common/models/state.js new file mode 100644 index 0000000000..aef20d4658 --- /dev/null +++ b/services/production/common/models/state.js @@ -0,0 +1,9 @@ +var app = require('../../server/server'); + +module.exports = function(State) { + var models = app.models; + + // Methods + + require('../methods/state/find.js')(State); +}; \ No newline at end of file diff --git a/services/production/common/models/state.json b/services/production/common/models/state.json index 97e2eecf33..9dff624327 100644 --- a/services/production/common/models/state.json +++ b/services/production/common/models/state.json @@ -3,7 +3,7 @@ "base": "MyModel", "validateUpsert": true, "properties": { - "id": { + "id": { "id": true, "type": "Number", "forceId": false @@ -11,6 +11,18 @@ "name": { "type": "String", "required": false + }, + "order":{ + "type": "Number", + "required": false + }, + "alertLevel":{ + "type": "Number", + "required": false + }, + "code":{ + "type": "String", + "required": false } }, "acls": [ diff --git a/services/production/common/models/ticket-state.json b/services/production/common/models/ticket-state.json index 5f919ff2ac..8ece52942b 100644 --- a/services/production/common/models/ticket-state.json +++ b/services/production/common/models/ticket-state.json @@ -3,7 +3,7 @@ "base": "MyModel", "validateUpsert": true, "properties": { - "id": { + "id": { "id": true, "type": "Number", "forceId": false diff --git a/services/production/server/datasources.json b/services/production/server/datasources.json index d6caf56d44..ba7db7577e 100644 --- a/services/production/server/datasources.json +++ b/services/production/server/datasources.json @@ -1,6 +1,31 @@ { "db": { "name": "db", - "connector": "memory" + "connector": "memory", + "file": "db.json" + }, + "auth": { + "name": "mysql", + "connector": "mysql", + "database": "salix", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 + }, + "vn": { + "name": "mysql", + "connector": "mysql", + "database": "salix", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } } From 87857488c0d692424e6c658f87e1c65b48cb1831 Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 13 Jun 2017 12:00:11 +0200 Subject: [PATCH 152/391] modificaciones fake son --- .../common/methods/ticket/list-fake.json | 2420 ++++++++++------- 1 file changed, 1412 insertions(+), 1008 deletions(-) diff --git a/services/production/common/methods/ticket/list-fake.json b/services/production/common/methods/ticket/list-fake.json index f8fcce9f8b..26089c37ac 100644 --- a/services/production/common/methods/ticket/list-fake.json +++ b/services/production/common/methods/ticket/list-fake.json @@ -1,1012 +1,1416 @@ [ { - "Ticket": 1532629, - "Agency": "REC_MADRID", - "Worker": "LOLI LOZANO RAEZ", - "Hour": 20, - "State": "OK", - "Lines": 2, - "M3": 0.03, - "Boxes": 0 - }, - { - "Ticket": 1532645, - "Agency": "CORREOSEXPRESS", - "Worker": "COMPUTER SYSTEM", - "Hour": 17, - "State": "Libre", - "Lines": 9, - "M3": 0.21, - "Boxes": 0 - }, - { - "Ticket": 1532656, - "Agency": "ZONA 32", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 35, - "M3": 0.42, - "Boxes": 0 - }, - { - "Ticket": 1532690, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "OK", - "Lines": 4, - "M3": 0.21, - "Boxes": 0 - }, - { - "Ticket": 1532729, - "Agency": "ZONA 25", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 17, - "M3": 0.45, - "Boxes": 0 - }, - { - "Ticket": 1532742, - "Agency": "CORREOSEXPRESS", - "Worker": "DEMBA SAKHO", - "Hour": 17, - "State": "Encajado", - "Lines": 13, - "M3": 0.27, - "Boxes": 0 - }, - { - "Ticket": 1532792, - "Agency": "ZONA 25", - "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hour": 20, - "State": "OK", - "Lines": 10, - "M3": 0.26, - "Boxes": 0 - }, - { - "Ticket": 1532803, - "Agency": "ZONA 31", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 12, - "M3": 0.49, - "Boxes": 0 - }, - { - "Ticket": 1532812, - "Agency": "ZELERIS", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 17, - "State": "Arreglar", - "Lines": 19, - "M3": 0.67, - "Boxes": 0 - }, - { - "Ticket": 1532879, - "Agency": "ZONA 20", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 20, - "State": "OK", - "Lines": 1, - "M3": 0.41, - "Boxes": 0 - }, - { - "Ticket": 1532880, - "Agency": "ZONA 20", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 8, - "M3": 0.08, - "Boxes": 0 - }, - { - "Ticket": 1532923, - "Agency": "ZONA 20", - "Worker": "JESUS DANIEL VALLES PEREZ", - "Hour": 20, - "State": "OK", - "Lines": 30, - "M3": 0.63, - "Boxes": 1 - }, - { - "Ticket": 1532995, - "Agency": "ZONA 20", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 20, - "State": "Arreglar", - "Lines": 54, - "M3": 1.62, - "Boxes": 0 - }, - { - "Ticket": 1533009, - "Agency": "ZONA 25", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 20, - "State": "Sin Acabar", - "Lines": 38, - "M3": 0.78, - "Boxes": 0 - }, - { - "Ticket": 1533051, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "Sin Acabar", - "Lines": 19, - "M3": 0.91, - "Boxes": 2 - }, - { - "Ticket": 1533064, - "Agency": "MRW 24h", - "Worker": "JOSE JAVIER ECHEVARRIA", - "Hour": 17, - "State": "OK", - "Lines": 11, - "M3": 0.22, - "Boxes": 0 - }, - { - "Ticket": 1533102, - "Agency": "MRW 24h", - "Worker": "LOLI LOZANO RAEZ", - "Hour": 17, - "State": "OK", - "Lines": 9, - "M3": 0.35, - "Boxes": 0 - }, - { - "Ticket": 1533151, - "Agency": "ZONA 32", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 7, - "M3": 0.05, - "Boxes": 0 - }, - { - "Ticket": 1533182, - "Agency": "ZONA 25", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 20, - "State": "OK", - "Lines": 20, - "M3": 0.26, - "Boxes": 0 - }, - { - "Ticket": 1533257, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "OK", - "Lines": 14, - "M3": 0.07, - "Boxes": 0 - }, - { - "Ticket": 1533279, - "Agency": "ZONA 46", - "Worker": "RICARD SENDRA", - "Hour": 15, - "State": "Impreso", - "Lines": 50, - "M3": 1.05, - "Boxes": 2 - }, - { - "Ticket": 1533284, - "Agency": "ZONA 20", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 20, - "State": "OK", - "Lines": 18, - "M3": 0.21, - "Boxes": 0 - }, - { - "Ticket": 1533314, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "OK", - "Lines": 3, - "M3": 0.05, - "Boxes": 0 - }, - { - "Ticket": 1533316, - "Agency": "ZONA 25", - "Worker": "LOLI LOZANO RAEZ", - "Hour": 20, - "State": "OK", - "Lines": 17, - "M3": 0.49, - "Boxes": 0 - }, - { - "Ticket": 1533319, - "Agency": "ZONA 25", - "Worker": "ELENA BASCUÑANA TORNERO", - "Hour": 20, - "State": "OK", - "Lines": 2, - "M3": 0.04, - "Boxes": 0 - }, - { - "Ticket": 1533327, - "Agency": "ZONA 25", - "Worker": "FRAN NATEK ECHEVARRIA", - "Hour": 20, - "State": "OK", - "Lines": 13, - "M3": 0.32, - "Boxes": 0 - }, - { - "Ticket": 1533339, - "Agency": "ZONA 20", - "Worker": "ELENA BASCUÑANA TORNERO", - "Hour": 20, - "State": "OK", - "Lines": 9, - "M3": 0.17, - "Boxes": 0 - }, - { - "Ticket": 1533340, - "Agency": "ZONA 25", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 20, - "State": "Arreglar", - "Lines": 48, - "M3": 1.59, - "Boxes": 4.5 - }, - { - "Ticket": 1533345, - "Agency": "ZONA 31", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 56, - "M3": 0.79, - "Boxes": 0 - }, - { - "Ticket": 1533349, - "Agency": "ZONA 20", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 12, - "M3": 0.34, - "Boxes": 0 - }, - { - "Ticket": 1533353, - "Agency": "ZONA 11", - "Worker": "COMPUTER SYSTEM", - "Hour": 21, - "State": "Libre", - "Lines": 10, - "M3": 0.08, - "Boxes": 0 - }, - { - "Ticket": 1533359, - "Agency": "ZONA 20", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 20, - "State": "OK", - "Lines": 9, - "M3": 0.52, - "Boxes": 0 - }, - { - "Ticket": 1533369, - "Agency": "INTEGRA2", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 17, - "State": "OK", - "Lines": 7, - "M3": 0.1, - "Boxes": 0 - }, - { - "Ticket": 1533392, - "Agency": "ZONA 25", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 16, - "M3": 0.35, - "Boxes": 0 - }, - { - "Ticket": 1533403, - "Agency": "ZONA 31", - "Worker": "Mª CARMEN SERRANO BAU", - "Hour": 19, - "State": "OK", - "Lines": 1, - "M3": 2.04, - "Boxes": 0 - }, - { - "Ticket": 1533412, - "Agency": "ZELERIS", - "Worker": "CARLOS BORRAS MARTINEZ", - "Hour": 17, - "State": "OK", - "Lines": 5, - "M3": 0.04, - "Boxes": 0 - }, - { - "Ticket": 1533425, - "Agency": "INTEGRA2", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 17, - "State": "OK", - "Lines": 11, - "M3": 0.14, - "Boxes": 0 - }, - { - "Ticket": 1533429, - "Agency": "ZONA 25", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 20, - "State": "OK", - "Lines": 43, - "M3": 0.6, - "Boxes": 0 - }, - { - "Ticket": 1533438, - "Agency": "ZELERIS", - "Worker": "MIGUEL ANGEL LORITE", - "Hour": 17, - "State": "Preparación", - "Lines": 10, - "M3": 0.17, - "Boxes": 0 - }, - { - "Ticket": 1533482, - "Agency": "ZONA 25", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 20, - "State": "Sin Acabar", - "Lines": 30, - "M3": 0.42, - "Boxes": 0 - }, - { - "Ticket": 1533486, - "Agency": "DHL", - "Worker": "JOSE JAVIER ECHEVARRIA", - "Hour": 17, - "State": "OK", - "Lines": 28, - "M3": 0.25, - "Boxes": 0 - }, - { - "Ticket": 1533495, - "Agency": "REC_VILASSAR", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 16, - "M3": 0.08, - "Boxes": 0 - }, - { - "Ticket": 1533507, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "OK", - "Lines": 16, - "M3": 0.39, - "Boxes": 0 - }, - { - "Ticket": 1533557, - "Agency": "ZONA 11", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 21, - "State": "OK", - "Lines": 50, - "M3": 1.16, - "Boxes": 0 - }, - { - "Ticket": 1533566, - "Agency": "ZONA 10", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 23, - "State": "Sin Acabar", - "Lines": 14, - "M3": 0.18, - "Boxes": 0 - }, - { - "Ticket": 1533570, - "Agency": "MRW 24h", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 17, - "State": "OK", - "Lines": 13, - "M3": 0.17, - "Boxes": 0 - }, - { - "Ticket": 1533580, - "Agency": "ZELERIS_10", - "Worker": "DEMBA SAKHO", - "Hour": 17, - "State": "Encajado", - "Lines": 4, - "M3": 0.13, - "Boxes": 0 - }, - { - "Ticket": 1533584, - "Agency": "ZONA 20", - "Worker": "JESUS DANIEL VALLES PEREZ", - "Hour": 20, - "State": "OK", - "Lines": 20, - "M3": 0.67, - "Boxes": 0 - }, - { - "Ticket": 1533585, - "Agency": "ZELERIS_10", - "Worker": "FRAN NATEK ECHEVARRIA", - "Hour": 17, - "State": "Sin Acabar", - "Lines": 1, - "M3": 0.01, - "Boxes": 0 - }, - { - "Ticket": 1533591, - "Agency": "ZONA 46", - "Worker": "JUANLU GALLETERO", - "Hour": 15, - "State": "Revisado", - "Lines": 16, - "M3": 0.3, - "Boxes": 0 - }, - { - "Ticket": 1533641, - "Agency": "ZONA 25", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 28, - "M3": 0.75, - "Boxes": 0 - }, - { - "Ticket": 1533685, - "Agency": "ZONA 20", - "Worker": "Mª CARMEN SERRANO BAU", - "Hour": 20, - "State": "OK", - "Lines": 39, - "M3": 0.78, - "Boxes": 1 - }, - { - "Ticket": 1533688, - "Agency": "ZONA 20", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 7, - "M3": 0.19, - "Boxes": 0 - }, - { - "Ticket": 1533795, - "Agency": "ZONA 25", - "Worker": "MANOLI PULIDO", - "Hour": 20, - "State": "OK", - "Lines": 16, - "M3": 0.3, - "Boxes": 0 - }, - { - "Ticket": 1533797, - "Agency": "ZONA 25", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 20, - "M3": 0.33, - "Boxes": 0 - }, - { - "Ticket": 1533807, - "Agency": "ZONA 25", - "Worker": "ESDENKA CALERO PEREZ", - "Hour": 20, - "State": "Arreglar", - "Lines": 16, - "M3": 0.14, - "Boxes": 0 - }, - { - "Ticket": 1533815, - "Agency": "ZELERIS_10", - "Worker": "RODRIGO HALABI ROCHA", - "Hour": 17, - "State": "OK", - "Lines": 15, - "M3": 0.2, - "Boxes": 0 - }, - { - "Ticket": 1533849, - "Agency": "MRW 24h", - "Worker": "JUAN CARLOS LORENZO SANCHEZ", - "Hour": 17, - "State": "OK", - "Lines": 18, - "M3": 0.25, - "Boxes": 0 - }, - { - "Ticket": 1533852, - "Agency": "MRW 24h", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 17, - "State": "OK", - "Lines": 17, - "M3": 0.68, - "Boxes": 0 - }, - { - "Ticket": 1533854, - "Agency": "ZONA 20", - "Worker": "MANOLI PULIDO", - "Hour": 20, - "State": "OK", - "Lines": 11, - "M3": 0.13, - "Boxes": 0 - }, - { - "Ticket": 1533863, - "Agency": "ZELERIS_10", - "Worker": "DEMBA SAKHO", - "Hour": 17, - "State": "Encajado", - "Lines": 6, - "M3": 0.16, - "Boxes": 0 - }, - { - "Ticket": 1533882, - "Agency": "ZONA 20", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 20, - "State": "OK", - "Lines": 9, - "M3": 0.44, - "Boxes": 0 - }, - { - "Ticket": 1533889, - "Agency": "MRW 24h", - "Worker": "ELENA BASCUÑANA TORNERO", - "Hour": 17, - "State": "OK", - "Lines": 10, - "M3": 0.5, - "Boxes": 0 - }, - { - "Ticket": 1533893, - "Agency": "ZONA 32", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 2, - "M3": 0.13, - "Boxes": 0 - }, - { - "Ticket": 1533915, - "Agency": "CORREOSEXPRESS", - "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hour": 17, - "State": "OK", - "Lines": 9, - "M3": 0.36, - "Boxes": 0 - }, - { - "Ticket": 1533919, - "Agency": "ZONA 20", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 20, - "State": "Arreglar", - "Lines": 16, - "M3": 0.23, - "Boxes": 0 - }, - { - "Ticket": 1533983, - "Agency": "ZONA 11", - "Worker": "MANOLI PULIDO", - "Hour": 21, - "State": "OK", - "Lines": 30, - "M3": 1.92, - "Boxes": 0 - }, - { - "Ticket": 1533992, - "Agency": "ZONA 25", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 32, - "M3": 0.23, - "Boxes": 0 - }, - { - "Ticket": 1534032, - "Agency": "MRW 24h", - "Worker": "JESUS DANIEL VALLES PEREZ", - "Hour": 17, - "State": "Sin Acabar", - "Lines": 4, - "M3": 0.04, - "Boxes": 0 - }, - { - "Ticket": 1534033, - "Agency": "ZONA 31", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 14, - "M3": 0.65, - "Boxes": 0 - }, - { - "Ticket": 1534055, - "Agency": "ZONA 32", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 42, - "M3": 1.09, - "Boxes": 0 - }, - { - "Ticket": 1534076, - "Agency": "REC_VILASSAR", - "Worker": "CRISTINA SANCHEZ BARRUGUER", - "Hour": 19, - "State": "OK", - "Lines": 4, - "M3": 0.03, - "Boxes": 0 - }, - { - "Ticket": 1534101, - "Agency": "CORREOSEXPRESS", - "Worker": "JESUS DANIEL VALLES PEREZ", - "Hour": 17, - "State": "Sin Acabar", - "Lines": 1, - "M3": 0.02, - "Boxes": 0 - }, - { - "Ticket": 1534186, - "Agency": "ZONA 32", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 16, - "M3": 0.4, - "Boxes": 0 - }, - { - "Ticket": 1534187, - "Agency": "ZONA 46", - "Worker": "MIGUEL ANGEL LORITE", - "Hour": 15, - "State": "Preparado", - "Lines": 3, - "M3": 0.17, - "Boxes": 0 - }, - { - "Ticket": 1534212, - "Agency": "ZELERIS_10", - "Worker": "RODRIGO HALABI ROCHA", - "Hour": 17, - "State": "Bloqueado", - "Lines": 2, - "M3": 0.07, - "Boxes": 0 - }, - { - "Ticket": 1534223, - "Agency": "ZONA 10", - "Worker": "JESUS DANIEL VALLES PEREZ", - "Hour": 23, - "State": "Sin Acabar", - "Lines": 4, - "M3": 0.05, - "Boxes": 0 - }, - { - "Ticket": 1534236, - "Agency": "REC_MADRID", - "Worker": "COMPUTER SYSTEM", - "Hour": 20, - "State": "Libre", - "Lines": 5, - "M3": 0.04, - "Boxes": 0 - }, - { - "Ticket": 1534240, - "Agency": "ZONA 46", - "Worker": "MARIA JOSE LAMELA FELIPE", - "Hour": 15, - "State": "OK", - "Lines": 47, - "M3": 0.91, - "Boxes": 1 - }, - { - "Ticket": 1534252, - "Agency": "VIAEXPRESS Interdia", - "Worker": "DEMBA SAKHO", - "Hour": 12, - "State": "Encajado", - "Lines": 2, - "M3": 0.02, - "Boxes": 0 - }, - { - "Ticket": 1534258, - "Agency": "ZONA 20", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 20, - "State": "OK", - "Lines": 5, - "M3": 0.18, - "Boxes": 0 - }, - { - "Ticket": 1534261, - "Agency": "REC_VILASSAR", - "Worker": "COMPUTER SYSTEM", - "Hour": 19, - "State": "Libre", - "Lines": 5, - "M3": 0.18, - "Boxes": 0 - }, - { - "Ticket": 1534264, - "Agency": "ZONA 20", - "Worker": "JOSE VICENTE DOMINGO SANCHEZ", - "Hour": 20, - "State": "Sin Acabar", - "Lines": 2, - "M3": 0.37, - "Boxes": 2 - }, - { - "Ticket": 1534300, - "Agency": "ZONA 20", - "Worker": "RODRIGO HALABI ROCHA", - "Hour": 20, - "State": "Sin Acabar", - "Lines": 1, - "M3": 0.02, - "Boxes": 0 - }, - { - "Ticket": 1534302, - "Agency": "ZONA 25", - "Worker": "LOLI LOZANO RAEZ", - "Hour": 20, - "State": "OK", - "Lines": 19, - "M3": 1.11, - "Boxes": 0 - }, - { - "Ticket": 1534311, - "Agency": "ZONA 32", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 19, - "State": "Arreglar", - "Lines": 43, - "M3": 0.8, - "Boxes": 0 - }, - { - "Ticket": 1534315, - "Agency": "ZONA 20", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 20, - "State": "Asignado", - "Lines": 6, - "M3": 0.34, - "Boxes": 0 - }, - { - "Ticket": 1534327, - "Agency": "ZONA 43", - "Worker": "COMPUTER SYSTEM", - "Hour": 14, - "State": "Libre", - "Lines": 23, - "M3": 0.41, - "Boxes": 0 - }, - { - "Ticket": 1534354, - "Agency": "ZONA 46", - "Worker": "MARIA DEL MAR GIRBES FERRUS", - "Hour": 15, - "State": "Asignado", - "Lines": 23, - "M3": 1.67, - "Boxes": 0 - }, - { - "Ticket": 1534359, - "Agency": "ZELERIS", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 17, - "State": "Arreglar", - "Lines": 3, - "M3": 0.06, - "Boxes": 0 - }, - { - "Ticket": 1534366, - "Agency": "REC_SILLA", - "Worker": "COMPUTER SYSTEM", - "Hour": 23, - "State": "Libre", - "Lines": 23, - "M3": 0.4, - "Boxes": 0 - }, - { - "Ticket": 1534385, - "Agency": "ZELERIS", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 17, - "State": "OK", - "Lines": 4, - "M3": 0.12, - "Boxes": 0 - }, - { - "Ticket": 1534397, - "Agency": "ZONA 20", - "Worker": "JUAN CARLOS LORENZO SANCHEZ", - "Hour": 20, - "State": "OK", - "Lines": 14, - "M3": 0.21, - "Boxes": 0 - }, - { - "Ticket": 1534428, - "Agency": "ZELERIS", - "Worker": "FRAN NATEK ECHEVARRIA", - "Hour": 17, - "State": "OK", - "Lines": 9, - "M3": 0.3, - "Boxes": 0 - }, - { - "Ticket": 1534467, - "Agency": "MRW 24h", - "Worker": "COMPUTER SYSTEM", - "Hour": 17, - "State": "Libre", - "Lines": 15, - "M3": 0.12, - "Boxes": 0 - }, - { - "Ticket": 1534477, - "Agency": "ZONA 11", - "Worker": "CRISTINA SANCHEZ BARRUGUER", - "Hour": 21, - "State": "OK", - "Lines": 8, - "M3": 0.09, - "Boxes": 0 - }, - { - "Ticket": 1534490, - "Agency": "ZONA 43", - "Worker": "JULIA LLOPIS CASTELL", - "Hour": 14, - "State": "Arreglar", - "Lines": 38, - "M3": 1.15, - "Boxes": 0 - }, - { - "Ticket": 1534500, - "Agency": "ZONA 20", - "Worker": "CARLOS LOPEZ AMORES", - "Hour": 20, - "State": "OK", - "Lines": 10, - "M3": 0.35, - "Boxes": 0 - }, - { - "Ticket": 1534504, - "Agency": "ZONA 20", - "Worker": "LOLI LOZANO RAEZ", - "Hour": 20, - "State": "OK", - "Lines": 18, - "M3": 0.18, - "Boxes": 0 - }, - { - "Ticket": 1534505, - "Agency": "ZONA 20", - "Worker": "JUAN BAUTISTA PASTOR REDONDO", - "Hour": 20, - "State": "OK", - "Lines": 5, - "M3": 0.23, - "Boxes": 0 - }, - { - "Ticket": 1534533, - "Agency": "ZONA 45", - "Worker": "DANIEL YAREHAM PALOMO", - "Hour": 24, - "State": "OK", - "Lines": 2, - "M3": 0.25, - "Boxes": 2 + "ticket": 1535516, + "agency": "MRW 24h", + "worker": "MARIA JOSE LAMELA FELIPE", + "hour": 17, + "state": "Sin Acabar", + "lines": 4, + "m3": 0.07, + "boxes": 0, + "city": "SAN FERNANDO", + "province": "Cádiz", + "client": 7315, + "salePerson": "MARIA JOSE LAMELA FELIPE" + }, + { + "ticket": 1535518, + "agency": "ZELERIS", + "worker": "JUAN CARLOS LORENZO SANCHEZ", + "hour": 17, + "state": "OK", + "lines": 10, + "m3": 0.25, + "boxes": 0, + "city": "ANDORRA", + "province": "Teruel", + "client": 1911, + "salePerson": "JUAN CARLOS LORENZO SANCHEZ" + }, + { + "ticket": 1535519, + "agency": "ZELERIS", + "worker": "JOSE JULIAN SAEZ FERNANDEZ", + "hour": 17, + "state": "Sin Acabar", + "lines": 8, + "m3": 0.42, + "boxes": 0, + "city": "AVILES", + "province": "Asturias", + "client": 4471, + "salePerson": "JOSE JULIAN SAEZ FERNANDEZ" + }, + { + "ticket": 1535521, + "agency": "INTEGRA2", + "worker": "JUAN CARLOS LORENZO SANCHEZ", + "hour": 17, + "state": "Arreglar", + "lines": 21, + "m3": 0.21, + "boxes": 0, + "city": "SANXENXO", + "province": "Pontevedra", + "client": 5075, + "salePerson": "JUAN CARLOS LORENZO SANCHEZ" + }, + { + "ticket": 1535523, + "agency": "ZELERIS", + "worker": "Mª CARMEN SERRANO BAU", + "hour": 17, + "state": "OK", + "lines": 12, + "m3": 0.32, + "boxes": 0, + "city": "ALHENDIN", + "province": "Granada", + "client": 1501, + "salePerson": "Mª CARMEN SERRANO BAU" + }, + { + "ticket": 1535524, + "agency": "INTEGRA2", + "worker": "COMPUTER SYSTEM", + "hour": 17, + "state": "Libre", + "lines": 15, + "m3": 0.33, + "boxes": 0, + "city": "A CORUÑA", + "province": "La Coruña", + "client": 8002, + "salePerson": "COMPUTER SYSTEM" + }, + { + "ticket": 1535526, + "agency": "ZELERIS", + "worker": "RODRIGO HALABI ROCHA", + "hour": 17, + "state": "Sin Acabar", + "lines": 11, + "m3": 0.1, + "boxes": 0, + "city": "LOGROÑO", + "province": "La Rioja", + "client": 2197, + "salePerson": "RODRIGO HALABI ROCHA" + }, + { + "ticket": 1535531, + "agency": "INTEGRA2", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 17, + "state": "OK", + "lines": 7, + "m3": 0.28, + "boxes": 0, + "city": "LLEIDA", + "province": "Lleida", + "client": 4227, + "salePerson": "FRAN NATEK ECHEVARRIA" + }, + { + "ticket": 1535544, + "agency": "VIAEXPRESS Interdia", + "worker": "DEMBA SAKHO", + "hour": 12, + "state": "Encajado", + "lines": 13, + "m3": 0.2, + "boxes": 0, + "city": "LA POBLA DE VALLBONA", + "province": "Valencia", + "client": 2053, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535548, + "agency": "ZONA 10", + "worker": "CONCHA ESTEBAN VILLENA", + "hour": 23, + "state": "OK", + "lines": 6, + "m3": 0.06, + "boxes": 0, + "city": "PICANYA", + "province": "Valencia", + "client": 2879, + "salePerson": "CONCHA ESTEBAN VILLENA" + }, + { + "ticket": 1535549, + "agency": "CORREOSEXPRESS", + "worker": "JAVIER VILAR PASTOR", + "hour": 17, + "state": "OK", + "lines": 3, + "m3": 0.14, + "boxes": 0, + "city": "LOJA", + "province": "Granada", + "client": 329, + "salePerson": "JAVIER VILAR PASTOR" + }, + { + "ticket": 1535555, + "agency": "REC_VILASSAR", + "worker": "COMPUTER SYSTEM", + "hour": 19, + "state": "Libre", + "lines": 8, + "m3": 0.38, + "boxes": 0, + "city": "VILASSAR DE MAR", + "province": "Barcelona", + "client": 6945, + "salePerson": "COMPUTER SYSTEM" + }, + { + "ticket": 1535557, + "agency": "CORREOSEXPRESS", + "worker": "MARIA DEL MAR GIRBES FERRUS", + "hour": 17, + "state": "Sin Acabar", + "lines": 7, + "m3": 0.08, + "boxes": 0, + "city": "EL ALTET", + "province": "Alicante", + "client": 8000, + "salePerson": "MARIA DEL MAR GIRBES FERRUS" + }, + { + "ticket": 1535558, + "agency": "ZONA 11", + "worker": 0, + "hour": 21, + "state": "Libre", + "lines": 13, + "m3": 0.41, + "boxes": 0, + "city": "TORREBLANCA", + "province": "Castellón", + "client": 5377, + "salePerson": 0 + }, + { + "ticket": 1535559, + "agency": "ZONA 20", + "worker": "ELENA BASCUÑANA TORNERO", + "hour": 20, + "state": "OK", + "lines": 17, + "m3": 0.36, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 3574, + "salePerson": "ELENA BASCUÑANA TORNERO" + }, + { + "ticket": 1535560, + "agency": "ZONA 43", + "worker": "DEMBA SAKHO", + "hour": 14, + "state": "Encajado", + "lines": 1, + "m3": 0.02, + "boxes": 0, + "city": "INCA", + "province": "Baleares (Mallorca)", + "client": 7500, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535561, + "agency": "ZELERIS", + "worker": "MANOLI PULIDO", + "hour": 17, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.05, + "boxes": 0, + "city": "TERUEL", + "province": "Teruel", + "client": 860, + "salePerson": "MANOLI PULIDO" + }, + { + "ticket": 1535562, + "agency": "ZONA 46", + "worker": "MIGUEL ANGEL LAGUNA", + "hour": 15, + "state": "Impreso", + "lines": 1, + "m3": 0.16, + "boxes": 2, + "city": "MALAGA", + "province": "Málaga", + "client": 5630, + "salePerson": "MIGUEL ANGEL LAGUNA" + }, + { + "ticket": 1535573, + "agency": "ZONA 43", + "worker": "JULIAN RAMIREZ SAYAGO", + "hour": 14, + "state": "Encajado", + "lines": 19, + "m3": 0.12, + "boxes": 0, + "city": "PALMA", + "province": "Baleares (Mallorca)", + "client": 6966, + "salePerson": "JULIAN RAMIREZ SAYAGO" + }, + { + "ticket": 1535578, + "agency": "MRW 24h", + "worker": "ESDENKA CALERO PEREZ", + "hour": 17, + "state": "Arreglar", + "lines": 7, + "m3": 0.12, + "boxes": 0, + "city": "VILLAMARIN DE VALDEORRAS", + "province": "Orense", + "client": 6671, + "salePerson": "ESDENKA CALERO PEREZ" + }, + { + "ticket": 1535579, + "agency": "ZONA 46", + "worker": "JUANLU GALLETERO", + "hour": 15, + "state": "Revisado", + "lines": 5, + "m3": 0.14, + "boxes": 0, + "city": "MALAGA", + "province": "Málaga", + "client": 6534, + "salePerson": "JUANLU GALLETERO" + }, + { + "ticket": 1535583, + "agency": "MRW 24h", + "worker": "CARLOS ZAMBRANO GARCIA", + "hour": 17, + "state": "OK", + "lines": 4, + "m3": 0.11, + "boxes": 0, + "city": "PALOMARES DEL RIO", + "province": "Sevilla", + "client": 8506, + "salePerson": "CARLOS ZAMBRANO GARCIA" + }, + { + "ticket": 1535584, + "agency": "ZONA 46", + "worker": "JULIAN RAMIREZ SAYAGO", + "hour": 15, + "state": "Encajado", + "lines": 10, + "m3": 0.46, + "boxes": 0, + "city": "MARBELLA", + "province": "Málaga", + "client": 3018, + "salePerson": "JULIAN RAMIREZ SAYAGO" + }, + { + "ticket": 1535589, + "agency": "VIAEXPRESS Interdia", + "worker": "DEMBA SAKHO", + "hour": 12, + "state": "Encajado", + "lines": 5, + "m3": 0.22, + "boxes": 0, + "city": "valencia", + "province": "Valencia", + "client": 3781, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535594, + "agency": "VIAEXPRESS Interdia", + "worker": "JULIAN RAMIREZ SAYAGO", + "hour": 12, + "state": "Encajado", + "lines": 5, + "m3": 0.2, + "boxes": 0, + "city": "BENISSODA", + "province": "Valencia", + "client": 958, + "salePerson": "JULIAN RAMIREZ SAYAGO" + }, + { + "ticket": 1535597, + "agency": "CORREOSEXPRESS", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 9, + "m3": 0.19, + "boxes": 0, + "city": "SORIA", + "province": "Soria", + "client": 2082, + "salePerson": 0 + }, + { + "ticket": 1535604, + "agency": "OTRA AGENCIA", + "worker": "BEGOÑA RODRIGUEZ", + "hour": 24, + "state": "Entregado", + "lines": 1, + "m3": 0, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 5134, + "salePerson": "BEGOÑA RODRIGUEZ" + }, + { + "ticket": 1535610, + "agency": "ZELERIS", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 3, + "m3": 0.06, + "boxes": 0, + "city": "VILLANUEVA DE LA SERENA", + "province": "Badajoz", + "client": 2816, + "salePerson": 0 + }, + { + "ticket": 1535617, + "agency": "REC_SILLA", + "worker": "OKSANA KHODORIVSKA", + "hour": 23, + "state": "Entregado", + "lines": 10, + "m3": 0.39, + "boxes": 0, + "city": "TORRENT", + "province": "Valencia", + "client": 1072, + "salePerson": "OKSANA KHODORIVSKA" + }, + { + "ticket": 1535622, + "agency": "ZONA 25", + "worker": "JAVIER VILAR PASTOR", + "hour": 20, + "state": "Sin Acabar", + "lines": 13, + "m3": 0.4, + "boxes": 2, + "city": "CALZADA DE CALATRAVA", + "province": "Ciudad Real", + "client": 3921, + "salePerson": "JAVIER VILAR PASTOR" + }, + { + "ticket": 1535624, + "agency": "ZONA 20", + "worker": 0, + "hour": 20, + "state": "Libre", + "lines": 10, + "m3": 0.29, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 6131, + "salePerson": 0 + }, + { + "ticket": 1535631, + "agency": "REC_VILASSAR", + "worker": 0, + "hour": 19, + "state": "Libre", + "lines": 15, + "m3": 0.33, + "boxes": 0, + "city": "VILASSAR DE MAR", + "province": "Barcelona", + "client": 4658, + "salePerson": 0 + }, + { + "ticket": 1535637, + "agency": "ZONA 43", + "worker": "JUANLU GALLETERO", + "hour": 14, + "state": "Revisado", + "lines": 10, + "m3": 0.08, + "boxes": 0, + "city": "FELANITX", + "province": "Baleares (Mallorca)", + "client": 2477, + "salePerson": "JUANLU GALLETERO" + }, + { + "ticket": 1535643, + "agency": "VIAEXPRESS Interdia", + "worker": "DEMBA SAKHO", + "hour": 12, + "state": "Encajado", + "lines": 26, + "m3": 0.49, + "boxes": 0, + "city": "BURRIAN", + "province": "Castellón", + "client": 3027, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535644, + "agency": "REC_MADRID", + "worker": 0, + "hour": 20, + "state": "Libre", + "lines": 7, + "m3": 0.22, + "boxes": 0, + "city": "SAN FERNANDO DE HENARES", + "province": "Madrid", + "client": 3005, + "salePerson": 0 + }, + { + "ticket": 1535648, + "agency": "OTRA AGENCIA", + "worker": "BEGOÑA RODRIGUEZ", + "hour": 24, + "state": "Entregado", + "lines": 1, + "m3": 0, + "boxes": 0, + "city": "CATADAU", + "province": "Valencia", + "client": 1425, + "salePerson": "BEGOÑA RODRIGUEZ" + }, + { + "ticket": 1535652, + "agency": "INTEGRA2", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 17, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.02, + "boxes": 0, + "city": "PALACIOS Y VILLAFRAN", + "province": "Sevilla", + "client": 3063, + "salePerson": "FRAN NATEK ECHEVARRIA" + }, + { + "ticket": 1535657, + "agency": "OTRA AGENCIA", + "worker": "BEGOÑA RODRIGUEZ", + "hour": 24, + "state": "Entregado", + "lines": 1, + "m3": 0, + "boxes": 0, + "city": "PALMA DE GANDIA", + "province": "Valencia", + "client": 1261, + "salePerson": "BEGOÑA RODRIGUEZ" + }, + { + "ticket": 1535658, + "agency": "OTRA AGENCIA", + "worker": "BEGOÑA RODRIGUEZ", + "hour": 24, + "state": "Entregado", + "lines": 1, + "m3": 0, + "boxes": 0, + "city": "GALDACANO", + "province": "Vizcaya", + "client": 1309, + "salePerson": "BEGOÑA RODRIGUEZ" + }, + { + "ticket": 1535660, + "agency": "ZELERIS", + "worker": "ELENA BASCUÑANA TORNERO", + "hour": 17, + "state": "OK", + "lines": 2, + "m3": 0.05, + "boxes": 0, + "city": "CEHEGIN", + "province": "Murcia", + "client": 178, + "salePerson": "ELENA BASCUÑANA TORNERO" + }, + { + "ticket": 1535663, + "agency": "MRW 24h", + "worker": "Mª CARMEN SERRANO BAU", + "hour": 17, + "state": "OK", + "lines": 6, + "m3": 0.06, + "boxes": 0, + "city": "ROCIANA DEL CONDADO", + "province": "Huelva", + "client": 6471, + "salePerson": "Mª CARMEN SERRANO BAU" + }, + { + "ticket": 1535673, + "agency": "MRW 24h", + "worker": "CRISTINA SANCHEZ BARRUGUER", + "hour": 17, + "state": "Sin Acabar", + "lines": 19, + "m3": 0.3, + "boxes": 0, + "city": "CIUDAD RODRIGO", + "province": "Salamanca", + "client": 7821, + "salePerson": "CRISTINA SANCHEZ BARRUGUER" + }, + { + "ticket": 1535678, + "agency": "ZONA 11", + "worker": "JESUS DANIEL VALLES PEREZ", + "hour": 21, + "state": "OK", + "lines": 5, + "m3": 0.18, + "boxes": 0, + "city": "BURRIANA", + "province": "Castellón", + "client": 3021, + "salePerson": "JESUS DANIEL VALLES PEREZ" + }, + { + "ticket": 1535679, + "agency": "ZONA 20", + "worker": 0, + "hour": 20, + "state": "Libre", + "lines": 1, + "m3": 0.03, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 3222, + "salePerson": 0 + }, + { + "ticket": 1535682, + "agency": "VIAEXPRESS Interdia", + "worker": "DEMBA SAKHO", + "hour": 12, + "state": "Encajado", + "lines": 15, + "m3": 0.08, + "boxes": 0, + "city": "PUZOL", + "province": "Valencia", + "client": 389, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535684, + "agency": "REC_SILLA", + "worker": "GISELA LLOPIS COLOM", + "hour": 23, + "state": "Entregado", + "lines": 2, + "m3": 0.3, + "boxes": 3, + "city": "MONTSERRAT", + "province": "Valencia", + "client": 3075, + "salePerson": "GISELA LLOPIS COLOM" + }, + { + "ticket": 1535686, + "agency": "ZONA 31", + "worker": "COMPUTER SYSTEM", + "hour": 19, + "state": "Libre", + "lines": 9, + "m3": 0.15, + "boxes": 0, + "city": "BARBERA DEL VALLES", + "province": "Barcelona", + "client": 4631, + "salePerson": "COMPUTER SYSTEM" + }, + { + "ticket": 1535687, + "agency": "MRW 24h", + "worker": "CARLOS BORRAS MARTINEZ", + "hour": 17, + "state": "Sin Acabar", + "lines": 6, + "m3": 0.03, + "boxes": 0, + "city": "BECERREA", + "province": "Lugo", + "client": 5410, + "salePerson": "CARLOS BORRAS MARTINEZ" + }, + { + "ticket": 1535690, + "agency": "ZELERIS", + "worker": "DAVID SARRION RIVERO", + "hour": 17, + "state": "OK", + "lines": 8, + "m3": 0.09, + "boxes": 0, + "city": "REINOSA", + "province": "Cantabria", + "client": 4268, + "salePerson": "DAVID SARRION RIVERO" + }, + { + "ticket": 1535693, + "agency": "ZONA 25", + "worker": "RODRIGO HALABI ROCHA", + "hour": 20, + "state": "OK", + "lines": 1, + "m3": 0.06, + "boxes": 0, + "city": "DAIMIEL", + "province": "Ciudad Real", + "client": 904, + "salePerson": "RODRIGO HALABI ROCHA" + }, + { + "ticket": 1535694, + "agency": "CORREOSEXPRESS", + "worker": "CARLOS ZAMBRANO GARCIA", + "hour": 17, + "state": "OK", + "lines": 4, + "m3": 0.1, + "boxes": 0, + "city": "VILLARALBO", + "province": "Zamora", + "client": 5801, + "salePerson": "CARLOS ZAMBRANO GARCIA" + }, + { + "ticket": 1535699, + "agency": "ZONA 20", + "worker": "MANOLI PULIDO", + "hour": 20, + "state": "OK", + "lines": 7, + "m3": 0.28, + "boxes": 0, + "city": "ALCORCON", + "province": "Madrid", + "client": 422, + "salePerson": "MANOLI PULIDO" + }, + { + "ticket": 1535702, + "agency": "ZELERIS", + "worker": "Mª CARMEN SERRANO BAU", + "hour": 17, + "state": "OK", + "lines": 3, + "m3": 0.23, + "boxes": 0, + "city": "PURULLENA", + "province": "Granada", + "client": 3224, + "salePerson": "Mª CARMEN SERRANO BAU" + }, + { + "ticket": 1535713, + "agency": "REC_MADRID", + "worker": "ELENA BASCUÑANA TORNERO", + "hour": 20, + "state": "OK", + "lines": 16, + "m3": 0.36, + "boxes": 0, + "city": "TORREJON DE ARDOZ", + "province": "Madrid", + "client": 680, + "salePerson": "ELENA BASCUÑANA TORNERO" + }, + { + "ticket": 1535719, + "agency": "ZELERIS", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 15, + "m3": 0.22, + "boxes": 0, + "city": "RIBADESELLA", + "province": "Asturias", + "client": 2428, + "salePerson": 0 + }, + { + "ticket": 1535720, + "agency": "REC_VILASSAR", + "worker": 0, + "hour": 19, + "state": "Libre", + "lines": 11, + "m3": 0.07, + "boxes": 0, + "city": "BARCELONA", + "province": "Barcelona", + "client": 7628, + "salePerson": 0 + }, + { + "ticket": 1535724, + "agency": "REC_SILLA", + "worker": 0, + "hour": 23, + "state": "Libre", + "lines": 3, + "m3": 0.04, + "boxes": 0, + "city": "QUART DE POBLET", + "province": "Valencia", + "client": 326, + "salePerson": 0 + }, + { + "ticket": 1535727, + "agency": "ZONA 43", + "worker": "DEMBA SAKHO", + "hour": 14, + "state": "Encajando", + "lines": 21, + "m3": 0.35, + "boxes": 0, + "city": "PALMA MALLORCA", + "province": "Baleares (Mallorca)", + "client": 3436, + "salePerson": "DEMBA SAKHO" + }, + { + "ticket": 1535732, + "agency": "ZONA 20", + "worker": "MARIA DEL MAR GIRBES FERRUS", + "hour": 20, + "state": "Sin Acabar", + "lines": 10, + "m3": 0.44, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 7303, + "salePerson": "MARIA DEL MAR GIRBES FERRUS" + }, + { + "ticket": 1535736, + "agency": "ZONA 42", + "worker": "JUANLU GALLETERO", + "hour": 14, + "state": "Preparación", + "lines": 6, + "m3": 0.09, + "boxes": 0, + "city": "SANT JOSEP DE SATALIA", + "province": "Baleares (Ibiza)", + "client": 3472, + "salePerson": "JUANLU GALLETERO" + }, + { + "ticket": 1535737, + "agency": "MRW 24h", + "worker": "DEBORA SANCHEZ TORIO", + "hour": 17, + "state": "OK", + "lines": 6, + "m3": 0.18, + "boxes": 0, + "city": "MARCILLA", + "province": "Navarra", + "client": 957, + "salePerson": "DEBORA SANCHEZ TORIO" + }, + { + "ticket": 1535742, + "agency": "ZONA 46", + "worker": "MIGUEL ANGEL LAGUNA", + "hour": 15, + "state": "Impreso", + "lines": 3, + "m3": 0.11, + "boxes": 0, + "city": "MALAGA", + "province": "Málaga", + "client": 4812, + "salePerson": "MIGUEL ANGEL LAGUNA" + }, + { + "ticket": 1535747, + "agency": "MRW 24h", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 17, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.23, + "boxes": 2, + "city": "SEVILLA", + "province": "Sevilla", + "client": 4095, + "salePerson": "FRAN NATEK ECHEVARRIA" + }, + { + "ticket": 1535749, + "agency": "ZELERIS", + "worker": "DEBORA SANCHEZ TORIO", + "hour": 17, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.03, + "boxes": 0, + "city": "VIVEIRO", + "province": "Lugo", + "client": 5928, + "salePerson": "DEBORA SANCHEZ TORIO" + }, + { + "ticket": 1535751, + "agency": "ZELERIS", + "worker": "JOSE JULIAN SAEZ FERNANDEZ", + "hour": 17, + "state": "OK", + "lines": 27, + "m3": 0.95, + "boxes": 2.99, + "city": "RABADE LUGO", + "province": "Lugo", + "client": 5652, + "salePerson": "JOSE JULIAN SAEZ FERNANDEZ" + }, + { + "ticket": 1535756, + "agency": "MRW 24h", + "worker": "DAVID SARRION RIVERO", + "hour": 17, + "state": "OK", + "lines": 11, + "m3": 0.31, + "boxes": 0, + "city": "LANDETE", + "province": "Cuenca", + "client": 3857, + "salePerson": "DAVID SARRION RIVERO" + }, + { + "ticket": 1535758, + "agency": "VIAEXPRESS Interdia", + "worker": 0, + "hour": 12, + "state": "Libre", + "lines": 21, + "m3": 0.49, + "boxes": 0, + "city": "LA POBLA DE VALLBONA", + "province": "Valencia", + "client": 2053, + "salePerson": 0 + }, + { + "ticket": 1535765, + "agency": "ZONA 31", + "worker": 0, + "hour": 19, + "state": "Libre", + "lines": 1, + "m3": 0.07, + "boxes": 0, + "city": "SANT HIPÒLIT DE VOLTREGÀ", + "province": "Barcelona", + "client": 5876, + "salePerson": 0 + }, + { + "ticket": 1535770, + "agency": "ZONA 25", + "worker": "DEBORA SANCHEZ TORIO", + "hour": 20, + "state": "OK", + "lines": 16, + "m3": 0.18, + "boxes": 0, + "city": "ILLESCAS", + "province": "Toledo", + "client": 4283, + "salePerson": "DEBORA SANCHEZ TORIO" + }, + { + "ticket": 1535771, + "agency": "ZELERIS", + "worker": "JUANLU GALLETERO", + "hour": 17, + "state": "Revisado", + "lines": 1, + "m3": 0.03, + "boxes": 0, + "city": "SEVILLA", + "province": "Sevilla", + "client": 2000, + "salePerson": "JUANLU GALLETERO" + }, + { + "ticket": 1535772, + "agency": "ZELERIS_10", + "worker": "MARIA JOSE LAMELA FELIPE", + "hour": 17, + "state": "OK", + "lines": 3, + "m3": 0.07, + "boxes": 0, + "city": "SEVILLA", + "province": "Sevilla", + "client": 2635, + "salePerson": "MARIA JOSE LAMELA FELIPE" + }, + { + "ticket": 1535774, + "agency": "ZELERIS", + "worker": "JESUS DANIEL VALLES PEREZ", + "hour": 17, + "state": "OK", + "lines": 19, + "m3": 0.18, + "boxes": 0, + "city": "LEON", + "province": "León", + "client": 8321, + "salePerson": "JESUS DANIEL VALLES PEREZ" + }, + { + "ticket": 1535775, + "agency": "ZONA 10", + "worker": "JESUS DANIEL VALLES PEREZ", + "hour": 23, + "state": "OK", + "lines": 1, + "m3": 0.69, + "boxes": 0, + "city": "PUIG PLAYA", + "province": "Valencia", + "client": 3781, + "salePerson": "JESUS DANIEL VALLES PEREZ" + }, + { + "ticket": 1535776, + "agency": "REC_MADRID", + "worker": "CRISTINA SANCHEZ BARRUGUER", + "hour": 20, + "state": "Sin Acabar", + "lines": 10, + "m3": 0.09, + "boxes": 0, + "city": "TORREJON DE ARDOZ", + "province": "Madrid", + "client": 1600, + "salePerson": "CRISTINA SANCHEZ BARRUGUER" + }, + { + "ticket": 1535777, + "agency": "ZELERIS", + "worker": "MANOLI PULIDO", + "hour": 17, + "state": "Sin Acabar", + "lines": 3, + "m3": 0.06, + "boxes": 0, + "city": "PALENCIA", + "province": "Palencia", + "client": 3717, + "salePerson": "MANOLI PULIDO" + }, + { + "ticket": 1535779, + "agency": "ZONA 11", + "worker": "ELENA BASCUÑANA TORNERO", + "hour": 21, + "state": "OK", + "lines": 16, + "m3": 0.21, + "boxes": 0, + "city": "ESLIDA", + "province": "Castellón", + "client": 7423, + "salePerson": "ELENA BASCUÑANA TORNERO" + }, + { + "ticket": 1535899, + "agency": "ZONA 31", + "worker": "CLAUDI SANROMA REYNARES", + "hour": 19, + "state": "OK", + "lines": 7, + "m3": 0.33, + "boxes": 0, + "city": "MARTORELL", + "province": "Barcelona", + "client": 4058, + "salePerson": "CLAUDI SANROMA REYNARES" + }, + { + "ticket": 1535903, + "agency": "MRW 24h", + "worker": "SILVERIO DOMINGUEZ", + "hour": 17, + "state": "OK", + "lines": 9, + "m3": 0.24, + "boxes": 0, + "city": "TOLOSA", + "province": "Guipuzcoa", + "client": 6308, + "salePerson": "SILVERIO DOMINGUEZ" + }, + { + "ticket": 1535905, + "agency": "ZONA 20", + "worker": "ELENA BASCUÑANA TORNERO", + "hour": 20, + "state": "OK", + "lines": 19, + "m3": 0.33, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 3574, + "salePerson": "ELENA BASCUÑANA TORNERO" + }, + { + "ticket": 1535908, + "agency": "INTEGRA2", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 1, + "m3": 0.04, + "boxes": 0, + "city": "LA PUEBLA DE CAZALLA", + "province": "Sevilla", + "client": 5007, + "salePerson": 0 + }, + { + "ticket": 1535911, + "agency": "ZONA 43", + "worker": "MIGUEL ANGEL LAGUNA", + "hour": 14, + "state": "Impreso", + "lines": 53, + "m3": 0.61, + "boxes": 0, + "city": "INCA", + "province": "Baleares (Mallorca)", + "client": 6032, + "salePerson": "MIGUEL ANGEL LAGUNA" + }, + { + "ticket": 1535912, + "agency": "REC_SILLA", + "worker": "COMPUTER SYSTEM", + "hour": 23, + "state": "Libre", + "lines": 2, + "m3": 0.11, + "boxes": 0, + "city": "VALENCIA", + "province": "Valencia", + "client": 3613, + "salePerson": "COMPUTER SYSTEM" + }, + { + "ticket": 1535918, + "agency": "ZONA 10", + "worker": 0, + "hour": 23, + "state": "Libre", + "lines": 15, + "m3": 0.12, + "boxes": 0, + "city": "VALENCIA", + "province": "Valencia", + "client": 2574, + "salePerson": 0 + }, + { + "ticket": 1535919, + "agency": "ZONA 43", + "worker": "MARIA DEL MAR GIRBES FERRUS", + "hour": 14, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.01, + "boxes": 0, + "city": "PALMA", + "province": "Baleares (Mallorca)", + "client": 7445, + "salePerson": "MARIA DEL MAR GIRBES FERRUS" + }, + { + "ticket": 1535920, + "agency": "INTEGRA2", + "worker": "JULIA LLOPIS CASTELL", + "hour": 17, + "state": "Arreglar", + "lines": 9, + "m3": 0.1, + "boxes": 0, + "city": "Benahavis", + "province": "Málaga", + "client": 7796, + "salePerson": "JULIA LLOPIS CASTELL" + }, + { + "ticket": 1535921, + "agency": "REC_SILLA", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 23, + "state": "Entregado", + "lines": 2, + "m3": 0, + "boxes": 0, + "city": "SUECA", + "province": "Valencia", + "client": 1160, + "salePerson": "FRAN NATEK ECHEVARRIA" + }, + { + "ticket": 1535928, + "agency": "CORREOSEXPRESS", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 8, + "m3": 0.07, + "boxes": 0, + "city": "ESCALONA", + "province": "Toledo", + "client": 2787, + "salePerson": 0 + }, + { + "ticket": 1535931, + "agency": "ZONA 20", + "worker": "CARLOS ZAMBRANO GARCIA", + "hour": 20, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.02, + "boxes": 0, + "city": "PARLA", + "province": "Madrid", + "client": 2725, + "salePerson": "CARLOS ZAMBRANO GARCIA" + }, + { + "ticket": 1535935, + "agency": "REC_MADRID", + "worker": 0, + "hour": 20, + "state": "Libre", + "lines": 1, + "m3": 0.12, + "boxes": 3, + "city": "SAN FERNADO DE HENARES", + "province": "Madrid", + "client": 3240, + "salePerson": 0 + }, + { + "ticket": 1535936, + "agency": "ZELERIS", + "worker": "DAVID SARRION RIVERO", + "hour": 17, + "state": "OK", + "lines": 2, + "m3": 0.11, + "boxes": 0, + "city": "VINAROS", + "province": "Castellón", + "client": 768, + "salePerson": "DAVID SARRION RIVERO" + }, + { + "ticket": 1535938, + "agency": "ZONA 46", + "worker": 0, + "hour": 15, + "state": "Libre", + "lines": 5, + "m3": 0.11, + "boxes": 0, + "city": "VELEZ-MALAGA", + "province": "Málaga", + "client": 5358, + "salePerson": 0 + }, + { + "ticket": 1535941, + "agency": "CORREOSEXPRESS", + "worker": "LOLI LOZANO RAEZ", + "hour": 17, + "state": "OK", + "lines": 1, + "m3": 0.01, + "boxes": 0, + "city": "HUERCAL DE ALMERIA", + "province": "Almería", + "client": 475, + "salePerson": "LOLI LOZANO RAEZ" + }, + { + "ticket": 1535942, + "agency": "CORREOSEXPRESS", + "worker": "CARLOS ZAMBRANO GARCIA", + "hour": 17, + "state": "OK", + "lines": 3, + "m3": 0.41, + "boxes": 10, + "city": "CHIPIONA", + "province": "Cádiz", + "client": 1479, + "salePerson": "CARLOS ZAMBRANO GARCIA" + }, + { + "ticket": 1535943, + "agency": "ZONA 43", + "worker": 0, + "hour": 14, + "state": "Libre", + "lines": 1, + "m3": 0.14, + "boxes": 0, + "city": "PALMA DE MALLORCA", + "province": "Baleares (Mallorca)", + "client": 5840, + "salePerson": 0 + }, + { + "ticket": 1535946, + "agency": "REC_VILASSAR", + "worker": 0, + "hour": 19, + "state": "Libre", + "lines": 1, + "m3": 0.01, + "boxes": 0, + "city": "VILASSAR DE MAR", + "province": "Barcelona", + "client": 3951, + "salePerson": 0 + }, + { + "ticket": 1535956, + "agency": "ZONA 10", + "worker": "JOSE JAVIER ECHEVARRIA", + "hour": 23, + "state": "OK", + "lines": 5, + "m3": 0.12, + "boxes": 0, + "city": "CATARROJA", + "province": "Valencia", + "client": 4193, + "salePerson": "JOSE JAVIER ECHEVARRIA" + }, + { + "ticket": 1535957, + "agency": "ZONA 43", + "worker": 0, + "hour": 14, + "state": "Libre", + "lines": 9, + "m3": 0.08, + "boxes": 0, + "city": "BINISSALEM", + "province": "Baleares (Mallorca)", + "client": 5172, + "salePerson": 0 + }, + { + "ticket": 1535960, + "agency": "MRW 24h", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 17, + "state": "OK", + "lines": 3, + "m3": 0.09, + "boxes": 0, + "city": "BAENA", + "province": "Córdoba", + "client": 1667, + "salePerson": "FRAN NATEK ECHEVARRIA" + }, + { + "ticket": 1535961, + "agency": "ZONA 20", + "worker": 0, + "hour": 20, + "state": "Libre", + "lines": 3, + "m3": 0.11, + "boxes": 0, + "city": "MADRID", + "province": "Madrid", + "client": 5762, + "salePerson": 0 + }, + { + "ticket": 1535962, + "agency": "MRW 24h", + "worker": 0, + "hour": 17, + "state": "Libre", + "lines": 19, + "m3": 0.26, + "boxes": 0, + "city": "CUEVAS DEL VALLE", + "province": "Ávila", + "client": 6070, + "salePerson": 0 + }, + { + "ticket": 1535967, + "agency": "ZELERIS", + "worker": "FRAN NATEK ECHEVARRIA", + "hour": 17, + "state": "Sin Acabar", + "lines": 1, + "m3": 0.1, + "boxes": 0, + "city": "SEVILLA", + "province": "Sevilla", + "client": 2000, + "salePerson": "FRAN NATEK ECHEVARRIA" } ] \ No newline at end of file From e09f60a53a550cc03a0504efaa0f1191f3fa91e0 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 13 Jun 2017 13:08:06 +0200 Subject: [PATCH 153/391] =?UTF-8?q?Nuevos=20componentes:=20drop-down,=20ic?= =?UTF-8?q?on-menu.=20Refactorizaci=C3=B3n=20de=20icon=20e=20icon-button?= =?UTF-8?q?=20(pasados=20a=20componentes=20sin=20template=20manager)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/core/src/components.js | 2 + client/core/src/drop-down/drop-down.html | 3 ++ client/core/src/drop-down/drop-down.js | 16 ++++++ client/core/src/drop-down/style.scss | 20 +++++++ client/core/src/filters/index.js | 1 + client/core/src/filters/ucwords.js | 20 +++++++ client/core/src/icon-button/icon-button.html | 3 ++ client/core/src/icon-button/icon-button.js | 18 +++++-- client/core/src/icon-menu/icon-menu.html | 4 ++ client/core/src/icon-menu/icon-menu.js | 54 +++++++++++++++++++ client/core/src/icon/icon.js | 16 ++++-- client/core/src/icon/icon.mdl.js | 2 +- client/production/src/index/index.html | 55 ++++++++++---------- client/production/src/index/index.js | 19 ++++++- client/production/src/index/style.scss | 3 ++ 15 files changed, 199 insertions(+), 37 deletions(-) create mode 100644 client/core/src/drop-down/drop-down.html create mode 100644 client/core/src/drop-down/drop-down.js create mode 100644 client/core/src/drop-down/style.scss create mode 100644 client/core/src/filters/ucwords.js create mode 100644 client/core/src/icon-button/icon-button.html create mode 100644 client/core/src/icon-menu/icon-menu.html create mode 100644 client/core/src/icon-menu/icon-menu.js diff --git a/client/core/src/components.js b/client/core/src/components.js index fc5c92d344..f0303ebe21 100644 --- a/client/core/src/components.js +++ b/client/core/src/components.js @@ -15,6 +15,8 @@ import './subtitle/subtitle'; import './spinner/spinner'; import './snackbar/snackbar'; import './tooltip/tooltip'; +import './icon-menu/icon-menu'; +import './drop-down/drop-down'; export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html new file mode 100644 index 0000000000..4b354ae623 --- /dev/null +++ b/client/core/src/drop-down/drop-down.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client/core/src/drop-down/drop-down.js b/client/core/src/drop-down/drop-down.js new file mode 100644 index 0000000000..c33aea7b5e --- /dev/null +++ b/client/core/src/drop-down/drop-down.js @@ -0,0 +1,16 @@ +import {module} from '../module'; +import './style.scss'; + +/* export default class DropDown { +}*/ + +module.component('vnDropDown', { + template: require('./drop-down.html'), + // controller: DropDown, + bindings: { + items: '<', + show: '<', + selected: '=' + }, + controllerAs: 'dd' +}); diff --git a/client/core/src/drop-down/style.scss b/client/core/src/drop-down/style.scss new file mode 100644 index 0000000000..07cf592d9c --- /dev/null +++ b/client/core/src/drop-down/style.scss @@ -0,0 +1,20 @@ +vn-drop-down { + position: absolute; + z-index: 9999; + + ul{ + padding: 0; + margin: 10px 0 0 0; + background: white; + border: 1px solid #A7A7A7; + li { + list-style-type: none; + padding: 5px 20px 5px 5px; + cursor: pointer; + } + li:hover{ + background-color: #3D3A3B; + color: white; + } + } +} \ No newline at end of file diff --git a/client/core/src/filters/index.js b/client/core/src/filters/index.js index de0560b2f8..885f3cd666 100644 --- a/client/core/src/filters/index.js +++ b/client/core/src/filters/index.js @@ -1 +1,2 @@ import './phone'; +import './ucwords'; diff --git a/client/core/src/filters/ucwords.js b/client/core/src/filters/ucwords.js new file mode 100644 index 0000000000..08ca725ebf --- /dev/null +++ b/client/core/src/filters/ucwords.js @@ -0,0 +1,20 @@ +import {module} from '../module'; + +/** + * Uppercase the first character of each word in a string + * + * @return {String} The formated string + */ +export default function ucwords() { + return function(input) { + input = input || ''; + let out = ''; + let aux = input.split(' '); + for (let i = 0; i < aux.length; i++) { + out += (aux[i]) ? aux[i].charAt(0).toUpperCase() + aux[i].substr(1).toLowerCase() : ''; + out += ' '; + } + return out.trim(); + }; +} +module.filter('ucwords', ucwords); diff --git a/client/core/src/icon-button/icon-button.html b/client/core/src/icon-button/icon-button.html new file mode 100644 index 0000000000..4f80d96b58 --- /dev/null +++ b/client/core/src/icon-button/icon-button.html @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/client/core/src/icon-button/icon-button.js b/client/core/src/icon-button/icon-button.js index 62ce9a2a4d..806b86d83f 100644 --- a/client/core/src/icon-button/icon-button.js +++ b/client/core/src/icon-button/icon-button.js @@ -1,10 +1,10 @@ import {module as _module} from '../module'; -import * as resolveFactory from '../lib/resolveDefaultComponents'; +// import * as resolveFactory from '../lib/resolveDefaultComponents'; import * as util from '../lib/util'; const _NAME = 'iconButton'; export const NAME = util.getName(_NAME); - +/* directive.$inject = [resolveFactory.NAME]; export function directive(resolve) { return { @@ -14,4 +14,16 @@ export function directive(resolve) { } }; } -_module.directive(NAME, directive); +_module.directive(NAME, directive); */ + +_module.component(NAME, { + template: require('./icon-button.html'), + bindings: { + icon: '@', + className: ' + + +
    \ No newline at end of file diff --git a/client/core/src/icon-menu/icon-menu.js b/client/core/src/icon-menu/icon-menu.js new file mode 100644 index 0000000000..d1119bedbc --- /dev/null +++ b/client/core/src/icon-menu/icon-menu.js @@ -0,0 +1,54 @@ +import {module} from '../module'; + +export default class IconMenu { + constructor($element, $http, $timeout) { + this.$element = $element; + this.$http = $http; + this.$timeout = $timeout; + this._showDropDown = false; + } + get showDropDown() { + return this._showDropDown; + } + set showDropDown(value) { + this._showDropDown = value; + } + + getItems() { + this.$http.get(this.url).then( + json => { + this.items = json.data; + } + ); + } + $onInit() { + if (!this.items && this.url) { + this.getItems(); + } + + this.$element.bind('mouseover', () => { + this.$timeout(() => { + this.showDropDown = true; + }); + }); + + this.$element.bind('mouseout', () => { + this.$timeout(() => { + this.showDropDown = false; + }); + }); + } +} +IconMenu.$inject = ['$element', '$http', '$timeout']; + +module.component('vnIconMenu', { + template: require('./icon-menu.html'), + bindings: { + url: '@?', + items: '=?', + icon: '@', + selected: '=' + }, + controller: IconMenu, + controllerAs: 'im' +}); diff --git a/client/core/src/icon/icon.js b/client/core/src/icon/icon.js index 31e9ca5658..29f3d0747d 100644 --- a/client/core/src/icon/icon.js +++ b/client/core/src/icon/icon.js @@ -1,12 +1,12 @@ import {module} from '../module'; import './icon.mdl'; import './style.css'; -import * as resolveFactory from '../lib/resolveDefaultComponents'; +// import * as resolveFactory from '../lib/resolveDefaultComponents'; -const _NAME = 'icon'; +// const _NAME = 'icon'; export const NAME = 'vnIcon'; -export function directive(resolver) { +/* export function directive(resolver) { return { restrict: 'E', template: function(_, attrs) { @@ -16,4 +16,12 @@ export function directive(resolver) { } directive.$inject = [resolveFactory.NAME]; -module.directive(NAME, directive); +module.directive(NAME, directive);*/ + +module.component(NAME, { + template: '{{i.icon}}', + bindings: { + icon: '@' + }, + controllerAs: 'i' +}); diff --git a/client/core/src/icon/icon.mdl.js b/client/core/src/icon/icon.mdl.js index ce3f82856d..6a558285cb 100644 --- a/client/core/src/icon/icon.mdl.js +++ b/client/core/src/icon/icon.mdl.js @@ -6,7 +6,7 @@ export function factory() { return { template: template, default: {} - } + }; } module.factory(NAME, factory); diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index b768aab801..cc1b7511af 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -1,4 +1,4 @@ - + @@ -25,7 +25,10 @@ - + + + + @@ -34,51 +37,49 @@ - - + + - + - - + + - + - - + + - - + + - - {{ticket.id}} - {{ticket.agency.name}} - {{ticket.employee.name}} + + {{ticket.ticket}} + {{ticket.agency}} + {{ticket.worker | ucwords}} {{ticket.hour}} - {{ticket.state.name}} + {{ticket.state}} {{ticket.lines}} - {{ticket.meters}} + {{ticket.m3}} {{ticket.boxes}} - + - + + + : {{$ctrl.tickets.length}} - - - - - - + + {{$ctrl.lines}} {{$ctrl.meters}} - + \ No newline at end of file diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 97c5c1d5c0..8fed9a431b 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -10,6 +10,7 @@ export default class ProductionIndex { this.tickets = []; this.lines = 0; this.meters = 0; + this.state = null; } get checkAll() { return this._checkAll; @@ -18,6 +19,12 @@ export default class ProductionIndex { this._checkAll = value; this.switchChecks(); } + /*get state() { + return this._state; + } + set state(value) { + this._state = value; + }*/ switchChecks() { let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]'); checks.forEach( @@ -33,11 +40,13 @@ export default class ProductionIndex { let ids = []; checks.forEach( (_, i) => { - ids.push(this.tickets[i].id); + ids.push(this.tickets[i].ticket); } ); + console.log("TODO: call action -> endPoint with tickets's Ids", action, ids, arguments[1]); // TODO: call action -> endPoint with tickets's Ids } else { + console.log("TODO: dialog with no items selected", action); // TODO: dialog with no items selected } } @@ -47,7 +56,7 @@ export default class ProductionIndex { this.tickets.forEach( val => { lines += parseFloat(val.lines); - meters += parseFloat(val.meters); + meters += parseFloat(val.m3); } ); this.lines = lines; @@ -57,6 +66,12 @@ export default class ProductionIndex { this.$.index.filter = this.filter; this.$.index.accept(); } + $doCheck() { + if (this.state) { + this.doAction('changeState', Object.assign({}, this.state)); + this.state = null; + } + } } ProductionIndex.$inject = ['$element', '$scope']; diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index 13bd38bbfb..cafeb13cb9 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -29,6 +29,9 @@ vn-production-index { .list > vn-one, .list > [vn-one], .list > [vn-two], .list > vn-two{ text-align: center; } + .list > vn-none{ + min-width: 60px; + } .list-body{ padding: 4px 0px; border-bottom: 1px solid #9D9D9D; From 6adc734f69f5dbe79de64afea6b8bc0ef746ac6c Mon Sep 17 00:00:00 2001 From: nelo Date: Tue, 13 Jun 2017 13:57:40 +0200 Subject: [PATCH 154/391] change state ticket --- .../methods/ticket-state/change-state.js | 46 +++++++++++++++++++ .../production/common/models/ticket-state.js | 9 ++++ 2 files changed, 55 insertions(+) create mode 100644 services/production/common/methods/ticket-state/change-state.js create mode 100644 services/production/common/models/ticket-state.js diff --git a/services/production/common/methods/ticket-state/change-state.js b/services/production/common/methods/ticket-state/change-state.js new file mode 100644 index 0000000000..99254bd66c --- /dev/null +++ b/services/production/common/methods/ticket-state/change-state.js @@ -0,0 +1,46 @@ +module.exports = function(TicketState) { + TicketState.remoteMethod('changeState', { + description: 'Change state of tickets', + accepts: [ + { + arg: 'tickets', + type: 'array', + required: true, + description: 'Array of tickets', + http: {source: 'path'} + }, + { + arg: 'state', + type: 'number', + required: true, + description: 'New state', + http: {source: 'path'} + }, + ], + returns: { + arg: 'response', + type: 'boolean' + }, + http: { + verb: 'put', + path: '/:tickets/:state/changeState' + } + }); + + TicketState.changeState = function(tickets, state, cb) { + changeState(tickets, state, cb); + }; + + var changeState = function(tickets, state, cb){ + TicketState.update(where(tickets), {"state": state}, function(error, response){ + if(!error) + cb(null, true); + cb(error); + }); + } + + var where = function(tickets){ + return {"where": {"ticketFk": {"inq": tickets } } }; + } + +} \ No newline at end of file diff --git a/services/production/common/models/ticket-state.js b/services/production/common/models/ticket-state.js new file mode 100644 index 0000000000..f6890964d1 --- /dev/null +++ b/services/production/common/models/ticket-state.js @@ -0,0 +1,9 @@ +var app = require('../../server/server'); + +module.exports = function(TicketState) { + var models = app.models; + + // Methods + + require('../methods/ticket-state/change-state.js')(TicketState); +}; \ No newline at end of file From 7713d0bd6f09e4aa6759cabd3e25c3c7ab32bc93 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Tue, 13 Jun 2017 14:57:09 +0200 Subject: [PATCH 155/391] cambio estilos dropdown --- client/core/src/drop-down/style.scss | 4 +++- client/production/src/index/index.html | 17 ++++++++++------- client/production/src/index/index.js | 7 +++++-- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/client/core/src/drop-down/style.scss b/client/core/src/drop-down/style.scss index 07cf592d9c..626b681569 100644 --- a/client/core/src/drop-down/style.scss +++ b/client/core/src/drop-down/style.scss @@ -1,7 +1,9 @@ vn-drop-down { position: absolute; z-index: 9999; - + padding: 0 15px; + margin-left: -15px; + ul{ padding: 0; margin: 10px 0 0 0; diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index cc1b7511af..eb033eeff7 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -28,6 +28,9 @@ + + + @@ -58,14 +61,14 @@ - {{ticket.ticket}} - {{ticket.agency}} - {{ticket.worker | ucwords}} - {{ticket.hour}} + {{::ticket.ticket}} + {{::ticket.agency}} + {{::ticket.worker | ucwords}} + {{::ticket.hour}} {{ticket.state}} - {{ticket.lines}} - {{ticket.m3}} - {{ticket.boxes}} + {{::ticket.lines}} + {{::ticket.m3}} + {{::ticket.boxes}} diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 8fed9a431b..6b1706de31 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -41,9 +41,12 @@ export default class ProductionIndex { checks.forEach( (_, i) => { ids.push(this.tickets[i].ticket); + // Fake change state + this.tickets[i].state = this.state.name; } ); - console.log("TODO: call action -> endPoint with tickets's Ids", action, ids, arguments[1]); + console.log("TODO: call action -> endPoint with tickets's Ids", action, ids, this.state); + // TODO: call action -> endPoint with tickets's Ids } else { console.log("TODO: dialog with no items selected", action); @@ -68,7 +71,7 @@ export default class ProductionIndex { } $doCheck() { if (this.state) { - this.doAction('changeState', Object.assign({}, this.state)); + this.doAction('changeState'); this.state = null; } } From 3da67266bbc58dc31587cc6e87a5bd6853dd9143 Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 14 Jun 2017 08:54:45 +0200 Subject: [PATCH 156/391] promesa para obtener usuario --- services/client/common/models/my-model.js | 14 ++++++++++- .../methods/ticket-state/change-state.js | 23 +++++++++++-------- services/production/common/models/my-model.js | 14 ++++++++++- services/production/server/middleware.json | 12 +++++++++- .../server/middleware/currentUser.js | 13 +++++++++++ services/service/models/my-model.js | 13 +++++++++++ 6 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 services/production/server/middleware/currentUser.js diff --git a/services/client/common/models/my-model.js b/services/client/common/models/my-model.js index 4d98e7f62b..bfa55efbd4 100644 --- a/services/client/common/models/my-model.js +++ b/services/client/common/models/my-model.js @@ -1,4 +1,3 @@ - module.exports = function(self) { self.setup = function() { @@ -26,7 +25,20 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } + }; + self.getUser = function() { + let loopBackContext = require('loopback-context'); + let currentUser = loopBackContext.getCurrentContext(); + let userId = currentUser.get('currentUser'); + return userId; + }; + + self.getEmployee = function() { + let app = require('../../server/server'); + let userId = self.getUser(); + let employee = app.models.Employee; + return employee.findOne({where: {userFk: userId}}); }; self.rawSql = function(query, params, cb) { diff --git a/services/production/common/methods/ticket-state/change-state.js b/services/production/common/methods/ticket-state/change-state.js index 99254bd66c..ce68022888 100644 --- a/services/production/common/methods/ticket-state/change-state.js +++ b/services/production/common/methods/ticket-state/change-state.js @@ -28,19 +28,22 @@ module.exports = function(TicketState) { }); TicketState.changeState = function(tickets, state, cb) { - changeState(tickets, state, cb); + TicketState.getEmployee().then(function(emp){ + changeState(emp, tickets, state, cb); + }); }; - var changeState = function(tickets, state, cb){ - TicketState.update(where(tickets), {"state": state}, function(error, response){ - if(!error) - cb(null, true); - cb(error); + var changeState = function(emp, tickets, state, cb){ + var inserts = []; + + tickets.forEach(function(t) { + inserts.push({ticketFk: t, stateFk: state, employeeFk: emp}); + }, this); + + TicketState.create(inserts, function(err, res){ + if(!err) + cb(null, res); }); } - var where = function(tickets){ - return {"where": {"ticketFk": {"inq": tickets } } }; - } - } \ No newline at end of file diff --git a/services/production/common/models/my-model.js b/services/production/common/models/my-model.js index 4d98e7f62b..bfa55efbd4 100644 --- a/services/production/common/models/my-model.js +++ b/services/production/common/models/my-model.js @@ -1,4 +1,3 @@ - module.exports = function(self) { self.setup = function() { @@ -26,7 +25,20 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } + }; + self.getUser = function() { + let loopBackContext = require('loopback-context'); + let currentUser = loopBackContext.getCurrentContext(); + let userId = currentUser.get('currentUser'); + return userId; + }; + + self.getEmployee = function() { + let app = require('../../server/server'); + let userId = self.getUser(); + let employee = app.models.Employee; + return employee.findOne({where: {userFk: userId}}); }; self.rawSql = function(query, params, cb) { diff --git a/services/production/server/middleware.json b/services/production/server/middleware.json index fbfff8165d..8100507708 100644 --- a/services/production/server/middleware.json +++ b/services/production/server/middleware.json @@ -28,10 +28,20 @@ "helmet#noSniff": {}, "helmet#noCache": { "enabled": false + }, + "loopback-context#per-request": { + "params": { + "enableHttpContext": true + } } }, "session": {}, - "auth": {}, + "auth": { + "loopback#token": {} + }, + "auth:after": { + "./middleware/currentUser": {} + }, "parse": {}, "routes": { "loopback#rest": { diff --git a/services/production/server/middleware/currentUser.js b/services/production/server/middleware/currentUser.js new file mode 100644 index 0000000000..6024b442ea --- /dev/null +++ b/services/production/server/middleware/currentUser.js @@ -0,0 +1,13 @@ +module.exports = function(options) { + return function storeCurrentUser(req, res, next) { + if (!req.accessToken) { + return next(); + } + let LoopBackContext = require('loopback-context'); + let loopbackContext = LoopBackContext.getCurrentContext(); + if (loopbackContext) { + loopbackContext.set('currentUser', req.accessToken.userId); + } + next(); + }; +}; diff --git a/services/service/models/my-model.js b/services/service/models/my-model.js index 4d98e7f62b..9246e02a94 100644 --- a/services/service/models/my-model.js +++ b/services/service/models/my-model.js @@ -1,3 +1,5 @@ +let loopBackContext = require('loopback-context'); +let app = require('../../server/server'); module.exports = function(self) { @@ -26,7 +28,18 @@ module.exports = function(self) { for(let method in disableMethods) { //this.disableRemoteMethod(method, disableMethods[method]); } + }; + self.getUser = function() { + let currentUser = loopBackContext.getCurrentContext(); + let userId = currentUser.get('currentUser'); + return userId; + }; + + self.getEmployee = function() { + let userId = self.getUser(); + let employee = app.models.Employee; + return employee.findOne({where: {userFk: userId}}); }; self.rawSql = function(query, params, cb) { From afff93cce61612d54fc729c86e4c47adf8258c3f Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Wed, 14 Jun 2017 09:54:00 +0200 Subject: [PATCH 157/391] =?UTF-8?q?Tooltip:=20admite=20html,=20Localizador?= =?UTF-8?q?:=20a=C3=B1adido=20icono=20con=20informaci=C3=B3n=20adicional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/core/src/drop-down/style.scss | 2 +- client/core/src/tooltip/style.css | 5 ++- client/core/src/tooltip/tooltip.js | 33 ++++++++++++++++--- client/production/src/index/index.html | 23 ++++++++----- client/production/src/index/index.js | 32 +++++++++++------- .../src/index/more-info-tooltip.tpl.html | 18 ++++++++++ client/production/src/index/style.scss | 23 ------------- client/salix/src/styles/misc.scss | 24 ++++++++++++++ .../methods/ticket-state/change-state.js | 2 +- 9 files changed, 110 insertions(+), 52 deletions(-) create mode 100644 client/production/src/index/more-info-tooltip.tpl.html diff --git a/client/core/src/drop-down/style.scss b/client/core/src/drop-down/style.scss index 626b681569..52adc11999 100644 --- a/client/core/src/drop-down/style.scss +++ b/client/core/src/drop-down/style.scss @@ -3,7 +3,7 @@ vn-drop-down { z-index: 9999; padding: 0 15px; margin-left: -15px; - + background: transparent; ul{ padding: 0; margin: 10px 0 0 0; diff --git a/client/core/src/tooltip/style.css b/client/core/src/tooltip/style.css index 943a92c9ce..9d27976c04 100644 --- a/client/core/src/tooltip/style.css +++ b/client/core/src/tooltip/style.css @@ -6,7 +6,6 @@ position: fixed; background-color: #fff; padding: 15px; - max-width: 250px; color: #424242; z-index: 999; border: 1px solid #A7A7A7; @@ -23,6 +22,10 @@ height: 0; } +.tooltip-text{ + max-width: 250px; +} + .tooltip-down .tooltip-arrow { top: -15px; left: 50%; diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js index d7620e41c2..ff3f7472ff 100644 --- a/client/core/src/tooltip/tooltip.js +++ b/client/core/src/tooltip/tooltip.js @@ -1,18 +1,41 @@ import {module} from '../module'; import './style.css'; -tooltip.$inject = ['$document', '$compile']; -function tooltip($document, $compile) { +tooltip.$inject = ['$document', '$compile', '$sce', '$templateCache', '$http']; +function tooltip($document, $compile, $sce, $templateCache, $http) { + function getTemplate(tooltipTemplateUrl) { + var template = $templateCache.get(tooltipTemplateUrl); + if (typeof template === 'undefined') { + template = $http.get(tooltipTemplateUrl).then(function onGetTemplateSuccess(response) { + return response.data; + }); + $templateCache.put(tooltipTemplateUrl, template); + } + return template; + } + return { restrict: 'A', - scope: true, + priority: -1, link: function(scope, element, attrs) { - var tip = $compile('
    {{ text }}
    ')(scope); + var tip = $compile('
    {{ text }}
    ')(scope); var tipClassName = 'tooltip'; var tipActiveClassName = 'tooltip-show'; scope.tipClass = [tipClassName]; - scope.text = attrs.vnTooltip; + scope.text = attrs.vnTooltip || ''; + + if (attrs.tooltipHtml) { + scope.isHtmlContent = true; + scope.htmlContent = $sce.trustAsHtml(attrs.tooltipHtml); + } else if (attrs.tooltipTemplate) { + var template = getTemplate(attrs.tooltipTemplate); + scope.isHtmlContent = true; + scope.htmlContent = $sce.trustAsHtml(template); + } else { + scope.isHtmlContent = false; + scope.htmlContent = null; + } if (attrs.tooltipPosition) { scope.tipClass.push('tooltip-' + attrs.tooltipPosition); diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index eb033eeff7..e132f00336 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -26,15 +26,18 @@ - - + + - - + + + + + + + + - - - @@ -56,7 +59,7 @@
    - + @@ -69,7 +72,9 @@ {{::ticket.lines}} {{::ticket.m3}} {{::ticket.boxes}} - + + + diff --git a/client/production/src/index/index.js b/client/production/src/index/index.js index 6b1706de31..c2d811af3b 100644 --- a/client/production/src/index/index.js +++ b/client/production/src/index/index.js @@ -10,7 +10,12 @@ export default class ProductionIndex { this.tickets = []; this.lines = 0; this.meters = 0; - this.state = null; + this.actions = { + state: null, + worker: null, + hour: null + }; + this.hourItems = []; } get checkAll() { return this._checkAll; @@ -19,12 +24,6 @@ export default class ProductionIndex { this._checkAll = value; this.switchChecks(); } - /*get state() { - return this._state; - } - set state(value) { - this._state = value; - }*/ switchChecks() { let checks = this.$element[0].querySelectorAll('.list-body input[type="checkbox"]'); checks.forEach( @@ -42,11 +41,10 @@ export default class ProductionIndex { (_, i) => { ids.push(this.tickets[i].ticket); // Fake change state - this.tickets[i].state = this.state.name; + this.tickets[i].state = this.actions.state.name; } ); - console.log("TODO: call action -> endPoint with tickets's Ids", action, ids, this.state); - + console.log("TODO: call action -> endPoint with tickets's Ids", action, ids, this.actions); // TODO: call action -> endPoint with tickets's Ids } else { console.log("TODO: dialog with no items selected", action); @@ -70,9 +68,19 @@ export default class ProductionIndex { this.$.index.accept(); } $doCheck() { - if (this.state) { + if (this.actions.state) { this.doAction('changeState'); - this.state = null; + this.actions.state = null; + } + } + $onInit() { + for (let i = 6; i < 21; i++) { + let hour = [i].join(''); + if (hour.length === 1) { + hour = [0, i].join(''); + } + hour += ':00'; + this.hourItems.push({id: i, name: hour}); } } } diff --git a/client/production/src/index/more-info-tooltip.tpl.html b/client/production/src/index/more-info-tooltip.tpl.html new file mode 100644 index 0000000000..085187043c --- /dev/null +++ b/client/production/src/index/more-info-tooltip.tpl.html @@ -0,0 +1,18 @@ + + + + Población + Provincia + ID_Cliente + Comercial + + + + + {{ticket.city}} + {{ticket.province}} + {{ticket.client}} + {{ticket.salePerson}} + + + \ No newline at end of file diff --git a/client/production/src/index/style.scss b/client/production/src/index/style.scss index cafeb13cb9..63d0cd9a7b 100644 --- a/client/production/src/index/style.scss +++ b/client/production/src/index/style.scss @@ -17,27 +17,4 @@ vn-production-index { .icon-square{ height: 36px; } - .list-header{ - border-bottom: 3px solid #9D9D9D; - font-weight: bold; - } - - .list-footer{ - border-top: 3px solid #9D9D9D; - font-weight: bold; - } - .list > vn-one, .list > [vn-one], .list > [vn-two], .list > vn-two{ - text-align: center; - } - .list > vn-none{ - min-width: 60px; - } - .list-body{ - padding: 4px 0px; - border-bottom: 1px solid #9D9D9D; - - i { - color: #ffa410; - } - } } \ No newline at end of file diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index c3712646e6..604e40d51b 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -35,4 +35,28 @@ html [vn-right], .vn-right{ } html [vn-left], .vn-left{ float: left; +} + +.list-header{ + border-bottom: 3px solid #9D9D9D; + font-weight: bold; + } + +.list-footer{ + border-top: 3px solid #9D9D9D; + font-weight: bold; +} +.list > vn-one, .list > [vn-one], .list > [vn-two], .list > vn-two{ + text-align: center; +} +.list > vn-none{ + min-width: 60px; +} +.list-body{ + padding: 4px 0px; + border-bottom: 1px solid #9D9D9D; + + i { + color: #ffa410; + } } \ No newline at end of file diff --git a/services/production/common/methods/ticket-state/change-state.js b/services/production/common/methods/ticket-state/change-state.js index 99254bd66c..8951ec13e7 100644 --- a/services/production/common/methods/ticket-state/change-state.js +++ b/services/production/common/methods/ticket-state/change-state.js @@ -32,7 +32,7 @@ module.exports = function(TicketState) { }; var changeState = function(tickets, state, cb){ - TicketState.update(where(tickets), {"state": state}, function(error, response){ + TicketState.updateAll(where(tickets), {"state": state}, function(error, response){ if(!error) cb(null, true); cb(error); From 956264a529f93924c6830fe526ec9e768af2f045 Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 14 Jun 2017 09:56:08 +0200 Subject: [PATCH 158/391] fake son con notas --- .../common/methods/ticket/list-fake.json | 300 ++++++++++++------ 1 file changed, 200 insertions(+), 100 deletions(-) diff --git a/services/production/common/methods/ticket/list-fake.json b/services/production/common/methods/ticket/list-fake.json index 26089c37ac..cda5ae63fb 100644 --- a/services/production/common/methods/ticket/list-fake.json +++ b/services/production/common/methods/ticket/list-fake.json @@ -11,7 +11,8 @@ "city": "SAN FERNANDO", "province": "Cádiz", "client": 7315, - "salePerson": "MARIA JOSE LAMELA FELIPE" + "salePerson": "MARIA JOSE LAMELA FELIPE", + "notes": null }, { "ticket": 1535518, @@ -25,7 +26,8 @@ "city": "ANDORRA", "province": "Teruel", "client": 1911, - "salePerson": "JUAN CARLOS LORENZO SANCHEZ" + "salePerson": "JUAN CARLOS LORENZO SANCHEZ", + "notes": null }, { "ticket": 1535519, @@ -39,7 +41,8 @@ "city": "AVILES", "province": "Asturias", "client": 4471, - "salePerson": "JOSE JULIAN SAEZ FERNANDEZ" + "salePerson": "JOSE JULIAN SAEZ FERNANDEZ", + "notes": null }, { "ticket": 1535521, @@ -53,7 +56,8 @@ "city": "SANXENXO", "province": "Pontevedra", "client": 5075, - "salePerson": "JUAN CARLOS LORENZO SANCHEZ" + "salePerson": "JUAN CARLOS LORENZO SANCHEZ", + "notes": null }, { "ticket": 1535523, @@ -67,7 +71,8 @@ "city": "ALHENDIN", "province": "Granada", "client": 1501, - "salePerson": "Mª CARMEN SERRANO BAU" + "salePerson": "Mª CARMEN SERRANO BAU", + "notes": null }, { "ticket": 1535524, @@ -81,7 +86,8 @@ "city": "A CORUÑA", "province": "La Coruña", "client": 8002, - "salePerson": "COMPUTER SYSTEM" + "salePerson": "COMPUTER SYSTEM", + "notes": null }, { "ticket": 1535526, @@ -95,7 +101,8 @@ "city": "LOGROÑO", "province": "La Rioja", "client": 2197, - "salePerson": "RODRIGO HALABI ROCHA" + "salePerson": "RODRIGO HALABI ROCHA", + "notes": null }, { "ticket": 1535531, @@ -109,7 +116,8 @@ "city": "LLEIDA", "province": "Lleida", "client": 4227, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null }, { "ticket": 1535544, @@ -123,7 +131,8 @@ "city": "LA POBLA DE VALLBONA", "province": "Valencia", "client": 2053, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535548, @@ -137,7 +146,8 @@ "city": "PICANYA", "province": "Valencia", "client": 2879, - "salePerson": "CONCHA ESTEBAN VILLENA" + "salePerson": "CONCHA ESTEBAN VILLENA", + "notes": null }, { "ticket": 1535549, @@ -151,7 +161,8 @@ "city": "LOJA", "province": "Granada", "client": 329, - "salePerson": "JAVIER VILAR PASTOR" + "salePerson": "JAVIER VILAR PASTOR", + "notes": null }, { "ticket": 1535555, @@ -165,7 +176,8 @@ "city": "VILASSAR DE MAR", "province": "Barcelona", "client": 6945, - "salePerson": "COMPUTER SYSTEM" + "salePerson": "COMPUTER SYSTEM", + "notes": null }, { "ticket": 1535557, @@ -179,7 +191,8 @@ "city": "EL ALTET", "province": "Alicante", "client": 8000, - "salePerson": "MARIA DEL MAR GIRBES FERRUS" + "salePerson": "MARIA DEL MAR GIRBES FERRUS", + "notes": null }, { "ticket": 1535558, @@ -193,7 +206,8 @@ "city": "TORREBLANCA", "province": "Castellón", "client": 5377, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535559, @@ -207,7 +221,8 @@ "city": "MADRID", "province": "Madrid", "client": 3574, - "salePerson": "ELENA BASCUÑANA TORNERO" + "salePerson": "ELENA BASCUÑANA TORNERO", + "notes": null }, { "ticket": 1535560, @@ -221,7 +236,8 @@ "city": "INCA", "province": "Baleares (Mallorca)", "client": 7500, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535561, @@ -235,7 +251,8 @@ "city": "TERUEL", "province": "Teruel", "client": 860, - "salePerson": "MANOLI PULIDO" + "salePerson": "MANOLI PULIDO", + "notes": null }, { "ticket": 1535562, @@ -249,7 +266,8 @@ "city": "MALAGA", "province": "Málaga", "client": 5630, - "salePerson": "MIGUEL ANGEL LAGUNA" + "salePerson": "MIGUEL ANGEL LAGUNA", + "notes": null }, { "ticket": 1535573, @@ -263,7 +281,8 @@ "city": "PALMA", "province": "Baleares (Mallorca)", "client": 6966, - "salePerson": "JULIAN RAMIREZ SAYAGO" + "salePerson": "JULIAN RAMIREZ SAYAGO", + "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535578, @@ -277,7 +296,8 @@ "city": "VILLAMARIN DE VALDEORRAS", "province": "Orense", "client": 6671, - "salePerson": "ESDENKA CALERO PEREZ" + "salePerson": "ESDENKA CALERO PEREZ", + "notes": null }, { "ticket": 1535579, @@ -291,7 +311,8 @@ "city": "MALAGA", "province": "Málaga", "client": 6534, - "salePerson": "JUANLU GALLETERO" + "salePerson": "JUANLU GALLETERO", + "notes": null }, { "ticket": 1535583, @@ -305,7 +326,8 @@ "city": "PALOMARES DEL RIO", "province": "Sevilla", "client": 8506, - "salePerson": "CARLOS ZAMBRANO GARCIA" + "salePerson": "CARLOS ZAMBRANO GARCIA", + "notes": null }, { "ticket": 1535584, @@ -319,7 +341,8 @@ "city": "MARBELLA", "province": "Málaga", "client": 3018, - "salePerson": "JULIAN RAMIREZ SAYAGO" + "salePerson": "JULIAN RAMIREZ SAYAGO", + "notes": null }, { "ticket": 1535589, @@ -333,7 +356,8 @@ "city": "valencia", "province": "Valencia", "client": 3781, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535594, @@ -347,7 +371,8 @@ "city": "BENISSODA", "province": "Valencia", "client": 958, - "salePerson": "JULIAN RAMIREZ SAYAGO" + "salePerson": "JULIAN RAMIREZ SAYAGO", + "notes": null }, { "ticket": 1535597, @@ -361,7 +386,8 @@ "city": "SORIA", "province": "Soria", "client": 2082, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535604, @@ -375,7 +401,8 @@ "city": "MADRID", "province": "Madrid", "client": 5134, - "salePerson": "BEGOÑA RODRIGUEZ" + "salePerson": "BEGOÑA RODRIGUEZ", + "notes": null }, { "ticket": 1535610, @@ -389,7 +416,8 @@ "city": "VILLANUEVA DE LA SERENA", "province": "Badajoz", "client": 2816, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535617, @@ -403,7 +431,8 @@ "city": "TORRENT", "province": "Valencia", "client": 1072, - "salePerson": "OKSANA KHODORIVSKA" + "salePerson": "OKSANA KHODORIVSKA", + "notes": null }, { "ticket": 1535622, @@ -417,7 +446,8 @@ "city": "CALZADA DE CALATRAVA", "province": "Ciudad Real", "client": 3921, - "salePerson": "JAVIER VILAR PASTOR" + "salePerson": "JAVIER VILAR PASTOR", + "notes": null }, { "ticket": 1535624, @@ -431,7 +461,8 @@ "city": "MADRID", "province": "Madrid", "client": 6131, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535631, @@ -445,7 +476,8 @@ "city": "VILASSAR DE MAR", "province": "Barcelona", "client": 4658, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535637, @@ -459,7 +491,8 @@ "city": "FELANITX", "province": "Baleares (Mallorca)", "client": 2477, - "salePerson": "JUANLU GALLETERO" + "salePerson": "JUANLU GALLETERO", + "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535643, @@ -473,7 +506,8 @@ "city": "BURRIAN", "province": "Castellón", "client": 3027, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535644, @@ -487,7 +521,8 @@ "city": "SAN FERNANDO DE HENARES", "province": "Madrid", "client": 3005, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535648, @@ -501,7 +536,8 @@ "city": "CATADAU", "province": "Valencia", "client": 1425, - "salePerson": "BEGOÑA RODRIGUEZ" + "salePerson": "BEGOÑA RODRIGUEZ", + "notes": null }, { "ticket": 1535652, @@ -515,7 +551,8 @@ "city": "PALACIOS Y VILLAFRAN", "province": "Sevilla", "client": 3063, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null }, { "ticket": 1535657, @@ -529,7 +566,8 @@ "city": "PALMA DE GANDIA", "province": "Valencia", "client": 1261, - "salePerson": "BEGOÑA RODRIGUEZ" + "salePerson": "BEGOÑA RODRIGUEZ", + "notes": null }, { "ticket": 1535658, @@ -543,7 +581,8 @@ "city": "GALDACANO", "province": "Vizcaya", "client": 1309, - "salePerson": "BEGOÑA RODRIGUEZ" + "salePerson": "BEGOÑA RODRIGUEZ", + "notes": null }, { "ticket": 1535660, @@ -557,7 +596,8 @@ "city": "CEHEGIN", "province": "Murcia", "client": 178, - "salePerson": "ELENA BASCUÑANA TORNERO" + "salePerson": "ELENA BASCUÑANA TORNERO", + "notes": null }, { "ticket": 1535663, @@ -571,7 +611,8 @@ "city": "ROCIANA DEL CONDADO", "province": "Huelva", "client": 6471, - "salePerson": "Mª CARMEN SERRANO BAU" + "salePerson": "Mª CARMEN SERRANO BAU", + "notes": null }, { "ticket": 1535673, @@ -585,7 +626,8 @@ "city": "CIUDAD RODRIGO", "province": "Salamanca", "client": 7821, - "salePerson": "CRISTINA SANCHEZ BARRUGUER" + "salePerson": "CRISTINA SANCHEZ BARRUGUER", + "notes": null }, { "ticket": 1535678, @@ -599,7 +641,8 @@ "city": "BURRIANA", "province": "Castellón", "client": 3021, - "salePerson": "JESUS DANIEL VALLES PEREZ" + "salePerson": "JESUS DANIEL VALLES PEREZ", + "notes": null }, { "ticket": 1535679, @@ -613,7 +656,8 @@ "city": "MADRID", "province": "Madrid", "client": 3222, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535682, @@ -627,7 +671,8 @@ "city": "PUZOL", "province": "Valencia", "client": 389, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535684, @@ -641,7 +686,8 @@ "city": "MONTSERRAT", "province": "Valencia", "client": 3075, - "salePerson": "GISELA LLOPIS COLOM" + "salePerson": "GISELA LLOPIS COLOM", + "notes": null }, { "ticket": 1535686, @@ -655,7 +701,8 @@ "city": "BARBERA DEL VALLES", "province": "Barcelona", "client": 4631, - "salePerson": "COMPUTER SYSTEM" + "salePerson": "COMPUTER SYSTEM", + "notes": null }, { "ticket": 1535687, @@ -669,7 +716,8 @@ "city": "BECERREA", "province": "Lugo", "client": 5410, - "salePerson": "CARLOS BORRAS MARTINEZ" + "salePerson": "CARLOS BORRAS MARTINEZ", + "notes": null }, { "ticket": 1535690, @@ -683,7 +731,8 @@ "city": "REINOSA", "province": "Cantabria", "client": 4268, - "salePerson": "DAVID SARRION RIVERO" + "salePerson": "DAVID SARRION RIVERO", + "notes": null }, { "ticket": 1535693, @@ -697,7 +746,8 @@ "city": "DAIMIEL", "province": "Ciudad Real", "client": 904, - "salePerson": "RODRIGO HALABI ROCHA" + "salePerson": "RODRIGO HALABI ROCHA", + "notes": null }, { "ticket": 1535694, @@ -711,7 +761,8 @@ "city": "VILLARALBO", "province": "Zamora", "client": 5801, - "salePerson": "CARLOS ZAMBRANO GARCIA" + "salePerson": "CARLOS ZAMBRANO GARCIA", + "notes": null }, { "ticket": 1535699, @@ -725,7 +776,8 @@ "city": "ALCORCON", "province": "Madrid", "client": 422, - "salePerson": "MANOLI PULIDO" + "salePerson": "MANOLI PULIDO", + "notes": null }, { "ticket": 1535702, @@ -739,7 +791,8 @@ "city": "PURULLENA", "province": "Granada", "client": 3224, - "salePerson": "Mª CARMEN SERRANO BAU" + "salePerson": "Mª CARMEN SERRANO BAU", + "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535713, @@ -753,7 +806,8 @@ "city": "TORREJON DE ARDOZ", "province": "Madrid", "client": 680, - "salePerson": "ELENA BASCUÑANA TORNERO" + "salePerson": "ELENA BASCUÑANA TORNERO", + "notes": null }, { "ticket": 1535719, @@ -767,7 +821,8 @@ "city": "RIBADESELLA", "province": "Asturias", "client": 2428, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535720, @@ -781,7 +836,8 @@ "city": "BARCELONA", "province": "Barcelona", "client": 7628, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535724, @@ -795,7 +851,8 @@ "city": "QUART DE POBLET", "province": "Valencia", "client": 326, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535727, @@ -809,7 +866,8 @@ "city": "PALMA MALLORCA", "province": "Baleares (Mallorca)", "client": 3436, - "salePerson": "DEMBA SAKHO" + "salePerson": "DEMBA SAKHO", + "notes": null }, { "ticket": 1535732, @@ -823,7 +881,8 @@ "city": "MADRID", "province": "Madrid", "client": 7303, - "salePerson": "MARIA DEL MAR GIRBES FERRUS" + "salePerson": "MARIA DEL MAR GIRBES FERRUS", + "notes": null }, { "ticket": 1535736, @@ -837,7 +896,8 @@ "city": "SANT JOSEP DE SATALIA", "province": "Baleares (Ibiza)", "client": 3472, - "salePerson": "JUANLU GALLETERO" + "salePerson": "JUANLU GALLETERO", + "notes": null }, { "ticket": 1535737, @@ -851,7 +911,8 @@ "city": "MARCILLA", "province": "Navarra", "client": 957, - "salePerson": "DEBORA SANCHEZ TORIO" + "salePerson": "DEBORA SANCHEZ TORIO", + "notes": null }, { "ticket": 1535742, @@ -865,7 +926,8 @@ "city": "MALAGA", "province": "Málaga", "client": 4812, - "salePerson": "MIGUEL ANGEL LAGUNA" + "salePerson": "MIGUEL ANGEL LAGUNA", + "notes": null }, { "ticket": 1535747, @@ -879,7 +941,8 @@ "city": "SEVILLA", "province": "Sevilla", "client": 4095, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null }, { "ticket": 1535749, @@ -893,7 +956,8 @@ "city": "VIVEIRO", "province": "Lugo", "client": 5928, - "salePerson": "DEBORA SANCHEZ TORIO" + "salePerson": "DEBORA SANCHEZ TORIO", + "notes": null }, { "ticket": 1535751, @@ -907,7 +971,8 @@ "city": "RABADE LUGO", "province": "Lugo", "client": 5652, - "salePerson": "JOSE JULIAN SAEZ FERNANDEZ" + "salePerson": "JOSE JULIAN SAEZ FERNANDEZ", + "notes": null }, { "ticket": 1535756, @@ -921,7 +986,8 @@ "city": "LANDETE", "province": "Cuenca", "client": 3857, - "salePerson": "DAVID SARRION RIVERO" + "salePerson": "DAVID SARRION RIVERO", + "notes": null }, { "ticket": 1535758, @@ -935,7 +1001,8 @@ "city": "LA POBLA DE VALLBONA", "province": "Valencia", "client": 2053, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535765, @@ -949,7 +1016,8 @@ "city": "SANT HIPÒLIT DE VOLTREGÀ", "province": "Barcelona", "client": 5876, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535770, @@ -963,7 +1031,8 @@ "city": "ILLESCAS", "province": "Toledo", "client": 4283, - "salePerson": "DEBORA SANCHEZ TORIO" + "salePerson": "DEBORA SANCHEZ TORIO", + "notes": null }, { "ticket": 1535771, @@ -977,7 +1046,8 @@ "city": "SEVILLA", "province": "Sevilla", "client": 2000, - "salePerson": "JUANLU GALLETERO" + "salePerson": "JUANLU GALLETERO", + "notes": null }, { "ticket": 1535772, @@ -991,7 +1061,8 @@ "city": "SEVILLA", "province": "Sevilla", "client": 2635, - "salePerson": "MARIA JOSE LAMELA FELIPE" + "salePerson": "MARIA JOSE LAMELA FELIPE", + "notes": null }, { "ticket": 1535774, @@ -1005,7 +1076,8 @@ "city": "LEON", "province": "León", "client": 8321, - "salePerson": "JESUS DANIEL VALLES PEREZ" + "salePerson": "JESUS DANIEL VALLES PEREZ", + "notes": null }, { "ticket": 1535775, @@ -1019,7 +1091,8 @@ "city": "PUIG PLAYA", "province": "Valencia", "client": 3781, - "salePerson": "JESUS DANIEL VALLES PEREZ" + "salePerson": "JESUS DANIEL VALLES PEREZ", + "notes": null }, { "ticket": 1535776, @@ -1033,7 +1106,8 @@ "city": "TORREJON DE ARDOZ", "province": "Madrid", "client": 1600, - "salePerson": "CRISTINA SANCHEZ BARRUGUER" + "salePerson": "CRISTINA SANCHEZ BARRUGUER", + "notes": null }, { "ticket": 1535777, @@ -1047,7 +1121,8 @@ "city": "PALENCIA", "province": "Palencia", "client": 3717, - "salePerson": "MANOLI PULIDO" + "salePerson": "MANOLI PULIDO", + "notes": null }, { "ticket": 1535779, @@ -1061,7 +1136,8 @@ "city": "ESLIDA", "province": "Castellón", "client": 7423, - "salePerson": "ELENA BASCUÑANA TORNERO" + "salePerson": "ELENA BASCUÑANA TORNERO", + "notes": null }, { "ticket": 1535899, @@ -1075,7 +1151,8 @@ "city": "MARTORELL", "province": "Barcelona", "client": 4058, - "salePerson": "CLAUDI SANROMA REYNARES" + "salePerson": "CLAUDI SANROMA REYNARES", + "notes": null }, { "ticket": 1535903, @@ -1089,7 +1166,8 @@ "city": "TOLOSA", "province": "Guipuzcoa", "client": 6308, - "salePerson": "SILVERIO DOMINGUEZ" + "salePerson": "SILVERIO DOMINGUEZ", + "notes": null }, { "ticket": 1535905, @@ -1103,7 +1181,8 @@ "city": "MADRID", "province": "Madrid", "client": 3574, - "salePerson": "ELENA BASCUÑANA TORNERO" + "salePerson": "ELENA BASCUÑANA TORNERO", + "notes": null }, { "ticket": 1535908, @@ -1131,7 +1210,8 @@ "city": "INCA", "province": "Baleares (Mallorca)", "client": 6032, - "salePerson": "MIGUEL ANGEL LAGUNA" + "salePerson": "MIGUEL ANGEL LAGUNA", + "notes": null }, { "ticket": 1535912, @@ -1145,7 +1225,8 @@ "city": "VALENCIA", "province": "Valencia", "client": 3613, - "salePerson": "COMPUTER SYSTEM" + "salePerson": "COMPUTER SYSTEM", + "notes": null }, { "ticket": 1535918, @@ -1159,7 +1240,8 @@ "city": "VALENCIA", "province": "Valencia", "client": 2574, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535919, @@ -1173,7 +1255,8 @@ "city": "PALMA", "province": "Baleares (Mallorca)", "client": 7445, - "salePerson": "MARIA DEL MAR GIRBES FERRUS" + "salePerson": "MARIA DEL MAR GIRBES FERRUS", + "notes": null }, { "ticket": 1535920, @@ -1187,7 +1270,8 @@ "city": "Benahavis", "province": "Málaga", "client": 7796, - "salePerson": "JULIA LLOPIS CASTELL" + "salePerson": "JULIA LLOPIS CASTELL", + "notes": null }, { "ticket": 1535921, @@ -1201,7 +1285,8 @@ "city": "SUECA", "province": "Valencia", "client": 1160, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null }, { "ticket": 1535928, @@ -1215,7 +1300,8 @@ "city": "ESCALONA", "province": "Toledo", "client": 2787, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535931, @@ -1229,7 +1315,8 @@ "city": "PARLA", "province": "Madrid", "client": 2725, - "salePerson": "CARLOS ZAMBRANO GARCIA" + "salePerson": "CARLOS ZAMBRANO GARCIA", + "notes": null }, { "ticket": 1535935, @@ -1243,7 +1330,8 @@ "city": "SAN FERNADO DE HENARES", "province": "Madrid", "client": 3240, - "salePerson": 0 + "salePerson": 0, + "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535936, @@ -1257,7 +1345,8 @@ "city": "VINAROS", "province": "Castellón", "client": 768, - "salePerson": "DAVID SARRION RIVERO" + "salePerson": "DAVID SARRION RIVERO", + "notes": null }, { "ticket": 1535938, @@ -1271,7 +1360,8 @@ "city": "VELEZ-MALAGA", "province": "Málaga", "client": 5358, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535941, @@ -1285,7 +1375,8 @@ "city": "HUERCAL DE ALMERIA", "province": "Almería", "client": 475, - "salePerson": "LOLI LOZANO RAEZ" + "salePerson": "LOLI LOZANO RAEZ", + "notes": null }, { "ticket": 1535942, @@ -1299,7 +1390,8 @@ "city": "CHIPIONA", "province": "Cádiz", "client": 1479, - "salePerson": "CARLOS ZAMBRANO GARCIA" + "salePerson": "CARLOS ZAMBRANO GARCIA", + "notes": null }, { "ticket": 1535943, @@ -1313,7 +1405,8 @@ "city": "PALMA DE MALLORCA", "province": "Baleares (Mallorca)", "client": 5840, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535946, @@ -1327,7 +1420,8 @@ "city": "VILASSAR DE MAR", "province": "Barcelona", "client": 3951, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535956, @@ -1341,7 +1435,8 @@ "city": "CATARROJA", "province": "Valencia", "client": 4193, - "salePerson": "JOSE JAVIER ECHEVARRIA" + "salePerson": "JOSE JAVIER ECHEVARRIA", + "notes": null }, { "ticket": 1535957, @@ -1355,7 +1450,8 @@ "city": "BINISSALEM", "province": "Baleares (Mallorca)", "client": 5172, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535960, @@ -1369,7 +1465,8 @@ "city": "BAENA", "province": "Córdoba", "client": 1667, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null }, { "ticket": 1535961, @@ -1383,7 +1480,8 @@ "city": "MADRID", "province": "Madrid", "client": 5762, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535962, @@ -1397,7 +1495,8 @@ "city": "CUEVAS DEL VALLE", "province": "Ávila", "client": 6070, - "salePerson": 0 + "salePerson": 0, + "notes": null }, { "ticket": 1535967, @@ -1411,6 +1510,7 @@ "city": "SEVILLA", "province": "Sevilla", "client": 2000, - "salePerson": "FRAN NATEK ECHEVARRIA" + "salePerson": "FRAN NATEK ECHEVARRIA", + "notes": null } ] \ No newline at end of file From 16302e1f9aa4f1ee8e6894c7321b95f204af369e Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 14 Jun 2017 12:16:53 +0200 Subject: [PATCH 159/391] problemas con riesgo --- .../common/methods/ticket/list-fake.json | 200 +++++++++--------- 1 file changed, 100 insertions(+), 100 deletions(-) diff --git a/services/production/common/methods/ticket/list-fake.json b/services/production/common/methods/ticket/list-fake.json index cda5ae63fb..6cf32bc134 100644 --- a/services/production/common/methods/ticket/list-fake.json +++ b/services/production/common/methods/ticket/list-fake.json @@ -12,7 +12,7 @@ "province": "Cádiz", "client": 7315, "salePerson": "MARIA JOSE LAMELA FELIPE", - "notes": null + "problems": null }, { "ticket": 1535518, @@ -27,7 +27,7 @@ "province": "Teruel", "client": 1911, "salePerson": "JUAN CARLOS LORENZO SANCHEZ", - "notes": null + "problems": null }, { "ticket": 1535519, @@ -42,7 +42,7 @@ "province": "Asturias", "client": 4471, "salePerson": "JOSE JULIAN SAEZ FERNANDEZ", - "notes": null + "problems": null }, { "ticket": 1535521, @@ -57,7 +57,7 @@ "province": "Pontevedra", "client": 5075, "salePerson": "JUAN CARLOS LORENZO SANCHEZ", - "notes": null + "problems": null }, { "ticket": 1535523, @@ -72,7 +72,7 @@ "province": "Granada", "client": 1501, "salePerson": "Mª CARMEN SERRANO BAU", - "notes": null + "problems": null }, { "ticket": 1535524, @@ -87,7 +87,7 @@ "province": "La Coruña", "client": 8002, "salePerson": "COMPUTER SYSTEM", - "notes": null + "problems": null }, { "ticket": 1535526, @@ -102,7 +102,7 @@ "province": "La Rioja", "client": 2197, "salePerson": "RODRIGO HALABI ROCHA", - "notes": null + "problems": null }, { "ticket": 1535531, @@ -117,7 +117,7 @@ "province": "Lleida", "client": 4227, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535544, @@ -132,7 +132,7 @@ "province": "Valencia", "client": 2053, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535548, @@ -147,7 +147,7 @@ "province": "Valencia", "client": 2879, "salePerson": "CONCHA ESTEBAN VILLENA", - "notes": null + "problems": null }, { "ticket": 1535549, @@ -162,7 +162,7 @@ "province": "Granada", "client": 329, "salePerson": "JAVIER VILAR PASTOR", - "notes": null + "problems": null }, { "ticket": 1535555, @@ -177,7 +177,7 @@ "province": "Barcelona", "client": 6945, "salePerson": "COMPUTER SYSTEM", - "notes": null + "problems": null }, { "ticket": 1535557, @@ -192,7 +192,7 @@ "province": "Alicante", "client": 8000, "salePerson": "MARIA DEL MAR GIRBES FERRUS", - "notes": null + "problems": null }, { "ticket": 1535558, @@ -207,7 +207,7 @@ "province": "Castellón", "client": 5377, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535559, @@ -222,7 +222,7 @@ "province": "Madrid", "client": 3574, "salePerson": "ELENA BASCUÑANA TORNERO", - "notes": null + "problems": null }, { "ticket": 1535560, @@ -237,7 +237,7 @@ "province": "Baleares (Mallorca)", "client": 7500, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535561, @@ -252,7 +252,7 @@ "province": "Teruel", "client": 860, "salePerson": "MANOLI PULIDO", - "notes": null + "problems": null }, { "ticket": 1535562, @@ -267,7 +267,7 @@ "province": "Málaga", "client": 5630, "salePerson": "MIGUEL ANGEL LAGUNA", - "notes": null + "problems": null }, { "ticket": 1535573, @@ -282,7 +282,7 @@ "province": "Baleares (Mallorca)", "client": 6966, "salePerson": "JULIAN RAMIREZ SAYAGO", - "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " + "problems": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535578, @@ -297,7 +297,7 @@ "province": "Orense", "client": 6671, "salePerson": "ESDENKA CALERO PEREZ", - "notes": null + "problems": null }, { "ticket": 1535579, @@ -312,7 +312,7 @@ "province": "Málaga", "client": 6534, "salePerson": "JUANLU GALLETERO", - "notes": null + "problems": null }, { "ticket": 1535583, @@ -327,7 +327,7 @@ "province": "Sevilla", "client": 8506, "salePerson": "CARLOS ZAMBRANO GARCIA", - "notes": null + "problems": null }, { "ticket": 1535584, @@ -342,7 +342,7 @@ "province": "Málaga", "client": 3018, "salePerson": "JULIAN RAMIREZ SAYAGO", - "notes": null + "problems": null }, { "ticket": 1535589, @@ -357,7 +357,7 @@ "province": "Valencia", "client": 3781, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535594, @@ -372,7 +372,7 @@ "province": "Valencia", "client": 958, "salePerson": "JULIAN RAMIREZ SAYAGO", - "notes": null + "problems": null }, { "ticket": 1535597, @@ -387,7 +387,7 @@ "province": "Soria", "client": 2082, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535604, @@ -402,7 +402,7 @@ "province": "Madrid", "client": 5134, "salePerson": "BEGOÑA RODRIGUEZ", - "notes": null + "problems": null }, { "ticket": 1535610, @@ -417,7 +417,7 @@ "province": "Badajoz", "client": 2816, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535617, @@ -432,7 +432,7 @@ "province": "Valencia", "client": 1072, "salePerson": "OKSANA KHODORIVSKA", - "notes": null + "problems": null }, { "ticket": 1535622, @@ -447,7 +447,7 @@ "province": "Ciudad Real", "client": 3921, "salePerson": "JAVIER VILAR PASTOR", - "notes": null + "problems": "RIESGO" }, { "ticket": 1535624, @@ -462,7 +462,7 @@ "province": "Madrid", "client": 6131, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535631, @@ -477,7 +477,7 @@ "province": "Barcelona", "client": 4658, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535637, @@ -492,7 +492,7 @@ "province": "Baleares (Mallorca)", "client": 2477, "salePerson": "JUANLU GALLETERO", - "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " + "problems": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535643, @@ -507,7 +507,7 @@ "province": "Castellón", "client": 3027, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535644, @@ -522,7 +522,7 @@ "province": "Madrid", "client": 3005, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535648, @@ -537,7 +537,7 @@ "province": "Valencia", "client": 1425, "salePerson": "BEGOÑA RODRIGUEZ", - "notes": null + "problems": null }, { "ticket": 1535652, @@ -552,7 +552,7 @@ "province": "Sevilla", "client": 3063, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535657, @@ -567,7 +567,7 @@ "province": "Valencia", "client": 1261, "salePerson": "BEGOÑA RODRIGUEZ", - "notes": null + "problems": null }, { "ticket": 1535658, @@ -582,7 +582,7 @@ "province": "Vizcaya", "client": 1309, "salePerson": "BEGOÑA RODRIGUEZ", - "notes": null + "problems": null }, { "ticket": 1535660, @@ -597,7 +597,7 @@ "province": "Murcia", "client": 178, "salePerson": "ELENA BASCUÑANA TORNERO", - "notes": null + "problems": null }, { "ticket": 1535663, @@ -612,7 +612,7 @@ "province": "Huelva", "client": 6471, "salePerson": "Mª CARMEN SERRANO BAU", - "notes": null + "problems": null }, { "ticket": 1535673, @@ -627,7 +627,7 @@ "province": "Salamanca", "client": 7821, "salePerson": "CRISTINA SANCHEZ BARRUGUER", - "notes": null + "problems": null }, { "ticket": 1535678, @@ -642,7 +642,7 @@ "province": "Castellón", "client": 3021, "salePerson": "JESUS DANIEL VALLES PEREZ", - "notes": null + "problems": null }, { "ticket": 1535679, @@ -657,7 +657,7 @@ "province": "Madrid", "client": 3222, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535682, @@ -672,7 +672,7 @@ "province": "Valencia", "client": 389, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535684, @@ -687,7 +687,7 @@ "province": "Valencia", "client": 3075, "salePerson": "GISELA LLOPIS COLOM", - "notes": null + "problems": null }, { "ticket": 1535686, @@ -702,7 +702,7 @@ "province": "Barcelona", "client": 4631, "salePerson": "COMPUTER SYSTEM", - "notes": null + "problems": null }, { "ticket": 1535687, @@ -717,7 +717,7 @@ "province": "Lugo", "client": 5410, "salePerson": "CARLOS BORRAS MARTINEZ", - "notes": null + "problems": null }, { "ticket": 1535690, @@ -732,7 +732,7 @@ "province": "Cantabria", "client": 4268, "salePerson": "DAVID SARRION RIVERO", - "notes": null + "problems": null }, { "ticket": 1535693, @@ -747,7 +747,7 @@ "province": "Ciudad Real", "client": 904, "salePerson": "RODRIGO HALABI ROCHA", - "notes": null + "problems": null }, { "ticket": 1535694, @@ -762,7 +762,7 @@ "province": "Zamora", "client": 5801, "salePerson": "CARLOS ZAMBRANO GARCIA", - "notes": null + "problems": null }, { "ticket": 1535699, @@ -777,7 +777,7 @@ "province": "Madrid", "client": 422, "salePerson": "MANOLI PULIDO", - "notes": null + "problems": null }, { "ticket": 1535702, @@ -792,7 +792,7 @@ "province": "Granada", "client": 3224, "salePerson": "Mª CARMEN SERRANO BAU", - "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " + "problems": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535713, @@ -807,7 +807,7 @@ "province": "Madrid", "client": 680, "salePerson": "ELENA BASCUÑANA TORNERO", - "notes": null + "problems": "RIESGO" }, { "ticket": 1535719, @@ -822,7 +822,7 @@ "province": "Asturias", "client": 2428, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535720, @@ -837,7 +837,7 @@ "province": "Barcelona", "client": 7628, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535724, @@ -852,7 +852,7 @@ "province": "Valencia", "client": 326, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535727, @@ -867,7 +867,7 @@ "province": "Baleares (Mallorca)", "client": 3436, "salePerson": "DEMBA SAKHO", - "notes": null + "problems": null }, { "ticket": 1535732, @@ -882,7 +882,7 @@ "province": "Madrid", "client": 7303, "salePerson": "MARIA DEL MAR GIRBES FERRUS", - "notes": null + "problems": null }, { "ticket": 1535736, @@ -897,7 +897,7 @@ "province": "Baleares (Ibiza)", "client": 3472, "salePerson": "JUANLU GALLETERO", - "notes": null + "problems": null }, { "ticket": 1535737, @@ -912,7 +912,7 @@ "province": "Navarra", "client": 957, "salePerson": "DEBORA SANCHEZ TORIO", - "notes": null + "problems": null }, { "ticket": 1535742, @@ -927,7 +927,7 @@ "province": "Málaga", "client": 4812, "salePerson": "MIGUEL ANGEL LAGUNA", - "notes": null + "problems": null }, { "ticket": 1535747, @@ -942,7 +942,7 @@ "province": "Sevilla", "client": 4095, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535749, @@ -957,7 +957,7 @@ "province": "Lugo", "client": 5928, "salePerson": "DEBORA SANCHEZ TORIO", - "notes": null + "problems": null }, { "ticket": 1535751, @@ -972,7 +972,7 @@ "province": "Lugo", "client": 5652, "salePerson": "JOSE JULIAN SAEZ FERNANDEZ", - "notes": null + "problems": null }, { "ticket": 1535756, @@ -987,7 +987,7 @@ "province": "Cuenca", "client": 3857, "salePerson": "DAVID SARRION RIVERO", - "notes": null + "problems": null }, { "ticket": 1535758, @@ -1002,7 +1002,7 @@ "province": "Valencia", "client": 2053, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535765, @@ -1017,7 +1017,7 @@ "province": "Barcelona", "client": 5876, "salePerson": 0, - "notes": null + "problems": "RIESGO" }, { "ticket": 1535770, @@ -1032,7 +1032,7 @@ "province": "Toledo", "client": 4283, "salePerson": "DEBORA SANCHEZ TORIO", - "notes": null + "problems": null }, { "ticket": 1535771, @@ -1047,7 +1047,7 @@ "province": "Sevilla", "client": 2000, "salePerson": "JUANLU GALLETERO", - "notes": null + "problems": null }, { "ticket": 1535772, @@ -1062,7 +1062,7 @@ "province": "Sevilla", "client": 2635, "salePerson": "MARIA JOSE LAMELA FELIPE", - "notes": null + "problems": null }, { "ticket": 1535774, @@ -1077,7 +1077,7 @@ "province": "León", "client": 8321, "salePerson": "JESUS DANIEL VALLES PEREZ", - "notes": null + "problems": null }, { "ticket": 1535775, @@ -1092,7 +1092,7 @@ "province": "Valencia", "client": 3781, "salePerson": "JESUS DANIEL VALLES PEREZ", - "notes": null + "problems": null }, { "ticket": 1535776, @@ -1107,7 +1107,7 @@ "province": "Madrid", "client": 1600, "salePerson": "CRISTINA SANCHEZ BARRUGUER", - "notes": null + "problems": null }, { "ticket": 1535777, @@ -1122,7 +1122,7 @@ "province": "Palencia", "client": 3717, "salePerson": "MANOLI PULIDO", - "notes": null + "problems": null }, { "ticket": 1535779, @@ -1137,7 +1137,7 @@ "province": "Castellón", "client": 7423, "salePerson": "ELENA BASCUÑANA TORNERO", - "notes": null + "problems": null }, { "ticket": 1535899, @@ -1152,7 +1152,7 @@ "province": "Barcelona", "client": 4058, "salePerson": "CLAUDI SANROMA REYNARES", - "notes": null + "problems": null }, { "ticket": 1535903, @@ -1167,7 +1167,7 @@ "province": "Guipuzcoa", "client": 6308, "salePerson": "SILVERIO DOMINGUEZ", - "notes": null + "problems": null }, { "ticket": 1535905, @@ -1182,7 +1182,7 @@ "province": "Madrid", "client": 3574, "salePerson": "ELENA BASCUÑANA TORNERO", - "notes": null + "problems": null }, { "ticket": 1535908, @@ -1211,7 +1211,7 @@ "province": "Baleares (Mallorca)", "client": 6032, "salePerson": "MIGUEL ANGEL LAGUNA", - "notes": null + "problems": null }, { "ticket": 1535912, @@ -1226,7 +1226,7 @@ "province": "Valencia", "client": 3613, "salePerson": "COMPUTER SYSTEM", - "notes": null + "problems": null }, { "ticket": 1535918, @@ -1241,7 +1241,7 @@ "province": "Valencia", "client": 2574, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535919, @@ -1256,7 +1256,7 @@ "province": "Baleares (Mallorca)", "client": 7445, "salePerson": "MARIA DEL MAR GIRBES FERRUS", - "notes": null + "problems": null }, { "ticket": 1535920, @@ -1271,7 +1271,7 @@ "province": "Málaga", "client": 7796, "salePerson": "JULIA LLOPIS CASTELL", - "notes": null + "problems": null }, { "ticket": 1535921, @@ -1286,7 +1286,7 @@ "province": "Valencia", "client": 1160, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535928, @@ -1301,7 +1301,7 @@ "province": "Toledo", "client": 2787, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535931, @@ -1316,7 +1316,7 @@ "province": "Madrid", "client": 2725, "salePerson": "CARLOS ZAMBRANO GARCIA", - "notes": null + "problems": "RIESGO" }, { "ticket": 1535935, @@ -1331,7 +1331,7 @@ "province": "Madrid", "client": 3240, "salePerson": 0, - "notes": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " + "problems": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non mattis ante. Curabitur id malesuada sapien. Praesent convallis erat id. " }, { "ticket": 1535936, @@ -1346,7 +1346,7 @@ "province": "Castellón", "client": 768, "salePerson": "DAVID SARRION RIVERO", - "notes": null + "problems": null }, { "ticket": 1535938, @@ -1361,7 +1361,7 @@ "province": "Málaga", "client": 5358, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535941, @@ -1376,7 +1376,7 @@ "province": "Almería", "client": 475, "salePerson": "LOLI LOZANO RAEZ", - "notes": null + "problems": null }, { "ticket": 1535942, @@ -1391,7 +1391,7 @@ "province": "Cádiz", "client": 1479, "salePerson": "CARLOS ZAMBRANO GARCIA", - "notes": null + "problems": null }, { "ticket": 1535943, @@ -1406,7 +1406,7 @@ "province": "Baleares (Mallorca)", "client": 5840, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535946, @@ -1421,7 +1421,7 @@ "province": "Barcelona", "client": 3951, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535956, @@ -1436,7 +1436,7 @@ "province": "Valencia", "client": 4193, "salePerson": "JOSE JAVIER ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535957, @@ -1451,7 +1451,7 @@ "province": "Baleares (Mallorca)", "client": 5172, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535960, @@ -1466,7 +1466,7 @@ "province": "Córdoba", "client": 1667, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null }, { "ticket": 1535961, @@ -1481,7 +1481,7 @@ "province": "Madrid", "client": 5762, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535962, @@ -1496,7 +1496,7 @@ "province": "Ávila", "client": 6070, "salePerson": 0, - "notes": null + "problems": null }, { "ticket": 1535967, @@ -1511,6 +1511,6 @@ "province": "Sevilla", "client": 2000, "salePerson": "FRAN NATEK ECHEVARRIA", - "notes": null + "problems": null } ] \ No newline at end of file From 699635202922e2d43668a187f9538db4dcc28855 Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 14 Jun 2017 12:55:10 +0200 Subject: [PATCH 160/391] get warehouses --- .../methods/warehouse/list-warehouses.js | 24 +++++++++++++ .../production/common/models/warehouse.js | 9 +++++ .../production/common/models/warehouse.json | 35 +++++++++++++++++++ services/production/server/model-config.json | 4 +++ 4 files changed, 72 insertions(+) create mode 100644 services/production/common/methods/warehouse/list-warehouses.js create mode 100644 services/production/common/models/warehouse.js create mode 100644 services/production/common/models/warehouse.json diff --git a/services/production/common/methods/warehouse/list-warehouses.js b/services/production/common/methods/warehouse/list-warehouses.js new file mode 100644 index 0000000000..326244943d --- /dev/null +++ b/services/production/common/methods/warehouse/list-warehouses.js @@ -0,0 +1,24 @@ +module.exports = function(Warehouse) { + Warehouse.remoteMethod('list', { + description: 'List production warehouses', + returns: { + arg: 'warehouses', + type: 'object' + }, + http: { + verb: 'get', + path: '/list' + } + }); + + Warehouse.list = function(cb) { + Warehouse.find(where(), function(err, warehouses){ + if(!err) + cb(null, warehouses); + }); + }; + + var where = function(){ + return {"where": {"tpv": {"neq": 0}}} + } +} \ No newline at end of file diff --git a/services/production/common/models/warehouse.js b/services/production/common/models/warehouse.js new file mode 100644 index 0000000000..b46253ae1c --- /dev/null +++ b/services/production/common/models/warehouse.js @@ -0,0 +1,9 @@ +var app = require('../../server/server'); + +module.exports = function(Warehouse) { + var models = app.models; + + // Methods + + require('../methods/warehouse/list-warehouses.js')(Warehouse); +}; \ No newline at end of file diff --git a/services/production/common/models/warehouse.json b/services/production/common/models/warehouse.json new file mode 100644 index 0000000000..2089140855 --- /dev/null +++ b/services/production/common/models/warehouse.json @@ -0,0 +1,35 @@ +{ + "name": "Warehouse", + "base": "MyModel", + "validateUpsert": true, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "name": { + "type": "String" + }, + "tpv": { + "type": "Number" + }, + "inventary": { + "type": "Number" + } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "DENY" + }, + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "root", + "permission": "ALLOW" + } + ] +} diff --git a/services/production/server/model-config.json b/services/production/server/model-config.json index 7f29155b0a..edfa734b53 100644 --- a/services/production/server/model-config.json +++ b/services/production/server/model-config.json @@ -52,5 +52,9 @@ "TicketState":{ "dataSource": "vn", "public": true + }, + "Warehouse":{ + "dataSource": "vn", + "public": true } } From 18ff74b17f988ea3f81724bd76b9bb144da946bd Mon Sep 17 00:00:00 2001 From: nelo Date: Wed, 14 Jun 2017 14:27:16 +0200 Subject: [PATCH 161/391] get user and employee --- services/client/common/models/my-model.js | 5 +++-- .../production/common/methods/ticket-state/change-state.js | 6 +++--- services/production/common/models/my-model.js | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/services/client/common/models/my-model.js b/services/client/common/models/my-model.js index bfa55efbd4..9246e02a94 100644 --- a/services/client/common/models/my-model.js +++ b/services/client/common/models/my-model.js @@ -1,3 +1,6 @@ +let loopBackContext = require('loopback-context'); +let app = require('../../server/server'); + module.exports = function(self) { self.setup = function() { @@ -28,14 +31,12 @@ module.exports = function(self) { }; self.getUser = function() { - let loopBackContext = require('loopback-context'); let currentUser = loopBackContext.getCurrentContext(); let userId = currentUser.get('currentUser'); return userId; }; self.getEmployee = function() { - let app = require('../../server/server'); let userId = self.getUser(); let employee = app.models.Employee; return employee.findOne({where: {userFk: userId}}); diff --git a/services/production/common/methods/ticket-state/change-state.js b/services/production/common/methods/ticket-state/change-state.js index c778330c70..90f2f041de 100644 --- a/services/production/common/methods/ticket-state/change-state.js +++ b/services/production/common/methods/ticket-state/change-state.js @@ -28,12 +28,11 @@ module.exports = function(TicketState) { }); TicketState.changeState = function(tickets, state, cb) { - TicketState.getEmployee().then(function(emp){ - changeState(emp, tickets, state, cb); + icketState.getEmployee().then(function(emp){ + changeState(emp, tickets, state, cb); }); }; - var changeState = function(emp, tickets, state, cb){ var inserts = []; @@ -47,4 +46,5 @@ module.exports = function(TicketState) { }); } + } \ No newline at end of file diff --git a/services/production/common/models/my-model.js b/services/production/common/models/my-model.js index bfa55efbd4..9246e02a94 100644 --- a/services/production/common/models/my-model.js +++ b/services/production/common/models/my-model.js @@ -1,3 +1,6 @@ +let loopBackContext = require('loopback-context'); +let app = require('../../server/server'); + module.exports = function(self) { self.setup = function() { @@ -28,14 +31,12 @@ module.exports = function(self) { }; self.getUser = function() { - let loopBackContext = require('loopback-context'); let currentUser = loopBackContext.getCurrentContext(); let userId = currentUser.get('currentUser'); return userId; }; self.getEmployee = function() { - let app = require('../../server/server'); let userId = self.getUser(); let employee = app.models.Employee; return employee.findOne({where: {userFk: userId}}); From 9072b100f9be4513c824705de089f9bb707eab98 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 15 Jun 2017 07:45:01 +0200 Subject: [PATCH 162/391] tooltip admite plantilla html, icon-menu forzado de posicion en dropDown --- client/core/src/drop-down/drop-down.js | 19 ++- client/core/src/icon-menu/icon-menu.html | 2 +- client/core/src/icon-menu/icon-menu.js | 15 ++- client/core/src/tooltip/tooltip.js | 120 +++++++++++------- client/production/src/index/index.html | 10 +- .../src/index/more-info-tooltip.tpl.html | 28 ++-- client/salix/src/styles/colors.scss | 3 +- client/salix/src/styles/misc.scss | 27 +++- gulpfile.js | 2 +- 9 files changed, 146 insertions(+), 80 deletions(-) diff --git a/client/core/src/drop-down/drop-down.js b/client/core/src/drop-down/drop-down.js index c33aea7b5e..c40d286726 100644 --- a/client/core/src/drop-down/drop-down.js +++ b/client/core/src/drop-down/drop-down.js @@ -1,16 +1,27 @@ import {module} from '../module'; import './style.scss'; -/* export default class DropDown { -}*/ +export default class DropDown { + constructor($element, $window) { + this.$element = $element; + this.$window = $window; + } + $onChanges(changesObj) { + if (changesObj.show && changesObj.top && changesObj.top.currentValue) { + this.$element.css('top', changesObj.top.currentValue + 'px'); + } + } +} +DropDown.$inject = ['$element', '$window']; module.component('vnDropDown', { template: require('./drop-down.html'), - // controller: DropDown, + controller: DropDown, bindings: { items: '<', show: '<', - selected: '=' + selected: '=', + top: ' - + \ No newline at end of file diff --git a/client/core/src/icon-menu/icon-menu.js b/client/core/src/icon-menu/icon-menu.js index d1119bedbc..2a521ce4f2 100644 --- a/client/core/src/icon-menu/icon-menu.js +++ b/client/core/src/icon-menu/icon-menu.js @@ -6,6 +6,7 @@ export default class IconMenu { this.$http = $http; this.$timeout = $timeout; this._showDropDown = false; + this._pos = undefined; } get showDropDown() { return this._showDropDown; @@ -14,6 +15,13 @@ export default class IconMenu { this._showDropDown = value; } + get pos() { + return this._pos; + } + set pos(value) { + this._pos = value; + } + getItems() { this.$http.get(this.url).then( json => { @@ -26,9 +34,10 @@ export default class IconMenu { this.getItems(); } - this.$element.bind('mouseover', () => { + this.$element.bind('mouseover', e => { this.$timeout(() => { this.showDropDown = true; + this.pos = e.target.getBoundingClientRect(); }); }); @@ -38,6 +47,10 @@ export default class IconMenu { }); }); } + $onDestroy() { + this.$element.unbind('mouseover'); + this.$element.unbind('mouseout'); + } } IconMenu.$inject = ['$element', '$http', '$timeout']; diff --git a/client/core/src/tooltip/tooltip.js b/client/core/src/tooltip/tooltip.js index ff3f7472ff..4842979770 100644 --- a/client/core/src/tooltip/tooltip.js +++ b/client/core/src/tooltip/tooltip.js @@ -1,12 +1,18 @@ import {module} from '../module'; import './style.css'; -tooltip.$inject = ['$document', '$compile', '$sce', '$templateCache', '$http']; -function tooltip($document, $compile, $sce, $templateCache, $http) { - function getTemplate(tooltipTemplateUrl) { +tooltip.$inject = ['$document', '$compile', '$interpolate', '$sce', '$templateCache', '$http', '$q']; +function tooltip($document, $compile, $interpolate, $sce, $templateCache, $http, $q) { + var promise; + + function _getTemplate(tooltipTemplateUrl) { var template = $templateCache.get(tooltipTemplateUrl); if (typeof template === 'undefined') { template = $http.get(tooltipTemplateUrl).then(function onGetTemplateSuccess(response) { + if (promise) { + promise.resolve(response.data); + } + promise = undefined; return response.data; }); $templateCache.put(tooltipTemplateUrl, template); @@ -14,11 +20,23 @@ function tooltip($document, $compile, $sce, $templateCache, $http) { return template; } + function getTemplate(tooltipTemplateUrl) { + var _promise = $q.defer(); + var template = _getTemplate(tooltipTemplateUrl); + if (template) { + _promise.resolve(template); + } else { + promise = _promise; + } + return _promise.promise; + } + return { restrict: 'A', priority: -1, link: function(scope, element, attrs) { - var tip = $compile('
    {{ text }}
    ')(scope); + var tipHtml = '
    {{text}}
    '; + var tip; var tipClassName = 'tooltip'; var tipActiveClassName = 'tooltip-show'; @@ -28,13 +46,17 @@ function tooltip($document, $compile, $sce, $templateCache, $http) { if (attrs.tooltipHtml) { scope.isHtmlContent = true; scope.htmlContent = $sce.trustAsHtml(attrs.tooltipHtml); + _compileTip(); } else if (attrs.tooltipTemplate) { - var template = getTemplate(attrs.tooltipTemplate); - scope.isHtmlContent = true; - scope.htmlContent = $sce.trustAsHtml(template); + getTemplate(attrs.tooltipTemplate).then(template => { + scope.isHtmlContent = true; + scope.htmlContent = $sce.trustAsHtml($interpolate(template)(scope)); + _compileTip(); + }); } else { scope.isHtmlContent = false; scope.htmlContent = null; + _compileTip(); } if (attrs.tooltipPosition) { @@ -43,53 +65,59 @@ function tooltip($document, $compile, $sce, $templateCache, $http) { scope.tipClass.push('tooltip-down'); } - $document.find('body').append(tip); + function _compileTip() { + tip = $compile(tipHtml)(scope); + $document.find('body').append(tip); + _bindEvents(); + } - element.bind('mouseover', function(e) { - tip.addClass(tipActiveClassName); + function _bindEvents() { + element.bind('mouseover', function(e) { + tip.addClass(tipActiveClassName); - let pos = e.target.getBoundingClientRect(); - let tipPos = tip[0].getBoundingClientRect(); - let offset = {top: 0, left: 0}; - let tipWidth = tipPos.width || tipPos.right - tipPos.left; - let tipHeight = tipPos.height || tipPos.bottom - tipPos.top; - let elWidth = pos.width || pos.right - pos.left; - let elHeight = pos.height || pos.bottom - pos.top; - let tipOffset = 10; + let pos = e.target.getBoundingClientRect(); + let tipPos = tip[0].getBoundingClientRect(); + let offset = {top: 0, left: 0}; + let tipWidth = tipPos.width || tipPos.right - tipPos.left; + let tipHeight = tipPos.height || tipPos.bottom - tipPos.top; + let elWidth = pos.width || pos.right - pos.left; + let elHeight = pos.height || pos.bottom - pos.top; + let tipOffset = 10; - if (tip.hasClass('tooltip-right')) { - offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); - offset.left = pos.right + tipOffset; - } else if (tip.hasClass('tooltip-left')) { - offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); - offset.left = pos.left - tipWidth - tipOffset; - } else if (tip.hasClass('tooltip-down')) { - offset.top = pos.top + elHeight + tipOffset; - offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); - } else { - offset.top = pos.top - tipHeight - tipOffset; - offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); - } + if (tip.hasClass('tooltip-right')) { + offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); + offset.left = pos.right + tipOffset; + } else if (tip.hasClass('tooltip-left')) { + offset.top = pos.top - (tipHeight / 2) + (elHeight / 2); + offset.left = pos.left - tipWidth - tipOffset; + } else if (tip.hasClass('tooltip-down')) { + offset.top = pos.top + elHeight + tipOffset; + offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); + } else { + offset.top = pos.top - tipHeight - tipOffset; + offset.left = pos.left - (tipWidth / 2) + (elWidth / 2); + } - tip.css('top', offset.top + 'px'); - tip.css('left', offset.left + 'px'); - }); + tip.css('top', offset.top + 'px'); + tip.css('left', offset.left + 'px'); + }); - element.on('mouseout', function() { - tip.removeClass(tipActiveClassName); - }); + element.on('mouseout', function() { + tip.removeClass(tipActiveClassName); + }); - tip.on('mouseover', function() { - tip.addClass(tipActiveClassName); - }); + tip.on('mouseover', function() { + tip.addClass(tipActiveClassName); + }); - tip.on('mouseout', function() { - tip.removeClass(tipActiveClassName); - }); + tip.on('mouseout', function() { + tip.removeClass(tipActiveClassName); + }); - element.on('$destroy', function() { - tip.remove(); - }); + element.on('$destroy', function() { + tip.remove(); + }); + } } }; } diff --git a/client/production/src/index/index.html b/client/production/src/index/index.html index e132f00336..44e0d3f5a8 100644 --- a/client/production/src/index/index.html +++ b/client/production/src/index/index.html @@ -49,7 +49,7 @@ - + @@ -57,23 +57,23 @@
    - + - + {{::ticket.ticket}} {{::ticket.agency}} - {{::ticket.worker | ucwords}} + {{::ticket.salePerson | ucwords}} {{::ticket.hour}} {{ticket.state}} {{::ticket.lines}} {{::ticket.m3}} {{::ticket.boxes}} - + diff --git a/client/production/src/index/more-info-tooltip.tpl.html b/client/production/src/index/more-info-tooltip.tpl.html index 085187043c..e7cfddc507 100644 --- a/client/production/src/index/more-info-tooltip.tpl.html +++ b/client/production/src/index/more-info-tooltip.tpl.html @@ -1,18 +1,14 @@ - - - Población - Provincia - ID_Cliente - Comercial - - - - - {{ticket.city}} - {{ticket.province}} - {{ticket.client}} - {{ticket.salePerson}} - - + + Población + Provincia + ID_Cliente + Comercial + + + {{::ticket.city | ucwords}} + {{::ticket.province | ucwords}} + {{::ticket.client}} + {{::ticket.salePerson | ucwords}} + \ No newline at end of file diff --git a/client/salix/src/styles/colors.scss b/client/salix/src/styles/colors.scss index 9638ac0c87..dc939d113d 100644 --- a/client/salix/src/styles/colors.scss +++ b/client/salix/src/styles/colors.scss @@ -4,4 +4,5 @@ $color-orange: rgb(255,171,64); $color-white: white; $color-dark: #3c393b; $color-dark-grey: #424242; -$color-light-grey: #e6e6e6; \ No newline at end of file +$color-light-grey: #e6e6e6; +$color-medium-grey: #9D9D9D; \ No newline at end of file diff --git a/client/salix/src/styles/misc.scss b/client/salix/src/styles/misc.scss index 604e40d51b..2823fe4eab 100644 --- a/client/salix/src/styles/misc.scss +++ b/client/salix/src/styles/misc.scss @@ -1,5 +1,6 @@ @import "padding"; @import "margin"; +@import "colors"; .form { height: 100%; @@ -38,12 +39,12 @@ html [vn-left], .vn-left{ } .list-header{ - border-bottom: 3px solid #9D9D9D; + border-bottom: 3px solid $color-medium-grey; font-weight: bold; } .list-footer{ - border-top: 3px solid #9D9D9D; + border-top: 3px solid $color-medium-grey; font-weight: bold; } .list > vn-one, .list > [vn-one], .list > [vn-two], .list > vn-two{ @@ -54,9 +55,25 @@ html [vn-left], .vn-left{ } .list-body{ padding: 4px 0px; - border-bottom: 1px solid #9D9D9D; - + border-bottom: 1px solid $color-medium-grey; i { - color: #ffa410; + color: $color-orange; + } +} +.list-body:last-child{ + border: none; +} +.list-body.warning{ + background-color: $color-orange; + color:$color-white; + font-weight: bold; + i { + color: $color-white; + } + .mdl-checkbox.is-checked .mdl-checkbox__box-outline{ + border-color: $color-white; + } + .mdl-checkbox.is-checked .mdl-checkbox__tick-outline{ + background-color: $color-white; } } \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 5722981c0a..057483795c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -58,7 +58,7 @@ gulp.task('services', ['copy'], function() { }); gulp.task('clean', function() { - return del(`${buildDir}/*`, {force: true}); + return del([`${buildDir}/*`, `!${buildDir}/templates`], {force: true}); }); // Spliting From f346e5e83c4300cd30411c6f4cbfc4028e3fbb28 Mon Sep 17 00:00:00 2001 From: Dani Herrero Date: Thu, 15 Jun 2017 08:26:03 +0200 Subject: [PATCH 163/391] arreglos en drop-down --- client/core/src/drop-down/drop-down.html | 4 ++-- client/core/src/drop-down/drop-down.js | 3 +-- client/core/src/icon-menu/icon-menu.js | 3 ++- client/production/src/index/index.html | 10 +++------- .../src/index/more-info-tooltip.tpl.html | 14 -------------- 5 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 client/production/src/index/more-info-tooltip.tpl.html diff --git a/client/core/src/drop-down/drop-down.html b/client/core/src/drop-down/drop-down.html index 4b354ae623..c448520fa9 100644 --- a/client/core/src/drop-down/drop-down.html +++ b/client/core/src/drop-down/drop-down.html @@ -1,3 +1,3 @@ -