<!-- Signup modal-->
@can('create', App\Models\Piece::class)
<div id="create" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="exampleModalToggleLabel">Créer Une Piéce </h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <form class="ps-3 pe-3" method="POST" action="{{ route('Piece.store') }}">

                <div class="modal-body">
                    {{-- <div class="text-center text-dark mt-2 mb-4 fs-4"> Créer Une Piéce </div> --}}
                    @csrf
                    <div class="row">
                        <div class="form-group col-8 mb-3">
                            <label for="piece_type_id">Type Piéce *:</label>
                            <select name="piece_type_id"
                                class="form-control @error('piece_type_id') is-invalid @enderror">
                                @foreach ($piecetypes as $type)
                                    <option value="{{ $type->id }}">
                                        {{ $type->type }}</option>
                                @endforeach
                            </select>
                            @error('piece_type_id')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                        <div class="form-group col-8 mb-1">
                            <label for="piece">Piéce :</label>
                            <input type="text" name="piece"
                                class="form-control @error('piece') is-invalid @enderror">
                            @error('piece')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>

                        {{-- <div class="form-group col-6 mb-1">
                            <label for="prix_unitaire">Prix Unitaire *:</label>
                            <input type="number" step="0.01" name="prix_unitaire" required
                                class="form-control @error('prix_unitaire') is-invalid @enderror">
                            @error('prix_unitaire')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>

                        <div class="form-group col-6 mb-3">
                            <label for="brand">Type Reparation *:</label>
                            <select name="type_reparation_id" id="type_reparation_id"
                                class="form-control @error('type_reparation_id') is-invalid @enderror">
                                @foreach ($types as $type)
                                    <option value="{{ $type->id }}">
                                        {{ $type->type }}</option>
                                @endforeach
                            </select>
                            @error('type_reparation_id')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>

                        <div class="form-group col-6 mb-3">
                            <label for="brand">Operation Piéce *:</label>
                            <select name="operation" id="operation"
                                class="form-control @error('operation') is-invalid @enderror">
                                @foreach ($operations as $operation)
                                    <option value="{{ $operation->id }}">
                                        {{ $operation->operation }}</option>
                                @endforeach
                            </select>
                            @error('operation')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                        <div class="form-group col-6 mb-3">
                            <label for="qte">Qte *:</label>
                            <input type="number" name="qte" id="qte" min="1" value="1"
                                class="form-control @error('qte') is-invalid @enderror">

                            @error('qte')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                        <div class="form-group col-6 mb-3">
                            <label for="gravite">Gravite *:</label>
                            <select name="gravite" id="gravite" class="form-control ">
                                <option value="">Sélectionner :</option>
                                <option value="Moyen">Moyen</option>
                                <option value="Faible">Faible</option>
                            </select>
                        </div>

                        <div class="form-group col-6 mb-3">
                            <label for="gravite">Etat *:</label>
                            <select name="etat" id="etat" class="form-control ">
                                <option value="">Sélectionner :</option>
                                <option value="OUI">OUI</option>
                                <option value="NON">NON</option>
                            </select>
                        </div>

                        <div class="form-group col-6 mb-3">
                            <label for="vetuste">Vétuste :</label>
                            <input type="number" name="vetuste" id="vetuste" min="0" value="0"
                                class="form-control @error('vetuste') is-invalid @enderror">

                            @error('vetuste')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div>
                        <div class="form-group col-6 mb-3">
                            <label for="remise">Remise :</label>
                            <input type="number" name="remise" id="remise" min="0" value="0"
                                class="form-control @error('remise') is-invalid @enderror">

                            @error('remise')
                                <span class="invalid-feedback" role="alert">
                                    <strong>{{ $message }}</strong>
                                </span>
                            @enderror
                        </div> --}}
                    </div>


                </div>
                <div class="modal-footer">
                    {{-- <button class="btn btn-secondary" data-bs-target="#exampleModalToggle2" data-bs-toggle="create"
                        data-bs-dismiss="create">Fermer</button> --}}
                    <button class="btn btn-primary" type="submit" type="submit">Ajouter</button>
                </div>
        </div>
        </form><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
@endcan
