more format for the table plus supress links when no database saved

This commit is contained in:
2024-07-01 08:54:19 +01:00
parent ae0e133918
commit 4997bbffa2
2 changed files with 28 additions and 9 deletions

View File

@@ -59,14 +59,29 @@
<td tal:condition="repeat.row.index == 24" tal:attributes="class python:'col-total'" tal:content="'TOTALS'">Totals</td>
<td tal:condition="repeat.row.index == 25" tal:attributes="class python:'col-percent'" tal:content="'PERCENT'">Percent</td>
<td tal:condition="repeat.row.index < 24" tal:content="string:${reporting_date}, ${repeat.row.index}">Hour</td>
<td tal:repeat="cell row" tal:attributes="class python: 'col-' + str(repeat.cell.index)">
<!-- Exclude the PERCENT column from generating links and apply the logic to rows 0 to 23 -->
<tal:condition tal:condition="repeat.row.index >= 0 and repeat.row.index < 24 and repeat.cell.index != 16">
<a tal:attributes="href string:./showSummaryLogs.php?hour=${repeat.row.index}" tal:content="cell">Cell</a>
</tal:condition>
<!-- For PERCENT column or other rows, just display the cell content -->
<tal:condition tal:condition="not (repeat.row.index >= 0 and repeat.row.index < 24 and repeat.cell.index != 16)" tal:content="cell">Cell</tal:condition>
</td>
<td tal:repeat="cell row" tal:attributes="class python: 'col-' + str(repeat.cell.index)">
<!-- Check if 'nolinks' is true. If not, generate links for rows 0 to 23 except 'PERCENT' column -->
<tal:case tal:condition="not: nolinks">
<tal:case tal:condition="repeat.row.index >= 0 and repeat.row.index < 24 and repeat.cell.index != 16">
<a tal:attributes="href string:./showSummaryLogs.php?hour=${repeat.row.index}">
<!-- Check if cell value is zero and print "-" -->
<tal:case tal:condition="cell != 0" tal:content="cell">Cell</tal:case>
<tal:case tal:condition="cell == 0" tal:content="'-'">-</tal:case>
</a>
</tal:case>
<!-- For 'PERCENT' column or other rows, just display the cell content -->
<tal:case tal:condition="not (repeat.row.index >= 0 and repeat.row.index < 24 and repeat.cell.index != 16)">
<!-- Check if cell value is zero and print "-" -->
<tal:case tal:condition="cell != 0" tal:content="cell">Cell</tal:case>
<tal:case tal:condition="cell == 0" tal:content="'-'">-</tal:case>
</tal:case>
</tal:case>
<tal:case tal:condition="nolinks">
<!-- Display cell content without link if 'nolinks' is true -->
<tal:case tal:condition="cell != 0" tal:content="cell">Cell</tal:case>
<tal:case tal:condition="cell == 0" tal:content="'-'">-</tal:case>
</tal:case>
</td>
</tr>
</tbody>
</table>