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-card>
<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="client.card.credit.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

@ -31,7 +31,6 @@
</vn-vertical>
</vn-card>
<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="client.card.greuge.create" vn-bind="+" fixed-bottom-right>
<vn-float-button icon="add"></vn-float-button>

View File

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

View File

@ -31,5 +31,4 @@
</vn-vertical>
</vn-card>
<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

@ -27,5 +27,4 @@
</vn-vertical>
</vn-card>
<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

@ -31,7 +31,6 @@
</vn-vertical>
</vn-card>
<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="client.card.recovery.create" vn-bind="+" fixed-bottom-right>
<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>
<label class="mdl-textfield__label" translate>{{::$ctrl.label}}</label>
</div>
<i class="material-icons pointer"
ng-show="!$ctrl.disabled && $ctrl.hasValue && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-click="$ctrl.clear()">
clear
</i>
</div>
<vn-drop-down
vn-id="drop-down"

View File

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

View File

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

View File

@ -14,7 +14,7 @@ import './style.scss';
class Pagination extends Component {
constructor($element, $scope) {
super($element, $scope);
this.scrollOffset = 20;
this.scrollOffset = 150;
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 top = parentRect.top + parentRect.height + arrowHeight;
let left = parentRect.left;
let height = popoverRect.height;
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 showTop = top + height + margin > window.innerHeight;

View File

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

View File

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

View File

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

View File

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

View File

@ -25,5 +25,4 @@
</vn-vertical>
</vn-card>
<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

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

View File

@ -64,5 +64,4 @@
</vn-vertical>
</vn-card>
<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>

View File

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

View File

@ -67,7 +67,6 @@
</table>
</vn-vertical>
<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>
<vn-item-descriptor-popover vn-id="descriptor"></vn-item-descriptor-popover>

View File

@ -40,6 +40,5 @@
</vn-vertical>
</vn-card>
<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>

View File

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

View File

@ -33,6 +33,5 @@
</vn-vertical>
</vn-card>
<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>

View File

@ -23,8 +23,7 @@
</vn-vertical>
</vn-card>
<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>
<vn-float-button icon="add"></vn-float-button>
</a>

View File

@ -37,7 +37,6 @@
</vn-vertical>
</vn-card>
<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>

View File

@ -1,4 +1,6 @@
module.exports = function(Self) {
require('../methods/recovery/filter')(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`;
DROP procedure IF EXISTS ` ticketGetVisibleAvailable`;
DROP procedure IF EXISTS `ticketGetVisibleAvailable`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE ` ticketGetVisibleAvailable`(
CREATE DEFINER=`root`@`%` PROCEDURE `ticketGetVisibleAvailable`(
vTicket INT)
BEGIN
DECLARE vVisibleCalc INT;
DECLARE vAvailableCalc INT;
DECLARE vShipped DATE;
DECLARE vWarehouse TINYINT;
DECLARE vAvailableCalc INT;
DECLARE vShipped DATE;
DECLARE vWarehouse TINYINT;
DECLARE vAlertLevel INT;
SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel
FROM ticket t
LEFT JOIN ticketState ts ON ts.ticketFk = 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);
END IF;
IF vShipped = CURDATE() THEN
CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped);
CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse);
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
FROM vn.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.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc
SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available
FROM sale s
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
WHERE s.ticketFk = vTicket;
END$$

View File

@ -21,6 +21,5 @@
"Only manager can change the credit": "Only manager can change the credit",
"Name cannot be blank": "Name 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).",
"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)."
"Observation type cannot be blank": "Observation type cannot be blank"
}

View File

@ -26,5 +26,6 @@
"NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE",
"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",
"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"
}