refs #4550 changed font-family of collection-label #1187

Merged
joan merged 4 commits from #4550-HOTFIX-collection-label-font into master 2022-11-30 10:35:37 +00:00
4 changed files with 34 additions and 22 deletions

View File

@ -1,5 +1,5 @@
html { html {
font-family: "Roboto"; font-family: Arial, Helvetica, sans-serif;
margin-top: -6px; margin-top: -6px;
} }
* { * {
@ -9,12 +9,14 @@ html {
} }
#vertical { #vertical {
writing-mode: vertical-rl; writing-mode: vertical-rl;
height: 240px; height: 235px;
font-size: 30px;
margin-left: -13px; margin-left: -13px;
} }
.outline { .outline {
border: 1px solid black; border: 1px solid black;
padding: 5px; padding: 5px;
height: 37px;
} }
#nickname { #nickname {
font-size: 22px; font-size: 22px;
@ -33,6 +35,6 @@ html {
#shipped { #shipped {
font-weight: bold; font-weight: bold;
} }
#ticketFk, #vertical { #ticketFk {
font-size: 34px; font-size: 32px;
} }

View File

@ -4,31 +4,29 @@
<table v-for="labelData in labelsData" style="break-before: page"> <table v-for="labelData in labelsData" style="break-before: page">
<tbody> <tbody>
<tr> <tr>
<td rowspan="6"><span id="vertical" class="ellipsize"> <td rowspan="6"><span id="vertical" class="ellipsize">{{getVertical(labelData)}}</span></td>
{{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(23)}}
</span></td>
<td id="ticketFk"> <td id="ticketFk">
Outdated
Review

Estos fragments amb condicionals o formateig de datos es millor posarlos en una propietat computed. En este cas, al ser dins de un bucle tindría que ser amb una funció en la que li pases les dades de la fila, exemple:

collectionDescription(labelData)

Estos fragments amb condicionals o formateig de datos es millor posarlos en una propietat computed. En este cas, al ser dins de un bucle tindría que ser amb una funció en la que li pases les dades de la fila, exemple: `collectionDescription(labelData)`
{{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}} {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}}
</td> </td>
<td colspan="2" id="shipped">{{labelData.shipped ? labelData.shipped : '---'}}</td> <td colspan="2" id="shipped">{{labelData.shipped || '---'}}</td>
</tr> </tr>
<tr> <tr>
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td> <td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
<td class="outline">{{labelData.workerCode ? labelData.workerCode : '---'}}</td> <td class="outline">{{labelData.workerCode || '---'}}</td>
</tr> </tr>
<tr> <tr>
<td class="outline">{{labelData.labelCount ? labelData.labelCount : 0}}</td> <td class="outline">{{labelData.labelCount || 0}}</td>
</tr> </tr>
<tr> <tr>
<td class="outline">{{labelData.code == 'plant' ? labelData.size + 'cm' : labelData.volume + 'm³'}}</td> <td class="outline">{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}</td>
</tr> </tr>
<tr> <tr>
<td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription}}</div></td> <td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}</div></td>
<td id="bold">{{labelData.lineCount ? labelData.lineCount : 0}}</td> <td id="bold">{{labelData.lineCount || 0}}</td>
</tr> </tr>
<tr> <tr>
<td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName : '---'}}</td> <td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}}</td>
<td id="bold">{{labelData.shipped ? labelData.shippedHour : labelData.zoneHour}}</td> <td id="bold">{{labelData.shippedHour || labelData.zoneHour}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -25,7 +25,6 @@ module.exports = {
ticketIds = [this.id]; ticketIds = [this.id];
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]); this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
if (!this.labelsData.length) if (!this.labelsData.length)
throw new UserError('Empty data source'); throw new UserError('Empty data source');
}, },
@ -44,6 +43,19 @@ module.exports = {
}); });
return xmlSerializer.serializeToString(svgNode); return xmlSerializer.serializeToString(svgNode);
}, },
getVertical(labelData) {
let value;
if (labelData.collectionFk) {
value = `${labelData.collectionFk} ~ `;
if (labelData.code == 'V')
value = value + `${labelData.wagon}-${labelData.level}`;
else
value = value + `${labelData.color.substring(0, 4)}`;
} else
value = '-'.repeat(19);
return value;
},
}, },
components: { components: {
'report-body': reportBody.build() 'report-body': reportBody.build()

View File

@ -1,13 +1,13 @@
SELECT tc.collectionFk, SELECT c.itemPackingTypeFk code,
tc.collectionFk,
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
tc.`level`, tc.`level`,
t.id ticketFk, t.id ticketFk,
COALESCE(et.description, zo.name, am.name) agencyDescription, COALESCE(et.description, zo.name, am.name) agencyDescription,
am.name, cc.code color,
t.clientFk, t.clientFk,
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
MAX(i.`size`) `size`, MAX(i.`size`) `size`,
ic.code,
w.code workerCode, w.code workerCode,
TIME_FORMAT(t.shipped, '%H:%i') shippedHour, TIME_FORMAT(t.shipped, '%H:%i') shippedHour,
TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour,
@ -16,8 +16,8 @@ SELECT tc.collectionFk,
tt.labelCount, tt.labelCount,
COUNT(*) lineCount COUNT(*) lineCount
FROM vn.ticket t FROM vn.ticket t
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
LEFT JOIN vn.collection c ON c.id = tc.collectionFk JOIN vn.collection c ON c.id = tc.collectionFk
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
AND cc.wagon = tc.wagon AND cc.wagon = tc.wagon
AND cc.trainFk = c.trainFk AND cc.trainFk = c.trainFk
@ -26,7 +26,7 @@ SELECT tc.collectionFk,
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN vn.itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN vn.worker w ON w.id = c.workerFk JOIN vn.worker w ON w.id = c.workerFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id