#184 listar modelo expeditions

This commit is contained in:
Carlos Jimenez 2018-03-21 15:51:09 +01:00
parent 7ac6e903f4
commit 613054e29f
7 changed files with 129 additions and 2 deletions

View File

@ -47,7 +47,7 @@
}
},
{
"url": "/observations",
"url": "/observation",
"state": "ticket.card.observations",
"component": "vn-ticket-observations",
"params": {
@ -58,6 +58,30 @@
"icon": "insert_drive_file"
}
},
{
"url": "/volume",
"state": "ticket.card.volume",
"component": "vn-ticket-volume",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"description": "Volume",
"icon": "icon-volume"
}
},
{
"url": "/expedition",
"state": "ticket.card.expedition",
"component": "vn-ticket-expedition",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"description": "Expedition",
"icon": "icon-volum"
}
},
{
"url" : "/package",
"abstract": true,

View File

@ -0,0 +1,42 @@
<mg-ajax path="/ticket/api/Expeditions/filter" options="vnIndexNonAuto"></mg-ajax>
<vn-vertical>
<vn-card pad-large>
<vn-vertical>
<vn-title>Expedition</vn-title>
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
<vn-column-header vn-one pad-medium-h text="Delete"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="itemFk" text="Item"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="name" text="Name" order-locked></vn-column-header>
<vn-column-header vn-one pad-medium-h field="packageFk" text="Package type"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="counter" text="Counter"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="checked" text="Checked"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="worker" text="Worker"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="created" text="Created" default-order="DESC"></vn-column-header>
</vn-grid-header>
<vn-one class="list list-content">
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="expedition in index.model.instances track by expedition.id">
<vn-none pad-medium-h style="color:#FFA410;">
<i
pointer
class="material-icons"
vn-tooltip="delete expedition"
ng-click="$ctrl.deleteExpedition(expedition)">delete</i>
</vn-none>
<vn-one pad-medium-h>{{expedition.itemFk}}</vn-one>
<vn-one pad-medium-h>{{expedition.item.name}}</vn-one>
<vn-one pad-medium-h>{{expedition.package.name}}</vn-one>
<vn-one pad-medium-h>{{expedition.counter}}</vn-one>
<vn-one pad-medium-h>{{expedition.checked}}</vn-one>
<vn-one pad-medium-h>{{expedition.worker.firstName}} {{expedition.worker.name}}</vn-one>
<vn-one pad-medium-h>{{expedition.created | date:'dd/MM/yyyy'}}</vn-one>
</vn-horizontal>
</vn-one>
<vn-one class="text-center pad-small-v" ng-if="index.model.count === 0" translate>No results</vn-one>
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -0,0 +1,22 @@
import ngModule from '../module';
import FilterTicketList from '../filter-ticket-list';
class Controller extends FilterTicketList {
constructor($scope, $timeout, $stateParams, $http) {
super($scope, $timeout, $stateParams);
this.params = $stateParams;
this.$http = $http;
}
deleteExpedition(expedition) {
this.$http.delete(`/ticket/api/Expeditions/${expedition.id}`, this.params).then(
() => this.$.index.accept()
);
}
}
Controller.$inject = ['$scope', '$timeout', '$state', '$http'];
ngModule.component('vnTicketExpedition', {
template: require('./ticket-expedition.html'),
controller: Controller
});

View File

@ -3,6 +3,14 @@ Basic data: Datos básicos
Description: Descripción
Discount: Descuento
Item: Articulo
Delete: Borrar
delete expedition: borrar expedición
Expedition: Expedición
Name: Nombre
Package type: Tipo de porte
Counter: Contador
Checked: Comprobado
Worker: Trabajador
Notes: Notas
Observation type: Tipo de observación
Price: Precio

View File

@ -5,7 +5,9 @@ import './create/ticket-create';
import './card/ticket-card';
import './summary/ticket-summary';
import './data/ticket-data';
import './notes/ticket-observations';
import './note/ticket-observation';
import './expedition/ticket-expedition';
import './volume/ticket-volume';
import './package/list/package-list';
import './sale/sale';
import './tracking/tracking';

View File

@ -0,0 +1,26 @@
module.exports = Self => {
Self.installMethod('filter', filterParams);
function filterParams(params) {
return {
where: {
ticketFk: params.ticketFk
},
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order || 'created DESC',
include: [{
relation: 'item',
scope: {fields: ['name']}
},
{
relation: 'worker',
scope: {fields: ['firstName', 'name']}
},
{
relation: 'package',
scope: {fields: ['name']}
}]
};
}
};

View File

@ -0,0 +1,3 @@
module.exports = function(Self) {
require('../methods/expedition/filter.js')(Self);
};