feat: galeria muestra foto impresa + estimacion por placa en detalle
- Galeria: cards muestran imagen de referencia si existe, fallback a thumbnail 3D - Detalle: nueva seccion 'Placas de impresion' con estimacion individual por parte - Endpoint /estimate ahora acepta file_id para calcular por archivo - Visualizacion de placa 220x220mm con proporcion de pieza y totales acumulados
This commit is contained in:
@@ -58,6 +58,13 @@ function renderGrid(models, append = false) {
|
||||
`<span class="px-1.5 py-0.5 rounded bg-cyan-500/10 text-cyan-400 text-[10px] font-medium">${t.name}</span>`
|
||||
).join('');
|
||||
|
||||
// Use reference image if available, fallback to 3D thumbnail
|
||||
const refImage = (m.files || []).find(f => f.file_type === 'image');
|
||||
const imgUrl = refImage
|
||||
? `/images/${encodeURIComponent(refImage.filename)}`
|
||||
: `/api/models/${m.id}/thumbnail`;
|
||||
const imgLabel = refImage ? 'Foto' : 'Vista 3D';
|
||||
|
||||
card.innerHTML = `
|
||||
<div class="relative h-52 bg-slate-900 overflow-hidden">
|
||||
${selectionMode ? `
|
||||
@@ -67,7 +74,7 @@ function renderGrid(models, append = false) {
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
<img src="/api/models/${m.id}/thumbnail" alt="${m.title}" loading="lazy" class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110" onerror="this.style.display='none'; this.parentElement.innerHTML='<div class=\'w-full h-full flex items-center justify-center text-slate-600\'><svg class=\'w-10 h-10\' fill=\'none\' stroke=\'currentColor\' viewBox=\'0 0 24 24\'><path stroke-linecap=\'round\' stroke-linejoin=\'round\' stroke-width=\'1.5\' d=\'M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4\'/></svg></div>';">
|
||||
<img src="${imgUrl}" alt="${m.title}" loading="lazy" class="w-full h-full object-cover transition-transform duration-500 group-hover:scale-110" onerror="this.onerror=null; this.src='/api/models/${m.id}/thumbnail';">
|
||||
<div class="absolute top-3 right-3">
|
||||
<span class="px-2.5 py-1 rounded-lg bg-black/50 backdrop-blur text-xs font-medium text-white border border-white/10">${m.faces ?? '?'} caras</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user