Merge branch 'dev' into 5660-changeRolDeliveryAssistant
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-03 07:23:59 +00:00
commit 7c0eb16e5b
39 changed files with 478 additions and 144 deletions

View File

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2330.01] - 2023-07-27 ## [2334.01] - 2023-08-24
### Added ### Added
@ -14,6 +14,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
## [2332.01] - 2023-08-09
### Added
- (Trabajadores -> Gestión documental) Soporte para Docuware
- (General -> Agencia) Soporte para Viaexpress
### Changed
- (General -> Tickets) Devuelve el motivo por el cual no es editable
- (Desplegables -> Trabajadores) Mejorados
### Fixed
## [2330.01] - 2023-07-27 ## [2330.01] - 2023-07-27
### Added ### Added
@ -24,7 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- (General -> Iconos) Añadidos nuevos iconos - (General -> Iconos) Añadidos nuevos iconos
- (Clientes -> Razón social) Nuevas restricciones por pais - (Clientes -> Razón social) Permite crear clientes con la misma razón social según el país
### Fixed ### Fixed

View File

@ -0,0 +1,45 @@
const axios = require('axios');
const {DOMParser} = require('xmldom');
module.exports = Self => {
Self.remoteMethod('internationalExpedition', {
description: 'Create an expedition and return a label',
accessType: 'WRITE',
accepts: [{
arg: 'expeditionFk',
type: 'number',
required: true
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/internationalExpedition`,
verb: 'POST'
}
});
Self.internationalExpedition = async expeditionFk => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
fields: ['url']
});
const renderedXml = await models.ViaexpressConfig.renderer(expeditionFk);
const response = await axios.post(`${viaexpressConfig.url}ServicioVxClientes.asmx`, renderedXml, {
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
}
});
const xmlString = response.data;
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
const referenciaVxElement = xmlDoc.getElementsByTagName('ReferenciaVx')[0];
const referenciaVx = referenciaVxElement.textContent;
return referenciaVx;
};
};

View File

@ -0,0 +1,126 @@
const fs = require('fs');
const ejs = require('ejs');
module.exports = Self => {
Self.remoteMethod('renderer', {
description: 'Renders the data from an XML',
accessType: 'READ',
accepts: [{
arg: 'expeditionFk',
type: 'number',
required: true
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/renderer`,
verb: 'GET'
}
});
Self.renderer = async expeditionFk => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType']
});
const expedition = await models.Expedition.findOne({
fields: ['id', 'ticketFk'],
where: {id: expeditionFk},
include: [
{
relation: 'ticket',
scope: {
fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'],
include: [
{
relation: 'client',
scope: {
fields: ['mobile', 'phone', 'email']
}
},
{
relation: 'address',
scope: {
fields: [
'nickname',
'street',
'postalCode',
'city',
'mobile',
'phone',
'provinceFk'
],
include: {
relation: 'province',
scope: {
fields: ['name', 'countryFk'],
include: {
relation: 'country',
scope: {
fields: ['code'],
}
}
}
}
}
},
{
relation: 'company',
scope: {
fields: ['clientFk'],
include: {
relation: 'client',
scope: {
fields: ['socialName', 'mobile', 'phone', 'email', 'defaultAddressFk'],
include: {
relation: 'defaultAddress',
scope: {
fields: [
'street',
'postalCode',
'city',
'mobile',
'phone',
'provinceFk'
],
include: {
relation: 'province',
scope: {
fields: ['name']
}
}
}
}
}
}
}
}
]
}
}
]
});
const ticket = expedition.ticket();
const sender = ticket.company().client();
const shipped = ticket.shipped.toISOString();
const data = {
viaexpressConfig,
sender,
senderAddress: sender.defaultAddress(),
client: ticket.client(),
address: ticket.address(),
shipped
};
const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8');
const renderedXml = ejs.render(template, data);
return renderedXml;
};
};

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<PutExpedicionInternacional xmlns="http://82.223.6.71:82">
<ObjetoEnvio>
<Peso><%= viaexpressConfig.defaultWeight %></Peso>
<Bultos>1</Bultos>
<Reembolso>0</Reembolso>
<Fecha><%= shipped %></Fecha>
<ConRetorno>0</ConRetorno>
<Tipo><%= viaexpressConfig.deliveryType %></Tipo>
<Debidos>0</Debidos>
<Asegurado>0</Asegurado>
<Imprimir>0</Imprimir>
<ConDevolucionAlbaran>0</ConDevolucionAlbaran>
<Intradia>0</Intradia>
<Observaciones></Observaciones>
<AlbaranRemitente></AlbaranRemitente>
<Modo>0</Modo>
<TextoAgencia></TextoAgencia>
<Terminal></Terminal>
<ObjetoRemitente>
<RazonSocial><%= sender.socialName %></RazonSocial>
<Domicilio><%= senderAddress.street %></Domicilio>
<Cpostal><%= senderAddress.postalCode %></Cpostal>
<Poblacion><%= senderAddress.city %></Poblacion>
<Provincia><%= senderAddress.province().name %></Provincia>
<Contacto></Contacto>
<Telefono><%= senderAddress.mobile || senderAddress.phone || sender.mobile || sender.phone %></Telefono>
<Email><%= sender.email %></Email>
</ObjetoRemitente>
<ObjetoDestinatario>
<RazonSocial><%= address.nickname %></RazonSocial>
<Domicilio><%= address.street %></Domicilio>
<Cpostal><%= address.postalCode %></Cpostal>
<Poblacion><%= address.city %></Poblacion>
<Municipio></Municipio>
<Provincia><%= address.province().name %></Provincia>
<Contacto></Contacto>
<Telefono><%= address.mobile || address.phone || client.mobile || client.phone %></Telefono>
<Email><%= client.email %></Email>
<Pais><%= address.province().country().code %></Pais>
</ObjetoDestinatario>
<ObjetoLogin>
<IdCliente><%= viaexpressConfig.client %></IdCliente>
<Usuario><%= viaexpressConfig.user %></Usuario>
<Password><%= viaexpressConfig.password %></Password>
</ObjetoLogin>
</ObjetoEnvio>
</PutExpedicionInternacional>
</soap12:Body>
</soap12:Envelope>

