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