
      </div>
    </div>
    <!-- /#page-content-wrapper -->

  </div>
  <!-- /#wrapper -->

<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script src="js/particles.js"></script>
<script src="js/alerts.js"></script>
</body>

</html>

<script type="text/javascript">


//table
$(document).ready( function () {
    $('#Dtable').DataTable 
                ({
                    "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
					"filter": true,
                    "Paginate": true,
					"ordering": false,
                });
} );


$("#menu-toggle").click(function(e) {
  e.preventDefault();
  $("#wrapper").toggleClass("toggled");
});

//updtae alert
$("#success-alert").fadeTo(2000, 500).slideUp(500, function(){
    $("#success-alert").alert('close');
});


//delete modal
    $('#confirm-delete').on('show.bs.modal', function(e) {
        $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
    });

</script>
<script>
$(document).ready(function () {
    $('#flash-msg').delay(3000).fadeOut('slow');
});

$('#confirm-delete').on('show.bs.modal', function(e) {
    $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>

<script>
$(document).ready(function () {
    $('#flash-msg').delay(3000).fadeOut('slow');
});
</script>

<script>
$('#confirm-delete').on('show.bs.modal', function(e) {
    $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>
<script type="text/javascript">
$("#form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii:ss', autoclose:true});

$(document).ready(function () {
    $('#Dtable').DataTable
                ({
                    "lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
                    "filter": true,
                    "Paginate": true,
                    "ordering": true,
                    "searching": true,
                    "paging":   true,
                    "info":     true
                });
});

$("#menu-toggle").click(function(e) {
  e.preventDefault();
  $("#wrapper").toggleClass("toggled");
});

$("#success-alert").fadeTo(2000, 500).slideUp(500, function(){
    $("#success-alert").alert('close');
});

$('#confirm-delete').on('show.bs.modal', function(e) {
    $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
});
</script>
<style>
sorting {
    background-repeat: no-repeat;
    background-position: center right;
}
</style>

<?php
//createAlert(title, summary, details, severity, dismissible, autoDismiss, appendToId)
$success = "createAlert('','¡Éxito!','La operación se realizó correctamente.','success',true,true,'pageMessages');";
$danger = "createAlert('','¡Eliminado!','El registro fue eliminado correctamente.','danger',true,true,'pageMessages');";
$info = "createAlert('','Información','Bienvenido.','info',true,true,'pageMessages');";
$warning = "createAlert('','Advertencia','Debes completar todos los campos.','warning',true,true,'pageMessages');";
if(isset($_GET['status'])){
	if ($_GET['status'] == '1'){
		echo "<script>$success</script>";
	}elseif ($_GET['status'] == '2'){
		echo "<script>$danger</script>";
	}elseif ($_GET['status'] == '3'){
		echo "<script>$info</script>";
	}elseif ($_GET['status'] == '4'){
		echo "<script>$warning</script>";
	}
}
?>
<script>
    $(document).ready(function() {
        // Enviar recordatorio por WhatsApp
        $('.send-reminder').click(function(e) {
            e.preventDefault();
            
            var whatsapp = $(this).data('whatsapp');
            var name = $(this).data('name');
            var days = $(this).data('days');
            var expire = $(this).data('expire');
            
            // Formatear la fecha de expiración
            var expireDate = new Date(expire);
            var formattedDate = expireDate.toLocaleDateString('es-ES', { 
                weekday: 'long', 
                year: 'numeric', 
                month: 'long', 
                day: 'numeric' 
            });
            
            // Crear mensaje con emojis
            var message = `Hola *${name}* 👋,\n\n` +
                          `Te recordamos que tu suscripción está por vencer en *${days} día(s)* ⏳.\n\n` +
                          `📅 *Fecha de vencimiento:* ${formattedDate}\n\n` +
                          `Por favor, renueva tu servicio para evitar interrupciones. ¡Gracias! 😊`;
            
            // Codificar el mensaje para URL
            var encodedMessage = encodeURIComponent(message);
            
            // Abrir WhatsApp con el mensaje
            window.open(`https://wa.me/${whatsapp}?text=${encodedMessage}`, '_blank');
        });
        
        // Resto del código existente...
        $('#confirm-delete').on('show.bs.modal', function(e) {
            $(this).find('.btn-ok').attr('href', $(e.relatedTarget).data('href'));
        });
        
        document.getElementById('per_page').addEventListener('change', function() {
            this.form.submit();
        });
    });
</script>