View File

@ -47,7 +47,7 @@ module.exports = Self => {
const user = await Self.findById(userId, {fields: ['hasGrant']}, myOptions); const user = await Self.findById(userId, {fields: ['hasGrant']}, myOptions);
const userToUpdate = await Self.findById(id, { const userToUpdate = await Self.findById(id, {
fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'], fields: ['id', 'name', 'hasGrant', 'roleFk', 'password', 'email'],
include: { include: {
relation: 'role', relation: 'role',
scope: { scope: {

View File

@ -150,6 +150,9 @@
}, },
"PrintConfig": { "PrintConfig": {
"dataSource": "vn" "dataSource": "vn"
},
"ViaexpressConfig": {
"dataSource": "vn"
} }
} }

View File

@ -27,5 +27,12 @@
"where" :{ "where" :{
"expired": null "expired": null
} }
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
}
} }
} }

View File

@ -0,0 +1,4 @@
module.exports = Self => {
require('../methods/viaexpress-config/internationalExpedition')(Self);
require('../methods/viaexpress-config/renderer')(Self);
};

View File

@ -0,0 +1,34 @@
{
"name": "ViaexpressConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "viaexpressConfig"
}
},
"properties": {
"id": {
"type": "number",
"required": true
},
"url": {
"type": "string",
"required": true
},
"client": {
"type": "string"
},
"user": {
"type": "string"
},
"password": {
"type": "string"
},
"defaultWeight": {
"type": "number"
},
"deliveryType": {
"type": "string"
}
}
}

View File

@ -20,7 +20,7 @@ module.exports = function(Self) {
Self.validatesFormatOf('email', { Self.validatesFormatOf('email', {
message: 'Invalid email', message: 'Invalid email',
allowNull: true, allowNull: true,
allowBlank: true, allowBlank: false,
with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/ with: /^[\w|.|-]+@[\w|-]+(\.[\w|-]+)*(,[\w|.|-]+@[\w|-]+(\.[\w|-]+)*)*$/
}); });
@ -115,6 +115,14 @@ module.exports = function(Self) {
Self.validateLogin = async function(user, password) { Self.validateLogin = async function(user, password) {
let loginInfo = Object.assign({password}, Self.userUses(user)); let loginInfo = Object.assign({password}, Self.userUses(user));
token = await Self.login(loginInfo, 'user'); token = await Self.login(loginInfo, 'user');
const userToken = await token.user.get();
try {
await Self.app.models.Account.sync(userToken.name, password);
} catch (err) {
console.warn(err);
}
return {token: token.id, ttl: token.ttl}; return {token: token.id, ttl: token.ttl};
}; };

View File

@ -0,0 +1,4 @@
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('ViaexpressConfig', 'internationalExpedition', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('ViaexpressConfig', 'renderer', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,10 @@
CREATE TABLE `vn`.`viaexpressConfig` (
id int auto_increment NOT NULL,
url varchar(100) NOT NULL,
client varchar(100) NOT NULL,
user varchar(100) NOT NULL,
password varchar(100) NOT NULL,
defaultWeight decimal(10,2) NOT NULL,
deliveryType varchar(5) NOT NULL,
CONSTRAINT viaexpressConfig_PK PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

View File

View File

@ -579,13 +579,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`)
VALUES VALUES
(241, 442, 'ES111122333344111122221111', 128); (241, 442, 'ES111122333344111122221111', 128);
INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary`) INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary` , `clientFk`)
VALUES VALUES
(69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL), (69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL , NULL),
(442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'), (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport' , 1101),
(567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'), (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport' , NULL),
(791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL), (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL , NULL),
(1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport' , NULL);
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
VALUES VALUES

View File

@ -339,8 +339,9 @@ export default class SmartTable extends Component {
if (!header) return; if (!header) return;
const tbody = this.element.querySelector('tbody'); const tbody = this.element.querySelector('tbody');
const columns = header.querySelectorAll('th'); if (!tbody) return;
const columns = header.querySelectorAll('th');
const hasSearchRow = tbody.querySelector('tr#searchRow'); const hasSearchRow = tbody.querySelector('tr#searchRow');
if (hasSearchRow) { if (hasSearchRow) {
if (this.$inputsScope) if (this.$inputsScope)

View File

@ -39,7 +39,7 @@
label="Recovery email" label="Recovery email"
ng-model="$ctrl.account.email" ng-model="$ctrl.account.email"
info="This email is used for user to regain access their account." info="This email is used for user to regain access their account."
rule="VnUser.name"> rule="VnUser.email">
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>

View File

@ -0,0 +1,20 @@
name: invoice in
columns:
id: id
serialNumber: serial number
serial: serial
supplierFk: supplier
issued: issued
supplierRef: supplierRef
isBooked: is booked
currencyFk: currency
created: created
companyFk: company
docFk: document
booked: booked
operated: operated
bookEntried: book entried
isVatDeductible: is VAT deductible
withholdingSageFk: withholding
expenceFkDeductible: expence deductible
editorFk: editor

View File

@ -0,0 +1,20 @@
name: factura recibida
columns:
id: id
serialNumber: número de serie
serial: serie
supplierFk: proveedor
issued: fecha emisión
supplierRef: referéncia proveedor
isBooked: facturado
currencyFk: moneda
created: creado
companyFk: empresa
docFk: documento
booked: fecha contabilización
operated: fecha entrega
bookEntried: fecha asiento
isVatDeductible: impuesto deducible
withholdingSageFk: código de retención
expenceFkDeductible: gasto deducible
editorFk: editor

View File

@ -0,0 +1,9 @@
name: invoice in due day
columns:
id: id
invoiceInFk: invoice in
dueDated: due date
bankFk: bank
amount: amount
foreignValue : foreign amount
created: created

View File

@ -0,0 +1,9 @@
name: vencimientos factura recibida
columns:
id: id
invoiceInFk: factura
dueDated: fecha vto.
bankFk: banco
amount: importe
foreignValue : importe divisa
created: creado

View File

@ -0,0 +1,12 @@
name: invoice in tax
columns:
id: id
invoiceInFk: invoice in
taxCodeFk: tax
taxableBase: taxable base
expenceFk: expence
foreignValue: foreign amount
taxTypeSageFk: tax type
transactionTypeSageFk: transaction type
created: created
editorFk: editor

View File

@ -0,0 +1,12 @@
name: factura recibida impuesto
columns:
id: id
invoiceInFk: factura recibida
taxCodeFk: código IVA
taxableBase: base imponible
expenceFk: código gasto
foreignValue: importe divisa
taxTypeSageFk: código impuesto
transactionTypeSageFk: código transacción
created: creado
editorFk: editor

View File

@ -1,44 +0,0 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethod('activeBuyers', {
description: 'Returns a list of buyers for the given item type',
accepts: [{
arg: 'filter',
type: 'object',
description: `Filter defining where, order, offset, and limit - must be a JSON-encoded string`
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/activeBuyers`,
verb: 'GET'
}
});
Self.activeBuyers = async(filter, options) => {
const conn = Self.dataSource.connector;
const where = {isActive: true};
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
filter = mergeFilters(filter, {where});
let stmt = new ParameterizedSQL(
`SELECT DISTINCT w.id workerFk, w.firstName, w.lastName, u.name, u.nickname
FROM worker w
JOIN itemType it ON it.workerFk = w.id
JOIN account.user u ON u.id = w.id
JOIN item i ON i.typeFk = it.id`,
null, myOptions);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt);
};
};

View File

@ -1,24 +0,0 @@
const models = require('vn-loopback/server/server').models;
describe('Worker activeBuyers', () => {
it('should return the buyers in itemType as result', async() => {
const tx = await models.Item.beginTransaction({});
try {
const options = {transaction: tx};
const filter = {};
const result = await models.Item.activeBuyers(filter, options);
const firstWorker = result[0];
const secondWorker = result[1];
expect(result.length).toEqual(2);
expect(firstWorker.nickname).toEqual('logisticBossNick');
expect(secondWorker.nickname).toEqual('buyerNick');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -14,7 +14,6 @@ module.exports = Self => {
require('../methods/item/getWasteByWorker')(Self); require('../methods/item/getWasteByWorker')(Self);
require('../methods/item/getWasteByItem')(Self); require('../methods/item/getWasteByItem')(Self);
require('../methods/item/createIntrastat')(Self); require('../methods/item/createIntrastat')(Self);
require('../methods/item/activeBuyers')(Self);
require('../methods/item/buyerWasteEmail')(Self); require('../methods/item/buyerWasteEmail')(Self);
require('../methods/item/labelPdf')(Self); require('../methods/item/labelPdf')(Self);

View File

@ -26,7 +26,7 @@
search-function="{firstName: $search}" search-function="{firstName: $search}"
value-field="id" value-field="id"
where="{role: {inq: ['logistic', 'buyer']}}" where="{role: {inq: ['logistic', 'buyer']}}"
label="Atender"> label="Buyer">
<tpl-item>{{nickname}}</tpl-item> <tpl-item>{{nickname}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>

View File

@ -41,10 +41,10 @@
<vn-autocomplete <vn-autocomplete
vn-one vn-one
ng-model="filter.buyerFk" ng-model="filter.buyerFk"
url="Items/activeBuyers" url="TicketRequests/getItemTypeWorker"
search-function="{firstName: $search}"
show-field="nickname" show-field="nickname"
search-function="{nickname: {like: '%'+ $search +'%'}}" value-field="id"
value-field="workerFk"
label="Buyer"> label="Buyer">
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete <vn-autocomplete

View File

@ -1,7 +1,9 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('getItemTypeWorker', { Self.remoteMethod('getItemTypeWorker', {
description: 'Returns the workers that appear in itemType', description: 'Returns the workers that appear in itemType',
accessType: 'READ', accessType: 'READ',
accepts: [{ accepts: [{
@ -20,38 +22,37 @@ module.exports = Self => {
} }
}); });
Self.getItemTypeWorker = async(ctx, filter, options) => { Self.getItemTypeWorker = async filter => {
const myOptions = {};
const conn = Self.dataSource.connector; const conn = Self.dataSource.connector;
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
const query = const query =
`SELECT DISTINCT u.id, u.nickname `SELECT DISTINCT u.id, u.nickname
FROM itemType it FROM itemType it
JOIN worker w ON w.id = it.workerFk JOIN worker w ON w.id = it.workerFk
JOIN account.user u ON u.id = w.id`; JOIN account.user u ON u.id = w.id`;
const stmt = new ParameterizedSQL(query);
let stmt = new ParameterizedSQL(query); filter.where = buildFilter(filter.where, (param, value) => {
switch (param) {
if (filter.where) { case 'firstName':
const value = filter.where.firstName; return {or: [
const myFilter = {
where: {or: [
{'w.firstName': {like: `%${value}%`}}, {'w.firstName': {like: `%${value}%`}},
{'w.lastName': {like: `%${value}%`}}, {'w.lastName': {like: `%${value}%`}},
{'u.name': {like: `%${value}%`}}, {'u.name': {like: `%${value}%`}},
{'u.nickname': {like: `%${value}%`}} {'u.nickname': {like: `%${value}%`}}
]} ]};
}; case 'id':
return {'w.id': value};
}
});
stmt.merge(conn.makeSuffix(myFilter)); let myFilter = {
} where: {'u.active': true}
};
if (tx) await tx.commit(); myFilter = mergeFilters(myFilter, filter);
stmt.merge(conn.makeSuffix(myFilter));
return conn.executeStmt(stmt); return conn.executeStmt(stmt);
}; };
}; };

View File

@ -1,12 +1,10 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
describe('ticket-request getItemTypeWorker()', () => { describe('ticket-request getItemTypeWorker()', () => {
const ctx = {req: {accessToken: {userId: 18}}};
it('should return the buyer as result', async() => { it('should return the buyer as result', async() => {
const filter = {where: {firstName: 'buyer'}}; const filter = {where: {firstName: 'buyer'}};
const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); const result = await models.TicketRequest.getItemTypeWorker(filter);
expect(result.length).toEqual(1); expect(result.length).toEqual(1);
}); });
@ -14,7 +12,7 @@ describe('ticket-request getItemTypeWorker()', () => {
it('should return the workers at itemType as result', async() => { it('should return the workers at itemType as result', async() => {
const filter = {}; const filter = {};
const result = await models.TicketRequest.getItemTypeWorker(ctx, filter); const result = await models.TicketRequest.getItemTypeWorker(filter);
expect(result.length).toBeGreaterThan(1); expect(result.length).toBeGreaterThan(1);
}); });

View File

@ -67,7 +67,7 @@ module.exports = function(Self) {
throw new UserError(`This ticket is already invoiced`); throw new UserError(`This ticket is already invoiced`);
const priceZero = ticket.totalWithVat == 0; const priceZero = ticket.totalWithVat == 0;
if (priceZero) if (ticketsIds.length == 1 && priceZero)
throw new UserError(`A ticket with an amount of zero can't be invoiced`); throw new UserError(`A ticket with an amount of zero can't be invoiced`);
}); });

View File

@ -36,9 +36,9 @@ module.exports = Self => {
if (isSubordinate === false) if (isSubordinate === false)
throw new UserError(`You don't have enough privileges`); throw new UserError(`You don't have enough privileges`);
const subordinate = await Worker.findById(ctx.args.workerFk); const subordinate = await Worker.findById(ctx.args.workerFk, {fields: ['id']});
filter = mergeFilters(filter, {where: { filter = mergeFilters(filter, {where: {
userFk: subordinate.userFk userFk: subordinate.id
}}); }});
return Self.find(filter); return Self.find(filter);

View File

@ -25,8 +25,7 @@
"type" : "string" "type" : "string"
}, },
"userFk": { "userFk": {
"type" : "number", "type" : "number"
"required": true
}, },
"bossFk": { "bossFk": {
"type" : "number" "type" : "number"

View File

@ -36,7 +36,7 @@ class Controller extends ModuleCard {
this.$http.get(`Workers/${this.$params.id}`, {filter}) this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data), .then(res => this.worker = res.data),
this.$http.get(`Workers/${this.$params.id}/activeContract`) this.$http.get(`Workers/${this.$params.id}/activeContract`)
.then(res => this.hasWorkCenter = res.data.workCenterFk) .then(res => this.hasWorkCenter = res.data?.workCenterFk)
]); ]);
} }
} }

View File

@ -32,6 +32,28 @@ class Controller extends Descriptor {
this.vnApp.showSuccess(this.$t('Department deleted.')); this.vnApp.showSuccess(this.$t('Department deleted.'));
}); });
} }
loadData() {
const filter = {
fields: ['id', 'name', 'code', 'workerFk', 'isProduction', 'chatName',
'isTeleworking', 'notificationEmail', 'hasToRefill', 'hasToSendMail', 'hasToMistake', 'clientFk'],
include: [
{relation: 'client',
scope: {
fields: ['id', 'name']
}},
{
relation: 'worker',
scope: {
fields: ['id', 'firstName', 'lastName']
}
}
]
};
return this.getData(`Departments/${this.id}`, {filter})
.then(res => this.entity = res.data);
}
} }
Controller.$inject = ['$element', '$scope', '$rootScope']; Controller.$inject = ['$element', '$scope', '$rootScope'];

View File

@ -4,7 +4,7 @@
filter="::$ctrl.filter" filter="::$ctrl.filter"
data="$ctrl.hours"> data="$ctrl.hours">
</vn-crud-model> </vn-crud-model>
<div ng-if="$ctrl.card.hasWorkCenter"> <div>
<vn-card class="vn-pa-lg vn-w-lg"> <vn-card class="vn-pa-lg vn-w-lg">
<vn-table model="model" auto-load="false"> <vn-table model="model" auto-load="false">
<vn-thead> <vn-thead>
@ -106,12 +106,6 @@
</vn-button> </vn-button>
</vn-button-bar> </vn-button-bar>
</div> </div>
<div
ng-if="!$ctrl.card.hasWorkCenter"
class="bg-title"
translate>
Autonomous worker
</div>
<vn-side-menu side="right"> <vn-side-menu side="right">
<div class="vn-pa-md"> <div class="vn-pa-md">

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "23.32.01", "version": "23.34.01",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -1,6 +1,6 @@
{ {
"name": "salix-back", "name": "salix-back",
"version": "23.32.01", "version": "23.34.01",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "Salix backend", "description": "Salix backend",
"license": "GPL-3.0", "license": "GPL-3.0",

View File

@ -539,9 +539,9 @@
<Stroke>2</Stroke> <Stroke>2</Stroke>
<Width>4</Width> <Width>4</Width>
</GraphicShape> </GraphicShape>
<GraphicShape xsi:type="WindowText" Style="Cross" IsPrint="true" PageAlignment="None" Locked="false" bStroke="true" bFill="true" Direction="Angle90" X="613" Y="24" Alignment="Left" AlignPointX="613" AlignPointY="24" FontScript="Default" FontCmd="Arial,118.2266,B&#xD;&#xA;" FontHeight="1" FontWidth="1" TextSpace="0" bSpaceCropping="false"> <GraphicShape xsi:type="WindowText" Style="Cross" IsPrint="true" PageAlignment="None" Locked="false" bStroke="true" bFill="true" Direction="Angle90" X="564" Y="32" Alignment="Left" AlignPointX="564" AlignPointY="32" FontScript="Default" FontCmd="Arial,118.2266,B&#xD;&#xA;" FontHeight="1" FontWidth="1" TextSpace="0" bSpaceCropping="false">
<qHitOnCircumferance>false</qHitOnCircumferance> <qHitOnCircumferance>false</qHitOnCircumferance>
<Selected>false</Selected> <Selected>true</Selected>
<iBackground_color>4294967295</iBackground_color> <iBackground_color>4294967295</iBackground_color>
<Id>5</Id> <Id>5</Id>
<ItemLabel>W5</ItemLabel> <ItemLabel>W5</ItemLabel>
@ -571,15 +571,15 @@
<BoundRectHeight>2896</BoundRectHeight> <BoundRectHeight>2896</BoundRectHeight>
<BoundRect> <BoundRect>
<Location> <Location>
<X>187</X> <X>138</X>
<Y>24</Y> <Y>32</Y>
</Location> </Location>
<Size> <Size>
<Width>426</Width> <Width>426</Width>
<Height>2896</Height> <Height>2896</Height>
</Size> </Size>
<X>187</X> <X>138</X>
<Y>24</Y> <Y>32</Y>
<Width>426</Width> <Width>426</Width>
<Height>2896</Height> <Height>2896</Height>
</BoundRect> </BoundRect>
@ -621,14 +621,14 @@
<Setup bInfinityPrint="false" LabelLength="610" LabelWidth="100" LeftMargin="0" TopMargin="0" LabelType="1" GapLength="3" FeedLength="0" ZSign="43" BlackMark="3" Position="0" Speed="2" Copy="1" bCopyDataBase="false" CopyField="None" Stripper="0" LabelsPerCut="0" DoubleCut_Enable="false" DoubleCut_OffsetLen="0" DoubleCut_FirstCutMode="1" Rotate180="200" Stop="35" Darkness="5" Number="1" bCutDataBase="false" bBatchCut="false" bNumberDataBase="false" NumberField="None" PageDirection="Portrait" PrintMode="0" PowerRFID="10" LengthRFID="0" RetryRFID="3" DrawMode="0"> <Setup bInfinityPrint="false" LabelLength="610" LabelWidth="100" LeftMargin="0" TopMargin="0" LabelType="1" GapLength="3" FeedLength="0" ZSign="43" BlackMark="3" Position="0" Speed="2" Copy="1" bCopyDataBase="false" CopyField="None" Stripper="0" LabelsPerCut="0" DoubleCut_Enable="false" DoubleCut_OffsetLen="0" DoubleCut_FirstCutMode="1" Rotate180="200" Stop="35" Darkness="5" Number="1" bCutDataBase="false" bBatchCut="false" bNumberDataBase="false" NumberField="None" PageDirection="Portrait" PrintMode="0" PowerRFID="10" LengthRFID="0" RetryRFID="3" DrawMode="0">
<Layout Shape="0" AcrossType="Copied" PageDirection="Portrait" HorAcross="1" VerAcross="1" HorGap="0" VerGap="0" HorAcrossMode1="1" VerAcrossMode1="1" LabelMode="0" HorGapMode1="0" VerGapMode1="0" BottomMargin="0" RightMargin="0" /> <Layout Shape="0" AcrossType="Copied" PageDirection="Portrait" HorAcross="1" VerAcross="1" HorGap="0" VerGap="0" HorAcrossMode1="1" VerAcrossMode1="1" LabelMode="0" HorGapMode1="0" VerGapMode1="0" BottomMargin="0" RightMargin="0" />
<Description>New label <Description>New label
Lang:(es-ES) OS:Microsoft Windows NT 10.0.22000.0(Win32NT)</Description> Lang:(es-ES) OS:Microsoft Windows NT 10.0.19045.0(Win32NT)</Description>
<UnitType>Mm</UnitType> <UnitType>Mm</UnitType>
<Dpi>203</Dpi> <Dpi>203</Dpi>
</Setup> </Setup>
<PrinterModel /> <PrinterModel />
<PrinterLanguage>EZPL</PrinterLanguage> <PrinterLanguage>EZPL</PrinterLanguage>
<USBName>GODEX G300#132207AB</USBName> <USBName>00000000</USBName>
<COMName>None</COMName> <COMName>COM1</COMName>
<CommunicationType>USB</CommunicationType> <CommunicationType>USB</CommunicationType>
<NetworkIPAddress>2886794855</NetworkIPAddress> <NetworkIPAddress>2886794855</NetworkIPAddress>
<NetworkPort>9100</NetworkPort> <NetworkPort>9100</NetworkPort>

View File

@ -1,9 +1,9 @@
[ [
{ {
"filename": "model.ezp", "filename": "model.ezpx",
"component": "printer-setup", "component": "printer-setup",
"path": "/assets/files/model.ezp", "path": "/assets/files/model.ezpx",
"cid": "model.ezp" "cid": "model.ezpx"
}, },
{ {
"filename": "port.png", "filename": "port.png",