Put bankEntity on global components, and fixed conflict updates
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a1ca8d90c3
commit
0c335b9705
|
@ -1,6 +1,6 @@
|
||||||
<vn-dialog class="edit"
|
<vn-dialog class="edit"
|
||||||
vn-id="bankEntityDialog"
|
vn-id="bankEntityDialog"
|
||||||
on-open="$ctrl.resetLocation()"
|
on-open="$ctrl.resetData()"
|
||||||
on-accept="$ctrl.onAccept()"
|
on-accept="$ctrl.onAccept()"
|
||||||
message="New bank entity">
|
message="New bank entity">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
vn-focus
|
vn-focus
|
||||||
vn-id="entityName"
|
vn-id="entityName"
|
||||||
label="Name"
|
label="Name"
|
||||||
ng-model="$ctrl.location.name"
|
ng-model="$ctrl.data.name"
|
||||||
required="true">
|
required="true">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
vn-focus
|
vn-focus
|
||||||
vn-id="bic"
|
vn-id="bic"
|
||||||
label="Swift"
|
label="Swift"
|
||||||
ng-model="$ctrl.location.bic"
|
ng-model="$ctrl.data.bic"
|
||||||
required="true">
|
required="true">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
ng-model="$ctrl.location.countryFk"
|
ng-model="$ctrl.data.countryFk"
|
||||||
url="Countries"
|
url="Countries"
|
||||||
show-field="country"
|
show-field="country"
|
||||||
value-field="id"
|
value-field="id"
|
|
@ -1,4 +1,4 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../../module';
|
||||||
import Component from 'core/lib/component';
|
import Component from 'core/lib/component';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
|
@ -6,22 +6,18 @@ class Controller extends Component {
|
||||||
open() {
|
open() {
|
||||||
this.$.bankEntityDialog.show();
|
this.$.bankEntityDialog.show();
|
||||||
}
|
}
|
||||||
resetLocation() {
|
resetData() {
|
||||||
this.location = {};
|
this.data = {};
|
||||||
}
|
|
||||||
|
|
||||||
onCountryResponse(response) {
|
|
||||||
this.location.countryFk = response.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccept() {
|
onAccept() {
|
||||||
try {
|
try {
|
||||||
if (!this.location.countryFk)
|
if (!this.data.countryFk)
|
||||||
throw new Error(`The country can't be empty`);
|
throw new Error(`The country can't be empty`);
|
||||||
|
|
||||||
this.$http.post(`Bankentities`, this.location).then(() => {
|
this.$http.post(`bankEntities`, this.data).then(() => {
|
||||||
this.vnApp.showMessage(this.$t('The bank entity 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.data});
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.vnApp.showError(this.$t(e.message));
|
this.vnApp.showError(this.$t(e.message));
|
|
@ -1,13 +1,13 @@
|
||||||
import './index';
|
import './index';
|
||||||
|
|
||||||
describe('Supplier Component vnNewBankEntity', () => {
|
describe('Salix Component vnNewBankEntity', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
let $scope;
|
let $scope;
|
||||||
let $element;
|
let $element;
|
||||||
let vnApp;
|
let vnApp;
|
||||||
|
|
||||||
beforeEach(ngModule('supplier'));
|
beforeEach(ngModule('salix'));
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
|
beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _vnApp_) => {
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
|
@ -18,13 +18,13 @@ describe('Supplier Component vnNewBankEntity', () => {
|
||||||
controller = $componentController('vnNewBankEntity', {$element, $scope});
|
controller = $componentController('vnNewBankEntity', {$element, $scope});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('resetLocation()', () => {
|
describe('resetData()', () => {
|
||||||
it('should reset the location in the controller', () => {
|
it('should reset the location in the controller', () => {
|
||||||
expect(controller.location).toBeUndefined();
|
expect(controller.data).toBeUndefined();
|
||||||
|
|
||||||
controller.resetLocation();
|
controller.resetData();
|
||||||
|
|
||||||
expect(controller.location).toEqual({});
|
expect(controller.data).toEqual({});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ describe('Supplier Component vnNewBankEntity', () => {
|
||||||
it('should throw an error if there is no country id in the location', () => {
|
it('should throw an error if there is no country id in the location', () => {
|
||||||
jest.spyOn(controller.vnApp, 'showMessage');
|
jest.spyOn(controller.vnApp, 'showMessage');
|
||||||
|
|
||||||
controller.location = {};
|
controller.data = {};
|
||||||
|
|
||||||
controller.onAccept();
|
controller.onAccept();
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ describe('Supplier Component vnNewBankEntity', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should do add the new bank entity', () => {
|
it('should do add the new bank entity', () => {
|
||||||
controller.location = {
|
controller.data = {
|
||||||
countryFk: 1
|
countryFk: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
$httpBackend.expectPOST('Bankentities', controller.location).respond(200, controller.location);
|
$httpBackend.expectPOST('bankEntities', controller.data).respond(200, controller.data);
|
||||||
|
|
||||||
controller.onAccept();
|
controller.onAccept();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
|
@ -8,4 +8,5 @@ The province can't be empty: La provincia no puede quedar vacía
|
||||||
The country can't be empty: El país no puede quedar vacío
|
The country can't be empty: El país no puede quedar vacío
|
||||||
The postcode has been created. You can save the data now: Se ha creado el código postal. Ahora puedes guardar los datos
|
The postcode has been created. You can save the data now: Se ha creado el código postal. Ahora puedes guardar los datos
|
||||||
The city has been created: Se ha creado la ciudad
|
The city has been created: Se ha creado la ciudad
|
||||||
The province has been created: Se ha creado la provincia
|
The province has been created: Se ha creado la provincia
|
||||||
|
The bank entity has been created. You can save the data now: Se ha creado la entidad bancaria. Puedes guardar los datos ahora
|
|
@ -14,3 +14,4 @@ import './summary';
|
||||||
import './topbar/topbar';
|
import './topbar/topbar';
|
||||||
import './user-popover';
|
import './user-popover';
|
||||||
import './upload-photo';
|
import './upload-photo';
|
||||||
|
import './bank-entity';
|
||||||
|
|
|
@ -91,5 +91,6 @@
|
||||||
"The observation type can't be repeated": "The observation type can't be repeated",
|
"The observation type can't be repeated": "The observation type can't be repeated",
|
||||||
"New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
|
"New ticket request has been created with price": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}* and a price of *{{price}} €*",
|
||||||
"New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
|
"New ticket request has been created": "New ticket request has been created *'{{description}}'* for day *{{shipped}}*, with a quantity of *{{quantity}}*",
|
||||||
"There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})"
|
"There's a new urgent ticket": "There's a new urgent ticket: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
|
||||||
|
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty"
|
||||||
}
|
}
|
|
@ -172,5 +172,7 @@
|
||||||
"New ticket request has been created": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
"New ticket request has been created": "Se ha creado una nueva petición de compra *'{{description}}'* para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||||
"That item doesn't exists": "Ese artículo no existe",
|
"That item doesn't exists": "Ese artículo no existe",
|
||||||
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
|
"There's a new urgent ticket": "Hay un nuevo ticket urgente: [{{title}}](https://cau.verdnatura.es/WorkOrder.do?woMode=viewWO&woID={{issueId}})",
|
||||||
"Compensation account is empty": "La cuenta para compensar está vacia"
|
"Compensation account is empty": "La cuenta para compensar está vacia",
|
||||||
|
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
|
||||||
|
"This BIC already exist.": "This BIC already exist."
|
||||||
}
|
}
|
|
@ -21,12 +21,10 @@
|
||||||
ng-model="supplierAccount.iban"
|
ng-model="supplierAccount.iban"
|
||||||
rule>
|
rule>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-autocomplete vn-two vn-focus
|
<vn-autocomplete vn-two
|
||||||
label="Bank entity"
|
label="Bank entity"
|
||||||
initial-data="$ctrl.getName(bankEntity)"
|
|
||||||
ng-model="supplierAccount.bankEntityFk"
|
ng-model="supplierAccount.bankEntityFk"
|
||||||
url="BankEntities"
|
url="BankEntities"
|
||||||
on-change="$ctrl.getName(bankEntity)"
|
|
||||||
show-field="name"
|
show-field="name"
|
||||||
rule>
|
rule>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
|
@ -18,13 +18,9 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onResponse(response) {
|
||||||
this.$.watcher.check();
|
this.name = response.name;
|
||||||
this.$.model.save().then(() => {
|
console.log(this.name);
|
||||||
this.$.watcher.notifySaved();
|
|
||||||
this.$.watcher.updateOriginalData();
|
|
||||||
this.card.reload();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showBankEntity(event) {
|
showBankEntity(event) {
|
||||||
|
@ -38,6 +34,15 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSubmit() {
|
||||||
|
this.$.watcher.check();
|
||||||
|
this.$.model.save().then(() => {
|
||||||
|
this.$.watcher.notifySaved();
|
||||||
|
this.$.watcher.updateOriginalData();
|
||||||
|
this.card.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnSupplierAccount', {
|
ngModule.vnComponent('vnSupplierAccount', {
|
||||||
|
|
|
@ -57,7 +57,9 @@ describe('Supplier Component vnSupplierAccount', () => {
|
||||||
countryFk: 1,
|
countryFk: 1,
|
||||||
id: 2200
|
id: 2200
|
||||||
};
|
};
|
||||||
$httpBackend.expectPATCH(`SupplierAccounts/${controller.$.bankEntity.id}/createBankEntity`).respond({id: 2200});
|
|
||||||
|
const query = `SupplierAccounts/${controller.$.bankEntity.id}/createBankEntity`;
|
||||||
|
$httpBackend.expectPATCH(query).respond({id: 2200});
|
||||||
controller.onBankEntityAccept();
|
controller.onBankEntityAccept();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
Bank entity: Entidad bancaria
|
Bank entity: Entidad bancaria
|
||||||
swift: Swift BIC
|
swift: Swift BIC
|
||||||
|
Add account: Añadir cuenta
|
|
@ -8,7 +8,6 @@ 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';
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
{"state": "supplier.index", "icon": "icon-supplier"}
|
{"state": "supplier.index", "icon": "icon-supplier"}
|
||||||
],
|
],
|
||||||
"card": [
|
"card": [
|
||||||
{"state": "supplier.card.account", "icon": "face"},
|
{"state": "supplier.card.account", "icon": "contact_support"},
|
||||||
{"state": "supplier.card.basicData", "icon": "settings"},
|
{"state": "supplier.card.basicData", "icon": "settings"},
|
||||||
{"state": "supplier.card.fiscalData", "icon": "account_balance"},
|
{"state": "supplier.card.fiscalData", "icon": "account_balance"},
|
||||||
{"state": "supplier.card.billingData", "icon": "icon-payment"},
|
{"state": "supplier.card.billingData", "icon": "icon-payment"},
|
||||||
|
|
Loading…
Reference in New Issue