diff --git a/db/changes/10100-allSaints/00-travelLog.sql b/db/changes/10100-allSaints/00-travelLog.sql
index bd7035fd1..fe9d03274 100644
--- a/db/changes/10100-allSaints/00-travelLog.sql
+++ b/db/changes/10100-allSaints/00-travelLog.sql
@@ -1,5 +1,5 @@
CREATE TABLE `vn`.`travelLog` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`originFk` int(10) unsigned NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
@@ -13,6 +13,6 @@ CREATE TABLE `vn`.`travelLog` (
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
- CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
\ No newline at end of file
diff --git a/modules/travel/front/create/index.html b/modules/travel/front/create/index.html
new file mode 100644
index 000000000..586689ff7
--- /dev/null
+++ b/modules/travel/front/create/index.html
@@ -0,0 +1,60 @@
+
+
+
+
diff --git a/modules/travel/front/create/index.js b/modules/travel/front/create/index.js
new file mode 100644
index 000000000..02be34ca7
--- /dev/null
+++ b/modules/travel/front/create/index.js
@@ -0,0 +1,15 @@
+import ngModule from '../module';
+import Section from 'salix/components/section';
+
+class Controller extends Section {
+ onSubmit() {
+ return this.$.watcher.submit().then(
+ res => this.$state.go('travel.card.summary', {id: res.data.id})
+ );
+ }
+}
+
+ngModule.component('vnTravelCreate', {
+ template: require('./index.html'),
+ controller: Controller
+});
diff --git a/modules/travel/front/create/index.spec.js b/modules/travel/front/create/index.spec.js
new file mode 100644
index 000000000..88152120e
--- /dev/null
+++ b/modules/travel/front/create/index.spec.js
@@ -0,0 +1,30 @@
+import './index';
+import watcher from 'core/mocks/watcher';
+
+describe('Travel Component vnTravelCreate', () => {
+ let $element;
+ let $scope;
+ let $state;
+ let controller;
+
+ beforeEach(ngModule('travel'));
+
+ beforeEach(angular.mock.inject(($componentController, $rootScope, _$state_) => {
+ $scope = $rootScope.$new();
+ $state = _$state_;
+ $scope.watcher = watcher;
+ $element = angular.element('');
+ controller = $componentController('vnTravelCreate', {$element, $scope});
+ }));
+
+ describe('onSubmit()', () => {
+ it(`should call submit() on the watcher then expect a callback`, () => {
+ spyOn($state, 'go');
+
+ controller.onSubmit();
+
+ expect(controller.$state.go).toHaveBeenCalledWith('travel.card.summary', {id: 1234});
+ });
+ });
+});
+
diff --git a/modules/travel/front/index.js b/modules/travel/front/index.js
index d9e1fa07e..02bbb997b 100644
--- a/modules/travel/front/index.js
+++ b/modules/travel/front/index.js
@@ -8,3 +8,4 @@ import './card';
import './summary';
import './basic-data';
import './log';
+import './create';
diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html
index 1989a1262..044f1ca8f 100644
--- a/modules/travel/front/index/index.html
+++ b/modules/travel/front/index/index.html
@@ -58,4 +58,11 @@
travel="$ctrl.travelSelected">
+
+
+
\ No newline at end of file
diff --git a/modules/travel/front/locale/es.yml b/modules/travel/front/locale/es.yml
index 54feab876..454cfa58f 100644
--- a/modules/travel/front/locale/es.yml
+++ b/modules/travel/front/locale/es.yml
@@ -12,7 +12,7 @@ Delivered: Enviado
Received: Recibido
Travel id: Id envío
Search travels by id: Buscar envios por identificador
-
+New travel: Nuevo travel
# Sections
Travels: Envíos
Log: Historial
\ No newline at end of file
diff --git a/modules/travel/front/routes.json b/modules/travel/front/routes.json
index f540d532f..357ffffc2 100644
--- a/modules/travel/front/routes.json
+++ b/modules/travel/front/routes.json
@@ -53,6 +53,11 @@
"state": "travel.card.log",
"component": "vn-travel-log",
"description": "Log"
+ }, {
+ "url": "/create",
+ "state": "travel.create",
+ "component": "vn-travel-create",
+ "description": "New travel"
}
]
}
\ No newline at end of file