Merge pull request 'hotfix_item.getVisible&Available' (!1339) from hotfix_item.getVisible&Available into test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1339 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
a6dbc64ef6
|
@ -5,6 +5,25 @@ class Controller extends ModuleCard {
|
|||
reload() {
|
||||
this.$http.get(`Items/${this.$params.id}/getCard`)
|
||||
.then(res => this.item = res.data);
|
||||
|
||||
this.$http.get('ItemConfigs/findOne')
|
||||
.then(res => {
|
||||
if (this.$state.getCurrentPath()[4].state.name === 'item.card.diary') return;
|
||||
this.warehouseFk = res.data.warehouseFk;
|
||||
this.getWarehouseName(res.data.warehouseFk);
|
||||
});
|
||||
}
|
||||
|
||||
getWarehouseName(warehouseFk) {
|
||||
const filter = {
|
||||
where: {id: warehouseFk}
|
||||
};
|
||||
this.$http.get('Warehouses/findOne', {filter})
|
||||
.then(res => {
|
||||
this.warehouseText = this.$t('WarehouseFk', {
|
||||
warehouseName: res.data.name
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,15 @@ describe('Item', () => {
|
|||
describe('Component vnItemCard', () => {
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
let $state;
|
||||
let data = {id: 1, name: 'fooName'};
|
||||
|
||||
beforeEach(ngModule('item'));
|
||||
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $stateParams, _$state_) => {
|
||||
$httpBackend = _$httpBackend_;
|
||||
$state = _$state_;
|
||||
$state.getCurrentPath = () => [null, null, null, null, {state: {name: 'item.card.diary'}}];
|
||||
|
||||
let $element = angular.element('<div></div>');
|
||||
controller = $componentController('vnItemCard', {$element});
|
||||
|
@ -19,6 +22,7 @@ describe('Item', () => {
|
|||
}));
|
||||
|
||||
it('should request data and set it on the controller', () => {
|
||||
$httpBackend.expect('GET', `ItemConfigs/findOne`).respond({});
|
||||
controller.reload();
|
||||
$httpBackend.flush();
|
||||
|
||||
|
|
|
@ -68,6 +68,10 @@ class Controller extends Section {
|
|||
|
||||
this.$[descriptor].show(event.target, sale.origin);
|
||||
}
|
||||
|
||||
$onDestroy() {
|
||||
this.card.reload();
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$anchorScroll', '$location'];
|
||||
|
|
Loading…
Reference in New Issue