<!DOCTYPE html>
<html lang="en">
  
<head>
    <%- include('./partials/head'); -%>
    
</head>
<body onload="startTime()">
    <%- include('./partials/header_sidebar'); -%>
    
        <!-- Page Sidebar Ends-->
        <div class="page-body">
          <div class="container-fluid">
            <div class="page-title">
              <div class="row">
                <div class="col-sm-6">
                  <h3>Service Transaction Report</h3>
                </div>
                <div class="col-sm-6">
                  <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/index"><i data-feather="home"></i></a></li>
                    <li class="breadcrumb-item"><%=lan.dashboard%></li>
                    <li class="breadcrumb-item active">Service Transaction Report</li>
                  </ol>
                </div>
              </div>
            </div>
          </div>
          <!-- Container-fluid starts-->
          <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="table-responsive theme-scrollbar">
                                <table class="display" id="basic-1">
                                    <thead>
                                        <tr>
                                            <th>#</th>
                                            <th>Customer</th>
                                            <th>Phone</th>
                                            <th>Service</th>
                                            <th>Sub-Service</th>
                                            <th>Payment ID</th>
                                            <th>Amount</th>
                                            <th>Type</th>
                                            <th>Note</th>
                                            <th>Payment Status</th>
                                            <th>Date</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <% let i = 1 %>
                                        <% transaction_list.forEach((data) => { %>
                                            <tr>
                                                <td><%= i %></td>
                                                <td><%= data.customer_name || '—' %></td>
                                                <td><%= data.customer_phone || '—' %></td>
                                                <td><%= data.service_title || '—' %></td>
                                                <td><%= data.sub_service_title || '—' %></td>
                                                <td><%= data.payment_id || '—' %></td>
                                                <td class="invosymbol"><%= parseFloat(data.amount || 0).toFixed(2) %></td>
                                                <td><%= data.type || '—' %></td>
                                                <td><%= data.note || '—' %></td>
                                                <td>
                                                    <% if (data.payment_status == 1) { %>
                                                        <span class="badge badge-success">Success</span>
                                                    <% } else if (data.payment_status == 2) { %>
                                                        <span class="badge badge-danger">Failed</span>
                                                    <% } else { %>
                                                        <span class="badge badge-warning">Pending</span>
                                                    <% } %>
                                                </td>
                                                <td><%= data.createdAt ? new Date(data.createdAt).toLocaleString('en-IN') : (data.date || '—') %></td>
                                            </tr>
                                        <% i++ %>
                                        <% }) %>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
          </div>
          <!-- Container-fluid Ends-->
        </div>

    <%- include('./partials/footer'); -%>
    <%- include('./partials/script'); -%>
  </body>
</html>
