diff --git a/client/claim/src/action/index.html b/client/claim/src/action/index.html
index 94a27d946..761786d0a 100644
--- a/client/claim/src/action/index.html
+++ b/client/claim/src/action/index.html
@@ -15,6 +15,16 @@
+
+
+
+
+
+
diff --git a/client/claim/src/action/index.js b/client/claim/src/action/index.js
index 295b9a955..f4b751227 100644
--- a/client/claim/src/action/index.js
+++ b/client/claim/src/action/index.js
@@ -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() {
let inputs = document.querySelectorAll("#claimDestinationFk");
inputs[inputs.length - 1].querySelector("input").focus();
diff --git a/client/claim/src/action/index.spec.js b/client/claim/src/action/index.spec.js
index 5241f1a0f..dcc4905b3 100644
--- a/client/claim/src/action/index.spec.js
+++ b/client/claim/src/action/index.spec.js
@@ -1,7 +1,7 @@
import './index.js';
describe('claim', () => {
- describe('Component vnClaimDetail', () => {
+ describe('Component vnClaimAction', () => {
let $componentController;
let controller;
let $httpBackend;
@@ -11,11 +11,10 @@ describe('claim', () => {
angular.mock.module('claim');
});
- beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_, $rootScope) => {
+ beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => {
$componentController = _$componentController_;
$httpBackend = _$httpBackend_;
$httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({});
- $httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({});
$state = _$state_;
$state.params.id = 1;
@@ -104,5 +103,18 @@ describe('claim', () => {
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!');
+ });
+ });
});
});
diff --git a/client/claim/src/action/style.scss b/client/claim/src/action/style.scss
index a3947e63c..32db1645f 100644
--- a/client/claim/src/action/style.scss
+++ b/client/claim/src/action/style.scss
@@ -12,5 +12,4 @@ vn-claim-action {
}
}
}
-}
-
+}
\ No newline at end of file