    

<link href="<?php echo e(asset('/assets/pages/css/about.css')); ?>" rel="stylesheet" type="text/css" />

<?php $__env->startSection('content'); ?>
</div>
<!-- END PAGE HEAD-->
<!-- BEGIN PAGE CONTENT BODY -->
<div class="page-content">
    <div class="container-fluid">
        <div class="page-content-inner">
            <div class="row">
                <div class="col-md-12">
                    <div class="portlet light">
                        <div class="portlet-body">
                         <div class="col-md-12 text-center">
                            <h1><?php echo $pesquisa->titulo; ?></h1>
                        </div>
                        <?php echo Form::open(['route' => $action->route, 'method' => $action->method, 'id'=>'pesquisa']); ?> 
                        <?php echo Form::hidden('pesquisa_satisfacao_id', $pesquisa->id); ?>

                        <?php echo Form::hidden('pesquisa_satisfacao_registro', $registro->id); ?>

                        <div class="row">
                            <div class="col-xs-12" style=" margin-top: 10px;">

                                <?php foreach($pesquisa->perguntas as $key => $pergunta): ?>
                                <?php echo Form::hidden('perguntas[]', $pergunta->id); ?>

                                <div class="col-xs-12 note note-info">
                                    <label>
                                        <strong><?php echo e($key+1); ?></strong> - 
                                        <?php echo e($pergunta->enunciado); ?>

                                    </label>

                                    <?php echo Form::hidden('pesquisa_satisfacao_id', $pesquisa->id); ?>

                                    <?php if(count($pergunta->alterantivas)>0): ?>
                                    <div class="col-xs-12 ">
                                        <?php foreach($pergunta->alterantivas as $alterantivas): ?>
                                        <?php echo Form::hidden('resposta['.$pergunta->id.']', $alterantivas->alternativa); ?>


                                        <div class="form-group  has-personalizado" style="margin-top: 5px; margin-bottom: 5px" >
                                            <div class="md-radio" >
                                                <?php echo Form::radio('alternativa['.$pergunta->id.'] ',$alterantivas->id ,''  , ['id'=>'alternativa'.$alterantivas->id,'class'=>'md-radiobtn','required'=>'true']); ?>

                                                <label for="alternativa<?php echo e($alterantivas->id); ?>">
                                                    <span></span>
                                                    <span class="check has-personalizado"></span>
                                                    <span class="box"></span>
                                                </label> 
                                                <label for="alternativa<?php echo e($alterantivas->id); ?>" style="padding-left: 5px;"><?php echo $alterantivas->alternativa; ?></label>
                                            </div>
                                        </div>
                                        <?php endforeach; ?> 
                                    </div>
                                    <?php else: ?>
                                    <div class="form-group form-md-line-input has-personalizado form-md-floating-label">
                                        <?php echo Form::textarea('resposta['.$pergunta->id.']','', ['class' => 'form-control', 'id'=>'enunciado', 'autocomplete' => 'off','style'=>'max-height:100px;resize:none']); ?>

                                        <?php echo Form::label('name', 'Resposta'); ?> 
                                    </div>
                                    <?php endif; ?>
                                </div>
                                <hr/>
                                <?php endforeach; ?> 

                                <hr/>
                            </div>
                            <div class="col-xs-12 text-center">
                                <button type="submit"  class="btn yellow-gold popovers"  data-container="body" data-trigger="hover" data-placement="top" id='salvar' data-content="Salvar pergunta na pesquisa">
                                   <i class=" fa fa-file-text-o"></i> 
                                   Responder Agora
                               </button>
                           </div>
                       </div>
                       <?php echo Form::close(); ?>


                   </div>
               </div>
           </div>
       </div>
   </div>
   <!-- END PAGE CONTENT INNER -->
</div>
</div>
<!-- END PAGE CONTENT BODY -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js-admin-user'); ?>
<script src="<?php echo e(asset('/assets/global/scripts/app.min.js')); ?>" type="text/javascript"></script>

<script>
    $(document).ready( function() { 

        $("#pesquisa").validate({
            rules: {
                <?php foreach($pesquisa->perguntas as $key => $pergunta): ?> 
                    <?php if($pergunta->alterantivas->count()>0): ?> 
                    "alternativa[<?php echo e($pergunta->id); ?>]": {required:true},
                    <?php else: ?> 

                        <?php if($pergunta->obrigatorio==1): ?> 
                        "resposta[<?php echo e($pergunta->id); ?>]": {required:true},
                        <?php endif; ?> 

                    <?php endif; ?> 
                <?php endforeach; ?> 
            },
            invalidHandler: function(event, validator) {
                console.log(event);
                console.log(validator);
                 swal({"title":"Ops","text": 'Preencha os campos obrigatórios' ,"showConfirmButton":true,"type":"error","html":true});
            }
        });

        <?php if(count($errors) > 0): ?>
        var teste = "<?php foreach($errors->all() as $error): ?> <?php echo e($error); ?><br> <?php endforeach; ?> " ;
        swal({"title":"Ops","text": teste ,"showConfirmButton":true,"type":"error","html":true});
        <?php endif; ?>
        
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('template', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>