form.html 4.75 KB
Newer Older
Ryan Herbert's avatar
Ryan Herbert committed
1
<div>
Ryan Herbert's avatar
Ryan Herbert committed
2
    <span class="left form_label" style="line-height: 33px">Sample {{=i+1}}</span>
3 4 5
    {{ if file is not None and 'error' in file and len(file['error']) > 0: }}
        <div class="error">error: {{=", ".join(file['error'])}}</div>
    {{ pass }}
Ryan Herbert's avatar
Ryan Herbert committed
6 7 8
    {{ if file is not None and 'message' in file and len(file['message']) > 0: }}
        <div>{{=", ".join(file['message'])}}</div>
    {{ pass }}
Ryan Herbert's avatar
Ryan Herbert committed
9
    <div class="hidden">
Ryan Herbert's avatar
Ryan Herbert committed
10
        <input type="hidden" id="file_filename_{{=i}}" class="filename" name="file[{{=i}}][filename]" type="text" value="">
11 12 13 14 15
        <input type="hidden" id="file_id_{{=i}}" name="file[{{=i}}][id]"
            value="{{if 'id' in file:}}{{=file['id']}}{{pass}}" >
        <input type="hidden" id="sample_set_id" name="sample_set_id" value="{{if "sample_set_id" in request.vars:}}{{=request.vars["sample_set_id"]}}{{pass}}" >
        <input type="hidden" id="sample_type" name="sample_type" value="{{=sample_type}}" />
    </div>
Ryan Herbert's avatar
Ryan Herbert committed
16

17 18 19 20 21 22 23
    <div class="field_div">
        <div id="file_field_1_{{=i}}" class="field_div file_1" {{if source_module_active:}} style="display: none" {{pass}}>
            <input class="upload_field form-control" id="file_upload_1_{{=i}}" type="file"
            {{if source_module_active:}}
                disabled
            {{pass}}
                onchange="db.upload_file_onChange('file_filename_{{=i}}', this.value)"
24
                title="first file for this sample (.fa, .fastq, .fa.gz, .fastq.gz, .clntab)"
25 26 27 28 29 30 31
            >
        </div>
        <div id="file_2_{{=i}}" class="field_div file_2" style="display: none">
            <input class="upload_field form-control" id="file_upload_2_{{=i}}" type="file"
            {{if source_module_active:}}
                disabled
            {{pass}}
32
                title="second file for this sample (.fa, .fastq, .fa.gz, .fastq.gz)"
33 34 35 36 37 38 39 40 41 42 43
            >
        </div>
        <div id="jstree_field_{{=i}}"
            class="field_div jstree_field form-control"
            {{if not source_module_active:}} style="display: none;" {{pass}}
            data-index={{=i}}
            onclick="db.display_jstree(this.dataset.index)">
            <span class="button2">browse</span>
            <span id="file_indicator_{{=i}}"></span>
        </div>
    </div>
44
    <div class="field_div">
45
        <input class="date form-control" id="sampling_date_{{=i}}" name="file[{{=i}}][sampling_date]" type="text" title="sampling date"
46
            value="{{if 'sampling_date' in file and file['sampling_date'] is not None:}}{{=file['sampling_date']}}{{pass}}"
47
            placeholder="yyyy-mm-dd" pattern="(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))">
48 49
    </div>
    <div class="field_div">
50
        <input id="file_info_{{=i}}"
51
            onfocus="new VidjilAutoComplete().setupTags(this);"
52
            onkeydown="if (event.keyCode == 13) return false;"
53 54 55 56 57
            data-needs-atwho="true"
            data-keys="{{=group_ids}}"
            class="text form-control"
            name="file[{{=i}}][info]"
            rows="1"
58
            placeholder="sample information (#tags can be used)"
59
            autocomplete="off"
60
            value="{{if 'info' in file and file['info'] is not None:}}{{=file['info']}}{{pass}}"/>
61
    </div>
Ryan Herbert's avatar
Ryan Herbert committed
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    <div class="field_div">
        <div class="token_div form-control" onclick="$('#token_input_{{=i}}').focus()">
            <input
                hidden
                id="file_set_list_{{=i}}"
                name="file[{{=i}}][set_ids]"
                type="text"
                value="{{=",".join([set['id'] for set in file['sets']])}}">
            <div id="file_set_div_{{=i}}" class="token_container">
                {{ for set in file['sets']: }}
                    <span class="set_token {{=set['type']}}_token" data-set-id="{{=set['id']}}">
                        <i class="icon-cancel" onclick="new Tokeniser(document.getElementById('file_set_div_{{=i}}'), document.getElementById('file_set_list_{{=i}}')).removeToken(this.parentNode);"></i>
                        {{=set['id'][3:]}}
                    </span>
                {{pass}}
77
            </div>
78 79 80
	    {{ if isEditing: }}
            {{ else: }}
	    <input
Ryan Herbert's avatar
Ryan Herbert committed
81 82 83 84 85
                id="token_input_{{=i}}"
                class="token_input"
                autocomplete="off"
                onfocus="new VidjilAutoComplete().setupSamples(this);
                new Tokeniser(document.getElementById('file_set_div_{{=i}}'), document.getElementById('file_set_list_{{=i}}'));"
86
                data-needs-atwho="true"
Ryan Herbert's avatar
Ryan Herbert committed
87 88 89
                data-needs-tokeniser="true"
                data-group-ids="{{=upload_group_ids}}"
                data-keys='["generic", "patient", "run"]'
90
                placeholder="specific sets"
Ryan Herbert's avatar
Ryan Herbert committed
91
                type="text">
92
	    {{ pass }}
93
        </div>
Ryan Herbert's avatar
Ryan Herbert committed
94 95
    </div>
</div>