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

This commit is contained in:
gerard 2018-07-04 14:44:02 +02:00
commit 2ac0c34085
33 changed files with 96 additions and 316 deletions

View File

@ -23,7 +23,6 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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> </vn-vertical>
<a ui-sref="client.card.credit.create" vn-bind="+" fixed-bottom-right> <a ui-sref="client.card.credit.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>

View File

@ -31,7 +31,6 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-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> </vn-vertical>
<a ui-sref="client.card.greuge.create" vn-bind="+" fixed-bottom-right> <a ui-sref="client.card.greuge.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>

View File

@ -10,12 +10,9 @@ export default class Controller {
exprBuilder(param, value) { exprBuilder(param, value) {
switch (param) { switch (param) {
case 'search': case 'search':
return { return /^\d+$/.test(value)
or: [ ? {id: value}
{id: value}, : {name: {regexp: value}};
{name: {regexp: value}}
]
};
case 'phone': case 'phone':
return { return {
or: [ or: [

View File

@ -31,5 +31,4 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-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> </vn-vertical>

View File

@ -27,5 +27,4 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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> </vn-vertical>

View File

@ -31,7 +31,6 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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> </vn-vertical>
<a ui-sref="client.card.recovery.create" vn-bind="+" fixed-bottom-right> <a ui-sref="client.card.recovery.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>

View File

@ -1,7 +0,0 @@
<vn-horizontal margin-medium-top>
<vn-one></vn-one>
<vn-auto>
<vn-spinner enable="$ctrl.watchScroll"></vn-spinner>
</vn-auto>
<vn-one></vn-one>
</vn-horizontal>

View File

@ -1,123 +0,0 @@
import ngModule from '../../module';
import getWatchers from '../../lib/get-watchers';
class AutoPaging {
constructor($http, $window, $element, $timeout, vnApp, $translate, $scope) {
this.$http = $http;
this.$window = $window;
this.$element = $element;
this.$timeout = $timeout;
this.vnApp = vnApp;
this.$translate = $translate;
this.$scope = $scope;
this.numPerPage = null;
this.maxItems = 0;
this.watchScroll = false;
this.waitingNewPage = false;
this.handlerScroll = this.onScroll.bind(this);
}
get numPages() {
return this.numPerPage ? Math.ceil(this.maxItems / this.numPerPage) : 0;
}
loadNewPage() {
this.index.filter.page++;
this.waitingNewPage = true;
this.index.accept().then(res => {
this.$timeout(() => {
res.instances.forEach(item => {
this.items.push(item);
});
this.$scope.$apply();
this.checkWatchers();
});
if (this.index.filter.page == this.numPages) {
this.cancelScroll();
}
this.waitingNewPage = false;
});
}
checkPosition() {
let element = this.$element[0].querySelector('vn-spinner');
let position = element.getBoundingClientRect();
let isVisible = position.y < document.body.offsetHeight + 150;
if (this.currentPage < this.numPages && isVisible && !this.waitingNewPage) {
this.loadNewPage();
}
}
onScroll() {
this.checkPosition();
}
startScroll() {
this.watchScroll = true;
this.checkPosition();
let mainView = this.$window.document.querySelector('.main-view > ui-view.ng-scope');
angular.element(mainView).bind("scroll", this.handlerScroll);
}
cancelScroll() {
this.watchScroll = false;
let mainView = this.$window.document.querySelector('.main-view > ui-view.ng-scope');
angular.element(mainView).unbind("scroll", this.handlerScroll);
}
checkScroll() {
if (this.numPages > this.currentPage && !this.watchScroll) {
this.startScroll();
} else if (this.numPages <= this.currentPage && this.watchScroll) {
this.cancelScroll();
}
}
checkWatchers() {
let watchers = getWatchers();
if (watchers > 3000 && this.watchScroll) {
this.cancelScroll();
this.vnApp.showMessage(
this.$translate.instant('Auto-scroll interrupted, please adjust the search')
);
}
}
$onChanges(changes) {
if (!this.index) return;
this.numPerPage = this.index.filter.size;
this.currentPage = this.index.filter.page;
this.currentInstances = this.items;
if (changes.total)
this.maxItems = changes.total.currentValue;
this.checkScroll();
}
$postLink() {
this.checkScroll();
}
$doCheck() {
if (this.index && this.index.filter && this.index.filter.page && this.index.filter.page != this.currentPage) {
this.currentPage = this.index.filter.page;
this.checkScroll();
}
}
}
AutoPaging.$inject = ['$http', '$window', '$element', '$timeout', 'vnApp', '$translate', '$scope'];
ngModule.component('vnAutoPaging', {
template: require('./auto-paging.html'),
bindings: {
index: '<',
total: '<',
items: '<'
},
controller: AutoPaging
});

View File

@ -1,61 +0,0 @@
import './auto-paging.js';
import template from './auto-paging.html';
describe('Component vnAutoPaging', () => {
let $http;
let $window;
let $element;
let $timeout;
let controller;
beforeEach(() => {
angular.mock.module('client');
});
beforeEach(angular.mock.inject((_$componentController_, _$httpBackend_, _$window_, _$timeout_) => {
$http = _$httpBackend_;
$window = _$window_;
$timeout = _$timeout_;
$element = angular.element(`<div>${template}</div>`);
controller = _$componentController_('vnAutoPaging', {$http, $window, $element, $timeout});
}));
describe('onChanges: actions when index object changes', () => {
beforeEach(() => {
controller.index = {
filter: {
size: 5,
page: 1
}
};
controller.items = [1, 2, 3, 4, 5];
});
it('call startScroll() if there are pages to load', () => {
let changes = {
total: {
currentValue: 20
}
};
spyOn(controller, 'startScroll');
controller.$onChanges(changes);
expect(controller.startScroll).toHaveBeenCalled();
});
it('call stopScroll() if there are not pages to load', () => {
let changes = {
total: {
currentValue: 5
}
};
controller.watchScroll = true;
spyOn(controller, 'cancelScroll');
controller.$onChanges(changes);
expect(controller.cancelScroll).toHaveBeenCalled();
});
});
});

View File

@ -17,11 +17,6 @@
</div> </div>
<label class="mdl-textfield__label" translate>{{::$ctrl.label}}</label> <label class="mdl-textfield__label" translate>{{::$ctrl.label}}</label>
</div> </div>
<i class="material-icons pointer"
ng-show="!$ctrl.disabled && $ctrl.hasValue && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-click="$ctrl.clear()">
clear
</i>
</div> </div>
<vn-drop-down <vn-drop-down
vn-id="drop-down" vn-id="drop-down"

View File

@ -5,6 +5,7 @@ vn-drop-down {
.dropdown { .dropdown {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: inherit;
& > .filter { & > .filter {
position: relative; position: relative;

View File

@ -34,7 +34,6 @@ import './float-button/float-button';
import './step-control/step-control'; import './step-control/step-control';
import './label-value/label-value'; import './label-value/label-value';
import './paging/paging'; import './paging/paging';
import './auto-paging/auto-paging';
import './pagination/pagination'; import './pagination/pagination';
import './searchbar/searchbar'; import './searchbar/searchbar';
import './table'; import './table';

View File

@ -14,7 +14,7 @@ import './style.scss';
class Pagination extends Component { class Pagination extends Component {
constructor($element, $scope) { constructor($element, $scope) {
super($element, $scope); super($element, $scope);
this.scrollOffset = 20; this.scrollOffset = 150;
this.scrollHandler = e => this.onScroll(e); this.scrollHandler = e => this.onScroll(e);
} }

View File

@ -136,10 +136,10 @@ export default class Popover extends Component {
let arrowHeight = Math.sqrt(Math.pow(arrowRect.height, 2) * 2) / 2; let arrowHeight = Math.sqrt(Math.pow(arrowRect.height, 2) * 2) / 2;
let top = parentRect.top + parentRect.height + arrowHeight;
let left = parentRect.left;
let height = popoverRect.height; let height = popoverRect.height;
let width = Math.max(popoverRect.width, parentRect.width); let width = Math.max(popoverRect.width, parentRect.width);
let top = parentRect.top + parentRect.height + arrowHeight;
let left = parentRect.left + parentRect.width / 2 - width / 2;
let margin = 10; let margin = 10;
let showTop = top + height + margin > window.innerHeight; let showTop = top + height + margin > window.innerHeight;

View File

@ -19,25 +19,24 @@
} }
& > .popover { & > .popover {
position: absolute; position: absolute;
display: flex;
box-shadow: 0 .1em .4em rgba(1, 1, 1, .4); box-shadow: 0 .1em .4em rgba(1, 1, 1, .4);
z-index: 0;
& > .arrow { & > .arrow {
width: 1em; width: 1em;
height: 1em; height: 1em;
margin: -.5em; margin: -.5em;
background-color: white; background-color: white;
box-shadow: 0 .1em .4em rgba(1, 1, 1, .4); box-shadow: 0 .1em .4em rgba(1, 1, 1, .4);
position: absolute; position: absolute;
transform: rotate(45deg); transform: rotate(45deg);
z-index: 0; z-index: -1;
} }
& > .content { & > .content {
width: 100%;
border-radius: .1em; border-radius: .1em;
overflow: auto;
background-color: white; background-color: white;
z-index: 1; height: inherit;
overflow: auto;
} }
} }
} }

View File

@ -1,28 +1,29 @@
@import "colors"; @import "colors";
vn-textfield { vn-textfield {
margin: 20px 0!important; margin: 20px 0!important;
display: block; display: inline-block;
.leftIcons, .rightIcons, .suffix{ & > .container {
display: inline-flex;
color: $secondary-font-color;
& .material-icons{
font-size: 20px!important
}
}
.leftIcons{
margin-right: 3px;
}
.container{
width: 100%; width: 100%;
position: relative; position: relative;
padding-bottom: 2px; padding-bottom: 2px;
display: flex;
& > .textField {
width: 100%;
display: flex;
align-items: center;
position: relative;
padding-top: 4px;
}
} }
.textField{ .leftIcons, .rightIcons, .suffix {
width: 100%; display: flex;
display: inline-flex; color: $secondary-font-color;
position: relative;
padding: 4px 0; & .material-icons {
font-size: 20px !important
}
} }
.infix { .infix {
position: relative; position: relative;
@ -31,8 +32,16 @@ vn-textfield {
width: 100%; width: 100%;
min-width: 0; min-width: 0;
} }
i.pointer { i.clear {
visibility: hidden; visibility: hidden;
cursor: pointer;
&:hover {
color: #222;
}
}
&:hover i.clear {
visibility: visible;
} }
i.visible { i.visible {
visibility: visible; visibility: visible;
@ -48,12 +57,14 @@ vn-textfield {
input { input {
outline: none; outline: none;
border: none; border: none;
font-family: "Helvetica","Arial",sans-serif; font-family: "Helvetica", "Arial", sans-serif;
display: block; display: block;
font-size: 16px; font-size: 16px;
width: 100%; width: 100%;
background: 0 0; background: 0 0;
color: inherit; color: inherit;
padding: 4px;
box-sizing: border-box;
&[type=number] { &[type=number] {
-moz-appearance: textfield; -moz-appearance: textfield;
@ -64,10 +75,10 @@ vn-textfield {
} }
} }
&:invalid { &:invalid {
box-shadow:none; box-shadow: none;
} }
} }
.underline{ .underline {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
height: 1px; height: 1px;
@ -76,11 +87,11 @@ vn-textfield {
width: 100%; width: 100%;
background-color: rgba(0,0,0,.12); background-color: rgba(0,0,0,.12);
} }
.selected.underline{ .selected.underline {
background-color: rgb(255,152,0); background-color: rgb(255,152,0);
height: 2px; height: 2px;
left: 50%; left: 50%;
width: 0px!important; width: 0px !important;
transition-duration: 0.2s; transition-duration: 0.2s;
transition-timing-function: cubic-bezier(.4,0,.2,1); transition-timing-function: cubic-bezier(.4,0,.2,1);
} }
@ -91,7 +102,7 @@ vn-textfield {
font-size: 12px; font-size: 12px;
} }
} }
div.selected{ div.selected {
&.container{ &.container{
border-bottom: 0px; border-bottom: 0px;
} }
@ -105,20 +116,18 @@ vn-textfield {
width: 100%!important; width: 100%!important;
} }
} }
& > div.container > div.textField > div.infix.invalid{ & > div.container > div.textField > div.infix.invalid {
@extend div.selected; @extend div.selected;
& > span.mdl-textfield__error{ & > span.mdl-textfield__error {
visibility: visible; visibility: visible;
margin-top: 9px; margin-top: 9px;
} }
& > label{ & > label {
color: #d50000; color: #d50000;
} }
} }
.infix.invalid + .underline { .infix.invalid + .underline {
&{ background-color: #d50000;
background-color: #d50000;
}
} }
} }

View File

@ -1,36 +1,29 @@
<div class="container" <div class="container"
ng-class="{selected: $ctrl.hasFocus}" ng-class="{selected: $ctrl.hasFocus}">
ng-mouseenter="$ctrl.hasMouseIn = true"
ng-mouseleave="$ctrl.hasMouseIn = false"
style="display: inline-flex"
>
<div class="textField"> <div class="textField">
<div class="leftIcons"> <div class="leftIcons"></div>
</div>
<div class="infix"> <div class="infix">
<input <input
type="{{$ctrl.type}}" type="{{$ctrl.type}}"
name="{{$ctrl.name}}" name="{{$ctrl.name}}"
ng-model="$ctrl.value" ng-model="$ctrl.value"
vn-validation="{{$ctrl.rule}}" vn-validation="{{$ctrl.rule}}"
ng-disabled="$ctrl.disabled" ng-disabled="$ctrl.disabled"
ng-readonly="$ctrl.readonly" ng-readonly="$ctrl.readonly"
ng-focus="$ctrl.hasFocus = true" ng-focus="$ctrl.hasFocus = true"
ng-blur="$ctrl.hasFocus = false" ng-blur="$ctrl.hasFocus = false"
tabindex="{{$ctrl.input.tabindex}}" tabindex="{{$ctrl.input.tabindex}}"/>
/>
<label class="label" translate>{{::$ctrl.label}}</label> <label class="label" translate>{{::$ctrl.label}}</label>
</div> </div>
<div class="underline"></div> <div class="underline"></div>
<div class="selected underline"></div> <div class="selected underline"></div>
<div class="suffix"> <div class="suffix">
<i class="material-icons pointer" <i class="material-icons clear"
translate-attr="{title: 'Clear'}"
ng-class="{visible: ng-class="{visible:
!$ctrl.disabled !$ctrl.disabled
&& $ctrl.hasValue && $ctrl.hasValue
&& ($ctrl.hasFocus || $ctrl.hasMouseIn) && ($ctrl.hasFocus)
&& !$ctrl.unclearable}" && !$ctrl.unclearable}"
ng-click="$ctrl.clear()"> ng-click="$ctrl.clear()">
clear clear

View File

@ -5,7 +5,6 @@
data="sales" data="sales"
auto-load="false"> auto-load="false">
</vn-crud-model> </vn-crud-model>
<vn-vertical> <vn-vertical>
<vn-card pad-large> <vn-card pad-large>
<vn-vertical> <vn-vertical>
@ -53,5 +52,4 @@
</vn-table> </vn-table>
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
</vn-vertical> </vn-vertical>

View File

@ -25,5 +25,4 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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> </vn-vertical>

View File

@ -28,12 +28,9 @@ class Controller {
exprBuilder(param, value) { exprBuilder(param, value) {
switch (param) { switch (param) {
case 'search': case 'search':
return { return /^\d+$/.test(value)
or: [ ? {id: value}
{id: value}, : {name: {regexp: value}};
{name: {regexp: value}}
]
};
case 'name': case 'name':
case 'description': case 'description':
return {[param]: {regexp: value}}; return {[param]: {regexp: value}};

View File

@ -64,5 +64,4 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging margin-large-top vn-one index="$ctrl.entries" total="$ctrl.entries.count"></vn-paging> <vn-paging margin-large-top vn-one index="$ctrl.entries" total="$ctrl.entries.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> </vn-vertical>

View File

@ -50,4 +50,5 @@ Add barcode: Añadir código de barras
Remove barcode: Quitar código de barras Remove barcode: Quitar código de barras
Buyer: Comprador Buyer: Comprador
No results: Sin resultados No results: Sin resultados
Tag: Etiqueta Tag: Etiqueta
Worker: Trabajador

View File

@ -67,7 +67,6 @@
</table> </table>
</vn-vertical> </vn-vertical>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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-card>
</vn-vertical> </vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover> <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -40,6 +40,5 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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>
</vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover> <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -59,12 +59,9 @@ export default class Controller {
exprBuilder(param, value) { exprBuilder(param, value) {
switch (param) { switch (param) {
case 'search': case 'search':
return { return /^\d+$/.test(value)
or: [ ? {id: value}
{id: value}, : {nickname: {regexp: value}};
{nickname: {regexp: value}}
]
};
case 'from': case 'from':
return {shipped: {gte: value}}; return {shipped: {gte: value}};
case 'to': case 'to':

View File

@ -33,6 +33,5 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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>
</vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover> <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -23,8 +23,7 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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>
</vn-vertical>
<a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right> <a ui-sref="ticket.card.tracking.edit" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button> <vn-float-button icon="add"></vn-float-button>
</a> </a>

View File

@ -37,7 +37,6 @@
</vn-vertical> </vn-vertical>
</vn-card> </vn-card>
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-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>
</vn-vertical>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover> <vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -1,4 +1,6 @@
module.exports = function(Self) { module.exports = function(Self) {
require('../methods/recovery/filter')(Self); require('../methods/recovery/filter')(Self);
require('../methods/recovery/hasActiveRecovery')(Self); require('../methods/recovery/hasActiveRecovery')(Self);
Self.validatesPresenceOf('period', {message: 'Period cannot be blank'});
}; };

View File

@ -1,2 +0,0 @@
INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('89','Sale', 'moveToNewTicket', '*', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (90, 'Sale', 'reserve', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,38 +1,35 @@
USE `vn`; USE `vn`;
DROP procedure IF EXISTS ` ticketGetVisibleAvailable`; DROP procedure IF EXISTS `ticketGetVisibleAvailable`;
DELIMITER $$ DELIMITER $$
USE `vn`$$ USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE ` ticketGetVisibleAvailable`( CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetVisibleAvailable`(
vTicket INT) vTicket INT)
BEGIN BEGIN
DECLARE vVisibleCalc INT; DECLARE vVisibleCalc INT;
DECLARE vAvailableCalc INT; DECLARE vAvailableCalc INT;
DECLARE vShipped DATE; DECLARE vShipped DATE;
DECLARE vWarehouse TINYINT; DECLARE vWarehouse TINYINT;
DECLARE vAlertLevel INT; DECLARE vAlertLevel INT;
SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel
FROM ticket t FROM ticket t
LEFT JOIN ticketState ts ON ts.ticketFk = vTicket LEFT JOIN ticketState ts ON ts.ticketFk = vTicket
WHERE t.id = vTicket; WHERE t.id = vTicket;
IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN
IF vShipped > CURDATE() THEN IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN
IF vShipped >= CURDATE() THEN
CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped);
END IF; END IF;
IF vShipped = CURDATE() THEN IF vShipped = CURDATE() THEN
CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped);
CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse);
END IF; END IF;
END IF; END IF;
SELECT s.itemFk, s.quantity, s.price, s.discount, i.val1 ,i.val2, i.val3, i.val4, i.val5, i.val6,v.visible, av.available SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available
FROM vn.sale s FROM sale s
JOIN vn.itemTagArranged i ON i.itemFk = s.itemFk LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc
LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc
LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc
WHERE s.ticketFk = vTicket; WHERE s.ticketFk = vTicket;
END$$ END$$

View File

@ -21,6 +21,5 @@
"Only manager can change the credit": "Only manager can change the credit", "Only manager can change the credit": "Only manager can change the credit",
"Name cannot be blank": "Name cannot be blank", "Name cannot be blank": "Name cannot be blank",
"Phone cannot be blank": "Phone cannot be blank", "Phone cannot be blank": "Phone cannot be blank",
"ValidationError: La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).": "ValidationError: La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).", "Observation type cannot be blank": "Observation type cannot be blank"
"La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null).": "La instancia `ClientContact` no es válida. Detalles: `name` Name cannot be blank (value: null)."
} }

View File

@ -26,5 +26,6 @@
"NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE", "NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE",
"Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente", "Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
"Name cannot be blank": "El nombre no puede estar en blanco", "Name cannot be blank": "El nombre no puede estar en blanco",
"Phone cannot be blank": "El teléfono no puede estar en blanco" "Phone cannot be blank": "El teléfono no puede estar en blanco",
"Period cannot be blank": "El periodo no puede estar en blanco"
} }