diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a806bd99c..d0d5be5d5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -940,7 +940,7 @@ export default { }, supplierBasicData: { alias: 'vn-supplier-basic-data vn-textfield[ng-model="$ctrl.supplier.nickname"]', - isOfficial: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isOfficial"]', + isSerious: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isSerious"]', isActive: 'vn-supplier-basic-data vn-check[ng-model="$ctrl.supplier.isActive"]', notes: 'vn-supplier-basic-data vn-textarea[ng-model="$ctrl.supplier.note"]', saveButton: 'vn-supplier-basic-data button[type="submit"]', diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js index 9620af98f..319130b98 100644 --- a/e2e/paths/13-supplier/02_basic_data.spec.js +++ b/e2e/paths/13-supplier/02_basic_data.spec.js @@ -20,7 +20,7 @@ describe('Supplier basic data path', () => { it('should edit the basic data', async() => { await page.clearInput(selectors.supplierBasicData.alias); await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL'); - await page.waitToClick(selectors.supplierBasicData.isOfficial); + await page.waitToClick(selectors.supplierBasicData.isSerious); await page.waitToClick(selectors.supplierBasicData.isActive); await page.write(selectors.supplierBasicData.notes, 'Some notes'); @@ -40,8 +40,8 @@ describe('Supplier basic data path', () => { expect(result).toEqual('Plants Nick SL'); }); - it('should check the isOffical checkbox is now unchecked', async() => { - const result = await page.checkboxState(selectors.supplierBasicData.isOfficial); + it('should check the isSerious checkbox is now unchecked', async() => { + const result = await page.checkboxState(selectors.supplierBasicData.isSerious); expect(result).toBe('unchecked'); }); diff --git a/modules/supplier/back/methods/supplier/getSummary.js b/modules/supplier/back/methods/supplier/getSummary.js index 24a592acf..e6509eaa2 100644 --- a/modules/supplier/back/methods/supplier/getSummary.js +++ b/modules/supplier/back/methods/supplier/getSummary.js @@ -25,7 +25,7 @@ module.exports = Self => { 'id', 'name', 'nickname', - 'isOfficial', + 'isSerious', 'isActive', 'note', 'nif', @@ -39,6 +39,9 @@ module.exports = Self => { 'payDay', 'account', 'isFarmer', + 'sageTaxTypeFk', + 'sageTransactionTypeFk', + 'sageWithholdingFk', ], include: [ { @@ -64,10 +67,27 @@ module.exports = Self => { scope: { fields: ['id', 'payDem'] } + }, + { + relation: 'sageTaxType', + scope: { + fields: ['id', 'vat'] + } + }, + { + relation: 'sageTransactionType', + scope: { + fields: ['id', 'transaction'] + } + }, + { + relation: 'sageWithholding', + scope: { + fields: ['id', 'withholding'] + } } ] }; - let supplier = await Self.app.models.Supplier.findOne(filter); return supplier; }; diff --git a/modules/supplier/back/models/supplier-contact.json b/modules/supplier/back/models/supplier-contact.json index accb2acd6..104a3a404 100644 --- a/modules/supplier/back/models/supplier-contact.json +++ b/modules/supplier/back/models/supplier-contact.json @@ -1,6 +1,10 @@ { "name": "SupplierContact", - "base": "VnModel", + "base": "Loggable", + "log": { + "model":"SupplierLog", + "relation": "supplier" + }, "options": { "mysql": { "table": "supplierContact" diff --git a/modules/supplier/back/models/supplier.json b/modules/supplier/back/models/supplier.json index 596aad745..eb3c5989e 100644 --- a/modules/supplier/back/models/supplier.json +++ b/modules/supplier/back/models/supplier.json @@ -51,6 +51,9 @@ "isOfficial": { "type": "Boolean" }, + "isSerious": { + "type": "Boolean" + }, "note": { "type": "String" }, @@ -123,7 +126,22 @@ "model": "Client", "foreignKey": "nif", "primaryKey": "fi" - } + }, + "sageTaxType": { + "type": "belongsTo", + "model": "SageTaxType", + "foreignKey": "sageTaxTypeFk" + }, + "sageTransactionType": { + "type": "belongsTo", + "model": "SageTransactionType", + "foreignKey": "sageTransactionTypeFk" + }, + "sageWithholding": { + "type": "belongsTo", + "model": "SageWithholding", + "foreignKey": "sageWithholdingFk" + } }, "acls": [ { diff --git a/modules/supplier/front/basic-data/index.html b/modules/supplier/front/basic-data/index.html index 03622cf38..a39f07da2 100644 --- a/modules/supplier/front/basic-data/index.html +++ b/modules/supplier/front/basic-data/index.html @@ -18,8 +18,8 @@ + label="Verified" + ng-model="$ctrl.supplier.isSerious"> diff --git a/modules/supplier/front/descriptor/index.html b/modules/supplier/front/descriptor/index.html index 5e7225e1c..c98a8e001 100644 --- a/modules/supplier/front/descriptor/index.html +++ b/modules/supplier/front/descriptor/index.html @@ -29,9 +29,9 @@ ng-class="{bright: $ctrl.supplier.isActive == false}"> + vn-tooltip="Verified supplier" + icon="verified_user" + ng-class="{bright: $ctrl.supplier.isSerious == true}">