Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2509-add_geolocation

This commit is contained in:
Carlos Jimenez Ruiz 2020-10-19 11:24:47 +02:00
commit dc7c541b1d
1 changed files with 8 additions and 4 deletions

View File

@ -3,6 +3,7 @@ const Component = require(`${appPath}/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
const md5 = require('md5'); const md5 = require('md5');
const fs = require('fs-extra');
module.exports = { module.exports = {
name: 'delivery-note', name: 'delivery-note',
@ -24,11 +25,14 @@ module.exports = {
}, },
computed: { computed: {
dmsPath() { dmsPath() {
const pathHash = md5(this.signature.id.toString()).substring(0, 3); if (!this.signature) return;
const hostPath = `file:///${config.storage.root}/${pathHash}`;
if (this.signature && this.signature.id) const hash = md5(this.signature.id.toString()).substring(0, 3);
return `${hostPath}/${this.signature.id}.png`; const file = `${config.storage.root}/${hash}/${this.signature.id}.png`;
const src = fs.readFileSync(file);
const base64 = Buffer.from(src, 'utf8').toString('base64');
return `data:image/png;base64, ${base64}`;
}, },
serviceTotal() { serviceTotal() {
let total = 0.00; let total = 0.00;