#1739 claim.detail dialog add cambiar campos
This commit is contained in:
parent
ae4533c61e
commit
5b38889a72
|
@ -45,7 +45,7 @@
|
|||
<vn-td expand title="{{::saleClaimed.sale.concept}}">
|
||||
<span
|
||||
class="link"
|
||||
ng-click="$ctrl.showDescriptor($event, saleClaimed.sale.itemFk)">
|
||||
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)">
|
||||
{{::saleClaimed.sale.concept}}
|
||||
</span>
|
||||
</vn-td>
|
||||
|
@ -87,7 +87,6 @@
|
|||
<vn-table>
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th number>Id</vn-th>
|
||||
<vn-th number>Landed</vn-th>
|
||||
<vn-th number>Quantity</vn-th>
|
||||
<vn-th number>Description</vn-th>
|
||||
|
@ -98,10 +97,15 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="sale in $ctrl.salesToClaim" class="clickable" ng-click="$ctrl.addClaimedSale($index)">
|
||||
<vn-td number>{{sale.saleFk}}</vn-td>
|
||||
<vn-td number>{{sale.landed | dateTime: 'dd/MM/yyyy'}}</vn-td>
|
||||
<vn-td number>{{sale.quantity}}</vn-td>
|
||||
<vn-td number>{{sale.concept}}</vn-td>
|
||||
<vn-td expand title="{{::sale.concept}}">
|
||||
<span
|
||||
class="link"
|
||||
ng-click="$ctrl.showItemDescriptor($event, sale.itemFk)">
|
||||
{{sale.concept}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td number>{{sale.price | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td number>{{sale.discount}} %</vn-td>
|
||||
<vn-td number>
|
||||
|
|
|
@ -111,8 +111,8 @@ class Controller {
|
|||
return total;
|
||||
}
|
||||
|
||||
// Item Descriptor
|
||||
showDescriptor(event, itemFk) {
|
||||
showItemDescriptor(event, itemFk) {
|
||||
event.stopImmediatePropagation();
|
||||
this.$.descriptor.itemFk = itemFk;
|
||||
this.$.descriptor.parent = event.target;
|
||||
this.$.descriptor.show();
|
||||
|
|
|
@ -3,6 +3,7 @@ import crudModel from 'core/mocks/crud-model';
|
|||
|
||||
describe('claim', () => {
|
||||
describe('Component vnClaimDetail', () => {
|
||||
let $scope;
|
||||
let controller;
|
||||
let $httpBackend;
|
||||
let $state;
|
||||
|
@ -12,12 +13,16 @@ describe('claim', () => {
|
|||
$translateProvider.translations('en', {});
|
||||
}));
|
||||
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
|
||||
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, $rootScope) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.descriptor = {
|
||||
show: () => {}
|
||||
};
|
||||
$httpBackend = _$httpBackend_;
|
||||
$httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
|
||||
$state = _$state_;
|
||||
aclService = {hasAny: () => true};
|
||||
controller = $componentController('vnClaimDetail', {$state, aclService});
|
||||
controller = $componentController('vnClaimDetail', {$state, aclService, $scope});
|
||||
controller.salesToClaim = [{saleFk: 1}, {saleFk: 2}];
|
||||
controller.salesClaimed = [{id: 1, sale: {}}];
|
||||
controller.claim = {ticketFk: 1};
|
||||
|
@ -119,5 +124,24 @@ describe('claim', () => {
|
|||
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
|
||||
describe('showItemDescriptor()', () => {
|
||||
it('should configure the descriptor then show it', () => {
|
||||
const itemId = 500;
|
||||
const event = {
|
||||
stopImmediatePropagation: () => {},
|
||||
target: 'the target element'
|
||||
};
|
||||
spyOn(event, 'stopImmediatePropagation');
|
||||
spyOn(controller.$.descriptor, 'show');
|
||||
|
||||
controller.showItemDescriptor(event, itemId);
|
||||
|
||||
expect(event.stopImmediatePropagation).toHaveBeenCalledWith();
|
||||
expect(controller.$.descriptor.itemFk).toEqual(itemId);
|
||||
expect(controller.$.descriptor.parent).toEqual(event.target);
|
||||
expect(controller.$.descriptor.show).toHaveBeenCalledWith();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue