root/controlies/www/groups/index.html @ 85
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 -->
|
|
76 | manumora | <!-- <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> -->
|
|||
72 | manumora | ||
76 | manumora | <link rel="stylesheet" href="js/autocomplete/TextboxList.css" type="text/css" media="screen" charset="utf-8" />
|
|
<link rel="stylesheet" href="/js/autocomplete/TextboxList.Autocomplete.css" type="text/css" media="screen" charset="utf-8" />
|
|||
<script src="js/autocomplete/GrowingInput.js" type="text/javascript" charset="utf-8"></script>
|
|||
<script src="js/autocomplete/TextboxList.js" type="text/javascript" charset="utf-8"></script>
|
|||
<script src="js/autocomplete/TextboxList.Autocomplete.js" type="text/javascript" charset="utf-8"></script>
|
|||
<script src="js/autocomplete/TextboxList.Autocomplete.Binary.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",
|
|||
79 | manumora | colNames:['Tipo Grupo','Nombre','ID Grupo','Nº Usuarios'],
|
|
61 | manumora | 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"},
|
|
79 | manumora | {name:'gidNumber',index:'gidNumber', width:60, align:"center"},
|
|
{name:'usersNumber',index:'usersNumber', width:60, align:"center"}
|
|||
61 | manumora | ],
|
|
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(){
|
|
84 | manumora | $("#messageLoading").show();
|
|
69 | manumora | $("#dialog-form").html("");
|
|
$("#dialog-form").load("groups/form.html", function() {
|
|||
$("#form_data #action").val("add");
|
|||
$("#form_data #messageForm").html("Todos los campos son obligatorios");
|
|||
84 | manumora | ||
x = ($(window).width()-500)/2;
|
|||
y = ($(window).height()-500)/2;
|
|||
$("#messageLoading").hide();
|
|||
$("#dialog-form").dialog({
|
|||
resizable: false,
|
|||
position: top,
|
|||
modal: true,
|
|||
width: 500,
|
|||
title: "Añadir Grupo"
|
|||
}).dialog('option', 'position', [x, y]);
|
|||
76 | manumora | ||
var autoComplete = new $.TextboxList('#users', {unique: true, plugins: {autocomplete: {
|
|||
minLength: 2,
|
|||
queryRemote: true,
|
|||
remote: {url: 'users?action=getAllUsers'}
|
|||
}}});
|
|||
69 | manumora | ||
84 | manumora | ||
});
|
|||
69 | manumora | }
|
|
77 | manumora | ||
var autoComplete;
|
|||
69 | manumora | function modifyRecord(){
|
|
var uid;
|
|||
84 | manumora | ||
$("#messageLoading").show();
|
|||
69 | manumora | var uid = rowSelected();
|
|
if(uid==false)
|
|||
return false;
|
|||
61 | manumora | ||
84 | manumora | $("#dialog-form").html("").css("display","none");;
|
|
69 | manumora | $("#dialog-form").load("groups/form.html", function() {
|
|
$("#form_data #action").val("modify");
|
|||
77 | manumora | ||
$.post('groups', 'action=getGroupData&name='+uid, function(data) {
|
|||
69 | manumora | var result = $.parseJSON(data);
|
|
79 | manumora | if(result.response['type']=="school_department")
|
|
var textType = "Departamento";
|
|||
else
|
|||
var textType = "Curso";
|
|||
$("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
|
|||
$("#form_data #name").replaceWith(result.response['name']+"<input type='hidden' id='name' name='name' value='"+result.response['name']+"'/>");
|
|||
84 | manumora | ||
x = ($(window).width()-500)/2;
|
|||
y = ($(window).height()-500)/2;
|
|||
$("#messageLoading").hide();
|
|||
$("#dialog-form").dialog({
|
|||
resizable: false,
|
|||
modal: true,
|
|||
width: 500,
|
|||
title: "Modificar Grupo"
|
|||
}).dialog('option', 'position', [x, y]);
|
|||
// Autocomplete with poll the server as you type
|
|||
autoComplete = new $.TextboxList('#users', {unique: true, plugins: {autocomplete: {
|
|||
minLength: 2,
|
|||
queryRemote: true,
|
|||
remote: {url: 'users?action=getAllUsers'}
|
|||
}}});
|
|||
76 | manumora | ||
77 | manumora | $.each(result.response['memberuid'], function(i, l){
|
|
autoComplete.add(l);
|
|||
84 | manumora | });
|
|
77 | manumora | });
|
|
69 | manumora | });
|
|
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>
|