$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
ieVersion();
var es_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if(es_firefox){
Mensaje();
}
calendarioPlazoLegal();
$("#subirArchivo").hide( "drop", { direction: "down" }, "slow" );
var formularioContactosAdicionals;
var formularioContactosPrincipal;
var formularioDatosPrincipal;
var NombreArchivoAudiencia;
var TipoPromovente;
var archivocargado = false;
createValidatorsContactosAdicionales();
createValidatorsContactosPrincipal();
createValidatorsDatosPrincipales();
obtenerHorariosProgramados();
horarios();
var textarea=document.getElementById("txtsPreguntas");
var caracteresPreguntas=document.getElementById("caracteresPreguntas");
textarea.oninput=function(e){
caracteresPreguntas.innerHTML=(1000-this.value.length);
}
var textarea=document.getElementById("txtsComentarios");
var caracteresComentarios=document.getElementById("caracteresComentarios");
textarea.oninput=function(e){
caracteresComentarios.innerHTML=(100-this.value.length);
}
var textarea=document.getElementById("txtsAsunto");
var caracteresAsunto=document.getElementById("caracteresAsunto");
textarea.oninput=function(e){
caracteresAsunto.innerHTML=(100-this.value.length);
}
$('#numeropermiso').hide();
$("#sujetorepr").hide();
$("#nombrenuevopermisionario").hide();
$("#nombrepermisionario").hide();
$('#tiporelacion').hide();
$("#sujetocalidad").hide();
$("#btnOtroAsistente").click(function(){
formularioContactosPrincipal.resetForm();
if (!formularioContactosPrincipal.form()) {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
}
$("#ModalContactAdicional").modal("show");
});
createValidatorsContactosAdicionales();
$("#btnGuardarContacto").click(function(event){
formularioContactosAdicionals.resetForm();
if (!formularioContactosAdicionals.form()) {
return;
}
var Nombre = $('#txtcNombre').val();
var Apellidos = $('#txtcApellidos').val();
var Mail = $('#txtcMail').val();
var TelefonoDirecto = $('#txtcTelefonoDirecto').val();
var TelefonoMovil = $('#txtcTelefonoMovil').val();
var Conmutador = $('#txtcConmutador').val();
var Extension = $('#txtcExtension').val();
var Cargo = $('#txtcCargo').val();
var Empresa = $('#txtcEmpresa').val();
addTableRow($("#tblDatosContactoAdicional"),Nombre,Apellidos,Mail,TelefonoDirecto,TelefonoMovil,Conmutador,Extension,Cargo,Empresa);
$("#ModalContactAdicional").modal("hide");
$("#btnOtroAsistente").hide();
$(".br").hide();
});
function addTableRow(jQtable,Nombre,Apellidos,
Mail,TelefonoDirecto,TelefonoMovil,Conmutador,Extension,Cargo,Empresa){
jQtable.each(function(){
var $table = $(this);
$table.append('
'+Nombre+' | '+Apellidos+
' | '+Mail+' | '+TelefonoDirecto+
' | '+TelefonoMovil+' | '+Conmutador+' | '+Extension+' | '+Cargo+
' | '+Empresa+' |
');
});
}
function createValidatorsContactosAdicionales() {
formularioContactosAdicionals = $('#formContactosAdicional').uValidate({
rules: {
txtcNombre: { required: true},
txtcApellidos: { required: true},
txtcMail: { required: true},
txtcTelefonoDirecto: { required: true, minlength: 10},
txtcTelefonoMovil: { required: true, minlength: 10},
txtcConmutador: { required: true},
txtcExtension: { required: true},
txtcCargo: { required: true},
txtcEmpresa: { required: true}
}
});
}
function createValidatorsContactosPrincipal() {
formularioContactosPrincipal = $('#formContatoPrincipal').uValidate({
rules: {
txtpNombre: { required: true},
txtpApellidos: { required: true},
txtpMail: { required: true},
txtpTelefonoDirecto: { required: true, minlength: 10},
txtpTelefonoMovil: { required: true, minlength: 10},
txtpConmutador: { required: true},
txtpExtension: { required: true},
txtpCargo: { required: true},
txtpEmpresa: { required: true},
txtNumeroPermiso: { required: function(){
if ($('#titularpermiso').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
txtSujetoRepr: { required: function(){
if ($('#representante').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
txtTipoRelacion: {required: function(){
if ($('#titularpermiso').prop('checked') || $('#solicitantepermiso').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
txtNombreNuevoPermisionario: {required: function(){
if ($('#solicitantepermiso').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
txtNombrePermisionario: {required: function(){
if ($('#titularpermiso').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
txtSujetoCalidad: { required: function(){
if ($('#representante').prop('checked'))
{
return true;
}
else
{
return false;
}
}
},
atencion: { required: true}
}
});
}
function createValidatorsDatosPrincipales() {
formularioDatosPrincipal = $('#formDatosPrincipales').uValidate({
rules: {
sSeleccionCombo: { required: true},
txtsAsunto: { required: true},
txtsPreguntas: { required: true}
}
});
}
function InabilitarDias(date)
{
var day = date.getDay();
return [(day != 0 && day != 1 && day != 3 && day != 6), ''];
}
function calendarioPlazoLegal(){
var dateToday = new Date();
$('#FechaPlazoLegal').datepicker({
minDate: dateToday,
beforeShowDay: InabilitarDias,
onSelect: function(dateText, inst) {
$("#subirArchivo").show( "fold", 1000 );
}
});
}
function convertDate(inputFormat) {
function pad(s) { return (s < 10) ? '0' + s : s; }
if (typeof (inputFormat) === "string") {
return [inputFormat.split('/')[2], inputFormat.split('/')[1], inputFormat.split('/')[0]].join('/');
}
else {
return [pad(inputFormat.getDate()), pad(inputFormat.getMonth() + 1), inputFormat.getFullYear()].join('/');
}
}
function CreateSelect(Horas, selector)
{
var option = '';
for (var i=0;i' + Horas[i].name + '';
}
$(selector).append(option);
}
function RegistrarAudiencia(objeto)
{
$.ajax({
type: 'POST',
url: 'https://api-documento.cre.gob.mx/api/Audiencias/Post_RegistrarAudiencia/',
data:objeto,
dataType: 'json',
})
.done(function (_resultado, textStatus, jqXHR) {
if (_resultado != null && _resultado != 0) {
var Nombre = ""+($("#txtpNombre").val())+ " "+($("#txtpApellidos").val());
var Mail = $("#txtpMail").val();
var Cargo = $("#txtpCargo").val();
var Empresa = $("#txtpEmpresa").val();
var Participantes = $('#txtsParticipantes').val();
var Tema = $("#txtsAsunto").val();
var preguntas = $("#txtsPreguntas").val();
var comentarios = $("#txtsComentarios").val();
var TelefonoDirecto = $('#txtpTelefonoDirecto').val();
var TelefonoMovil = $('#txtpTelefonoMovil').val();
var fechaI = convertDate($("#fechaTentativaI").text())+ " " +($("#horaTentativaI").text());
var fechaII = convertDate($("#fechaTentativaII").text())+ " " +($("#horaTentativaII").text());
var sector = $("#sSeleccionCombo").val();
GuardarFechasTentativas(_resultado);
if(_resultado == null || _resultado <= 0)
{
$("#ErrorRegistro").fadeIn();
setTimeout(function(){
$("#ErrorRegistro").fadeOut()
}, 5000);
return
}
else
{
EnviarCorreo(Nombre,_resultado,Mail,Cargo,Empresa,sector);
EnviarCorreoInterno(Nombre,Cargo,Empresa,Tema,comentarios,preguntas,_resultado,Mail,TelefonoMovil,TelefonoDirecto,sector)
}
$("#exitoGeneral").fadeIn();
setTimeout(function(){
$("#exitoGeneral").fadeOut()
}, 4000);
}
else
{
$("#ErrorRegistro").fadeIn();
setTimeout(function(){
$("#ErrorRegistro").fadeOut()
}, 5000);
return
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 3000);
})
.always(function (jqXHR, textStatus, errorThrown) {
});
setTimeout(function(){window.location.replace("https://organodegobierno.cre.gob.mx/Solicitud/Audiencias/Default.html"); }, 10000); //Ruta que actualiza la página después de registrar audiencia
}
$("#btnEnviarSolicitud").click(function(){
if(($("#FechaPlazoLegal").val() != null && $("#FechaPlazoLegal").val() != '') && !archivocargado){
$("#ErrorFechaPlazo").fadeIn();
setTimeout(function(){
$("#ErrorFechaPlazo").fadeOut()
}, 5000);
return
}
else if(($("#FechaPlazoLegal").val() == null || $("#FechaPlazoLegal").val() == '') && archivocargado){
$("#ErrorFechaPlazoLegal").fadeIn();
setTimeout(function(){
$("#ErrorFechaPlazoLegal").fadeOut()
}, 5000);
return
}
else{
var primeraFechaSolicitud = ($("#fechaTentativaI").text() + $("#horaTentativaI").text());
var segundaFechaSolicitud = ($("#fechaTentativaII").text() + $("#horaTentativaII").text());
console.log('Primera fecha = ' + primeraFechaSolicitud + ' Segunda Fecha: ' + segundaFechaSolicitud);
if(primeraFechaSolicitud.length > 0 && primeraFechaSolicitud != ' ' && primeraFechaSolicitud != '' && segundaFechaSolicitud.length > 0 && segundaFechaSolicitud != ' ' && segundaFechaSolicitud != '') {
formularioContactosPrincipal.resetForm();
if (!formularioContactosPrincipal.form()) {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
}
formularioDatosPrincipal.resetForm();
if (!formularioDatosPrincipal.form()) {
$("html, body").animate({ scrollTop: 1140 }, "slow");
return false;
}
var adicional = $('#tblDatosContactoAdicional').tableToJSON();
var inciales = {
Nombre: $("#txtpNombre").val(),
Apellidos: $("#txtpApellidos").val(),
Mail: $("#txtpMail").val(),
Telefono: $("#txtpTelefonoDirecto").val(),
Movil: $("#txtpTelefonoMovil").val(),
Conmutador: $("#txtpConmutador").val(),
Extension: $("#txtpExtension").val(),
Cargo: $("#txtpCargo").val(),
Empresa: $("#txtpEmpresa").val(),
TipoSolicitanteId: 1,
TipoPromovente: TipoPromovente,
NombrePermisionario: $('#txtNombrePermisionario').val() + ' ' + $("#txtNombreNuevoPermisionario").val(),
};
adicional.push(inciales);
var oResultado =
{
Participantes: $('#txtsParticipantes').val(),
FechaPlazoLegal: $("#FechaPlazoLegal").val(),
Tema: $("#txtsAsunto").val(),
NumeroEntidad: $("#txtNumeroPermiso").val() + '_' + $("#txtnumeroturnoficio").val(),
Preguntas: $("#txtsPreguntas").val(),
SujetoRepr: $("#txtSujetoRepr").val() + ' ' + $("#txtSujetoCalidad").val(),
Comentarios: $("#txtsComentarios").val(),
EstadoAudiencia: 1,
SectorName: $("#sSeleccionCombo").val(),
solicitante: adicional,
TipoRelacion: $("#txtTipoRelacion").val(),
ArchivoJustificacionAzure: NombreArchivoAudiencia
};
RegistrarAudiencia(oResultado);
}
else
{
$("#alertSeleccionHorario").fadeIn();
setTimeout(function(){
$("#alertSeleccionHorario").fadeOut()
}, 3000);
}
return
}
});
function EnviarCorreo(nombre,folio,Mail,cargo,empresa,sector)
{
var FechaI = convertDate($("#fechaTentativaI").text())+ " " +($("#horaTentativaI").text());
var FechaII = convertDate($("#fechaTentativaII").text())+ " " +($("#horaTentativaII").text());
var dataSend = {
SistemaId: 3,
TipoProceso: 2,
Correo: {
BovedaRefId: (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase(),
IdPlantilla: 14,
Destinatarios: Mail,
DestinatariosCC: "",
DestinatariosCCO: "",
Asunto: "Registro de nueva audiencia",
Remitente: "avisosti@cre.gob.mx",
NotificarOrigen: false,
ContenidoJson: { "folio": folio, "nombre": nombre, "FechaI": FechaI, "FechaII": FechaII, "cargo": cargo, "empresa": empresa, "sector": sector }
}
}
var settings = {
"url": "https://plantillaelectronica-dev.azurewebsites.net/api/plantilla/enviar",
"method": "POST",
"headers": {
"content-type": "application/json",
"cache-control": "no-cache",
},
"processData": false,
"data": JSON.stringify(dataSend)
}
$.ajax(settings).done(function (response) {
console.log(response);
});
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
}
function EnviarCorreoInterno(Nombre,Cargo,Empresa,Tema,Comentarios,preguntas,folio,Mail,TelefonoMovil,TelefonoDirecto,sector)
{
var FechaI = convertDate($("#fechaTentativaI").text())+ " " +($("#horaTentativaI").text());
var FechaII = convertDate($("#fechaTentativaII").text())+ " " +($("#horaTentativaII").text());
var dataSend = {
SistemaId : 3,
TipoProceso : 2,
Correo:{
BovedaRefId : (S4() + S4() + "-" + S4() + "-4" + S4().substr(0, 3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase(),
IdPlantilla : 12,
Destinatarios : "jrecillas@cre.gob.mx", //"cdrueda@cre.gob.mx, ccamacho@cre.gob.mx, aobregon@cre.gob.mx, azarza@cre.gob.mx, jhneri@cre.gob.mx",
DestinatariosCC: "",
DestinatariosCCO: "",
Asunto : "Registro de nueva audiencia",
Remitente : "avisosti@cre.gob.mx",
NotificarOrigen : false,
ContenidoJson : {"folio": folio, "nombre":Nombre, "cargo":Cargo, "empresa":Empresa, "tema":Tema, "comentarios":Comentarios, "preguntas":preguntas, "FechaI":FechaI,"FechaII":FechaII, "TelefonoMovil":TelefonoMovil, "TelefonoDirecto":TelefonoDirecto, "Mail":Mail, "sector":sector}
}
}
var settings = {
"url": "https://plantillaelectronica-dev.azurewebsites.net/api/plantilla/enviar",
"method": "POST",
"headers": {
"content-type": "application/json",
"cache-control": "no-cache",
},
"processData": false,
"data": JSON.stringify(dataSend)
}
$.ajax(settings).done(function (response) {
console.log(response);
});
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
$("main input, main select, main textarea").val("");
$("#fechaTentativaI, #horaTentativaI, #fechaTentativaII, #horaTentativaII").text("");
$('#tblDatosContactoAdicional tr').each(function (i, e) { if(i !== 0 ) $(e).remove(); } );
formularioContactosPrincipal.resetForm();
formularioContactosAdicionals.resetForm();
formularioDatosPrincipal.resetForm();
}
$("#btnSubirArchivo").click(function () {
var fileInput = document.getElementById('fileAudiencia');
var nombreSistema = $("#nombreSistema").val();
var urlBase ='https://cre-boveda-des.azurewebsites.net/';
//do nothing if there's no files
if (fileInput.files.length === 0) return;
var file = fileInput.files[0];
var payload = new FormData();
payload.append("NombreOriginal",file.name );
payload.append("file", file);
var archivo = file.name;
var extension = archivo.substring(archivo.lastIndexOf('.') + 1).toLowerCase();
if (extension != "pdf")
{
$("#errorExtensionArchivo").fadeIn();
setTimeout(function(){
$("#errorExtensionArchivo").fadeOut()
}, 3000);
}
else{
$.ajax({
url: urlBase + 'api/DocumentoPortal/Cargar',
data: payload,
processData: false,
contentType: false,
type: 'POST',
success: function (data) {
NombreArchivoAudiencia = data.message;
archivocargado = true;
// $("#nombreSistema").val(data.message);
$("#cargaextiosa").fadeIn();
setTimeout(function(){
$("#cargaextiosa").fadeOut()
}, 3000);
},
});
}
});
//SCRIPTS CALENDARIO
var day;
var oldDay;
var fTentativa;
var hTentativo;
var fechasDeshabilitadas = [];
var fechaFormateada;
var fechaLista;
var fechaDeshabilitadoNuevoArreglo;
function obtenerHorariosProgramados() {
$.ajax({
type: 'GET',
url: 'https://api-documento.cre.gob.mx/api/Audiencias/Get_HorariosProgramados',
dataType: 'json',
beforeSend: function () { $('#response').text('Cargando...')},
})
.done(function (data, textStatus, jqXHR) {
if (data != null && data.length != 0)
for (var i = 0; i < data.length; i++) {
fechasDeshabilitadas.push(data[i].Fecha);
}
calendario();
$("html, body").animate({ scrollTop: 0 }, 0);
})
.fail(function (jqXHR, textStatus, errorThrown) {
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 3000);
});
};
function calendario() {
var fechaDefault = new Date();
var maxDate = new Date();
maxDate.setDate(fechaDefault.getDate()+2);
var fotmatDate = moment(fechaDefault).format("YYYY-MM-DD")
var calendarioAudiencias = $('#datetimepicker12').datetimepicker({
daysOfWeekDisabled: [0, 1, 6],
disabledDates: fechasDeshabilitadas,
defaultDate: fotmatDate,
minDate: moment().format("YYYY-MM-DD"),
format: 'DD/MM/YYYY',
locale: 'es-MX',
keepOpen: true,
inline: true,
debug: true,
//sideBySide: false,
});
fTentativa = $('#datetimepicker12').val();
// fTentativa = $('#datetimepicker12').text();
$.ajax({
type: 'GET',
url: 'https://api-documento.cre.gob.mx/api/Audiencias/Get_HorarioBloqueado/?Fecha=' +fotmatDate,
dataType: 'json',
beforeSend: function () { $('#response').text('Cargando...')},
})
.done(function (data, textStatus, jqXHR) {
day = fechaDefault.getDay();
if (day == 5) {
$("#mrts").fadeOut(0);
$("#jvs").fadeOut(0);
$("#vrns").fadeIn(0);
if(oldDay != day)
{
$('#horarioSeleccionado').val('');
$('input[name=radio-info]').prop('checked', false);
}
}
if (day != 5) {
$("#vrns").fadeOut(0);
$("#mrts").fadeIn(0);
$("#jvs").fadeIn(0);
if (oldDay == 5) {
$('#horarioSeleccionado').val('');
$('input[name=radio-info]').prop('checked', false);
}
}
if (data.aaData.length != 0){
for (var i = 0; i < data.aaData.length; i++) {
if ((data.aaData[i].Horarios) == "10:00 - 11:00") {
$("#jvs").fadeOut(0);
} else if ((data.aaData[i].Horarios) == "11:00 - 12:00") {
$("#vrns").fadeOut(0);
} else {
$("#mrts").fadeOut(0);
}
}
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
$("#errorGeneral").fadeIn(0);
setTimeout(function(){
$("#errorGeneral").fadeOut(0)
}, 3000);
});
};
$("#datetimepicker12").on("dp.change", function (e) {
$('#horarioSeleccionado').val("");
var date = e.date._d;
var fotmatDate = moment(date).format("YYYY-MM-DD")
console.log(fotmatDate);
$.ajax({
type: 'GET',
url: 'https://api-documento.cre.gob.mx/api/Audiencias/Get_HorarioBloqueado/?Fecha=' + fotmatDate,
dataType: 'json',
})
.done(function (data, textStatus, jqXHR) {
if (data.aaData.length != 0)
for (var i = 0; i < data.aaData.length; i++) {
if ((data.aaData[i].Horarios) == "10:00 - 11:00") {
$("#jvs").fadeOut(0);
} else if ((data.aaData[i].Horarios) == "11:00 - 12:00") {
$("#vrns").fadeOut(0);
} else {
$("#mrts").fadeOut(0);
}
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 3000);
});
var olddate;
if (e.oldDate == null) {
olddate = 'pez';
}
else {
olddate = e.oldDate;
oldDay = olddate._d.getDay();
}
day = date.getDay();
if (day == 4 || day == 5) {
console.log("asdasdasdasd");
$("#mrts").fadeOut(0);
$("#jvs").fadeOut(0);
$("#vrns").fadeIn(0);
$('input[name=radio-info]').prop('checked', false);
if(oldDay != day)
{
$('#horarioSeleccionado').val('');
$('input[name=radio-info]').prop('checked', false);
}
}
if (day == 0 || day == 1 || day == 2 || day == 3 || day == 6) {
console.log(day);
$("#exth").fadeOut(0);
if (fotmatDate === '2022-05-04') {
$("#jvs").fadeOut(0);
$("#vrns").fadeOut(0);
$("#mrts").fadeOut(0);
$("#exth").fadeIn(0);
}else{
$("#vrns").fadeOut(0);
$("#mrts").fadeIn(0);
$("#jvs").fadeIn(0);
$('input[name=radio-info]').prop('checked', false);
}
if (oldDay == 5) {
$('#horarioSeleccionado').val('');
$('input[name=radio-info]').prop('checked', false);
}
}
fTentativa = $('#datetimepicker12').val();
});
function horarios() {
$("input[name='radio-info']").change(function (e) {
var horarioSeleccionado = $('input[name=radio-info]:checked').val();
$('#horarioSeleccionado').val(horarioSeleccionado);
hTentativo = $('#horarioSeleccionado').val();
});
};
$('#cmdAnadirFechaAudienciaI').on('click', function () {
añadirFechaI();
});
$('#cmdAnadirFechaAudienciaII').on('click', function () {
validacionFechasDiferentes();
});
function añadirFechaI() {
if ($("#datetimepicker12").val().length == 0 || $("#horarioSeleccionado").val().length == 0)
{
$("#alertSeleccionHorario").fadeIn();
setTimeout(function(){
$("#alertSeleccionHorario").fadeOut()
}, 3000);
return
}
$("#fechaTentativaI").html(fTentativa);
$("#horaTentativaI").html(hTentativo);
$("#fechaTentativaII").html('');
$("#horaTentativaII").html('');
};
function añadirFechaII() {
if ($("#datetimepicker12").val().length == 0 || $("#horarioSeleccionado").val().length == 0) {
$("#alertSeleccionHorario").fadeIn(0);
setTimeout(function(){
$("#alertSeleccionHorario").fadeOut(0)
}, 3000);
return
}
$("#fechaTentativaII").html(fTentativa);
$("#horaTentativaII").html(hTentativo);
};
function getWeekNumber(d) {
// Copy date so don't modify original
d = new Date(+d);
d.setHours(0, 0, 0, 0);
// Set to nearest Thursday: current date + 4 - current day number
// Asegurar que el domingo es el día 7
d.setDate(d.getDate() + 4 - (d.getDay() || 7));
// Get first day of year
var yearStart = new Date(d.getFullYear(), 0, 1);
// Calculate full weeks to nearest Thursday
var weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
// Return array of year and week number
return [d.getFullYear(), weekNo];
};
function validacionFechasDiferentes() {
getWeekNumber();
var o = moment(convertDate($("#fechaTentativaI").text()));
var p = moment(convertDate(fTentativa));
var primeraSemana = getWeekNumber(o);
var segundaSemana = getWeekNumber(p);
if (primeraSemana[0] == segundaSemana[0] && primeraSemana[1] == segundaSemana[1])
{
$("#alertFechaSemana").fadeIn();
setTimeout(function(){
$("#alertFechaSemana").fadeOut()
}, 3000);
} else {
añadirFechaII();
}
};
$('#cmdGuardarCalendarioAudiencia').on('click', function () {
GuardarFechasTentativas();
})
function GuardarFechasTentativas(AudienciaId) {
var primeraFecha = $("#fechaTentativaI").text();
var segundaFecha = $("#fechaTentativaII").text();
console.log(primeraFecha + segundaFecha);
if(primeraFecha.length <= 1 && primeraFecha == ''){
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 3000);
return
}
if(segundaFecha.length <= 1 && segundaFecha == ''){
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 3000);
return
}
var oData = [{
Fecha: convertDate($("#fechaTentativaI").text()),
HorarioDescripcion:$("#horaTentativaI").text(),
TipoFechaDescripcion: 'Alternativa 1'
}];
var oDataII = [{
Fecha: convertDate($("#fechaTentativaII").text()),
HorarioDescripcion: $("#horaTentativaII").text(),
TipoFechaDescripcion: 'Alternativa 2'
}];
oData = oData.concat(oDataII);
var objeto = {
AudienciaId: AudienciaId,
Fechas: oData
};
$.ajax({
type: 'POST',
url: 'https://api-documento.cre.gob.mx/api/Audiencias/Post_RegistrarProgramacionAudiencia',
dataType: 'json',
data: objeto
})
.done(function (data, textStatus, jqXHR) {
$("#exitoGeneral").fadeIn();
setTimeout(function(){
$("#exitoGeneral").fadeOut()
}, 4000);
})
.fail(function (jqXHR, textStatus, errorThrown) {
$("#errorGeneral").fadeIn();
setTimeout(function(){
$("#errorGeneral").fadeOut()
}, 4000);
});
};
$("#txtpTelefonoDirecto").keypress(function (e) {
var expresion = /^\d+$/;
var valor = e.key;
if(!expresion.test(valor)){
e.preventDefault();
return;
}
});
$("#txtpTelefonoMovil").keypress(function (e) {
var expresion = /^\d+$/;
var valor = e.key;
if(!expresion.test(valor)){
e.preventDefault();
return;
}
});
$("#solicitantepermiso").on("change", function (){
$("#numeropermiso").hide();
$("#sujetorepr").hide();
$("#nombrepermisionario").hide();
$("#sujetocalidad").hide();
$("#nombrenuevopermisionario").show();
$('#tiporelacion').show();
$("#titularpermiso").prop('checked', false);
$("#representante").prop('checked', false);
$("#organismos").prop('checked', false);
TipoPromovente = 1;
});
$("#titularpermiso").on("change", function () {
$("#numeropermiso").show();
$("#nombrepermisionario").show();
$('#tiporelacion').show();
$("#sujetorepr").hide();
$("#nombrenuevopermisionario").hide();
$("#sujetocalidad").hide();
$("#solicitantepermiso").prop('checked', false);
$("#representante").prop('checked', false);
$("#organismos").prop('checked', false);
TipoPromovente = 2;
});
$("#representante").on("change", function () {
$("#sujetorepr").show();
$("#sujetocalidad").show();
$("#numeropermiso").hide();
$("#nombrenuevopermisionario").hide();
$("#nombrepermisionario").hide();
$('#tiporelacion').hide();
$("#solicitantepermiso").prop('checked', false);
$("#titularpermiso").prop('checked', false);
$("#organismos").prop('checked', false);
TipoPromovente = 3;
});
$("#organismos").on("change", function () {
$("#numeropermiso").hide();
$("#nombrenuevopermisionario").hide();
$("#nombrepermisionario").hide();
$('#tiporelacion').hide();
$("#sujetorepr").hide();
$("#sujetocalidad").hide();
$("#solicitantepermiso").prop('checked', false);
$("#titularpermiso").prop('checked', false);
$("#representante").prop('checked', false);
TipoPromovente = 4;
});
$('#datetimepicker12').css("cursor", "pointer");
//Hace invisible el "input blinking cursor"
$('#datetimepicker12').css({ "color": "transparent", "text-shadow": "0 0 0 #000" });
//Evita que capturen con el teclado
$('#datetimepicker12').on("keydown", function (e) {
e.preventDefault();
return;
});
function ieVersion() {
var ua = window.navigator.userAgent;
if (ua.indexOf("Trident/7.0") > 0)
Mensaje();
else if (ua.indexOf("Trident/6.0") > 0)
Mensaje();
else if (ua.indexOf("Trident/5.0") > 0)
Mensaje();
else if (ua.indexOf("Trident/4.0") > 0)
Mensaje();
else if (ua.indexOf("MSIE 7") > 0)
Mensaje();
else if (ua.indexOf("MSIE 6") > 0)
Mensaje();
else if (ua.indexOf("Edge/") > 0)
Mensaje();
else {
//$.uAlert({ title: "AVISO IMPORTANTE",
// message: "AVISO IMPORTANTE AUDIENCIA
A continuación accederá a un formato de solicitud para uso exclusivode personas que representen los intereses de los sujetos regulados de acuerdo con el artículo 13 de la Ley de los Órganos Reguladores Coordinados en Materia Energética.
Audiencia: Es el acto por el que la autoridad escucha a las personas que acuden a ella.
Se recomienda una audiencia cuando el tema sea referente a: barreras de entrada; barreras de competencia; inversión; asuntos no atendidos por staff; nuevos proyectos.
Días y horarios de atención de AUDIENCIAS: Martes y Jueves de 10:00 a 11:00 y 17:00 a 18:00 hrs. Viernes de 11:00 a 12:00 hrs.
Aviso de Privacidad
Es necesario usar el navegador Google Chrome para poder procesar su audiencia",
// buttons: {
// confirm: {
// text: "Continuar",
// className: "btn btn-primary"
// },
// cancel: {
// text: "Regresar",
// className: "btn btn-default"
// }
// }
// },
// function (argument) { } ,
// function (argument) { window.location.replace("https://www.gob.mx/cre"); }
//);
}
}
function Mensaje() {
$.uAlert({ title: "¡Atención!",
message: "Utilice Google Chrome para procesar su solicitud, de otra manera no garantizamos el correcto registro de la solicitud",
buttons: {
confirm: {
text: "Entendido",
className: "btn btn-primary"
}
}
},
function (argument) { window.location.replace("https://www.gob.mx/cre"); }
);
}
});
///A continuación accederá a un formato de solicitud para uso exclusivode personas que representen los intereses de los sujetos regulados de acuerdo con el artículo 13 de la Ley de los Órganos Reguladores Coordinados en Materia Energética.
Audiencia: Es el acto por el que la autoridad escucha a las personas que acuden a ella.
Se recomienda una audiencia cuando el tema sea referente a: barreras de entrada; barreras de competencia; inversión; asuntos no atendidos por staff; nuevos proyectos.
Días y horarios de atención de AUDIENCIAS: Martes y Jueves de 10:00 a 11:00 y 17:00 a 18:00 hrs. Viernes de 11:00 a 12:00 hrs.
Aviso de Privacidad
Es necesario usar el navegador Google Chrome para poder procesar su audiencia