added travel service

This commit is contained in:
Joan 2018-11-13 07:44:03 +01:00
parent e05b2d9550
commit 10d191544e
19 changed files with 310 additions and 2 deletions

View File

@ -8,3 +8,4 @@ order: [item, ticket]
claim: [item, client]
route: []
agency: []
travel: []

View File

@ -27,3 +27,4 @@ What is new: Novedades de la versión
Web Account inactive: Sin acceso Web
Orders: Pedidos
Agencies: Agencias
Travels: Envíos

View File

@ -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')))
};

1
client/travel/index.js Normal file
View File

@ -0,0 +1 @@
export * from './src';

22
client/travel/routes.json Normal file
View File

@ -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": []
}

View File

@ -0,0 +1,4 @@
export * from './module';
import './index/';
import './search-panel';

View File

@ -0,0 +1,59 @@
<vn-crud-model
vn-id="model"
url="/travel/api/Travels"
filter="::$ctrl.filter"
limit="20"
data="travels"
auto-load="false">
</vn-crud-model>
<div margin-medium>
<div class="vn-list">
<vn-card pad-medium-h>
<vn-searchbar
panel="vn-travel-search-panel"
model="model"
expr-builder="$ctrl.exprBuilder(param, value)"
vn-focus>
</vn-searchbar>
</vn-card>
</div>
<vn-card margin-medium-v pad-medium>
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th field="id" number>Id</vn-th>
<vn-th field="ref">Reference</vn-th>
<vn-th field="agencyFk">Agency</vn-th>
<vn-th field="warehouseOutFk">Warehouse Out</vn-th>
<vn-th field="shipped">Shipped</vn-th>
<vn-th field="isDelivered">Delivered</vn-th>
<vn-th field="warehouseInFk">Warehouse In</vn-th>
<vn-th field="landed">Landed</vn-th>
<vn-th field="isReceived">Received</vn-th>
<vn-th></vn-th>
</vn-tr>
</vn-thead>
<vn-tbody>
<vn-tr ng-repeat="travel in travels" class="clickable">
<vn-td number>{{::travel.id}}</vn-td>
<vn-td>{{::travel.ref}}</vn-td>
<vn-td>{{::travel.agency.name}}</vn-td>
<vn-td>{{::travel.warehouseOut.name}}</vn-td>
<vn-td>{{::travel.shipped | date:'dd/MM/yyyy'}}</vn-td>
<vn-td><vn-check field="travel.isDelivered" disabled="true"></vn-check></vn-td>
<vn-td>{{::travel.warehouseIn.name}}</vn-td>
<vn-td>{{::travel.landed | date:'dd/MM/yyyy'}}</vn-td>
<vn-td><vn-check field="travel.isReceived" disabled="true"></vn-check></vn-td>
<vn-td></vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="model.data.length === 0" translate>
No results
</vn-empty-rows>
</vn-table>
</vn-card>
<vn-pagination
model="model"
scroll-selector="ui-view">
</vn-pagination>
</div>

View File

@ -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
});

View File

@ -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

View File

@ -0,0 +1,5 @@
import {ng} from 'vendor';
import 'core';
const ngModule = ng.module('travel', ['vnCore']);
export default ngModule;

View File

@ -0,0 +1,52 @@
<div pad-large style="min-width: 30em">
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield
vn-one
label="General search"
model="filter.search"
vn-focus>
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Reference"
model="filter.ref">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Travel id"
model="filter.id">
</vn-textfield>
<vn-autocomplete vn-one
label="Agency"
field="filter.agencyFk"
url="/ticket/api/Agencies"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
label="Warehouse Out"
field="filter.warehouseOutFk"
url="/ticket/api/Warehouses"
show-field="name"
value-field="id">
</vn-autocomplete>
<vn-autocomplete vn-one
label="Warehouse In"
field="filter.warehouseInFk"
url="/ticket/api/Warehouses"
show-field="name"
value-field="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit>
</vn-horizontal>
</form>
</div>

View File

@ -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
});

View File

@ -0,0 +1,7 @@
Ticket id: Id ticket
Client id: Id cliente
Nickname: Alias
From: Desde
To: Hasta
Agency: Agencia
Warehouse: Almacén

View File

@ -0,0 +1,6 @@
FROM vn-loopback:latest
COPY travel /app
WORKDIR /app
CMD ["pm2-docker", "./server/server.js"]

View File

@ -0,0 +1 @@
{}

View File

@ -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"
}
}
}

View File

@ -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"
}

View File

@ -0,0 +1,5 @@
{
"Travel": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,4 @@
var vnLoopback = require('vn-loopback/server/server.js');
var app = module.exports = vnLoopback.loopback();
vnLoopback.boot(app, __dirname, module);