root/controlies/www/groups/index.html @ 73
61 | manumora | ||
70 | manumora | <!-- Libreria Multiselect -->
|
|
<link type="text/css" href="js/multiselect2/css/ui.multiselect.css" rel="stylesheet" />
|
|||
<script type="text/javascript" src="js/multiselect2/plugins/localisation/jquery.localisation-min.js"></script>
|
|||
<script type="text/javascript" src="js/multiselect2/plugins/scrollTo/jquery.scrollTo-min.js"></script>
|
|||
<script type="text/javascript" src="js/multiselect2/ui.multiselect.js"></script>
|
|||
61 | manumora | ||
72 | manumora | <!-- Libreria Facebook -->
|
|
<link rel="stylesheet" href="js/fcbkcomplete/style.css" type="text/css" media="screen" title="Test Stylesheet" charset="utf-8" />
|
|||
<script src="js/fcbkcomplete/fcbkcomplete.js" type="text/javascript" charset="utf-8"></script>
|
|||
61 | manumora | <script language="javascript">
|
|
$(function() {
|
|||
$("#dialog-confirm").dialog({ autoOpen: false });
|
|||
$("#dialog-alert").dialog({ autoOpen: false });
|
|||
});
|
|||
function print_grid(){
|
|||
$("#list").jqGrid({
|
|||
url:'groups?action=list',
|
|||
mtype: 'POST',
|
|||
datatype: "json",
|
|||
colNames:['Tipo Grupo','Nombre','ID Grupo'],
|
|||
colModel:[
|
|||
69 | manumora | {name:'type',index:'type', width:60, align:"center", stype:'select', editoptions:{value:":Todo;Departamento:Departamentos;Curso:Cursos"}},
|
|
61 | manumora | {name:'cn',index:'cn', width:80, align:"center"},
|
|
{name:'gidNumber',index:'gidNumber', width:60, align:"center"}
|
|||
],
|
|||
rowNum:25,
|
|||
height:335,
|
|||
width: 800,
|
|||
rowList:[25,50,75],
|
|||
pager: '#pager',
|
|||
sortname: 'cn',
|
|||
autowidth: false,
|
|||
viewrecords: true,
|
|||
sortorder: "desc",
|
|||
caption:"Grupos"
|
|||
});
|
|||
$("#list").jqGrid('navGrid','#pager',{add:false,edit:false,del:false,search:false,refresh:false});
|
|||
$("#list").jqGrid('navButtonAdd','#pager',{
|
|||
caption: "Insertar",
|
|||
buttonicon :'ui-icon-plus',
|
|||
onClickButton : function (){
|
|||
69 | manumora | addRecord();
|
|
61 | manumora | }
|
|
});
|
|||
$("#list").jqGrid('navButtonAdd','#pager',{
|
|||
caption: "Modificar",
|
|||
buttonicon :'ui-icon-pencil',
|
|||
onClickButton : function (){
|
|||
69 | manumora | modifyRecord();
|
|
61 | manumora | }
|
|
});
|
|||
$("#list").jqGrid('navButtonAdd','#pager',{
|
|||
caption: "Borrar",
|
|||
buttonicon :'ui-icon-trash',
|
|||
onClickButton : function (){
|
|||
deleteRecord();
|
|||
}
|
|||
});
|
|||
$("#list").jqGrid('filterToolbar');
|
|||
}
|
|||
function rowSelected(){
|
|||
var id = $("#list").jqGrid('getGridParam','selrow');
|
|||
if( id == null ){
|
|||
$( "#dialog-alert" ).dialog({
|
|||
resizable: false,
|
|||
height:150,
|
|||
width:290,
|
|||
modal: true,
|
|||
buttons: { "Aceptar": function() { $( this ).dialog( "close" ); }}
|
|||
}).dialog('open');
|
|||
return false;
|
|||
}
|
|||
return id;
|
|||
}
|
|||
69 | manumora | function addRecord(){
|
|
$("#dialog-form").html("");
|
|||
$("#dialog-form").load("groups/form.html", function() {
|
|||
$("#form_data #action").val("add");
|
|||
$("#form_data #messageForm").html("Todos los campos son obligatorios");
|
|||
});
|
|||
x = ($(window).width()-250)/2;
|
|||
y = ($(window).height()-400)/2;
|
|||
$("#dialog-form").dialog({
|
|||
resizable: false,
|
|||
position: top,
|
|||
modal: true,
|
|||
title: "Añadir Grupo"
|
|||
}).dialog('option', 'position', [x, y]);
|
|||
}
|
|||
function modifyRecord(){
|
|||
var uid;
|
|||
61 | manumora | ||
69 | manumora | var uid = rowSelected();
|
|
if(uid==false)
|
|||
return false;
|
|||
61 | manumora | ||
69 | manumora | $("#dialog-form").html("");
|
|
$("#dialog-form").load("groups/form.html", function() {
|
|||
72 | manumora | $.facebooklist('#facebook-demo', '#preadded', '#facebook-auto',{url:'users',cache:1}, 10, {userfilter:1,casesensetive:0});
|
|
getAllUsers();
|
|||
70 | manumora | /*
|
|
69 | manumora | $("#form_data #action").val("modify");
|
|
$("#form_data #user").attr("readonly","true");
|
|||
$("#form_data #user").css("background-color","#DDD");
|
|||
$("#form_data #messageForm").html("Todos los campos son obligatorios");
|
|||
$.post('users', 'action=getUserData&user='+uid, function(data) {
|
|||
var result = $.parseJSON(data);
|
|||
if(result.response['type']=="teacher")
|
|||
var textType = "Profesor";
|
|||
else
|
|||
var textType = "Alumno";
|
|||
var dep = Array(result.response['groups']['departments']);
|
|||
$("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
|
|||
70 | manumora | $("#form_data #name").val(result.response['name']);
|
|
}); */
|
|||
69 | manumora | });
|
|
70 | manumora | x = ($(window).width()-500)/2;
|
|
69 | manumora | y = ($(window).height()-500)/2;
|
|
61 | manumora | ||
$("#dialog-form").dialog({
|
|||
resizable: false,
|
|||
modal: true,
|
|||
70 | manumora | width: 500,
|
|
69 | manumora | title: "Modificar Grupo"
|
|
}).dialog('option', 'position', [x, y]);
|
|||
61 | manumora | }
|
|
69 | manumora | ||
61 | manumora | function deleteRecord(){
|
|
var id = rowSelected();
|
|||
if(id==false)
|
|||
return false;
|
|||
69 | manumora | ||
61 | manumora | $( "#dialog-confirm" ).dialog({
|
|
resizable: false,
|
|||
height:160,
|
|||
width:350,
|
|||
modal: true,
|
|||
buttons: {
|
|||
"Borrar": function() {
|
|||
69 | manumora | $.post("groups","name="+id+"&action=delete", function(data){
|
|
$("#dialog-confirm").dialog( "close" );
|
|||
61 | manumora | $("#list").trigger("reloadGrid");
|
|
});
|
|||
},
|
|||
"Cancelar": function() {
|
|||
69 | manumora | $(this).dialog( "close" );
|
|
61 | manumora | }
|
|
}
|
|||
}).dialog('open');
|
|||
}
|
|||
70 | manumora | ||
function getAllUsers(){
|
|||
$.post('users','action=getAllUsers', function(data) {
|
|||
var users = $.parseJSON(data);
|
|||
72 | manumora | ||
/*$.each( users.users, function(i, l){
|
|||
$("#form_data #users").append("<option value='"+l.username+"'>"+l.name+"</option>");
|
|||
});*/
|
|||
});
|
|||
70 | manumora | }
|
|
61 | manumora | </script>
|
|
<div id="tabla_clientes">
|
|||
<table width="100%">
|
|||
<tr>
|
|||
<td style="width:2%"></td>
|
|||
<td><table id="list" width="100%"></table></td>
|
|||
<td style="width:2%"></td>
|
|||
</tr>
|
|||
</table>
|
|||
<div id="pager" style=""></div>
|
|||
<div id="filter" style="margin-left:30%;display:none">Search Invoices</div>
|
|||
</div>
|
|||
<div id="dialog-form"></div>
|
|||
<div id="dialog-confirm" title="¿Borrar el registro seleccionado?" style="display:none;">
|
|||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Este elemento quedará permanentemente eliminado. ¿Está seguro?</p>
|
|||
</div>
|
|||
<div id="dialog-alert" title="Atención" style="display:none;">
|
|||
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Para operar sobre un registro debe seleccionarlo previamente.</p>
|
|||
</div>
|
|||
<script language="javascript"> print_grid();</script>
|