@extends('layouts.idara.panel')


@section('content')
<link rel="stylesheet" href="{{ asset('backend/css/idara.css') }}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />

@include('backend.partials.import')


@include('backend.partials.features')

@if(session('success'))
            <div class="alert alert-success">
                {{ session('success') }}
            </div>
            @endif
        <section class="mt-4">
            <div class="card">
                <div class="card-header actionTitle">

                    <div class="row">
                        <div class="col">
                            <strong><i class="fa fa-ellipsis-v" aria-hidden="true"></i> {{$article->titre}}</strong>

                        </div>
                        <div class="col flexBtn">
                            <div class="dropdown">
                                <button class="btn  dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <i class="fa fa-gears"></i> Actions
                                </button>
                                <ul class="dropdown-menu">
                                    <a href="{{url('/clean')}}">
                                        <li><button class="dropdown-item" type="button"><i class="fas fa-eye" aria-hidden="true"></i> Visualiser</button></li>

                                    </a>
                      {{-- <a href="{{route('presentation.show', ['id' => $article])}}" >{{$article->titre}}</a> --}}

                                    <a href="{{ route('presentation.edit', ['id'=> $article]) }}">
                                        <li><button class="dropdown-item" type="button"> <i class="fa-solid fa-pen-to-square"></i> Modifier</button></li>
                                    </a>

                                </ul>
                            </div>
                            <div class="dropdown">
                                <button class="btn  dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                    <i class="fa fa-puzzle-piece"></i> Extensions
                                </button>
                                <ul class="dropdown-menu">

                                    <a href="{{route('presentation.editImage', ['id'=> $article])}}">
                                        <li><button class="dropdown-item" type="button"> <i class="fa fa-camera"></i> image</button></li>
                                    </a>
                                    {{-- <a href="{{url('presentations/'.$article->id.'/editVideo')}}">
                                        <li><button class="dropdown-item" type="button"> <i class="fa fa-camera"></i> Video</button></li>
                                    </a> --}}
                                    <a href="{{route('presentation.editDetails', ['id'=> $article])}}">
                                        <li><button class="dropdown-item" type="button"> <i class="fa fa-camera"></i> Details</button></li>
                                    </a>

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

                    </div>


                </div>

                <div class="card-body">
                    <div><i class="fa-solid fa-calendar-days"></i> <strong>Date de mise à jour : </strong> {{$article->created_at}}</div>

                    <br>
                    <div> {!! html_entity_decode ($article->texte)!!}</div>

                </div>
            </div>


        </section>
        <section>

            
            @if(empty($article->image))

            @else
            <div class="card mt-4">
                <h5 class="card-header">Image</h5>
                <div class="card-body">

                    <div class="showImage">

                        <img src="{{ asset('storage/image/'.$article->image) }}" alt="description of myimage">
                        <Tooltip title="suprrimer">

                            <form action="{{url('deleteImageP/'.$article->id)}}" method="post">

                                @csrf
                                @method('DELETE')
                                <input type="hidden" name="id" value="{{$article->id}}" />
                                <button type="submit" class="btn btn-sm btn-secondary ml-2"><i class="fa-solid fa-x"></i></button>
  
                            </form>
                        </Tooltip>
                    </div>
                </div>
            </div>
            @endif

        </section>
        <section>


                @if(empty($article->videos))

                @else
                <div class="card mt-4">
                    <h5 class="card-header">Video</h5>
                    <div class="card-body">

                        <div class="showImage">

                        <video width="320" height="240" controls>
                        <source src="{{ asset('storage/'.$article->videos)}}" type="video/mp4">

                        </video>
                            <Tooltip title="suprrimer">

                                <form action="{{url('deleteVideo/'.$article->id)}}" method="post">

                                    @csrf
                                    @method('DELETE')
                                    <input type="hidden" name="id" value="{{$article->id}}" />
                                    <button type="submit" class="btn btn-sm btn-danger ml-2">Delete</button>
                                </form>
                            </Tooltip>
                        </div>
                    </div>
                </div>
                @endif

</section>

    </div>

    @endsection
