<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <meta charset="UTF-8">
    @include('meta::manager')
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Tanzania Public Health Association</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta content="" name="description">
    <meta content="" name="keywords">
    
    {{-- Favicons --}}
    <link href="{{asset('/images/favicon.png')}}" rel="icon">
    <link href="{{asset('/images/favicon.png')}}" rel="apple-touch-icon">

     {{-- Google Fonts --}}
    {{-- <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Roboto:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet"> --}}

    {{-- Vendor CSS Files --}}

    <link href="{{asset('/css/front/bootstrap.min.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/form.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/icofont.min.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/boxicons.min.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/owl.carousel.min.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/animate.min.css')}}" rel="stylesheet">
    
    <link rel="stylesheet" href="{{asset('/css/all.min.css')}}">

    <link href="{{asset('/css/front/venobox.css')}}" rel="stylesheet">
    <link href="{{asset('/css/front/aos.css')}}" rel="stylesheet">
    

    {{-- Template Main CSS File --}}
    
    <link href="{{asset('/css/front/style.css?v=1.01')}}" rel="stylesheet">
    <script src="{{asset('/js/front/jquery.min.js')}}"></script>
    <script src="{{asset('/js/front/form.js')}}"></script>
   
    <script src="{{asset('/js/front/bootstrap.bundle.min.js')}}"></script>
    {{-- Sweet Alert --}}
    <script src="{{asset('/js/sweetalert2.all.min.js')}}"></script>
</head>
<body>
    @yield('content')
   
   @if (($socials->count() != 0 )&& ($details->count() != 0))
   
   <!-- ======= Top Bar ======= -->
   <div id="topbar" class="d-none d-lg-flex align-items-center fixed-top">
       <div class="container d-flex">
           
            <div class="contact-info mr-auto">
               @foreach ($details as $item)
               <i class="icofont-envelope"></i> <a href="mailto:{{$item->email}}">{{$item->email}}</a>
               <i class="icofont-phone"></i> {{$item->phone1}}
               @endforeach          
           </div>
   
           <div class="social-links">

            @foreach ($socials as $row)
            @if($row->twitter != '')
            <a href="{{$row->twitter}}" target="_blank" class="twitter"><i class="icofont-twitter"></i></a>
            @endif

            @if($row->facebook != '')
            <a href="{{$row->facebook}}" target="_blank" class="facebook"><i class="icofont-facebook"></i></a>
            @endif

            @if($row->instagram != '')
            <a href="{{$row->instagram}}" target="_blank" class="instagram"><i class="icofont-instagram"></i></a>
            @endif

            @if($row->skype != '')
            <a href="{{$row->skype}}" target="_blank" class="skype"><i class="icofont-skype"></i></a>
            @endif

            @if($row->youtube != '')
            <a href="{{$row->youtube}}" target="_blank" class="youtube"><i class="icofont-youtube"></i></a>
            @endif

            @if($row->linkedin != '')
            <a href="{{$row->linkedin}}" target="_blank" class="linkedin"><i class="icofont-linkedin"></i></i></a>
            @endif
            @endforeach
   
           </div>
       </div>
   </div>

   @else
   <div id="topbar" class="d-none d-lg-flex align-items-center fixed-top">
        <div class="container d-flex">
            
            <div class="contact-info mr-auto">
                
                <i class="icofont-envelope"></i> <a href="mailto:#"></a>
                <i class="icofont-phone"></i> --
                        
            </div>

            <div class="social-links">

            @foreach ($socials as $row)
            @if($row->twitter != '')
            <a href="{{$row->twitter}}" target="_blank" class="twitter"><i class="icofont-twitter"></i></a>
            @endif

            @if($row->facebook != '')
            <a href="{{$row->facebook}}" target="_blank" class="facebook"><i class="icofont-facebook"></i></a>
            @endif

            @if($row->instagram != '')
            <a href="{{$row->instagram}}" target="_blank" class="instagram"><i class="icofont-instagram"></i></a>
            @endif

            @if($row->skype != '')
            <a href="{{$row->skype}}" target="_blank" class="skype"><i class="icofont-skype"></i></a>
            @endif

            @if($row->youtube != '')
            <a href="{{$row->youtube}}" target="_blank" class="youtube"><i class="icofont-youtube"></i></a>
            @endif

            @if($row->linkedin != '')
            <a href="{{$row->linkedin}}" target="_blank" class="linkedin"><i class="icofont-linkedin"></i></i></a>
            @endif
            @endforeach

            </div>
        </div>
    </div>
   @endif
   
   
   {{-- Header --}}
   <header id="header" class="fixed-top">
       <div class="container d-flex align-items-center">
   
           {{-- <h1 class="logo mr-auto"><a href="index.html">TPHA</a></h1> --}}
           {{-- Uncomment below if you prefer to use an image logo --}}
           <a href="{{url('/')}}" class="logo mr-auto"><img src="{{asset('/images/tpha_logo.png')}}" alt="logo"></a>
   
           <nav class="nav-menu d-none d-lg-block">
               <ul>
                   {{-- ========================= HOME ===================================--}}
                   <li class="{{Request::is('/')? 'active':''}}"><a href="{{url('/')}}">Home</a></li>

                   {{-- ========================= ABOUT US ===============================--}}
                   <li class="drop-down {{Request::is('about')? 'active':''}}"><a href="javascript::void(0);">About</a>
                    <ul>
                        <li><a href="{{url('about')}}">History</a></li>
                        <li><a href="{{url('about')}}">Vision</a></li>
                        <li><a href="{{url('about')}}">Mission</a></li>
                    </ul>
                    </li>

                   {{-- ========================= MEMBERSHIP =============================--}} 
                   <li class="{{Request::is('membership')? 'active':''}}"><a href="{{url('membership')}}">Membership</a></li>
                   
                   {{-- ========================= PUBLICATION =========================== --}}
                   <li class="drop-down {{ Request::is('strategic') || Request::is('proceeding') || Request::is('directory') ? 'active':''}}"><a href="javascript::void(0)">Publication</a>
                    <ul>
                        <li><a href="{{url('strategic')}}">Strategic Plan</a></li>
                        <li><a href="{{url('proceeding')}}">Proceeding</a></li>
                        <li><a href="{{url('directory')}}">Directory</a></li>
                    </ul>
                   </li>

                   {{-- ========================= PROJECTS ===============================--}}
                   <li class="{{ Request::is('projects') ? 'active':''}}"><a href="{{url('projects')}}">Projects</a></li>
                   
                   {{-- ========================== PHOTO GALLERY =========================--}}
                   <li class="drop-down {{Request::is('photo_gallery')? 'active':''}}"><a href="javascript::void(0)">Communities</a>
                       <ul>
                           <li><a href="{{url('photo_gallery')}}">Gallery</a></li>
                           <li><a href="{{url('faq')}}">FAQ</a></li>
                           {{-- <li><a href="#">Network</a></li>
                           <li><a href="#">Affiliates</a></li>
                           <li><a href="#">Communities</a></li> --}}
                       </ul>
                   </li>

                   {{--========================== CONTACT US =============================--}}
                   <li class="{{Request::is('contacts')? 'active':''}}"><a href="{{url('contacts')}}">Contact</a></li>
   
               </ul>
           </nav>
   
       </div>
   </header>

   {{--======= Footer =======--}}
<footer id="footer">

    @if(Request::is('/') || Request::is('contacts'))
    <div class="footer-newsletter">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-lg-6">
                    <h4>Join Our Newsletter</h4>
                    <p>Subscribe yourself to Receive Periodical Articles and Other Documents </p>
                    <form id="subscribedForm">
                        @csrf
                        <input type="email" name="email"><input type="submit" value="Subscribe">
                    </form>
                </div>
            </div>
        </div>
    </div>
    @endif

    @include('layouts.contact')

    <div id="preloader"></div>
    <a href="#" class="back-to-top"><i class="icofont-simple-up"></i></a>

    {{-- ===================== JS Files ================== --}}
    
    <script src="{{asset('/js/front/jquery.easing.min.js')}}"></script>
    <script src="{{asset('/js/front/validate.js')}}"></script>
    <script src="{{asset('/js/front/jquery.waypoints.min.js')}}"></script>
    <script src="{{asset('/js/front/counterup.min.js')}}"></script>
    <script src="{{asset('/js/front/owl.carousel.min.js')}}"></script>
    <script src="{{asset('/js/front/isotope.pkgd.min.js')}}"></script>
    <script src="{{asset('/js/front/venobox.min.js')}}"></script>
    <script src="{{asset('/js/front/aos.js')}}"></script>


    {{-- ===================== Template Main JS File =================== --}}
    <script src="{{asset('/js/front/main.js')}}"></script>

    <script>
        $("document").ready(function(){
            $('#subscribedForm').on('submit',function(event){
                event.preventDefault();

                var data_url = "{{route('subscribed.store')}}";
                
                $.ajax({
                    url: data_url,
                    method: "POST",
                    dataType: "JSON",
                    data: $(this).serialize(),
                    success: function(data){
                        if(data.success){
                            var result = data.success;
                            Swal.fire({
                                icon: "success",
                                timer: 4500,
                                showConfirmButton: false,
                                showCancelButton: false,
                                title: "Info!",
                                text: result,
                            })

                            $('#subscribedForm')[0].reset();
                        }

                        if(data.errors){
                            var result = data.errors;
                            Swal.fire({
                                icon: "warning",
                                timer: 4500,
                                showConfirmButton: false,
                                showCancelButton: false,
                                title: "Notification!",
                                text: result,
                            }) 
                        }

                        if(data.failed){
                            var result = data.failed;
                            Swal.fire({
                                icon: "info",
                                timer: 4500,
                                showConfirmButton: false,
                                showCancelButton: false,
                                title: "Info!",
                                text: result,
                            }) 
                        }
                    }
                })
            })
        })
    </script>
</body>
</html>