was saving data on page load #1820
gitea/salix/dev There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2019-10-21 13:43:17 +02:00
parent 1739a71e0d
commit 8e1d594a13
2 changed files with 11 additions and 19 deletions

View File

@ -1,10 +1,14 @@
<vn-crud-model auto-load="true" <vn-crud-model vn-id="model" auto-load="true" auto-save="true"
vn-id="model"
url="claim/api/ClaimEnds" url="claim/api/ClaimEnds"
filter="$ctrl.filter" filter="$ctrl.filter"
data="$ctrl.salesClaimed"> data="$ctrl.salesClaimed">
</vn-crud-model> </vn-crud-model>
<vn-crud-model auto-load="true"
url="/claim/api/ClaimDestinations"
data="claimDestinations">
</vn-crud-model>
<vn-card class="vn-mb-md vn-pa-lg vn-w-lg" style="text-align: right" <vn-card class="vn-mb-md vn-pa-lg vn-w-lg" style="text-align: right"
ng-if="$ctrl.salesClaimed.length > 0"> ng-if="$ctrl.salesClaimed.length > 0">
<vn-label-value label="Total claimed" <vn-label-value label="Total claimed"
@ -28,7 +32,6 @@
translate-attr="{title: 'Imports ticket lines'}"> translate-attr="{title: 'Imports ticket lines'}">
</vn-button> </vn-button>
<vn-range <vn-range
vn-one
label="Responsability" label="Responsability"
min-label="Company" min-label="Company"
max-label="Sales/Client" max-label="Sales/Client"
@ -82,14 +85,12 @@
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>
<vn-autocomplete vn-one <vn-autocomplete vn-one id="claimDestinationFk"
id="claimDestinationFk"
ng-model="saleClaimed.claimDestinationFk" ng-model="saleClaimed.claimDestinationFk"
url="/claim/api/ClaimDestinations" data="claimDestinations"
fields="['id','description']" fields="['id','description']"
value-field="id" value-field="id"
show-field="description" show-field="description">
on-change="$ctrl.setClaimDestination(saleClaimed.id, value)">
</vn-autocomplete> </vn-autocomplete>
</vn-td> </vn-td>
<vn-td>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td> <vn-td>{{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>

View File

@ -19,7 +19,8 @@ class Controller {
} }
} }
}, },
{relation: 'claimBeggining'} {relation: 'claimBeggining'},
{relation: 'claimDestination'}
] ]
}; };
this.resolvedState = 3; this.resolvedState = 3;
@ -82,16 +83,6 @@ class Controller {
this.calculateTotals(); this.calculateTotals();
} }
setClaimDestination(id, claimDestinationFk) {
if (claimDestinationFk) {
let params = {id: id, claimDestinationFk: claimDestinationFk};
let query = `claim/api/ClaimEnds/`;
this.$http.patch(query, params).then(() => {
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
}
calculateTotals() { calculateTotals() {
this.claimedTotal = 0; this.claimedTotal = 0;
this.salesClaimed.forEach(sale => { this.salesClaimed.forEach(sale => {