about summary refs log tree commit diff
path: root/uploader/templates/phenotypes/confirm-delete-phenotypes.html
blob: b59fd7b3808ed4a82a4581cb63586c382b2ec752 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{%extends "phenotypes/base.html"%}
{%from "flash_messages.html" import flash_all_messages%}

{%block title%}Phenotypes{%endblock%}

{%block pagetitle%}Delete Phenotypes{%endblock%}

{%block lvl4_breadcrumbs%}
<li {%if activelink=="view-dataset"%}
    class="breadcrumb-item active"
    {%else%}
    class="breadcrumb-item"
    {%endif%}>
  <a href="{{url_for('species.populations.phenotypes.view_dataset',
           species_id=species.SpeciesId,
           population_id=population.Id,
           dataset_id=dataset.Id)}}">View</a>
</li>
{%endblock%}

{%block contents%}
{{flash_all_messages()}}

<div class="row"><h2>Delete Phenotypes</h2></div>

{%if phenotypes | length > 0%}
<div class="row">
  <p>You have requested to delete the following phenotypes:</p>
</div>

<div class="row">
  <div class="col">
    <a id="btn-select-all-phenotypes"
       href="#"
       class="btn btn-info"
       title="Select all phenotypes">select all</a>
  </div>
  <div class="col">
    <a id="btn-deselect-all-phenotypes"
       href="#"
       class="btn btn-warning"
       title="Deselect all phenotypes">deselect all</a>
  </div>
</div>

<div class="row">
  <table id="tbl-delete-phenotypes" class="table">
    <thead>
      <tr>
        <th>#</th>
        <th>Record ID</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      {%for phenotype in phenotypes%}
      <tr>
        <td>
          <input id="chk-xref-id-{{phenotype}}"
                 name="xref_ids"
                 type="checkbox"
                 class="chk-row-select" />
        </td>
        <td>{{phenotype}}</td>
        <td>{{phenotype}} — Description</td>
      </tr>
      {%endfor%}
    </tbody>
  </table>
</div>

<div class="row">
  <form id="frm-delete-phenotypes-selected"
        method="POST"
        action="{{url_for('species.populations.phenotypes.delete_phenotypes',
                species_id=species.SpeciesId,
                population_id=population.Id,
                dataset_id=dataset.Id)}}">
    <div class="row">
      <div class="col">
        <input class="btn btn-info"
               type="submit"
               title="Cancel delete and return to dataset page."
               name="action"
               value="cancel" /></div>
      <div class="col">
        <input id="btn-delete-phenotypes-selected"
               class="btn btn-danger"
               type="submit"
               title="Delete the selected phenotypes from this dataset."
               name="action"
               value="delete" />
      </div>
    </div>
  </form>
</div>
{%else%}
<div class="row">
  <p>You did not select any phenotypes to delete. Delete everything?</p>
</div>

<div class="row">
  <form id="frm-delete-phenotypes-all"
        method="POST"
        action="{{url_for('species.populations.phenotypes.delete_phenotypes',
                species_id=species.SpeciesId,
                population_id=population.Id,
                dataset_id=dataset.Id)}}">
    <div class="form-check">
      <input class="form-check-input"
             type="checkbox"
             name="confirm_delete_all_phenotypes"
             id="chk-confirm-delete-all-phenotypes" />
      <label class="form-check-label"
             for="chk-confirm-delete-all-phenotypes">
        delete all phenotypes?</label>
    </div>

    <div class="row">
      <div class="col">
        <input class="btn btn-info"
               type="submit"
               title="Cancel delete and return to dataset page."
               name="action"
               value="cancel" /></div>
      <div class="col">
        <input class="btn btn-danger"
               type="submit"
               title="Delete all phenotypes in this dataset."
               name="action"
               value="delete" />
      </div>
    </div>
  </form>
</div>
{%endif%}

{%endblock%}

{%block javascript%}
<script type="text/javascript">
  $(function() {
      var dt = buildDataTable(
          "#tbl-delete-phenotypes",
          data=[],
          columns=[],
          userSettings={
              responsive: true,
              select: {
                  style: "os",
                  info: false
              },
              initComplete: function(setting, json) {
                  var api = this.api();
                  api.rows().select();
                  api.rows({selected: true}).nodes().each((node, index) => {
                      setRowChecked(node);
                  });
              }
          });

      $("#btn-select-all-phenotypes").on("click", function(event) {
          dt.selectAll();
      });

      $("#btn-deselect-all-phenotypes").on("click", function(event) {
          dt.deselectAll();
      });
  });
</script>
{%endblock%}