From 7ae011b3b693a2f6718b1481b299517247774d4b Mon Sep 17 00:00:00 2001 From: Gerard Date: Fri, 22 Mar 2019 11:07:44 +0100 Subject: [PATCH] #1240 route.descriptor --- modules/route/front/card/index.html | 7 +++ modules/route/front/card/index.js | 49 +++++++++++++++ modules/route/front/descriptor/index.html | 63 ++++++++++++++++++++ modules/route/front/descriptor/index.js | 22 +++++++ modules/route/front/descriptor/locale/es.yml | 2 + modules/route/front/index.js | 3 + modules/route/front/routes.json | 17 +++++- 7 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 modules/route/front/card/index.html create mode 100644 modules/route/front/card/index.js create mode 100644 modules/route/front/descriptor/index.html create mode 100644 modules/route/front/descriptor/index.js create mode 100644 modules/route/front/descriptor/locale/es.yml diff --git a/modules/route/front/card/index.html b/modules/route/front/card/index.html new file mode 100644 index 000000000..08b6c9de6 --- /dev/null +++ b/modules/route/front/card/index.html @@ -0,0 +1,7 @@ + + + + + +
+
diff --git a/modules/route/front/card/index.js b/modules/route/front/card/index.js new file mode 100644 index 000000000..99441584e --- /dev/null +++ b/modules/route/front/card/index.js @@ -0,0 +1,49 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($stateParams, $http) { + this.$http = $http; + this.$stateParams = $stateParams; + this.route = null; + this.filter = { + fields: ['id', 'agencyModeFk', 'created', 'm3', 'warehouseFk', 'description', 'vehicleFk'], + where: {id: $stateParams.id}, + include: [ + { + relation: 'agencyMode', + scope: { + fields: ['id', 'name'] + } + }, + { + relation: 'vehicle', + scope: { + fields: ['id', 'm3'] + } + } + ] + }; + } + + $onInit() { + this.getCard(); + } + + getCard() { + let json = encodeURIComponent(JSON.stringify(this.filter)); + this.$http.get(`/client/api/Routes?filter=${json}`).then(response => { + this.route = response.data[0]; + }); + } + + reload() { + this.getCard(); + } +} +Controller.$inject = ['$stateParams', '$http']; + +ngModule.component('vnRouteCard', { + template: require('./index.html'), + controller: Controller +}); + diff --git a/modules/route/front/descriptor/index.html b/modules/route/front/descriptor/index.html new file mode 100644 index 000000000..9ccd7444b --- /dev/null +++ b/modules/route/front/descriptor/index.html @@ -0,0 +1,63 @@ +
+ +
+
+
{{$ctrl.route.name}}
+ + + + + + + + + + +
+
+ + +
+ +
+
\ No newline at end of file diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js new file mode 100644 index 000000000..5c47c864f --- /dev/null +++ b/modules/route/front/descriptor/index.js @@ -0,0 +1,22 @@ +import ngModule from '../module'; + +class Controller { + set quicklinks(value = {}) { + this._quicklinks = Object.assign(value, this._quicklinks); + } + + get quicklinks() { + return this._quicklinks; + } +} + +Controller.$inject = ['$http', '$state']; + +ngModule.component('vnRouteDescriptor', { + template: require('./index.html'), + bindings: { + route: '<', + quicklinks: '<' + }, + controller: Controller +}); diff --git a/modules/route/front/descriptor/locale/es.yml b/modules/route/front/descriptor/locale/es.yml new file mode 100644 index 000000000..3f7596ae0 --- /dev/null +++ b/modules/route/front/descriptor/locale/es.yml @@ -0,0 +1,2 @@ +Volume exceded: Volumen excedido +Volume: Volumen \ No newline at end of file diff --git a/modules/route/front/index.js b/modules/route/front/index.js index 6849e9df3..f2f13ce9a 100644 --- a/modules/route/front/index.js +++ b/modules/route/front/index.js @@ -2,3 +2,6 @@ export * from './module'; import './index/'; import './search-panel'; +import './descriptor'; +import './summary'; +import './card'; diff --git a/modules/route/front/routes.json b/modules/route/front/routes.json index 2671d3e0d..4dcbac150 100644 --- a/modules/route/front/routes.json +++ b/modules/route/front/routes.json @@ -3,7 +3,7 @@ "name": "Routes", "icon": "icon-delivery", "validations" : true, - "dependencies": ["client", "worker"], + "dependencies": ["client", "worker", "ticket"], "routes": [ { "url": "/route", @@ -18,6 +18,21 @@ "state": "route.index", "component": "vn-route-index", "description": "Routes" + }, + { + "url": "/:id", + "state": "route.card", + "abstract": true, + "component": "vn-route-card" + }, + { + "url": "/summary", + "state": "route.card.summary", + "component": "vn-route-summary", + "description": "Summary", + "params": { + "route": "$ctrl.route" + } } ] } \ No newline at end of file