-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathjs.php
481 lines (378 loc) · 18.4 KB
/
js.php
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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<?php
// Javascript:
?>
<!--jQuery-->
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
<!--jQuery UI -->
<script src="//code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<!--Latest complied and minified JavaScript-->
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<!--Datatables-->
<script type="text/javascript" src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/fixedcolumns/3.2.2/js/dataTables.fixedColumns.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/1.0.0/js/dataTables.responsive.js"></script>
<!--ptTimeSelect-->
<?php echo '<script type="text/javascript" src="'.$_SESSION['link_root'].'config/jquery.ptTimeSelect.js"></script>'; ?>
<!--Sample Storage Dropdown-->
<script type="text/javascript">
$(document).ready(function(){
$('#oStore_temp').change(function(){ //on change event
var Store_temp = $('#oStore_temp').val(); //<----- get the value from the parent select
if(Store_temp == 'Used'){
$("#oStore_name").html("<option value='Used'>Used</option>");
$('#orig_sample_exist2').prop('checked',true);
}
else{
var Store_name = "oStore_name";
$('#orig_sample_exist1').prop('checked',true);
$.ajax({
url : root+'freezer_drawer_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { Store_temp: Store_temp,Store_name: Store_name}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#oStore_name').html(data)}, // On success, it will populate the 2nd select
error : function(){alert('An Error Has Occurred')} //error message
})
}
});
});
</script>
<!--Change dropdown for storage if the sample no longer exists-->
<script type="text/javascript">
$(document).ready(function() {
var temp = $("#oStore_temp").val();
var name = $("#oStore_name").val();
$('.orig_sample_exist').click(function(event) { //on click
if(this.checked) { // check select status
$('.orig_sample_exist').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
$("#oStore_temp").val("Used");
$("#oStore_name").html("<option value='Used'>Used</option>");
});
}else{
$('.orig_sample_exist').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
$("#oStore_temp").val(temp);
//$("#oStore_name").val(name);
if(name == '0'){
$("#oStore_name").html('<option value='+name+'>-Select-</option>');
}
else{
$("#oStore_name").html('<option value='+name+'>'+name+'</option>');
}
});
}
});
});
</script>
<!--DNA extraction storage-->
<script type="text/javascript">
$(document).ready(function(){
$('#dStore_temp').change(function(){ //on change event
var Store_temp = $('#dStore_temp').val(); //<----- get the value from the parent select
if(Store_temp == 'Used'){
$('#DNA_sample_exist-2').prop('checked',true);
}else if(Store_temp == 0){
$('#DNA_sample_exist-1').prop('checked',true);
}else{
$('#DNA_sample_exist-0').prop('checked',true);
}
var Store_name = "dStore_name";
$.ajax({
url : root+'freezer_drawer_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { Store_temp: Store_temp,Store_name: Store_name}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#dStore_name').html(data)}, // On success, it will populate the 2nd select
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--RNA extraction storage-->
<script type="text/javascript">
$(document).ready(function(){
$('#rStore_temp').change(function(){ //on change event
var Store_temp = $('#rStore_temp').val(); //<----- get the value from the parent select
if(Store_temp == 'Used'){
$('#RNA_sample_exist-2').prop('checked',true);
}else if(Store_temp == 0){
$('#RNA_sample_exist-1').prop('checked',true);
}else{
$('#RNA_sample_exist-0').prop('checked',true);
}
var Store_name = "rStore_name";
$.ajax({
url : root+'freezer_drawer_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { Store_temp: Store_temp,Store_name: Store_name}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#rStore_name').html(data)}, // On success, it will populate the 2nd select
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--general storage-->
<script type="text/javascript">
$(document).ready(function(){
$('#Store_temp').change(function(){ //on change event
var Store_temp = $('#Store_temp').val(); //<----- get the value from the parent select
var Store_name = "Store_name";
$.ajax({
url : root+'freezer_drawer_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { Store_temp: Store_temp,Store_name: Store_name}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#Store_name').html(data)}, // On success, it will populate the 2nd select
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--custom alert box-->
<script>
function CustomAlert(){
this.render = function(dialog){
var winW = window.innerWidth;
var winH = window.innerHeight;
var dialogoverlay = document.getElementById('dialogoverlay');
var dialogbox = document.getElementById('dialogbox');
dialogoverlay.style.display = "block"; /*not none anymore*/
dialogoverlay.style.height = winH+"px";
dialogbox.style.left = (winW/2) - (555 * .5) + "px";
dialogbox.style.top = "100px";
dialogbox.style.display = "block";
document.getElementById('dialogboxhead').innerHTML = "Acknowledge This Message";
document.getElementById('dialogboxbody').innerHTML = dialog;
document.getElementById('dialogboxfoot').innerHTML = '<button onclick="Alert.ok()">OK</button';
}
this.ok = function(){
//remove the dialog box and the overlay once you hit ok
document.getElementById('dialogbox').style.display = "none";
document.getElementById('dialogoverlay').style.display = "none";
}
this.render2 = function(dialog){
var winW = window.innerWidth;
var winH = window.innerHeight;
var dialogoverlay = document.getElementById('dialogoverlay');
var dialogbox = document.getElementById('dialogbox');
dialogoverlay.style.display = "block"; /*not none anymore*/
dialogoverlay.style.height = winH+"px";
dialogbox.style.left = (winW/2) - (555 * .5) + "px";
dialogbox.style.top = "100px";
dialogbox.style.display = "block";
document.getElementById('dialogboxhead').innerHTML = "Acknowledge This Message";
document.getElementById('dialogboxbody').innerHTML = dialog;
document.getElementById('dialogboxfoot').innerHTML = '<button onclick="Alert.ok2()">OK</button';
}
this.ok2 = function(){
goBack();
}
function goBack() {
window.history.back();
}
}
var Alert = new CustomAlert();
</script>
<div id="dialogoverlay"></div>
<div id="dialogbox">
<div>
<div id="dialogboxhead"></div>
<div id="dialogboxbody"></div>
<div id="dialogboxfoot"></div>
</div>
</div>
<!--If Sample Type is not an Sample, set flow rate to zero-->
<script type="text/javascript">
$(document).ready(function(){
$('#sType').change(function(){ //on change event
var sType = $('#sType').val(); //<----- get the value from the parent select
var pooled_flag = $('#pooled_flag').val();
if (pooled_flag == "P" && sType != 'P') {//assume coriolis and commonly used 300
Alert.render("Warning: Sample is a pooled sample. Are you sure you want to change sample type?");
}
if(pooled_flag != "P" && sType == 'P'){
Alert.render("Warning: Pooled Sample Type Only For Pooling Samples Already Existing In DB");
}
});
});
</script>
<!--Pick Sensor Info-->
<script type="text/javascript">
$(document).ready(function(){
$('#sens_num').change(function(){ //on button click event
var num_sensors = $('#sens_num').val(); //<----- get the value from the parent select
//alert(num_sensors);
$.ajax({
url : root+'daily_data/sensor_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { num_sensors: num_sensors}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#div1').html(data)}, // On success, it will populate the div
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--Pick Samplers Info-->
<script type="text/javascript">
//var old_sampler_num = $("#sampler_num").val();
$(document).ready(function(){
var previous;
$("select[id=sampler_num]").on("focus",function () {
previous = this.value;
}).change(function() {
var value = this.value;
//alert('Old Value : '+previous+' New Value : '+value);
var sampler_num = value;
var old_sampler_num = previous;
//my samplers
var my_samplers = [];
var start_dates = [];
var end_dates = [];
var start_times = [];
var end_times = [];
for ( var x = 1; x <= sampler_num; x++) {
var mySampler = $("#mySamp"+x).val();
my_samplers[x] = mySampler;
var sdate = $("#sdate"+x).val();
start_dates[x] = sdate;
var edate = $("#edate"+x).val();
end_dates[x] = edate;
var stime = $("#stime"+x).val();
start_times[x] = stime;
var etime = $("#etime"+x).val();
end_times[x] = etime;
}
$.ajax({
url : root+'sample_insert/sampler_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { num_my_samplers: sampler_num,
old_num_my_samplers: old_sampler_num,
my_samplers:my_samplers,
start_dates:start_dates,
end_dates:end_dates,
start_times:start_times,
end_times:end_times}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#div_sampler_num').html(data)}, // On success, it will populate the div
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--pick sample names-->
<script type="text/javascript">
$(document).ready(function(){
$('#projName').change(function(){ //on button click event
var start_date = $('#smydate').val();
var end_date = $('#emydate').val();
var projName = $('#projName').val(); //<----- get the value from the parent select
//alert(num_sensors);
$.ajax({
url : root+'sequencing/sample_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { projName: projName,
start_date:start_date,
end_date:end_date}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#sampleSelect').html(data)}, // On success, it will populate the div
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--Pick Sample Pooling Info-->
<script type="text/javascript">
$(document).ready(function(){
$('#pool_num').change(function(){ //on button click event
var num_pooled_samples = $('#pool_num').val(); //<----- get the value from the parent select
//alert(num_sensors);
$.ajax({
url : root+'pooling/pool_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { num_pooled_samples: num_pooled_samples}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#div_pool').html(data)}, // On success, it will populate the div
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--show options for amplicon sequencing-->
<script type="text/javascript">
$(document).ready(function(){
$('#sample_type').change(function(){ //on button click event
var sample_type = $('#sample_type').val(); //<----- get the value from the parent select
//alert(num_sensors);
$.ajax({
url : root+'sequencing/amplicon_div_select.php', //the url you are sending datas to which will again send the result
type : 'GET', //type of request, GET or POST
data : { sample_type: sample_type}, //Data you are sending
//success : function(data){$('#div_store').html(data)},
success : function(data){$('#amplicon_info').html(data)}, // On success, it will populate the div
error : function(){alert('An Error Has Occurred')} //error message
})
});
});
</script>
<!--select all checkboxes-->
<script type="text/javascript">
$(document).ready(function() {
$('#selecctall').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox1').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
</script>
<!--select all 'yes' checkboxes on sequencing submission form-->
<script type="text/javascript">
$(document).ready(function() {
$('#selecctallyes').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox2').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox2').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
</script>
<!--select all 'no' checkboxes on sequencing submission form-->
<script type="text/javascript">
$(document).ready(function() {
$('#selecctallno').click(function(event) { //on click
if(this.checked) { // check select status
$('.checkbox3').each(function() { //loop through each checkbox
this.checked = true; //select all checkboxes with class "checkbox1"
});
}else{
$('.checkbox3').each(function() { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "checkbox1"
});
}
});
});
</script>
<!--if sample is part of a pool, disable the sample input page for editing-->
<script type="text/javascript">
$(document).ready(function(){
if(document.getElementById('part_of_pool')){
var part_of_sample = document.getElementById('part_of_pool').value;
if(part_of_sample == 'Y'){
Alert.render2("Notice: Sample Is Now Part Of A Pool. Original Sample Cannot Be Edited. See Query Info Tab To Explore Sample Info");
}
}
});
</script>