<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.w3.org/1999/xhtml"
      xmlns:uind="http://www.w3.org/1999/xhtml" xmlns:ctp="http://www.w3.org/1999/xhtml">
    <head th:replace="_fragments :: head('Inventory Accounts')"></head>
    <body>
        <div class="container-fluid">
            <header class="row page-header" th:replace="_fragments :: page-header"></header>
            <main class="row page-main">
                <!-- sidebar starts -->
                <aside class="col-sm-2" th:replace="_inventory-account-sidebar :: sidebar"></aside>
                <!-- sidebar ends -->
                <!--header starts-->
                <div class="col-sm">
                    <div th:replace="_notices :: page-notices"></div>
                    <div class="mb-4 d-flex justify-content-between">
                        <h3>Inventory Accounts</h3>
                        <a th:href="@{/inventory-accounts/new}" class="btn btn-primary">Add New</a>
                    </div>
                    <div th:replace="_fragments :: table-loading-skeleton"></div>
                    <table th:if="${#lists != null && #lists.size(accounts) !=  0 }" class="table table-striped table-bordered" data-table data-order="[[ 0, &quot;asc&quot; ]]">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>Title</th>
                                <th>Parent Type</th>
                                <th>Active</th>
                                <th>Created By</th>
                                <th>Created At</th>
                                <th>Location</th>
                                <th>Note</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr th:each="account : ${accounts}" th:object="${account}">
                                <td th:text="*{id}"></td>
                                <td th:text="*{title}"></td>
                                <td th:text="*{parentEntityType}"></td>
                                <td > <i th:text="*{ active.equals(true) ? 'Active' : 'In-Active' }" class="font-sm" th:classappend="*{ active } ? 'badge badge-APPROVED' : 'badge badge-danger'"></i></td>
                                <td th:text="*{createdBy}"></td>
                                <td ctp:formatdatetime="*{createdAt}"></td>
                                <td th:text="*{locationTitle}"></td>
                                <td class="font-italic" th:text="*{notes}"></td>
                                <td>
                                    <a th:href="@{'/inventory-accounts/edit/' + *{id}}" class="btn btn-sm btn-secondary"
                                       title="Edit">
                                        <i class="bi bi-pencil"></i>
                                    </a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <h4 th:if="${#lists.size(accounts) == 0}">No accounts found.</h4>
                </div>
            </main>
        </div>
        <div th:replace="_fragments :: page-footer-scripts"></div>
    </body>
</html>