jQuery(function($){

	$("#continuar").bind("click",function(event){
		abrirCopiarAltaPlanGDialog();
	});	

	$('.esNumero').on('input', function () { 
	    this.value = this.value.replace(/[^0-9]/g,'');
	});

	
	$("#CopiarPlanG").rup_table({	
		url: $.rup.CTX_PATH + "planesgestion/copiarplang",
		colNames: [
			"",
			$.rup.i18n.app.campos_tabla_planes_gestion["nombreEntidad"],
			$.rup.i18n.app.campos_tabla_planes_estrategicos["fechas"],
			$.rup.i18n.app.campos_tabla_planes_gestion["anyo"]
		],
		colModel: [
			{ 	name: "codplang",
				index: "CODPLANG",
				align: "left",
				width: 150,
				hidden: true,
				sortable: true
			},
			{ 	name: "planesEstrategicos.entidad.desentidad",
				index: "DESENTIDAD",
				align: "left",
				width: 150,
				hidden: false,
				sortable: true
			},
			{ 	name: "planesEstrategicos.anyos",
				index: "anyoinicio",
				align: "left",
				width: 80,
				hidden: false,
				sortable: true
			},
			{ 	name: "anyo",
				index: "ANYO",
				align: "left",
				width: 100,
				hidden: false,
				sortable: true
			}
        ],

        model:"PlanesGestion",
        usePlugins:[
			//"formEdit",
        	"feedback",
			"toolbar",
        	//"contextMenu",
        	"responsive",
        	"filter"
         	],
		primaryKey: "codplang",
		sortname: "CODPLANG",
		sortorder: "ASC",
		loadOnStartUp: true,
		feedback:{
			config:{
				block: false
			}
		},
		core:{
	    	showOperations:{
	    		"clone": false,
	    		"delete": false,
	    		"edit": false
	    	},
	    	operations:{
	    	  
	    	}
    	},
        formEdit:{
        	detailForm: "#CopiarPlanG_detail_div",
        	
        }
	});
	
	
	//$("#gbox_CopiarPlanE").css("width","700px");
	$("#CopiarPlanG_toolbar").css("display","none");
	$("#CopiarPlanG_pager_left").css("width","10px");
	
	
	function abrirCopiarAltaPlanGDialog(){
		 var selectedRow = ab39aUtils.tabla.getSelectedRow($("#CopiarPlanG"));
		 var codplang = selectedRow.codplang;
		 if(codplang!==undefined){
			ab39aUtils.util.bloquearInterfaz();
			$('#divCopiarAltaPlanG_Dialog').rup_dialog({
					title :$.rup.i18n.app.campos_tabla_planes_gestion['datosPlanGestion'],
					type: $.rup.dialog.AJAX, 
					url: ab39aUtils.util.setUrlNoCachePortalWar($.rup.CTX_PATH + "planesgestion/cargardetalleplang/"+codplang),
					autoOpen : true,
					closeOnEscape : true,
					modal : true,
					resizable : false,
					minWidth : 1600,
					minHeight : 300,
					ajaxOptions: {
						success: function (data, textStatus, XMLHttpRequest){
		
						},
						error: function (error){
						}
					},
					open: function(){
						
					},
					load: function(){
						ab39aUtils.util.desbloquearInterfaz();
					},
					close: function(event, ui) { 
						//ab39aUtils.util.desbloquearInterfaz();
					}
				});	
		 }
		
	}
	

});





