test → dev #1701

Merged
guillermo merged 10 commits from test into dev 2023-08-04 09:39:34 +00:00
4 changed files with 16 additions and 10 deletions
Showing only changes of commit 4a0b8f37cd - Show all commits

View File

@ -29,5 +29,5 @@ module.exports = Self => {
const routeMaxKm = 1000; const routeMaxKm = 1000;
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd) if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
err(); err();
} };
}; };

View File

@ -180,7 +180,7 @@
</span> </span>
<hr> <hr>
<div class="imgSection"> <div class="imgSection">
<img v-bind:src="getStamp"/> <img :src="senderStamp"/>
</div> </div>
</td> </td>
<td> <td>
@ -191,7 +191,7 @@
</span> </span>
<hr> <hr>
<div class="imgSection"> <div class="imgSection">
Aquí va la el stamp <img :src="deliveryStamp"/>
</div> </div>
</td> </td>
<td> <td>

View File

@ -3,6 +3,8 @@ 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 prefixBase64 = 'data:image/png;base64,';
module.exports = { module.exports = {
name: 'cmr', name: 'cmr',
mixins: [vnReport], mixins: [vnReport],
@ -13,6 +15,13 @@ module.exports = {
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)
? `${prefixBase64} ${this.data.senderStamp.toString('base64')}`
: null;
this.deliveryStamp = (this.data.deliveryStamp)
? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}`
: null;
}, },
props: { props: {
id: { id: {
@ -30,11 +39,7 @@ module.exports = {
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 `data:image/png;base64, ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`; return `${prefixBase64} ${Buffer.from(fs.readFileSync(file), 'utf8').toString('base64')}`;
}, },
async getStamp() { }
const data = this.data.stamp.toString('base64');
return `data:image/png;base64, ${data}`;
}
},
}; };

View File

@ -32,7 +32,8 @@ SELECT c.id cmrFk,
a2.postalCode loadPostalCode, a2.postalCode loadPostalCode,
a2.city loadCity, a2.city loadCity,
cou4.country loadCountry, cou4.country loadCountry,
co.stamp co.stamp senderStamp,
s.stamp deliveryStamp
FROM cmr c FROM cmr c
LEFT JOIN supplier s ON s.id = c.supplierFk LEFT JOIN supplier s ON s.id = c.supplierFk
LEFT JOIN country cou ON cou.id = s.countryFk LEFT JOIN country cou ON cou.id = s.countryFk