Fix materials table alphabetical sorting - materials now sort by name

Co-authored-by: naielv <109038805+naielv@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-07 09:13:46 +00:00
parent cf553295bb
commit d39f92554a

View File

@@ -719,6 +719,16 @@ function TS_IndexElement(
function render() {
function sorter(a, b) {
// If data has Nombre field (like materials), sort alphabetically by name
if (a.Nombre && b.Nombre) {
const nameA = a.Nombre.toLowerCase();
const nameB = b.Nombre.toLowerCase();
if (nameA < nameB) return -1;
if (nameA > nameB) return 1;
return 0;
}
// Otherwise, sort by Fecha (date) for other data types
if (a.Fecha < b.Fecha) {
return -1;
}