@extends('layouts.base')

@section('menu')
    @include('admin.menu')
@endsection

@section('content')

@if ($errors->any())
    <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

<section class="bg-gray">
    <div class="container">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h4>Mettre à jour le type d'offre</h4>
            </div>
            <div class="card-body">
                <form action="{{ route('admin.update-type-offres', ['id' => $typeOffre->id]) }}" method="POST" enctype="multipart/form-data">
                    @csrf
                    
                    <div class="mb-3">
                        <label for="name" class="form-label">Intitulé</label>
                        <input type="text" name="name" id="name" class="form-control" value="{{ $typeOffre->name }}" required>
                            @error('name')
                                <div class="text-danger">{{ $message }}</div>
                            @enderror
                    </div>
                    <div class="mb-3">
                        <label for="description" class="form-label">Description</label>
                        <textarea name="description" id="description" class="form-control" rows="4" required>{{ $typeOffre->description }}</textarea>
                        @error('description')
                            <div class="text-danger">{{ $message }}</div>
                        @enderror
                    </div>
                    <button type="submit" class="btn btn-success">Mettre à jour</button>
                </form>
                
            </div>
        </div>
    </div>
</section>
@endsection

@section('scripts')
<script>
</script>
@endsection
