Tarea #405 crear order
This commit is contained in:
parent
4ba541bec2
commit
9a80f22e93
|
@ -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() {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -1,3 +1,5 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/new')(Self);
|
||||
//require('../methods/order/getTotalVolume')(Self);
|
||||
require('../methods/order/getTotal')(Self);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue