Merge branch 'dev' of ssh://git.verdnatura.es:/var/lib/git/salix into dev

This commit is contained in:
nelo 2017-06-07 08:38:53 +02:00
commit 97fbc75e05
18 changed files with 181 additions and 53 deletions

2
Jenkinsfile vendored
View File

@ -7,7 +7,7 @@ def branchName = "${env.BRANCH_NAME}";
def branchNameTest = "preprod";
def branchNameProd = "master";
def prefixDocker = "test";
def dockerNginxName = ["nginx", "-p 80:8080 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"]
def dockerNginxName = ["nginx", "-p 80:80 --privileged --link test-auth:auth --link test-salix:salix --link test-client:client"]
def dockerAuthName = ["auth", "-p 3000:3000"]
def dockerSalixName = ["salix", "-p 3001:3001"]
def dockerClientName = ["client", "-p 3002:3002"]

View File

@ -8,7 +8,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
this._loadedModules = {};
}
load(moduleName) {
if(this._loadedModules[moduleName])
if (this._loadedModules[moduleName])
return;
this._loadedModules[moduleName] = true;
@ -17,18 +17,19 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
let modules = splitingRegister.modules;
let promises = [];
for(let dep of deps) {
for (let dep of deps) {
this._loadedModules[dep] = true;
promises.push(modules[dep]());
promises.push(new Promise(resolve => {
$http.get(`/${dep}/validations`).then(
json => this.onValidationsReady(json, resolve)
json => this.onValidationsReady(json, resolve),
json => resolve()
);
}));
$translatePartialLoader.addPart(dep);
// FIXME: https://github.com/angular-translate/angular-translate/pull/1674
//promises.push($translate.refresh());
// promises.push($translate.refresh());
setTimeout (() => $translate.refresh(), 500);
}
@ -41,7 +42,7 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
});
}
parseValidation(val) {
switch(val.validation) {
switch (val.validation) {
case 'custom':
// TODO: Reemplazar eval
val.customValidator = eval(`(${val.customValidator})`);
@ -53,11 +54,11 @@ export function factory($translatePartialLoader, $http, $window, $ocLazyLoad, $q
}
onValidationsReady(json, resolve) {
let entities = json.data;
for(let entity in entities) {
for (let entity in entities) {
let fields = entities[entity].validations;
for(let field in fields) {
for (let field in fields) {
let validations = fields[field];
for(let validation of validations)
for (let validation of validations)
this.parseValidation(validation);
}
}

View File

@ -0,0 +1 @@
export * from './src/production';

View File

@ -0,0 +1,12 @@
{
"module": "production",
"name": "Production",
"icon": "group_work",
"routes": [
{
"url": "/production",
"state": "production",
"component": "vn-production-index"
}
]
}

View File

@ -0,0 +1,23 @@
<div pad-large>
<form ng-submit="$ctrl.onSearch()">
<vn-horizontal>
<vn-textfield vn-one label="ID Ruta" model="$ctrl.filter.ruteId"></vn-textfield>
<vn-textfield vn-one label="Fecha" model="$ctrl.filter.date"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-one
initial-value="$ctrl.filter.province"
field="$ctrl.filter.provinceFk"
url="/client/api/Provinces"
show-field="name"
value-field="id"
label="Provincia">
</vn-autocomplete>
<vn-textfield vn-one label="Hora" model="$ctrl.filter.hour"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-check vn-one pad-medium-top label="Ticket con incidencia" field="$ctrl.filter.withIncidence"></vn-check>
<vn-textfield vn-one label="Agencia" model="$ctrl.filter.agency"></vn-textfield>
</vn-horizontal>
</form>
</div>

View File

@ -0,0 +1,25 @@
import ngModule from '../module';
export default class Controller {
constructor($window) {
this.$window = $window;
}
onSearch() {
this.setStorageValue();
this.onSubmit(this.filter);
}
$onChanges() {
var value = JSON.parse(this.$window.sessionStorage.getItem('production'));
if (value !== undefined)
this.filter = value;
}
setStorageValue() {
this.$window.sessionStorage.setItem('production', JSON.stringify(this.filter));
}
}
Controller.$inject = ['$window'];
ngModule.component('vnProductionFilterPanel', {
template: require('./filter-panel.html'),
controller: Controller
});

View File

@ -0,0 +1,36 @@
<vn-card margin-large>
<mg-ajax path="" options="vnIndex"></mg-ajax>
<vn-vertical pad-medium>
<vn-horizontal vn-one>
<vn-title vn-one><span translate>Localizador</span></vn-title>
<vn-searchbar vn-auto
index="index"
on-search="$ctrl.filter(index)"
advanced="true"
search="$ctrl.model.filter"
popover="vn-production-filter-panel">
</vn-searchbar>
<vn-one vn-horizontal>
<vn-one></vn-one>
<vn-autocomplete vn-one
initial-value="$ctrl.warehouse"
field="$ctrl.warehouseFk"
url="/client/api/ContactChannels"
label="Almacen">
</vn-autocomplete>
<vn-none>
<vn-icon-button icon="refresh"></vn-icon-button>
</vn-none>
</vn-one>
</vn-horizontal>
<vn-horizontal vn-one>
<vn-one>
<vn-horizontal>
<vn-button vn-auto label="Impreso"></vn-button>
</vn-horizontal>
</vn-one>
<vn-two></vn-two>
</vn-horizontal>
</vn-vertical>
</vn-card>

View File

@ -0,0 +1,13 @@
import ngModule from '../module';
export default class ProductionIndex {
search(index) {
index.filter.search = this.model.search;
index.accept();
}
}
ngModule.component('vnProductionIndex', {
template: require('./index.html'),
controller: ProductionIndex
});

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,5 @@
import {ng} from 'vendor';
import 'core';
const ngModule = ng.module('production', []);
export default ngModule;

View File

@ -0,0 +1,6 @@
export * from './module';
// import components
import './index/index';
import './filter-panel/filter-panel';

View File

@ -2,7 +2,7 @@
<vn-horizontal>
<h6 vn-one translate="Modules access"></h6>
</vn-horizontal>
<vn-horizontal vn-one>
<vn-module-container>
<a ng-repeat="mod in $ctrl.modules" ui-sref="{{::mod.route.state}}" class="{{::mod.name}} vn-module mdl-shadow--4dp">
<vn-vertical>
<vn-one>

View File

@ -10,32 +10,45 @@ vn-home {
a:link{
text-decoration: none;
}
.vn-module{
vn-module-container{
display: flex;
flex: none;
padding: 2em;
border-radius: 4px;
box-sizing: border-box;
transition: opacity 0.7s ease;
h4{
text-transform: capitalize;
}
vn-one{
text-align: center;
}
flex: 1;
flex-direction: row;
justify-content: center;
i{
font-size: 50px !important;
margin: 0 auto;
.vn-module{
display: flex;
flex: none;
padding: 2em;
margin: 10px;
border-radius: 4px;
box-sizing: border-box;
transition: opacity 0.7s ease;
h4{
text-transform: capitalize;
font-size: 16pt;
}
vn-one{
text-align: center;
}
i{
font-size: 50px !important;
margin: 0 auto;
}
&:hover{
opacity: 0.7;
}
&.Clients{
background-color: #ffa410;
color: #ffffff;
}
&.Production{
background-color: #95d600;
color: #ffffff;
}
}
&:hover{
opacity: 0.7;
}
&.Clients{
background-color: #ffa410;
color: #ffffff;
}
}
}

View File

@ -9,9 +9,9 @@ export default class LeftMenu {
this.init();
}
init() {
let station = this.$state.current.data.station || 'default';
if (routes[station]) {
routes[station].routes.forEach(i => {
let routes = this.$state.current.data.routes || [];
if (routes.length) {
routes.forEach(i => {
if (i.menu && this.aclService.routeHasPermission(i))
this.items.push({
description: i.menu.description,

View File

@ -50,7 +50,7 @@ function config($stateProvider, $urlRouterProvider, aclServiceProvider) {
loader: loader(moduleName)
},
data: {
station: file
routes: fileRoutes
}
});
}

View File

@ -132,7 +132,7 @@ gulp.task('webpack-dev-server', ['spliting'], function() {
// Locale
var localeFiles = `./${srcDir}/**/locale/*.json`;
var localeFiles = `${srcDir}/**/locale/*.json`;
gulp.task('locales', function() {
var streams = [];
@ -150,22 +150,12 @@ gulp.task('locales', function() {
// Routes
var routeFiles = `./${srcDir}/**/routes.json`;
var routeFiles = `${srcDir}/**/routes.json`;
gulp.task('routes', function() {
function cb(file) {
var relative = file.relative.replace(/\\/g, '/');
var dirname = relative.match(/^(.*)\/routes\.json$/)[1];
return {
dirname: dirname,
json: file.contents
};
}
return gulp.src(routeFiles)
.pipe(wrap('\n"<%=dirname%>": <%=json%>', cb))
.pipe(concat('routes.js', {newLine: ','}))
.pipe(wrap('var routes = {<%=contents%>\n};'))
.pipe(wrap('var routes = [<%=contents%>\n];'))
.pipe(gulp.dest(buildDir));
});

View File

@ -1,6 +1,7 @@
{
"salix": ["client"],
"salix": ["client", "production"],
"auth": [],
"core": [],
"client": []
"client": [],
"production": []
}