@include('layouts.commons.errors')

<div>
    <h2 class="pb-2">Modifier un fichier</h2>
</div>

<div class="container pr-2 pl-2">
    <form method="POST" action="{{ route('fichiers.update', [$projet->id, $fichier->id]) }}">
        @csrf
        {{ method_field('PUT') }}
        {{-- Input caché utilisé par le validator --}}
        <input type="hidden" name="projet_id" value="{{ $projet->id }}">
        <input type="hidden" name="fichier_id" value="{{ $fichier->id }}">

        <!-- Fichier -->
        <div class="form-group row">
            <label for="fichier" class="col-md-4 col-form-label text-md-right">Fichier</label>
            <div class="col-md-6">
                <input id="fichier" type="text" class="form-control" name="fichier" value="{{ old('fichier', $fichier->nom) }}" required disabled>
            </div>
        </div>

        <!-- Commentaire -->
        <div class="form-group row">
            <label for="commentaire" class="col-md-4 col-form-label text-md-right">Commentaire</label>
            <div class="col-md-6">
                <textarea class="form-control" id="commentaire" name="commentaire">{{ old('commentaire', $fichier->commentaire) }}</textarea>
            </div>
        </div>

        <div class="form-group row mb-0">
            <div class="col-md-8 offset-md-4">
                <button type="submit" class="btn btn-outline-success">
                    Sauvegarder
                </button>
                <a href="{{ route('projets.edit', $projet->id) }}" class="btn btn-outline-warning">Annuler</a>
            </div>
        </div>
    </form>
</div>
