@extends('layouts.app')

@section('content')
    
<div class="container-fluid">
    <div class="row">
        <div class="col">
            @if ($errors->any())
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            @endif
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="card" id="formEntreprise">
                <div class="card-header">
                    <h4 class="card-title">Informations du mandat de location</h4>
                </div>
                <div class="card-body">
                    <form method="POST" action="{{route('location.store', $bienId)}}">
                        @csrf

                        {{-- champs caché --}}
                        <input type="text" name="bien_id" hidden value="{{ $bienId }}">

                        <div class="row mb-4 mt-4">
                            <div class="col-3 mt-auto">
                                <div class="form-group">
                                    <label>Dépot de garantie (€)</label>
                                    <input required type="number" step="0.01" name="depot_garantie" class="form-control" value="0">
                                </div>
                            </div>
                            <div class="col-3 mt-auto">
                                <div class="form-group">
                                    <label>Honoraires pour la gestion locative (€)</label>
                                    <input required type="number" step="0.01" name="honoraire_location_locataire" class="form-control" value="0">
                                </div>
                            </div>
                            <div class="col-3 mt-auto">
                                <div class="form-group">
                                    <label>Honoraires pour la rédaction de l’état des lieux (€)</label>
                                    <input required type="number" step="0.01" name="honoraire_etat_locataire" class="form-control" value="0">
                                </div>
                            </div>
                            <div class="col-3 mt-auto">
                                <div class="form-group">
                                    <label>Total des honoraires (€)</label>
                                    <input required type="number" name="honoraire_total_locataire" class="form-control" value="0">
                                </div>
                            </div>
                        </div>

                        <div class="row mb-4">
                            <div class="col-3 mt-auto">
                                <label for="complement_loyer">Montant du loyer complémentaire si éligible (€)</label>
                                <input required type="number" step="0.01" name="complement_loyer" class="form-control" value="0">
                            </div>
                            <div class="col-3 mt-auto">
                                <label for="modalite_charge">Mode de régularisation des charges</label>
                                <select required name="modalite_charge" class="form-control">
                                    <option value="0">Provision sur charge</option>
                                    <option value="1">Charge forfaitaire</option>
                                    <option value="2">Au réel</option>
                                </select>
                            </div>
                            <div class="col-3 mt-auto">
                                <label for="charges">Charges mensuelles au forfait ou par provision sur charges conditionné par le mode de régularisation (€)</label>
                                <input required type="number" step="0.01" name="charges" class="form-control" value="0">
                            </div>
                            
                            <div class="col-3 mt-auto">
                                <label for="type_mandat">Type du mandat</label>
                                <select required name="type_mandat" class="form-control">
                                    <option value="S">Mandat simple</option>
                                    <option value="E">Mandat exclusif</option>
                                    <option value="P">Mandat priviliégié</option>
                                </select>
                            </div>
                        </div>

                        <div class="row mb-4">
                            <div class="col-4 mt-auto">
                                <label for="num_mandat">Numéro de référence du mandat tel qu’inscrit sur le mandat de vente (papier)</label>
                                <input required type="text" name="num_mandat" class="form-control">
                            </div>
                            <div class="col-4 mt-auto">
                                <label for="date_mandat">Date du mandat</label>
                                <input required type="date" name="date_mandat" class="form-control">
                            </div>
                            <div class="col-4 mt-auto">
                                <label for="libre_le">Date de libération du bien</label>
                                <input type="date" name="libre_le" class="form-control">
                            </div>
                        </div>

                        <hr>

                        <h4 class="card-title">Information du loyer</h4>

                        <div class="row mt-4 mb-4">
                            <div class="col-4 mt-auto">
                                <label for="hors_charges">Loyer mensuel hors charges et hors complément de loyer (charges non récupérables) (€)</label>
                                <input required type="number" step="0.01" name="hors_charges" class="form-control" value="0">
                            </div>
                            <div class="col-4 mt-auto">
                                <label for="charges_comprises">Loyer mensuel charges comprises et complément de loyer incus (charges récupérables) (€)</label>
                                <input required type="number" step="0.01" name="charges_comprises" class="form-control" value="0">
                            </div>
                            <div class="col-4 mt-auto">
                                <label for="depot_garantie">Dépot de garantie (€)</label>
                                <input required type="number" step="0.01" name="depot_garantie" class="form-control" value="0">
                            </div>
                        </div>

                        <button type="submit" class="btn btn-info btn-fill pull-right">Etape suivante</button>
                        <div class="clearfix"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

@endsection