@extends('layouts.idara.panel')


@section('content')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link href="https://unpkg.com/filepond@4.30.4/dist/filepond.min.css" rel="stylesheet" type="text/css" />

<link
    href="https://unpkg.com/filepond-plugin-image-edit/dist/filepond-plugin-image-edit.css"
    rel="stylesheet"
/>
<div class="container">
    <section style="margin-bottom: 44px;">
        <div class="card">
            <div class="card-header">
                Vos images pour le {{$article->nom}}
            </div>
            <div class="card-body">


                <a href="javascript:history.back()" class="btn btn-primary">Retour</a>

                <a href="javascript:window.location.href=window.location.href" class="btn btn-secondary"><i class="fa-solid fa-arrows-rotate"></i>Actualiser</a>


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



    <div class="card">
        <div class="card-header">
            Document
        </div>
        <div class="card-body">
            

            <div class="container">
                @if(session('success'))
                <div class="alert alert-success">
                    {{ session('success') }}
                </div>
                @endif
                @if (count($errors) > 0)
                <div class="alert alert-danger">
                    <strong>Whoops!</strong> Some problems with your input.<br><br>
                    <ul>
                        @foreach ($errors->all() as $error)
                        <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
                @endif

                <form method="POST" action="{{url('/produitDoc/'.$article->id)}}" enctype="multipart/form-data">
                <input type="hidden" name="_method" value="PUT">
                @csrf

                    
                    <div class="input-group control-group increment" >
                    <input type="file" name="document" class="form-control "  required/>
                    
                    </div>
                  
                
                       
                         <div class="form-group col-md-4 mt-4">
                            <button type="submit" class="btn btn-success" style="margin-top:10px">Confirmer</button>
                        </div>
                    

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

</div>


<script src="https://unpkg.com/filepond@4.30.4/dist/filepond.min.js"></script>
<script>
    // Get a reference to the file input element
    const inputElement = document.querySelector('input[type="file"]');

    // Create a FilePond instance
    const pond = FilePond.create(inputElement);
    FilePond.setOptions({
    server: {
        process: '/doc-upload',
        revert: '/doc-delete',
        headers:{
                        'X-CSRF-TOKEN': '{{ csrf_token() }}'}
       
    },
});
</script>



@endsection
