#960 order.line bugs solved
This commit is contained in:
parent
6865f606a4
commit
1d5cd1c86d
|
@ -0,0 +1,26 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('confirm', {
|
||||
description: 'Gets the taxes of a given order',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'order id',
|
||||
http: {source: 'path'}
|
||||
}],
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/:id/confirm`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.confirm = async orderFk => {
|
||||
let query = `CALL hedera.orderConfirm(?);`;
|
||||
return await Self.rawSql(query, [orderFk]);
|
||||
};
|
||||
};
|
|
@ -11,4 +11,5 @@ module.exports = Self => {
|
|||
require('../methods/order/getSourceValues')(Self);
|
||||
require('../methods/order/newFromTicket')(Self);
|
||||
require('../methods/order/updateBasicData')(Self);
|
||||
require('../methods/order/confirm')(Self);
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
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' }}">
|
||||
value="{{$ctrl.order.landed | date: 'dd/MM/yyyy' }}">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Agency"
|
||||
value="{{$ctrl.order.agencyMode.name}}">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="totalBox">
|
||||
<vn-label translate>Subtotal</vn-label>
|
||||
<span>{{$ctrl.order.total - $ctrl.VAT | currency:'€':2}}</span>
|
||||
<span>{{$ctrl.subtotal | currency:'€':2}}</span>
|
||||
<p>
|
||||
<vn-label translate>VAT</vn-label>
|
||||
<span>{{$ctrl.VAT | currency:'€':2}}</span>
|
||||
|
@ -49,7 +49,7 @@
|
|||
</vn-td>
|
||||
<vn-td><vn-fetched-tags max-length="6" item="row.item"/></vn-td>
|
||||
<vn-td>{{row.warehouse.name}}</vn-td>
|
||||
<vn-td>{{row.shipped | dashIfEmpty}}</vn-td>
|
||||
<vn-td>{{row.shipped | date: 'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td number>{{row.quantity}}</vn-td>
|
||||
<vn-td number>
|
||||
{{row.price | currency:'€':2}}
|
||||
|
@ -59,7 +59,7 @@
|
|||
medium-grey
|
||||
vn-tooltip="Remove item"
|
||||
icon="delete"
|
||||
ng-click="$ctrl.removeRow($index)"
|
||||
ng-click="$ctrl.showDeleteRow($index)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</vn-td>
|
||||
|
@ -81,4 +81,11 @@
|
|||
|
||||
<vn-item-descriptor-popover
|
||||
vn-id="descriptor">
|
||||
</vn-item-descriptor-popover>
|
||||
</vn-item-descriptor-popover>
|
||||
|
||||
<vn-confirm
|
||||
vn-id="delete-row"
|
||||
on-response="$ctrl.deleteRow(response)"
|
||||
question="Delete row"
|
||||
message="Are you sure you want to delete this row?">
|
||||
</vn-confirm>
|
|
@ -13,9 +13,17 @@ class Controller {
|
|||
|
||||
$onInit() {
|
||||
this.getRows();
|
||||
}
|
||||
|
||||
set order(value) {
|
||||
this._order = value;
|
||||
this.getVAT();
|
||||
}
|
||||
|
||||
get order() {
|
||||
return this._order;
|
||||
}
|
||||
|
||||
getRows() {
|
||||
let filter = {
|
||||
where: {orderFk: this.$state.params.id},
|
||||
|
@ -40,9 +48,32 @@ class Controller {
|
|||
});
|
||||
}
|
||||
|
||||
removeRow(index) {
|
||||
let [lineRemoved] = this.rows.splice(index, 1);
|
||||
this.idsToRemove.push(lineRemoved.id);
|
||||
get subtotal() {
|
||||
return this.order.total - this.VAT || 0;
|
||||
}
|
||||
|
||||
showDeleteRow(index) {
|
||||
this.lineIdToRemove = index;
|
||||
this.$scope.deleteRow.show();
|
||||
}
|
||||
|
||||
deleteRow(response) {
|
||||
if (response == 'ACCEPT') {
|
||||
let [lineRemoved] = this.rows.splice(this.lineIdToRemove, 1);
|
||||
this.idsToRemove.push(lineRemoved.id);
|
||||
let params = {
|
||||
rows: this.idsToRemove,
|
||||
actualOrderId: this.$state.params.id
|
||||
};
|
||||
let query = `/order/api/OrderRows/removes`;
|
||||
|
||||
this.$http.post(query, params).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
});
|
||||
this.getVAT();
|
||||
this.card.reload();
|
||||
}
|
||||
this.lineIdToRemove = undefined;
|
||||
}
|
||||
|
||||
// Item Descriptor
|
||||
|
@ -57,14 +88,10 @@ class Controller {
|
|||
}
|
||||
|
||||
save() {
|
||||
let params = {
|
||||
rows: this.idsToRemove,
|
||||
actualOrderId: this.$state.params.id
|
||||
};
|
||||
let query = `/order/api/OrderRows/removes`;
|
||||
let query = `/api/Orders/${this.order.id}/confirm`;
|
||||
|
||||
this.$http.post(query, params).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$http.post(query).then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Order confirmed'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -76,5 +103,8 @@ ngModule.component('vnOrderLine', {
|
|||
controller: Controller,
|
||||
bindings: {
|
||||
order: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^vnOrderCard'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -58,9 +58,9 @@ class Controller {
|
|||
}
|
||||
|
||||
addQuantity(price) {
|
||||
if (this.total + price.grouping <= this.max) {
|
||||
if (this.total + price.grouping <= this.max)
|
||||
price.quantity += price.grouping;
|
||||
}
|
||||
|
||||
this.validate();
|
||||
}
|
||||
validate() {
|
||||
|
@ -76,11 +76,10 @@ class Controller {
|
|||
});
|
||||
let wrongInputs = this.$element[0].querySelectorAll('vn-input-number[name="quantity"] div.infix.invalid');
|
||||
|
||||
if (wrongInputs.length > 0) {
|
||||
if (wrongInputs.length > 0)
|
||||
this.$element[0].querySelector('vn-vertical.prices').classList.add('invalid');
|
||||
} else {
|
||||
else
|
||||
this.$element[0].querySelector('vn-vertical.prices').classList.remove('invalid');
|
||||
}
|
||||
});
|
||||
}
|
||||
getFilledLines() {
|
||||
|
@ -119,6 +118,7 @@ class Controller {
|
|||
this.$http.post(`/order/api/OrderRows/addToOrder`, params).then(res => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||
this.$.popover.hide();
|
||||
this.card.reload();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -131,5 +131,8 @@ ngModule.component('vnOrderPricesPopover', {
|
|||
controller: Controller,
|
||||
bindings: {
|
||||
order: '<'
|
||||
},
|
||||
require: {
|
||||
card: '^vnOrderCard'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
<vn-title vn-two>Volume</vn-title>
|
||||
<div class="totalBox">
|
||||
<vn-label-value label="Total"
|
||||
value="{{::edit.model.totalVolume}}">
|
||||
value="{{::edit.model.totalVolume}} M³">
|
||||
</vn-label-value>
|
||||
<vn-label-value label="Cajas"
|
||||
value="{{::edit.model.totalBoxes}}">
|
||||
value="{{::edit.model.totalBoxes | dashIfEmpty}} U">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
</vn-horizontal>
|
||||
|
|
Loading…
Reference in New Issue