module routes: front dev 80%
This commit is contained in:
parent
911fbb2f8b
commit
cf36d7d6be
|
@ -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"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
<vn-horizontal>
|
||||
<mg-ajax
|
||||
path="/route/api/Deliveries/{{edit.params.id}}"
|
||||
actions="$ctrl.route = edit.model"
|
||||
options="mgEdit">
|
||||
</mg-ajax>
|
||||
<vn-empty style="min-width: 18em; padding-left: 1em; padding-bottom: 1em;">
|
||||
<vn-card>
|
||||
<vn-vertical class="margin-medium" pad-medium-top pad-medium-bottom>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<i class="material-icons descriptor-icon">local_shipping</i>
|
||||
</vn-one>
|
||||
<vn-vertical vn-two>
|
||||
<div class="margin-none"><span translate>Ruta</span> {{::$ctrl.route.id}}</div>
|
||||
<div class="margin-none">{{$ctrl.route.date | date:'dd/MM/yyyy'}}</div>
|
||||
</vn-vertical>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-empty>
|
||||
<vn-auto>
|
||||
<vn-vertical style="max-width: 70em; margin: 0 auto;" ui-view></vn-vertical>
|
||||
</vn-auto>
|
||||
</vn-horizontal>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class RouteCard {
|
||||
constructor() {
|
||||
this.route = null;
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnRouteCard', {
|
||||
template: require('./card.html'),
|
||||
controller: RouteCard
|
||||
});
|
|
@ -0,0 +1,29 @@
|
|||
<mg-ajax path="/route/api/Delivery/createRoute" options="vnPost"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.route"
|
||||
form="form"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" margin-medium>
|
||||
<div style="max-width: 70em; margin: 0 auto;">
|
||||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Create Route</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker vn-one label="Date" field="$ctrl.route.date"></vn-date-picker>
|
||||
<vn-textfield vn-one label="Agency" field="$ctrl.route.agency"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Driver" field="$ctrl.route.driver"></vn-textfield>
|
||||
<vn-textfield vn-one label="Vehicle" field="$ctrl.route.vehicle"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Create and edit"></vn-submit>
|
||||
<vn-button label="Create" ng-click="watcher.submitBack()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</div>
|
||||
</form>
|
|
@ -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
|
||||
});
|
|
@ -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">
|
||||
</vn-searchbar>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
|
@ -17,7 +17,7 @@
|
|||
</vn-card>
|
||||
<vn-paging index="index" total="index.model.count"></vn-paging>
|
||||
</div>
|
||||
<a ui-sref="create" fixed-bottom-right>
|
||||
<a ui-sref="routes.create" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<a vn-horizontal ui-sref="routeCard.basicData({ id: {{$ctrl.route.id}} })" pad-medium border-solid-bottom>
|
||||
<a vn-horizontal ui-sref="routes.card.basicData({id: {{$ctrl.route.id}} })" pad-medium border-solid-bottom>
|
||||
<vn-one>
|
||||
<vn-vertical>
|
||||
<vn-one>
|
||||
|
|
|
@ -2,3 +2,6 @@ export * from './module';
|
|||
|
||||
// import components
|
||||
import './index/index';
|
||||
import './search-panel/search-panel';
|
||||
import './create/create';
|
||||
import './card/card';
|
||||
|
|
|
@ -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"
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<div pad-large style="min-width: 30em">
|
||||
<form ng-submit="$ctrl.onSearch()">
|
||||
<vn-horizontal>
|
||||
<vn-date-picker vn-one label="Date" model="$ctrl.filter.date"></vn-date-picker>
|
||||
<vn-textfield vn-one label="Zone" model="$ctrl.filter.zone"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Postcode" model="$ctrl.filter.postcode"></vn-textfield>
|
||||
<vn-textfield vn-one label="Route_Id" model="$ctrl.filter.id"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-horizontal margin-large-top>
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
</vn-horizontal>
|
||||
</form>
|
||||
</div>
|
|
@ -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
|
||||
});
|
|
@ -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;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<vn-icon icon="account_circle" translate-attr="{title: 'Profile'}" style="font-size: 35px;"></vn-icon>
|
||||
<ul class="mdl-menu mdl-js-menu mdl-menu--bottom-right" pad-small for="apps">
|
||||
<li class="mdl-menu__item" ng-repeat="mod in $ctrl.modules track by $index" ui-sref="{{::mod.route.state}}">
|
||||
<vn-icon ng-if="mod.icon && !mod.icon.startsWith('/')" icon="{{::mod.icon}}"></vn-icon>
|
||||
<img ng-if="mod.icon && mod.icon.startsWith('/')" ng-src="{{::mod.icon}}" />
|
||||
<span translate="{{::mod.name}}"></span>
|
||||
</li>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue