7152-devToTest_2414 #2228

Merged
alexm merged 636 commits from 7152-devToTest_2414 into test 2024-03-28 08:26:34 +00:00
13 changed files with 89 additions and 107 deletions
Showing only changes of commit 8365d9b843 - Show all commits

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

@ -1826,12 +1826,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
@ -1880,14 +1880,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,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

@ -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

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

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,