<?php $__env->startSection('title', '| Enregister projet'); ?>

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

    <div class="content-wrapper">

        <div class="container">
            <div class="content-header">
                <div class="container-fluid">
                    <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1 class="m-0 text-info">GESTION DES PROJETS</h1>
                    </div><!-- /.col -->
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="<?php echo e(route('home')); ?>" role="button" class="btn btn-success">ACCUEIL</a></li>
                        <li class="breadcrumb-item active"><a href="<?php echo e(route('projet.index')); ?>" role="button" class="btn btn-success">Formulaire d'enregistrement des projets</a></li>

                        </ol>
                    </div><!-- /.col -->
                    </div><!-- /.row -->
                </div><!-- /.container-fluid -->
            </div>
        <form action="<?php echo e(route('projet.store')); ?>" method="POST" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
             <div class="card border-danger border-0">
                        <div class="card-header bg-success text-center">FORMULAIRE D'ENREGISTREMENT D'UN PROJET</div>
                            <div class="card-body">
                                <?php if($errors->any()): ?>
                                    <div class="alert alert-danger">
                                        <ul>
                                            <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <li><?php echo e($error); ?></li>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </ul>
                                    </div>
                                <?php endif; ?>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>Nom du Projet</label>
                                        <input type="text" name="nom"  value="<?php echo e(old('nom')); ?>" class="form-control"  required>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>Durée</label>
                                        <input type="number" name="duree"  value="<?php echo e(old('duree')); ?>" class="form-control"  required>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>Objectif</label>
                                        <textarea name="objectif"    class="form-control" > <?php echo e(old('objectif')); ?></textarea>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>Type Cadre</label>
                                        <select class="form-control" name="typecadre" required="">
                                            <option value="">Veuillez Selectionnez</option>
                                            <option value="Cadre logique">Cadre Logique</option>
                                            <option value="Cadre de  resultat">Cadre de  resultat</option>
                                            <option value="Plan d'action">Plan d'action</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label>Pays</label>
                                        <select class="form-control" id="pays_id" name="pays_id" required="">
                                            <option value="">Veuillez Selectionnez</option>
                                            <?php $__currentLoopData = $payss; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $pays): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <option value="<?php echo e($pays->id); ?>"><?php echo e($pays->nomp); ?></option>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label>Image en avant</label>
                                        <input type="file" name="image"  class="form-control" >
                                    </div>
                                </div>
                                <div class="col-lg-6">

                                    <div class="form-group" id="region_id">


                                        </div>
                                    </div>

                                </div>

                                <div>
                                    <center>
                                        <button type="submit" class="btn btn-success btn btn-lg "> ENREGISTRER</button>
                                    </center>
                                </div>
                            </div>

                            </div>

            </form>
            </div>
        </div>



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

<?php $__env->startSection('script'); ?>
<script type='text/javascript'>
$("#pays_id").change(function () {

    //var selectedClasse = $(this).children("option:selected").val();
var pays_id =  $("#pays_id").children("option:selected").val();
    // alert("You have selected the country - " + region_id);
    //var region_id = "<option value=''>Veuillez selectionner</option>";
    var region_id ="<label>Région d'intervention</label>";
    $.ajax({
        type:'GET',
       // url:"http://46.105.120.83/suivievaluation/public/pays/region/"+pays_id,
       url:"http://127.0.0.1:8000/pays/region/"+pays_id,
        data:'_token = <?php echo csrf_token() ?>',
        success:function(data) {
            //alert(data);
            //var region_id = " <option value=''>Sélectionner</option>";
           $.each(data,function(index,row){
                //alert(row.nomd);
                region_id +=" <div class='custom-control custom-checkbox' >"+
                "<input class='custom-control-input' name='zone[]' type='checkbox' id="+row.id+" value="+row.id+">"+
                "<label for='"+row.id+"' class='custom-control-label'>"+row.nom+"</label> </div>";



            });
            $("#region_id").empty();
            $("#region_id").append(region_id);
        }
    });

});
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\enda\RFA\plateforme RFA\rfaBackend\resources\views/projet/add.blade.php ENDPATH**/ ?>