From 10d191544ef5d6c00273d824367f3dc933eb0a8d Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 13 Nov 2018 07:44:03 +0100 Subject: [PATCH] added travel service --- client/modules.yml | 1 + client/salix/src/locale/es.yml | 3 +- client/spliting.js | 4 +- client/travel/index.js | 1 + client/travel/routes.json | 22 ++++++++ client/travel/src/index.js | 4 ++ client/travel/src/index/index.html | 59 ++++++++++++++++++++ client/travel/src/index/index.js | 52 +++++++++++++++++ client/travel/src/locale/es.yml | 13 +++++ client/travel/src/module.js | 5 ++ client/travel/src/search-panel/index.html | 52 +++++++++++++++++ client/travel/src/search-panel/index.js | 7 +++ client/travel/src/search-panel/locale/es.yml | 7 +++ services/travel/Dockerfile | 6 ++ services/travel/common/locale/es.json | 1 + services/travel/common/models/travel.json | 48 ++++++++++++++++ services/travel/package.json | 18 ++++++ services/travel/server/model-config.json | 5 ++ services/travel/server/server.js | 4 ++ 19 files changed, 310 insertions(+), 2 deletions(-) create mode 100644 client/travel/index.js create mode 100644 client/travel/routes.json create mode 100644 client/travel/src/index.js create mode 100644 client/travel/src/index/index.html create mode 100644 client/travel/src/index/index.js create mode 100644 client/travel/src/locale/es.yml create mode 100644 client/travel/src/module.js create mode 100644 client/travel/src/search-panel/index.html create mode 100644 client/travel/src/search-panel/index.js create mode 100644 client/travel/src/search-panel/locale/es.yml create mode 100644 services/travel/Dockerfile create mode 100644 services/travel/common/locale/es.json create mode 100644 services/travel/common/models/travel.json create mode 100644 services/travel/package.json create mode 100644 services/travel/server/model-config.json create mode 100644 services/travel/server/server.js diff --git a/client/modules.yml b/client/modules.yml index a656e2e5d..abcd1eace 100644 --- a/client/modules.yml +++ b/client/modules.yml @@ -8,3 +8,4 @@ order: [item, ticket] claim: [item, client] route: [] agency: [] +travel: [] diff --git a/client/salix/src/locale/es.yml b/client/salix/src/locale/es.yml index 69446f9ef..308d0d937 100644 --- a/client/salix/src/locale/es.yml +++ b/client/salix/src/locale/es.yml @@ -26,4 +26,5 @@ Routes: Rutas What is new: Novedades de la versión Web Account inactive: Sin acceso Web Orders: Pedidos -Agencies: Agencias \ No newline at end of file +Agencies: Agencias +Travels: Envíos diff --git a/client/spliting.js b/client/spliting.js index adbbc18f6..6601929e4 100644 --- a/client/spliting.js +++ b/client/spliting.js @@ -12,5 +12,7 @@ export default { claim: cb => require.ensure([], () => cb(require('claim'))), agency: - cb => require.ensure([], () => cb(require('agency'))) + cb => require.ensure([], () => cb(require('agency'))), + travel: + cb => require.ensure([], () => cb(require('travel'))) }; diff --git a/client/travel/index.js b/client/travel/index.js new file mode 100644 index 000000000..8420b1093 --- /dev/null +++ b/client/travel/index.js @@ -0,0 +1 @@ +export * from './src'; diff --git a/client/travel/routes.json b/client/travel/routes.json new file mode 100644 index 000000000..43643f570 --- /dev/null +++ b/client/travel/routes.json @@ -0,0 +1,22 @@ +{ + "module": "travel", + "name": "Travels", + "icon": "icon-travels", + "validations": true, + "routes": [ + { + "url": "/travel", + "state": "travel", + "abstract": true, + "component": "ui-view", + "description": "Travels" + }, + { + "url": "/index?q", + "state": "travel.index", + "component": "vn-travel-index", + "description": "List" + } + ], + "menu": [] +} \ No newline at end of file diff --git a/client/travel/src/index.js b/client/travel/src/index.js new file mode 100644 index 000000000..6849e9df3 --- /dev/null +++ b/client/travel/src/index.js @@ -0,0 +1,4 @@ +export * from './module'; + +import './index/'; +import './search-panel'; diff --git a/client/travel/src/index/index.html b/client/travel/src/index/index.html new file mode 100644 index 000000000..2f60f14fb --- /dev/null +++ b/client/travel/src/index/index.html @@ -0,0 +1,59 @@ + + +
+
+ + + + +
+ + + + + Id + Reference + Agency + Warehouse Out + Shipped + Delivered + Warehouse In + Landed + Received + + + + + + {{::travel.id}} + {{::travel.ref}} + {{::travel.agency.name}} + {{::travel.warehouseOut.name}} + {{::travel.shipped | date:'dd/MM/yyyy'}} + + {{::travel.warehouseIn.name}} + {{::travel.landed | date:'dd/MM/yyyy'}} + + + + + + No results + + + + + +
\ No newline at end of file diff --git a/client/travel/src/index/index.js b/client/travel/src/index/index.js new file mode 100644 index 000000000..3a79d57cf --- /dev/null +++ b/client/travel/src/index/index.js @@ -0,0 +1,52 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($scope) { + this.$scope = $scope; + this.ticketSelected = null; + + this.filter = { + include: [ + { + relation: 'agency', + scope: { + fields: ['name'] + } + }, + { + relation: 'warehouseIn', + scope: { + fields: ['name'] + } + }, + { + relation: 'warehouseOut', + scope: { + fields: ['name'] + } + } + ] + }; + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return {id: value}; + case 'ref': + return {[param]: {regexp: value}}; + case 'id': + case 'agencyFk': + case 'warehouseOutFk': + case 'warehouseInFk': + return {[param]: value}; + } + } +} + +Controller.$inject = ['$scope']; + +ngModule.component('vnTravelIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/travel/src/locale/es.yml b/client/travel/src/locale/es.yml new file mode 100644 index 000000000..90fe3aecf --- /dev/null +++ b/client/travel/src/locale/es.yml @@ -0,0 +1,13 @@ +#Ordenar alfabeticamente +Reference: Referencia +Warehouse Out: Almacén salida +Warehouse In: Almacén llegada +Shipped: F. salida +Landed: F. llegada +Delivered: Enviado +Received: Recibido +Travel id: Id envío +#sections +Travels: Envíos +List: Listado +Summary: Vista previa \ No newline at end of file diff --git a/client/travel/src/module.js b/client/travel/src/module.js new file mode 100644 index 000000000..c232afcfa --- /dev/null +++ b/client/travel/src/module.js @@ -0,0 +1,5 @@ +import {ng} from 'vendor'; +import 'core'; + +const ngModule = ng.module('travel', ['vnCore']); +export default ngModule; diff --git a/client/travel/src/search-panel/index.html b/client/travel/src/search-panel/index.html new file mode 100644 index 000000000..d3898fcf9 --- /dev/null +++ b/client/travel/src/search-panel/index.html @@ -0,0 +1,52 @@ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/client/travel/src/search-panel/index.js b/client/travel/src/search-panel/index.js new file mode 100644 index 000000000..74e732534 --- /dev/null +++ b/client/travel/src/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import SearchPanel from 'core/src/components/searchbar/search-panel'; + +ngModule.component('vnTravelSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/client/travel/src/search-panel/locale/es.yml b/client/travel/src/search-panel/locale/es.yml new file mode 100644 index 000000000..1f892a742 --- /dev/null +++ b/client/travel/src/search-panel/locale/es.yml @@ -0,0 +1,7 @@ +Ticket id: Id ticket +Client id: Id cliente +Nickname: Alias +From: Desde +To: Hasta +Agency: Agencia +Warehouse: Almacén \ No newline at end of file diff --git a/services/travel/Dockerfile b/services/travel/Dockerfile new file mode 100644 index 000000000..fe7ad357d --- /dev/null +++ b/services/travel/Dockerfile @@ -0,0 +1,6 @@ +FROM vn-loopback:latest + +COPY travel /app +WORKDIR /app +CMD ["pm2-docker", "./server/server.js"] + diff --git a/services/travel/common/locale/es.json b/services/travel/common/locale/es.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/services/travel/common/locale/es.json @@ -0,0 +1 @@ +{} diff --git a/services/travel/common/models/travel.json b/services/travel/common/models/travel.json new file mode 100644 index 000000000..d950e1d4f --- /dev/null +++ b/services/travel/common/models/travel.json @@ -0,0 +1,48 @@ +{ + "name": "Travel", + "base": "VnModel", + "options": { + "mysql": { + "table": "travel" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "shipped": { + "type": "date" + }, + "landed": { + "type": "date" + }, + "isDelivered": { + "type": "Boolean" + }, + "isReceived": { + "type": "Boolean" + }, + "ref": { + "type": "String" + } + }, + "relations": { + "agency": { + "type": "belongsTo", + "model": "Agency", + "foreignKey": "agencyFk" + }, + "warehouseIn": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseInFk" + }, + "warehouseOut": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseOutFk" + } + } +} diff --git a/services/travel/package.json b/services/travel/package.json new file mode 100644 index 000000000..d95156995 --- /dev/null +++ b/services/travel/package.json @@ -0,0 +1,18 @@ +{ + "name": "vn-travel", + "version": "1.0.0", + "main": "server/server.js", + "scripts": { + "start": "node .", + "posttest": "npm run lint && nsp check" + }, + "dependencies": { + "vn-loopback": "file:../loopback" + }, + "repository": { + "type": "git", + "url": "https://git.verdnatura.es/salix" + }, + "license": "GPL-3.0", + "description": "vn-travel" +} diff --git a/services/travel/server/model-config.json b/services/travel/server/model-config.json new file mode 100644 index 000000000..95879c1a5 --- /dev/null +++ b/services/travel/server/model-config.json @@ -0,0 +1,5 @@ +{ + "Travel": { + "dataSource": "vn" + } +} diff --git a/services/travel/server/server.js b/services/travel/server/server.js new file mode 100644 index 000000000..05280d0ce --- /dev/null +++ b/services/travel/server/server.js @@ -0,0 +1,4 @@ +var vnLoopback = require('vn-loopback/server/server.js'); + +var app = module.exports = vnLoopback.loopback(); +vnLoopback.boot(app, __dirname, module);