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 reportFooter = new Component('report-footer');
const md5 = require('md5');
const fs = require('fs-extra');
module.exports = {
name: 'delivery-note',
@ -24,11 +25,14 @@ module.exports = {
},
computed: {
dmsPath() {
const pathHash = md5(this.signature.id.toString()).substring(0, 3);
const hostPath = `file:///${config.storage.root}/${pathHash}`;
if (!this.signature) return;
if (this.signature && this.signature.id)
return `${hostPath}/${this.signature.id}.png`;
const hash = md5(this.signature.id.toString()).substring(0, 3);
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() {
let total = 0.00;