File size: 3,072 Bytes
b9a69cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{% extends 'base.html' %} {% block head %}
<link rel="stylesheet" href="../static/candidatos_vaga_id.css" />
<link

  rel="stylesheet"

  type="text/css"

  href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.min.css"

/>{% endblock %} {% block conteudo %}

<main>
  <div class="container-vaga-page" data-vaga-id=" {{ vaga.id }}">
    <div class="container-vaga-page-header">
      <span id="header-field">Candidatos</span>
      <ul class="vaga-info">
        <li id="vaga-cargo">{{ vaga.cargo }} {{vaga.nivel}}</li>
        <li id="vaga-departamento">{{vaga.departamento}}</li>
        <li id="vaga-data-abertura">
          Vaga aberta em {{vaga.data_abertura.strftime('%d/%m/%Y')}}
        </li>
      </ul>

      <div class="buttons-interact">
        <button

          id="new-candidate"

          class="buttons-interact-button"

          title="Novo candidato"

        >
          <i class="bi bi-plus-circle"></i>
        </button>
      </div>
    </div>

    <div class="grid-candidatos">
      <table id="table-candidatos" style="width: 100%">
        <thead>
          <tr>
            <th>Nome</th>
            <th>Email</th>
            <th>Telefone</th>
            <th>Status</th>
          </tr>
        </thead>
        <tbody>
          {% for candidato in candidatos %} {% if candidato.nome != none %}
          <tr data-candidato-id="{{ candidato.id }}">
            <td>{{candidato.nome}}</td>
            <td>{{candidato.email}}</td>
            <td>{{candidato.telefone}}</td>
            <td>{{candidato.status}}</td>
          </tr>
          {% endif %} {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
  {% include 'animation_publish.html' %}
</main>

{% endblock %} {% block finalscript %}
<script src="https://cdn.datatables.net/2.0.3/js/dataTables.min.js"></script>
<script>

  $(document).ready(function () {

    $("#table-candidatos").DataTable({

      language: {

        search: "Buscar:",

        lengthMenu: "Mostrar _MENU_ registros por página",

        info: "Mostrando _START_ a _END_ de _TOTAL_ registros",

        infoEmpty: "Mostrando 0 a 0 de 0 registros",

        infoFiltered: "(filtrado de _MAX_ registros totais)",

        paginate: {

          first: "Primeiro",

          last: "Último",

          next: "Próximo",

          previous: "Anterior",

        },

      },

    });

  });

</script>

<script>

  $(document).ready(function () {

    $("#header-field").click(function () {

      location.reload(); // Atualiza a página

    });

  });

</script>
<script>

  $(document).ready(function () {

    // Adiciona um evento de clique às linhas da tabela

    $("#table-candidatos").on("click", "tr[data-candidato-id]", function () {

      var candidatoId = $(this).data("candidato-id");

      var url = "/candidatos/" + candidatoId; // ou use url_for para gerar o URL no Flask



      // Redireciona para a página do candidato

      window.location.href = url;

    });

  });

</script>
{% endblock %}