#655 [FALTA PLANIFICACION] claim.action añadir acciones Front Part
This commit is contained in:
parent
d40597deef
commit
e1131c2c93
|
@ -15,6 +15,16 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-tool-bar margin-medium-bottom>
|
||||||
|
<vn-button
|
||||||
|
vn-acl="salesAssistant"
|
||||||
|
label="Import sales"
|
||||||
|
ng-click="$ctrl.importToNewRefundTicket()"
|
||||||
|
vn-tooltip="Imports sales details">
|
||||||
|
</vn-button>
|
||||||
|
</vn-tool-bar>
|
||||||
|
</vn-horizontal>
|
||||||
<vn-table model="model">
|
<vn-table model="model">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
|
|
|
@ -59,6 +59,14 @@ class Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
importToNewRefundTicket() {
|
||||||
|
let query = `claim/api/ClaimBeginnings/${this.$state.params.id}/importToNewRefundTicket`;
|
||||||
|
this.$http.post(query).then(() => {
|
||||||
|
this.$.model.refresh();
|
||||||
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
focusLastInput() {
|
focusLastInput() {
|
||||||
let inputs = document.querySelectorAll("#claimDestinationFk");
|
let inputs = document.querySelectorAll("#claimDestinationFk");
|
||||||
inputs[inputs.length - 1].querySelector("input").focus();
|
inputs[inputs.length - 1].querySelector("input").focus();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import './index.js';
|
import './index.js';
|
||||||
|
|
||||||
describe('claim', () => {
|
describe('claim', () => {
|
||||||
describe('Component vnClaimDetail', () => {
|
describe('Component vnClaimAction', () => {
|
||||||
let $componentController;
|
let $componentController;
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
|
@ -11,11 +11,10 @@ describe('claim', () => {
|
||||||
angular.mock.module('claim');
|
angular.mock.module('claim');
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_, $rootScope) => {
|
beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => {
|
||||||
$componentController = _$componentController_;
|
$componentController = _$componentController_;
|
||||||
$httpBackend = _$httpBackend_;
|
$httpBackend = _$httpBackend_;
|
||||||
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
|
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
|
||||||
$httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
|
|
||||||
$state = _$state_;
|
$state = _$state_;
|
||||||
$state.params.id = 1;
|
$state.params.id = 1;
|
||||||
|
|
||||||
|
@ -104,5 +103,18 @@ describe('claim', () => {
|
||||||
expect(controller.claimedTotal).toEqual(50);
|
expect(controller.claimedTotal).toEqual(50);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('importToNewRefundTicket()', () => {
|
||||||
|
it('should perform a post query', () => {
|
||||||
|
spyOn(controller.$.model, 'refresh');
|
||||||
|
spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
$httpBackend.expect('POST', `claim/api/ClaimBeginnings/1/importToNewRefundTicket`).respond({});
|
||||||
|
controller.importToNewRefundTicket();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.$.model.refresh).toHaveBeenCalledWith();
|
||||||
|
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,4 +13,3 @@ vn-claim-action {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue