Second step, add component bankEntity

This commit is contained in:
Jorge Padawan 2021-01-08 10:46:50 +01:00
parent 31f18db72d
commit 5e201419f8
6 changed files with 8 additions and 15 deletions

View File

@ -2,7 +2,7 @@
vn-id="model" vn-id="model"
url="SupplierAccounts" url="SupplierAccounts"
fields="['id', 'supplierFk', 'iban', 'bankEntityFk']" fields="['id', 'supplierFk', 'iban', 'bankEntityFk']"
link="{bankEntityFk: $ctrl.$params.id}" link="{supplierFk: $ctrl.$params.id}"
include="$ctrl.include" include="$ctrl.include"
data="$ctrl.supplierAccounts" data="$ctrl.supplierAccounts"
auto-load="true"> auto-load="true">

View File

@ -38,13 +38,6 @@ class Controller extends Section {
return this.$http.patch(query, this.newBankEntity) return this.$http.patch(query, this.newBankEntity)
.then(res => this.supplierAccount.bankEntityFk = res.data.id); .then(res => this.supplierAccount.bankEntityFk = res.data.id);
} }
onResponse(response) {
this.supplier.postcode = response.code;
this.supplier.city = response.city;
this.supplier.provinceFk = response.provinceFk;
this.supplier.countryFk = response.countryFk;
}
} }
ngModule.vnComponent('vnSupplierAccount', { ngModule.vnComponent('vnSupplierAccount', {

View File

@ -1,5 +1,5 @@
<vn-dialog class="edit" <vn-dialog class="edit"
vn-id="bankentityDialog" vn-id="bankEntityDialog"
on-open="$ctrl.onOpen()" on-open="$ctrl.onOpen()"
on-accept="$ctrl.onAccept()" on-accept="$ctrl.onAccept()"
message="New bank entity"> message="New bank entity">
@ -9,7 +9,7 @@
<vn-textfield <vn-textfield
vn-one vn-one
vn-focus vn-focus
vn-id="entityname" vn-id="entityName"
label="Name" label="Name"
ng-model="$ctrl.location.name" ng-model="$ctrl.location.name"
required="true"> required="true">
@ -35,6 +35,6 @@
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button id= "savePostcode" response="accept" translate>Save</button> <button id= "saveBankEntity" response="accept" translate>Save</button>
</tpl-buttons> </tpl-buttons>
</vn-dialog> </vn-dialog>

View File

@ -4,12 +4,11 @@ import './style.scss';
class Controller extends Component { class Controller extends Component {
open() { open() {
this.$.bankentityDialog.show(); this.$.bankEntityDialog.show();
} }
onOpen() { onOpen() {
this.location = {}; this.location = {};
this.$.bankentity.focus();
} }
onCountryResponse(response) { onCountryResponse(response) {
@ -22,7 +21,7 @@ class Controller extends Component {
throw new Error(`The country can't be empty`); throw new Error(`The country can't be empty`);
this.$http.patch(`bankentities`, this.location).then(() => { this.$http.patch(`bankentities`, this.location).then(() => {
this.vnApp.showMessage(this.$t('The bankentity has been created. You can save the data now')); this.vnApp.showMessage(this.$t('The bank entity has been created. You can save the data now'));
this.emit('response', {$response: this.location}); this.emit('response', {$response: this.location});
}); });
} catch (e) { } catch (e) {

View File

@ -27,7 +27,7 @@ describe('Supplier', () => {
controller.onAccept(); controller.onAccept();
$httpBackend.flush(); $httpBackend.flush();
expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The bankentity has been created. You can save the data now'); expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The bank entity has been created. You can save the data now');
}); });
}); });
}); });

View File

@ -8,6 +8,7 @@ import './search-panel';
import './summary'; import './summary';
import './basic-data'; import './basic-data';
import './fiscal-data'; import './fiscal-data';
import './bankentity';
import './account'; import './account';
import './contact'; import './contact';
import './log'; import './log';