Tarea #406 order.volumen
This commit is contained in:
parent
9a66c950b7
commit
73ed4d0d19
|
@ -42,6 +42,18 @@
|
||||||
"icon": "shopping_cart"
|
"icon": "shopping_cart"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"url": "/volume",
|
||||||
|
"state": "order.card.volume",
|
||||||
|
"component": "vn-order-volume",
|
||||||
|
"params": {
|
||||||
|
"order": "$ctrl.order"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Volume",
|
||||||
|
"icon": "icon-volume"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "order.create",
|
"state": "order.create",
|
||||||
|
|
|
@ -31,16 +31,18 @@ class Controller {
|
||||||
this.$http.get(query).then(res => {
|
this.$http.get(query).then(res => {
|
||||||
if (res.data)
|
if (res.data)
|
||||||
this.order = res.data;
|
this.order = res.data;
|
||||||
|
this.getTotal();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
query = `/order/api/Orders/${this.$state.params.id}/getTotal`;
|
getTotal() {
|
||||||
|
let query = `/order/api/Orders/${this.$state.params.id}/getTotal`;
|
||||||
this.$http.get(query).then(res => {
|
this.$http.get(query).then(res => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
this.order.total = res.data.total;
|
this.order.total = res.data.total;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.getOrder();
|
this.getOrder();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,3 +7,4 @@ import './index/';
|
||||||
import './summary';
|
import './summary';
|
||||||
import './catalogue';
|
import './catalogue';
|
||||||
import './catalogue/product';
|
import './catalogue/product';
|
||||||
|
import './volume';
|
||||||
|
|
|
@ -1,42 +1,44 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="/ticket/api/sales"
|
url="/order/api/OrderRows"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
link="{itemFk: $ctrl.$stateParams.id}"
|
link="{orderFk: $ctrl.$stateParams.id}"
|
||||||
limit="20"
|
limit="20"
|
||||||
data="sales" on-data-change="$ctrl.onDataChange()">
|
data="rows" on-data-change="$ctrl.onDataChange()">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<mg-ajax path="/client/api/tickets/{{$ctrl.$stateParams.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
|
<mg-ajax path="/order/api/Orders/{{$ctrl.$stateParams.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-card pad-large>
|
<vn-card pad-large>
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-title>Volume</vn-title>
|
<vn-horizontal>
|
||||||
<vn-one pad-small margin-medium-bottom pad-large class="totalBox">
|
<vn-title vn-two>Volume</vn-title>
|
||||||
|
<div class="totalBox">
|
||||||
<vn-label-value label="Total"
|
<vn-label-value label="Total"
|
||||||
value="{{::edit.model.totalVolume}}">
|
value="{{::edit.model.totalVolume}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Cajas"
|
<vn-label-value label="Cajas"
|
||||||
value="{{::edit.model.totalBoxes}}">
|
value="{{::edit.model.totalBoxes}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</vn-one>
|
</div>
|
||||||
|
</vn-horizontal>
|
||||||
<vn-table model="model">
|
<vn-table model="model">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th field="itemFk" number>Item</vn-th>
|
<vn-th field="itemFk" default-order="ASC" number>Item</vn-th>
|
||||||
<vn-th field="concept" default-order="ASC">Description</vn-th>
|
<vn-th>Description</vn-th>
|
||||||
<vn-th field="quantity" number>Quantity</vn-th>
|
<vn-th field="quantity" number>Quantity</vn-th>
|
||||||
<vn-th number>m³ per quantity</vn-th>
|
<vn-th number>m³ per quantity</vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-thead>
|
</vn-thead>
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="sale in sales">
|
<vn-tr ng-repeat="row in rows">
|
||||||
<vn-td number pointer
|
<vn-td number pointer
|
||||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
ng-click="$ctrl.showDescriptor($event, row.itemFk)">
|
||||||
{{::sale.itemFk}}
|
{{::row.itemFk}}
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td><vn-fetched-tags sale="sale"/></vn-td>
|
<vn-td><vn-fetched-tags concept="row.item.name" tags="row.item.tags"/></vn-td>
|
||||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
<vn-td number>{{::row.quantity}}</vn-td>
|
||||||
<vn-td number>{{::sale.volume.m3 | number:3}}</vn-td>
|
<vn-td number>{{::row.volume | number:3}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
</vn-tbody>
|
</vn-tbody>
|
||||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||||
|
@ -50,5 +52,5 @@
|
||||||
</vn-pagination>
|
</vn-pagination>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>
|
<!-- <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
import './style.scss';
|
||||||
|
|
||||||
|
class Controller {
|
||||||
|
constructor($scope, $http, $stateParams) {
|
||||||
|
this.$scope = $scope;
|
||||||
|
this.$http = $http;
|
||||||
|
this.$stateParams = $stateParams;
|
||||||
|
this.filter = {
|
||||||
|
include: [{
|
||||||
|
relation: 'item',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'tags',
|
||||||
|
scope: {
|
||||||
|
fields: ['tagFk', 'value'],
|
||||||
|
include: {
|
||||||
|
relation: 'tag',
|
||||||
|
scope: {
|
||||||
|
fields: ['name']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
limit: 6
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fields: ['itemFk', 'name']
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
this.order = {};
|
||||||
|
this.ticketVolumes = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
onDataChange() {
|
||||||
|
this.$http.get(`/order/api/Orders/${this.$stateParams.id}/getVolumes`)
|
||||||
|
.then(response => {
|
||||||
|
if (response.data) {
|
||||||
|
this.$scope.model.data.forEach(order => {
|
||||||
|
response.data.volumes.forEach(volume => {
|
||||||
|
if (order.itemFk === volume.itemFk) {
|
||||||
|
order.volume = volume.volume;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
showDescriptor(event, itemFk) {
|
||||||
|
this.$scope.descriptor.itemFk = itemFk;
|
||||||
|
this.$scope.descriptor.parent = event.target;
|
||||||
|
this.$scope.descriptor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
onDescriptorLoad() {
|
||||||
|
this.$scope.popover.relocate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.$inject = ['$scope', '$http', '$stateParams'];
|
||||||
|
|
||||||
|
ngModule.component('vnOrderVolume', {
|
||||||
|
template: require('./index.html'),
|
||||||
|
controller: Controller,
|
||||||
|
bindings: {
|
||||||
|
order: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
.totalBox {
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
text-align: left;
|
||||||
|
align-self: flex-end;
|
||||||
|
}
|
Loading…
Reference in New Issue