<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-sm-8">
            <table th:if="${#lists != null && #lists.size(poJobcardItems.keySet()) !=  0  }" class="table table-bordered font-sm mb-4"  data-order="[[ 0, &quot;desc&quot; ]]" data-dropdown-icon-summary >
                <thead>
                <tr>
                    <th>Sku</th>
                    <th>Color</th>
                    <th>Size</th>
                    <th>Expected Production</th>
                    <th>Total Cutting</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="poItems : ${poJobcardItems.values()}" th:object="${poItems}">
                    <td th:text="*{sku}"></td>
                    <td th:text="*{color}"></td>
                    <td th:text="*{size}"></td>
                    <td th:text="*{totalProduction}"></td>
                    <td th:text="*{totalCutting}"></td>
                </tr>
                </tbody>
            </table>
            <h5 th:if="${#lists.size(poJobcardItems.keySet()) == 0}" class="mt-2">No Items found.</h5>
        </div>
    </div>
</div>
<div th:replace="_fragments :: page-footer-scripts"></div>
<script th:inline="javascript">

    // Initialize DataTables for each individual table
    $('table[data-dropdown-icon-summary]').each(function () {
        const $table = $(this);

        // Prevent reinitializing if already done
        if (!$.fn.DataTable.isDataTable($table)) {
            $table.DataTable({
                paging: false,
                searching: false,
                lengthChange: false,
                info: false,
                dom: 't',
                buttons: [{
                    extend: 'excel',
                    text: '',
                    className: 'bi bi-file-earmark-spreadsheet btn-sm d-none'
                }]
            });
        }

    });

</script>

</body>
</html>