chore: version inicial del codigo fuente del LMS Estafeta
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<section class="py-md-4 py-2">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h1 class="text-secondary font-weight-bolder">Licencia</h1>
|
||||
<p>Apartado solo para el Aministrador para modificar el límite de usuarios que se pueden registrar en la plataforma en perfil de Manager.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="py-md-4 py-2 controller">
|
||||
<div class="container">
|
||||
<div class="row align-items-center align-self-center">
|
||||
<div class="col-12 text-left my-4">
|
||||
<h3 class="title-cat edit" style="display: none;">Editar límite</h3>
|
||||
<h3 class="title-cat crear" style="display: none;">Crear límite</h3>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-12">
|
||||
<form class="formlimite" autocomplete="off">
|
||||
<input type="hidden" name="idlicencia" id="idlicencia">
|
||||
<div class="form-group row">
|
||||
<label class="col-md-2 col-12 col-form-label" for="cantidad">Límite de usuarios</label>
|
||||
<div class="col-lg-8 col-md-8 col-12">
|
||||
<input id="cantidad" name="cantidad" value="10" placeholder="Límite de usuarios" type="number" class="form-control" required="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row justify-content-center">
|
||||
<div class="col-12 col-md-6 text-right">
|
||||
<!--<div class="btn btn-warning btn_cancelar">Cancelar</div> -->
|
||||
<button name="Enviar" type="submit" value="Enviar" class="btn btn-primary">Enviar</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".layer-load").show();
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
function parseJSON(resp) {
|
||||
if (resp == null) return null;
|
||||
if (typeof resp === 'object') return resp;
|
||||
try { return JSON.parse(resp); }
|
||||
catch (e) { console.error('Respuesta no-JSON del servidor:', String(resp).substring(0, 300)); return null; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
Limite();
|
||||
/**********************************************************************/
|
||||
/***************************** OBTENER LÍMITE *************************/
|
||||
/**********************************************************************/
|
||||
function Limite(){
|
||||
|
||||
$.ajax({
|
||||
url: 'usuarios_statistical.php'
|
||||
})
|
||||
.done(function (response) {
|
||||
var _data = parseJSON(response);
|
||||
if (_data.code == "200") {
|
||||
$('#cantidad').val(_data.limite.limite);
|
||||
$('#idlicencia').val(_data.limite.idlicencia);
|
||||
$('.edit').show();
|
||||
$('.crear').hide();
|
||||
}else{
|
||||
$('.crear').show();
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
//console.log("error");
|
||||
})
|
||||
.always(function () {
|
||||
//console.log("complete");
|
||||
});
|
||||
}
|
||||
/**********************************************************************/
|
||||
/***************************** ACTUALIAR LÍMITE ***********************/
|
||||
/**********************************************************************/
|
||||
$(".formlimite").validate({
|
||||
submitHandler: function (form) {
|
||||
var licencia = 'licencia_update.php';
|
||||
if ($(".crear").css("display") == "block") {
|
||||
licencia = 'licencia_add.php';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: licencia,
|
||||
type: 'POST',
|
||||
data: $(".formlimite").serializeArray(),
|
||||
})
|
||||
.done(function (response) {
|
||||
var _data = parseJSON(response);
|
||||
|
||||
Swal.fire({
|
||||
html: _data.msg,
|
||||
icon: _data.icon,
|
||||
onBeforeOpen: function () {},
|
||||
onOpen: function () {},
|
||||
onRender: function () {},
|
||||
onClose: function () {
|
||||
Limite();
|
||||
},
|
||||
onAfterClose: function () {}
|
||||
});
|
||||
|
||||
})
|
||||
.fail(function () {
|
||||
//console.log("error");
|
||||
})
|
||||
.always(function () {
|
||||
//console.log("complete");
|
||||
});
|
||||
},
|
||||
rules: {
|
||||
cantidad: {
|
||||
required: true,
|
||||
maxlength: 254,
|
||||
minlength: 2,
|
||||
number: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
cantidad: {
|
||||
required: "Límite de usuarios requerido"
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user