entry descriptor, add more options to view entry report
This commit is contained in:
parent
0a4adedcdb
commit
832089de79
|
@ -6,7 +6,16 @@
|
||||||
<a translate-attr="{title: 'Preview'}" ui-sref="entry.card.summary({id: $ctrl.entry.id})">
|
<a translate-attr="{title: 'Preview'}" ui-sref="entry.card.summary({id: $ctrl.entry.id})">
|
||||||
<vn-icon icon="desktop_windows"></vn-icon>
|
<vn-icon icon="desktop_windows"></vn-icon>
|
||||||
</a>
|
</a>
|
||||||
<span></span>
|
<vn-icon-menu
|
||||||
|
vn-id="more-button"
|
||||||
|
icon="more_vert"
|
||||||
|
show-filter="false"
|
||||||
|
value-field="callback"
|
||||||
|
translate-fields="['name']"
|
||||||
|
data="$ctrl.moreOptions"
|
||||||
|
on-change="$ctrl.onMoreChange(value)"
|
||||||
|
on-open="$ctrl.onMoreOpen()">
|
||||||
|
</vn-icon-menu>
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="attributes">
|
<div class="attributes">
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
import Component from 'core/lib/component';
|
||||||
|
|
||||||
class Controller {
|
class Controller extends Component {
|
||||||
constructor($scope) {
|
constructor($element, $, $httpParamSerializer, vnConfig) {
|
||||||
this.$ = $scope;
|
super($element, $);
|
||||||
|
this.vnConfig = vnConfig;
|
||||||
|
this.$httpParamSerializer = $httpParamSerializer;
|
||||||
|
this.moreOptions = [
|
||||||
|
{name: 'Show entry report', callback: this.showEntryReport}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMoreChange(callback) {
|
||||||
|
callback.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
get entry() {
|
get entry() {
|
||||||
return this._entry;
|
return this._entry;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +46,6 @@ class Controller {
|
||||||
tooltip: 'All entries with current supplier'
|
tooltip: 'All entries with current supplier'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this._quicklinks = links;
|
this._quicklinks = links;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +56,19 @@ class Controller {
|
||||||
set quicklinks(value = {}) {
|
set quicklinks(value = {}) {
|
||||||
this._quicklinks = Object.assign(value, this._quicklinks);
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showEntryReport() {
|
||||||
|
const params = {
|
||||||
|
clientId: this.vnConfig.storage.currentUserWorkerId,
|
||||||
|
entryId: this.entry.id
|
||||||
|
};
|
||||||
|
const serializedParams = this.$httpParamSerializer(params);
|
||||||
|
let url = `api/report/entry-order?${serializedParams}`;
|
||||||
|
window.open(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$scope'];
|
Controller.$inject = ['$element', '$scope', '$httpParamSerializer', 'vnConfig'];
|
||||||
|
|
||||||
ngModule.component('vnEntryDescriptor', {
|
ngModule.component('vnEntryDescriptor', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import './index.js';
|
||||||
|
|
||||||
|
describe('Entry Component vnEntryDescriptor', () => {
|
||||||
|
let $httpParamSerializer;
|
||||||
|
let controller;
|
||||||
|
let $element;
|
||||||
|
|
||||||
|
beforeEach(ngModule('entry'));
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, _$httpParamSerializer_) => {
|
||||||
|
$httpParamSerializer = _$httpParamSerializer_;
|
||||||
|
$element = angular.element(`<vn-entry-descriptor></vn-entry-descriptor>`);
|
||||||
|
controller = $componentController('vnEntryDescriptor', {$element});
|
||||||
|
controller._entry = {id: 2};
|
||||||
|
controller.vnConfig.storage = {currentUserWorkerId: 9};
|
||||||
|
controller.cardReload = ()=> {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('showEntryReport()', () => {
|
||||||
|
it('should open a new window showing a delivery note PDF document', () => {
|
||||||
|
const params = {
|
||||||
|
clientId: controller.vnConfig.storage.currentUserWorkerId,
|
||||||
|
entryId: controller.entry.id
|
||||||
|
};
|
||||||
|
const serializedParams = $httpParamSerializer(params);
|
||||||
|
let expectedPath = `api/report/entry-order?${serializedParams}`;
|
||||||
|
spyOn(window, 'open');
|
||||||
|
controller.showEntryReport();
|
||||||
|
|
||||||
|
expect(window.open).toHaveBeenCalledWith(expectedPath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,3 +1,4 @@
|
||||||
Reference: Referencia
|
Reference: Referencia
|
||||||
All travels with current agency: Todos los envios con la agencia actual
|
All travels with current agency: Todos los envios con la agencia actual
|
||||||
All entries with current supplier: Todas las entradas con el proveedor actual
|
All entries with current supplier: Todas las entradas con el proveedor actual
|
||||||
|
Show entry report: Ver informe del pedido
|
Loading…
Reference in New Issue