@extends('layouts.master')
@section('content')

    <section class="join-soty">
        <div class="container-fluid">
            <div class="tabs-containers">
                <div class="tabs">
                    @foreach($joinAsTypes as $key => $type)
                        <button class="tab-link {{ $key == 0 ? 'active' : '' }}" 
                            onclick="showTab('{{ $type->slug ?? 'tab-'.$type->id }}', event)">
                            {{ $type->name }}
                        </button>
                    @endforeach
                </div>
            
                <div class="content">
                    @foreach($joinAsTypes as $key => $type)
                        <div id="{{ $type->slug ?? 'tab-'.$type->id }}" 
                             class="tab-content" 
                             style="{{ $key == 0 ? 'display:block;' : 'display:none;' }}">
                            
                            <div class="tab-containers">
                                @forelse($type->details as $detail)
                                    <div class="card">
                                        <h3>{{ $detail->title }}</h3>
                                        <p>{!! $detail->description !!}</p>
                                    </div>
                                @empty
                                    <div class="card">
                                        <p>No content available.</p>
                                    </div>
                                @endforelse
                            </div>
            
                            <!--<a class="btn" href="{{ URL::to('/join/'.$type->slug) }}">-->
                            <!--    Join Soty-->
                            <!--</a>-->
                            <!--<a class="btn" href="{{ URL::to('/registration/') }}">-->
                            <!--    Join Soty-->
                            <!--</a>-->
                            <a class="btn" href="{{URL::to('/joinmentor')}}">Join Soty</a>
                            
                        </div>
                    @endforeach
                </div>
            </div>
        </div>
    </section>
    
    
    <script>
    
    function showTab(tabId, event) {
        document.querySelectorAll('.tab-content').forEach(c => c.style.display = 'none');
        document.querySelectorAll('.tab-link').forEach(b => b.classList.remove('active'));
        document.getElementById(tabId).style.display = 'block';
        event.currentTarget.classList.add('active');
    }
  </script>

@endsection

@section('footer')
    @include('layouts.footer')
@endsection