<!DOCTYPE html>
<html>

@include('includes.head')


<body class="hold-transition skin-blue fixed sidebar-mini">
    <!-- Site wrapper -->
    <div class="wrapper">

        @include('includes.header')
        <!-- =============================================== -->

        <!-- Left side column. contains the sidebar -->
        @include('includes.side-nav')

        <!-- =============================================== -->

        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                    Banner
                    <small>Manage Banner</small>
                </h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li><a href="#">Banner</a></li>
                    <li class="active">Banner</li>
                </ol>
            </section>

            <!-- Main content -->
            <section class="content">
                @include('includes.messages')
                <!-- Default box -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">Banner Management</h3>
                        <div class="box-tools pull-right">
                            <a href="{{ route('banner.create') }}" class="btn btn-block btn-primary btn-flat"
                                data-toggle="tooltip" title="Create System User">
                                <i class="fa fa-plus"></i> Create Banner </a>

                        </div>

                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="box-body">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th>Sl No</th>
                                            <th> Title</th>
                                            <th> Sub Title</th>

                                            <th>Image</th>

                                            <th style="width: 200px">Action</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        @foreach ($records as $record)
                                            <tr>
                                                <td>{{ $loop->iteration }}</td>
                                                <td>{{ $record->title ??"" }}</td>
                                                <td>{{ $record->sub_title ??"" }}</td>



                                                <td>

                                                    @if ($record->img)
                                                        <img src="{{ $record->img }}"
                                                            style="width: 200px;  border:2px solid #101010"
                                                            alt="">
                                                    @else
                                                        No Image
                                                    @endif
                                                </td>
                                                <td>
                                                    <!-- Add your action buttons or links here -->
                                                    {{-- Example: --}}
                                                    <a href="{{ route('banner.edit', $record->id) }}"
                                                        class="btn btn-primary btn-sm">Edit</a>
                                                    <a href="#" class="btn btn-danger btn-sm"
                                                        onclick="confirmDelete('{{ route('banner.delete', $record->id) }}')">Delete</a>

                                                    <script>
                                                        function confirmDelete(url) {
                                                            if (confirm('Are you sure you want to delete this?')) {
                                                                window.location.href = url;
                                                            }
                                                        }
                                                    </script>
                                                </td>
                                            </tr>
                                        @endforeach

                                    </tbody>
                                </table>

                            </div>
                            <!-- /.box-body -->

                        </div>

                    </div>

                </div>
                <!-- /.box -->

            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->

        @include('includes.footer')

    </div>
    <!-- ./wrapper -->

    @include('includes.scripts')
</body>

</html>
