aboutsummaryrefslogtreecommitdiff
path: root/qc_app/templates/select_species.html
blob: 35850de4faac7ddb4bcc62eff86309d357228dc6 (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
{%extends "base.html"%}
{%from "flash_messages.html" import flash_messages%}
{%from "upload_progress_indicator.html" import upload_progress_indicator%}

{%block title%}Data Upload{%endblock%}

{%block contents%}
{{upload_progress_indicator()}}

<div class="row">
  <form action="{{url_for('entry.upload_file')}}"
        method="POST"
        enctype="multipart/form-data"
        id="frm-upload-expression-data">
    <legend class="heading">upload expression data</legend>
    {{flash_messages("error-expr-data")}}

    <div class="form-group">
      <label for="select_species01" class="form-label">Species</label>
      <select id="select_species01"
	      name="speciesid"
	      required="required"
              class="form-control">
        <option value="">Select species</option>
        {%for aspecies in species%}
        <option value="{{aspecies.SpeciesId}}">{{aspecies.MenuName}}</option>
        {%endfor%}
      </select>
    </div>

    <div class="form-group">
      <legend class="heading">file type</legend>

      <div class="form-check">
        <input type="radio" name="filetype" value="average" id="filetype_average"
	       required="required" class="form-check-input" />
        <label for="filetype_average" class="form-check-label">average</label>
      </div>

      <div class="form-check">
        <input type="radio" name="filetype" value="standard-error"
	       id="filetype_standard_error" required="required"
	       class="form-check-input" />
        <label for="filetype_standard_error" class="form-check-label">
          standard error
        </label>
      </div>
    </div>

    <div class="form-group">
      <span id="no-file-error" class="alert-danger" style="display: none;">
        No file selected
      </span>
      <label for="file_upload" class="form-label">select file</label>
      <input type="file" name="qc_text_file" id="file_upload"
	     accept="text/plain, text/tab-separated-values, application/zip"
	     class="form-control"/>
    </div>

    <button type="submit" class="btn btn-primary">upload file</button>
  </form>
</div>
{%endblock%}


{%block javascript%}
<script type="text/javascript" src="static/js/upload_progress.js"></script>
<script type="text/javascript">
  function setup_formdata(form) {
      var formdata = new FormData();
      formdata.append(
	  "speciesid",
	  form.querySelector("#select_species01").value)
      formdata.append(
	  "qc_text_file",
	  form.querySelector("input[type='file']").files[0]);
      formdata.append(
	  "filetype",
	  selected_filetype(
	      Array.from(form.querySelectorAll("input[type='radio']"))));
      return formdata;
  }

  setup_upload_handlers(
      "frm-upload-expression-data", make_data_uploader(setup_formdata));
</script>
{%endblock%}