Newer
Older
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
<!DOCTYPE html>
<html>
<head>
{% for src in js %}
<script type="text/javascript" src="{{ src }}"></script>
{% endfor %}
{% for src in css %}
<link type="text/css" rel="stylesheet" href="{{ src }}">
{% endfor %}
<link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', path = 'app.css' ) }}">
<link type="text/css" rel="stylesheet" href="{{ url_for( 'send_app_files', path = 'dropzone.css' ) }}">
<script type="text/javascript">
baseurl = "{{ baseurl }}";
</script>
</head>
<body class="icnml_main_layout">
{% include "header.html" %}
{% include "navigation.html" %}
<form id="icnml_submission_form">
<div class="ui-widget-header ui-corner-top icnml_box_top">Submition form</div>
<div class="ui-widget-content ui-corner-bottom icnml_box_content">
<div class="icnml_box_fields">
<div style="text-align: right;">
<label for="upload_nickname">Submission nickname</label>
</div>
<div>
<input id="upload_nickname" name="upload_nickname" type="text" style="width: 100%">
</div>
<div style="text-align: right;">
<label for="email">Donnor e-mail</label>
</div>
<div>
<input id="email" name="email" type="text" style="width: 100%">
</div>
<div style="text-align: right;">
<label for="email_confirmation">Donnor e-mail confirmation</label>
</div>
<div>
<input id="email_confirmation" name="email_confirmation" type="text" style="width: 100%">
</div>
<div style="text-align: right;">
<label for="consent_form">Consent form</label>
</div>
<div>
<div id="consent_form_dropzone" class="dropzone"></div>
</div>
<div style="text-align: right;">
<label for="tenprint_card">Tenprint card(s)</label>
</div>
<div>
<div id="tenprint_card_dropzone" class="dropzone"></div>
</div>
<div style="text-align: right;">
<label for="latents">Latent</label>
</div>
<div>
<div id="latents_dropzone" class="dropzone"></div>
</div>
</div>
<div id="icnml_sub_error" class="icnml_box_error"></div>
<div class="icnml_button">
<a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="next_button" role="button" aria-disabled="false">
<span class="ui-button-text">Next</span>
</a>
</div>
</form>
<script type="text/javascript">
Dropzone.autoDiscover = false;
function sleep( ms ) {
return new Promise( resolve => setTimeout( resolve, ms ) );
}
$( function()
{
new Dropzone(
"#consent_form_dropzone",
{
url: baseurl + "/upload",
timeout: 600000,
params: {
'upload_type': 'consent_form',
}
}
)
.on( 'addedfile', function( file )
{
$( '#consent_form_dropzone > .dz-default.dz-message' ).remove();
} )
.on( "success", function( p ) {
var response = JSON.parse( p.xhr.response );
console.log( response );
} )
.on( "error", function( p )
{
console.log( p );
toastr.error( "Error" );
} );
} );
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
$( function()
{
new Dropzone(
"#tenprint_card_dropzone",
{
url: baseurl + "/upload",
timeout: 600000,
params: {
'upload_type': 'tenprint_card',
}
}
)
.on( 'addedfile', function( file )
{
$( '#tenprint_card_dropzone > .dz-default.dz-message' ).remove();
} )
.on( "success", function( p ) {
var response = JSON.parse( p.xhr.response );
console.log( response );
} )
.on( "error", function( p )
{
console.log( p );
toastr.error( "Error" );
} );
} );
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
$( function()
{
new Dropzone(
"#latents_dropzone",
{
url: baseurl + "/upload",
timeout: 600000,
params: {
'upload_type': 'latent',
}
}
)
.on( 'addedfile', function( file )
{
$( '#latents_dropzone > .dz-default.dz-message' ).remove();
} )
.on( "success", function( p ) {
var response = JSON.parse( p.xhr.response );
console.log( response );
} )
.on( "error", function( p )
{
console.log( p );
toastr.error( "Error" );
} );
} );
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
var validate_form = function()
{
$( '#icnml_sub_error' ).text( "" );
var upload_nickname = $( '#upload_nickname' ).val();
var email = $( '#email' ).val();
var email_conf = $( '#email_confirmation' ).val();
if( ! email )
{
$( '#icnml_sub_error' )
.text( "The e-mail can not be empty" );
}
else if( email !== email_conf )
{
$( '#icnml_sub_error' )
.text( "The e-amils fields does not match" );
} else {
$.ajax( {
url: '{{ url_for( 'create_submission_case' ) }}',
dataType: 'json',
method: 'POST',
data: {
upload_nickname: upload_nickname,
email: email
},
success: function( data )
{
if( ! data.error )
{
toastr.success( "Case id: " + data.id, "Case created" );
} else {
toastr.error( data.msg, "Case not created" );
}
}
} );
}
}
$( '#next_button' ).on( 'click', validate_form );
$( '#upload_nickname' ).focus();
</script>
</body>
</html>