<!DOCTYPE html>
<html lang="en">
  
<head>
    <title><%= lang_data.pickups %> <%= lang_data.Report %></title>
    <%- include('./partials/meta'); -%>

</head>
<body>
    <%- include('./partials/header_sidebar'); -%> 

        <div class="page-body">
            <div class="container-fluid">
                <div class="page-title">
                    <div class="row">
                        <div class="col-sm-6">
                            <h3><%= lang_data.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"><a href="/report/pickup"><%= lang_data.pickups %> <%= lang_data.Report %></a></li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
            <!-- Container-fluid starts-->
            <div class="container-fluid">
                <div class="row">
                            
                    <!-- Scroll - vertical dynamic Starts-->
                    <div class="col-sm-12">
                        <div class="card">
                            <div class="card-header pb-0 d-flex justify-content-between">
                                <h4><%= lang_data.pickups %> <%= lang_data.Report %></h4>
                            </div>
                            <div class="card-body">
                                <div class="row mb-3">
                                    <div class="col-6">
                                      <div class="col-form-label"><%= lang_data.Start_Date %></div>
                                      <input class="form-control digits pickup" type="date" id="pickup_start_date">
                                    </div>
                                    
                                    <div class="col-6">
                                      <div class="col-form-label"><%= lang_data.End_Date %></div>
                                      <input class="form-control digits pickup" type="date" id="pickup_end_date">
                                    </div>
                                </div>
                                <div class="dt-ext table-responsive theme-scrollbar">
                                    <table class="display" id="export-button" aria-label="table">
                                        <thead>
                                            <tr>
                                                <th class="d-none"></th>
                                                <th>#</th>
                                                <th><%= lang_data.Tracking %></th>
                                                <th><%= lang_data.date %></th>
                                                <th><%= lang_data.Sender %></th>
                                                <th><%= lang_data.Recipient %></th>
                                                <th><%= lang_data.status %></th>
                                                <th><%= lang_data.Payment %></th>
                                            </tr>
                                        </thead>
                                        <tbody id="pickup_tbody">
                                            <% var no = 1 %>
                                            <% pickup_data.forEach((data) => { %>

                                                <tr>
                                                    <td class="d-none"></td>
                                                    <td><%= no %></td>
                                                    <td><%= data.invoice %></td>
                                                    <td><%= data.date.toLocaleDateString() %></td>
                                                    <td><%= data.customers_firstname %> <%= data.customers_lastname %></td>
                                                    <td><%= data.client_firstname %> <%= data.client_lastname %></td>
                                                    <td>
                                                        <% if (data.delivery_status == '8') { %>
                                                            <span class="badge badge-danger p-2">Cancelled</span>

                                                        <% } else if (data.delivery_status == '6') { %>
                                                            <span class="badge badge-success p-2">Delivered</span>

                                                        <% } else if (data.shipping_status == null) { %>
                                                            <span class="badge badge-secondary p-2">Accept pickup</span>

                                                        <% } else { %>
                                                            <span class="badge badge-primary p-2">Pick_up</span>

                                                        <% } %>
                                                    </td>
                                                    <td><%= data.payment_type_name %></td>
                                                </tr>
                                            <% no++ %>
                                            <% }) %>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Scroll - vertical dynamic Ends-->
                </div>
            </div>
        <!-- Container-fluid Ends-->
        </div>
        
        <%- include('./partials/footer'); -%>
        
    <%- include('./partials/script'); -%>

</body>

</html>