Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2583-create_supplierAccount_section

This commit is contained in:
Jorge Padawan 2021-01-12 11:05:35 +01:00
commit 4e1b9b911b
18 changed files with 1608 additions and 1184 deletions

File diff suppressed because one or more lines are too long

View File

@ -1085,6 +1085,22 @@ INSERT INTO `vn`.`itemBotanical`(`itemFk`, `botanical`, `genusFk`, `specieFk`)
(3, 'Cycas revoluta', 2, NULL), (3, 'Cycas revoluta', 2, NULL),
(4, 'Polygonum', NULL, NULL); (4, 'Polygonum', NULL, NULL);
INSERT INTO `vn`.`tag`(`id`, `code`, `name`, `isFree`, `isQuantitatif`, `sourceTable`, `unit`, `ediTypeFk`, `overwrite`)
VALUES
(1, 'color', 'Color', 0, 0, 'ink', NULL, NULL, 'inkFk'),
(2, NULL, 'Forma', 1, 0, NULL, NULL,NULL, NULL),
(3, NULL, 'Material', 1, 0, NULL, NULL,NULL, NULL),
(4, NULL, 'Longitud', 1, 1, NULL, 'mm', NULL, 'size'),
(5, NULL, 'Diámetro', 1, 1, NULL, 'mm',NULL, 'diameter'),
(7, NULL, 'Ancho de la base', 1, 1, NULL, 'mm',NULL, NULL),
(23, 'stems', 'Tallos', 1, 1, NULL, NULL, NULL, 'stems'),
(27, NULL, 'Longitud(cm)', 1, 1, NULL, 'cm', NULL, NULL),
(36, NULL, 'Proveedor', 1, 0, NULL, NULL, NULL, NULL),
(56, NULL, 'Genero', 1, 0, NULL, NULL, NULL, NULL),
(58, NULL, 'Variedad', 1, 0, NULL, NULL, NULL, NULL),
(67, 'category', 'Categoria', 1, 0, NULL, NULL, NULL, NULL),
(92, NULL, 'Nombre temporal', 1, 0, NULL, NULL, NULL, NULL);
INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`) INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
VALUES VALUES
(1, 1, 56, 'Ranged weapon', 1), (1, 1, 56, 'Ranged weapon', 1),

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,6 @@ TABLES=(
cplusSubjectOp cplusSubjectOp
cplusTaxBreak cplusTaxBreak
pgc pgc
tag
time time
claimResponsible claimResponsible
claimReason claimReason

View File

@ -59,7 +59,6 @@ IGNORETABLES=(
--ignore-table=vn.mail__ --ignore-table=vn.mail__
--ignore-table=vn.manaSpellers --ignore-table=vn.manaSpellers
--ignore-table=vn.outgoingInvoiceKk --ignore-table=vn.outgoingInvoiceKk
--ignore-table=vn.payment
--ignore-table=vn.paymentExchangeInsurance --ignore-table=vn.paymentExchangeInsurance
--ignore-table=vn.payrollCenter --ignore-table=vn.payrollCenter
--ignore-table=vn.plantpassport__ --ignore-table=vn.plantpassport__

View File

@ -187,7 +187,10 @@ export default class Field extends FormInput {
} }
onChange() { onChange() {
this.emit('change', {value: this.field}); // Changes doesn't reflect until appling async
this.$.$applyAsync(() => {
this.emit('change', {value: this.field});
});
} }
} }
Field.$inject = ['$element', '$scope']; Field.$inject = ['$element', '$scope'];

View File

@ -1,4 +1,5 @@
import Component from '../../lib/component'; import Component from '../../lib/component';
import './style.scss';
export default class SearchPanel extends Component { export default class SearchPanel extends Component {
set filter(value) { set filter(value) {

View File

@ -1,4 +1,4 @@
@import "variables"; @import "./variables";
vn-searchbar { vn-searchbar {
display: block; display: block;
@ -44,4 +44,27 @@ vn-searchbar {
& > form { & > form {
padding: $spacing-lg; padding: $spacing-lg;
} }
& > form#manifold-form {
padding: 0;
.manifold-panel {
border: $border-thin-light;
border-radius: 5px;
position: relative;
text-align: right;
.or {
font-weight: bold;
font-size: 26px;
color: $color-font-secondary
}
vn-icon[icon="info"] {
position: absolute;
top: 2px;
right: 2px
}
}
}
} }

View File

@ -1,4 +1,5 @@
import ngModule from '../../module'; import ngModule from '../../module';
import './style.scss';
export default class Th { export default class Th {
constructor($element) { constructor($element) {

View File

@ -86,5 +86,7 @@
"The social name cannot be empty": "The social name cannot be empty", "The social name cannot be empty": "The social name cannot be empty",
"The nif cannot be empty": "The nif cannot be empty", "The nif cannot be empty": "The nif cannot be empty",
"A travel with this data already exists": "A travel with this data already exists", "A travel with this data already exists": "A travel with this data already exists",
"The observation type can't be repeated": "The observation type can't be repeated" "The observation type can't be repeated": "The observation type can't be repeated",
"New ticket request has been created with price": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong> and a price of <strong>{{price}} €</strong>",
"New ticket request has been created": "New ticket request has been created '{{description}}' for day <strong>{{shipped}}</strong>, with a quantity of <strong>{{quantity}}</strong>"
} }

View File

@ -164,5 +164,7 @@
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria", "You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
"You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas", "You can't upload images on the test environment": "No puedes subir imágenes en el entorno de pruebas",
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta", "The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
"Sorts whole route": "Reordena ruta entera" "Sorts whole route": "Reordena ruta entera",
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong> y un precio de <strong>{{price}} €</strong>",
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día <strong>{{shipped}}</strong>, con una cantidad de <strong>{{quantity}}</strong>"
} }

View File

@ -24,9 +24,9 @@ exports.translateValues = async(instance, changes) => {
function formatDate(date) { function formatDate(date) {
return new Intl.DateTimeFormat('es', { return new Intl.DateTimeFormat('es', {
year: '2-digit', year: 'numeric',
month: '2-digit', month: 'numeric',
day: '2-digit', day: 'numeric',
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
second: '2-digit' second: '2-digit'

View File

@ -8,10 +8,38 @@ module.exports = function(Self) {
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {
if (ctx.isNewInstance) { if (ctx.isNewInstance) {
const loopBackContext = LoopBackContext.getCurrentContext(); const loopBackContext = LoopBackContext.getCurrentContext();
let filter = {where: {userFk: loopBackContext.active.accessToken.userId}}; const filter = {where: {userFk: loopBackContext.active.accessToken.userId}};
let worker = await Self.app.models.Worker.findOne(filter); const models = Self.app.models;
const worker = await models.Worker.findOne(filter);
ctx.instance.requesterFk = worker.id; const instance = ctx.instance;
instance.requesterFk = worker.id;
const httpCtx = {req: loopBackContext.active};
const httpRequest = httpCtx.req.http .req;
const $t = httpRequest.__;
const attenderId = instance.attenderFk;
if (attenderId) {
const ticket = await models.Ticket.findById(instance.ticketFk);
let messageText = 'New ticket request has been created';
if (instance.price)
messageText = 'New ticket request has been created with price';
const shipped = new Intl.DateTimeFormat('es', {
year: 'numeric',
month: 'numeric',
day: 'numeric'
}).format(ticket.shipped);
const message = $t(messageText, {
description: instance.description,
shipped: shipped,
quantity: instance.quantity,
price: instance.price
});
await models.Chat.sendCheckingPresence(httpCtx, attenderId, message);
}
} }
}); });
}; };

View File

@ -1,6 +1,6 @@
<div class="search-panel"> <div class="search-panel">
<form ng-submit="$ctrl.onSearch()"> <form id="manifold-form" ng-submit="$ctrl.onSearch()">
<vn-horizontal> <vn-horizontal class="vn-px-lg vn-pt-lg">
<vn-textfield <vn-textfield
vn-one vn-one
label="General search" label="General search"
@ -9,7 +9,7 @@
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal class="vn-px-lg">
<vn-textfield <vn-textfield
vn-one vn-one
label="Client id" label="Client id"
@ -21,27 +21,37 @@
ng-model="filter.orderFk"> ng-model="filter.orderFk">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <section class="vn-px-md">
<vn-date-picker <vn-horizontal class="manifold-panel vn-pa-md">
vn-one <vn-date-picker
label="From" vn-one
ng-model="filter.from"> label="From"
</vn-date-picker> ng-model="filter.from"
<vn-date-picker on-change="$ctrl.from = value">
vn-one </vn-date-picker>
label="To" <vn-date-picker
ng-model="filter.to"> vn-one
</vn-date-picker> label="To"
<vn-input-number ng-model="filter.to"
vn-one on-change="$ctrl.to = value">
min="0" </vn-date-picker>
step="1" <vn-none class="or vn-px-md">O</vn-none>
label="Days onward" <vn-input-number
ng-model="filter.scopeDays" vn-one
display-controls="true"> min="0"
</vn-input-number> step="1"
</vn-horizontal> label="Days onward"
<vn-horizontal> ng-model="filter.scopeDays"
on-change="$ctrl.scopeDays = value"
display-controls="true">
</vn-input-number>
<vn-icon color-marginal
icon="info"
vn-tooltip="Cannot choose a range of dates and days onward at the same time">
</vn-icon>
</vn-horizontal>
</section>
<vn-horizontal class="vn-px-lg">
<vn-textfield <vn-textfield
vn-one vn-one
label="Nickname" label="Nickname"
@ -63,7 +73,7 @@
ng-model="filter.refFk"> ng-model="filter.refFk">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal class="vn-px-lg">
<vn-autocomplete <vn-autocomplete
vn-one vn-one
label="Agency" label="Agency"
@ -87,7 +97,7 @@
</tpl-item> </tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal class="vn-px-lg">
<vn-autocomplete <vn-autocomplete
vn-one vn-one
label="Warehouse" label="Warehouse"
@ -101,7 +111,7 @@
url="Provinces"> url="Provinces">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal class="vn-px-lg">
<vn-check <vn-check
vn-one vn-one
label="My team" label="My team"
@ -121,7 +131,7 @@
triple-state="true"> triple-state="true">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal class="vn-mt-lg"> <vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
<vn-submit label="Search"></vn-submit> <vn-submit label="Search"></vn-submit>
</vn-horizontal> </vn-horizontal>
</form> </form>

View File

@ -1,8 +1,11 @@
import ngModule from '../module'; import ngModule from '../module';
import SearchPanel from 'core/components/searchbar/search-panel'; import SearchPanel from 'core/components/searchbar/search-panel';
class Controller extends SearchPanel { class Controller extends SearchPanel {
constructor($, $element) { constructor($, $element) {
super($, $element); super($, $element);
this.filter = this.$.filter;
this.getGroupedStates(); this.getGroupedStates();
} }
@ -19,6 +22,35 @@ class Controller extends SearchPanel {
this.groupedStates = groupedStates; this.groupedStates = groupedStates;
}); });
} }
get from() {
return this._from;
}
set from(value) {
this._from = value;
this.filter.scopeDays = null;
}
get to() {
return this._to;
}
set to(value) {
this._to = value;
this.filter.scopeDays = null;
}
get scopeDays() {
return this._scopeDays;
}
set scopeDays(value) {
this._scopeDays = value;
this.filter.from = null;
this.filter.to = null;
}
} }
ngModule.vnComponent('vnTicketSearchPanel', { ngModule.vnComponent('vnTicketSearchPanel', {

View File

@ -10,10 +10,11 @@ describe('Ticket Component vnTicketSearchPanel', () => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
controller = $componentController('vnTicketSearchPanel', {$element: null}); controller = $componentController('vnTicketSearchPanel', {$element: null});
controller.$t = () => {}; controller.$t = () => {};
controller.filter = {};
})); }));
describe('getGroupedStates()', () => { describe('getGroupedStates()', () => {
it('should set an array of groupedStates with the aditionof a name translation', () => { it('should set an array of groupedStates with the adition of a name translation', () => {
jest.spyOn(controller, '$t').mockReturnValue('miCodigo'); jest.spyOn(controller, '$t').mockReturnValue('miCodigo');
const data = [ const data = [
{ {
@ -32,4 +33,39 @@ describe('Ticket Component vnTicketSearchPanel', () => {
}]); }]);
}); });
}); });
describe('from() setter', () => {
it('should clear the scope days when setting the from property', () => {
controller.filter.scopeDays = 1;
controller.from = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.from).toBeDefined();
});
});
describe('to() setter', () => {
it('should clear the scope days when setting the to property', () => {
controller.filter.scopeDays = 1;
controller.to = new Date();
expect(controller.filter.scopeDays).toBeNull();
expect(controller.to).toBeDefined();
});
});
describe('scopeDays() setter', () => {
it('should clear the date range when setting the scopeDays property', () => {
controller.filter.from = new Date();
controller.filter.to = new Date();
controller.scopeDays = 1;
expect(controller.filter.from).toBeNull();
expect(controller.filter.to).toBeNull();
expect(controller.scopeDays).toBeDefined();
});
});
}); });

View File

@ -16,4 +16,5 @@ Pending: Pendiente
FREE: Libre FREE: Libre
DELIVERED: Servido DELIVERED: Servido
ON_PREPARATION: En preparacion ON_PREPARATION: En preparacion
PACKED: Encajado PACKED: Encajado
Cannot choose a range of dates and days onward at the same time: No se puede selecionar un rango de fechas y días en adelante a la vez

View File

@ -4,4 +4,4 @@ You are going to delete this weekly ticket: Vas a eliminar este ticket programad
This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas? This ticket will be removed from weekly tickets! Continue anyway?: Este ticket se eliminará de tickets programados! ¿Continuar de todas formas?
Search weekly ticket by id or client id: Busca tickets programados por el identificador o el identificador del cliente Search weekly ticket by id or client id: Busca tickets programados por el identificador o el identificador del cliente
Search by weekly ticket: Buscar por tickets programados Search by weekly ticket: Buscar por tickets programados
weekDay: Dia Weekday: Llegada