Tarea #405 crear order

This commit is contained in:
gerard 2018-07-20 16:32:34 +02:00
parent 4ba541bec2
commit 9a80f22e93
4 changed files with 38 additions and 1 deletions

View File

@ -31,6 +31,13 @@ class Controller {
if (res.data)
this.order = res.data;
});
query = `/order/api/Orders/${this.$state.params.id}/getTotal`;
this.$http.get(query).then(res => {
if (res.data) {
this.order.total = res.data.total;
}
});
}
$onInit() {

View File

@ -34,7 +34,7 @@
value="{{$ctrl.order.rows.length}}">
</vn-label-value>
<vn-label-value label="Total"
value="{{$ctrl.order.total || 0 | currency: ' €': 2}}">
value="{{$ctrl.order.total | currency: ' €': 2}}">
</vn-label-value>
</div>
</vn-card>

View File

@ -0,0 +1,28 @@
module.exports = Self => {
Self.remoteMethod('getTotal', {
description: 'Gets the total for an order',
accessType: 'READ',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'ticket id',
http: {source: 'path'}
}],
returns: {
type: 'number',
root: true
},
http: {
path: `/:id/getTotal`,
verb: 'GET'
}
});
Self.getTotal = async orderFk => {
let query = `SELECT hedera.orderGetTotal(?) total;`;
let [total] = await Self.rawSql(query, [orderFk]);
console.log(total);
return total;
};
};

View File

@ -1,3 +1,5 @@
module.exports = Self => {
require('../methods/new')(Self);
//require('../methods/order/getTotalVolume')(Self);
require('../methods/order/getTotal')(Self);
};