@extends('dashboard.layouts.master')

@section('title')
Opet   dashboard
@endsection
<!-- ======= Header ======= -->

<!-- End Header -->
@section('content')
<div class="wrapper">
    @include('dashboard.layouts.nav')
    @include('dashboard.layouts.aside')
   
    <main role="main" class="main-content">
        <div class="container-fluid">
          <div class="row justify-content-center">
            <div class="col-12">
                <div class="row">
                    <div class="col-6">
                        <h2 class="page-title">Our Partners </h2>
                    </div>
                    <div class="col-6 text-right">
                        <button type="button" class="fe fe-24 fe-plus" data-toggle="modal" data-target="#exampleModal">
                            
                          </button>
                    </div>
                </div>

                

                @if(Session::has('success'))
                <div class="alert alert-success outline form-control">{{Session::get('success')}}</div>
                @endif
                @if(Session::has('errors'))
                <div class="alert alert-danger outline form-control">{{Session::get('errors')}}</div>
                @endif
                <div class="table-responsive">
                    <table class="table display datatables" id="ajax-data-object">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Image</th>
                                <th>Alt</th>
                               

                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>

                            @if(@isset($data) && !@empty($data))
                            @foreach( $data as $index => $info)
                        
                            <tr>
                                <td>{{$index +1 }}</td>
                                <td>
                                    <img src="{{ asset('uploads/partner/' . $info->image) }}" width="80px" height="80px" style="margin-bottom: 10px; " /> <br>

                                </td>
                                <td>
                                     {{$info->alt}}

                                </td>
                                
                                <td>
                                    <a href="{{ route('delete_partners',$info->id) }}" class="btn btn-danger btn-sm">Delete</a>
                                </td>
                            </tr>
                        
                            @endforeach
                            @else
                            <tr>
                                <td colspan="5" class="alert alert-danger">No Data</td>
                            </tr>

                            @endif
                        </tbody>
                    </table>
                </div>
          </div> <!-- .row -->
        </div> <!-- .container-fluid -->
        
        <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h5 class="modal-title" id="exampleModalLabel">New Partner</h5>
                  <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </div>
                <form action="{{route('add_partner')}}" method="post" enctype="multipart/form-data">
                    @csrf
                    <div class="modal-body">
                        <div>

                            <label class="col-form-label pt-0" for="image"> Partner Image alt </label>
                            <input class="form-control" id="alt" name="alt" type="text">
                        </div>
                     
                        <div>

                            <label class="col-form-label pt-0" for="image"> Partner Image </label>
                            <input class="form-control" id="image" name="image" type="file">
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                        <button  type="submit" class="btn btn-primary">Save </button>
                    </div>
                        
                    </form>
              </div>
            </div>
        </div>
    </main> <!-- main -->

   
@endsection