From cf36d7d6bee942a3e258072cc6d1978f5437cd81 Mon Sep 17 00:00:00 2001 From: dherrero Date: Wed, 11 Oct 2017 12:09:22 +0200 Subject: [PATCH] module routes: front dev 80% --- client/route/routes.json | 55 ++++++++++++++++++- client/route/src/card/card.html | 27 +++++++++ client/route/src/card/card.js | 12 ++++ client/route/src/create/create.html | 29 ++++++++++ client/route/src/create/create.js | 21 +++++++ client/route/src/index/index.html | 4 +- client/route/src/index/item-route.html | 2 +- client/route/src/route.js | 3 + client/route/src/search-panel/locale/es.json | 10 ++++ .../route/src/search-panel/search-panel.html | 17 ++++++ client/route/src/search-panel/search-panel.js | 27 +++++++++ client/salix/src/components/home/style.scss | 3 +- .../src/components/main-menu/main-menu.html | 1 + .../salix/src/components/main-menu/style.scss | 5 ++ services/route/common/methods/filter.js | 2 +- 15 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 client/route/src/card/card.html create mode 100644 client/route/src/card/card.js create mode 100644 client/route/src/create/create.html create mode 100644 client/route/src/create/create.js create mode 100644 client/route/src/search-panel/locale/es.json create mode 100644 client/route/src/search-panel/search-panel.html create mode 100644 client/route/src/search-panel/search-panel.js diff --git a/client/route/routes.json b/client/route/routes.json index e6da8754f..b1b9358c9 100644 --- a/client/route/routes.json +++ b/client/route/routes.json @@ -1,13 +1,66 @@ { "module": "route", "name": "Route", - + "icon" : "local_shipping", "validations" : false, "routes": [ { "url": "/routes", "state": "routes", + "abstract": true, + "component": "ui-view" + }, + { + "url": "/list", + "state": "routes.index", "component": "vn-route-index" + }, + { + "url": "/create", + "state": "routes.create", + "component": "vn-route-create" + }, + { + "url": "/:id", + "state": "routes.card", + "abstract": true, + "component": "vn-route-card" + }, + { + "url": "/basicData", + "state": "routes.card.basicData", + "component": "vn-route-basic-data", + "params": { + "route": "$ctrl.route" + }, + "menu": { + "description": "Datos básicos", + "icon": "person" + } + }, + { + "url": "/logisticData", + "state": "routes.card.logisticData", + "component": "vn-route-logistic-data", + "params": { + "route": "$ctrl.route" + }, + "menu": { + "description": "Datos logísticos", + "icon": "local_shipping" + } + }, + { + "url": "/tickets", + "state": "routes.card.tickets", + "component": "vn-route-tickets", + "params": { + "route": "$ctrl.route" + }, + "menu": { + "description": "Tickets asignados", + "icon": "assignment" + } } ] } \ No newline at end of file diff --git a/client/route/src/card/card.html b/client/route/src/card/card.html new file mode 100644 index 000000000..985c02d90 --- /dev/null +++ b/client/route/src/card/card.html @@ -0,0 +1,27 @@ + + + + + + + + + local_shipping + + +
Ruta {{::$ctrl.route.id}}
+
{{$ctrl.route.date | date:'dd/MM/yyyy'}}
+
+
+
+
+ +
+ + + +
+ \ No newline at end of file diff --git a/client/route/src/card/card.js b/client/route/src/card/card.js new file mode 100644 index 000000000..e0655c069 --- /dev/null +++ b/client/route/src/card/card.js @@ -0,0 +1,12 @@ +import ngModule from '../module'; + +class RouteCard { + constructor() { + this.route = null; + } +} + +ngModule.component('vnRouteCard', { + template: require('./card.html'), + controller: RouteCard +}); diff --git a/client/route/src/create/create.html b/client/route/src/create/create.html new file mode 100644 index 000000000..f976ccdea --- /dev/null +++ b/client/route/src/create/create.html @@ -0,0 +1,29 @@ + + + +
+
+ + + Create Route + + + + + + + + + + + + + + + +
+
diff --git a/client/route/src/create/create.js b/client/route/src/create/create.js new file mode 100644 index 000000000..e5092c732 --- /dev/null +++ b/client/route/src/create/create.js @@ -0,0 +1,21 @@ +import ngModule from '../module'; + +class RouteCreate { + constructor($scope, $state) { + this.$ = $scope; + this.$state = $state; + this.route = {}; + console.log('hi world'); + } + onSubmit() { + this.$.watcher.submit().then( + json => this.$state.go('routes.card.basicData', {id: json.data.id}) + ); + } +} +RouteCreate.$inject = ['$scope', '$state']; + +ngModule.component('vnRouteCreate', { + template: require('./create.html'), + controller: RouteCreate +}); diff --git a/client/route/src/index/index.html b/client/route/src/index/index.html index 337bb2a2a..7cbf0100f 100644 --- a/client/route/src/index/index.html +++ b/client/route/src/index/index.html @@ -8,7 +8,7 @@ on-search="$ctrl.search(index)" advanced="true" search="$ctrl.model.search" - popover="vn-client-search-panel"> + popover="vn-route-search-panel"> @@ -17,7 +17,7 @@ - + diff --git a/client/route/src/index/item-route.html b/client/route/src/index/item-route.html index 6b982b9aa..226d75810 100644 --- a/client/route/src/index/item-route.html +++ b/client/route/src/index/item-route.html @@ -1,4 +1,4 @@ - + diff --git a/client/route/src/route.js b/client/route/src/route.js index 69a09db10..b490a2039 100644 --- a/client/route/src/route.js +++ b/client/route/src/route.js @@ -2,3 +2,6 @@ export * from './module'; // import components import './index/index'; +import './search-panel/search-panel'; +import './create/create'; +import './card/card'; diff --git a/client/route/src/search-panel/locale/es.json b/client/route/src/search-panel/locale/es.json new file mode 100644 index 000000000..1dc7b850f --- /dev/null +++ b/client/route/src/search-panel/locale/es.json @@ -0,0 +1,10 @@ +{ + "Client id": "Id cliente", + "Tax number": "NIF/CIF", + "Name": "Nombre", + "Social name": "Razon social", + "Town/City": "Ciudad", + "Postcode": "Código postal", + "Email": "Correo electrónico", + "Phone": "Teléfono" +} \ No newline at end of file diff --git a/client/route/src/search-panel/search-panel.html b/client/route/src/search-panel/search-panel.html new file mode 100644 index 000000000..7249bbd9c --- /dev/null +++ b/client/route/src/search-panel/search-panel.html @@ -0,0 +1,17 @@ +
+
+ + + + + + + + + + + + + +
+
diff --git a/client/route/src/search-panel/search-panel.js b/client/route/src/search-panel/search-panel.js new file mode 100644 index 000000000..c1b79d5de --- /dev/null +++ b/client/route/src/search-panel/search-panel.js @@ -0,0 +1,27 @@ +import ngModule from '../module'; + +export default class Controller { + constructor($window) { + this.$window = $window; + // onSubmit() is defined by @vnSearchbar + this.onSubmit = () => {}; + } + 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']; + +ngModule.component('vnRouteSearchPanel', { + template: require('./search-panel.html'), + controller: Controller +}); diff --git a/client/salix/src/components/home/style.scss b/client/salix/src/components/home/style.scss index 135f5d461..b35c1a1c7 100644 --- a/client/salix/src/components/home/style.scss +++ b/client/salix/src/components/home/style.scss @@ -45,8 +45,9 @@ vn-home { } i{ - font-size: 50px !important; + font-size: 75px !important; margin: 0 auto; + padding-top: 15px; } &:hover{ opacity: 0.7; diff --git a/client/salix/src/components/main-menu/main-menu.html b/client/salix/src/components/main-menu/main-menu.html index a85bebb7c..25b375fd3 100644 --- a/client/salix/src/components/main-menu/main-menu.html +++ b/client/salix/src/components/main-menu/main-menu.html @@ -6,6 +6,7 @@
  • +
  • diff --git a/client/salix/src/components/main-menu/style.scss b/client/salix/src/components/main-menu/style.scss index 6b9687d5e..ea454ebf3 100644 --- a/client/salix/src/components/main-menu/style.scss +++ b/client/salix/src/components/main-menu/style.scss @@ -8,6 +8,11 @@ vn-main-menu { vertical-align: middle; margin-top: -3px; } + i{ + float: left; + padding-top: 13px; + margin-right: 3px; + } } li.mdl-menu__item:hover{ background-color: #FF9300; diff --git a/services/route/common/methods/filter.js b/services/route/common/methods/filter.js index a31c200d0..22e93afbd 100644 --- a/services/route/common/methods/filter.js +++ b/services/route/common/methods/filter.js @@ -40,7 +40,7 @@ module.exports = function(Delivery) { } Object.keys(params).forEach( key => { - filters.where[key] = (key === 'postcode' || key === 'fi') ? params[key] : {regexp: params[key]}; + filters.where[key] = {regexp: params[key]}; } ); return filters;