<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-3">
        <h2 class="mb-0">Ürün Yorumları</h2>
        <div class="d-flex gap-2 align-items-center">
            <form class="d-flex" action="/admin/content/product-comments" method="GET">
                <input type="search" name="product_id" class="form-control form-control-sm me-2"
                    placeholder="Ürün ID ile Ara..." value="{{ .ProductID }}">
                <button class="btn btn-sm btn-outline-secondary" type="submit"><i class="bi bi-search"></i></button>
            </form>
        </div>
    </div>

    <div class="card border-0 shadow-sm">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="bg-light">
                    <tr>
                        <th class="ps-3 border-0 text-muted small text-uppercase">ID</th>
                        <th class="border-0 text-muted small text-uppercase">Kullanıcı (User ID)</th>
                        <th class="border-0 text-muted small text-uppercase">Yorum (Body)</th>
                        <th class="border-0 text-muted small text-uppercase">Ürün ID</th>
                        <th class="border-0 text-muted small text-uppercase">Tarih</th>
                        <th class="border-0 text-muted small text-uppercase text-end pe-3">İşlemler</th>
                    </tr>
                </thead>
                <tbody>
                    {{ range .ProductComments }}
                    <tr>
                        <td class="ps-3"><span class="text-secondary fw-medium">#{{ .ID }}</span></td>
                        <td>
                            <div class="d-flex align-items-center">
                                <span class="badge bg-secondary">User #{{ .UserID }}</span>
                            </div>
                        </td>
                        <td>
                            <div class="text-dark">{{ .Body }}</div>
                        </td>
                        <td>
                            <span class="badge bg-primary">Product #{{ .ProductID }}</span>
                        </td>
                        <td class="text-secondary small">
                            {{ .CreatedAt.Format "02.01.2006 15:04" }}
                        </td>
                        <td class="text-end pe-3">
                            <form action="/admin/product-comments/{{ .ID }}/delete" method="POST" class="d-inline"
                                onsubmit="return confirm('Bu yorumu silmek istediğinize emin misiniz?');">
                                <button type="submit" class="btn btn-sm btn-outline-danger" title="Sil">
                                    <i class="bi bi-trash"></i>
                                </button>
                            </form>
                        </td>
                    </tr>
                    {{ else }}
                    <tr>
                        <td colspan="6" class="text-center py-5 text-muted">
                            <i class="bi bi-chat-dots fs-1 d-block mb-2"></i>
                            Henüz ürünlere yorum yapılmamış.
                        </td>
                    </tr>
                    {{ end }}
                </tbody>
            </table>
        </div>
    </div>
</div>