changes supplier models
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
fe2f12cd8f
commit
e3757e9191
|
@ -186,6 +186,12 @@
|
|||
"model": "BankEntity",
|
||||
"foreignKey": "bankEntityFk"
|
||||
},
|
||||
"supplier": {
|
||||
"type": "belongsTo",
|
||||
"model": "Supplier",
|
||||
"foreignKey": "fi",
|
||||
"primaryKey": "nif"
|
||||
},
|
||||
"defaulters": {
|
||||
"type": "hasMany",
|
||||
"model": "Defaulter",
|
||||
|
|
|
@ -20,7 +20,6 @@ module.exports = Self => {
|
|||
});
|
||||
Self.isAClient = async nif => {
|
||||
const client = await Self.app.models.Client.findOne({where: {fi: nif}});
|
||||
console.log('client', client);
|
||||
return client;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -96,7 +96,13 @@
|
|||
"type": "belongsTo",
|
||||
"model": "Country",
|
||||
"foreignKey": "countryFk"
|
||||
}
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "fi",
|
||||
"primaryKey": "nif"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
|
|
|
@ -28,6 +28,12 @@ class Controller extends ModuleCard {
|
|||
scope: {
|
||||
fields: ['id', 'payDem']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'fi']
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -8,7 +8,8 @@ class Controller extends Descriptor {
|
|||
|
||||
set supplier(value) {
|
||||
this.entity = value;
|
||||
this.iSupplierAClient();
|
||||
console.log('this.entity', this.entity);
|
||||
// this.iSupplierAClient();
|
||||
}
|
||||
|
||||
get entryFilter() {
|
||||
|
@ -29,22 +30,22 @@ class Controller extends Descriptor {
|
|||
to
|
||||
});
|
||||
}
|
||||
iSupplierAClient() {
|
||||
if (!this.supplier) return;
|
||||
// iSupplierAClient() {
|
||||
// if (!this.supplier) return;
|
||||
|
||||
const filter = {
|
||||
where: {fi: this.supplier.nif}
|
||||
};
|
||||
this.$http.get('Clients/findOne', {filter}).then(res => {
|
||||
if (res.data)
|
||||
this.isAClient = res.data;
|
||||
}).catch(error => {
|
||||
return this.isAClient = false;
|
||||
});
|
||||
// this.$http.get(`Suppliers/${this.supplier.nif}/isAClient`).then(res => {
|
||||
// this.isAClient = res.data;
|
||||
// });
|
||||
}
|
||||
// const filter = {
|
||||
// where: {fi: this.supplier.nif}
|
||||
// };
|
||||
// this.$http.get('Clients/findOne', {filter}).then(res => {
|
||||
// if (res.data)
|
||||
// this.isAClient = res.data;
|
||||
// }).catch(error => {
|
||||
// return this.isAClient = false;
|
||||
// });
|
||||
// // this.$http.get(`Suppliers/${this.supplier.nif}/isAClient`).then(res => {
|
||||
// // this.isAClient = res.data;
|
||||
// // });
|
||||
// }
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
|
@ -72,6 +73,12 @@ class Controller extends Descriptor {
|
|||
scope: {
|
||||
fields: ['id', 'payDem']
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'fi']
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue