Last active
June 6, 2024 15:38
-
-
Save hermzz/c0fe7276388384790924ed9ee45a7b06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function htmlEmpretienda(valores) { | |
// Verificar si hay datos a partir de la descripción | |
if (!valores[0][0]) { | |
return 'El rango debe contener datos a partir de la descripción y exactamente 17 celdas.'; | |
} | |
// Verificar si hay exactamente 17 celdas | |
if (valores[0].length !== 17) { | |
return 'El rango debe contener exactamente 17 celdas.'; | |
} | |
///Función auxiliar para agregar línea HTML si el valor no es vacío o null | |
function agregarLinea(etiqueta, valor) { | |
return "<tr><td valign='top'><strong>" + etiqueta + ':</strong></td><td>' + valor + '</td></tr>'; | |
} | |
function agregarElementoLista(etiqueta, valor) { | |
if (!valor) { | |
return ''; | |
} | |
return '<li><strong>' + etiqueta + ':</strong> ' + valor + ' cm</li>'; | |
} | |
return [ | |
'<table>', | |
agregarLinea('Descripción', valores[0][0]), | |
agregarLinea('Composición', valores[0][1]), | |
agregarLinea('Talle',valores[0][3]), | |
// Agregar la sección de medidas | |
agregarLinea('Medidas', [ | |
'<ul>', | |
agregarElementoLista('Largo', valores[0][4]), | |
agregarElementoLista('Contorno de busto', valores[0][5]), | |
agregarElementoLista('Contorno de cintura', valores[0][6]), | |
agregarElementoLista('Contorno de cadera', valores[0][7]), | |
agregarElementoLista('Hombros', valores[0][8]), | |
agregarElementoLista('Mangas', valores[0][9]), | |
agregarElementoLista('Sisa', valores[0][10]), | |
agregarElementoLista('Largo de hombros a entrepierna', valores[0][11]), | |
agregarElementoLista('Largo de tira', valores[0][12]), | |
agregarElementoLista('Largo de cinturón', valores[0][13]), | |
agregarElementoLista('Alto', valores[0][14]), | |
agregarElementoLista('Ancho', valores[0][15]), | |
agregarElementoLista('Largo', valores[0][16]), | |
'</ul>' | |
].join('\n')), | |
'</table>', | |
'<p>*Cada artículo tiene uso previo. No realizamos cambios ni devoluciones.</p>' | |
].join('\n'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment