#set ($layout = "grid.vm" )
#set ($title = "Clients")
#set ($module = "clients")
#if ($request.isUserInRole("packageadmin"))
#set ($computer_admin=true)
#set ($disable_flag=false)
#else
#set ($disable_flag=true)
#end
	<SCRIPT type="text/javascript">

#js_default_formatters()
#js_error_handler()
#js_search("name")

	var grid;
	var dataView;

  	var columns = [
		{id: "name", name: "Name", field: "name", cssClass: "mycell"},
		{id: "ipAddress", name: "IP-Adresse", field: "ipAddress", cssClass: "mycell" },
		{id: "macAddress", name: "MAC-Adresse", field: "macAddress", cssClass: "mycell" },
		{id: "server", name: "Server", field: "server", cssClass: "mycell"  },
	];

	$(document).ready(function () {

#js_create_grid("columns")

#if($clients_editable)
		grid.onSelectedRowsChanged.subscribe(function() { 
#if($computer_admin)
			$("#button-edit").button("option","disabled",false);
#if($properties_button)
			$("#button-properties").button("option","disabled",false);
#end
			$("#button-rename").button("option","disabled",false);
			$("#button-delete").button("option","disabled",false);
#end
			$("#button-view").button("option","disabled",false);

	   		row_ids = grid.getSelectedRows();
 	  		console.log(row_ids);
		});
		grid.onDblClick.subscribe(function() { $("#button-edit").click(); });

#js_dialog_form("new" "Create" "ui-icon-plus" $disable_flag false)
#js_dialog_form("edit" "Save" "ui-icon-pencil" true false)
#js_dialog_form("rename" "Rename" "ui-icon-tag" true false)
#js_dialog_form("delete" "Delete" "ui-icon-minus" true false)
#js_searchbox()

#end

#js_load_data($module,"name")

	});

	</SCRIPT>
<DIV class="ui-layout-center">
</DIV>
<DIV class="ui-layout-north">#parse("menu.vm")
#searchbox()
</DIV>
<DIV class="ui-layout-south">
<div class="buttons">
#if ($clients_editable)
<button id="button-new">Neu</button>
<button id="button-edit">Bearbeiten</button>
<button id="button-rename">Umbenennen</button>
<button id="button-delete">Löschen</button>
<span>&nbsp;</span>
#end
</div>
</DIV>
#if($clients_editable)
#parse("$module/new.inc")
#parse("$module/edit.inc")
#parse("$module/rename.inc")
#parse("$module/delete.inc")
#end
