diff --git a/client/claim/src/index/index.html b/client/claim/src/index/index.html index 89f9270d2..586328b16 100644 --- a/client/claim/src/index/index.html +++ b/client/claim/src/index/index.html @@ -49,6 +49,9 @@ + + No results + +
+
+
+ + +
+
+
+
+ + clear + + + info_outline + +
+
+
+ diff --git a/client/core/src/components/input-time/index.js b/client/core/src/components/input-time/index.js new file mode 100644 index 000000000..0b5a8fcbd --- /dev/null +++ b/client/core/src/components/input-time/index.js @@ -0,0 +1,55 @@ +import ngModule from '../../module'; +import Textfield from '../textfield/textfield'; +import './style.scss'; + +export default class InputTime extends Textfield { + + constructor($element, $scope, $attrs, vnTemplate, $transclude, $filter) { + super($element, $scope, $attrs, vnTemplate, $transclude); + + this.$filter = $filter; + } + + get value() { + return this._value; + } + + set value(value) { + this._value = value; + this.hasValue = this._value !== null; + + if (this.hasValue) this.element.classList.add('not-empty'); + + this.element.querySelector('.infix').classList.remove('invalid', 'validated'); + } + + get step() { + return parseFloat(this.input.step); + } + + set step(value) { + this.input.step = value; + } +} + +InputTime.$inject = ['$element', '$scope', '$attrs', 'vnTemplate', '$transclude', '$filter']; + +ngModule.component('vnInputTime', { + template: require('./index.html'), + controller: InputTime, + transclude: { + leftIcons: '?tLeftIcons', + rightIcons: '?tRightIcons' + }, + bindings: { + label: '@?', + disabled: ' { + let $componentController; + let $scope; + let $attrs; + let $timeout; + let $element; + let controller; + + beforeEach(() => { + angular.mock.module('claim'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$timeout_) => { + $componentController = _$componentController_; + $scope = $rootScope.$new(); + $attrs = {}; + $timeout = _$timeout_; + $element = angular.element('
'); + controller = $componentController('vnInputNumber', {$element, $scope, $attrs, $timeout, $transclude: () => {}}); + })); + + describe('value() setter', () => { + it(`should set _value to a given value, add the class not-empty and remove invalid and validated`, () => { + controller.value = 'pepino'; + let classes = controller.element.classList.toString(); + + expect(classes).toContain('not-empty'); + expect(controller._value).toEqual('pepino'); + + classes = controller.element.querySelector('.infix').classList.toString(); + + expect(classes).not.toContain('invalid validated'); + }); + + it(`should set _value to a given value and not add the class not-empty if the given value is null`, () => { + controller.value = null; + let classes = controller.element.classList.toString(); + + expect(classes).not.toContain('not-empty'); + expect(controller._value).toEqual(null); + }); + }); + + describe('step() setter/getter', () => { + it(`should set input.step to a given value`, () => { + controller.step = 50; + + expect(controller.input.step).toEqual('50'); + }); + + it(`should return a number`, () => { + controller.step = 50; + + expect(controller.step).toEqual(50); + expect(typeof controller.step).toEqual('number'); + }); + }); +}); diff --git a/client/core/src/components/input-time/style.scss b/client/core/src/components/input-time/style.scss new file mode 100644 index 000000000..3b7333f9b --- /dev/null +++ b/client/core/src/components/input-time/style.scss @@ -0,0 +1,12 @@ +@import 'colors'; +@import '../textfield/style.scss'; + +vn-input-time { + @extend vn-textfield; + + input[type="time"] { + clip-path: inset(0 17px 0 0); + outline:none; + outline:0; + } +} \ No newline at end of file diff --git a/client/core/src/components/textfield/style.scss b/client/core/src/components/textfield/style.scss index 37ee3b511..872ef427f 100644 --- a/client/core/src/components/textfield/style.scss +++ b/client/core/src/components/textfield/style.scss @@ -26,7 +26,6 @@ vn-textfield { } } .infix { - position: relative; display: block; flex: auto; width: 100%; @@ -49,6 +48,7 @@ vn-textfield { label { position: absolute; bottom: 0; + left: 0; padding: 4px 0!important; pointer-events: none; color: $secondary-font-color; diff --git a/client/helpers/watcherHelper.js b/client/helpers/watcherHelper.js index 92c4084b4..2541fb90c 100644 --- a/client/helpers/watcherHelper.js +++ b/client/helpers/watcherHelper.js @@ -7,5 +7,6 @@ module.exports.watcher = { check: () => {}, notifySaved: () => {}, setDirty: () => {}, - setPristine: () => {} + setPristine: () => {}, + updateOriginalData: () => {} }; diff --git a/client/modules.yml b/client/modules.yml index 0b8e1d16b..c68ee4d7a 100644 --- a/client/modules.yml +++ b/client/modules.yml @@ -6,3 +6,4 @@ salix: [] ticket: [item, client] order: [item, ticket] claim: [item, client] +route: [] diff --git a/client/route/routes.json b/client/route/routes.json index f9d358bbd..22ebe01b5 100644 --- a/client/route/routes.json +++ b/client/route/routes.json @@ -4,19 +4,57 @@ "icon" : "local_shipping", "validations" : true, "routes": [ - { - "url": "/routes", - "state": "routes", + /* { + "url": "/route", + "state": "route", "abstract": true, "component": "ui-view", "description": "Routes" }, { "url": "/index?q", - "state": "routes.index", + "state": "route.index", "component": "vn-route-index", "description": "List", "acl": ["developer"] + }, */ + { + "url": "/zone", + "state": "zone", + "abstract": true, + "component": "ui-view", + "description": "Zones" + }, + { + "url": "/index?q", + "state": "zone.index", + "component": "vn-zone-index", + "description": "List", + "acl": ["developer"] + }, + { + "url": "/create", + "state": "zone.create", + "component": "vn-zone-create", + "description": "New zone" + }, + { + "url": "/:id", + "state": "zone.card", + "abstract": true, + "component": "vn-zone-card" + }, + { + "url": "/basic-data", + "state": "zone.card.basicData", + "component": "vn-zone-basic-data", + "description": "Basic data", + "params": { + "client": "$ctrl.client" + }, + "menu": { + "icon": "settings" + } } ] } \ No newline at end of file diff --git a/client/route/src/index.js b/client/route/src/index.js index cfb4664b4..428cafb81 100644 --- a/client/route/src/index.js +++ b/client/route/src/index.js @@ -1,3 +1,8 @@ export * from './module'; // import components +import './zone/card'; +import './zone/descriptor'; +import './zone/search-panel'; +import './zone/index'; +import './zone/create'; diff --git a/client/route/src/locale/es.yml b/client/route/src/locale/es.yml index 4805a41e6..0d1ddbe88 100644 --- a/client/route/src/locale/es.yml +++ b/client/route/src/locale/es.yml @@ -1,15 +1,11 @@ -Basic data: Datos básicos -Logistic data: Datos logísticos -Assigned tickets: Tickets asignados -Routes: Rutas -Route: Ruta -Date: Fecha +Name: Nombre Agency: Agencia -Driver: Conductor -Vehicle: Vehículo -Start Hour: Hora Inicio -End Hour: Hora Fin -Start Km: Km Inicio -End Km: Km Fin -Packages: Bultos -Route document: Documento de Ruta +Warehouse: Almacén +Hour: Hora (ETD) +Price: Precio +Create: Crear + +Zones: Zonas +List: Listado +New zone: Nueva zona +Basic data: Datos básicos \ No newline at end of file diff --git a/client/route/src/module.js b/client/route/src/module.js index 779683e38..2521d0a39 100644 --- a/client/route/src/module.js +++ b/client/route/src/module.js @@ -1,5 +1,5 @@ import {ng} from 'vendor'; import 'core'; -const ngModule = ng.module('route', []); +const ngModule = ng.module('route', ['vnCore']); export default ngModule; diff --git a/client/route/src/zone/card/index.html b/client/route/src/zone/card/index.html new file mode 100644 index 000000000..093e6d42a --- /dev/null +++ b/client/route/src/zone/card/index.html @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/client/route/src/zone/card/index.js b/client/route/src/zone/card/index.js new file mode 100644 index 000000000..5a62d0eef --- /dev/null +++ b/client/route/src/zone/card/index.js @@ -0,0 +1,60 @@ +import ngModule from '../../module'; + +class Controller { + constructor($http, $state) { + this.$http = $http; + this.$state = $state; + this.order = {}; + this.filter = { + include: [ + {relation: 'agencyMode', scope: {fields: ['name']}}, + {relation: 'address', scope: {fields: ['nickname']}}, + {relation: 'rows', scope: {fields: ['id']}}, + { + relation: 'client', + scope: { + fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], + include: { + relation: 'salesPerson', + fields: ['firstName', 'name'] + } + } + } + ] + }; + } + +/* getOrder() { + let json = encodeURIComponent(JSON.stringify(this.filter)); + let query = `/order/api/Orders/${this.$state.params.id}?filter=${json}`; + this.$http.get(query).then(res => { + if (res.data) { + this.order = res.data; + this.getTotal(); + } + }); + } + + getTotal() { + let query = `/order/api/Orders/${this.$state.params.id}/getTotal`; + this.$http.get(query).then(res => { + if (res.data) { + this.order.total = res.data.total; + } + }); + } + $onInit() { + this.getOrder(); + } + + reload() { + this.getOrder(); + } */ +} + +Controller.$inject = ['$http', '$state']; + +ngModule.component('vnZoneCard', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/route/src/zone/card/index.spec.js b/client/route/src/zone/card/index.spec.js new file mode 100644 index 000000000..19ed1993c --- /dev/null +++ b/client/route/src/zone/card/index.spec.js @@ -0,0 +1,68 @@ +import './index.js'; + +describe('Order', () => { + describe('Component vnOrderCard', () => { + let $componentController; + let $scope; + let controller; + let $httpBackend; + let $state; + + beforeEach(() => { + angular.mock.module('order'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); + $scope = $rootScope.$new(); + $scope.card = {createOrder: () => {}}; + $state = {params: {id: 1}}; + controller = $componentController('vnOrderCard', {$scope: $scope, $state: $state}); + })); + + describe('getOrder()', () => { + it(`should make a query, save the data in order and call get order if the response has data`, () => { + spyOn(controller, 'getTotal'); + let json = encodeURIComponent(JSON.stringify(controller.filter)); + $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond({id: 1}); + controller.getOrder(); + $httpBackend.flush(); + + expect(controller.order).toEqual({id: 1}); + expect(controller.getTotal).toHaveBeenCalledWith(); + }); + + it(`should make a query and not call getTotal if the response is not defined`, () => { + spyOn(controller, 'getTotal'); + let json = encodeURIComponent(JSON.stringify(controller.filter)); + $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}?filter=${json}`).respond(undefined); + controller.getOrder(); + $httpBackend.flush(); + + expect(controller.order).toEqual({}); + expect(controller.getTotal).not.toHaveBeenCalledWith(); + }); + }); + + describe('getTotal()', () => { + it(`should make a query and save the data in order.total`, () => { + $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}/getTotal`).respond({total: '20M'}); + controller.getTotal(); + $httpBackend.flush(); + + expect(controller.order.total).toEqual('20M'); + }); + + it(`should make a query and not save the respones if is not defined`, () => { + $httpBackend.expectGET(`/order/api/Orders/${controller.$state.params.id}/getTotal`).respond(); + controller.getTotal(); + $httpBackend.flush(); + + expect(controller.order.total).toEqual(undefined); + }); + }); + }); +}); + diff --git a/client/route/src/zone/create/index.html b/client/route/src/zone/create/index.html new file mode 100644 index 000000000..4305631c0 --- /dev/null +++ b/client/route/src/zone/create/index.html @@ -0,0 +1,69 @@ + + +
+
+ + New zone + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/client/route/src/zone/create/index.js b/client/route/src/zone/create/index.js new file mode 100644 index 000000000..a9a135d17 --- /dev/null +++ b/client/route/src/zone/create/index.js @@ -0,0 +1,34 @@ +import ngModule from '../../module'; + +export default class Controller { + constructor($scope, $state, $http) { + this.$scope = $scope; + this.$state = $state; + this.$http = $http; + this.zone = { + travelingDays: 0, + price: 0.50, + bonus: 0.50 + }; + } + + onSubmit() { + this.$scope.watcher.check(); + + let data = Object.assign({}, this.zone); + data.hour = new Date(this.zone.hour); + + this.$http.post('/route/api/Zones', data).then(res => { + this.$scope.watcher.updateOriginalData(); + this.$scope.watcher.setPristine(); + this.$scope.watcher.notifySaved(); + this.$state.go('zone.card.basicData', {id: res.data.id}); + }); + } +} +Controller.$inject = ['$scope', '$state', '$http']; + +ngModule.component('vnZoneCreate', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/route/src/zone/create/index.spec.js b/client/route/src/zone/create/index.spec.js new file mode 100644 index 000000000..cbfdee558 --- /dev/null +++ b/client/route/src/zone/create/index.spec.js @@ -0,0 +1,43 @@ +import './index'; +import {watcher} from '../../../../helpers/watcherHelper'; + +describe('Route', () => { + describe('Component vnZoneCreate', () => { + let $componentController; + let $httpBackend; + let $scope; + let $state; + let controller; + + beforeEach(() => { + angular.mock.module('route'); + }); + + beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$httpBackend_, _$state_) => { + $componentController = _$componentController_; + $httpBackend = _$httpBackend_; + $httpBackend.when('GET', /\/locale\/\w+\/[a-z]{2}\.json/).respond({}); + $httpBackend.when('GET', 'claim/api/Claims/ClaimBeginnings').respond({}); + $scope = $rootScope.$new(); + $state = _$state_; + $scope.watcher = watcher; + controller = $componentController('vnZoneCreate', {$scope: $scope}); + })); + + describe('onSubmit()', () => { + it(`should call submit() on the watcher then expect a callback`, () => { + spyOn($state, 'go'); + + controller.zone = { + name: 'Zone One' + }; + + $httpBackend.expectPOST(`/route/api/Zones`).respond({id: 1234}); + controller.onSubmit(); + $httpBackend.flush(); + + expect(controller.$state.go).toHaveBeenCalledWith('zone.card.basicData', {id: 1234}); + }); + }); + }); +}); diff --git a/client/route/src/zone/create/locale/es.yml b/client/route/src/zone/create/locale/es.yml new file mode 100644 index 000000000..24b3f6784 --- /dev/null +++ b/client/route/src/zone/create/locale/es.yml @@ -0,0 +1,3 @@ +Traveling days: Días de viaje +Estimated hour (ETD): Hora estimada (ETD) +Bonus: Bonificación \ No newline at end of file diff --git a/client/route/src/zone/descriptor/index.html b/client/route/src/zone/descriptor/index.html new file mode 100644 index 000000000..5fd2cbc54 --- /dev/null +++ b/client/route/src/zone/descriptor/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + +
+ + + + +
+
diff --git a/client/route/src/zone/descriptor/index.js b/client/route/src/zone/descriptor/index.js new file mode 100644 index 000000000..31ad04774 --- /dev/null +++ b/client/route/src/zone/descriptor/index.js @@ -0,0 +1,18 @@ +import ngModule from '../../module'; +import './style.scss'; + +class Controller { + constructor($translate) { + this.translate = $translate; + } +} + +Controller.$inject = ['$translate']; + +ngModule.component('vnZoneDescriptor', { + template: require('./index.html'), + bindings: { + order: '<' + }, + controller: Controller +}); diff --git a/client/route/src/zone/descriptor/locale/es.yml b/client/route/src/zone/descriptor/locale/es.yml new file mode 100644 index 000000000..feb0b4c55 --- /dev/null +++ b/client/route/src/zone/descriptor/locale/es.yml @@ -0,0 +1,8 @@ +Client: Cliente +Confirmed: Confirmado +Not confirmed: Sin confirmar +State: Estado +Landed: F. entrega +Items: Articulos +Agency: Agencia +Sales person: Comercial \ No newline at end of file diff --git a/client/route/src/zone/descriptor/style.scss b/client/route/src/zone/descriptor/style.scss new file mode 100644 index 000000000..469020e50 --- /dev/null +++ b/client/route/src/zone/descriptor/style.scss @@ -0,0 +1,5 @@ +vn-label-value[label=Total]{ + padding-top: 10px; + display: block; + font-size: 1.2em; +} \ No newline at end of file diff --git a/client/route/src/zone/index/index.html b/client/route/src/zone/index/index.html new file mode 100644 index 000000000..2b3cc49a1 --- /dev/null +++ b/client/route/src/zone/index/index.html @@ -0,0 +1,55 @@ + + +
+
+ + + + +
+ + + + + Id + Name + Agency + Warehouse + Hour + Price + + + + + {{::zone.id}} + {{::zone.name}} + {{::zone.agencyMode.name}} + {{::zone.warehouse.name}} + {{::zone.hour | date: 'HH:mm'}} + {{::zone.price | currency:'€':2}} + + + + No results + + + + + +
+ + + + \ No newline at end of file diff --git a/client/route/src/zone/index/index.js b/client/route/src/zone/index/index.js new file mode 100644 index 000000000..052271e46 --- /dev/null +++ b/client/route/src/zone/index/index.js @@ -0,0 +1,32 @@ +import ngModule from '../../module'; + +export default class Controller { + constructor($scope) { + this.$scope = $scope; + this.filter = { + include: [ + {relation: 'agencyMode', fields: ['name']}, + {relation: 'warehouse', fields: ['name']} + ] + }; + } + + exprBuilder(param, value) { + switch (param) { + case 'search': + return /^\d+$/.test(value) + ? {id: value} + : {name: {regexp: value}}; + case 'warehouseFk': + case 'agencyModeFk': + return {[param]: value}; + } + } +} + +Controller.$inject = ['$scope']; + +ngModule.component('vnZoneIndex', { + template: require('./index.html'), + controller: Controller +}); diff --git a/client/route/src/zone/index/index.spec.js b/client/route/src/zone/index/index.spec.js new file mode 100644 index 000000000..eb4439f1f --- /dev/null +++ b/client/route/src/zone/index/index.spec.js @@ -0,0 +1,43 @@ +import './index.js'; + +describe('Route', () => { + describe('Component vnZoneIndex', () => { + let $componentController; + let controller; + + beforeEach(() => { + angular.mock.module('route'); + }); + + beforeEach(angular.mock.inject(_$componentController_ => { + $componentController = _$componentController_; + controller = $componentController('vnZoneIndex'); + })); + + describe('exprBuilder()', () => { + it('should return a formated object with the id in case of search', () => { + let param = 'search'; + let value = 1; + let result = controller.exprBuilder(param, value); + + expect(result).toEqual({id: 1}); + }); + + it('should return a formated object with the warehouseFk in case of warehouseFk', () => { + let param = 'warehouseFk'; + let value = 'Silla'; + let result = controller.exprBuilder(param, value); + + expect(result).toEqual({warehouseFk: 'Silla'}); + }); + + it('should return a formated object with the warehouseFk in case of warehouseFk', () => { + let param = 'agencyModeFk'; + let value = 'My Delivery'; + let result = controller.exprBuilder(param, value); + + expect(result).toEqual({agencyModeFk: 'My Delivery'}); + }); + }); + }); +}); diff --git a/client/route/src/zone/search-panel/index.html b/client/route/src/zone/search-panel/index.html new file mode 100644 index 000000000..86fcece74 --- /dev/null +++ b/client/route/src/zone/search-panel/index.html @@ -0,0 +1,33 @@ +
+
+ + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/client/route/src/zone/search-panel/index.js b/client/route/src/zone/search-panel/index.js new file mode 100644 index 000000000..83591a016 --- /dev/null +++ b/client/route/src/zone/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../../module'; +import SearchPanel from 'core/src/components/searchbar/search-panel'; + +ngModule.component('vnZoneSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/client/ticket/src/index/index.html b/client/ticket/src/index/index.html index a0c325ae0..a638f8026 100644 --- a/client/ticket/src/index/index.html +++ b/client/ticket/src/index/index.html @@ -75,6 +75,9 @@ + + No results + { .click(selectors.ticketPackages.savePackagesButton) .waitForLastSnackbar() .then(result => { - expect(result).toEqual('The package cannot be blank'); + expect(result).toEqual('Package cannot be blank'); }); }); diff --git a/services/db/install/changes/1.1.1/zoneChanges.sql b/services/db/install/changes/1.1.1/zoneChanges.sql new file mode 100644 index 000000000..f04619106 --- /dev/null +++ b/services/db/install/changes/1.1.1/zoneChanges.sql @@ -0,0 +1,8 @@ +ALTER TABLE `vn`.`zoneGeo` +RENAME TO `vn`.`zoneIncluded` ; + +ALTER TABLE `vn`.`zoneNest` +RENAME TO `vn`.`zoneGeo` ; + +ALTER TABLE `vn`.`zone` +CHANGE COLUMN `agencyFk` `agencyModeFk` INT(11) NOT NULL ; diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json index 78ef386f5..f85125d6a 100644 --- a/services/loopback/common/locale/es.json +++ b/services/loopback/common/locale/es.json @@ -11,7 +11,7 @@ "Is invalid": "Is invalid", "Quantity cannot be zero": "La cantidad no puede ser cero", "Enter an integer different to zero": "Introduce un entero distinto de cero", - "The package cannot be blank": "El embalaje no puede estar en blanco", + "Package cannot be blank": "El embalaje no puede estar en blanco", "The company name must be unique": "La razón social debe ser única", "Invalid email": "Correo electrónico inválido", "The IBAN does not have the correct format": "El IBAN no tiene el formato correcto", @@ -48,5 +48,7 @@ "The tag can't be repeated": "El tag no puede repetirse", "The observation type can't be repeated": "El tipo de observación no puede repetirse", "A claim with that sale already exists": "Ya existe una reclamación para esta línea", - "You don't have enough privileges to change that field": "You don't have enough privileges to change that field" + "You don't have enough privileges to change that field": "You don't have enough privileges to change that field", + "Warehouse cannot be blank": "El almacén no puede quedar en blanco", + "Agency cannot be blank": "La agencia no puede quedar en blanco" } \ No newline at end of file diff --git a/services/route/common/models/zone-calendar.json b/services/route/common/models/zone-calendar.json new file mode 100644 index 000000000..9690cdd0f --- /dev/null +++ b/services/route/common/models/zone-calendar.json @@ -0,0 +1,25 @@ +{ + "name": "ZoneCalendar", + "base": "VnModel", + "options": { + "mysql": { + "table": "ZoneCalendar" + } + }, + "properties": { + "zoneFk": { + "id": true, + "type": "Number" + }, + "delivered": { + "type": "Date" + } + }, + "relations": { + "zone": { + "type": "belongsTo", + "model": "Zone", + "foreignKey": "zoneFk" + } + } +} \ No newline at end of file diff --git a/services/route/common/models/zone-geo.json b/services/route/common/models/zone-geo.json new file mode 100644 index 000000000..14f436133 --- /dev/null +++ b/services/route/common/models/zone-geo.json @@ -0,0 +1,24 @@ +{ + "name": "ZoneGeo", + "base": "VnModel", + "options": { + "mysql": { + "table": "zoneGeo" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number" + }, + "name": { + "type": "String" + }, + "lft": { + "type": "Number" + }, + "rgt": { + "type": "Number" + } + } +} \ No newline at end of file diff --git a/services/route/common/models/zone-included.json b/services/route/common/models/zone-included.json new file mode 100644 index 000000000..9f9508824 --- /dev/null +++ b/services/route/common/models/zone-included.json @@ -0,0 +1,30 @@ +{ + "name": "ZoneIncluded", + "base": "VnModel", + "options": { + "mysql": { + "table": "zoneIncluded" + } + }, + "properties": { + "zoneFk": { + "id": true, + "type": "Number" + }, + "isIncluded": { + "type": "Boolean" + } + }, + "relations": { + "zone": { + "type": "belongsTo", + "model": "Zone", + "foreignKey": "zoneFk" + }, + "geo": { + "type": "belongsTo", + "model": "ZoneGeo", + "foreignKey": "geoFk" + } + } +} \ No newline at end of file diff --git a/services/route/common/models/zone.js b/services/route/common/models/zone.js new file mode 100644 index 000000000..228895f79 --- /dev/null +++ b/services/route/common/models/zone.js @@ -0,0 +1,9 @@ +module.exports = Self => { + Self.validatesPresenceOf('warehouseFk', { + message: `Warehouse cannot be blank` + }); + + Self.validatesPresenceOf('agencyModeFk', { + message: `Agency cannot be blank` + }); +}; diff --git a/services/route/common/models/zone.json b/services/route/common/models/zone.json index 2398ecece..70f9c4e39 100644 --- a/services/route/common/models/zone.json +++ b/services/route/common/models/zone.json @@ -1,23 +1,47 @@ { - "name": "Zone", - "base": "VnModel", - "options": { - "mysql": { - "table": "zone" - } - }, - "properties": { - "id": { - "id": true, - "type": "Number", - "forceId": false - }, - "name": { - "type": "String" - }, - "printingOrder":{ - "type": "Number" - } + "name": "Zone", + "base": "VnModel", + "options": { + "mysql": { + "table": "zone" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number" + }, + "name": { + "type": "String", + "required": true + }, + "hour": { + "type": "Date", + "required": true + }, + "travelingDays": { + "type": "Number", + "required": true + }, + "price": { + "type": "Number", + "required": true + }, + "bonus": { + "type": "Number", + "required": true + } + }, + "relations": { + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + }, + "agencyMode": { + "type": "belongsTo", + "model": "AgencyMode", + "foreignKey": "agencyModeFk" + } } - } - \ No newline at end of file +} \ No newline at end of file diff --git a/services/route/server/model-config.json b/services/route/server/model-config.json index 5b7a0dc34..0f200bca2 100644 --- a/services/route/server/model-config.json +++ b/services/route/server/model-config.json @@ -7,5 +7,14 @@ }, "Zone": { "dataSource": "vn" + }, + "ZoneGeo": { + "dataSource": "vn" + }, + "ZoneCalendar": { + "dataSource": "vn" + }, + "ZoneIncluded": { + "dataSource": "vn" } } diff --git a/services/salix/client/index.ejs b/services/salix/client/index.ejs index cb445f458..ef808d0e7 100644 --- a/services/salix/client/index.ejs +++ b/services/salix/client/index.ejs @@ -2,7 +2,7 @@ - Salix + diff --git a/services/ticket/common/models/ticket-packaging.js b/services/ticket/common/models/ticket-packaging.js index 01cb3ee75..801e35351 100644 --- a/services/ticket/common/models/ticket-packaging.js +++ b/services/ticket/common/models/ticket-packaging.js @@ -9,5 +9,5 @@ module.exports = function(Self) { return !isNaN(quantity) && quantity != 0; } - Self.validatesPresenceOf('packagingFk', {message: 'The package cannot be blank'}); + Self.validatesPresenceOf('packagingFk', {message: 'Package cannot be blank'}); };