Subtotal
-
{{$ctrl.order.total - $ctrl.VAT | currency:'€':2}}
+
{{$ctrl.subtotal | currency:'€':2}}
VAT
{{$ctrl.VAT | currency:'€':2}}
@@ -49,7 +49,7 @@
{{row.warehouse.name}}
- {{row.shipped | dashIfEmpty}}
+ {{row.shipped | date: 'dd/MM/yyyy'}}
{{row.quantity}}
{{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">
@@ -81,4 +81,11 @@
-
\ No newline at end of file
+
+
+
+
\ No newline at end of file
diff --git a/modules/order/front/line/index.js b/modules/order/front/line/index.js
index fdfa4f8a2..e25d50532 100644
--- a/modules/order/front/line/index.js
+++ b/modules/order/front/line/index.js
@@ -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'
}
});
diff --git a/modules/order/front/prices-popover/index.js b/modules/order/front/prices-popover/index.js
index b31dab0f8..e1f8e3775 100644
--- a/modules/order/front/prices-popover/index.js
+++ b/modules/order/front/prices-popover/index.js
@@ -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'
}
});
diff --git a/modules/order/front/volume/index.html b/modules/order/front/volume/index.html
index 1aee6bdb2..175cf7808 100644
--- a/modules/order/front/volume/index.html
+++ b/modules/order/front/volume/index.html
@@ -14,10 +14,10 @@
Volume
+ value="{{::edit.model.totalVolume}} M³">
+ value="{{::edit.model.totalBoxes | dashIfEmpty}} U">