<?php $__env->startSection('conteudo'); ?>

<div class="pcoded-content">

    <div class="page-header">
        <div class="page-block">
            <div class="row align-items-center">
                <div class="col-md-12">
                    <div class="page-header-title">
                        <h5 class="m-b-10">Rotas</h5>
                    </div>
                    <ul class="breadcrumb">
                        <li class="breadcrumb-item"><a href="index.html"><i class="feather icon-home"></i></a></li>
                        <li class="breadcrumb-item"><a href="#!">Rotas</a></li>
                        <li class="breadcrumb-item"><a href="#!">Nova</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="row">

        <div class="col-sm-12"  >
            <?php if($errors->any()): ?>
                <div class="sufee-alert alert with-close alert-danger alert-dismissible fade show">
                    <span class="badge badge-pill badge-danger">Erro</span>
                    <ul class="errors">
                        <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $erro): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <li> <?php echo e($erro); ?></li>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </ul>
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
        <?php endif; ?>
            <div  id="sms_erro" class="sufee-alert alert with-close alert-danger alert-dismissible fade show">
                <span class="badge badge-pill badge-danger">Erro</span>
               Preencha todos os campos obrigatórios.

            </div>


            <div class="card">
                <div class="card-body">
                    <h5>Nova</h5>

                    <hr>
                    <form id="formulario" action="<?php echo e(route('registar.rota.post')); ?>" method="post" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>

                        <div class="form-row">

                            <div class="form-group col-md-6">
                                <label for="inputCity">Origem <span style="color: red">*</span></label>
                                <input type="text" id="origem" name="origem" class="form-control" >

                            </div>
                            <div class="form-group col-md-6">
                                <label for="inputCity">Destino <span style="color: red">*</span></label>
                                <input type="text"  id="destino" name="destino" class="form-control" >

                            </div>
                        </div>


                        <button onclick="verificarRegisto()" class="btn  btn-primary float-right">Registar</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>


<script>

    document.getElementById('sms_erro').style.display = 'none';

function verificarRegisto(){
    
    event.preventDefault();
    var origem = document.getElementById('origem').value;
    var destino = document.getElementById('destino').value;


    if(origem ==="" || destino==="" ){
        document.getElementById('sms_erro').style.display = 'block';
    }else{
        document.getElementById('sms_erro').style.display = 'none';
        document.getElementById('formulario').submit();
    }
}


</script>


<?php $__env->stopSection(); ?>

<?php echo $__env->make('Dashboard.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\Ferdinando Roque\Documents\GitHub\creche\resources\views/Dashboard/pagina/nova_rota.blade.php ENDPATH**/ ?>