Merge branch 'dev' of https://git.verdnatura.es/salix into dev
This commit is contained in:
commit
ac84b37f32
|
@ -43,11 +43,13 @@ node
|
||||||
|
|
||||||
stage ("Stopping/Removing Docker")
|
stage ("Stopping/Removing Docker")
|
||||||
{
|
{
|
||||||
|
env.TAG = "${env.BUILD_NUMBER}" - 1;
|
||||||
sh "docker-compose down --rmi 'all'"
|
sh "docker-compose down --rmi 'all'"
|
||||||
}
|
}
|
||||||
|
|
||||||
stage ("Generar dockers")
|
stage ("Generar dockers")
|
||||||
{
|
{
|
||||||
|
env.TAG = "${env.BUILD_NUMBER}" + 1;
|
||||||
sh "docker-compose up -d --build"
|
sh "docker-compose up -d --build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Datos básicos",
|
"description": "Basic data",
|
||||||
"icon": "person"
|
"icon": "person"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Datos fiscales",
|
"description": "Fiscal data",
|
||||||
"icon": "account_balance"
|
"icon": "account_balance"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Consignatarios",
|
"description": "Addresses",
|
||||||
"icon": "local_shipping"
|
"icon": "local_shipping"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Acceso web",
|
"description": "Web access",
|
||||||
"icon": "language"
|
"icon": "language"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
@ -99,13 +99,59 @@
|
||||||
"client": "$ctrl.client"
|
"client": "$ctrl.client"
|
||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"description": "Notas",
|
"description": "Notes",
|
||||||
"icon": "insert_drive_file"
|
"icon": "insert_drive_file"
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"url": "/create",
|
"url": "/create",
|
||||||
"state": "clientCard.notes.create",
|
"state": "clientCard.notes.create",
|
||||||
"component": "vn-note-create"
|
"component": "vn-note-create"
|
||||||
|
}, {
|
||||||
|
"url": "/credit",
|
||||||
|
"abstract": true,
|
||||||
|
"state": "clientCard.credit",
|
||||||
|
"component": "ui-view"
|
||||||
|
}, {
|
||||||
|
"url": "/list",
|
||||||
|
"state": "clientCard.credit.list",
|
||||||
|
"component": "vn-client-credit-list",
|
||||||
|
"params": {
|
||||||
|
"client": "$ctrl.client"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Credit",
|
||||||
|
"icon": "credit_card"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"url": "/create",
|
||||||
|
"state": "clientCard.credit.create",
|
||||||
|
"component": "vn-client-credit-create",
|
||||||
|
"params": {
|
||||||
|
"client": "$ctrl.client"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"url": "/greuge",
|
||||||
|
"abstract": true,
|
||||||
|
"state": "clientCard.greuge",
|
||||||
|
"component": "ui-view"
|
||||||
|
}, {
|
||||||
|
"url": "/list",
|
||||||
|
"state": "clientCard.greuge.list",
|
||||||
|
"component": "vn-client-greuge-list",
|
||||||
|
"params": {
|
||||||
|
"client": "$ctrl.client"
|
||||||
|
},
|
||||||
|
"menu": {
|
||||||
|
"description": "Greuge",
|
||||||
|
"icon": "work"
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
"url": "/create",
|
||||||
|
"state": "clientCard.greuge.create",
|
||||||
|
"component": "vn-client-greuge-create",
|
||||||
|
"params": {
|
||||||
|
"client": "$ctrl.client"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{
|
{
|
||||||
"Addresses": "Consignatarios",
|
|
||||||
"Set as default": "Establecer como predeterminado"
|
"Set as default": "Establecer como predeterminado"
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"Basic data": "Datos básicos",
|
|
||||||
"Comercial Name": "Nombre comercial",
|
"Comercial Name": "Nombre comercial",
|
||||||
"Tax number": "NIF/CIF",
|
"Tax number": "NIF/CIF",
|
||||||
"Social name": "Razón social",
|
"Social name": "Razón social",
|
||||||
|
|
|
@ -14,3 +14,7 @@ import './address-edit/address-edit';
|
||||||
import './notes/notes';
|
import './notes/notes';
|
||||||
import './note-create/note-create';
|
import './note-create/note-create';
|
||||||
import './web-access/web-access';
|
import './web-access/web-access';
|
||||||
|
import './credit-list/credit-list';
|
||||||
|
import './credit-create/credit-create';
|
||||||
|
import './greuge-list/greuge-list';
|
||||||
|
import './greuge-create/greuge-create';
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<mg-ajax path="/client/api/Clients/{{patch.params.id}}" options="vnPatch"></mg-ajax>
|
||||||
|
<vn-watcher
|
||||||
|
vn-id="watcher"
|
||||||
|
data="$ctrl.client"
|
||||||
|
form="form"
|
||||||
|
save="patch">
|
||||||
|
</vn-watcher>
|
||||||
|
<form name="form" ng-submit="watcher.submitGo('clientCard.credit.list')" pad-medium>
|
||||||
|
<vn-card >
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title>Add credit</vn-title>
|
||||||
|
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield vn-one label="Credit" field="$ctrl.client.credit" type="number" vn-focus></vn-textfield>
|
||||||
|
<vn-one></vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<vn-button-bar>
|
||||||
|
<vn-submit label="Save"></vn-submit>
|
||||||
|
</vn-button-bar>
|
||||||
|
</form>
|
|
@ -0,0 +1,8 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnClientCreditCreate', {
|
||||||
|
template: require('./credit-create.html'),
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"Add credit": "Añadir crédito"
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<mg-ajax path="/client/api/clientCredits/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||||
|
<vn-card pad-medium>
|
||||||
|
<vn-vertical pad-large>
|
||||||
|
<vn-title vn-one margin-large-bottom>Credit</vn-title>
|
||||||
|
|
||||||
|
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||||
|
<vn-column-header vn-one pad-medium-h field="amount" text="Credit"></vn-column-header>
|
||||||
|
<vn-column-header vn-two pad-medium-h field="created" text="Since" default-order="ASC"></vn-column-header>
|
||||||
|
<vn-column-header vn-two pad-medium-h field="employee.name" text="Employee" order-locked></vn-column-header>
|
||||||
|
</vn-grid-header>
|
||||||
|
<vn-one class="list list-content">
|
||||||
|
<vn-horizontal
|
||||||
|
vn-one class="list list-element text-center"
|
||||||
|
pad-small-bottom
|
||||||
|
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.employee.name}}</vn-two>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-one>
|
||||||
|
<vn-one class="text-center" ng-if="index.model.count === 0" translate>No results</vn-one>
|
||||||
|
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
|
||||||
|
<vn-paging vn-one margin-large-top index="index" total="index.model.count"></vn-paging>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<a ui-sref="clientCard.credit.create" fixed-bottom-right>
|
||||||
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
|
</a>
|
|
@ -0,0 +1,45 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
class ClientCreditList {
|
||||||
|
constructor($scope, $timeout) {
|
||||||
|
this.$ = $scope;
|
||||||
|
this.$timeout = $timeout;
|
||||||
|
|
||||||
|
this.waitingMgCrud = 0;
|
||||||
|
}
|
||||||
|
onOrder(field, order) {
|
||||||
|
this.filter(`${field} ${order}`);
|
||||||
|
}
|
||||||
|
filter(order) {
|
||||||
|
if (this.$.index && this.client && this.client.id) {
|
||||||
|
this.waitingMgCrud = 0;
|
||||||
|
this.$.index.filter = {
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
clientFk: this.client.id
|
||||||
|
};
|
||||||
|
|
||||||
|
if (order) {
|
||||||
|
this.$.index.filter.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$.index.accept();
|
||||||
|
} else if (this.waitingMgCrud > 0) {
|
||||||
|
throw new Error('Magic Crud is not loaded');
|
||||||
|
} else {
|
||||||
|
this.waitingMgCrud++;
|
||||||
|
this.$timeout(() => {
|
||||||
|
this.filter(order);
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ClientCreditList.$inject = ['$scope', '$timeout'];
|
||||||
|
|
||||||
|
ngModule.component('vnClientCreditList', {
|
||||||
|
template: require('./credit-list.html'),
|
||||||
|
controller: ClientCreditList,
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"Since" : "Desde",
|
||||||
|
"Employee" : "Empleado",
|
||||||
|
"No results": "Sin resultados"
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<vn-card pad-medium>
|
||||||
|
<vn-vertical pad-medium>
|
||||||
|
<vn-title vn-one margin-large-bottom>Add Greuge</vn-title>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield vn-one margin-small-right label="Importe" field="$ctrl.greuge.amount" type="number" vn-focus></vn-textfield>
|
||||||
|
<vn-date-picker vn-one label="Date" model="$ctrl.greuge.date"></vn-date-picker>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-textfield vn-one margin-small-right label="Comment" field="$ctrl.greuge.description"></vn-textfield>
|
||||||
|
<vn-autocomplete vn-one
|
||||||
|
field="$ctrl.greuge.greugeTypeFk"
|
||||||
|
url="/client/api/greugeTypes"
|
||||||
|
label="Type">
|
||||||
|
</vn-autocomplete>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
|
@ -0,0 +1,8 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
ngModule.component('vnClientGreugeCreate', {
|
||||||
|
template: require('./greuge-create.html'),
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,38 @@
|
||||||
|
<mg-ajax path="/client/api/greuges/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||||
|
<mg-ajax path="/client/api/greuges/{{edit.params.id}}/sumAmount" options="mgEdit"></mg-ajax>
|
||||||
|
<vn-card pad-medium>
|
||||||
|
<vn-vertical pad-medium>
|
||||||
|
<vn-title vn-one margin-large-bottom>Greuge</vn-title>
|
||||||
|
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||||
|
<vn-column-header vn-one pad-medium-h field="shipped" text="Date" default-order="ASC"></vn-column-header>
|
||||||
|
<vn-column-header vn-two pad-medium-h field="description" text="Comment"></vn-column-header>
|
||||||
|
<vn-column-header vn-one pad-medium-h field="amount" text="Amount"></vn-column-header>
|
||||||
|
<vn-column-header vn-one pad-medium-h field="greugeTypeFk" text="Type"></vn-column-header>
|
||||||
|
</vn-grid-header>
|
||||||
|
|
||||||
|
<vn-one class="list list-content">
|
||||||
|
<vn-horizontal
|
||||||
|
class="list list-element text-center"
|
||||||
|
pad-small-bottom
|
||||||
|
ng-repeat="greuge in index.model.instances track by greuge.id"
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
<vn-one pad-medium-h>{{::greuge.greugeType.name}}</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
</vn-one>
|
||||||
|
|
||||||
|
<vn-one class="text-center" ng-if="index.model.count === 0" translate>No results</vn-one>
|
||||||
|
<vn-horizontal vn-one class="list list-footer text-center">
|
||||||
|
<vn-one pad-medium-h></vn-one>
|
||||||
|
<vn-two pad-medium-h></vn-two>
|
||||||
|
<vn-one pad-medium-h ng-if="index.model.count > 0">{{edit.model.sumAmount | number:2}} €</vn-one>
|
||||||
|
<vn-one pad-medium-h></vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
<vn-paging margin-large-top vn-one index="index" total="index.model.count"></vn-paging>
|
||||||
|
</vn-vertical>
|
||||||
|
</vn-card>
|
||||||
|
<a ui-sref="clientCard.greuge.create" fixed-bottom-right>
|
||||||
|
<vn-float-button icon="add"></vn-float-button>
|
||||||
|
</a>
|
|
@ -0,0 +1,45 @@
|
||||||
|
import ngModule from '../module';
|
||||||
|
|
||||||
|
class ClientGreugeList {
|
||||||
|
constructor($scope, $timeout) {
|
||||||
|
this.$ = $scope;
|
||||||
|
this.$timeout = $timeout;
|
||||||
|
|
||||||
|
this.waitingMgCrud = 0;
|
||||||
|
}
|
||||||
|
onOrder(field, order) {
|
||||||
|
this.filter(`${field} ${order}`);
|
||||||
|
}
|
||||||
|
filter(order) {
|
||||||
|
if (this.$.index && this.client && this.client.id) {
|
||||||
|
this.waitingMgCrud = 0;
|
||||||
|
this.$.index.filter = {
|
||||||
|
page: 1,
|
||||||
|
size: 10,
|
||||||
|
clientFk: this.client.id
|
||||||
|
};
|
||||||
|
|
||||||
|
if (order) {
|
||||||
|
this.$.index.filter.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$.index.accept();
|
||||||
|
} else if (this.waitingMgCrud > 3) {
|
||||||
|
throw new Error('Magic Crud is not loaded');
|
||||||
|
} else {
|
||||||
|
this.waitingMgCrud++;
|
||||||
|
this.$timeout(() => {
|
||||||
|
this.filter(order);
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ClientGreugeList.$inject = ['$scope', '$timeout'];
|
||||||
|
|
||||||
|
ngModule.component('vnClientGreugeList', {
|
||||||
|
template: require('./greuge-list.html'),
|
||||||
|
controller: ClientGreugeList,
|
||||||
|
bindings: {
|
||||||
|
client: '<'
|
||||||
|
}
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"Date" : "Fecha",
|
||||||
|
"Comment" : "Comentario",
|
||||||
|
"Amount" : "Importe",
|
||||||
|
"Type": "Tipo",
|
||||||
|
"Add Greuge": "Añadir Greuge"
|
||||||
|
}
|
|
@ -2,7 +2,11 @@
|
||||||
"Active": "Activo",
|
"Active": "Activo",
|
||||||
"Client": "Cliente",
|
"Client": "Cliente",
|
||||||
"Clients": "Clientes",
|
"Clients": "Clientes",
|
||||||
|
"Basic data": "Datos básicos",
|
||||||
"Fiscal data": "Datos Fiscales",
|
"Fiscal data": "Datos Fiscales",
|
||||||
|
"Addresses": "Consignatarios",
|
||||||
|
"Web access": "Acceso web",
|
||||||
|
"Notes": "Notas",
|
||||||
"Has to invoice": "Factura",
|
"Has to invoice": "Factura",
|
||||||
"Invoice by mail": "Factura impresa",
|
"Invoice by mail": "Factura impresa",
|
||||||
"Country": "País",
|
"Country": "País",
|
||||||
|
@ -12,5 +16,6 @@
|
||||||
"Province": "Provincia",
|
"Province": "Provincia",
|
||||||
"Save": "Guardar",
|
"Save": "Guardar",
|
||||||
"Pay method" : "Forma de pago",
|
"Pay method" : "Forma de pago",
|
||||||
"Address": "Consignatario"
|
"Address": "Consignatario",
|
||||||
|
"Credit" : "Crédito"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"Notes": "Notas"
|
|
||||||
}
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"User": "Usuario",
|
"User": "Usuario",
|
||||||
"Enable web access": "Habilitar acceso web",
|
"Enable web access": "Habilitar acceso web",
|
||||||
"Web access": "Acceso web",
|
|
||||||
"New password": "Nueva contraseña",
|
"New password": "Nueva contraseña",
|
||||||
"Repeat password": "Repetir contraseña",
|
"Repeat password": "Repetir contraseña",
|
||||||
"Change password": "Cambiar contraseña"
|
"Change password": "Cambiar contraseña"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="{{$ctrl.className}}" ng-mouseover="$ctrl.mouseIsOver = true" ng-mouseleave="$ctrl.mouseIsOver = false">
|
<div class="{{$ctrl.className}}" ng-mouseover="$ctrl.mouseIsOver = true" ng-mouseleave="$ctrl.mouseIsOver = false">
|
||||||
<vn-horizontal ng-if="$ctrl.text" class="orderly" ng-click="$ctrl.onClick()">
|
<vn-horizontal ng-if="$ctrl.text" class="orderly" ng-class="{'pointer' : !$ctrl.orderLocked}" ng-click="$ctrl.onClick()">
|
||||||
<vn-none class="title" translate>
|
<vn-none class="title" translate>
|
||||||
{{::$ctrl.text}}
|
{{::$ctrl.text}}
|
||||||
</vn-none>
|
</vn-none>
|
||||||
|
|
|
@ -1,19 +1,25 @@
|
||||||
import {module} from '../module';
|
import {module} from '../module';
|
||||||
|
|
||||||
export default class ColumnHeader {
|
export default class ColumnHeader {
|
||||||
constructor() {
|
constructor($attrs) {
|
||||||
this.order = undefined;
|
this.order = undefined;
|
||||||
this.mouseIsOver = false;
|
this.mouseIsOver = false;
|
||||||
|
this.orderLocked = ($attrs.orderLocked !== undefined);
|
||||||
}
|
}
|
||||||
onClick() {
|
onClick() {
|
||||||
if (this.order === 'ASC') {
|
if (!this.orderLocked) {
|
||||||
this.order = 'DESC';
|
if (this.order === 'ASC') {
|
||||||
} else {
|
this.order = 'DESC';
|
||||||
this.order = 'ASC';
|
} else {
|
||||||
|
this.order = 'ASC';
|
||||||
|
}
|
||||||
|
this.gridHeader.selectColum(this);
|
||||||
}
|
}
|
||||||
this.gridHeader.selectColum(this);
|
|
||||||
}
|
}
|
||||||
showArrow(type) {
|
showArrow(type) {
|
||||||
|
if (this.orderLocked)
|
||||||
|
return false;
|
||||||
|
|
||||||
let showArrow = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order === type);
|
let showArrow = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order === type);
|
||||||
let showOther = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order !== type);
|
let showOther = (this.gridHeader && this.gridHeader.currentColumn && this.gridHeader.currentColumn.field === this.field && this.order !== type);
|
||||||
if (type === 'DESC' && this.mouseIsOver && !showOther) {
|
if (type === 'DESC' && this.mouseIsOver && !showOther) {
|
||||||
|
@ -22,13 +28,13 @@ export default class ColumnHeader {
|
||||||
return showArrow;
|
return showArrow;
|
||||||
}
|
}
|
||||||
$onInit() {
|
$onInit() {
|
||||||
if (this.defaultOrder) {
|
if (this.defaultOrder && !this.orderLocked) {
|
||||||
this.order = this.defaultOrder;
|
this.order = this.defaultOrder;
|
||||||
this.onClick();
|
this.onClick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ColumnHeader.$inject = [];
|
ColumnHeader.$inject = ['$attrs'];
|
||||||
|
|
||||||
module.component('vnColumnHeader', {
|
module.component('vnColumnHeader', {
|
||||||
template: require('./column-header.html'),
|
template: require('./column-header.html'),
|
||||||
|
|
|
@ -2,7 +2,6 @@ vn-grid-header {
|
||||||
border-bottom: 3px solid #9D9D9D;
|
border-bottom: 3px solid #9D9D9D;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
.orderly{
|
.orderly{
|
||||||
cursor: pointer;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
@ -13,6 +13,8 @@ export class ProductionTable {
|
||||||
},
|
},
|
||||||
model: []
|
model: []
|
||||||
};
|
};
|
||||||
|
this.filteredField = null;
|
||||||
|
this.filteredReverse = null;
|
||||||
}
|
}
|
||||||
get checkAll() {
|
get checkAll() {
|
||||||
return this._checkAll;
|
return this._checkAll;
|
||||||
|
@ -21,7 +23,7 @@ export class ProductionTable {
|
||||||
this._checkAll = value;
|
this._checkAll = value;
|
||||||
}
|
}
|
||||||
set tickets(value) {
|
set tickets(value) {
|
||||||
this._tickets = value;
|
this._tickets = this.filteredField ? this.$filter('orderBy')(value, this.filteredField, this.filteredReverse) : value;
|
||||||
this.totalFilter = this._tickets.length;
|
this.totalFilter = this._tickets.length;
|
||||||
this.pageTable.filter.page = 1;
|
this.pageTable.filter.page = 1;
|
||||||
this.pageTickets();
|
this.pageTickets();
|
||||||
|
@ -30,8 +32,9 @@ export class ProductionTable {
|
||||||
return this._tickets;
|
return this._tickets;
|
||||||
}
|
}
|
||||||
onOrder(field, order) {
|
onOrder(field, order) {
|
||||||
let reverse = order === 'DESC';
|
this.filteredField = field;
|
||||||
this.tickets = this.$filter('orderBy')(this.tickets, field, reverse);
|
this.filteredReverse = order === 'DESC';
|
||||||
|
this.tickets = this.tickets; // call tickets setter
|
||||||
}
|
}
|
||||||
pageTickets() {
|
pageTickets() {
|
||||||
let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList;
|
let init = (this.pageTable.filter.page - 1) * this.itemsDisplayedInList;
|
||||||
|
|
|
@ -9,7 +9,7 @@ export default class MenuActions {
|
||||||
switchItem() {
|
switchItem() {
|
||||||
if (!this.items || !this.items.length) return;
|
if (!this.items || !this.items.length) return;
|
||||||
|
|
||||||
let stateName = this.$state.current.name.replace('create', 'list').replace('edit', 'list');
|
let stateName = this.$state.current.name.replace('.create', '.list').replace('.edit', '.list');
|
||||||
|
|
||||||
for (let i = 0; i < this.items.length; i++) {
|
for (let i = 0; i < this.items.length; i++) {
|
||||||
this.items[i].active = (this.items[i].href === stateName);
|
this.items[i].active = (this.items[i].href === stateName);
|
||||||
|
|
|
@ -116,12 +116,7 @@ module.exports = function(Client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function maxCb(_, instances) {
|
function maxCb(_, instances) {
|
||||||
if (!instances) {
|
if (!instances || instances.length !== 1 || instances[0].employeeFk == userId || instances[0].amount > 0) {
|
||||||
done(generateErrorCredit());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instances.length !== 1 || instances[0].employeeFk == userId || instances[0].amount > 0) {
|
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.installMethod('filter', filterParams);
|
||||||
|
|
||||||
|
function filterParams(params) {
|
||||||
|
return {
|
||||||
|
where: {
|
||||||
|
clientFk: params.clientFk
|
||||||
|
},
|
||||||
|
skip: (params.page - 1) * params.size,
|
||||||
|
limit: params.size,
|
||||||
|
order: params.order || 'shipped DESC',
|
||||||
|
include: {
|
||||||
|
relation: "greugeType",
|
||||||
|
scope: {
|
||||||
|
fields: ["id", "name"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,34 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('sumAmount', {
|
||||||
|
description: 'returns sum greuge.ammount from client',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'clientFk',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
arg: 'sumAmount'
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/sumAmount`,
|
||||||
|
verb: 'get'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.sumAmount = (clientFk, callback) => {
|
||||||
|
let query = `SELECT sum(amount) as sumAmount FROM vn.greuge WHERE clientFk = ?`;
|
||||||
|
Self.rawSql(query, [clientFk], callback).then(response => {
|
||||||
|
if (response.length) {
|
||||||
|
callback(null, response[0].sumAmount);
|
||||||
|
} else {
|
||||||
|
callback(null, 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(reject => {
|
||||||
|
callback(reject, null);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,31 @@
|
||||||
|
module.exports = function(Self) {
|
||||||
|
Self.installMethod('filter', filterParams, filterResults);
|
||||||
|
|
||||||
|
function filterParams(params) {
|
||||||
|
return {
|
||||||
|
where: {
|
||||||
|
clientFk: params.clientFk
|
||||||
|
},
|
||||||
|
skip: (params.page - 1) * params.size,
|
||||||
|
limit: params.size,
|
||||||
|
order: params.order || 'created DESC',
|
||||||
|
include: {
|
||||||
|
relation: "employee",
|
||||||
|
scope: {
|
||||||
|
fields: ["id", "name", "surname"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterResults(instances) {
|
||||||
|
let result = JSON.parse(JSON.stringify(instances));
|
||||||
|
if (result && result.instances && result.instances.length) {
|
||||||
|
result.instances.forEach((element, i) => {
|
||||||
|
result.instances[i].employee.name = `${element.employee.name} ${element.employee.surname}`;
|
||||||
|
delete result.instances[i].employee.surname;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "ClientCredit",
|
"name": "clientCredit",
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "greugeType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "Number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
module.exports = function(Self) {
|
||||||
|
require('../methods/greuge/filter.js')(Self);
|
||||||
|
require('../methods/greuge/totalGreuge.js')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "greuge",
|
||||||
|
"base": "VnModel",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "Number",
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "String"
|
||||||
|
},
|
||||||
|
"amount": {
|
||||||
|
"type": "Number"
|
||||||
|
},
|
||||||
|
"shipped": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"client": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Client",
|
||||||
|
"foreignKey": "clientFk"
|
||||||
|
},
|
||||||
|
"greugeType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "greugeType",
|
||||||
|
"foreignKey": "greugeTypeFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
module.exports = fi => {
|
module.exports = fi => {
|
||||||
|
if (fi === undefined || fi === null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
let dni = fi;
|
let dni = fi;
|
||||||
let getLetterDni = dni => {
|
let getLetterDni = dni => {
|
||||||
const regExpDni = 'TRWAGMYFPDXBNJZSQVHLCKE';
|
const regExpDni = 'TRWAGMYFPDXBNJZSQVHLCKE';
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
"Client": {
|
"Client": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ClientCredit": {
|
"clientCredit": {
|
||||||
"dataSource": "salix"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ClientCreditLimit": {
|
"ClientCreditLimit": {
|
||||||
"dataSource": "salix"
|
"dataSource": "salix"
|
||||||
|
@ -59,5 +59,11 @@
|
||||||
},
|
},
|
||||||
"CreditClassification": {
|
"CreditClassification": {
|
||||||
"dataSource": "salix"
|
"dataSource": "salix"
|
||||||
|
},
|
||||||
|
"greuge": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"greugeType": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ module.exports = function(Self) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
Self.installMethod = function(methodName, filterCb) {
|
Self.installMethod = function(methodName, filterCb, filterResult) {
|
||||||
this.remoteMethod(methodName, {
|
this.remoteMethod(methodName, {
|
||||||
description: 'List items using a filter',
|
description: 'List items using a filter',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
|
@ -161,8 +161,12 @@ module.exports = function(Self) {
|
||||||
var response = {};
|
var response = {};
|
||||||
|
|
||||||
function returnValues() {
|
function returnValues() {
|
||||||
if (response.instances !== undefined && response.count !== undefined)
|
if (response.instances !== undefined && response.count !== undefined) {
|
||||||
cb(null, response);
|
if (filterResult)
|
||||||
|
cb(null, filterResult(response));
|
||||||
|
else
|
||||||
|
cb(null, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function error() {
|
function error() {
|
||||||
|
|
Loading…
Reference in New Issue