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

<main id="main">

    <section id="slideshows" class="slideshow">

        <div class="container" data-aos="fade-up">
            <div class="row">
                <div class="col-lg-8 col-md-6" data-aos="fade-up" data-aos-delay="100">

                    <div class="box text-left">
                        <div id="carouselExampleControls" class="carousel slide" data-interval="10000" data-ride="carousel">

                            {{-- ======================Means we are having sliders============= --}}
                            @if($sliders->count() != 0)
                            <ol class="carousel-indicators">
                                @foreach( $sliders as $photo )
                                <li data-target="#carouselExampleIndicators" data-slide-to="{{ $loop->index }}"
                                    class="{{ $loop->first ? 'active' : '' }}"></li>
                                @endforeach
                            </ol>
    
                            <div class="carousel-inner">
                                @foreach( $sliders as $photo )
                                <div class="carousel-item {{ $loop->first ? 'active' : '' }}">
                                    <img class="img-fluid animate__animated animate__fadeInTopRight animate__delay-0s"
                                        src="{{ url('/uploads/sliders/'.$photo->image_attachment) }}"
                                        alt="{{ $photo->title }}">
                                    <div class="carousel-caption d-none d-md-block">
                                        <h4 class="animate__animated animate__fadeInTopRight animate__delay-4s">{{ $photo->image_title }}</h4>
                                        <h5 class="animate__animated animate__fadeInBottomLeft animate__delay-3s">{{ $photo->description }}</h5>
                                    </div>
                            
                                </div>
                                @endforeach
                            </div>

                            @else

                            {{-- ======================== No picture has been set ============== --}}
                            <ol class="carousel-indicators">
                                <li data-target="#carouselExampleIndicators" data-slide-to="0" class="item active"></li>
                            </ol>
    
                            <div class="carousel-inner">
                                <div class="carousel-item active">
                                    <img class="img-fluid" src="{{asset('/images/slide1.jpg')}}" alt="slider1">
                                    <div class="carousel-caption d-none d-md-block">
                                        <h4 class="animate__animated animate__fadeInTopRight animate__delay-4s">Welcome to TPHA</h4>
                                        <h5 class="animate__animated animate__fadeInUp">Find out more about us by navigating to about us
                                            pages where you can get full explanation about who are we? what we do and others.
                                        </h5>
                                    </div>
                                </div>

                                <div class="carousel-item">
                                    <img class="img-fluid" src="{{asset('/images/slide2.jpg')}}" alt="slider2">
                                    <div class="carousel-caption d-none d-md-block">
                                        <h4 class="animate__animated animate__fadeInTopRight animate__delay-4s">Scientific Conference</h4>
                                        <h5 class="animate__animated animate__fadeInUp">Every Year the Organization conduct the Annual
                                            Scientific Meetings, find out more by reading to the News section.</h5>
                                    </div>
                                </div>
                            </div>

                            {{-- ===================================================--}}
                            @endif
                            <a class="carousel-control-prev" href="#carouselExampleControls" role="button"
                                data-slide="prev">
                                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                                <span class="sr-only">Previous</span>
                            </a>
                            <a class="carousel-control-next" href="#carouselExampleControls" role="button"
                                data-slide="next">
                                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                                <span class="sr-only">Next</span>
                            </a>
                            
                        </div>
    
                    </div>
                
                </div>
                <div class="col-lg-4 col-md-6 mt-2 mt-lg-0" data-aos="fade-up" data-aos-delay="200">
                    
                    <div class="box">
                        <h6 class="text-info"><i class="fas fa-fw fa-globe-africa fa-2x text-info"></i> &nbsp;&nbsp;News & Updates</h6>
                        <hr>

                        @if($news->count() != 0)
                        <ul>

                            <!-- temporary links -->
                                <li>
                                    <a href="{{url('online_services')}}">&nbsp;<img src="{{asset('images/new.gif')}}">&nbsp; TPHA Conference Online Registration</a>
                                </li>
                            <!---->

                            @foreach ($news as $new)
                                @if($new->status == "new")
                                <li>

                                    {{-- <a href="{{url('/uploads/events_files/'.$new->file_attachment)}}"
                                        target="_blank">&nbsp;<img src="{{asset('images/new.gif')}}">&nbsp;{{$new->event_title}} </a> --}}

                                    @if($new->file_attachment != "")
                                    <a href="{{url('/uploads/events_files/'.$new->file_attachment)}}"
                                        target="_blank">&nbsp;<img src="{{asset('images/new.gif')}}">&nbsp;{{$new->event_title}} </a>
                                    @else
                                    <a href="{{url('membership_record_update')}}"
                                        target="_blank">&nbsp;<img src="{{asset('images/new.gif')}}">&nbsp;{{$new->event_title}} </a>
                                    @endif

                                </li>
                                @else
                                <li>
                                    <a href="{{url('/uploads/events_files/'.$new->file_attachment)}}" target="_blank">&nbsp;&nbsp;<i class="fas fa-fw fa-file-alt text-info"></i> &nbsp;{{$new->event_title}}</a>
                                </li>
                                @endif
                            @endforeach

                        </ul>
                        @else

                        <p class="" style="font-size: 18px; text-align:justify;">Currently There are no any News or
                            Updates so far. We will update you once there is any new Update or information. </p>
                        @endif
                    </div>

                    <div class="box mt-3">
                        <h6 class="text-info"><i class="fas fa-fw fa-users fa-2x text-info"></i> &nbsp;&nbsp;Membership</h6>
                        <hr>

                        @if($home_members->count() != 0)
                        <marquee onmouseover="this.stop();" onmouseout="this.start();" scrolldelay="180"><p><a href="{{url('membership')}}">Read More about membership types ...</a></p></marquee>
                        @else
                        <marquee onmouseover="this.stop();" onmouseout="this.start();" scrolldelay="180"><p><a href="{{url('membership')}}">Read More about membership types ...</a></p></marquee>
                        @endif
                    </div>
                </div>
            </div>
        <hr>

        </div>

    </section>
    <section id="message" class="pricing" style="padding-top: 0px; margin-top: 0px;">
        <div class="container" data-aos="fade-up">

            <div class="row">

                <div class="col-lg-8 col-md-6" data-aos="fade-up" data-aos-delay="100">
                    <div class="box text-left">
                        <div class="row">

                            @if($messages->count() != 0)
                            @foreach ($messages as $row)
                            <div class="col-md-5 text-center">
                                <img src="{{url('/uploads/photos/'.$row->image_attachment)}}" class="img-fluid">
                                <p class="text-center mt-2 text-info"><b>{{$row->name}}</b></p>
                            </div>
                            <div class="col-md-7">
                                <p class="text-info">{{$row->message_title}}</p>
                                <hr>
                                <p style="font-size: 16px; text-align:justify;">{{$row->description}}</p>
                                <p><a href="{{url('about')}}">Read More..</a></p>
                            </div>
                            @endforeach
                            @else
                            <div class="col-md-5 text-center">
                                <img src="{{asset('images/logo.png')}}" class="img-fluid">
                                <p class="text-center mt-2">TPHA</p>
                            </div>
                            <div class="col-md-7">
                                <p class="text-info">Welcome Message</p>
                                <hr>
                                <p style="font-size: 18px; text-align:justify;">Welcome to Tanzania Public Health
                                    Association (TPHA) Website, Where You Can get information concerning Health Issues,
                                    Read about Recently
                                    Published Articles concerning Health Issues, Feel Free to subscribe to our
                                    Newsletter.</p>
                                <p><a href="{{url('about')}}">Read More..</a></p>
                            </div>
                            @endif

                        </div>
                    </div>
                </div>


                <div class="col-lg-4 col-md-6 mt-2 mt-lg-0" data-aos="fade-up" data-aos-delay="200">
                    <div class="box">
                        <h6 class="text-info"><img src="{{asset('/images/tpha_logo.png')}}" class="img-fluid" width="30px"> &nbsp;
                            &nbsp;TPHA PROJECTS</h6>
                        <hr>

                        @if($news->count() != 0)
                        <ul>

                            @foreach ($project_conducted as $new)

                            <li>
                                <a href="{{url('projects')}}" target="_blank">&nbsp;&nbsp;<i class="fas fa-fw fa-info-circle fa-2x text-info"></i>
                                    &nbsp;{{$new->project_title}}</a>
                            </li>

                            @endforeach
                            <p class="text-left ml-2"><i class="fas fa-fw fa-angle-double-right text-info"></i><a href="{{url('projects')}}">Read More..</a></p>

                        </ul>
                        @else

                        <p class="" style="font-size: 18px; text-align:justify;">Currently There are no any News or
                            Updates so far. We will update you once there is any new Update or information. </p>
                        @endif
                    </div>
                </div>

            </div>

        </div>
    </section>

    <!-- ======= Clients Section ======= -->
    <section id="clients" class="clients section-bg">
        <div class="container" data-aos="zoom-in">

            <div class="row">

                @foreach ($affiliates as $row)
                <div class="col-lg-2 col-md-4 col-6 d-flex align-items-center justify-content-center">
                    <img src="{{url('/uploads/affiliate/'.$row->image_attachment)}}" class="img-fluid" alt="">
                </div>
                @endforeach

            </div>

        </div>
    </section>

</main>

@endsection