<% Object.entries(phones).forEach(([name, number])=> { %>
<%= name %>
<% }); %>
<% // determine columns and chunk rows const cols = (buttons && buttons.COLS) || ['']; const numCols = Math.max(1, cols.length); const rowsFlat = (buttons && buttons.ROWS) || []; const chunks = []; for (let i = 0; i < rowsFlat.length; i += numCols) { const slice = rowsFlat.slice(i, i + numCols); // pad short slice with empty objects so layout stays consistent while (slice.length < numCols) slice.push({}); chunks.push(slice); } %>
<% for (let c = 0; c < numCols; c++) { %>
<%= cols[c] || '' %>
<% } %>
<% chunks.forEach((row) => { %>
<% for (let c = 0; c < numCols; c++) { const cell = row[c] || {}; const isBlank = Object.keys(cell).length === 0; %>
<% if (isBlank) { %> <% } else { const ctx = cell.context || {}; %>
data-context="<%= ctx.context %>" <% } %> <% if (ctx.timeout) { %> data-timeout="<%= ctx.timeout %>" <% } %> <% if (ctx.cid) { %> data-cid="<%= ctx.cid %>" <% } %> <% if (ctx.dial) { %> data-dial="<%= ctx.dial %>" <% } %> > <% if (cell.faIcon) { %>
style="color: <%= cell.faColor %>" <% } %>>
<%= cell.text || '' %>
<% } else { %> <%= cell.text || '' %> <% } %>
<% } %>
<% } %>
<% }); %>