Merge branch 'test' into dev
gitea/salix/dev There was a failure building this commit
Details
gitea/salix/dev There was a failure building this commit
Details
This commit is contained in:
commit
61b9646f5b
|
@ -8,19 +8,17 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
PROJECT_NAME = 'salix'
|
PROJECT_NAME = 'salix'
|
||||||
REGISTRY = 'registry.verdnatura.es'
|
REGISTRY = 'registry.verdnatura.es'
|
||||||
DOCKER_HOST_1 = 'vch1.verdnatura.es'
|
|
||||||
DOCKER_HOST_2 = 'vch2.verdnatura.es'
|
|
||||||
PORT_MASTER_FRONT = '5002'
|
PORT_MASTER_FRONT = '5002'
|
||||||
PORT_MASTER_BACK = '3001-3002'
|
PORT_MASTER_BACK = '3001'
|
||||||
PORT_TEST_FRONT = '5001'
|
PORT_TEST_FRONT = '5001'
|
||||||
PORT_TEST_BACK = '4001-4002'
|
PORT_TEST_BACK = '4001'
|
||||||
TAG = "${env.BRANCH_NAME}"
|
TAG = "${env.BRANCH_NAME}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
env.COMPOSE_PROJECT_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
env.STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
|
||||||
|
|
||||||
if (!env.GIT_COMMITTER_EMAIL) {
|
if (!env.GIT_COMMITTER_EMAIL) {
|
||||||
env.COMMITTER_EMAIL = sh(
|
env.COMMITTER_EMAIL = sh(
|
||||||
|
@ -65,21 +63,26 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Test') {
|
stage('Test') {
|
||||||
when { not { anyOf {
|
|
||||||
branch 'test'
|
|
||||||
branch 'master'
|
|
||||||
}}}
|
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ""
|
NODE_ENV = ""
|
||||||
FIREFOX_BIN = "/opt/firefox/firefox-bin"
|
|
||||||
}
|
}
|
||||||
|
parallel {
|
||||||
|
stage('Frontend') {
|
||||||
steps {
|
steps {
|
||||||
nodejs('node-lts') {
|
nodejs('node-lts') {
|
||||||
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=1'
|
sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Backend') {
|
||||||
|
steps {
|
||||||
|
nodejs('node-lts') {
|
||||||
sh 'gulp backTestDockerOnce --junit --random'
|
sh 'gulp backTestDockerOnce --junit --random'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
when { anyOf {
|
when { anyOf {
|
||||||
branch 'test'
|
branch 'test'
|
||||||
|
@ -96,6 +99,7 @@ pipeline {
|
||||||
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
|
sh 'docker login --username $CREDS_USR --password $CREDS_PSW $REGISTRY'
|
||||||
sh 'docker-compose build --parallel'
|
sh 'docker-compose build --parallel'
|
||||||
sh 'docker-compose push'
|
sh 'docker-compose push'
|
||||||
|
sh 'docker logout $REGISTRY'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
|
@ -107,27 +111,8 @@ pipeline {
|
||||||
DOCKER_TLS_VERIFY = 1
|
DOCKER_TLS_VERIFY = 1
|
||||||
}
|
}
|
||||||
parallel {
|
parallel {
|
||||||
stage('Host 1') {
|
|
||||||
environment {
|
|
||||||
DOCKER_HOST = "tcp://${env.DOCKER_HOST_1}:2376"
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) {
|
sh "docker stack deploy --compose-file docker-compose.yml ${env.STACK_NAME}"
|
||||||
sh 'docker-compose pull'
|
|
||||||
sh 'docker-compose up -d --scale back=2'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Host 2') {
|
|
||||||
environment {
|
|
||||||
DOCKER_HOST = "tcp://${env.DOCKER_HOST_2}:2376"
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
withCredentials([dockerCert(credentialsId: 'docker', variable: 'DOCKER_CERT_PATH')]) {
|
|
||||||
sh 'docker-compose pull'
|
|
||||||
sh 'docker-compose up -d --scale back=2'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,15 +132,6 @@ pipeline {
|
||||||
sh 'db/import-changes.sh -f $NODE_ENV'
|
sh 'db/import-changes.sh -f $NODE_ENV'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Cleanup') {
|
|
||||||
when { anyOf {
|
|
||||||
branch 'test'
|
|
||||||
branch 'master'
|
|
||||||
}}
|
|
||||||
steps {
|
|
||||||
sh 'docker logout $REGISTRY'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
DROP TRIGGER IF EXISTS `vn`.`expedition_beforeInsert`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
USE `vn`$$
|
||||||
|
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`expedition_beforeInsert`
|
||||||
|
BEFORE INSERT ON `expedition` FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
DECLARE intcounter INT;
|
||||||
|
DECLARE vShipFk INT;
|
||||||
|
|
||||||
|
IF NEW.isBox > 0 THEN
|
||||||
|
|
||||||
|
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
||||||
|
|
||||||
|
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
|
||||||
|
FROM expedition e
|
||||||
|
INNER JOIN ticket t1 ON e.ticketFk = t1.id
|
||||||
|
LEFT JOIN ticketState ts ON ts.ticket = t1.id
|
||||||
|
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
|
||||||
|
AND t1.warehouseFk = t2.warehouseFk
|
||||||
|
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
|
||||||
|
AND t1.agencyModeFk = t2.agencyModeFk;
|
||||||
|
|
||||||
|
SET NEW.`counter` = intcounter;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT shipFk INTO vShipFk FROM stowaway WHERE id = NEW.ticketFk;
|
||||||
|
|
||||||
|
IF vShipFk THEN
|
||||||
|
CALL stowaway_unboarding(vShipFk, NEW.ticketFk);
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,31 @@
|
||||||
|
|
||||||
|
USE `vn`;
|
||||||
|
DROP procedure IF EXISTS `vn`.`stowawayUnBoarding`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
USE `vn`$$
|
||||||
|
CREATE DEFINER=`root`@`%` PROCEDURE `stowaway_unboarding`(vShipFk INT, vStowawayFk INT)
|
||||||
|
BEGIN
|
||||||
|
DECLARE vWorker VARCHAR(255);
|
||||||
|
|
||||||
|
DELETE FROM stowaway
|
||||||
|
WHERE shipFk = vShipFk AND id = vStowawayFk;
|
||||||
|
|
||||||
|
DELETE tt FROM ticketTracking tt
|
||||||
|
JOIN state s ON s.id = tt.stateFk
|
||||||
|
WHERE code = 'BOARDING' AND ticketFk = vShipFk;
|
||||||
|
|
||||||
|
DELETE FROM sale
|
||||||
|
WHERE ticketFk = vShipFk
|
||||||
|
AND itemFk = 98
|
||||||
|
AND concept = CONCAT('POLIZÓN! ',vStowawayFk);
|
||||||
|
|
||||||
|
SELECT u.`name` INTO vWorker
|
||||||
|
FROM account.user u JOIN worker w ON w.userFk = u.id
|
||||||
|
WHERE w.id = client_getSalesPersonByTicket(vStowawayFk);
|
||||||
|
|
||||||
|
SELECT messageSend(vWorker,CONCAT('El ticket: ', vStowawayFk, ' ha dejado de ser un polizón')) INTO @a;
|
||||||
|
END$$
|
||||||
|
|
||||||
|
DELIMITER ;
|
||||||
|
;
|
|
@ -10,6 +10,8 @@ services:
|
||||||
- ${PORT_FRONT}:80
|
- ${PORT_FRONT}:80
|
||||||
links:
|
links:
|
||||||
- back
|
- back
|
||||||
|
deploy:
|
||||||
|
replicas: 3
|
||||||
back:
|
back:
|
||||||
image: registry.verdnatura.es/salix-back:${TAG}
|
image: registry.verdnatura.es/salix-back:${TAG}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -22,3 +24,5 @@ services:
|
||||||
- /containers/salix:/etc/salix
|
- /containers/salix:/etc/salix
|
||||||
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
- /mnt/storage/pdfs:/var/lib/salix/pdfs
|
||||||
- /mnt/storage/dms:/var/lib/salix/dms
|
- /mnt/storage/dms:/var/lib/salix/dms
|
||||||
|
deploy:
|
||||||
|
replicas: 6
|
||||||
|
|
10
gulpfile.js
10
gulpfile.js
|
@ -110,17 +110,27 @@ backTestOnce.description = `Runs the backend tests once, can receive --junit arg
|
||||||
|
|
||||||
async function backTestDockerOnce() {
|
async function backTestDockerOnce() {
|
||||||
let containerId = await docker();
|
let containerId = await docker();
|
||||||
|
try {
|
||||||
await backTestOnce();
|
await backTestOnce();
|
||||||
|
} catch (e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
if (argv['random'])
|
if (argv['random'])
|
||||||
await execP(`docker rm -fv ${containerId}`);
|
await execP(`docker rm -fv ${containerId}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
backTestDockerOnce.description = `Runs backend tests using in site container once`;
|
backTestDockerOnce.description = `Runs backend tests using in site container once`;
|
||||||
|
|
||||||
async function backTestDocker() {
|
async function backTestDocker() {
|
||||||
let containerId = await docker();
|
let containerId = await docker();
|
||||||
|
try {
|
||||||
await backTest();
|
await backTest();
|
||||||
|
} catch (e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
if (argv['random'])
|
if (argv['random'])
|
||||||
await execP(`docker rm -fv ${containerId}`);
|
await execP(`docker rm -fv ${containerId}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
backTestDocker.description = `Runs backend tests restoring fixtures first`;
|
backTestDocker.description = `Runs backend tests restoring fixtures first`;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Claimed ticket: Ticket reclamado
|
||||||
Delete claim: Eliminar reclamación
|
Delete claim: Eliminar reclamación
|
||||||
Observation: Observación
|
Observation: Observación
|
||||||
Responsible: Responsable
|
Responsible: Responsable
|
||||||
Remove sale: Borrar linea
|
Remove sale: Eliminar linea
|
||||||
Claim Id: Id reclamación
|
Claim Id: Id reclamación
|
||||||
Created: Creado
|
Created: Creado
|
||||||
Send Pickup order: Enviar orden de recogida
|
Send Pickup order: Enviar orden de recogida
|
||||||
|
|
|
@ -61,7 +61,8 @@
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
title="{{'Download file' | translate}}"
|
title="{{'Download file' | translate}}"
|
||||||
href="dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">{{::document.dms.file}}
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
|
{{::document.dms.file}}
|
||||||
</a>
|
</a>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
|
@ -74,7 +75,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
href="dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="cloud_download"
|
icon="cloud_download"
|
||||||
title="{{'Download file' | translate}}">
|
title="{{'Download file' | translate}}">
|
||||||
|
|
|
@ -18,7 +18,7 @@ Sent: Enviado
|
||||||
Worker: Trabajador
|
Worker: Trabajador
|
||||||
Sample: Plantilla
|
Sample: Plantilla
|
||||||
Credit: Crédito
|
Credit: Crédito
|
||||||
Are you sure you want to delete this expedition?: ¿Está seguro de borrar esta expedición?
|
Are you sure you want to delete this expedition?: ¿Está seguro de eliminar esta expedición?
|
||||||
Others: Otros
|
Others: Otros
|
||||||
New order: Nuevo pedido
|
New order: Nuevo pedido
|
||||||
Client frozen: Cliente congelado
|
Client frozen: Cliente congelado
|
||||||
|
|
|
@ -3,7 +3,7 @@ Volume: Volumen
|
||||||
Client card: Ficha del cliente
|
Client card: Ficha del cliente
|
||||||
Invoice ticket list: Listado de tickets de la factura
|
Invoice ticket list: Listado de tickets de la factura
|
||||||
Show invoice PDF: Ver factura en PDF
|
Show invoice PDF: Ver factura en PDF
|
||||||
Delete Invoice: Borrar factura
|
Delete Invoice: Eliminar factura
|
||||||
InvoiceOut deleted: Factura eliminada
|
InvoiceOut deleted: Factura eliminada
|
||||||
Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura?
|
Are you sure you want to delete this invoice?: Estas seguro de eliminar esta factura?
|
||||||
Book invoice: Asentar factura
|
Book invoice: Asentar factura
|
||||||
|
|
|
@ -7,6 +7,6 @@ Items: Articulos
|
||||||
Agency: Agencia
|
Agency: Agencia
|
||||||
Sales person: Comercial
|
Sales person: Comercial
|
||||||
Order ticket list: Ticket del pedido
|
Order ticket list: Ticket del pedido
|
||||||
Delete order: Borrar pedido
|
Delete order: Eliminar pedido
|
||||||
You are going to delete this order: El pedido se borrará
|
You are going to delete this order: El pedido se eliminará
|
||||||
continue anyway?: ¿Continuar de todos modos?
|
continue anyway?: ¿Continuar de todos modos?
|
|
@ -1,3 +1,3 @@
|
||||||
Delete row: Eliminar linea
|
Delete row: Eliminar linea
|
||||||
Order confirmed: Pedido confirmado
|
Order confirmed: Pedido confirmado
|
||||||
Are you sure you want to delete this row?: ¿Estas seguro de que quieres borrar esta línea?
|
Are you sure you want to delete this row?: ¿Estas seguro de que quieres eliminar esta línea?
|
|
@ -1,8 +1,8 @@
|
||||||
Remove ticket: Borrar ticket
|
Remove ticket: Eliminar ticket
|
||||||
Open buscaman: Abrir buscaman
|
Open buscaman: Abrir buscaman
|
||||||
Ticket removed from route: Ticket borrado de la ruta
|
Ticket removed from route: Ticket quitado de la ruta
|
||||||
Order changed: Orden cambiado
|
Order changed: Orden cambiado
|
||||||
Delete ticket from route?: ¿Borrar ticket de la ruta?
|
Delete ticket from route?: ¿Quitar el ticket de la ruta?
|
||||||
Sort routes: Ordenar rutas
|
Sort routes: Ordenar rutas
|
||||||
Add ticket: Añadir ticket
|
Add ticket: Añadir ticket
|
||||||
Tickets to add: Tickets a añadir
|
Tickets to add: Tickets a añadir
|
|
@ -21,10 +21,17 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.canHaveStowaway = async id => {
|
Self.canHaveStowaway = async id => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const ticket = await models.Ticket.findById(id);
|
const ticket = await models.Ticket.findById(id, {
|
||||||
|
include: {
|
||||||
|
relation: 'ship',
|
||||||
|
scope: {
|
||||||
|
fields: ['id']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
const warehouse = await models.Warehouse.findById(ticket.warehouseFk);
|
const warehouse = await models.Warehouse.findById(ticket.warehouseFk);
|
||||||
|
const hasStowaway = ticket.ship() ? true : false;
|
||||||
if (warehouse && warehouse.hasStowaway)
|
if (warehouse && warehouse.hasStowaway && !hasStowaway)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethod('deleteStowaway', {
|
||||||
|
description: 'Deletes an stowaway',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The ticket id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/deleteStowaway`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.deleteStowaway = async id => {
|
||||||
|
const ticket = await Self.findById(id, {
|
||||||
|
include: [{
|
||||||
|
relation: 'ship'
|
||||||
|
}, {
|
||||||
|
relation: 'stowaway'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
let params;
|
||||||
|
if (ticket.stowaway())
|
||||||
|
params = [ticket.stowaway().shipFk, ticket.stowaway().id];
|
||||||
|
else if (ticket.ship())
|
||||||
|
params = [ticket.ship().shipFk, ticket.ship().id];
|
||||||
|
|
||||||
|
return Self.rawSql(`CALL vn.stowaway_unboarding(?, ?)`, params);
|
||||||
|
};
|
||||||
|
};
|
|
@ -26,17 +26,22 @@ module.exports = Self => {
|
||||||
let address = await models.Address.findOne({
|
let address = await models.Address.findOne({
|
||||||
where: {id: params.addressFk},
|
where: {id: params.addressFk},
|
||||||
fields: ['id', 'clientFk'],
|
fields: ['id', 'clientFk'],
|
||||||
include: [
|
include: {
|
||||||
{relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
include: {
|
include: {
|
||||||
relation: 'type'
|
relation: 'type'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// FIXME: #1953 Params should be declared with it's correct argument type
|
||||||
|
if (params.shipped)
|
||||||
|
params.shipped = new Date(params.shipped);
|
||||||
|
if (params.landed)
|
||||||
|
params.landed = new Date(params.landed);
|
||||||
|
|
||||||
if (!address)
|
if (!address)
|
||||||
throw new UserError(`This address doesn't exist`);
|
throw new UserError(`This address doesn't exist`);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
fdescribe('ticket deleteStowaway()', () => {
|
||||||
|
const shipId = 16;
|
||||||
|
const stowawayId = 17;
|
||||||
|
|
||||||
|
it('should create an stowaway', async() => {
|
||||||
|
await app.models.Stowaway.rawSql(`
|
||||||
|
INSERT INTO stowaway (id, shipFk) VALUES (?, ?)
|
||||||
|
`, [stowawayId, shipId]);
|
||||||
|
|
||||||
|
const stowawayExists = await app.models.Stowaway.count({id: stowawayId, shipFk: shipId});
|
||||||
|
|
||||||
|
expect(stowawayExists).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete the stowaway from the ship ticket', async() => {
|
||||||
|
await app.models.Ticket.deleteStowaway(shipId);
|
||||||
|
|
||||||
|
const stowawayExists = await app.models.Stowaway.count({id: stowawayId, shipFk: shipId});
|
||||||
|
|
||||||
|
expect(stowawayExists).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create again an stowaway', async() => {
|
||||||
|
await app.models.Stowaway.rawSql(`
|
||||||
|
INSERT INTO stowaway (id, shipFk) VALUES (?, ?)
|
||||||
|
`, [stowawayId, shipId]);
|
||||||
|
|
||||||
|
const stowawayExists = await app.models.Stowaway.count({id: stowawayId, shipFk: shipId});
|
||||||
|
|
||||||
|
expect(stowawayExists).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete the stowaway from the stowaway ticket', async() => {
|
||||||
|
await app.models.Ticket.deleteStowaway(stowawayId);
|
||||||
|
|
||||||
|
const stowawayExists = await app.models.Stowaway.count({id: stowawayId, shipFk: shipId});
|
||||||
|
|
||||||
|
expect(stowawayExists).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
|
@ -27,6 +27,7 @@ module.exports = Self => {
|
||||||
require('../methods/ticket/transferSales')(Self);
|
require('../methods/ticket/transferSales')(Self);
|
||||||
require('../methods/ticket/canHaveStowaway')(Self);
|
require('../methods/ticket/canHaveStowaway')(Self);
|
||||||
require('../methods/ticket/recalculateComponents')(Self);
|
require('../methods/ticket/recalculateComponents')(Self);
|
||||||
|
require('../methods/ticket/deleteStowaway')(Self);
|
||||||
|
|
||||||
Self.observe('before save', async function(ctx) {
|
Self.observe('before save', async function(ctx) {
|
||||||
if (ctx.isNewInstance) return;
|
if (ctx.isNewInstance) return;
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"foreignKey": "clientFk"
|
"foreignKey": "clientFk"
|
||||||
},
|
},
|
||||||
"ship": {
|
"ship": {
|
||||||
"type": "hasMany",
|
"type": "hasOne",
|
||||||
"model": "Stowaway",
|
"model": "Stowaway",
|
||||||
"foreignKey": "shipFk"
|
"foreignKey": "shipFk"
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
class="modal-form"
|
class="modal-form"
|
||||||
on-open="model.refresh()">
|
on-open="model.refresh()">
|
||||||
<tpl-body>
|
<tpl-body>
|
||||||
<section class="header vn-pa-md">
|
<section class="add-stowaway header vn-pa-md">
|
||||||
<h5><span translate>Stowaways to add</span></h5>
|
<h5><span translate>Stowaways to add</span></h5>
|
||||||
</section>
|
</section>
|
||||||
<vn-horizontal class="vn-pa-md">
|
<vn-horizontal class="add-stowaway vn-pa-md">
|
||||||
<vn-data-viewer model="model">
|
<vn-data-viewer model="model">
|
||||||
<vn-table model="model" auto-load="false">
|
<vn-table model="model" auto-load="false">
|
||||||
<vn-thead>
|
<vn-thead>
|
||||||
|
|
|
@ -139,11 +139,12 @@
|
||||||
card-reload="$ctrl.cardReload()"
|
card-reload="$ctrl.cardReload()"
|
||||||
ticket="$ctrl.ticket">
|
ticket="$ctrl.ticket">
|
||||||
</vn-add-stowaway>
|
</vn-add-stowaway>
|
||||||
<vn-remove-stowaway
|
<vn-confirm
|
||||||
vn-id="removeStowaway"
|
vn-id="deleteStowaway"
|
||||||
card-reload="$ctrl.cardReload()"
|
on-accept="$ctrl.deleteStowaway()"
|
||||||
ticket="$ctrl.ticket">
|
question="Delete stowaway"
|
||||||
</vn-remove-stowaway>
|
message="Are you sure you want to delete this stowaway?">
|
||||||
|
</vn-confirm>
|
||||||
<vn-confirm
|
<vn-confirm
|
||||||
vn-id="confirm-dialog"
|
vn-id="confirm-dialog"
|
||||||
on-response="$ctrl.returnDialog($response)"
|
on-response="$ctrl.returnDialog($response)"
|
||||||
|
|
|
@ -19,9 +19,9 @@ class Controller extends Component {
|
||||||
show: () => this.canShowStowaway
|
show: () => this.canShowStowaway
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Remove stowaway',
|
name: 'Delete stowaway',
|
||||||
callback: this.showRemoveStowaway,
|
callback: this.showDeleteStowaway,
|
||||||
show: () => this.shouldShowRemoveStowaway()
|
show: () => this.shouldShowDeleteStowaway()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Make invoice',
|
name: 'Make invoice',
|
||||||
|
@ -43,6 +43,54 @@ class Controller extends Component {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get ticket() {
|
||||||
|
return this._ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
set ticket(value) {
|
||||||
|
this._ticket = value;
|
||||||
|
|
||||||
|
if (!value) return;
|
||||||
|
|
||||||
|
if (this.$params.sendSMS)
|
||||||
|
this.showSMSDialog();
|
||||||
|
|
||||||
|
this.canStowaway();
|
||||||
|
|
||||||
|
let links = {
|
||||||
|
btnOne: {
|
||||||
|
icon: 'person',
|
||||||
|
state: `client.card.summary({id: ${value.clientFk}})`,
|
||||||
|
tooltip: 'Client card'
|
||||||
|
}};
|
||||||
|
|
||||||
|
if (value.stowaway) {
|
||||||
|
links.btnTwo = {
|
||||||
|
icon: 'icon-stowaway',
|
||||||
|
state: `ticket.card.summary({id: ${value.stowaway.shipFk}})`,
|
||||||
|
tooltip: 'Ship stowaways'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.ship) {
|
||||||
|
links.btnThree = {
|
||||||
|
icon: 'icon-stowaway',
|
||||||
|
state: `ticket.card.summary({id: ${value.ship.id}})`,
|
||||||
|
tooltip: 'Stowaway'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
this._quicklinks = links;
|
||||||
|
}
|
||||||
|
|
||||||
|
get quicklinks() {
|
||||||
|
return this._quicklinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
set quicklinks(value = {}) {
|
||||||
|
this._quicklinks = Object.assign(value, this._quicklinks);
|
||||||
|
}
|
||||||
|
|
||||||
showChangeShipped() {
|
showChangeShipped() {
|
||||||
if (!this.isEditable) {
|
if (!this.isEditable) {
|
||||||
this.vnApp.showError(this.$translate.instant(`This ticket can't be modified`));
|
this.vnApp.showError(this.$translate.instant(`This ticket can't be modified`));
|
||||||
|
@ -72,24 +120,6 @@ class Controller extends Component {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
canStowaway() {
|
|
||||||
if (!this.isTicketModule()) return;
|
|
||||||
|
|
||||||
this.$http.get(`Tickets/${this.ticket.id}/canHaveStowaway`).then(response => {
|
|
||||||
if (response.data === true)
|
|
||||||
return this.canShowStowaway = true;
|
|
||||||
|
|
||||||
return this.canShowStowaway = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldShowRemoveStowaway() {
|
|
||||||
if (!this._ticket || !this.isTicketModule())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (this._ticket.stowaway || (this._ticket.ship && this._ticket.ship.length > 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
onMoreChange(callback) {
|
onMoreChange(callback) {
|
||||||
callback.call(this);
|
callback.call(this);
|
||||||
}
|
}
|
||||||
|
@ -149,61 +179,38 @@ class Controller extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canStowaway() {
|
||||||
|
if (!this.isTicketModule()) return;
|
||||||
|
|
||||||
|
this.$http.get(`Tickets/${this.ticket.id}/canHaveStowaway`).then(response => {
|
||||||
|
if (response.data === true)
|
||||||
|
return this.canShowStowaway = true;
|
||||||
|
|
||||||
|
return this.canShowStowaway = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldShowDeleteStowaway() {
|
||||||
|
if (!this._ticket || !this.isTicketModule())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return this._ticket.stowaway || this._ticket.ship;
|
||||||
|
}
|
||||||
|
|
||||||
showAddStowaway() {
|
showAddStowaway() {
|
||||||
this.$.addStowaway.show();
|
this.$.addStowaway.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
showRemoveStowaway() {
|
showDeleteStowaway() {
|
||||||
this.$.removeStowaway.show();
|
this.$.deleteStowaway.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
get ticket() {
|
deleteStowaway() {
|
||||||
return this._ticket;
|
const query = `Tickets/${this.ticket.id}/deleteStowaway`;
|
||||||
}
|
this.$http.post(query).then(res => {
|
||||||
|
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
||||||
set ticket(value) {
|
this.cardReload();
|
||||||
this._ticket = value;
|
});
|
||||||
|
|
||||||
if (!value) return;
|
|
||||||
|
|
||||||
if (this.$params.sendSMS)
|
|
||||||
this.showSMSDialog();
|
|
||||||
|
|
||||||
this.canStowaway();
|
|
||||||
|
|
||||||
let links = {
|
|
||||||
btnOne: {
|
|
||||||
icon: 'person',
|
|
||||||
state: `client.card.summary({id: ${value.clientFk}})`,
|
|
||||||
tooltip: 'Client card'
|
|
||||||
}};
|
|
||||||
|
|
||||||
if (value.stowaway) {
|
|
||||||
links.btnTwo = {
|
|
||||||
icon: 'icon-stowaway',
|
|
||||||
state: `ticket.card.summary({id: ${value.stowaway.shipFk}})`,
|
|
||||||
tooltip: 'Ship stowaways'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value.ship && value.ship.length == 1) {
|
|
||||||
links.btnThree = {
|
|
||||||
icon: 'icon-stowaway',
|
|
||||||
state: `ticket.card.summary({id: ${value.ship[0].id}})`,
|
|
||||||
tooltip: 'Stowaway'
|
|
||||||
};
|
|
||||||
} else if (value.ship && value.ship.length > 1)
|
|
||||||
this.shipStowaways = value.ship;
|
|
||||||
|
|
||||||
this._quicklinks = links;
|
|
||||||
}
|
|
||||||
|
|
||||||
set quicklinks(value = {}) {
|
|
||||||
this._quicklinks = Object.assign(value, this._quicklinks);
|
|
||||||
}
|
|
||||||
|
|
||||||
get quicklinks() {
|
|
||||||
return this._quicklinks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showDeliveryNote() {
|
showDeliveryNote() {
|
||||||
|
|
|
@ -174,11 +174,11 @@ describe('Ticket Component vnTicketDescriptor', () => {
|
||||||
|
|
||||||
describe('showRemoveStowaway()', () => {
|
describe('showRemoveStowaway()', () => {
|
||||||
it('should show a dialog for an stowaway removal', () => {
|
it('should show a dialog for an stowaway removal', () => {
|
||||||
controller.$.removeStowaway = {};
|
controller.$.deleteStowaway = {};
|
||||||
controller.$.removeStowaway.show = jasmine.createSpy('show');
|
controller.$.deleteStowaway.show = jasmine.createSpy('show');
|
||||||
controller.showRemoveStowaway();
|
controller.showDeleteStowaway();
|
||||||
|
|
||||||
expect(controller.$.removeStowaway.show).toHaveBeenCalledWith();
|
expect(controller.$.deleteStowaway.show).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ Ship stowaways: Polizones del barco
|
||||||
Stowaways to add: Polizones a añadir
|
Stowaways to add: Polizones a añadir
|
||||||
Stowaways of the ticket: Polizones del ticket
|
Stowaways of the ticket: Polizones del ticket
|
||||||
Add stowaway: Añadir polizón
|
Add stowaway: Añadir polizón
|
||||||
Remove stowaway: Borrar polizón
|
Delete stowaway: Eliminar polizón
|
||||||
Are you sure you want to delete this stowaway?: ¿Seguro que quieres borrar este polizón?
|
Are you sure you want to delete this stowaway?: ¿Seguro que quieres eliminar este polizón?
|
||||||
Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
|
||||||
Show Delivery Note: Ver albarán
|
Show Delivery Note: Ver albarán
|
||||||
Send Delivery Note: Enviar albarán
|
Send Delivery Note: Enviar albarán
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
<vn-dialog
|
|
||||||
class="modal-form"
|
|
||||||
vn-id="dialog">
|
|
||||||
<tpl-body>
|
|
||||||
<vn-horizontal class="header vn-pa-md">
|
|
||||||
<h5><span translate>Stowaways of the ticket</span> {{$ctrl.ticket.id}}</h5>
|
|
||||||
</vn-horizontal>
|
|
||||||
<vn-horizontal class="vn-pa-md">
|
|
||||||
<vn-table>
|
|
||||||
<vn-thead>
|
|
||||||
<vn-tr>
|
|
||||||
<vn-th number>Ticket id</vn-th>
|
|
||||||
<vn-th number>Shipped</vn-th>
|
|
||||||
<vn-th number>Agency</vn-th>
|
|
||||||
<vn-th number>Warehouse</vn-th>
|
|
||||||
<vn-th number>State</vn-th>
|
|
||||||
</vn-tr>
|
|
||||||
</vn-thead>
|
|
||||||
<vn-tbody>
|
|
||||||
<vn-tr ng-repeat="stowaway in $ctrl.ticketStowaways" class="clickable" ng-click="$ctrl.showDeleteConfirm($index)">
|
|
||||||
<vn-td number>{{stowaway.id}}</vn-td>
|
|
||||||
<vn-td number>{{stowaway.ticket.landed | date: 'dd/MM/yyyy'}}</vn-td>
|
|
||||||
<vn-td number>{{stowaway.ticket.agencyMode.name}}</vn-td>
|
|
||||||
<vn-td number>{{stowaway.ticket.warehouse.name}}</vn-td>
|
|
||||||
<vn-td number>{{stowaway.ticket.state.state.name}}</vn-td>
|
|
||||||
</vn-tr>
|
|
||||||
</vn-tbody>
|
|
||||||
</vn-table>
|
|
||||||
</vn-horizontal>
|
|
||||||
</tpl-body>
|
|
||||||
</vn-dialog>
|
|
||||||
|
|
||||||
<vn-confirm
|
|
||||||
vn-id="confirmation-dialog"
|
|
||||||
on-response="$ctrl.deleteStowaway($response)"
|
|
||||||
question="Delete stowaway"
|
|
||||||
message="Are you sure you want to delete this stowaway?">
|
|
||||||
</vn-confirm>
|
|
|
@ -1,78 +0,0 @@
|
||||||
import ngModule from '../module';
|
|
||||||
|
|
||||||
class Controller {
|
|
||||||
constructor($state, $scope, $http, vnApp, $translate) {
|
|
||||||
this.vnApp = vnApp;
|
|
||||||
this.$translate = $translate;
|
|
||||||
this.$scope = $scope;
|
|
||||||
this.$state = $state;
|
|
||||||
this.$http = $http;
|
|
||||||
}
|
|
||||||
|
|
||||||
getTicketStowaways() {
|
|
||||||
if (this.ticket.stowaway) {
|
|
||||||
this.ticketStowaways = [this.ticket.stowaway];
|
|
||||||
this.showDeleteConfirm(0);
|
|
||||||
} else if (this.ticket.ship.length > 1) {
|
|
||||||
let filter = {
|
|
||||||
where: {shipFk: this.ticket.id},
|
|
||||||
include: {
|
|
||||||
relation: 'ticket',
|
|
||||||
scope: {
|
|
||||||
include: [
|
|
||||||
{relation: 'agencyMode'},
|
|
||||||
{relation: 'warehouse'},
|
|
||||||
{relation: 'state',
|
|
||||||
scope: {
|
|
||||||
fields: ['stateFk'],
|
|
||||||
include: {
|
|
||||||
relation: 'state'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let json = encodeURIComponent(JSON.stringify(filter));
|
|
||||||
this.$http.get(`Stowaways?filter=${json}`).then(res => {
|
|
||||||
this.ticketStowaways = res.data;
|
|
||||||
this.$scope.dialog.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteStowaway(response) {
|
|
||||||
if (response === 'accept') {
|
|
||||||
this.$http.delete(`Stowaways/${this.stowawayToDelete.id}`).then(res => {
|
|
||||||
this.cardReload();
|
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
showDeleteConfirm(index) {
|
|
||||||
this.stowawayToDelete = this.ticketStowaways[index];
|
|
||||||
this.$scope.confirmationDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
|
||||||
this.getTicketStowaways();
|
|
||||||
}
|
|
||||||
|
|
||||||
hide() {
|
|
||||||
this.$scope.dialog.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate'];
|
|
||||||
|
|
||||||
ngModule.component('vnRemoveStowaway', {
|
|
||||||
template: require('./removeStowaway.html'),
|
|
||||||
controller: Controller,
|
|
||||||
bindings: {
|
|
||||||
ticket: '<',
|
|
||||||
cardReload: '&?'
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
@import "variables";
|
@import "variables";
|
||||||
|
|
||||||
vn-add-stowaway {
|
.add-stowaway {
|
||||||
vn-data-viewer {
|
vn-data-viewer {
|
||||||
width: 40em
|
width: 40em
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
title="{{'Download file' | translate}}"
|
title="{{'Download file' | translate}}"
|
||||||
href="dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
{{::document.dms.file}}
|
{{::document.dms.file}}
|
||||||
</a>
|
</a>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<a target="_blank"
|
<a target="_blank"
|
||||||
href="dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
href="api/dms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.accessToken}}">
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="cloud_download"
|
icon="cloud_download"
|
||||||
title="{{'Download file' | translate}}">
|
title="{{'Download file' | translate}}">
|
||||||
|
|
|
@ -6,7 +6,6 @@ import './search-panel';
|
||||||
import './card';
|
import './card';
|
||||||
import './descriptor';
|
import './descriptor';
|
||||||
import './descriptor/addStowaway';
|
import './descriptor/addStowaway';
|
||||||
import './descriptor/removeStowaway';
|
|
||||||
import './descriptor-popover';
|
import './descriptor-popover';
|
||||||
import './create/card';
|
import './create/card';
|
||||||
import './create/index';
|
import './create/index';
|
||||||
|
|
|
@ -14,8 +14,8 @@ Counter: Contador
|
||||||
Created : Añadido
|
Created : Añadido
|
||||||
Date : Fecha
|
Date : Fecha
|
||||||
Delay: Retraso
|
Delay: Retraso
|
||||||
Delete: Borrar
|
Delete: Eliminar
|
||||||
Delete expedition: Borrar expedición
|
Delete expedition: Eliminar expedición
|
||||||
Description: Descripción
|
Description: Descripción
|
||||||
Discount: Descuento
|
Discount: Descuento
|
||||||
Employee : Empleado
|
Employee : Empleado
|
||||||
|
@ -42,7 +42,7 @@ PPU: Ud.
|
||||||
Price: Precio
|
Price: Precio
|
||||||
Price gap: Diferencia de precio
|
Price gap: Diferencia de precio
|
||||||
Quantity: Cantidad
|
Quantity: Cantidad
|
||||||
Remove lines: Borrar lineas
|
Remove lines: Eliminar lineas
|
||||||
Route: Ruta
|
Route: Ruta
|
||||||
SET OK: PONER OK
|
SET OK: PONER OK
|
||||||
Shipment: Salida
|
Shipment: Salida
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
New price: Nuevo precio
|
New price: Nuevo precio
|
||||||
Add item: Añadir artículo
|
Add item: Añadir artículo
|
||||||
Add turn: Añadir a turno
|
Add turn: Añadir a turno
|
||||||
Delete ticket: Borrar ticket
|
Delete ticket: Eliminar ticket
|
||||||
Mark as reserved: Marcar como reservado
|
Mark as reserved: Marcar como reservado
|
||||||
Unmark as reserved: Desmarcar como reservado
|
Unmark as reserved: Desmarcar como reservado
|
||||||
Update discount: Actualizar descuento
|
Update discount: Actualizar descuento
|
||||||
|
@ -10,7 +10,7 @@ Edit discount: Editar descuento
|
||||||
Transfer to ticket: Transferir a ticket
|
Transfer to ticket: Transferir a ticket
|
||||||
New ticket: Nuevo ticket
|
New ticket: Nuevo ticket
|
||||||
Edit price: Editar precio
|
Edit price: Editar precio
|
||||||
You are going to delete lines of the ticket: Vas a borrar lineas del ticket
|
You are going to delete lines of the ticket: Vas a eliminar lineas del ticket
|
||||||
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
||||||
You have to allow pop-ups in your web browser to use this functionality:
|
You have to allow pop-ups in your web browser to use this functionality:
|
||||||
Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
|
Debes permitir los pop-pups en tu navegador para que esta herramienta funcione correctamente
|
||||||
|
@ -29,5 +29,5 @@ SMSAvailability: >-
|
||||||
{{notAvailables}} no disponible/s. Disculpe las molestias.
|
{{notAvailables}} no disponible/s. Disculpe las molestias.
|
||||||
Continue anyway?: ¿Continuar de todas formas?
|
Continue anyway?: ¿Continuar de todas formas?
|
||||||
This ticket is now empty: El ticket ha quedado vacio
|
This ticket is now empty: El ticket ha quedado vacio
|
||||||
Do you want to delete it?: ¿Quieres borrarlo?
|
Do you want to delete it?: ¿Quieres eliminarlo?
|
||||||
Recalculate price: Recalcular precio
|
Recalculate price: Recalcular precio
|
|
@ -5,7 +5,7 @@ Hours: Horas
|
||||||
Add time: Añadir hora
|
Add time: Añadir hora
|
||||||
Week total: Total semana
|
Week total: Total semana
|
||||||
Current week: Semana actual
|
Current week: Semana actual
|
||||||
This time entry will be deleted: Se borrará la hora fichada
|
This time entry will be deleted: Se eliminará la hora fichada
|
||||||
Are you sure you want to delete this entry?: ¿Seguro que quieres eliminarla?
|
Are you sure you want to delete this entry?: ¿Seguro que quieres eliminarla?
|
||||||
Finish at: Termina a las
|
Finish at: Termina a las
|
||||||
Entry removed: Fichada borrada
|
Entry removed: Fichada borrada
|
|
@ -13,8 +13,11 @@ const userLocale = {
|
||||||
methods: {
|
methods: {
|
||||||
getLocale(clientId) {
|
getLocale(clientId) {
|
||||||
return db.findOne(`
|
return db.findOne(`
|
||||||
SELECT lang FROM account.user
|
SELECT IF(u.lang IS NOT NULL, u.lang, LOWER(ct.code)) lang
|
||||||
WHERE id = ?`, [clientId]).then(rows => {
|
FROM client c
|
||||||
|
JOIN country ct ON ct.id = c.countryFk
|
||||||
|
JOIN account.user u ON u.id = c.id
|
||||||
|
WHERE c.id = ?`, [clientId]).then(rows => {
|
||||||
if (rows)
|
if (rows)
|
||||||
return rows.lang;
|
return rows.lang;
|
||||||
else return fallbackLocale;
|
else return fallbackLocale;
|
||||||
|
|
Loading…
Reference in New Issue