<?php
    // Variable for the form
    $form = 'carFormID';
    $button = [
        'save' => 'carSaveData',
        'close' => 'carCloseForm',
    ];

    // Get data
    $id = !empty($data) && !empty($data['id']) ? (int) $data['id'] : 0;
    $name = !empty($data) && !empty($data['name']) ? ucfirst($data['name']) : '';

    // Form title
    $title = !empty($id) ? $name : 'Ajouter un véhicule';

?>

<form id="<?php echo e($form); ?>">
    <?php echo csrf_field(); ?>
    <input type="hidden" name="rowID" value="<?php echo e($id); ?>">
    <div class="modal-header bg-primary">
        <h3 class="modal-title fw-light text-uppercase text-white fs-5"><?php echo e($title); ?></h3>
        <!--begin::Close-->
        <div class="btn btn-icon btn-sm  ms-2" data-bs-dismiss="modal" aria-label="Close">
            <i class="ki-duotone ki-cross fs-1 text-white"><span class="path1"></span><span class="path2"></span></i>
        </div>
        <!--end::Close-->
    </div>

    <div class="modal-body">
        <!--begin::Select -->
        <div class="fv-row mb-5 row">
            <div class="col-md-3">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Marque</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="brand_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $brand->id === $brandID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($brand->id); ?>"><?php echo e(ucfirst($brand->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>

            <div class="col-md-3">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Modèle</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="modele_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $modeles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $model): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $model->id === $modelID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($model->id); ?>"><?php echo e(ucfirst($model->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>


            <div class="col-md-3">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Type de véhicule</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="cartype_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $cartypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cartype): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $cartype->id === $cartypeID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($cartype->id); ?>"><?php echo e(ucfirst($cartype->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>


            <div class="col-md-3">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Type de carburant</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="fueltype_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $fueltypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fueltype): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $fueltype->id === $fueltypeID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($fueltype->id); ?>"><?php echo e(ucfirst($fueltype->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>

        </div>
        <!--end::Select-->

        <div class="fv-row mb-5 row">
            <div class="col-md-4">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Transmission</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="transmissiontype_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $transmissiontypes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transmissiontypes): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $transmissiontypes->id === $transmissiontypesID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($transmissiontypes->id); ?>"><?php echo e(ucfirst($transmissiontypes->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>
            <div class="col-md-4">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Couleur</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <select class="form-select form-select-solid sl2" data-control="select2" data-placeholder="Choix..."
                    data-dropdown-parent="#carModalID" name="color_id">
                    <option></option>
                    <?php $__empty_1 = true; $__currentLoopData = $colors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $color): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            // $selected = $color->id === $colorID ? ' selected="selected"' : '';
                        ?>
                        <option value="<?php echo e($color->id); ?>"><?php echo e(ucfirst($color->name)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                </select>
                <!--end::Select -->
            </div>

            <div class="col-md-4">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Immatriculation</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <input type="text" class="form-control form-control-lg form-control-solid" name="imm"
                    value="">
                <!--end::Input-->
            </div>
        </div>


        <div class="fv-row mb-5 row">
            <div class="col-md-3">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Nombre de place</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <input type="number" class="form-control form-control-lg form-control-solid" name="place"
                    value="">
                <!--end::Input-->
            </div>
            <div class="col-md-4">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Prix</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <input type="text" class="form-control form-control-lg form-control-solid" name="price"
                    value="">
                <!--end::Input-->
            </div>
            <div class="col-md-5">
                <!--begin::Label-->
                <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                    <span class="required">Images</span>
                    </span>
                </label>
                <!--end::Label-->
                <!--begin::Input-->
                <input type="file" class="form-control form-control-lg form-control-solid" name="files[]"
                multiple accept="image/png, image/jpeg">
                <!--end::Input-->
            </div>
        </div>

        <div class="fv-row mb-5">
            <!--begin::Label-->
            <label class="d-flex align-items-center fs-5 fw-semibold mb-2">
                <span class="required">Description</span>
                </span>
            </label>
            <!--end::Label-->
            <textarea name="description" id="" cols="3" rows="3" class="form-control form-control-lg form-control-solid" style="resize: none"></textarea>
        </div>

    </div>
    <div class="modal-footer justify-content-center">
        <a href="javascript:;" class="btn btn-danger" data-bs-dismiss="modal" aria-label="Close"
            id="<?php echo e($button['close']); ?>">Fermer</a>
        <button type="submit" class="btn btn-primary" id="<?php echo e($button['save']); ?>">Ajouter</button>
    </div>
</form>
<?php /**PATH C:\laragon\www\car-rend\resources\views/backoffice/car/form.blade.php ENDPATH**/ ?>