@extends('layouts.master')
@section('content')
        <div class="az-content-breadcrumb">
            <span>Purchase Order</span>
        </div>
        <h2 class="az-content-title" style="display: inline">Purchase Order List<span>
                <a href="{{ route('po.create') }}" class="btn btn-az-primary" style="float: right">
                    <i class="fa-solid fa-plus"></i> Add Purchase
                    Order</a></span></h2>
        {{-- <h2 style="float: right" class="az-content-title"></h2> --}}
        {{-- <div class="az-content-body pd-lg-l-40 d-flex flex-column"> --}}
        <div class="row">
            <div class="col-md-12 col-lg-12 col-xl-12">
                <div class="card card-body pd-20">
                <div>
                    <table id="example2" class="table table-striped">
                        <thead>
                            <tr>
                                <th class="wd-10p">Order ID</th>
                                <th class="wd-10p">PO Number</th>
                                <th class="wd-10p">PO Dated</th>
                                <th class="wd-10p">PO for (Supplier)</th>
                                <th class="wd-10p">QTY</th>
                                <th class="wd-10p">Total</th>
                                <th class="wd-10p">Status</th>
                                <th class="wd-10p">Created By</th>
                                <th class="col-2">Operations</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{-- @foreach ($invoice as $key => $discount)
                            <tr>
                                <td>{{ $key + 1 }}</td>
                                <td>{{ $discount->products_category_name }}</td>
                                <td>{{ $discount->products_category_name_urdu }}</td>
                                <td>{{ $discount->products_category_status }}</td>
                                <td>{{ $discount->name }}</td>
                                <td><?= date('d-m-Y', strtotime($discount->created_at)) ?></td>

                                <td> <a class="btn btn-rounded btn-primary" href="{{ route('invoice.edit',\Crypt::encrypt($discount->id_products_category)) }}">
                                    Edit
                                </a>

                                 <a class="btn btn-rounded btn-danger" href="{{ route('invoice.destroy',\Crypt::encrypt($discount->id_products_category)) }}">
                                    Delete
                                </a>
                            </td>
                            </tr>

                        @endforeach --}}
                        </tbody>
                        <tfoot>
                            <tr>
                                <th class="wd-10p">Order ID</th>
                                <th class="wd-10p">PO Number</th>
                                <th class="wd-10p">PO Dated</th>
                                <th class="wd-10p">PO for (Supplier)</th>
                                <th class="wd-10p">QTY</th>
                                <th class="wd-10p">Total</th>
                                <th class="wd-10p">Status</th>
                                <th class="wd-10p">Created By</th>
                                <th class="col-2">Operations</th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
                </div>
                <!-- card -->
            </div>
            <!-- col -->
        </div>
    {{-- </div><!-- az-content-body --> --}}
@endsection
@push('scripts')
    {{-- <script type="text/javascript">
        $(function() {
            oTable = $('#example2').DataTable({
                responsive: !0
            });
        });
    </script> --}}
    <script type="text/javascript">
        $(function() {
            oTable = $('#example2').DataTable({
                dom: 'Bfrtip',
                buttons: [{
                        extend: 'csv',
                        text: 'CSV',
                        title: 'Purchase Order List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'excel',
                        text: 'Excel',
                        title: 'Purchase Order List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'pdf',
                        text: 'PDF',
                        title: 'Purchase Order List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    },
                    {
                        extend: 'print',
                        text: 'Print',
                        title: 'Purchase Order List',
                        className: 'btn btn-default',
                        exportOptions: {
                            columns: 'th:not(:last-child)'
                        }
                    }
                ],
                responsive: !0
            });
        });
    </script>
@endpush
