Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Javi Gallego 2018-05-15 14:02:20 +02:00
commit 63cd55cd66
93 changed files with 2879 additions and 2076 deletions

38
Jenkinsfile vendored
View File

@ -1,30 +1,30 @@
#!/usr/bin/env groovy
def branchName = "${env.BRANCH_NAME}";
def branchName = env.BRANCH_NAME;
// TODO: We are using latest tag until image rotation it's implemented
env.TAG = "latest" /* "${env.BUILD_NUMBER}" */;
env.TAG = 'latest' /* env.BUILD_NUMBER */;
env.BRANCH_NAME = branchName;
env.salixUser="${env.salixUser}";
env.salixPassword="${env.salixPassword}";
env.salixUser = env.salixUser;
env.salixPassword = env.salixPassword;
switch (branchName) {
case "test":
env.NODE_ENV = "test";
env.salixHost = "${env.testSalixHost}";
env.salixPort = "${env.testSalixPort}";
case 'test':
env.NODE_ENV = 'test';
env.salixHost = env.testSalixHost;
env.salixPort = env.testSalixPort;
break;
case "master":
env.NODE_ENV = "production"
env.salixHost = "${env.productionSalixHost}";
env.salixPort = "${env.productionSalixPort}";
env.DOCKER_HOST = "tcp://vch1.verdnatura.es:2375";
case 'master':
env.NODE_ENV = 'production'
env.salixHost = env.productionSalixHost;
env.salixPort = env.productionSalixPort;
env.DOCKER_HOST = 'tcp://vch1.verdnatura.es:2375';
break;
}
node {
stage ('Print environment variables') {
echo "Branch ${branchName}, Build ${env.TAG}, salixHost ${env.salixHost}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}"
echo "Branch ${branchName}, tag ${env.TAG}, environament ${env.NODE_ENV}"
}
stage ('Checkout') {
checkout scm
@ -32,16 +32,16 @@ node {
stage ('Install client Node dependencies') {
sh "npm install"
}
stage ("Removing old dockers") {
sh "docker-compose down --rmi 'all'"
}
stage ('Build project') {
sh "gulp build"
}
stage ("Install services Node dependencies") {
stage ('Install services Node dependencies') {
sh "cd ./services/loopback && npm install"
}
stage ("Generating new dockers") {
stage ('Removing old dockers') {
sh "docker-compose down --rmi 'all'"
}
stage ('Generating new dockers') {
sh "docker-compose up -d --build"
}
}

View File

@ -1,3 +1,4 @@
@import "colors";
vn-login > div {
position: absolute;
@ -5,7 +6,7 @@ vn-login > div {
width: 100%;
margin: 0;
padding: 0;
color: #333;
color: $main-font-color;
font-size: 1.1em;
font-weight: normal;
background-color: #3c393b;

View File

@ -41,7 +41,7 @@
<vn-autocomplete vn-one
initial-data="$ctrl.address.agencyMode"
field="$ctrl.address.agencyModeFk"
url="/client/api/AgencyModes/deliveryMethod"
url="/client/api/AgencyModes"
show-field="name"
value-field="id"
label="Agency">

View File

@ -6,13 +6,13 @@
<vn-one border-radius class="pad-small border-solid"
ng-class="{'bg-dark-item': address.isDefaultAddress,'bg-opacity-item': !address.isActive && !address.isDefaultAddress}">
<vn-horizontal style="align-items: center;">
<vn-none pad-medium-h style="color:#FFA410;">
<i class="material-icons" ng-if="address.isDefaultAddress">star</i>
<i class="material-icons"
<vn-none pad-medium-h>
<i class="material-icons" orange ng-if="address.isDefaultAddress">star</i>
<i class="material-icons" orange
vn-tooltip="Active first to set as default"
tooltip-position="left"
ng-if="!address.isActive">star_border</i>
<i class="material-icons pointer"
<i class="material-icons pointer" orange
ng-if="address.isActive && !address.isDefaultAddress"
vn-tooltip="Set as default"
tooltip-position="left"

View File

@ -5,7 +5,7 @@
form="form"
save="patch">
</vn-watcher>
<form name="form" ng-submit="watcher.submitGo('clientCard.credit.list')">
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card pad-large>
<vn-title>Add credit</vn-title>
<vn-horizontal>
@ -16,3 +16,9 @@
<vn-submit label="Save"></vn-submit>
</vn-button-bar>
</form>
<vn-confirm
vn-id="confirmation"
on-response="$ctrl.returnDialog(response)"
question="Esta modificación retrasará el plazo del próximo recobro"
message="¿Desea continuar?">
</vn-confirm>

View File

@ -1,7 +1,44 @@
import ngModule from '../module';
class Controller {
constructor($http, $scope, $state) {
this.$http = $http;
this.$scope = $scope;
this.$state = $state;
}
onSubmit() {
this.$http.get(`/client/api/Recoveries/${this.$state.params.id}/hasActiveRecovery`).then(res => {
let activeRecovery = res.data;
if (activeRecovery)
this.$scope.confirmation.show();
else
this.addCredit();
});
}
returnDialog(response) {
if (response === 'CANCEL')
return;
this.addCredit();
}
addCredit() {
this.$scope.watcher.submit().then(
() => {
this.$state.go('clientCard.credit.list');
}
);
}
}
Controller.$inject = ['$http', '$scope', '$state'];
ngModule.component('vnClientCreditCreate', {
template: require('./credit-create.html'),
controller: Controller,
bindings: {
client: '<'
}

View File

@ -0,0 +1,85 @@
import './credit-create.js';
describe('Client', () => {
describe('Component vnClientCreditCreate', () => {
let $componentController;
let controller;
let $httpBackend;
let $state;
let $scope;
let client;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_, $rootScope, _$state_) => {
$componentController = _$componentController_;
$scope = $rootScope.$new();
$scope.confirmation = {show: () => {
return {
then: () => {}
};
}};
$scope.watcher = {
submit: () => {
return {
then: callback => {
callback();
}
};
}
};
client = {credit: 0};
$state = _$state_;
$state.params.id = 101;
$httpBackend = _$httpBackend_;
controller = $componentController('vnClientCreditCreate', {$scope: $scope}, {$state: $state});
}));
describe('onSubmit()', () => {
it('should perform a query to check (GET) if the client has an active recovery', () => {
$httpBackend.whenGET(`/client/api/Recoveries/101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`/client/api/Recoveries/101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();
});
it('should call show() method when the client have a recovery', () => {
spyOn(controller.$scope.confirmation, 'show');
$httpBackend.whenGET(`/client/api/Recoveries/101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`/client/api/Recoveries/101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();
expect(controller.$scope.confirmation.show).toHaveBeenCalledWith();
});
it('should call addCredit() method when the client doesnt have a recovery', () => {
spyOn(controller, 'addCredit');
$httpBackend.whenGET(`/client/api/Recoveries/101/hasActiveRecovery`).respond(false);
$httpBackend.expectGET(`/client/api/Recoveries/101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();
expect(controller.addCredit).toHaveBeenCalledWith();
});
});
describe('returnDialog()', () => {
it('should call addCredit() when is called with a param disctint from CANCEL', () => {
spyOn(controller, 'addCredit');
controller.returnDialog('Manzano');
expect(controller.addCredit).toHaveBeenCalledWith();
});
});
describe('addCredit()', () => {
it('should call the function go() on $state to go to the credit list', () => {
spyOn($state, 'go');
client.credit = 1;
controller.addCredit();
expect(controller.$state.go).toHaveBeenCalledWith('clientCard.credit.list');
});
});
});
});

View File

@ -12,7 +12,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="insurance in $ctrl.instances track by insurance.id">
ng-repeat="insurance in index.model.instances track by insurance.id">
<vn-one pad-medium-h>{{::insurance.credit}}</vn-one>
<vn-one pad-medium-h>{{::insurance.grade}}</vn-one>
<vn-two pad-medium-h>{{::insurance.created | date: 'dd/MM/yyyy'}}</vn-two>
@ -22,7 +22,8 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>
<a ui-sref="clientCard.creditInsurance.create({classificationId: {{index.params.classificationId}}})"
fixed-bottom-right vn-tooltip="New classification" vn-bind="+" tooltip-position="left" ng-if="!$ctrl.isClosed">

View File

@ -12,7 +12,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="credit in $ctrl.instances track by credit.id">
ng-repeat="credit in index.model.instances track by credit.id">
<vn-one pad-medium-h>{{::credit.amount | number:2}} €</vn-one>
<vn-two pad-medium-h>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-two>
<vn-two pad-medium-h>{{::credit.worker.firstName}} {{::credit.worker.name}}</vn-two>
@ -22,7 +22,8 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>
<a ui-sref="clientCard.credit.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -14,7 +14,7 @@
<vn-horizontal
class="list list-element text-center"
pad-small-bottom
ng-repeat="greuge in $ctrl.instances track by $index">
ng-repeat="greuge in index.model.instances track by $index">
<vn-one pad-medium-h>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-one>
<vn-two pad-medium-h>{{::greuge.description}}</vn-two>
<vn-one pad-medium-h>{{::greuge.amount | number:2}} €</vn-one>
@ -30,7 +30,8 @@
</vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging margin-large-top vn-one index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging margin-large-top vn-one index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>
<a ui-sref="clientCard.greuge.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -14,11 +14,12 @@
</vn-card>
<vn-card margin-medium-top>
<vn-item-client
ng-repeat="client in $ctrl.clients"
ng-repeat="client in index.model.instances track by client.id"
client="client">
</vn-item-client>
</vn-card>
<vn-auto-paging index="index" total="index.model.count" items="$ctrl.clients"></vn-auto-paging>
<vn-paging index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging index="index" total="index.model.count" items="$ctrl.clients"></vn-auto-paging> -->
</div>
</div>
<a ui-sref="create" vn-bind="+" fixed-bottom-right>

View File

@ -9,10 +9,11 @@ export default class Controller {
}
search(index) {
this.clients = [];
index.accept();
/* this.clients = [];
index.accept().then(res => {
this.clients = res.instances;
});
}); */
}
openSummary(client) {

View File

@ -17,7 +17,7 @@
<vn-horizontal
class="list list-element"
pad-small-bottom
ng-repeat="invoice in $ctrl.instances track by greuge.id">
ng-repeat="invoice in index.model.instances track by greuge.id">
<vn-one>{{::invoice.ref}}</vn-one>
<vn-one>{{::invoice.issued | date:'dd/MM/yyyy' }}</vn-one>
<vn-one>{{::invoice.dued | date:'dd/MM/yyyy' }}</vn-one>
@ -30,5 +30,6 @@
</vn-vertical>
</vn-vertical>
</vn-card>
<vn-auto-paging margin-large-top vn-one index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging margin-large-top vn-one index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -14,7 +14,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="mandate in $ctrl.instances track by mandate.id">
ng-repeat="mandate in index.model.instances track by mandate.id">
<vn-one pad-medium-h>{{::mandate.id}}</vn-one>
<vn-one pad-medium-h>{{::mandate.company.code}}</vn-one>
<vn-one pad-medium-h>{{::mandate.mandateType.name}}</vn-one>
@ -26,5 +26,6 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -13,7 +13,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="recovery in $ctrl.instances track by $index">
ng-repeat="recovery in index.model.instances track by $index">
<vn-none pad-medium-h style="color:#FFA410;">
<i class="material-icons pointer"
vn-tooltip="Finish that recovery period"
@ -30,7 +30,8 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>
<a ui-sref="clientCard.recovery.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -1,3 +1,4 @@
@import "colors";
vn-autocomplete > div > .mdl-textfield {
position: relative;
@ -16,16 +17,15 @@ vn-autocomplete > div > .mdl-textfield {
right: 0;
top: 1.3em;
height: 1em;
color: #888;
color: $secondary-font-color;
border-radius: .2em;
background-color: rgba(255, 255, 255, .8);
& > vn-icon {
cursor: pointer;
font-size: 18px;
&:hover {
color: #333;
color: $main-font-color;
}
}
}
@ -51,10 +51,10 @@ ul.vn-autocomplete {
&.active,
&:hover {
background-color: rgba(1, 1, 1, .1);
background-color: $hover;
}
&.load-more {
color: #ffa410;
color: $main-01;
font-family: vn-font-bold;
padding: .4em .8em;
}

View File

@ -1,3 +1,5 @@
@import "colors";
.vn-dialog {
display: none;
justify-content: center;
@ -62,7 +64,7 @@
input[type="button"],
input[type="submit"],
input[type="reset"] {
color: #ffa410;
color: $main-01;
font-family: vn-font-bold;
padding: .7em;
margin: -0.7em;

View File

@ -1,3 +1,5 @@
@import "colors";
vn-drop-down {
.dropdown {
display: flex;
@ -28,7 +30,7 @@ vn-drop-down {
font-size: 18px;
&:hover {
color: #333;
color: $main-font-color;
}
}
&:hover > vn-icon[icon=clear] {
@ -64,7 +66,7 @@ vn-drop-down {
}
}
.status {
color: #ffab40;
color: $main-01;
font-weight: bold;
}
}

View File

@ -1,5 +1,7 @@
@import "colors";
vn-grid-header {
border-bottom: 3px solid #9D9D9D;
border-bottom: 3px solid $main-header;
font-weight: bold;
.orderly{
text-align: center;

View File

@ -1,3 +1,5 @@
@import "colors";
.vn-grid {
border-collapse: collapse;
width: 100%;
@ -17,17 +19,17 @@
}
}
& > thead, & > tbody {
border-bottom: 3px solid #9D9D9D;
border-bottom: 3px solid $main-header;
}
& > tbody > tr {
border-bottom: 1px solid #9D9D9D;
border-bottom: 1px solid $main-header;
transition: background-color 200ms ease-in-out;
&.clickable {
cursor: pointer;
&:hover {
background-color: #e5e5e5;
background-color: $hover;
}
}

View File

@ -1,17 +1,34 @@
@import "colors";
vn-icon-button {
display: inline-block;
text-align: center;
color: rgba(#f7931e, 0.7);
color: rgba($main-01, 0.7);
transition: color 200ms ease-in-out;
cursor: pointer;
&.button {
background-color: $main-01;
color: white;
width: 64px;
height: 36px;
box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px, rgba(0, 0, 0, 0.2) 0px 3px 1px -2px, rgba(0, 0, 0, 0.12) 0px 1px 5px 0px;
border-radius: 2px;
}
&.button:focus {
will-change: box-shadow;
box-shadow: 0 0 8px rgba(0,0,0,.18),0 8px 16px rgba(0,0,0,.36);
transition: box-shadow .2s cubic-bezier(.4,0,1,1),background-color .2s cubic-bezier(.4,0,.2,1),color .2s cubic-bezier(.4,0,.2,1);
}
&.button i {
margin-top: 6px;
}
& > i,
& > i.material-icons {
display: block;
font-size: inherit;
color: inherit;
}
&:hover {
color: #f7931e;
&:not(.button):hover {
color: $main-01;
}
}

View File

@ -1,9 +1,11 @@
@import "colors";
vn-label-value {
& vn-label {
color: #9b9b9b
color: $secondary-font-color;
}
& span {
color: #222222
color: $main-font-color;
}
}

View File

@ -1,3 +1,5 @@
@import "colors";
vn-paging {
display: block;
text-align: center;
@ -18,7 +20,7 @@ vn-paging {
margin-left: 0;
}
&.active > a {
background: #3c393b;
background: $main-header;
color: #fff;
}
& > a,

View File

@ -1,3 +1,4 @@
@import "colors";
vn-snackbar > div {
box-sizing: border-box;
background-color: #333;
@ -39,7 +40,7 @@ vn-snackbar > div {
border: none;
background-color: transparent;
font-weight: bold;
color: #ffab40;
color: $main-01;
padding: 1em;
margin: -1em;
padding-left: 1.5em;

View File

@ -1,9 +1,11 @@
@import "colors";
vn-step-control {
display: flex;
justify-content: center;
.step-control {
border-top: 2px solid rgb(255,152,0);
border-top: 2px solid $main-01;
margin-bottom: 15px;
& > .steps {
@ -19,8 +21,8 @@ vn-step-control {
}
& > .steps > .step .circle {
border: 2px solid rgb(255,152,0);
background-color: #FFF;
border: 2px solid $main-01;
background-color: white;
align-content: center;
margin-top: -9.5px;
-moz-border-radius: 50%;
@ -32,7 +34,7 @@ vn-step-control {
}
& > .steps > .step .circle.active {
background-color: rgb(255,152,0);
background-color: $main-01;
}
& > .buttons {

View File

@ -153,18 +153,18 @@ export default class Watcher extends Component {
resolve(json);
}
noChanges(resolve) {
noChanges(reject) {
this.vnApp.showMessage(
this.$translate.instant('No changes to save')
);
resolve();
reject(new Error('No changes to save'));
}
invalidForm(resolve) {
invalidForm(reject) {
this.vnApp.showMessage(
this.$translate.instant('Some fields are invalid')
);
resolve();
reject(new Error('Some fields are invalid'));
}
updateOriginalData() {

View File

@ -1,4 +1,4 @@
import './mdl-override.css';
import './mdl-override.scss';
import './mdi-override.css';
import './zoom-image.scss';
import './fontello-head.css';

View File

@ -1,29 +0,0 @@
/**
* Rewrited CSS rules from Material Design Lite.
* FIXME: don't use !important
*/
body {
line-height: initial;
font-size: 12pt;
}
.mdl-button {
font-weight: bolder;
color: #ffa410;
}
.mdl-button--colored {
color: white !important;
}
.mdl-button--colored,
.mdl-button--colored:focus,
.mdl-button--colored:active {
background-color: #ffa410 !important;
}
.mdl-button--colored:hover,
.mdl-button--raised:hover {
background-color: #ffa410 !important;
}
.mdl-button--fab{
color: white !important;
background-color: #ff9400 !important;
}

View File

@ -0,0 +1,48 @@
@import "colors";
/**
* Rewrited CSS rules from Material Design Lite.
* FIXME: don't use !important
*/
body {
line-height: initial;
font-size: 12pt;
}
.mdl-button {
font-weight: bolder;
color: $main-01;
}
.mdl-button--colored {
color: white !important;
}
.mdl-textfield--floating-label.is-focused .mdl-textfield__label,
.mdl-textfield--floating-label.is-dirty .mdl-textfield__label,
.mdl-textfield--floating-label.has-placeholder .mdl-textfield__label {
color: $main-01 !important;
}
.mdl-checkbox.is-checked .mdl-checkbox__box-outline, {
border: 2px solid $main-01;
}
fieldset[disabled] .mdl-checkbox .mdl-checkbox__box-outline, .mdl-checkbox.is-disabled .mdl-checkbox__box-outline {
border: 2px solid rgba(0,0,0,.26);
}
.mdl-checkbox.is-checked .mdl-checkbox__tick-outline {
background: $main-01;
}
.mdl-textfield__label::after{
background-color: $main-01 !important;
}
.mdl-button--colored,
.mdl-button--colored:focus,
.mdl-button--colored:active {
background-color: $main-01 !important;
}
.mdl-button--colored:hover,
.mdl-button--raised:hover {
background-color: $main-01 !important;
}
.mdl-button--fab{
color: white !important;
background-color: $main-01 !important;
}

View File

@ -24,5 +24,6 @@
<vn-horizontal vn-one class="list list-footer text-center"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -15,11 +15,12 @@
</vn-card>
<vn-card margin-medium-top>
<vn-item-product
ng-repeat="item in $ctrl.items track by $index"
ng-repeat="item in index.model.instances track by item.id"
item="item">
</vn-item-product>
</vn-card>
<vn-auto-paging index="index" total="index.model.count" items="$ctrl.items"></vn-auto-paging>
<vn-paging index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging index="index" total="index.model.count" items="$ctrl.items"></vn-auto-paging> -->
</div>
</div>
<a ui-sref="item.create" vn-bind="+" fixed-bottom-right>

View File

@ -14,10 +14,11 @@ class ItemList {
}
search(index) {
this.items = [];
index.accept();
/* this.items = [];
index.accept().then(res => {
this.items = res.instances;
});
}); */
}
cloneItem(item) {

View File

@ -1,3 +1,5 @@
@import "colors";
vn-home {
padding: 2em;
@ -17,7 +19,7 @@ vn-home {
& > a {
overflow:hidden;
border-radius: 6px;
background-color: #FF9300;
background-color: $main-01;
color: white;
display: flex;
flex-direction: column;
@ -30,7 +32,7 @@ vn-home {
transition: opacity 250ms ease-out;
&:hover {
opacity: .7;
background-color: $hover;
}
& > vn-icon {
font-size: 4em;
@ -42,6 +44,7 @@ vn-home {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
color: white;
}
}
}

View File

@ -1,7 +1,8 @@
@import "colors";
vn-menu-item {
& > li.active {
background-color: #424242;
background-color: $main-header;
color: white;
}
}

View File

@ -1,3 +1,5 @@
@import "colors";
vn-main-menu {
#user {
display: inline-block;
@ -6,12 +8,15 @@ vn-main-menu {
height: 2.5em;
vertical-align: middle;
}
#user h6{
color: white;
}
& > div > vn-icon, & > div > a > vn-icon {
font-size: 2.2em;
cursor: pointer;
&:hover {
color: #FF9300;
color: $main-01;
}
}
.vn-popover ul {
@ -20,7 +25,7 @@ vn-main-menu {
color: white;
li {
background-color: #FF9300;
background-color: $main-01;
margin-bottom: .6em;
cursor: pointer;
padding: .8em;
@ -32,8 +37,7 @@ vn-main-menu {
vertical-align: middle;
}
&:hover {
background-color: #FF9300;
opacity: 0.7 !important;
background-color: $hover;
}
&:last-child {
margin-bottom: 0;

View File

@ -16,6 +16,17 @@ export function config($translatePartialLoaderProvider, $httpProvider, $qProvide
}
ngModule.config(config);
/*
// FIXME: Handle unhandled exceptions
exceptionHandler.$inject = ['vnApp'];
function exceptionHandler(vnApp) {
return function(exception, cause) {
console.error(exception);
};
}
ngModule.factory('$exceptionHandler', exceptionHandler);
*/
const HOOK_ABORTED_TRANSITION = 3;
run.$inject = ['$window', '$rootScope', 'vnApp', '$state'];

View File

@ -4,11 +4,11 @@ $bg-main: $color-green;
$bg-minor: $color-orange;
$bg-content: $color-light-grey;
$bg-panel: $color-white;
$bg-dark-bar: $color-dark;
$bg-dark-bar: $main-header;
$bg-dark-menu: $color-dark-grey;
html [bg-main], .bg-main {
background-color: $bg-main;
background-color: $main-bg;
}
html [bg-minor], .bg-minor {
background-color: $bg-minor;

View File

@ -1,11 +1,23 @@
$main-font-color :#222222;
$secondary-font-color: #9b9b9b;
$main-header: #3d3d3d;
$hover: #c4c4c4;
$main-bg: #e5e5e5;
$main-01: #f7931e;
$main-01-05: rgba($main-01, 0.5);
$main-01-03: rgba($main-01, 0.3);
$main-02: #a3d131;
$main-02-05: rgba($main-02, 0.5);
$main-02-03: rgba($main-02, 0.3);
$color-green: #a3d131;
$color-orange: #f7931e;
$color-white: white;
$color-dark: #3d3d3d;
$color-dark: $main-header; //headerbar
$color-dark-grey: #424242;
$color-light-grey: #e5e5e5;
$color-medium-grey: #9b9b9b;
$color-grey: #c4c4c4;
$color-light-grey: $main-bg;
$color-medium-grey: $secondary-font-color;
$color-grey: #c4c4c4; //deprecated
$color-medium-green: rgba($color-green, 0.5);
$color-medium-orange: rgba($color-orange, 0.5);
$color-light-green: rgba($color-green, 0.3);

View File

@ -1,10 +1,9 @@
@import "colors";
@import "font-family";
$font-color: $color-dark-grey;
body {
color: $font-color;
color: $main-font-color;
font-family: vn-font;
}
html [uppercase], .uppercase {
@ -12,12 +11,12 @@ html [uppercase], .uppercase {
}
html [green], .green{color: $color-green}
html [orange], .orange{color: $color-orange}
html [orange], .orange{color: $main-01}
html [white], .white{color: $color-white}
html [dark], .dark{color: $color-dark}
html [dark-grey], .dark-grey{color: $color-dark-grey}
html [light-grey], .light-grey{color: $color-light-grey}
html [medium-grey], .medium-grey{color: $color-medium-grey}
html [medium-grey], .medium-grey{color: $hover}
html [medium-green], .medium-green{color: $color-medium-green}
html [medium-orange], .medium-orange{color: $color-medium-orange}
html [light-green], .light-green{color: $color-light-green}

View File

@ -8,3 +8,4 @@ import './border.scss';
import './font-style.scss';
import './misc.scss';
import './summary.scss';
import './colors.scss';

View File

@ -64,9 +64,9 @@ html [vn-center], .vn-center{
.list-element{
padding: 8px 0 0 0;
border-bottom: 1px solid $color-medium-grey;
border-bottom: 1px solid $main-header;
i {
color: $color-orange;
color: $main-01;
}
}
.tooltip {
@ -81,7 +81,7 @@ html [vn-center], .vn-center{
}
.list-footer{
font-family: vn-font-bold;
border-top: 3px solid $color-medium-grey;
border-top: 3px solid $main-header;
}
.list-element.warning{
background-color: $color-medium-orange;
@ -97,7 +97,7 @@ html [vn-center], .vn-center{
background-color: $color-light-orange;
}
.flatpickr-month, .flatpickr-weekdays, span.flatpickr-weekday {
background-color: $color-orange;
background-color: $main-01;
}
html [pointer], .pointer{
@ -121,7 +121,7 @@ a {
transition: background-color 250ms ease-out;
&:hover {
background-color: rgba(0, 0, 0, .1);
background-color: $hover;
}
}
@ -134,6 +134,14 @@ vn-button-bar {
margin-top: $margin-small;
}
vn-tool-bar {
display: flex;
& > * {
margin-right: .6em;
}
}
vn-main-block {
display:block;
max-width: 1920px;
@ -150,7 +158,7 @@ vn-main-block {
.vn-descriptor {
.header {
background: #ffa410;
background: $main-01;
color: white;
justify-content: space-between;
align-items: stretch;
@ -183,7 +191,7 @@ vn-main-block {
font-size: 1.5em;
}
& > vn-icon.bright {
color: #ffa410;
color: $main-01;
opacity: 1;
}
}
@ -194,14 +202,6 @@ vn-main-block {
margin: 0 auto;
}
vn-tool-bar {
display: flex;
& > * {
margin-right: .6em;
}
}
.vn-list-item {
@extend .pad-medium;
@extend .border-solid-bottom;
@ -216,7 +216,7 @@ vn-tool-bar {
vn-icon {
opacity: .4;
color: #ffa410;
color: $main-01;
margin-left: .5em;
transition: opacity 250ms ease-out;
font-size: 2em;
@ -228,12 +228,12 @@ vn-tool-bar {
}
/** START - FORM ELEMENTS DISABLED **/
fieldset[disabled] .mdl-textfield .mdl-textfield__input, .mdl-textfield.is-disabled .mdl-textfield__input,
fieldset[disabled] .mdl-checkbox .mdl-checkbox__label, .mdl-checkbox.is-disabled .mdl-checkbox__label{
fieldset[disabled] .mdl-checkbox .mdl-checkbox__label, .mdl-checkbox.is-disabled .mdl-checkbox__label {
border: none !important;
color: inherit !important;
}
fieldset[disabled] .mdl-textfield .mdl-textfield__label, .mdl-textfield.is-disabled.is-disabled .mdl-textfield__label {
color: rgb(255,171,64) !important;
color: $main-01 !important;
}
/** END - FORM ELEMENTS DISABLED **/

View File

@ -2,12 +2,12 @@
.summary{
h5 {
border-bottom: 2px solid $color-orange;
border-bottom: 2px solid $main-01;
margin: 0 0 5px 0
}
h5.title {
border: none;
background: $color-orange;
background: $main-01;
color: $color-white;
}
p {
@ -36,7 +36,7 @@
}
& > div > button.close > vn-icon {
color: $color-orange;
color: $main-01;
}
& > div {

View File

@ -1,3 +1,4 @@
@import "colors";
h1 {
font-size: 32pt;
@ -23,4 +24,5 @@ h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: .2em;
font-family: vn-font-bold;
color: $main-font-color
}

View File

@ -1,4 +1,4 @@
<mg-ajax path="/ticket/api/Sales/saleComponentFilter" options="vnIndex" actions="$ctrl.sales = index.model.instances"></mg-ajax>
<mg-ajax path="/ticket/api/Sales/saleComponentFilter" options="vnIndexNonAuto" actions="$ctrl.sales = index.model.instances"></mg-ajax>
<vn-vertical>
<vn-card pad-large>
<vn-vertical>
@ -65,6 +65,7 @@
</tbody>
</table>
</vn-vertical>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-card>
</vn-vertical>

View File

@ -1,7 +1,14 @@
import ngModule from '../module';
import './style.scss';
import FilterTicketList from '../filter-ticket-list';
class Controller extends FilterTicketList {
constructor($scope, $timeout, $stateParams) {
super($scope, $timeout, $stateParams);
this.$scope = $scope;
this.onOrder('itemFk', 'ASC');
}
class Controller {
total() {
let sum;
if (this.sales) {
@ -36,6 +43,8 @@ class Controller {
}
}
Controller.$inject = ['$scope', '$timeout', '$state'];
ngModule.component('vnTicketComponents', {
template: require('./component.html'),
controller: Controller,

View File

@ -23,7 +23,7 @@
value="{{$ctrl.ticket.client.salesPerson.firstName}} {{$ctrl.ticket.client.salesPerson.name}}">
</vn-label-value>
<vn-label-value label="Shipped"
value="{{$ctrl.ticket.shipped | date}}">
value="{{$ctrl.ticket.shipped | date: 'dd/MM/yyyy HH:mm' }}">
</vn-label-value>
<vn-label-value label="Agency"
value="{{$ctrl.ticket.agencyMode.name}}">

View File

@ -17,7 +17,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="expedition in $ctrl.instances track by expedition.id">
ng-repeat="expedition in index.model.instances track by expedition.id">
<vn-one pad-medium-h style="color:#FFA410;">
<i
pointer
@ -38,5 +38,6 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -30,7 +30,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="ticket in $ctrl.tickets track by ticket.id"
<tr ng-repeat="ticket in index.model.instances track by ticket.id"
class="{{::$ctrl.compareDate(ticket.shipped)}} clickable"
ui-sref="ticket.card.summary({id: {{::ticket.id}}})">
<td>
@ -62,7 +62,8 @@
</table>
</vn-horizontal>
</vn-card>
<vn-auto-paging vn-one index="index" total="index.model.count" items="$ctrl.tickets"></vn-auto-paging>
<vn-paging vn-one index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one index="index" total="index.model.count" items="$ctrl.tickets"></vn-auto-paging> -->
</div>
</div>
<a ui-sref="ticket.create" vn-bind="+" fixed-bottom-right>

View File

@ -31,10 +31,11 @@ export default class Controller {
}
search(index) {
this.tickets = [];
index.accept();
/* this.tickets = [];
index.accept().then(res => {
this.tickets = res.instances;
});
}); */
}
}

View File

@ -13,7 +13,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in $ctrl.instances track by sale.id">
<tr ng-repeat="sale in index.model.instances track by sale.id">
<td style="text-align:center!important">
<vn-check style="text-align:center!important"
vn-one field="sale.isChecked.isChecked"
@ -31,5 +31,6 @@
</table>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -61,7 +61,8 @@
</table>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="index.model.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="index.model.instances"></vn-auto-paging> -->
<vn-item-descriptor-popover vn-id="descriptor">
</vn-item-descriptor-popover>
</vn-popover>

View File

@ -23,7 +23,7 @@
</vn-one>
<vn-one>
<vn-label-value label="Shipped"
value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy'}}">
value="{{$ctrl.summary.shipped | date: 'dd/MM/yyyy HH:mm'}}">
</vn-label-value>
<vn-label-value label="Landed"
value="{{$ctrl.summary.landed | date: 'dd/MM/yyyy'}}">

View File

@ -10,7 +10,7 @@ class Controller {
if (!this.ticket)
return;
this.$http.get(`/client/api/Tickets/${this.ticket.id}/summary`).then(res => {
this.$http.get(`/ticket/api/Tickets/${this.ticket.id}/summary`).then(res => {
if (res && res.data)
this.summary = res.data;
});

View File

@ -12,7 +12,7 @@
<vn-horizontal
vn-one class="list list-element text-center"
pad-small-bottom
ng-repeat="ticket in $ctrl.instances track by ticket.id">
ng-repeat="ticket in index.model.instances track by ticket.id">
<vn-one pad-medium-h>{{::ticket.state.name}}</vn-one>
<vn-two pad-medium-h>{{::ticket.worker.firstName}} {{ticket.worker.name}}</vn-two>
<vn-two pad-medium-h>{{::ticket.created | date:'dd/MM/yyyy HH:mm'}}</vn-two>
@ -22,7 +22,8 @@
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>
<a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -15,7 +15,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in $ctrl.instances track by sale.id" class="list list-element">
<tr ng-repeat="sale in index.model.instances track by sale.id" class="list list-element">
<td number>{{::sale.itemFk}}</td>
<td><vn-fetched-tags sale="sale"/></td>
<td number>{{::sale.quantity}}</td>
@ -30,5 +30,6 @@
</table>
</vn-vertical>
</vn-card>
<vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
<!-- <vn-auto-paging vn-one margin-large-top index="index" total="index.model.count" items="$ctrl.instances"></vn-auto-paging> -->
</vn-vertical>

View File

@ -22,10 +22,10 @@ describe('Client', () => {
});
});
it('should search for the user Petter Parker', () => {
it('should search for the user Ororo Munroe', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.type(selectors.clientsIndex.searchClientInput, 'Ororo Munroe')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
@ -36,7 +36,7 @@ describe('Client', () => {
it(`should click on the search result to access to the client's credit`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ororo Munroe')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientCredit.creditButton)
.waitForURL('credit/list')

View File

@ -169,7 +169,6 @@ gulp.task('docker-compose', async () => {
'salixPassword=${salixPassword}'
],
container_name: `\${BRANCH_NAME}-${service.name}`,
volumes: ["/config:/app"],
image: `${service.name}:\${TAG}`,
build: {
context: `./services`,

View File

@ -0,0 +1,34 @@
module.exports = Self => {
Self.remoteMethod('hasActiveRecovery', {
description: 'Returns a boolean that is true when a client has an active recovery',
accessType: 'READ',
accepts: [
{
arg: 'clientFk',
type: 'number',
required: true,
description: 'The id of a client',
http: {source: 'path'}
}
],
returns: {
type: 'boolean',
root: true
},
http: {
path: `/:clientFk/hasActiveRecovery`,
verb: 'GET'
}
});
Self.hasActiveRecovery = async id => {
let result = await Self.rawSql(
`SELECT count(*) AS hasActiveRecovery
FROM vn.recovery
WHERE clientFk = ?
AND IFNULL(finished,CURDATE()) >= CURDATE();`,
[id]
);
return result[0].hasActiveRecovery != 0;
};
};

View File

@ -1,3 +1,4 @@
module.exports = function(Self) {
require('../methods/recovery/filter')(Self);
require('../methods/recovery/hasActiveRecovery')(Self);
};

View File

@ -6,7 +6,7 @@ mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump
echo USE `vn`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc >> install/dump/03-dumpedFixtures.sql
echo USE `vn2008`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas>> install/dump/03-dumpedFixtures.sql
echo USE `bi`; >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql
echo USE `cache`; >> install/dump/03-dumpedFixtures.sql

View File

@ -7,7 +7,7 @@ mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump
echo "USE \`vn\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc >> install/dump/03-dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos>> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas>> install/dump/03-dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/03-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/03-dumpedFixtures.sql

View File

@ -8,13 +8,13 @@ else
# Dump structure
for file in dump/*-*.sql; do
echo "Imported $file"
mysql -u root -proot < $file
mysql -u root -proot -fc < $file
done
# Import changes
for file in changes/*/*.sql; do
echo "Imported $file"
mysql -u root -proot < $file
echo "Imported $file"
mysql -u root -proot -fc < $file
done
# Import fixtures

View File

@ -1,29 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `ticketVolume`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `ticketVolume`(IN vTicketId INT)
BEGIN
DECLARE vWarehouseId INTEGER;
DECLARE vShippedDate DATE;
DROP TEMPORARY TABLE IF EXISTS ticketVolume;
SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId;
CREATE TEMPORARY TABLE IF NOT EXISTS ticketVolume ENGINE MEMORY
SELECT itemFk, saleFk, quantity, concept, VolUd as m3_uni, volume as m3, volume * quantity as volumeTimesQuantity, @m3:= @m3 + ifnull(volume,0) as m3_total
FROM
(
SELECT round(r.cm3 / 1000000,3) as VolUd ,s.quantity, round(r.cm3 * s.quantity / 1000000,3) as volume,
s.itemFk, s.id AS saleFk, s.concept, @m3:= 0, @vol:=0, t.agencyModeFk
FROM sale s
JOIN vn.ticket t on t.id = s.ticketFk
JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk
WHERE s.ticketFk = vTicketId
) sub;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`ticketUpdateAction` AS
SELECT
`b`.`buo_id` AS `id`, `b`.`description` AS `description`
FROM
`vn2008`.`bionic_updating_options` `b`;

View File

@ -1,10 +0,0 @@
USE `bs`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `bs`.`workerMana` AS
SELECT
`m`.`Id_Trabajador` AS `workerFk`, `m`.`used` AS `amount`
FROM
`bs`.`mana_spellers` `m`;

View File

@ -1,10 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `ticketWeekly` AS
SELECT
`t`.`Id_Ticket` AS `ticketFk`, `t`.`weekDay` AS `weekDay`
FROM
`vn2008`.`Tickets_turno` `t`;

View File

@ -1,16 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`warehouse` AS
SELECT
`t`.`id` AS `id`,
`t`.`name` AS `name`,
`t`.`inventario` AS `isInventory`,
`t`.`is_comparative` AS `isComparative`,
`t`.`comisionantes` AS `hasComission`,
`t`.`reserve` AS `hasAvailable`,
`t`.`isManaged` AS `isManaged`
FROM
`vn2008`.`warehouse` `t`;

View File

@ -1,32 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `buy` AS
SELECT
`c`.`Id_Compra` AS `id`,
`c`.`Id_Entrada` AS `entryFk`,
`c`.`Id_Article` AS `itemFk`,
`c`.`Cantidad` AS `amount`,
`c`.`Costefijo` AS `buyingValue`,
`c`.`Cantidad` AS `quantity`,
`c`.`Id_Cubo` AS `packageFk`,
`c`.`Etiquetas` AS `stickers`,
`c`.`Portefijo` AS `freightValue`,
`c`.`Embalajefijo` AS `packageValue`,
`c`.`Comisionfija` AS `comissionValue`,
`c`.`Packing` AS `packing`,
`c`.`grouping` AS `grouping`,
`c`.`caja` AS `groupingMode`,
`c`.`Nicho` AS `location`,
`c`.`Tarifa1` AS `price1`,
`c`.`Tarifa2` AS `price2`,
`c`.`Tarifa3` AS `price3`,
`c`.`PVP` AS `minPrice`,
`c`.`Productor` AS `producer`,
`c`.`Vida` AS `printedStickers`,
`c`.`punteo` AS `isChecked`,
`c`.`Novincular` AS `isIgnored`
FROM
`vn2008`.`Compres` `c`;

View File

@ -1,31 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`item` AS
SELECT
`t`.`Id_Article` AS `id`,
`t`.`Article` AS `name`,
`t`.`tipo_id` AS `typeFk`,
`t`.`Medida` AS `size`,
`t`.`Color` AS `inkFk`,
`t`.`Categoria` AS `category`,
`t`.`Tallos` AS `stems`,
`t`.`id_origen` AS `originFk`,
`t`.`description` AS `description`,
`t`.`producer_id` AS `producerFk`,
`t`.`Codintrastat` AS `intrastatFk`,
`t`.`offer` AS `isOnOffer`,
`t`.`expenceFk` AS `expenceFk`,
`t`.`bargain` AS `isBargain`,
`t`.`comments` AS `comment`,
`t`.`relevancy` AS `relevancy`,
`t`.`Foto` AS `image`,
`t`.`generic` AS `generic`,
`t`.`density` AS `density`,
`t`.`iva_group_id` AS `taxClassFk`,
`t`.`PVP` AS `minPrice`,
`t`.`Min` AS `hasMinPrice`
FROM
`vn2008`.`Articles` `t`;

View File

@ -1,22 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`travel` AS
SELECT
`t`.`id` AS `id`,
`t`.`shipment` AS `shipped`,
`t`.`shipment_hour` AS `shipmentHour`,
`t`.`landing` AS `landed`,
`t`.`landing_hour` AS `landingHour`,
`t`.`warehouse_id` AS `warehouseInFk`,
`t`.`warehouse_id_out` AS `warehouseOutFk`,
`t`.`agency_id` AS `agencyFk`,
`t`.`ref` AS `ref`,
`t`.`delivered` AS `isDelivered`,
`t`.`received` AS `isReceived`,
`t`.`m3` AS `m3`,
`t`.`kg` AS `kg`
FROM
`vn2008`.`travel` `t`;

View File

@ -1,22 +0,0 @@
USE `vn`;
DROP function IF EXISTS `getSpecialPrice`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2)
BEGIN
DECLARE price DECIMAL(10,2);
SELECT rate3 INTO price
FROM vn.priceFixed
WHERE itemFk = vItemFk
AND CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1;
SELECT `value` INTO price
FROM vn.specialPrice
WHERE itemFk = vItemFk
AND clientFk = vClientFk ;
RETURN price;
END$$
DELIMITER ;

View File

@ -1,13 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`specialPrice` AS
SELECT
`p`.`Id_PrecioEspecial` AS `id`,
`p`.`Id_Cliente` AS `clientFk`,
`p`.`Id_Article` AS `itemFk`,
`p`.`PrecioEspecial` AS `value`
FROM
`vn2008`.`PreciosEspeciales` `p`;

View File

@ -1,11 +0,0 @@
CREATE TABLE vn.ticketComponentTemplate
SELECT * FROM vn2008.template_bionic_component;
ALTER TABLE `vn`.`ticketComponentTemplate`
CHANGE COLUMN `warehouse_id` `warehouseFk` SMALLINT(5) UNSIGNED NOT NULL ,
CHANGE COLUMN `item_id` `itemFk` INT(11) NOT NULL ,
CHANGE COLUMN `component_id` `componentFk` INT(10) UNSIGNED NOT NULL;

View File

@ -1,14 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`agencyProvince` AS
SELECT
`a`.`province_id` AS `provinceFk`,
`a`.`agency_id` AS `agencyFk`,
`a`.`zona` AS `zone`,
`a`.`warehouse_id` AS `warehouseFk`,
`a`.`route` AS `route`
FROM
`vn2008`.`Agencias_province` `a`;

View File

@ -1,16 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`agencyModeZone` AS
SELECT
`a`.`Id_Agencia` AS `agencyModeFk`,
`a`.`zona` AS `zone`,
`a`.`price` AS `price`,
`a`.`Id_Article` AS `itemFk`,
`a`.`warehouse_id` AS `warehouseFk`,
`a`.`porte_minimo` AS `minimCost`,
`a`.`inflacion` AS `inflation`
FROM
`vn2008`.`Agencias_zonas` `a`;

View File

@ -1,15 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`agencyWeekdayBonus` AS
SELECT
`a`.`id` AS `id`,
`a`.`warehouse_id` AS `warehouseFk`,
`a`.`agency_id` AS `agencyFk`,
`a`.`weekDay` AS `weekDay`,
`a`.`zona` AS `zone`,
`a`.`bonus` AS `bonus`
FROM
`vn2008`.`agency_weekday_bonus` `a`;

View File

@ -1,12 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`preparationPercentage` AS
SELECT
`p`.`week_day` AS `weekDay`,
`p`.`warehouse_id` AS `warehouseFk`,
`p`.`percentage` AS `percentage`
FROM
`vn2008`.`preparation_percentage` `p`;

View File

@ -1,12 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`preparationException` AS
SELECT
`p`.`exception_day` AS `exceptionDay`,
`p`.`warehouse_id` AS `warehouseFk`,
`p`.`percentage` AS `percentage`
FROM
`vn2008`.`preparation_exception` `p`;

View File

@ -1,2 +0,0 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`) VALUES ('WorkerMana', '*', 'READ', 'ALLOW', 'ROLE');
UPDATE `salix`.`ACL` SET `principalId`='employee' WHERE `id`='77';

View File

@ -0,0 +1,12 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`componentTypeRate` AS
SELECT
`t`.`tarifa_componentes_series_id` AS `id`,
`t`.`Serie` AS `type`,
`t`.`base` AS `base`
FROM
`bi`.`tarifa_componentes_series` `t`;

View File

@ -0,0 +1,22 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `sale` AS
SELECT
`m`.`Id_Movimiento` AS `id`,
`m`.`Id_Article` AS `itemFk`,
`m`.`Id_Ticket` AS `ticketFk`,
`m`.`Concepte` AS `concept`,
`m`.`Cantidad` AS `quantity`,
`m`.`Preu` AS `price`,
`m`.`Descuento` AS `discount`,
`m`.`Reservado` AS `reserved`,
`m`.`OK` AS `isPicked`,
`m`.`odbc_date` AS `created`,
`m`.`CostFixat` AS `priceFixed`,
`m`.`PrecioFijado` AS `isPriceFixed`
FROM
`vn2008`.`Movimientos` `m`;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -293,8 +293,8 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientF
( 1, 'T1111111' , 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
( 2, 'V2222222' , 'V', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
( 3, 'E3333333' , 'E', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
( 3, 'E4444444' , 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
( 3, 'E5555555' , 'E', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);
( 4, 'E4444444' , 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1),
( 5, 'E5555555' , 'E', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 8, 1);
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`, `refFk`)
VALUES
@ -308,11 +308,11 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `ref`, `serial`, `amount`, `issued`,`clientF
(8, 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 104, 'Professor X', 124, NULL),
(9, 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'Hulk', 125, NULL),
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'Jessica Jones', 125, NULL),
(11, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY), 101, 'ticket 1', 121, NULL),
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 DAY), 101, 'ticket 2', 121, NULL),
(13, 2, 2, 2, CURDATE(), 101, 'ticket 3', 121, NULL),
(14, 2, 2, 2, CURDATE(), 101, 'ticket 4', 121, NULL),
(15, 3, 3, 3, CURDATE(), 101, 'ticket 5', 121, NULL),
(11, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +10 DAY), 101, 'ticket 1', 121, NULL),
(12, 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 101, 'ticket 2', 121, NULL),
(13, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 101, 'ticket 3', 121, NULL),
(14, 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL +3 MONTH), 101, 'ticket 4', 121, NULL),
(15, 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL +4 MONTH), 101, 'ticket 5', 121, NULL),
(16, 3, 3, 4, CURDATE(), 101, 'ticket 6', 121, NULL),
(17, 4, 4, 4, CURDATE(), 106, 'ticket 7', 126, NULL),
(18, 4, 4, 4, CURDATE(), 107, 'ticket 8', 127, NULL),
@ -337,7 +337,18 @@ INSERT INTO `vn`.`ticketTracking`(`id`, `ticketFk`, `stateFk`, `workerFk`, `crea
(7, 7, 1, 18, CURDATE()),
(8, 8, 2, 19, CURDATE()),
(9, 9, 3, 19, CURDATE()),
(10, 10, 1, 19, CURDATE());
(10, 10, 3, 19, CURDATE()),
(11, 11, 3, 19, CURDATE()),
(12, 12, 3, 19, CURDATE()),
(13, 13, 3, 19, CURDATE()),
(14, 14, 3, 19, CURDATE()),
(15, 15, 3, 19, CURDATE()),
(16, 16, 1, 19, CURDATE()),
(17, 17, 1, 19, CURDATE()),
(18, 18, 1, 19, CURDATE()),
(19, 19, 1, 19, CURDATE()),
(20, 20, 1, 19, CURDATE()),
(21, 21, 1, 19, CURDATE());
INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk`, `warehouseFk`, `description`, `m3`, `isActive`)
VALUES
@ -642,7 +653,7 @@ INSERT INTO `vn`.`agencyModeZone`(`agencyModeFk`, `zone`, `price`, `itemFk`, `wa
( 2, 1, 20, 2, 1, 1, 2.00),
( 2, 2, 10, 1, 1, 0, 2.00);
INSERT INTO `vn`.`agencyWeekdayBonus`(`id`, `warehouseFk`, `agencyFk`, `weekDay`, `zone`, `bonus`)
INSERT INTO `vn`.`agencyWeekDayBonus`(`id`, `warehouseFk`, `agencyFk`, `weekDay`, `zone`, `bonus`)
VALUES
( 1, 1, 1, 0, 1, -1.00),
( 2, 1, 1, 1, 1, -1.00),

View File

@ -7,16 +7,22 @@ module.exports = Self => {
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order || 'name ASC', // name, relevancy DESC
include: {
relation: 'itemType',
scope: {
fields: ['id', 'name', 'workerFk'],
include: {
relation: 'worker',
fields: ['firstName', 'name']
include: [
{relation: 'itemType',
scope: {
fields: ['name', 'workerFk'],
include: {
relation: 'worker',
fields: ['firstName', 'name']
}
}
}
}
},
{relation: 'origin'},
{relation: 'ink'},
{relation: 'producer'},
{relation: 'intrastat'},
{relation: 'expence'}
]
};
delete params.page;

View File

@ -0,0 +1,20 @@
module.exports = Self => {
Self.remoteMethodCtx('getCurrentWorkerMana', {
description: 'Returns the mana of the logged worker',
accessType: 'READ',
accepts: [],
returns: {
type: 'number',
root: true
},
http: {
path: `/getCurrentWorkerMana`,
verb: 'GET'
}
});
Self.getCurrentWorkerMana = async ctx => {
let loggedWorkerId = ctx.req.accessToken.userId;
return await Self.rawSql(`SELECT used AS mana FROM vn.manaSpellers WHERE worker = ?`, [loggedWorkerId]);
};
};

View File

@ -46,6 +46,11 @@
"type": "belongsTo",
"model": "AgencyType",
"foreignKey": "agencyTypeFk"
},
"deliveryMethod": {
"type": "belongsTo",
"model": "DeliveryMethod",
"foreignKey": "deliveryMethodFk"
}
},
"acls": [

View File

@ -0,0 +1,32 @@
{
"name": "DeliveryMethod",
"description": "Delivery methods",
"base": "VnModel",
"options": {
"mysql": {
"table": "deliveryMethod"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"code": {
"type": "string",
"required": true
},
"description": {
"type": "string"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -7,7 +7,7 @@ module.exports = Self => {
* @param {Integer} stateId The user id
* @return {Boolean} %true if user has the role, %false otherwise
*/
Self.isAlertLevel0 = async function(stateId) {
Self.isAlertLevelZero = async function(stateId) {
let result = await Self.rawSql(
`SELECT alertLevel
FROM vn.state

View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/workerMana/getCurrentWorkerMana')(Self);
};

View File

@ -107,5 +107,8 @@
},
"WorkerMana": {
"dataSource": "bs"
},
"DeliveryMethod": {
"dataSource": "vn"
}
}

View File

@ -10,10 +10,10 @@ module.exports = function(Self) {
let isEmployee = await models.Account.hasRole(userId, 'employee');
let isProduction = await models.Account.hasRole(userId, 'production');
let isAlertLevel0 = await models.State.isAlertLevel0(ctx.instance.stateFk);
let isAlertLevelZero = await models.State.isAlertLevelZero(ctx.instance.stateFk);
let ticketAlertLevel = await models.TicketState.findOne({where: {id: ctx.instance.ticketFk}, fields: ["alertLevel"]});
if ((!isProduction && !isAlertLevel0) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction))
if ((!isProduction && !isAlertLevelZero) || !isEmployee || (isEmployee && ticketAlertLevel != 0 && !isProduction))
throw new Error("You don't have enough privileges to do that");
let user = await models.Worker.findOne({where: {userFk: userId}});

View File

@ -35,7 +35,18 @@ let baseConfig = {
loader: 'style-loader!css-loader'
}, {
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
use: [
{loader: 'style-loader'},
{loader: 'css-loader'},
{
loader: 'sass-loader',
options: {
includePaths: [
path.resolve(__dirname, 'client/salix/src/styles')
]
}
}
]
}, {
test: /\.(svg|png|ttf|woff|woff2)$/,
loader: 'file-loader'