Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into puppeteer
This commit is contained in:
commit
bd0130514c
|
@ -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;
|
|
@ -0,0 +1,60 @@
|
|||
<mg-ajax path="Travels" options="vnPost"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.travel"
|
||||
form="form"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
vn-one
|
||||
label="Reference"
|
||||
ng-model="$ctrl.travel.ref">
|
||||
</vn-textfield>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.travel.agencyModeFk"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Agency">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Shipped"
|
||||
ng-model="$ctrl.travel.shipped">
|
||||
</vn-date-picker>
|
||||
<vn-date-picker
|
||||
vn-one
|
||||
label="Landed"
|
||||
ng-model="$ctrl.travel.landed">
|
||||
</vn-date-picker>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.travel.warehouseOutFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse Out">
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete
|
||||
vn-one
|
||||
ng-model="$ctrl.travel.warehouseInFk"
|
||||
url="Warehouses"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Warehouse In">
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
<vn-button label="Undo changes" ng-if="watcher.dataChanged()" ng-click="watcher.loadOriginalData()"></vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -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
|
||||
});
|
|
@ -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('<div></div>');
|
||||
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});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -8,3 +8,4 @@ import './card';
|
|||
import './summary';
|
||||
import './basic-data';
|
||||
import './log';
|
||||
import './create';
|
||||
|
|
|
@ -58,4 +58,11 @@
|
|||
travel="$ctrl.travelSelected">
|
||||
</vn-travel-summary>
|
||||
</vn-popup>
|
||||
<a ui-sref="travel.create"
|
||||
vn-tooltip="New travel"
|
||||
vn-bind="+"
|
||||
vn-acl="buyer"
|
||||
fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
||||
<vn-scroll-up></vn-scroll-up>
|
|
@ -11,8 +11,8 @@ Landed: F. llegada
|
|||
Delivered: Enviado
|
||||
Received: Recibido
|
||||
Travel id: Id envío
|
||||
Search travels by id: Buscar envios por identificador
|
||||
|
||||
Search travels by id: Buscar envíos por identificador
|
||||
New travel: Nuevo envío
|
||||
# Sections
|
||||
Travels: Envíos
|
||||
Log: Historial
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue