code to correct insert in model
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-03-15 14:50:09 +01:00
parent ec41123772
commit 1ecc76067a
4 changed files with 21 additions and 22 deletions

View File

@ -10,7 +10,7 @@
auto-load="true"
url="Agencies"
filter="$ctrl.filter"
data="agencies">
data="$ctrl.agencies">
</vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg">
@ -18,7 +18,7 @@
<vn-autocomplete vn-id="agency" vn-one
label="Agency"
ng-model="$ctrl.supplierAgencyTerm.agencyFk"
data="agencies"
data="$ctrl.agencies"
show-field="name"
value-field="id"
rule>

View File

@ -5,22 +5,29 @@ export default class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
fields: [
'name'
],
include: [{
relation: 'supplierAgencyTerm',
where: {
supplierFk: 1
}
}],
this.supplierAgencyTerm = {
supplierFk: this.$params.id
};
this.filter = {
include: {
relation: 'supplierAgencyTerm',
scope: {
where: {
supplierFk: 1
}
}
}
};
}
$onInit() {
console.log(this);
}
onSubmit() {
this.$.watcher.submit().then(res => {
this.$state.go('supplier.card.address.index');
this.$state.go('supplier.card.agencyTerm.index');
});
}
}

View File

@ -68,14 +68,6 @@
</vn-icon-button>
</vn-none>
</vn-horizontal>
<vn-one>
<vn-icon-button
vn-bind="+"
vn-tooltip="Add row"
icon="add_circle"
ng-click="$ctrl.add()">
</vn-icon-button>
</vn-one>
</vn-card>
<vn-button-bar>
<vn-submit

View File

@ -19,7 +19,7 @@
},
"relations": {
"supplierAgencyTerm": {
"type": "belongsTo",
"type": "hasOne",
"model": "SupplierAgencyTerm",
"foreignKey": "agencyFk"
}