@extends('admin.layouts.app')



@section('content')
    @if (session('success'))
        <div id="successAlert" class="alert alert-success fixed-bottom text-white bg-success shadow-lg rounded p-3"
            style="width: 300px; bottom: 10px; right: 10px; position: fixed; z-index: 1050;">
            {{ session('success') }}
        </div>
    @endif

    @if (session('error'))
        <div id="errorAlert" class="alert alert-danger fixed-bottom text-white bg-danger shadow-lg rounded p-3"
            style="width: 300px; bottom: 10px; right: 10px; position: fixed; z-index: 1050;">
            {{ session('error') }}
        </div>
    @endif


    <div class="container">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header d-flex justify-content-between align-items-center bg-blue">
                        <h1 class="card-title" style="color:rgb(30, 255, 0);font-size:30px;">Contact section</h1>
                        {{-- <a href="{{ route('ourService.create') }}" class="btn btn-success  ml-auto">
                            <i class="fas fa-plus"></i> Add New
                        </a> --}}
                    </div>
                    <div class="card-body">
                        <div class="table-responsive">
                            <table class="table table-bordered table-striped">
                                <thead>
                                    <tr>
                                        <th>Sl</th>
                                        <th>banner_title</th>
                                        <th>banner_image</th>
                                        <th>from_title</th>
                                        <th>from_short_title</th>
                                        <th>iframe</th>
                                        <th>Actions</th>

                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($data as $index => $service)
                                        <tr>
                                            <td>{{ $index + 1 }}</td>
                                            <td>{{ $service->banner_title }}</td>
                                            <td><img src="{{ asset('img/' . $service->banner_image) }}" width="100"
                                                    alt="Image"></td>
                                            <td>{{ $service->from_title }}</td>
                                            <td>{{ $service->from_short_title }}</td>
                                            <td>{{ Str::limit($service->iframe, 50) }}</td>
                                            <td>
                                                <a href="{{ route('data.edit', $service->id) }}"
                                                    class="btn btn-warning">Edit</a>
                                                {{-- <form action="{{ route('data.destroy', $service->id) }}"
                                                    method="POST" class="d-inline">
                                                    @csrf
                                                    @method('DELETE')
                                                    <button type="submit" class="btn btn-danger">Delete</button>
                                                </form> --}}
                                            </td>
                                        </tr>
                                    @endforeach


                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

<script>
    setTimeout(function() {
        document.getElementById('successAlert')?.remove();
        document.getElementById('errorAlert')?.remove();
    }, 5000);
</script>
