@extends('layouts.master')

@section('title') @lang('translation.Customers') @endsection

@section('css')
    <!-- DataTables -->
    <link href="{{ URL::asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
    <!-- <link href="https://cdn.datatables.net/searchpanes/2.1.0/css/searchPanes.bootstrap4.min.css" rel="stylesheet" type="text/css" />
    <link href="https://cdn.datatables.net/select/1.5.0/css/select.bootstrap4.min.css" rel="stylesheet" type="text/css" /> -->
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Ecommerce @endslot
        @slot('title') Customers @endslot
    @endcomponent

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="row mb-2">
                        <div class="col-sm-4">
                            <div class="search-box me-2 mb-2 d-inline-block">
                            </div>
                        </div>
                        <div class="col-sm-8">
                            <div class="text-sm-end">
                                <a href="{{ route('assets.create')}}" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2"><i class="mdi mdi-plus me-1"></i> New Products</a>
                            </div>
                        </div><!-- end col-->
                    </div>

                    <?php $i = 0 ?>
                    <div class="table-responsive">
                        <table id="datatable-buttons" class="table align-middle table-nowrap">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Asset Name</th>
                                    <th> Created At</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                            @if($assets)
                                @foreach ($assets as $asset)
                                    <tr>
                                        <td>{{ ++$i }}</td>
                                        <td>{{ $asset->name }}</td>
                                        <td>{{ $asset->created_at }}</td>
                                        <td>
                                            <div class="dropdown">
                                                <a href="#" class="dropdown-toggle card-drop" data-bs-toggle="dropdown"
                                                    aria-expanded="false">
                                                    <i class="mdi mdi-dots-horizontal font-size-18"></i>
                                                </a>
                                                <ul class="dropdown-menu dropdown-menu-end">
                                                    <li><a href="{{ route('assets.edit', ['asset' => $asset->id]) }}" class="dropdown-item"><i
                                                                class="mdi mdi-pencil font-size-16 text-success me-1"></i>
                                                            Edit</a></li>
                                                    <li><a href="{{ url('edit/'. $asset->id) }}" class="dropdown-item"><i
                                                                class="mdi mdi-trash-can font-size-16 text-danger me-1"></i>
                                                            Delete</a></li>
                                                    <li><a href="{{ route('assets.show', ['asset' => $asset->id]) }}" class="dropdown-item"><i
                                                                class="mdi mdi-eye font-size-16 text-danger me-1"></i>
                                                            View</a></li>
                                                            
                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
    <!-- end row -->
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ URL::asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ URL::asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ URL::asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->
    <script src="{{ URL::asset('/assets/js/pages/datatables.init.js') }}"></script>
    <!-- <script src="https://cdn.datatables.net/searchpanes/2.1.0/js/dataTables.searchPanes.min.js"></script>
    <script src="https://cdn.datatables.net/searchpanes/2.1.0/js/searchPanes.bootstrap4.min.js"></script>
    <script src="https://cdn.datatables.net/select/1.5.0/js/dataTables.select.min.js"></script> -->
    <script type="text/javascript">
        $(document).ready(function(){
            // var table = $('#datatable-assets').DataTable({
            //     searchPanes: true
            // });
            // table.searchPanes.container().prependTo(table.table().container());
            // table.searchPanes.resizePanes();
        });
    </script>
@endsection
