<!-- resources/views/your-page.blade.php -->
@extends('layouts.theme1')

@section('title', 'Dashboard')

@section('content')
    <!-- Contenu de votre page -->
    
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.11.5/datatables.min.css"/>

    <div class="row">
        <div class="col-12">
            <div class="card">
            <div class="border-bottom title-part-padding">
                <h4 class="card-title mb-0">Projects</h4>
            </div>
            <div class="card-body">
                <h6 class="card-subtitle mb-3">
                DataTables has most features enabled by default, so all you
                need to do to use it with your own tables is to call the
                construction function:<code> $().DataTable();</code>. You
                can refer full documentation from here
                <a href="https://datatables.net/">Datatables</a>
                </h6>
                <div class="table-responsive">
                    <table id="projects-table" class="display">
                        <thead>
                            <tr>
                                <th>ID</th>
                                <th>Libellé</th>
                                <th>Son Style</th>
                                <th>Offline</th>
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>
            </div>
            </div>
        </div>
    </div>


    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.11.5/datatables.min.js"></script>

    <script>
    $(document).ready(function() {
            $('#projects-table').DataTable({
                processing: true,
                serverSide: false, // Important: Set to false for client-side processing
                ajax: '{{ route('projects.index') }}',
                columns: [
                    { data: 'id' },
                    { data: 'libelle' },
                    { data: 'sonStyle' },
                    { data: 'isOffline' },
                ]
            });
        });
    </script>
@endsection
