diff --git a/modules/entry/front/index.js b/modules/entry/front/index.js
index a0272fccf..25e054a71 100644
--- a/modules/entry/front/index.js
+++ b/modules/entry/front/index.js
@@ -5,7 +5,4 @@ import './index/';
import './search-panel';
import './descriptor';
import './card';
-// import './summary';
-// import './basic-data';
-// import './log';
-// import './create';
+import './summary';
diff --git a/modules/entry/front/routes.json b/modules/entry/front/routes.json
index f23ff02bf..ee4853eab 100644
--- a/modules/entry/front/routes.json
+++ b/modules/entry/front/routes.json
@@ -27,6 +27,14 @@
"state": "entry.card",
"abstract": true,
"component": "vn-entry-card"
+ }, {
+ "url": "/summary",
+ "state": "entry.card.summary",
+ "component": "vn-entry-summary",
+ "description": "Summary",
+ "params": {
+ "entry": "$ctrl.entry"
+ }
}
]
}
\ No newline at end of file
diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html
new file mode 100644
index 000000000..5397c72ca
--- /dev/null
+++ b/modules/entry/front/summary/index.html
@@ -0,0 +1,140 @@
+
+ {{$ctrl.travelData.id}} - {{$ctrl.travelData.ref}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Entries
+
+
+
+ Confirmed
+ Entry Id
+ Supplier
+ Reference
+ HB
+ Freight
+ Package
+ CC
+ Pallet
+ m3
+
+
+
+
+
+
+
+
+
+ {{entry.id}}
+ {{entry.supplierName}}
+ {{entry.ref}}
+ {{entry.hb}}
+ {{entry.freightValue | currency: 'EUR': 2}}
+ {{entry.packageValue | currency: 'EUR': 2}}
+ {{entry.cc}}
+ {{entry.pallet}}
+ {{entry.m3}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{$ctrl.total('hb')}}
+ {{$ctrl.total('freightValue') | currency: 'EUR': 2}}
+ {{$ctrl.total('packageValue') | currency: 'EUR': 2}}
+ {{$ctrl.total('cc')}}
+ {{$ctrl.total('pallet')}}
+ {{$ctrl.total('m3')}}
+
+
+
+
+
+
+ Thermographs
+
+
+
+ Code
+ Temperature
+ State
+ Destination
+ Created
+
+
+
+
+ {{thermograph.thermographFk}}
+ {{thermograph.temperature}}
+ {{thermograph.result}}
+ {{thermograph.warehouse.name}}
+ {{thermograph.created | date: 'dd/MM/yyyy'}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js
new file mode 100644
index 000000000..be17feb29
--- /dev/null
+++ b/modules/entry/front/summary/index.js
@@ -0,0 +1,56 @@
+import ngModule from '../module';
+import './style.scss';
+import Component from 'core/lib/component';
+
+class Controller extends Component {
+ constructor($element, $, $httpParamSerializer) {
+ super($element, $);
+ this.entries = [];
+ this.$httpParamSerializer = $httpParamSerializer;
+ }
+
+ get entry() {
+ return this._entry;
+ }
+
+ set entry(value) {
+ this._entry = value;
+
+ // if (value && value.id) {
+ // this.getTravel();
+ // this.getEntries();
+ // this.getThermographs();
+ // }
+ }
+
+ // getTravel() {
+ // return this.$http.get(`/api/Travels/${this.travel.id}/getTravel`).then(response => {
+ // this.travelData = response.data;
+ // });
+ // }
+
+ // getEntries() {
+ // return this.$http.get(`/api/Travels/${this.travel.id}/getEntries`).then(response => {
+ // this.entries = response.data;
+ // });
+ // }
+
+ // total(field) {
+ // let total = 0;
+
+ // for (let entry of this.entries)
+ // total += entry[field];
+
+ // return total;
+ // }
+}
+
+Controller.$inject = ['$element', '$scope', '$httpParamSerializer'];
+
+ngModule.component('vnEntrySummary', {
+ template: require('./index.html'),
+ controller: Controller,
+ bindings: {
+ entry: '<'
+ }
+});
diff --git a/modules/entry/front/summary/index.spec.js b/modules/entry/front/summary/index.spec.js
new file mode 100644
index 000000000..5411d8a0d
--- /dev/null
+++ b/modules/entry/front/summary/index.spec.js
@@ -0,0 +1,108 @@
+import './index';
+
+describe('component vnTravelSummary', () => {
+ let controller;
+ let $httpBackend;
+ let $scope;
+ let $element;
+ let $httpParamSerializer;
+
+ beforeEach(angular.mock.module('travel', $translateProvider => {
+ $translateProvider.translations('en', {});
+ }));
+
+ beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_, _$httpParamSerializer_) => {
+ $httpBackend = _$httpBackend_;
+ $httpParamSerializer = _$httpParamSerializer_;
+ $scope = $rootScope.$new();
+ $element = angular.element(``);
+ controller = $componentController('vnTravelSummary', {$element, $scope});
+ }));
+
+ describe('travel setter/getter', () => {
+ it('should return the travel', () => {
+ controller.travel = {id: null};
+
+ expect(controller.travel).toEqual(jasmine.any(Object));
+ });
+
+ it('should return the travel and then call both getTravel() and getEntries()', () => {
+ spyOn(controller, 'getTravel');
+ spyOn(controller, 'getEntries');
+ spyOn(controller, 'getThermographs');
+ controller.travel = {id: 99};
+
+
+ expect(controller._travel.id).toEqual(99);
+ expect(controller.getTravel).toHaveBeenCalledWith();
+ expect(controller.getEntries).toHaveBeenCalledWith();
+ expect(controller.getThermographs).toHaveBeenCalledWith();
+ });
+ });
+
+ describe('getTravel()', () => {
+ it('should perform a get and then store data on the controller', () => {
+ controller._travel = {id: 999};
+
+ const query = `/api/Travels/${controller._travel.id}/getTravel`;
+ $httpBackend.expectGET(query).respond('I am the travelData');
+ controller.getTravel();
+ $httpBackend.flush();
+
+ expect(controller.travelData).toEqual('I am the travelData');
+ });
+ });
+
+ describe('getEntries()', () => {
+ it('should call the getEntries method to get the entries data', () => {
+ controller._travel = {id: 999};
+
+ const query = `/api/Travels/${controller._travel.id}/getEntries`;
+ $httpBackend.expectGET(query).respond('I am the entries');
+ controller.getEntries();
+ $httpBackend.flush();
+
+ expect(controller.entries).toEqual('I am the entries');
+ });
+ });
+
+ describe('getThermographs()', () => {
+ it('should call the getThermographs method to get the thermographs', () => {
+ controller._travel = {id: 2};
+ const params = {
+ filter: {
+ include: {
+ relation: 'warehouse',
+ scope: {
+ fields: ['id', 'name']
+ }
+ },
+ where: {
+ travelFk: controller._travel.id
+ }
+ }
+ };
+ const serializedParams = $httpParamSerializer(params);
+ const query = `TravelThermographs?${serializedParams}`;
+ $httpBackend.expectGET(query).respond('I am the thermographs');
+ controller.getThermographs();
+ $httpBackend.flush();
+
+ expect(controller.travelThermographs).toEqual('I am the thermographs');
+ });
+ });
+
+ describe('total()', () => {
+ it('should calculate the total amount of a given property for every row', () => {
+ controller.entries = [
+ {id: 1, freightValue: 1, packageValue: 2, cc: 0.01},
+ {id: 2, freightValue: 1, packageValue: 2, cc: 0.01},
+ {id: 3, freightValue: 1, packageValue: 2, cc: 0.01}
+ ];
+
+ expect(controller.total('freightValue')).toEqual(3);
+ expect(controller.total('packageValue')).toEqual(6);
+ expect(controller.total('cc')).toEqual(0.03);
+ });
+ });
+});
diff --git a/modules/entry/front/summary/locale/es.yml b/modules/entry/front/summary/locale/es.yml
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/entry/front/summary/style.scss b/modules/entry/front/summary/style.scss
new file mode 100644
index 000000000..922b36ad8
--- /dev/null
+++ b/modules/entry/front/summary/style.scss
@@ -0,0 +1,10 @@
+@import "variables";
+
+
+vn-travel-summary .summary {
+ max-width: $width-lg;
+
+ vn-icon[icon=insert_drive_file]{
+ color: $color-font-secondary;
+ }
+}
\ No newline at end of file