Merge branch 'dev' into 6495-procRefactor4
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
a439d07245
|
@ -3,7 +3,7 @@ html {
|
|||
margin: 10px;
|
||||
font-size: 22px;
|
||||
}
|
||||
.mainTable, .specialTable, .categoryTable {
|
||||
.mainTable, .specialTable, .categoryTable, .observationTable {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: inherit;
|
||||
|
@ -98,4 +98,19 @@ img {
|
|||
#merchandiseLabels td {
|
||||
padding-bottom: 11px;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.observationTable tr td {
|
||||
border: none;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#qrSection {
|
||||
text-align: center;
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
#truckPlateQr {
|
||||
width: 125px;
|
||||
margin-bottom: 10px;
|
||||
}
|
|
@ -30,8 +30,11 @@
|
|||
<span id="label">16. Transportista / Transporteur / Carrier</span>
|
||||
<hr>
|
||||
<b>{{data.carrierName}}</b><br>
|
||||
{{data.carrierStreet}}<br>
|
||||
{{data.carrierPostalCode}} {{data.carrierCity}} {{(data.carrierCountry) ? `(${data.carrierCountry})` : null}}
|
||||
{{data.carrierStreet}} {{data.carrierPostalCode}}
|
||||
{{data.carrierCity}} {{(data.carrierCountry)
|
||||
? `(${data.carrierCountry})`
|
||||
: null}}<br>
|
||||
<b>CIF:</b> {{data.carrierCif}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -71,8 +74,19 @@
|
|||
Carrier's reservations and observations
|
||||
</span>
|
||||
<hr>
|
||||
<b>{{data.truckPlate}}</b><br>
|
||||
{{data.observations}}
|
||||
<table class="observationTable">
|
||||
<tr>
|
||||
<td>
|
||||
{{data.observations}}
|
||||
</td>
|
||||
<td id="qrSection">
|
||||
<img id="truckPlateQr" v-bind:src="truckPlateQr"/>
|
||||
<br>
|
||||
<b>{{data.truckPlate}}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -2,44 +2,51 @@ const config = require(`vn-print/core/config`);
|
|||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const md5 = require('md5');
|
||||
const fs = require('fs-extra');
|
||||
const qrcode = require('qrcode');
|
||||
|
||||
const prefixBase64 = 'data:image/png;base64,';
|
||||
|
||||
module.exports = {
|
||||
name: 'cmr',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.data = await this.findOneFromDef('data', [this.id]);
|
||||
if (this.data.ticketFk) {
|
||||
this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]);
|
||||
this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]);
|
||||
} else
|
||||
this.merchandises = null;
|
||||
name: 'cmr',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.data = await this.findOneFromDef('data', [this.id]);
|
||||
if (this.data.ticketFk) {
|
||||
this.merchandises = await this.rawSqlFromDef('merchandise', [this.data.ticketFk]);
|
||||
this.signature = await this.findOneFromDef('signature', [this.data.ticketFk]);
|
||||
} else
|
||||
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: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
description: 'The cmr id'
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
signPath() {
|
||||
if (!this.signature) return;
|
||||
this.senderStamp = (this.data.senderStamp)
|
||||
? `${prefixBase64} ${this.data.senderStamp.toString('base64')}`
|
||||
: null;
|
||||
this.deliveryStamp = (this.data.deliveryStamp)
|
||||
? `${prefixBase64} ${this.data.deliveryStamp.toString('base64')}`
|
||||
: null;
|
||||
this.truckPlateQr = await this.getQR(this.data.truckPlate);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true,
|
||||
description: 'The cmr id'
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
signPath() {
|
||||
if (!this.signature) return;
|
||||
|
||||
const signatureName = this.signature.signature
|
||||
const hash = md5(signatureName.toString()).substring(0, 3);
|
||||
const file = `${config.storage.root}/${hash}/${signatureName}.png`;
|
||||
if (!fs.existsSync(file)) return null;
|
||||
const signatureName = this.signature.signature;
|
||||
const hash = md5(signatureName.toString()).substring(0, 3);
|
||||
const file = `${config.storage.root}/${hash}/${signatureName}.png`;
|
||||
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});
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ SELECT c.id cmrFk,
|
|||
c.merchandiseDetail,
|
||||
c.ead,
|
||||
s.name carrierName,
|
||||
s.nif carrierCif,
|
||||
s.street carrierStreet,
|
||||
s.postCode carrierPostCode,
|
||||
s.city carrierCity,
|
||||
|
|
Loading…
Reference in New Issue