<!DOCTYPE html>
<html lang="en"
      th:replace="~{admin/dashboard/layout:: parent(~{::#content},~{::title},~{::script})}">
<head>
    <title >View Tags</title>
</head>
<body>
<!-- Page content-->
<section class="content" id="content">

        <div class="row">
            <div class="col-md-12">
                <div class="card card-primary">
                    <div class="card-header">
                        <h3 class="card-title">View Tag</h3>
                        <div class="card-tools">
                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                <i class="fas fa-minus"></i>
                            </button>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="card-header">
                            <div class="card-tools">
                                <div class="input-group input-group-sm" style="width: 150px;">
                                    <input type="text" name="table_search" class="form-control float-right" placeholder="Search">

                                    <div class="input-group-append">
                                        <button type="submit" class="btn btn-default">
                                            <i class="fas fa-search"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table class="table table-striped projects display" id="myTable">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th style="width:40%"> Name</th >
<!--                                <th style="width:30%">Description</th >-->
                                <th>Date</th>
                                <th class="text-center">Status</th>
                                <th class="text-center">Admin Status </th>
                                <th class="text-center">Action</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr  th:each="tag : ${tags}" >
                                <td th:text="${tag.tagId}"> </td>
                                <td th:text="${tag.name}"></td>
<!--                                <td th:text="${tag.desc}"></td>-->
                                <td th:text="${tag.createdAt}"></td>
                                <td>
                                     <span th:text="${tag.activeStatus == T(com.codenetworkz.blog.models.Status).YES ? 'Active' : 'Inactive'}"
                                          th:classappend="${tag.activeStatus == T(com.codenetworkz.blog.models.Status).YES ? 'badge badge-success' : 'badge badge-warning'}"></span>
                                </td>
                                <td class="project-state">
                                      <span th:text="${tag.adminStatus == T(com.codenetworkz.blog.models.Status).YES ? 'Accept' :
                                             (tag.adminStatus == T(com.codenetworkz.blog.models.Status).NO ? 'Denied' : 'Pending')}"
                                            th:class="${tag.adminStatus == T(com.codenetworkz.blog.models.Status).YES ? 'badge badge-success' :
                                             (tag.adminStatus == T(com.codenetworkz.blog.models.Status).NO ? 'badge badge-warning' :
                                            'badge badge-danger')}"> </span>
                                </td>
                                <td class="project-actions text-center">
                                    <a class="btn btn-primary btn-sm" th:href="@{'/admin/tags/view/'+${tag.slug}}"  title="View Tag">
                                        <i class="fas fa-folder">
                                        </i>
                                        View
                                    </a>
                                    <a class="btn btn-info btn-sm" th:href="@{'/admin/tags/update/'+${tag.slug}}"  title="Edit Tag">
                                        <i class="fas fa-pencil-alt">
                                        </i>
                                        Edit
                                    </a>
                                    <form th:action="@{'/admin/tags/change-status/' + ${tag.slug}}" method="post" style="display: inline;">
                                        <input type="hidden" name="slug" value="${tag.slug}" />
                                        <button type="submit" class="btn btn-primary btn-sm" title="Admin Approved">
                                            <i class="fas fa-user-shield"></i>
                                            Change Status
                                        </button>
                                    </form>
                                    <form th:action="@{'/admin/tags/admin-approve/' + ${tag.slug}}" method="post" style="display: inline;">
                                        <input type="hidden" name="slug" value="${tag.slug}" />
                                        <button type="submit" class="btn btn-primary btn-sm" title="Admin Approved">
                                            <i class="fas fa-user-shield"></i>
                                            Change Approved
                                        </button>
                                    </form>
                                    <form th:action="@{'/admin/tags/delete/' + ${tag.slug}}" method="post" style="display: inline;">
                                        <input type="hidden" name="slug" value="${tag.slug}" />
                                        <button type="submit" class="btn btn-danger btn-sm" title="delete">
                                            <i class="fas fa-trash" ></i>
                                            Delete
                                        </button>
                                    </form>
                                </td>
                            </tr>
                            <tr th:if="${tags.isEmpty()}">
                                <td colspan="7" class="text-center">No tags found.</td>
                            </tr>
                            </tbody>
                        </table>

                    </div>
                    <div class="card-footer clearfix"  th:if="${!#lists.isEmpty(tags)}">
                        <ul class="pagination pagination-sm m-0 float-right">
                            <li class="page-item">
                                <a class="page-link" th:if="${tags.hasPrevious()}" th:href="@{/admin/tags/list(page=${tags.number - 1}, size=${tags.size})}">«</a></li>
                            <li class="page-item" th:each="i : ${#numbers.sequence(0, tags.totalPages - 1)}">
                                <a class="page-link" th:href="@{/admin/tags/list(page=${i}, size=${tags.size})}" th:text="${i + 1}">1</a></li>
                            <li class="page-item">
                                <a class="page-link" th:if="${tags.hasNext()}" th:href="@{/admin/tags/list(page=${tags.number + 1}, size=${tags.size})}">»</a></li>
                        </ul>
                    </div>
                    <!-- /.card-body -->
                </div>
                <!-- /.card -->
            </div>
        </div>
</section>

</body>

</html>
