Browse Source

Refatroação dos cronometros para o painel

Websocket_painel
AlGouvea 3 years ago
parent
commit
f8e5620c0b
  1. 3
      frontend/src/__apps/painel/main.js
  2. 8
      sapl/templates/painel/index.html
  3. 63
      sapl/templates/sessao/painel.html

3
frontend/src/__apps/painel/main.js

@ -241,7 +241,7 @@ const v = new Vue({ // eslint-disable-line
} }
}, },
start: function startStopWatch (temp_crono) { start: function startStopWatch (temp_crono) {
if (this.running !== 0) return if (this.running === temp_crono) return
crono = temp_crono crono = temp_crono
if (time === null) { if (time === null) {
@ -254,7 +254,6 @@ const v = new Vue({ // eslint-disable-line
timeEnd.setMinutes(timeEnd.getMinutes() + time.getMinutes()) timeEnd.setMinutes(timeEnd.getMinutes() + time.getMinutes())
timeEnd.setSeconds(timeEnd.getSeconds() + time.getSeconds()) timeEnd.setSeconds(timeEnd.getSeconds() + time.getSeconds())
timeEnd.setMilliseconds(timeEnd.getMilliseconds() + time.getMilliseconds()) timeEnd.setMilliseconds(timeEnd.getMilliseconds() + time.getMilliseconds())
clearInterval(this.timeStopped)
} }
this.running = crono this.running = crono

8
sapl/templates/painel/index.html

@ -122,23 +122,15 @@
<h2 class="text-subtitle">Cronômetros</h2> <h2 class="text-subtitle">Cronômetros</h2>
<div class="text-value"> <div class="text-value">
Discurso:<span id='discurso' style="margin-right: 20px;">[[ cronometro_discurso ]]</span><span v-if="painel_aberto"> Discurso:<span id='discurso' style="margin-right: 20px;">[[ cronometro_discurso ]]</span><span v-if="painel_aberto">
<span v-if='running != 1'><button class="btn btn-success" v-on:click="start (1)">Iniciar</button><button style="margin-left: 10px;" class="btn btn-success" v-on:click="reset">Reiniciar</button></span>
<span v-else><button class="btn btn-danger" v-on:click="stop(1)">Parar</button></span>
</span><br> </span><br>
Aparte:<span id='discurso' style="margin-right: 20px;">[[ cronometro_aparte ]]</span><span v-if="painel_aberto"> Aparte:<span id='discurso' style="margin-right: 20px;">[[ cronometro_aparte ]]</span><span v-if="painel_aberto">
<span v-if='running != 2'><button class="btn btn-success" v-on:click="start (2)">Iniciar</button><button style="margin-left: 10px;" class="btn btn-success" v-on:click="reset">Reiniciar</button></span>
<span v-else><button class="btn btn-danger" v-on:click="stop(2)">Parar</button></span>
</span><br> </span><br>
Questão de Ordem: <span id='discurso' style="margin-right: 20px;">[[ cronometro_ordem ]]</span><span v-if="painel_aberto"> Questão de Ordem: <span id='discurso' style="margin-right: 20px;">[[ cronometro_ordem ]]</span><span v-if="painel_aberto">
<span v-if='running != 3'><button class="btn btn-success" v-on:click="start (3)">Iniciar</button><button style="margin-left: 10px;" class="btn btn-success" v-on:click="reset">Reiniciar</button></span>
<span v-else><button class="btn btn-danger" v-on:click="stop(3)">Parar</button></span>
</span><br> </span><br>
Considerações Finais: <span id='discurso' style="margin-right: 20px;">[[ cronometro_consideracoes ]]</span><span v-if="painel_aberto"> Considerações Finais: <span id='discurso' style="margin-right: 20px;">[[ cronometro_consideracoes ]]</span><span v-if="painel_aberto">
<span v-if='running != 4'><button class="btn btn-success" v-on:click="start (4)">Iniciar</button><button style="margin-left: 10px;" class="btn btn-success" v-on:click="reset">Reiniciar</button></span>
<span v-else><button class="btn btn-danger" v-on:click="stop(4)">Parar</button></span>
</span> </span>
</div> </div>
</div> </div>

63
sapl/templates/sessao/painel.html

@ -35,8 +35,8 @@
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"><button onclick="switch_cronometro(true, 1)" id="discursoStart" class="btn btn-success">Iniciar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(true, 1)" id="discursoStart" class="btn btn-success">Iniciar</button></div>
<div class="col-md-6"><button onclick="switch_cronometro(false, 1)" id="discursoStop" class="btn btn-success">Parar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(false, 1)" id="discursoStop" class="btn btn-danger">Parar</button></div>
<div class="col-md-6"><button type="button" id="discursoReset" class="btn btn-success">Reiniciar</button></div> <div class="col-md-6"><button type="button" id="discursoReset" class="btn btn-success">Reiniciar</button></div>
</div> </div>
@ -51,8 +51,9 @@
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"><button type="button" id="aparteStart" class="btn btn-success">Iniciar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(true, 2)" id="aparteStart" class="btn btn-success">Iniciar</button></div>
<div class="col-md-6"><button type="button" id="aparteReset" class="btn btn-success" class="btn btn-success">Reiniciar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(false, 2)" id="aparteStop" class="btn btn-danger">Parar</button></div>
<div class="col-md-6"><button type="button" id="aparteReset" class="btn btn-success">Reiniciar</button></div>
</div> </div>
<br /><br > <br /><br >
@ -66,7 +67,8 @@
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"><button type="button" id="ordemStart" class="btn btn-success">Iniciar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(true, 3)" id="ordemStart" class="btn btn-success">Iniciar</button></div>
<div class="col-md-3"><button onclick="switch_cronometro(false, 3)" id="ordemStop" class="btn btn-danger">Parar</button></div>
<div class="col-md-6"><button type="button" id="ordemReset" class="btn btn-success">Reiniciar</button></div> <div class="col-md-6"><button type="button" id="ordemReset" class="btn btn-success">Reiniciar</button></div>
</div> </div>
@ -83,7 +85,8 @@
<br /> <br />
<div class="row"> <div class="row">
<div class="col-md-6"><button type="button" id="consideracoesStart" class="btn btn-success">Iniciar</button></div> <div class="col-md-3"><button onclick="switch_cronometro(true, 3)" id="consideracoesStart" class="btn btn-success">Iniciar</button></div>
<div class="col-md-3"><button onclick="switch_cronometro(false, 3)" id="consideracoesStop" class="btn btn-danger">Parar</button></div>
<div class="col-md-6"><button type="button" id="consideracoesReset" class="btn btn-success">Reiniciar</button></div> <div class="col-md-6"><button type="button" id="consideracoesReset" class="btn btn-success">Reiniciar</button></div>
</div> </div>
<br /><br > <br /><br >
@ -151,7 +154,6 @@ $(function() {
$.get('/painel/cronometro', { tipo: 'discurso', action: 'start' } ); $.get('/painel/cronometro', { tipo: 'discurso', action: 'start' } );
$('#discursoReset').hide();
$('#discurso').runner('start'); $('#discurso').runner('start');
}); });
@ -160,7 +162,6 @@ $(function() {
$.get('/painel/cronometro', { tipo: 'discurso', action: 'stop' } ); $.get('/painel/cronometro', { tipo: 'discurso', action: 'stop' } );
$('#discursoReset').show();
$('#discurso').runner('stop'); $('#discurso').runner('stop');
}); });
@ -198,23 +199,13 @@ $(function() {
}); });
$('#aparteStart').click(function(){ $('#aparteStart').click(function(){
if ($('#aparteStart').text() == 'Iniciar') {
$.get('/painel/cronometro', { tipo: 'aparte', action: 'start' } ); $.get('/painel/cronometro', { tipo: 'aparte', action: 'start' } );
$('#aparteReset').hide();
$('#aparte').runner('start'); $('#aparte').runner('start');
$('#aparteStart').text('Parar'); });
} else {
$('#aparteStop').click(function(){
$.get('/painel/cronometro', { tipo: 'aparte', action: 'stop' } ); $.get('/painel/cronometro', { tipo: 'aparte', action: 'stop' } );
$('#aparteReset').show();
$('#aparte').runner('stop'); $('#aparte').runner('stop');
$('#aparteStart').text('Iniciar');
}
}); });
$('#aparteReset').click(function() { $('#aparteReset').click(function() {
@ -248,26 +239,14 @@ $(function() {
$('#ordemStart').text('Iniciar'); $('#ordemStart').text('Iniciar');
}); });
$('#ordemStart').click(function(){
$('#ordemStart').click(function() {
if ($('#ordemStart').text() == 'Iniciar') {
$.get('/painel/cronometro', { tipo: 'ordem', action: 'start' } ); $.get('/painel/cronometro', { tipo: 'ordem', action: 'start' } );
$('#ordemReset').hide();
$('#ordem').runner('start'); $('#ordem').runner('start');
$('#ordemStart').text('Parar'); });
} else {
$('#ordemStop').click(function(){
$.get('/painel/cronometro', { tipo: 'ordem', action: 'stop' } ); $.get('/painel/cronometro', { tipo: 'ordem', action: 'stop' } );
$('#ordemReset').show();
$('#ordem').runner('stop'); $('#ordem').runner('stop');
$('#ordemStart').text('Iniciar');
}
}); });
$('#ordemReset').click(function() { $('#ordemReset').click(function() {
@ -304,23 +283,13 @@ $(function() {
}); });
$('#consideracoesStart').click(function(){ $('#consideracoesStart').click(function(){
if ($('#consideracoesStart').text() == 'Iniciar') {
$.get('/painel/cronometro', { tipo: 'consideracoes', action: 'start' } ); $.get('/painel/cronometro', { tipo: 'consideracoes', action: 'start' } );
$('#consideracoesReset').hide();
$('#consideracoes').runner('start'); $('#consideracoes').runner('start');
$('#consideracoesStart').text('Parar'); });
} else {
$('#consideracoesStop').click(function(){
$.get('/painel/cronometro', { tipo: 'consideracoes', action: 'stop' } ); $.get('/painel/cronometro', { tipo: 'consideracoes', action: 'stop' } );
$('#consideracoesReset').show();
$('#consideracoes').runner('stop'); $('#consideracoes').runner('stop');
$('#consideracoesStart').text('Iniciar');
}
}); });
$('#consideracoesReset').click(function() { $('#consideracoesReset').click(function() {

Loading…
Cancel
Save