index.html 5.4 KB
Newer Older
1
{{extend 'db_layout.html'}}
2
{{import vidjil_utils}}
3

4
5
{{total_file_count = 0 ; total_size = 0}}

6
<h3></h3>
7

8
<div class="db_block">
9
    <div class="db_block_left">
10
        search
11
12
13
14
        <input id="db_filter_input" type="text" value="{{=request.vars["filter"]}}"  onchange="db.call('patient/index', {'filter' : this.value} )">
    </div>
</div>

15
16
17
18
19
<div id="db_table_container">
    <table class="db_table" id="table">


        <thead>
Mathieu Giraud's avatar
Mathieu Giraud committed
20
            <tr><td class="column_200 pointer" onclick="db.call('patient/index', {'sort' :'last_name', 'filter' : '{{=request.vars["filter"]}}'
21
                  {{if not reverse and request.vars["sort"]=="last_name" :}} , 'reverse' : true {{pass}} })"> name </td>
Mathieu Giraud's avatar
Mathieu Giraud committed
22
                <td class="column_100 pointer" onclick="db.call('patient/index', {'sort' :'birth', 'filter' : '{{=request.vars["filter"]}}'
23
                  {{if not reverse and request.vars["sort"]=="birth" :}} , 'reverse' : true {{pass}} })"> birth </td>
Mathieu Giraud's avatar
Mathieu Giraud committed
24
                <td class="pointer" onclick="db.call('patient/index', {'sort' :'info', 'filter' : '{{=request.vars["filter"]}}'
25
                  {{if not reverse and request.vars["sort"]=="info" :}} , 'reverse' : true {{pass}} })"> info </td>
Mathieu Giraud's avatar
Mathieu Giraud committed
26
                <td class="pointer" class="column_100" onclick="db.call('patient/index', {'sort' :'configs', 'filter' : '{{=request.vars["filter"]}}'
27
                  {{if not reverse and request.vars["sort"]=="configs" :}} , 'reverse' : true {{pass}} })"> results </td>
28
{{if isAdmin:}} <td class="column_100 pointer" onclick="db.call('patient/index', {'sort' :'groups', 'filter' : '{{=request.vars["filter"]}}'
29
                  {{if not reverse and request.vars["sort"]=="groups" :}} , 'reverse' : true {{pass}} })"> groups </td> {{pass}}
Mathieu Giraud's avatar
Mathieu Giraud committed
30
{{if isAdmin:}} <td class="column_100 pointer" onclick="db.call('patient/index', {'sort' :'creator', 'filter' : '{{=request.vars["filter"]}}'
31
                  {{if not reverse and request.vars["sort"]=="creator" :}} , 'reverse' : true {{pass}} })"> creator </td> {{pass}}
Mathieu Giraud's avatar
Mathieu Giraud committed
32
                <td class="column_100 pointer" onclick="db.call('patient/index', {'sort' :'files', 'filter' : '{{=request.vars["filter"]}}'
33
                  {{if not reverse and request.vars["sort"]=="files" :}} , 'reverse' : true {{pass}} })"> files </td>
34
35
                
                
36
37
38
39
40
                <td class="column5"> </td>
                <td class="column5"> </td>
                <td class="column5"> </td>
            </tr>
        </thead>
Marc Duez's avatar
Marc Duez committed
41
42
        
        
43
       {{for row in query :}}
44
           <tr class="pointer" onclick="db.call('sample_set/index', {'id' :'{{=row['sample_set_id']}}' , 'config_id' : {{=row['most_used_conf']}} } )" >
45
                <td>
46
47
                     {{ patient_name = vidjil_utils.anon_names(row['id'], row['first_name'], row['last_name'], row['anon_allowed'])}}
		     {{= patient_name}}
48
                </td>
49
                <td> {{ if row['birth'] is not None: }} {{=row['birth'] }} {{ pass }} </td>
Marc Duez's avatar
Marc Duez committed
50
                <td> {{=row['info'] }} </td>
51
                <td>
52
                  {{ configs = [] }}
53
                  {{for conf in row['conf_list'] :}}
54
                    {{filename = patient_name + " (" + conf['name'] + ")"}}
55
                    {{if conf['fused_file'] is not None :}}
56
57
58
                      {{ configs.append(str(A(conf['name'], _href="index.html?patient=" + str(row['id']) + "&config=" + str(conf['id']), _type="text/html",
                            _onclick="event.preventDefault();event.stopPropagation();if( event.which == 2 ) { window.open(this.href); } else { db.load_data( { 'patient' : '" + str(row['id']) + "' , 'config' : " + str(conf['id']) + " }, '" + filename + "' ); }"))) }}
                    {{else:}}
59
                      {{ configs.append(conf['name']) }}
60
                    {{pass}}
61
                  {{pass}}
62
                  {{= XML(", ".join(configs)) }}
63
                </td>
Marc Duez's avatar
Marc Duez committed
64
65
66
{{if isAdmin:}} <td> {{=row['groups']}}</td>{{pass}}
{{if isAdmin:}} <td> {{=row['creator']}}</td>{{pass}}
                <td> {{=row['file_count']}} ({{=vidjil_utils.format_size(row['size'])}}) </td>
67
            {{ total_file_count += row['file_count'] ; total_size += row['size'] }}
68
               
69
{{if isAdmin:}} <td onclick="db.call('patient/permission', {'id' :'{{=row['id']}}'} )" > <i class="icon-key" title="set permissions"></i> </td> {{else:}} <td></td> {{pass}}
Marc Duez's avatar
Marc Duez committed
70
                {{if row['has_permission']:}}
71
                <td onclick="db.call('patient/edit', {'id' :'{{=row['id']}}'} )" > <i class="icon-pencil-2" title="edit patient information"></i> </td>
72
                <td onclick="db.call('patient/confirm', {'id' :'{{=row['id']}}'} )" > <i class="icon-erase" title="delete patient"></i> </td>
73
74
75
76
77
78
                {{else:}}  <td></td><td></td>{{pass}}
            </tr>
        {{pass}}

    </table>
    <table class="db_table" id="db_fixed_header"></table>
79
</div>
80

81
82
<div class="db_block">
    <div class="db_block_left">
83

84
{{if auth.can_create_patient():}}
85
<span class="button2" onclick="db.call('patient/add')"> + new patient </span>
86
<span class="button2" onclick="db.call('sample_set/custom', {'filter': '{{=request.vars['filter']}}' })"> compare samples/patients </span>
87
{{else:}}
88
<!-- <span class="button2 inactive" onclick="db.call('patient/add')" title="you don't have permission to create new patient"> add patient </span> -->
89
{{pass}}
90
91
92

  </div>
  <div class="db_block_right">
93
94
  <br />
  {{ =len(query) }} patients, {{ =total_file_count }} files ({{ =vidjil_utils.format_size(total_size) }})
95
96
  </div>
</div>