<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\AppLayout::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>

    <div>
        <?php $__env->startSection('title', 'Crear Remota'); ?>

        <div class="col">
            <form action="<?php echo e(route('remotas.update',$remota->id)); ?>" method="POST" class="row g-3" id="formRemota">
                <?php echo csrf_field(); ?>
                <!-- Card -->
                <div class="card border-0 scroll-mt-3" id="basicInformationSection">
                    <div class="card-header">
                        <h2 class="h3 mb-0 text-center">Ver detalle Remota</h2>
                    </div>

                    <?php echo $__env->make('remotas.inputs-form', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>


                </div>

            </form>

        </div>

        

    </div>
    <script>
        var url = "<?php echo e(route('planes.porProveedor')); ?>";

    document.getElementById('proveedor_id').addEventListener('change', function() {
    var proveedor = this.value;

    // console.log(url +'/'+ proveedor);
    try {
        fetch(url +'/'+ proveedor)
            .then(function(response) {

                if (!response.ok) {
                    throw new Error('Error en la respuesta del servidor');
                }
                return response.json();

            })
            .then(function(data) {
                console.log(data);
                var select = document.getElementById('plan_id');
                var costo = document.getElementById('costo_plan');
                select.innerHTML = '';

                var option = document.createElement('option');
                var option = document.createElement('option');
                option.value = "";
                option.text = "Seleccione una opcion";
                select.add(option);
                data.forEach(function(plan) {
                    var option = document.createElement('option');
                    // agregar info de data
                    option.setAttribute('data-precio', plan.precio);
                    option.value = plan.id;
                    option.text = plan.nombre;
                    select.add(option);
                });
            })
            .catch(function(error) {
                console.error('Error:', error);
            });
    } catch (error) {
        console.error('Error:', error);
    }
    document.getElementById('plan_id').addEventListener('change', function() {
        let select_plan = document.getElementById('plan_id');
        // console.log(plan_cambiado);
        let plan_Seleccionado = select_plan.options[select_plan.selectedIndex];
        let precio_plan_seleccionado = plan_Seleccionado.getAttribute('data-precio');
        var costo = document.getElementById('costo_plan');
        costo.value = precio_plan_seleccionado;



    });
});





    </script>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?><?php /**PATH /var/www/vhosts/cloudsatllc.com/portal.cloudsatllc.com/resources/views/remotas/show-form.blade.php ENDPATH**/ ?>