{{ include('common/header.twig') }}
<!-- Invoice List Page start -->
<div class="page-title">
    <div class="row align-items-center">
        <div class="col-sm-4">
            <h2 class="page-title-text d-inline-block">{{ page_title }}</h2>
            <div class="breadcrumbs d-inline-block">
                <ul>
                    <li><a href="{{ common.info.url }}">Dashboard</a></li>
                    <li>{{ page_title }}</li>
                </ul>
            </div>
        </div>
        <div class="col-sm-8 text-right">
            <div class="btn btn-white btn-sm text-left mr-2">
                <i class="las la-filter text-danger pr-2"></i>
                <input type="text" class="table-date-range" data-start="{{ period.start|date(common.info.date_format) }}" data-end="{{ period.end|date(common.info.date_format) }}" data-route="invoices">
            </div>
            <div class="dropdown d-inline-block mr-2">
                <a class="btn btn-white btn-sm dropdown-toggle" data-toggle="dropdown"><i class="las la-cloud-download-alt text-primary pr-2"></i> Export</a>
                <ul class="dropdown-menu dropdown-menu-right export-button">
                    <li><a href="#" class="pdf"><i class="las la-file-pdf pr-2"></i>PDF</a></li>
                    <li><a href="#" class="excel"><i class="las la-file-excel pr-2"></i>Excel</a></li>
                    <li><a href="#" class="csv"><i class="las la-file-csv pr-2"></i>CSV</a></li>
                    <li><a href="#" class="print"><i class="las la-print pr-2"></i>Print</a></li>
                    <li><a href="#" class="copy"><i class="las la-copy pr-2"></i>Copy</a></li>
                </ul>
            </div>
            {% if page_add %}
                <a href="{{ common.info.url_route }}invoice/add" class="btn btn-primary btn-sm"><i class="las la-plus pr-2"></i> New Invoice</a>
            {% endif %}
        </div>
    </div>
</div>
<div class="panel panel-default">
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-middle table-bordered table-striped datatable-count-table">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Customer</th>
                        <th>Amount</th>
                        <th>Due</th>
                        <th>Status</th>
                        <th>Invoice Date</th>
                        <th>Created Date</th>
                        {% if page_view or page_edit or page_delete or page_pdf %}
                            <th></th>
                        {% endif %}
                    </tr>
                </thead>
                <tbody>
                    {% for value in result %}
                        <tr>
                            <td>{{ common.info.invoice_prefix~"%05d"|format(value.id) }}</td>
                            <td>
                                <p class="m-0 text-primary">{{ value.name }}</p>
                                <p class="m-0">{{ value.email }}</p>
                                <p class="m-0">{{ value.mobile }}</p>
                            </td>
                            <td>{{ common.info.currency_abbr~value.amount }}</td>
                            <td>{{ common.info.currency_abbr~value.due }}</td>
                            <td>
                                {% if value.inv_status == '0' %}
                                    <span class="label label-warning">Draft</span>
                                {% else %}
                                    {% if value.status == 'Paid' %}
                                        <span class="label label-success">Paid</span>
                                    {% elseif value.status == 'Unpaid' %}
                                        <span class="label label-danger">Unpaid</span>
                                    {% elseif value.status == 'Pending' %}
                                        <span class="label label-secondary">Pending</span>
                                    {% elseif value.status == 'In Process' %}
                                        <span class="label label-primary">In Process</span>
                                    {% elseif value.status == 'Cancelled' %}
                                        <span class="label label-warning">Cancelled</span>
                                    {% elseif value.status == 'Other' %}
                                        <span class="label label-default">Other</span>
                                    {% elseif value.status == 'Partially Paid' %}
                                        <span class="label label-info badge-pill badge-sm">Partially Paid</span>
                                    {% else %}
                                        <span class="label label-white">Unknown</span>
                                    {% endif %}
                                {% endif %}
                        </td>
                        <td>{{ value.invoicedate|date(common.info.date_format) }}</td>
                        <td>{{ value.date_of_joining|date(common.info.date_format) }}</td>
                        {% if page_view or page_edit or page_delete or page_pdf %}
                            <td class="table-action">
                                {% if page_view or page_edit or page_pdf %}
                                    <div class="dropdown d-inline-block">
                                        <a class="text-primary edit dropdown-toggle" data-toggle="dropdown"><i class="las la-ellipsis-h"></i></a>
                                        <ul class="dropdown-menu dropdown-menu-right export-button">
                                            {% if page_view %}
                                                <li><a href="{{ common.info.url_route~'invoice/view&id='~value.id }}"><i class="las la-laptop pr-2"></i>View</a></li>
                                            {% endif %}
                                            {% if page_edit %}
                                                <li><a href="{{ common.info.url_route~'invoice/edit&id='~value.id }}"><i class="las la-edit pr-2"></i>Edit</a></li>
                                            {% endif %}
                                            {% if page_pdf %}
                                                <li><a href="{{ common.info.url_route~'invoice/pdf&id='~value.id }}" target="_blank"><i class="las la-file-pdf pr-2"></i>PDF/Print</a></li>
                                            {% endif %}
                                        </ul>
                                    </div>
                                {% endif %}
                                {% if page_delete %}
                                    <a class="table-delete text-danger delete" data-toggle="tooltip" title="Delete">
                                        <i class="las la-trash-alt"></i><input type="hidden" value="{{ value.id }}">
                                    </a>
                                {% endif %}
                            </td>
                        {% endif %}
                    </tr>
                {% endfor %}
            </tbody>
            <tfoot>
                <tr>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                    {% if page_view or page_edit or page_delete or page_pdf %}
                        <th></th>
                    {% endif %}
                </tr>
            </tfoot>
        </table>
    </div>
</div>
</div>

{% if page_delete %}{{ include('common/delete_modal.twig') }}{% endif %}{{ include('common/footer.twig') }}