diff --git a/webconference/templates/webconference/relatorios.html b/webconference/templates/webconference/relatorios.html index c9dc070..7484bd5 100644 --- a/webconference/templates/webconference/relatorios.html +++ b/webconference/templates/webconference/relatorios.html @@ -1,4 +1,4 @@ -{% extends "subjects/view.html" %} +{% extends "webconference/view.html" %} {% load static i18n pagination permissions_tags subject_counter %} {% load django_bootstrap_breadcrumbs %} @@ -11,7 +11,7 @@ var array_history = []; {%for data_json in json_history.data %} - array_history.push(["{{data_json.0}}","{{data_json.1}}","{{view}}",{% if data_json.3 is not None %}new Date('{{data_json.3.isoformat}}'){% else%}null{% endif %}]); + array_history.push(["{{data_json.0}}","{{data_json.1}}","{% if data_json.2 == 'view' %} {{view}} {% elif data_json.2 == 'initwebconference' %} {{initwebconference}} {% else %} {{participate}} {% endif %}",{% if data_json.3 is not None %}new Date('{{data_json.3.isoformat}}'){% else%}null{% endif %}]); {% endfor%} var json_history = {"data":array_history}; var column_history = [{"string":'{% trans "User" %}'},{"string":'{% trans "Group" %}'},{"string":'{% trans "Action" %}'},{"date":'{% trans "Date of Action" %}'}]; @@ -48,7 +48,7 @@ var options = { title: '{{title_chart}}', // legend: {position: 'right', maxLines: 1}, - bar: { groupWidth: '30%' }, + bar: { groupWidth: '50%' }, chartArea:{width:"50%"}, titlePosition: 'out', vAxis: { @@ -64,9 +64,87 @@ function selectHandler() { var selectedItem = chart.getSelection()[0]; + var col = data.getColumnLabel(selectedItem.column); if (selectedItem) { - var col = data.getColumnLabel(selectedItem.column); - if (col == "{{n_did_table}}"){ + if (selectedItem.row == 0 && selectedItem.column == 1){ + tabela_atual = true; + search = []; + var text = "{{view}}"; + for (var i in json_history["data"]){ + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){ + search.push([json_history["data"][i][0],json_history["data"][i][1], + json_history["data"][i][2],json_history["data"][i][3]]); + } + } + drawTable(column_history,pagination(search,1),true,3); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if(selectedItem.row == 0 && selectedItem.column == 2){ + tabela_atual = false; + search = []; + var text = "{{view}}"; + for (var i in json_n_did["data"]){ + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){ + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1], + json_n_did["data"][i][2],json_n_did["data"][i][3]]); + } + } + drawTable(column_n_did,pagination(search,1),false); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if (selectedItem.row == 1 && selectedItem.column == 1){ + tabela_atual = true; + search = []; + var text = "{{initwebconference}}"; + for (var i in json_history["data"]){ + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){ + search.push([json_history["data"][i][0],json_history["data"][i][1], + json_history["data"][i][2],json_history["data"][i][3]]); + } + } + drawTable(column_history,pagination(search,1),true,3); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if(selectedItem.row == 1 && selectedItem.column == 2){ + tabela_atual = false; + search = []; + var text = "{{initwebconference}}"; + for (var i in json_n_did["data"]){ + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){ + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1], + json_n_did["data"][i][2],json_n_did["data"][i][3]]); + } + } + drawTable(column_n_did,pagination(search,1),false); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if (selectedItem.row == 2 && selectedItem.column == 1){ + tabela_atual = true; + search = []; + var text = "{{participate}}"; + for (var i in json_history["data"]){ + if (json_history["data"][i][2].toLowerCase().includes(text.toLowerCase())){ + search.push([json_history["data"][i][0],json_history["data"][i][1], + json_history["data"][i][2],json_history["data"][i][3]]); + } + } + drawTable(column_history,pagination(search,1),true,3); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if(selectedItem.row == 2 && selectedItem.column == 2){ + tabela_atual = false; + search = []; + var text = "{{participate}}"; + for (var i in json_n_did["data"]){ + if (json_n_did["data"][i][3].toLowerCase().includes(text.toLowerCase())){ + search.push([json_n_did["data"][i][0],json_n_did["data"][i][1], + json_n_did["data"][i][2],json_n_did["data"][i][3]]); + } + } + drawTable(column_n_did,pagination(search,1),false); + alterTitleTable(search.length); + putpagination(search,tabela_atual); + } else if (col == "{{n_did_table}}"){ tabela_atual = false; search = []; for (var i in json_n_did["data"]){ @@ -149,9 +227,8 @@ {% block breadcrumbs %} {{ block.super }} - {% breadcrumb webconference.topic 'subjects:topic_view' webconference.topic.subject.slug webconference.topic.slug %} {% trans 'Reports' as bread %} - {% breadcrumb bread webconference%} + {% breadcrumb bread webconference%} {% endblock %} {% block content %} @@ -203,7 +280,7 @@ + @@ -324,7 +401,7 @@ } } } - console.log(search); + if (!load_histoty){ drawTable(column_n_did,pagination(search,1),false); } else { @@ -432,5 +509,8 @@ function scroll(to){ $("html, body").animate({ scrollTop: $(to).offset().top }, "slow"); } + function alterTitleTable (quant){ + $("#title-table").text(quant + " {% trans 'record(s)' %}"); + } {% endblock %} -- libgit2 0.21.2