<?php if (isset($component)) { $__componentOriginal60fdcebc2cddd900cd96c2c6c7c2c461 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal60fdcebc2cddd900cd96c2c6c7c2c461 = $attributes; } ?>
<?php $component = App\View\Components\SelectTwo::resolve(['name' => ''.e($name).'','id' => 'feature_id_'.e($counter).''] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('select-two'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\SelectTwo::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <?php $__currentLoopData = $features; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $feature): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <option value="<?php echo e($feature->id); ?>"
            <?php echo e(old('feature_id', isset($model) ? $model->feature_id : '') == $feature->id ? 'selected' : ''); ?>>
            <?php echo e($feature->name); ?></option>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal60fdcebc2cddd900cd96c2c6c7c2c461)): ?>
<?php $attributes = $__attributesOriginal60fdcebc2cddd900cd96c2c6c7c2c461; ?>
<?php unset($__attributesOriginal60fdcebc2cddd900cd96c2c6c7c2c461); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal60fdcebc2cddd900cd96c2c6c7c2c461)): ?>
<?php $component = $__componentOriginal60fdcebc2cddd900cd96c2c6c7c2c461; ?>
<?php unset($__componentOriginal60fdcebc2cddd900cd96c2c6c7c2c461); ?>
<?php endif; ?>


<script>
    function toggleFeature() {
        if (document.getElementById('feature_id_<?php echo e($counter); ?>').value == '') {
            $('#<?php echo e($attributeid); ?>').empty();
            $('#<?php echo e($attributeid); ?>').append('<option>??</option>');
            return true;
        }
        $.ajax({
            url: "<?php echo e(url('api/' . App::getLocale() . '/features/')); ?>/" + document.getElementById(
                'feature_id_<?php echo e($counter); ?>').value,
            type: 'GET',
            dataType: 'json',
            success: function(data) {
                $('#<?php echo e($attributeid); ?>').empty();
                $('#<?php echo e($attributeid); ?>').append('<option>??</option>');
                $.each(data.data, function(key, value) {

                    $('#<?php echo e($attributeid); ?>').append('<option value="' + value.id +
                        '">' +
                        value.name + '</option>');
                })
            },
            error: function(error) {
                console.error(error);
            }
        });

    }

    $(document).on('change', '#feature_id_<?php echo e($counter); ?>', toggleFeature);
    initChoices();
</script>
<?php /**PATH /home/oday/public_html/mazdashboard.alialzahabia.com/resources/views/components/feature-select.blade.php ENDPATH**/ ?>