<div class="space-5"></div>
<form action="{{ url('add-to-cart') }}" method="post" id="order-form">
    {{ csrf_field() }}
    <div class="form-group form-inline {{ $errors->has('phone') ? ' has-error' : '' }}">
        <label for="">Marque</label>
        <select name="phone" class="form-control" id="form-phone" required>
            <option value="">Sélectionnez votre Marque </option>
            <?php $count = 0;  ?>
            @foreach($manufacturers as $key => $manufacturer)

            <?php $count++;  ?>

            <?php 
                $selected = '';
                if ( (old("phone") == $manufacturer->name) || (is_object($selected_manufacturer) && $selected_manufacturer->name == $manufacturer->name) || (isset($name) && strlen($name) > 0 && $name == str_replace(' ', '-', strtolower($manufacturer->name)))) {
                    $selected = 'selected="selected"';
                }
                
            ?>

            @if($count <= 5)
            <option {{ $selected }} style="font-weight:bold;" value="{{ $manufacturer->name }}">{{ $manufacturer->name }}</option>
            @else
            <option {{ $selected }} value="{{ $manufacturer->name }}">{{ $manufacturer->name }}</option>
            @endif

            @if($count == 5)
            <option value="" disabled="disabled">----------------------------------------------------</option>
            @endif
            @endforeach
        </select>

        @if ($errors->has('phone'))
            <span class="help-block">
                <strong>{{ $errors->first('phone') }}</strong>
            </span>
        @endif
    </div>

    <div class="form-group form-inline {{ $errors->has('model') ? ' has-error' : '' }}">
        <label for="">Modéle</label>
        <div class="input-group">
            <input type="text" id="form-model" value="{{ old('model') }}" name="model" class="form-control" placeholder="Entrez votre modèle de téléphone"required />
            <span class="input-group-addon"><i data-toggle="tooltip" data-placement="right" title="Si vous ne trouvez pas votre modèle de téléphone dans la liste ce n`est pas grave, veuillez simplement taper manuellement le nom complet de votre modèle dans la case, nous débloquons tous les modèles de téléphones sur le marché." class="icofont icofont-info-circle"></i></span>
        </div>
        @if ($errors->has('model'))
            <span class="help-block">
                <strong>{{ $errors->first('model') }}</strong>
            </span>
        @endif
    </div>

    <div class="form-group form-inline {{ $errors->has('operator_id') ? ' has-error' : '' }}">
        <label for="">Opérateur</label>
        <select name="operator_id" class="form-control" id="" required>
                <option value="">Votre ancien Opérateur</option>
                <?php $count = 0;  ?>
                @foreach($operators as $key => $operator)
                    <?php $count++;  ?>
                    <?php 
                        $selected = '';
                        if ( (old("operator_id") == $operator->id) || (isset($name) && strlen($name) > 0 && $name == str_replace(' ', '-', strtolower($operator->name)))) {
                            $selected = 'selected="selected"';
                        }
                        
                    ?>
                    @if($operator->parent_id == 0 || $operator->name == 'Virgin mobile' || $operator->name == 'Universal mobile')
                    <option {{ $selected }} style="font-weight:bold;" value="{{ $operator->id }}">{{ $operator->name }}</option>
                    @else
                    <option {{ $selected }}  value="{{ $operator->id }}">{{ $operator->name }} ({{ $operator->parent->name }})</option>
                    @endif

                    @if($count == 5)
                    <option value="" disabled="disabled">----------------------------------------------------</option>
                    @endif
                @endforeach
        </select>

        @if ($errors->has('operator_id'))
            <span class="help-block">
                <strong>{{ $errors->first('operator_id') }}</strong>
            </span>
        @endif
    </div>

    <div class="form-group form-inline {{ $errors->has('imei') ? ' has-error' : '' }}">
        <label for="">Code IMEI</label>
        <div class="input-group">
            <input type="number" name="imei" value="{{ old('imei') }}" class="form-control" placeholder=" Entrez votre numéro IMEI" required>
            <span class="input-group-addon"><i data-toggle="tooltip" data-placement="right" title="(Composez *#06# sur le clavier de votre portable) Notez uniquement les 15 premiers chiffres, sans tiret ni espace." class="icofont icofont-info-circle"></i></span>
        </div>

        @if ($errors->has('imei'))
            <span class="help-block">
                <strong>{{ $errors->first('imei') }}</strong>
            </span>
        @endif
    </div>

    @if(request()->segment(2) != '')
    <div class="form-group form-inline {{ $errors->has('price') ? ' has-error' : '' }}">
        <label for="">Prix</label>
        <input type="number" name="price" value="" class="form-control" placeholder="" disabled="disabled" required>
        @if ($errors->has('price'))
            <span class="help-block">
                <strong>{{ $errors->first('price') }}</strong>
            </span>
        @endif
    </div>
    @endif

    <div class="form-group form-inline {{ $errors->has('email') ? ' has-error' : '' }}">
        <label for="">Email</label>
        <input type="email" class="form-control" value="{{ old('email') }}" name="email" placeholder=" Entrez votre Email" required>
        @if ($errors->has('email'))
            <span class="help-block">
                <strong>{{ $errors->first('email') }}</strong>
            </span>
        @endif
    </div>

    <div class="checkbox">
        <label>
        <input type="checkbox" required>J'ai lu et j'accepte les <span data-toggle="modal" data-target="#modal-tos" class="text-green text-bold"> conditions générales de vente</span> 
        </label>
    </div>

    <div class="space-25 hidden-xs"></div>
    <div class="form-group">
        <button type="submit" class="bttn btn-orange @if(isset($cta_class)) {{ $cta_class }}  @endif">{{ $cta }}</button>
    </div>

</form>
<div class="space-10"></div>
<div id="website-secured-proof" class="center-block text-center">
    <ul class="list-unstyled">
        <li><div class="secured-logo norton"></div></li>
        <li><div class="secured-logo verisign"></div></li>
        <li><div class="secured-logo truste"></div></li>
        <li><div class="secured-logo paypal"></div></li>
    </ul>
</div>