diff --git a/sapl/painel/urls.py b/sapl/painel/urls.py index e24e94bae..3186e16e6 100644 --- a/sapl/painel/urls.py +++ b/sapl/painel/urls.py @@ -4,7 +4,7 @@ from .apps import AppConfig from .views import (cronometro_painel, get_dados_painel, painel_mensagem_view, painel_parlamentar_view, painel_view, painel_votacao_view, switch_painel, verifica_painel, votante_view, CronometroPainelCrud, - PainelConfigCrud, painel_parcial_view) + PainelConfigCrud,ordena_cronometro, painel_parcial_view) app_name = AppConfig.name @@ -23,6 +23,7 @@ urlpatterns = [ url(r'^painel/cronometro$', cronometro_painel, name='cronometro_painel'), url(r'^sistema/cronometro/', include(CronometroPainelCrud.get_urls())), + url(r'^sistema/ordena_cronometro/', ordena_cronometro, name='ordena_cronometro'), url(r'^sistema/painel-config/', include(PainelConfigCrud.get_urls())), url(r'^voto-individual/$', votante_view, diff --git a/sapl/painel/views.py b/sapl/painel/views.py index 78409006b..7ad244914 100644 --- a/sapl/painel/views.py +++ b/sapl/painel/views.py @@ -32,9 +32,19 @@ VOTACAO_NOMINAL = 2 class CronometroPainelCrud(CrudAux): model = Cronometro + class ListView(CrudAux.ListView): + template_name = "painel/cronometro_list.html" + class BaseMixin(CrudAux.BaseMixin): form_class = CronometroForm +def ordena_cronometro(request): + ordem = request.POST.getlist("ordem", []) + for index, o in enumerate(ordem, 1): + c = Cronometro.objects.get(id=o) + c.ordenacao = index + c.save() + return JsonResponse({'type':'success','msg':'Ordem alterada com sucesso.'}) class PainelConfigCrud(CrudAux): model = PainelConfig @@ -715,3 +725,4 @@ def get_dados_painel(request, pk): # Retorna que não há nenhuma matéria já votada ou aberta return response_nenhuma_materia(get_presentes(pk, response, None)) + diff --git a/sapl/templates/painel/cronometro_list.html b/sapl/templates/painel/cronometro_list.html new file mode 100644 index 000000000..7450f516d --- /dev/null +++ b/sapl/templates/painel/cronometro_list.html @@ -0,0 +1,99 @@ +{% extends "crud/list_tabaux.html" %} +{% load i18n %} +{% load i18n common_tags crispy_forms_tags%} + +{% block container_table_list %} + + {% if not rows %} +
{{ NO_ENTRIES_MSG }}
+ {% else %} ++ {{ name }} + | + {% endfor %} ++ | |||
---|---|---|---|---|
+ {{o}} + | ++ {{o.duracao_cronometro}} + | ++ {% if o.ativo %}Sim{% else %}Não{% endif %} + | +
+ |
+
+ |
+