


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


<div class="content-wrapper"> 

    <section class="content-header"> 

        <h1> Gestor de Secretarias </h1>

    </section>
    
    <section class="content"> 

            <div class="box"> 

                <div class="box-header"> 

                    <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#CrearSecretaria" >
                        Crear Secretaria </button>

                </div>                


                <div class="box-body"> 

                    <table class="table table-bordered table-hover table-striped dt-responsive" > 

                        <thead> 

                            <tr> 

                                <th>ID </th>
                                <th>Nombre y Apellido </th>
                                <th>Email </th>
                                <th>Documento </th>
                                <th>Teléfono </th>

                                <th>Editar/Borrar </th>

                            </tr>

                        </thead>
                        
                        <tbody> 

                            <?php $__currentLoopData = $secretarias; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $secretaria): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <tr> 

                                    <td><?php echo e($secretaria->id); ?></td>
                                    <td><?php echo e($secretaria->name); ?> </td>
                                    <td><?php echo e($secretaria->email); ?> </td>
                                    <td><?php echo e($secretaria->documento); ?></td>
                                    
                                    <td><?php echo e($secretaria->telefono); ?></td>
                                    
                                    <td>

                                        <a href="Editar-Secretaria/<?php echo e($secretaria->id); ?>" >
                                            <button class="btn btn-success"><i class="fa fa-pencil"></i></button>
                                        </a>

                                        <button class="btn btn-danger EliminarSecretaria" Sid="<?php echo e($secretaria->id); ?>" 
                                            Secretaria="<?php echo e($secretaria->name); ?>" ><i class="fa fa-trash"></i></button>

                                    </td>

                                </tr>
                                
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                        </tbody>

                    </table>

                </div>
                
            </div>


    </section>

</div>

<!--   modal para crear a las secretarias -->
<div id="CrearSecretaria" class="modal fade"> 

    <div class="modal-dialog"> 

        <div class="modal-content"> 

            <form method="POST">  

                <?php echo csrf_field(); ?>

                <div class="modal-body"> 

                    <div class="box-body"> 

                        <div class="form-group"> 

                            <h2> Nombre y Apellido:</h2>

                            <input type="text" class="form-control input-lg" name="name" required = "">

                        </div>
                        
                        <div class="form-group"> 

                            <h2> Email:</h2>

                            <input type="email" class="form-control input-lg" name="email" value="<?php echo e(old('email')); ?>" required = "">

                            <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                                <div class="alert alert-danger" >El email ya existe !!! </div>
                                
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>


                        </div>

                        <div class="form-group"> 

                            <h2> Contraseña:</h2>

                            <input type="text" class="form-control input-lg" name="password" required = "">

                        </div>                        

                    </div>

                </div>

                <div class="modal-footer"> 

                    <button type="submit" class="btn btn-primary">Crear </button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal" >Cerrar </button>

                </div>

            </form>

        </div>

    </div>

</div>

<!--   modal para editar a las secretarias -->
<div id="EditarSecretaria" class="modal fade"> 

    <div class="modal-dialog"> 

        <div class="modal-content"> 

            <form method="POST" action="<?php echo e(url('actulizar-secretaria/'. $secretaria->id)); ?>">  

                <?php echo csrf_field(); ?>
                <?php echo method_field('put'); ?>

                <div class="modal-body"> 

                    <div class="box-body"> 

                        <div class="form-group"> 

                            <h2> Nombre y Apellido:</h2>

                            <input type="text" class="form-control input-lg" name="name" value="<?php echo e($secretaria->name); ?>" required = "">

                        </div>
                        
                        <div class="form-group"> 

                            <h2> Email:</h2>

                            <input type="email" class="form-control input-lg" name="email" value="<?php echo e($secretaria->email); ?>" required = "">

                            <?php $__errorArgs = ['email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>

                                <div class="alert alert-danger" >El email ya existe !!! </div>
                                
                            <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>


                        </div>

                        <div class="form-group"> 

                            <h2>Nueva Contraseña:</h2>

                            <input type="text" class="form-control input-lg" name="passwordN">
                            <input type="hidden" name="password" value="<?php echo e($secretaria->password); ?>">

                        </div>                        

                    </div>

                </div>

                <div class="modal-footer"> 

                    <button type="submit" class="btn btn-success">Guardar Cambios </button>
                    <button type="button" class="btn btn-danger" data-dismiss="modal" >Cerrar </button>

                </div>

            </form>

        </div>

    </div>

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


<?php echo $__env->make('plantilla', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\Clinica-L8\resources\views/modulos/Secretarias.blade.php ENDPATH**/ ?>