Tarea #405 crear order
This commit is contained in:
parent
ebf38e225e
commit
3c3abb9063
|
@ -12,9 +12,9 @@
|
|||
"acl": ["developer"]
|
||||
},
|
||||
{
|
||||
"url": "/index?q",
|
||||
"state": "order.index",
|
||||
"component": "vn-order-index"
|
||||
"url": "/:id",
|
||||
"state": "order.card",
|
||||
"component": "vn-order-card"
|
||||
},
|
||||
{
|
||||
"url": "/create",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<vn-main-block>
|
||||
<vn-horizontal>
|
||||
<vn-auto class="left-block">
|
||||
<vn-order-descriptor order="$ctrl.order"></vn-order-descriptor>
|
||||
<vn-left-menu></vn-left-menu>
|
||||
</vn-auto>
|
||||
<vn-one>
|
||||
<vn-vertical margin-medium ui-view></vn-vertical>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-main-block>
|
|
@ -0,0 +1,50 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class Controller {
|
||||
constructor($http, $state) {
|
||||
this.$http = $http;
|
||||
this.$state = $state;
|
||||
}
|
||||
|
||||
getOrder() {
|
||||
let filter = {
|
||||
include: [
|
||||
{relation: 'agencyMode', scope: {fields: ['name']}},
|
||||
{relation: 'address', scope: {fields: ['nickname']}},
|
||||
{relation: 'rows', scope: {fields: ['id']}},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'],
|
||||
include: {
|
||||
relation: 'salesPerson',
|
||||
fields: ['firstName', 'name']
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
let json = encodeURIComponent(JSON.stringify(filter));
|
||||
let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`;
|
||||
this.$http.get(query).then(res => {
|
||||
if (res.data)
|
||||
this.order = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.getOrder();
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.getOrder();
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http', '$state'];
|
||||
|
||||
ngModule.component('vnOrderCard', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,40 @@
|
|||
<vn-card margin-medium-v class="vn-descriptor">
|
||||
<vn-horizontal class="header">
|
||||
<a translate-attr="{title: 'Return to module index'}" ui-sref="order.index">
|
||||
<vn-icon icon="chevron_left"></vn-icon>
|
||||
</a>
|
||||
<vn-icon icon="shopping_cart"></vn-icon>
|
||||
<a translate-attr="{title: 'Preview'}" ui-sref="order.card.summary">
|
||||
<vn-icon icon="desktop_windows"></vn-icon>
|
||||
</a>
|
||||
</vn-horizontal>
|
||||
<div pad-medium>
|
||||
<vn-label-value label="ID"
|
||||
value="{{$ctrl.order.id}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Client"
|
||||
value="{{$ctrl.order.client.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="State"
|
||||
value="{{$ctrl.order.isConfirmed ? 'Confirmed' : 'Not Confirmed'}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Sales person"
|
||||
value="{{$ctrl.order.client.salesPerson.firstName}} {{$ctrl.order.client.salesPerson.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Landed"
|
||||
value="{{$ctrl.order.landed | date: 'dd/MM/yyyy HH:mm' }}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.order.agencyMode.name}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Alias"
|
||||
value="{{$ctrl.order.address.nickname}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Items"
|
||||
value="{{$ctrl.order.rows.length}}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Total"
|
||||
value="{{$ctrl.order.total || 0 | currency: ' €': 2}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
</vn-card>
|
|
@ -0,0 +1,18 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($http) {
|
||||
this.$http = $http;
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$http'];
|
||||
|
||||
ngModule.component('vnOrderDescriptor', {
|
||||
template: require('./index.html'),
|
||||
bindings: {
|
||||
order: '<'
|
||||
},
|
||||
controller: Controller
|
||||
});
|
|
@ -0,0 +1,8 @@
|
|||
Client: Cliente
|
||||
Confirmed: Confirmado
|
||||
Not confirmed: Sin confirmar
|
||||
State: Estado
|
||||
Landed: F. entrega
|
||||
Items: Articulos
|
||||
Agency: Agencia
|
||||
Sales person: Comercial
|
|
@ -0,0 +1,4 @@
|
|||
vn-label-value[label=Total]{
|
||||
padding-top: 10px;
|
||||
font-size: 1.2em;
|
||||
}
|
|
@ -1 +1,5 @@
|
|||
export * from './module';
|
||||
export * from './module';
|
||||
|
||||
import './descriptor';
|
||||
import './index';
|
||||
import './card';
|
||||
|
|
|
@ -76,10 +76,20 @@
|
|||
"model": "Address",
|
||||
"foreignKey": "address_id"
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "customer_id"
|
||||
},
|
||||
"deliveryMethod": {
|
||||
"type": "belongsTo",
|
||||
"model": "DeliveryMethod",
|
||||
"foreignKey": "delivery_method_id"
|
||||
},
|
||||
"rows": {
|
||||
"type": "hasMany",
|
||||
"model": "OrderRow",
|
||||
"foreignKey": "orderFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue