Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6276-createNewWarehouse
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-03-01 12:29:55 +01:00
commit 7d8d31022b
24 changed files with 135 additions and 148 deletions

1
Jenkinsfile vendored
View File

@ -71,6 +71,7 @@ pipeline {
stage('Back') { stage('Back') {
steps { steps {
sh 'pnpm install --prefer-offline' sh 'pnpm install --prefer-offline'
sh 'pnpx puppeteer browsers install chrome'
} }
} }
stage('Print') { stage('Print') {

View File

@ -1356,8 +1356,6 @@ INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','em
INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (386,'Route','driverRouteEmail','WRITE','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer'); INSERT INTO `ACL` VALUES (387,'Ticket','deliveryNotePdf','READ','ALLOW','ROLE','customer');
INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative'); INSERT INTO `ACL` VALUES (388,'Supplier','newSupplier','WRITE','ALLOW','ROLE','administrative');
INSERT INTO `ACL` VALUES (389,'ClaimRma','*','READ','ALLOW','ROLE','claimManager');
INSERT INTO `ACL` VALUES (390,'ClaimRma','*','WRITE','ALLOW','ROLE','claimManager');
INSERT INTO `ACL` VALUES (391,'Notification','*','WRITE','ALLOW','ROLE','system'); INSERT INTO `ACL` VALUES (391,'Notification','*','WRITE','ALLOW','ROLE','system');
INSERT INTO `ACL` VALUES (392,'Boxing','*','*','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (392,'Boxing','*','*','ALLOW','ROLE','employee');
INSERT INTO `ACL` VALUES (393,'Url','*','READ','ALLOW','ROLE','employee'); INSERT INTO `ACL` VALUES (393,'Url','*','READ','ALLOW','ROLE','employee');

View File

@ -564,13 +564,13 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`) INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
VALUES VALUES
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), (1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'), (69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), (442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'), (567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'), (791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'); (1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`) INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
VALUES VALUES
@ -1827,12 +1827,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`,
( 6, 'mana', 'Mana', 72, 4, 0), ( 6, 'mana', 'Mana', 72, 4, 0),
( 7, 'lack', 'Faltas', 72, 2, 0); ( 7, 'lack', 'Faltas', 72, 2, 0);
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`, `ticketFk`) INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `ticketFk`)
VALUES VALUES
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183', 11), (1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, 11),
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL, 16), (2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, 16),
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL, 7), (3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, 7),
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL, 8); (4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, 8);
INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`) INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`)
VALUES VALUES
@ -1881,14 +1881,6 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa
(1103, 2000, 0.00, 0.00, 0.02, 1.00), (1103, 2000, 0.00, 0.00, 0.02, 1.00),
(1104, 2500, 150.00, 0.02, 0.10, 1.00); (1104, 2500, 150.00, 0.02, 0.10, 1.00);
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
VALUES
(1, '02676A049183', DEFAULT, 1106),
(2, '02676A049183', DEFAULT, 1106),
(3, '02676A049183', DEFAULT, 1107),
(4, '02676A049183', DEFAULT, 1107),
(5, '01837B023653', DEFAULT, 1106);
INSERT INTO `vn`.`claimLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`) INSERT INTO `vn`.`claimLog` (`originFk`, userFk, `action`, changedModel, oldInstance, newInstance, changedModelId, `description`)
VALUES VALUES
(1, 18, 'update', 'Claim', '{"hasToPickUp":false}', '{"hasToPickUp":true}', 1, NULL), (1, 18, 'update', 'Claim', '{"hasToPickUp":false}', '{"hasToPickUp":true}', 1, NULL),

View File

@ -0,0 +1,4 @@
-- Place your SQL code here
RENAME TABLE IF EXISTS vn.claimRma TO vn.claimRma__;
ALTER TABLE IF EXISTS vn.claimRma__ COMMENT='kkeada el 2024-02-26 por Pablo';
ALTER TABLE vn.claim CHANGE IF EXISTS rma rma__ varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL;

View File

@ -1,4 +1,4 @@
Are you sure exit without saving?: ¿Seguro que quieres salir sin guardar? Are you sure exit without saving?: ¿Seguro que quieres salir sin guardar?
Unsaved changes will be lost: Los cambios que no hayas guardado se perderán Unsaved changes will be lost: Los cambios que no hayas guardado se perderán
No changes to save: No hay cambios que guardar No changes to save: No hay cambios que guardar
Some fields are invalid: Algunos campos no son válidos Some fields are invalid: Algunos campos no son válidos

View File

@ -1,6 +1,8 @@
// For a detailed explanation regarding each configuration property, visit: // For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html // https://jestjs.io/docs/en/configuration.html
/* eslint max-len: ["error", { "code": 150 }]*/ /* eslint max-len: ["error", { "code": 150 }]*/
const cpus = require('os').cpus().length;
const maxCpus = Math.floor(cpus * 0.45);
module.exports = { module.exports = {
name: 'front end', name: 'front end',
@ -12,6 +14,7 @@ module.exports = {
setupFilesAfterEnv: [ setupFilesAfterEnv: [
'./front/jest-setup.js' './front/jest-setup.js'
], ],
maxWorkers: maxCpus,
testMatch: [ testMatch: [
'**/front/**/*.spec.js', '**/front/**/*.spec.js',
'**/print/**/*.spec.js', '**/print/**/*.spec.js',

View File

@ -333,9 +333,11 @@
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}", "It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada", "This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada", "This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
"Incorrect pin": "Pin incorrecto", "Field are invalid": "El campo '{{tag}}' no es válido",
"Incorrect pin": "Pin incorrecto.",
"You already have the mailAlias": "Ya tienes este alias de correo", "You already have the mailAlias": "Ya tienes este alias de correo",
"The alias cant be modified": "Este alias de correo no puede ser modificado", "The alias cant be modified": "Este alias de correo no puede ser modificado",
"No tickets to invoice": "No hay tickets para facturar",
"this warehouse has not dms": "El Almacén no acepta documentos", "this warehouse has not dms": "El Almacén no acepta documentos",
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado", "This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
"Name should be uppercase": "El nombre debe ir en mayúscula", "Name should be uppercase": "El nombre debe ir en mayúscula",
@ -344,6 +346,5 @@
"You cannot update these fields": "No puedes actualizar estos campos", "You cannot update these fields": "No puedes actualizar estos campos",
"CountryFK cannot be empty": "El país no puede estar vacío", "CountryFK cannot be empty": "El país no puede estar vacío",
"Cmr file does not exist": "El archivo del cmr no existe", "Cmr file does not exist": "El archivo del cmr no existe",
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias", "You are not allowed to modify the alias": "No estás autorizado a modificar el alias"
"No tickets to invoice": "No hay tickets para facturar"
} }

View File

@ -43,8 +43,5 @@
}, },
"ClaimObservation": { "ClaimObservation": {
"dataSource": "vn" "dataSource": "vn"
}, }
"ClaimRma": {
"dataSource": "vn"
}
} }

View File

@ -1,9 +0,0 @@
const LoopBackContext = require('loopback-context');
module.exports = Self => {
Self.observe('before save', async function(ctx) {
const changes = ctx.data || ctx.instance;
const loopBackContext = LoopBackContext.getCurrentContext();
changes.workerFk = loopBackContext.active.accessToken.userId;
});
};

View File

@ -1,30 +0,0 @@
{
"name": "ClaimRma",
"base": "VnModel",
"options": {
"mysql": {
"table": "claimRma"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"description": "Identifier"
},
"code": {
"type": "string",
"required": true
},
"created": {
"type": "date"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}

View File

@ -45,9 +45,6 @@
}, },
"packages": { "packages": {
"type": "number" "type": "number"
},
"rma": {
"type": "string"
} }
}, },
"relations": { "relations": {
@ -56,12 +53,6 @@
"model": "ClaimState", "model": "ClaimState",
"foreignKey": "claimStateFk" "foreignKey": "claimStateFk"
}, },
"rmas": {
"type": "hasMany",
"model": "ClaimRma",
"foreignKey": "code",
"primaryKey": "rma"
},
"client": { "client": {
"type": "belongsTo", "type": "belongsTo",
"model": "Client", "model": "Client",

View File

@ -26,23 +26,23 @@ module.exports = Self => {
}, },
{ {
arg: 'street', arg: 'street',
type: 'string' type: 'any'
}, },
{ {
arg: 'postcode', arg: 'postcode',
type: 'string' type: 'any'
}, },
{ {
arg: 'city', arg: 'city',
type: 'string' type: 'any'
}, },
{ {
arg: 'countryFk', arg: 'countryFk',
type: 'number' type: 'any'
}, },
{ {
arg: 'provinceFk', arg: 'provinceFk',
type: 'number' type: 'any'
}, },
{ {
arg: 'sageTaxTypeFk', arg: 'sageTaxTypeFk',
@ -94,7 +94,7 @@ module.exports = Self => {
}, },
{ {
arg: 'despiteOfClient', arg: 'despiteOfClient',
type: 'number' type: 'any'
}, },
{ {
arg: 'hasIncoterms', arg: 'hasIncoterms',

View File

@ -26,7 +26,8 @@ describe('Supplier newSupplier()', () => {
const options = {transaction: tx}; const options = {transaction: tx};
ctx.args = { ctx.args = {
name: 'NEWSUPPLIER', name: 'NEWSUPPLIER',
nif: '12345678Z' nif: '12345678Z',
city: 'Gotham'
}; };
const result = await models.Supplier.newSupplier(ctx, options); const result = await models.Supplier.newSupplier(ctx, options);

View File

@ -19,7 +19,7 @@ module.exports = Self => {
type: 'any' type: 'any'
}, { }, {
arg: 'phone', arg: 'phone',
type: 'string' type: 'any'
}, { }, {
arg: 'sageTaxTypeFk', arg: 'sageTaxTypeFk',
type: 'any' type: 'any'
@ -46,10 +46,10 @@ module.exports = Self => {
type: 'any' type: 'any'
}, { }, {
arg: 'supplierActivityFk', arg: 'supplierActivityFk',
type: 'string' type: 'any'
}, { }, {
arg: 'healthRegister', arg: 'healthRegister',
type: 'string' type: 'any'
}, { }, {
arg: 'isVies', arg: 'isVies',
type: 'boolean' type: 'boolean'

View File

@ -129,10 +129,13 @@ describe('loopback model Supplier', () => {
const options = {transaction: tx}; const options = {transaction: tx};
try { try {
const newSupplier = await models.Supplier.create({name: 'ALFRED PENNYWORTH'}, options); const newSupplier = {
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options); name: 'ALFRED PENNYWORTH', nif: '87805752D', city: 'Gotham'
};
const supplierCreated = await models.Supplier.create(newSupplier, options);
const fetchedSupplier = await models.Supplier.findById(supplierCreated.id, null, options);
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id); expect(Number(fetchedSupplier.account)).toEqual(4100000000 + supplierCreated.id);
await tx.rollback(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); await tx.rollback();

View File

@ -17,17 +17,13 @@ module.exports = Self => {
message: 'The social name cannot be empty' message: 'The social name cannot be empty'
}); });
if (this.city) { Self.validatesPresenceOf('city', {
Self.validatesPresenceOf('city', { message: 'City cannot be empty'
message: 'City cannot be empty' });
});
}
if (this.nif) { Self.validatesPresenceOf('nif', {
Self.validatesPresenceOf('nif', { message: 'The nif cannot be empty'
message: 'The nif cannot be empty' });
});
}
Self.validatesUniquenessOf('nif', { Self.validatesUniquenessOf('nif', {
message: 'TIN must be unique' message: 'TIN must be unique'

View File

@ -19,6 +19,7 @@ module.exports = Self => {
FROM ticketTracking tt FROM ticketTracking tt
WHERE tt.userFk = ? WHERE tt.userFk = ?
GROUP BY ticketFk GROUP BY ticketFk
ORDER BY created DESC
LIMIT 5;`; LIMIT 5;`;
return await Self.rawSql(query, [userId]); return await Self.rawSql(query, [userId]);
}; };

View File

@ -179,7 +179,6 @@ localFixtures:
- claimLog - claimLog
- claimObservation - claimObservation
- claimRatio - claimRatio
- claimRma
- claimState - claimState
- client - client
- clientConfig - clientConfig

View File

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

View File

@ -3786,7 +3786,7 @@ packages:
resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==} resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==}
dependencies: dependencies:
base64-js: 1.5.1 base64-js: 1.5.1
ieee754: 1.1.13 ieee754: 1.2.1
isarray: 1.0.0 isarray: 1.0.0
dev: false dev: false
@ -7288,8 +7288,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/http-proxy-agent@7.0.0: /http-proxy-agent@7.0.2:
resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==} resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}
engines: {node: '>= 14'} engines: {node: '>= 14'}
dependencies: dependencies:
agent-base: 7.1.0 agent-base: 7.1.0
@ -7367,8 +7367,8 @@ packages:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
/https-proxy-agent@7.0.2: /https-proxy-agent@7.0.4:
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==} resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==}
engines: {node: '>= 14'} engines: {node: '>= 14'}
dependencies: dependencies:
agent-base: 7.1.0 agent-base: 7.1.0
@ -9780,6 +9780,7 @@ packages:
/mkdirp-classic@0.5.3: /mkdirp-classic@0.5.3:
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
requiresBuild: true
dev: false dev: false
/mkdirp@0.3.0: /mkdirp@0.3.0:
@ -10692,8 +10693,8 @@ packages:
agent-base: 7.1.0 agent-base: 7.1.0
debug: 4.3.4(supports-color@6.1.0) debug: 4.3.4(supports-color@6.1.0)
get-uri: 6.0.2 get-uri: 6.0.2
http-proxy-agent: 7.0.0 http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.2 https-proxy-agent: 7.0.4
pac-resolver: 7.0.0 pac-resolver: 7.0.0
socks-proxy-agent: 8.0.2 socks-proxy-agent: 8.0.2
transitivePeerDependencies: transitivePeerDependencies:
@ -11155,8 +11156,8 @@ packages:
dependencies: dependencies:
agent-base: 7.1.0 agent-base: 7.1.0
debug: 4.3.4(supports-color@6.1.0) debug: 4.3.4(supports-color@6.1.0)
http-proxy-agent: 7.0.0 http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.2 https-proxy-agent: 7.0.4
lru-cache: 7.18.3 lru-cache: 7.18.3
pac-proxy-agent: 7.0.1 pac-proxy-agent: 7.0.1
proxy-from-env: 1.1.0 proxy-from-env: 1.1.0
@ -11288,6 +11289,7 @@ packages:
/queue-tick@1.0.1: /queue-tick@1.0.1:
resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==} resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
requiresBuild: true
dev: false dev: false
/quick-lru@4.0.1: /quick-lru@4.0.1:

View File

@ -3,7 +3,7 @@ html {
margin: 10px; margin: 10px;
font-size: 22px; font-size: 22px;
} }
.mainTable, .specialTable, .categoryTable { .mainTable, .specialTable, .categoryTable, .observationTable {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
font-size: inherit; font-size: inherit;
@ -98,4 +98,19 @@ img {
#merchandiseLabels td { #merchandiseLabels td {
padding-bottom: 11px; padding-bottom: 11px;
max-width: 300px; max-width: 300px;
}
.observationTable tr td {
border: none;
padding: 5px;
}
#qrSection {
text-align: center;
width: 30%;
}
#truckPlateQr {
width: 125px;
margin-bottom: 10px;
} }

View File

@ -30,8 +30,11 @@
<span id="label">16. Transportista / Transporteur / Carrier</span> <span id="label">16. Transportista / Transporteur / Carrier</span>
<hr> <hr>
<b>{{data.carrierName}}</b><br> <b>{{data.carrierName}}</b><br>
{{data.carrierStreet}}<br> {{data.carrierStreet}} {{data.carrierPostalCode}}
{{data.carrierPostalCode}} {{data.carrierCity}} {{(data.carrierCountry) ? `(${data.carrierCountry})` : null}} {{data.carrierCity}} {{(data.carrierCountry)
? `(${data.carrierCountry})`
: null}}<br>
<b>CIF:</b> {{data.carrierCif}}
</td> </td>
</tr> </tr>
<tr> <tr>
@ -71,8 +74,19 @@
Carrier's reservations and observations Carrier's reservations and observations
</span> </span>
<hr> <hr>
<b>{{data.truckPlate}}</b><br> <table class="observationTable">
{{data.observations}} <tr>
<td>
{{data.observations}}
</td>
<td id="qrSection">
<img id="truckPlateQr" v-bind:src="truckPlateQr"/>
<br>
<b>{{data.truckPlate}}</b>
</td>
</tr>
</table>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -2,44 +2,51 @@ const config = require(`vn-print/core/config`);
const vnReport = require('../../../core/mixins/vn-report.js'); const vnReport = require('../../../core/mixins/vn-report.js');
const md5 = require('md5'); const md5 = require('md5');
const fs = require('fs-extra'); const fs = require('fs-extra');
const qrcode = require('qrcode');
const prefixBase64 = 'data:image/png;base64,'; const prefixBase64 = 'data:image/png;base64,';
module.exports = { module.exports = {
name: 'cmr', name: 'cmr',
mixins: [vnReport], mixins: [vnReport],
async serverPrefetch() { async serverPrefetch() {
this.data = await this.findOneFromDef('data', [this.id]); this.data = await this.findOneFromDef('data', [this.id]);
if (this.data.ticketFk) { if (this.data.ticketFk) {
this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]); this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]);
this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]); this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]);
} else } else
this.merchandises = null; this.merchandises = null;
this.senderStamp = (this.data.senderStamp) this.senderStamp = (this.data.senderStamp)
? `${prefixBase64} ${this.data.senderStamp.toString('base64')}` ? `${prefixBase64} ${this.data.senderStamp.toString('base64')}`
: null; : null;
this.deliveryStamp = (this.data.deliveryStamp) this.deliveryStamp = (this.data.deliveryStamp)
? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}` ? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}`
: null; : null;
}, this.truckPlateQr = await this.getQR(this.data.truckPlate);
props: { },
id: { props: {
type: Number, id: {
required: true, type: Number,
description: 'The cmr id' required: true,
}, description: 'The cmr id'
}, },
computed: { },
signPath() { computed: {
if (!this.signature) return; signPath() {
if (!this.signature) return;
const signatureName = this.signature.signature const signatureName = this.signature.signature;
const hash = md5(signatureName.toString()).substring(0, 3); const hash = md5(signatureName.toString()).substring(0, 3);
const file = `${config.storage.root}/${hash}/${signatureName}.png`; const file = `${config.storage.root}/${hash}/${signatureName}.png`;
if (!fs.existsSync(file)) return null; if (!fs.existsSync(file)) return null;
return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`;
}, },
} },
}; methods: {
getQR(id) {
return qrcode.toDataURL(String(id), {margin: 0});
},
}
};

View File

@ -10,6 +10,7 @@ SELECT c.id cmrFk,
c.merchandiseDetail, c.merchandiseDetail,
c.ead, c.ead,
s.name carrierName, s.name carrierName,
s.nif carrierCif,
s.street carrierStreet, s.street carrierStreet,
s.postCode carrierPostCode, s.postCode carrierPostCode,
s.city carrierCity, s.city carrierCity,